@react-aria/visually-hidden 3.6.1 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +77 -0
- package/package.json +10 -5
package/dist/import.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {mergeProps as $9BxnE$mergeProps} from "@react-aria/utils";
|
|
2
|
+
import $9BxnE$react, {useState as $9BxnE$useState, useMemo as $9BxnE$useMemo} from "react";
|
|
3
|
+
import {useFocusWithin as $9BxnE$useFocusWithin} from "@react-aria/interactions";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/ /*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const $5c3e21d68f1c4674$var$styles = {
|
|
29
|
+
border: 0,
|
|
30
|
+
clip: "rect(0 0 0 0)",
|
|
31
|
+
clipPath: "inset(50%)",
|
|
32
|
+
height: 1,
|
|
33
|
+
margin: "0 -1px -1px 0",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
padding: 0,
|
|
36
|
+
position: "absolute",
|
|
37
|
+
width: 1,
|
|
38
|
+
whiteSpace: "nowrap"
|
|
39
|
+
};
|
|
40
|
+
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
|
|
41
|
+
let { style: style , isFocusable: isFocusable } = props;
|
|
42
|
+
let [isFocused, setFocused] = (0, $9BxnE$useState)(false);
|
|
43
|
+
let { focusWithinProps: focusWithinProps } = (0, $9BxnE$useFocusWithin)({
|
|
44
|
+
isDisabled: !isFocusable,
|
|
45
|
+
onFocusWithinChange: (val)=>setFocused(val)
|
|
46
|
+
});
|
|
47
|
+
// If focused, don't hide the element.
|
|
48
|
+
let combinedStyles = (0, $9BxnE$useMemo)(()=>{
|
|
49
|
+
if (isFocused) return style;
|
|
50
|
+
else if (style) return {
|
|
51
|
+
...$5c3e21d68f1c4674$var$styles,
|
|
52
|
+
...style
|
|
53
|
+
};
|
|
54
|
+
else return $5c3e21d68f1c4674$var$styles;
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
}, [
|
|
57
|
+
isFocused
|
|
58
|
+
]);
|
|
59
|
+
return {
|
|
60
|
+
visuallyHiddenProps: {
|
|
61
|
+
...focusWithinProps,
|
|
62
|
+
style: combinedStyles
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
|
+
let { children: children , elementType: Element = "div" , isFocusable: isFocusable , style: style , ...otherProps } = props;
|
|
69
|
+
let { visuallyHiddenProps: visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
|
|
70
|
+
return /*#__PURE__*/ (0, $9BxnE$react).createElement(Element, (0, $9BxnE$mergeProps)(otherProps, visuallyHiddenProps), children);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
export {$5c3e21d68f1c4674$export$a966af930f325cab as useVisuallyHidden, $5c3e21d68f1c4674$export$439d29a4e110a164 as VisuallyHidden};
|
|
77
|
+
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/visually-hidden",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"types": "./dist/types.d.ts",
|
|
10
|
+
"import": "./dist/import.mjs",
|
|
11
|
+
"require": "./dist/main.js"
|
|
12
|
+
},
|
|
8
13
|
"types": "dist/types.d.ts",
|
|
9
14
|
"source": "src/index.ts",
|
|
10
15
|
"files": [
|
|
@@ -19,9 +24,9 @@
|
|
|
19
24
|
"url": "https://github.com/adobe/react-spectrum"
|
|
20
25
|
},
|
|
21
26
|
"dependencies": {
|
|
22
|
-
"@react-aria/interactions": "^3.
|
|
23
|
-
"@react-aria/utils": "^3.
|
|
24
|
-
"@react-types/shared": "^3.
|
|
27
|
+
"@react-aria/interactions": "^3.14.0",
|
|
28
|
+
"@react-aria/utils": "^3.15.0",
|
|
29
|
+
"@react-types/shared": "^3.17.0",
|
|
25
30
|
"@swc/helpers": "^0.4.14",
|
|
26
31
|
"clsx": "^1.1.1"
|
|
27
32
|
},
|
|
@@ -31,5 +36,5 @@
|
|
|
31
36
|
"publishConfig": {
|
|
32
37
|
"access": "public"
|
|
33
38
|
},
|
|
34
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "a0efee84aa178cb1a202951dfd6d8de02b292307"
|
|
35
40
|
}
|