Files
NapCatQQ/.pnpm-store/v3/files/9e/f275c94efaddea88525efacc7a0b5841de183d07bff3e341593f407f57475ae92eea387644e469fcfb69c5e9ce6129c71d73dc9d79c6746072dc17bb86f920
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

62 lines
2.7 KiB
Plaintext

var $8TwZf$reactariautils = require("@react-aria/utils");
var $8TwZf$reactariainteractions = require("@react-aria/interactions");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useLink", () => $fbe6b19572273b2f$export$dcf14c9974fe2767);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onClick: onClick, isDisabled: isDisabled, ...otherProps } = props;
let linkProps = {};
if (elementType !== 'a') linkProps = {
role: 'link',
tabIndex: !isDisabled ? 0 : undefined
};
let { focusableProps: focusableProps } = (0, $8TwZf$reactariainteractions.useFocusable)(props, ref);
let { pressProps: pressProps, isPressed: isPressed } = (0, $8TwZf$reactariainteractions.usePress)({
onPress: onPress,
onPressStart: onPressStart,
onPressEnd: onPressEnd,
onClick: onClick,
isDisabled: isDisabled,
ref: ref
});
let domProps = (0, $8TwZf$reactariautils.filterDOMProps)(otherProps, {
labelable: true
});
let interactionHandlers = (0, $8TwZf$reactariautils.mergeProps)(focusableProps, pressProps);
let router = (0, $8TwZf$reactariautils.useRouter)();
let routerLinkProps = (0, $8TwZf$reactariautils.useLinkProps)(props);
return {
isPressed: isPressed,
linkProps: (0, $8TwZf$reactariautils.mergeProps)(domProps, routerLinkProps, {
...interactionHandlers,
...linkProps,
'aria-disabled': isDisabled || undefined,
'aria-current': props['aria-current'],
onClick: (e)=>{
var _pressProps_onClick;
(_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
(0, $8TwZf$reactariautils.handleLinkClick)(e, router, props.href, props.routerOptions);
}
})
};
}
//# sourceMappingURL=useLink.main.js.map