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

76 lines
2.9 KiB
Plaintext

var $2ohTN$reactariautils = require("@react-aria/utils");
var $2ohTN$react = require("react");
var $2ohTN$reactariainteractions = require("@react-aria/interactions");
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$export$a966af930f325cab);
$parcel$export(module.exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$export$439d29a4e110a164);
/*
* 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.
*/
const $b5c81b25cdf7a43c$var$styles = {
border: 0,
clip: 'rect(0 0 0 0)',
clipPath: 'inset(50%)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: 0,
position: 'absolute',
width: '1px',
whiteSpace: 'nowrap'
};
function $b5c81b25cdf7a43c$export$a966af930f325cab(props = {}) {
let { style: style, isFocusable: isFocusable } = props;
let [isFocused, setFocused] = (0, $2ohTN$react.useState)(false);
let { focusWithinProps: focusWithinProps } = (0, $2ohTN$reactariainteractions.useFocusWithin)({
isDisabled: !isFocusable,
onFocusWithinChange: (val)=>setFocused(val)
});
// If focused, don't hide the element.
let combinedStyles = (0, $2ohTN$react.useMemo)(()=>{
if (isFocused) return style;
else if (style) return {
...$b5c81b25cdf7a43c$var$styles,
...style
};
else return $b5c81b25cdf7a43c$var$styles;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
isFocused
]);
return {
visuallyHiddenProps: {
...focusWithinProps,
style: combinedStyles
}
};
}
function $b5c81b25cdf7a43c$export$439d29a4e110a164(props) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let { children: children, elementType: Element = 'div', isFocusable: isFocusable, style: style, ...otherProps } = props;
let { visuallyHiddenProps: visuallyHiddenProps } = $b5c81b25cdf7a43c$export$a966af930f325cab(props);
return /*#__PURE__*/ (0, ($parcel$interopDefault($2ohTN$react))).createElement(Element, (0, $2ohTN$reactariautils.mergeProps)(otherProps, visuallyHiddenProps), children);
}
//# sourceMappingURL=VisuallyHidden.main.js.map