@react-aria/visually-hidden 3.8.30 → 3.9.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 +2 -2
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +15 -14
- package/src/index.ts +3 -2
- package/dist/VisuallyHidden.main.js +0 -75
- package/dist/VisuallyHidden.main.js.map +0 -1
- package/dist/VisuallyHidden.mjs +0 -65
- package/dist/VisuallyHidden.module.js +0 -65
- package/dist/VisuallyHidden.module.js.map +0 -1
- package/dist/types.d.ts +0 -28
- package/dist/types.d.ts.map +0 -1
- package/src/VisuallyHidden.tsx +0 -99
package/dist/import.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useVisuallyHidden as $
|
|
1
|
+
import {useVisuallyHidden as $642aad87f320f5a1$re_export$useVisuallyHidden, VisuallyHidden as $642aad87f320f5a1$re_export$VisuallyHidden} from "react-aria/VisuallyHidden";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useVisuallyHidden as $5c3e21d68f1c4674$export$a966af930f325cab, Visually
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$
|
|
16
|
+
export {$642aad87f320f5a1$re_export$useVisuallyHidden as useVisuallyHidden, $642aad87f320f5a1$re_export$VisuallyHidden as VisuallyHidden};
|
|
17
17
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $l51OL$reactariaVisuallyHidden = require("react-aria/VisuallyHidden");
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
$parcel$export(module.exports, "useVisuallyHidden", ()
|
|
9
|
-
$parcel$export(module.exports, "VisuallyHidden", ()
|
|
8
|
+
$parcel$export(module.exports, "useVisuallyHidden", function () { return $l51OL$reactariaVisuallyHidden.useVisuallyHidden; });
|
|
9
|
+
$parcel$export(module.exports, "VisuallyHidden", function () { return $l51OL$reactariaVisuallyHidden.VisuallyHidden; });
|
|
10
10
|
/*
|
|
11
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
12
12
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/visually-hidden/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useVisuallyHidden, VisuallyHidden} from '
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/visually-hidden/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useVisuallyHidden, VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from 'react-aria/VisuallyHidden';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useVisuallyHidden as $
|
|
1
|
+
import {useVisuallyHidden as $642aad87f320f5a1$re_export$useVisuallyHidden, VisuallyHidden as $642aad87f320f5a1$re_export$VisuallyHidden} from "react-aria/VisuallyHidden";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useVisuallyHidden as $5c3e21d68f1c4674$export$a966af930f325cab, Visually
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$
|
|
16
|
+
export {$642aad87f320f5a1$re_export$useVisuallyHidden as useVisuallyHidden, $642aad87f320f5a1$re_export$VisuallyHidden as VisuallyHidden};
|
|
17
17
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/visually-hidden/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useVisuallyHidden, VisuallyHidden} from '
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/visually-hidden/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useVisuallyHidden, VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from 'react-aria/VisuallyHidden';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/visually-hidden",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.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
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -28,10 +28,8 @@
|
|
|
28
28
|
"url": "https://github.com/adobe/react-spectrum"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"@react-types/shared": "^3.33.0",
|
|
34
|
-
"@swc/helpers": "^0.5.0"
|
|
31
|
+
"@swc/helpers": "^0.5.0",
|
|
32
|
+
"react-aria": "3.48.0"
|
|
35
33
|
},
|
|
36
34
|
"peerDependencies": {
|
|
37
35
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -40,5 +38,8 @@
|
|
|
40
38
|
"publishConfig": {
|
|
41
39
|
"access": "public"
|
|
42
40
|
},
|
|
43
|
-
"
|
|
41
|
+
"targets": {
|
|
42
|
+
"types": false
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
44
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
export {useVisuallyHidden, VisuallyHidden} from '
|
|
13
|
-
|
|
12
|
+
export {useVisuallyHidden, VisuallyHidden} from 'react-aria/VisuallyHidden';
|
|
13
|
+
|
|
14
|
+
export type {VisuallyHiddenAria, VisuallyHiddenProps} from 'react-aria/VisuallyHidden';
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var $2ohTN$reactariautils = require("@react-aria/utils");
|
|
2
|
-
var $2ohTN$react = require("react");
|
|
3
|
-
var $2ohTN$reactariainteractions = require("@react-aria/interactions");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function $parcel$interopDefault(a) {
|
|
7
|
-
return a && a.__esModule ? a.default : a;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function $parcel$export(e, n, v, s) {
|
|
11
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
$parcel$export(module.exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$export$a966af930f325cab);
|
|
15
|
-
$parcel$export(module.exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$export$439d29a4e110a164);
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const $b5c81b25cdf7a43c$var$styles = {
|
|
30
|
-
border: 0,
|
|
31
|
-
clip: 'rect(0 0 0 0)',
|
|
32
|
-
clipPath: 'inset(50%)',
|
|
33
|
-
height: '1px',
|
|
34
|
-
margin: '-1px',
|
|
35
|
-
overflow: 'hidden',
|
|
36
|
-
padding: 0,
|
|
37
|
-
position: 'absolute',
|
|
38
|
-
width: '1px',
|
|
39
|
-
whiteSpace: 'nowrap'
|
|
40
|
-
};
|
|
41
|
-
function $b5c81b25cdf7a43c$export$a966af930f325cab(props = {}) {
|
|
42
|
-
let { style: style, isFocusable: isFocusable } = props;
|
|
43
|
-
let [isFocused, setFocused] = (0, $2ohTN$react.useState)(false);
|
|
44
|
-
let { focusWithinProps: focusWithinProps } = (0, $2ohTN$reactariainteractions.useFocusWithin)({
|
|
45
|
-
isDisabled: !isFocusable,
|
|
46
|
-
onFocusWithinChange: (val)=>setFocused(val)
|
|
47
|
-
});
|
|
48
|
-
// If focused, don't hide the element.
|
|
49
|
-
let combinedStyles = (0, $2ohTN$react.useMemo)(()=>{
|
|
50
|
-
if (isFocused) return style;
|
|
51
|
-
else if (style) return {
|
|
52
|
-
...$b5c81b25cdf7a43c$var$styles,
|
|
53
|
-
...style
|
|
54
|
-
};
|
|
55
|
-
else return $b5c81b25cdf7a43c$var$styles;
|
|
56
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
-
}, [
|
|
58
|
-
isFocused
|
|
59
|
-
]);
|
|
60
|
-
return {
|
|
61
|
-
visuallyHiddenProps: {
|
|
62
|
-
...focusWithinProps,
|
|
63
|
-
style: combinedStyles
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function $b5c81b25cdf7a43c$export$439d29a4e110a164(props) {
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
-
let { children: children, elementType: Element = 'div', isFocusable: isFocusable, style: style, ...otherProps } = props;
|
|
70
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = $b5c81b25cdf7a43c$export$a966af930f325cab(props);
|
|
71
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($2ohTN$react))).createElement(Element, (0, $2ohTN$reactariautils.mergeProps)(otherProps, visuallyHiddenProps), children);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=VisuallyHidden.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAqBD,MAAM,+BAAwB;IAC5B,QAAQ;IACR,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;IACV,OAAO;IACP,YAAY;AACd;AAUO,SAAS,0CAAkB,QAA6B,CAAC,CAAC;IAC/D,IAAI,SACF,KAAK,eACL,WAAW,EACZ,GAAG;IAEJ,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB,CAAC,MAAQ,WAAW;IAC3C;IAEA,sCAAsC;IACtC,IAAI,iBAAiB,CAAA,GAAA,oBAAM,EAAE;QAC3B,IAAI,WACF,OAAO;aACF,IAAI,OACT,OAAO;YAAC,GAAG,4BAAM;YAAE,GAAG,KAAK;QAAA;aAE3B,OAAO;IAEX,uDAAuD;IACvD,GAAG;QAAC;KAAU;IAEd,OAAO;QACL,qBAAqB;YACnB,GAAG,gBAAgB;YACnB,OAAO;QACT;IACF;AACF;AAMO,SAAS,0CAAe,KAA0B;IACvD,6DAA6D;IAC7D,IAAI,YAAC,QAAQ,EAAE,aAAa,UAAU,KAAK,eAAE,WAAW,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IAClF,IAAI,uBAAC,mBAAmB,EAAC,GAAG,0CAAkB;IAE9C,qBACE,0DAAC,SAAY,CAAA,GAAA,gCAAS,EAAE,YAAY,sBACjC;AAGP","sources":["packages/@react-aria/visually-hidden/src/VisuallyHidden.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, JSX, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface VisuallyHiddenProps extends DOMAttributes {\n /** The content to visually hide. */\n children?: ReactNode,\n\n /**\n * The element type for the container.\n * @default 'div'\n */\n elementType?: string | JSXElementConstructor<any>,\n\n /** Whether the element should become visible on focus, for example skip links. */\n isFocusable?: boolean\n}\n\nconst styles: CSSProperties = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap'\n};\n\nexport interface VisuallyHiddenAria {\n visuallyHiddenProps: DOMAttributes\n}\n\n/**\n * Provides props for an element that hides its children visually\n * but keeps content visible to assistive technology.\n */\nexport function useVisuallyHidden(props: VisuallyHiddenProps = {}): VisuallyHiddenAria {\n let {\n style,\n isFocusable\n } = props;\n\n let [isFocused, setFocused] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !isFocusable,\n onFocusWithinChange: (val) => setFocused(val)\n });\n\n // If focused, don't hide the element.\n let combinedStyles = useMemo(() => {\n if (isFocused) {\n return style;\n } else if (style) {\n return {...styles, ...style};\n } else {\n return styles;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusWithinProps,\n style: combinedStyles\n }\n };\n}\n\n/**\n * VisuallyHidden hides its children visually, while keeping content visible\n * to screen readers.\n */\nexport function VisuallyHidden(props: VisuallyHiddenProps): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {children, elementType: Element = 'div', isFocusable, style, ...otherProps} = props;\n let {visuallyHiddenProps} = useVisuallyHidden(props);\n\n return (\n <Element {...mergeProps(otherProps, visuallyHiddenProps)}>\n {children}\n </Element>\n );\n}\n"],"names":[],"version":3,"file":"VisuallyHidden.main.js.map"}
|
package/dist/VisuallyHidden.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {mergeProps as $7JYt2$mergeProps} from "@react-aria/utils";
|
|
2
|
-
import $7JYt2$react, {useState as $7JYt2$useState, useMemo as $7JYt2$useMemo} from "react";
|
|
3
|
-
import {useFocusWithin as $7JYt2$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
|
-
|
|
17
|
-
|
|
18
|
-
const $5c3e21d68f1c4674$var$styles = {
|
|
19
|
-
border: 0,
|
|
20
|
-
clip: 'rect(0 0 0 0)',
|
|
21
|
-
clipPath: 'inset(50%)',
|
|
22
|
-
height: '1px',
|
|
23
|
-
margin: '-1px',
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
padding: 0,
|
|
26
|
-
position: 'absolute',
|
|
27
|
-
width: '1px',
|
|
28
|
-
whiteSpace: 'nowrap'
|
|
29
|
-
};
|
|
30
|
-
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
|
|
31
|
-
let { style: style, isFocusable: isFocusable } = props;
|
|
32
|
-
let [isFocused, setFocused] = (0, $7JYt2$useState)(false);
|
|
33
|
-
let { focusWithinProps: focusWithinProps } = (0, $7JYt2$useFocusWithin)({
|
|
34
|
-
isDisabled: !isFocusable,
|
|
35
|
-
onFocusWithinChange: (val)=>setFocused(val)
|
|
36
|
-
});
|
|
37
|
-
// If focused, don't hide the element.
|
|
38
|
-
let combinedStyles = (0, $7JYt2$useMemo)(()=>{
|
|
39
|
-
if (isFocused) return style;
|
|
40
|
-
else if (style) return {
|
|
41
|
-
...$5c3e21d68f1c4674$var$styles,
|
|
42
|
-
...style
|
|
43
|
-
};
|
|
44
|
-
else return $5c3e21d68f1c4674$var$styles;
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
}, [
|
|
47
|
-
isFocused
|
|
48
|
-
]);
|
|
49
|
-
return {
|
|
50
|
-
visuallyHiddenProps: {
|
|
51
|
-
...focusWithinProps,
|
|
52
|
-
style: combinedStyles
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
-
let { children: children, elementType: Element = 'div', isFocusable: isFocusable, style: style, ...otherProps } = props;
|
|
59
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
|
|
60
|
-
return /*#__PURE__*/ (0, $7JYt2$react).createElement(Element, (0, $7JYt2$mergeProps)(otherProps, visuallyHiddenProps), children);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export {$5c3e21d68f1c4674$export$a966af930f325cab as useVisuallyHidden, $5c3e21d68f1c4674$export$439d29a4e110a164 as VisuallyHidden};
|
|
65
|
-
//# sourceMappingURL=VisuallyHidden.module.js.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {mergeProps as $7JYt2$mergeProps} from "@react-aria/utils";
|
|
2
|
-
import $7JYt2$react, {useState as $7JYt2$useState, useMemo as $7JYt2$useMemo} from "react";
|
|
3
|
-
import {useFocusWithin as $7JYt2$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
|
-
|
|
17
|
-
|
|
18
|
-
const $5c3e21d68f1c4674$var$styles = {
|
|
19
|
-
border: 0,
|
|
20
|
-
clip: 'rect(0 0 0 0)',
|
|
21
|
-
clipPath: 'inset(50%)',
|
|
22
|
-
height: '1px',
|
|
23
|
-
margin: '-1px',
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
padding: 0,
|
|
26
|
-
position: 'absolute',
|
|
27
|
-
width: '1px',
|
|
28
|
-
whiteSpace: 'nowrap'
|
|
29
|
-
};
|
|
30
|
-
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
|
|
31
|
-
let { style: style, isFocusable: isFocusable } = props;
|
|
32
|
-
let [isFocused, setFocused] = (0, $7JYt2$useState)(false);
|
|
33
|
-
let { focusWithinProps: focusWithinProps } = (0, $7JYt2$useFocusWithin)({
|
|
34
|
-
isDisabled: !isFocusable,
|
|
35
|
-
onFocusWithinChange: (val)=>setFocused(val)
|
|
36
|
-
});
|
|
37
|
-
// If focused, don't hide the element.
|
|
38
|
-
let combinedStyles = (0, $7JYt2$useMemo)(()=>{
|
|
39
|
-
if (isFocused) return style;
|
|
40
|
-
else if (style) return {
|
|
41
|
-
...$5c3e21d68f1c4674$var$styles,
|
|
42
|
-
...style
|
|
43
|
-
};
|
|
44
|
-
else return $5c3e21d68f1c4674$var$styles;
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
}, [
|
|
47
|
-
isFocused
|
|
48
|
-
]);
|
|
49
|
-
return {
|
|
50
|
-
visuallyHiddenProps: {
|
|
51
|
-
...focusWithinProps,
|
|
52
|
-
style: combinedStyles
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
-
let { children: children, elementType: Element = 'div', isFocusable: isFocusable, style: style, ...otherProps } = props;
|
|
59
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
|
|
60
|
-
return /*#__PURE__*/ (0, $7JYt2$react).createElement(Element, (0, $7JYt2$mergeProps)(otherProps, visuallyHiddenProps), children);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export {$5c3e21d68f1c4674$export$a966af930f325cab as useVisuallyHidden, $5c3e21d68f1c4674$export$439d29a4e110a164 as VisuallyHidden};
|
|
65
|
-
//# sourceMappingURL=VisuallyHidden.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAqBD,MAAM,+BAAwB;IAC5B,QAAQ;IACR,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;IACV,OAAO;IACP,YAAY;AACd;AAUO,SAAS,0CAAkB,QAA6B,CAAC,CAAC;IAC/D,IAAI,SACF,KAAK,eACL,WAAW,EACZ,GAAG;IAEJ,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB,CAAC,MAAQ,WAAW;IAC3C;IAEA,sCAAsC;IACtC,IAAI,iBAAiB,CAAA,GAAA,cAAM,EAAE;QAC3B,IAAI,WACF,OAAO;aACF,IAAI,OACT,OAAO;YAAC,GAAG,4BAAM;YAAE,GAAG,KAAK;QAAA;aAE3B,OAAO;IAEX,uDAAuD;IACvD,GAAG;QAAC;KAAU;IAEd,OAAO;QACL,qBAAqB;YACnB,GAAG,gBAAgB;YACnB,OAAO;QACT;IACF;AACF;AAMO,SAAS,0CAAe,KAA0B;IACvD,6DAA6D;IAC7D,IAAI,YAAC,QAAQ,EAAE,aAAa,UAAU,KAAK,eAAE,WAAW,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IAClF,IAAI,uBAAC,mBAAmB,EAAC,GAAG,0CAAkB;IAE9C,qBACE,gCAAC,SAAY,CAAA,GAAA,iBAAS,EAAE,YAAY,sBACjC;AAGP","sources":["packages/@react-aria/visually-hidden/src/VisuallyHidden.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, JSX, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface VisuallyHiddenProps extends DOMAttributes {\n /** The content to visually hide. */\n children?: ReactNode,\n\n /**\n * The element type for the container.\n * @default 'div'\n */\n elementType?: string | JSXElementConstructor<any>,\n\n /** Whether the element should become visible on focus, for example skip links. */\n isFocusable?: boolean\n}\n\nconst styles: CSSProperties = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap'\n};\n\nexport interface VisuallyHiddenAria {\n visuallyHiddenProps: DOMAttributes\n}\n\n/**\n * Provides props for an element that hides its children visually\n * but keeps content visible to assistive technology.\n */\nexport function useVisuallyHidden(props: VisuallyHiddenProps = {}): VisuallyHiddenAria {\n let {\n style,\n isFocusable\n } = props;\n\n let [isFocused, setFocused] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !isFocusable,\n onFocusWithinChange: (val) => setFocused(val)\n });\n\n // If focused, don't hide the element.\n let combinedStyles = useMemo(() => {\n if (isFocused) {\n return style;\n } else if (style) {\n return {...styles, ...style};\n } else {\n return styles;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusWithinProps,\n style: combinedStyles\n }\n };\n}\n\n/**\n * VisuallyHidden hides its children visually, while keeping content visible\n * to screen readers.\n */\nexport function VisuallyHidden(props: VisuallyHiddenProps): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {children, elementType: Element = 'div', isFocusable, style, ...otherProps} = props;\n let {visuallyHiddenProps} = useVisuallyHidden(props);\n\n return (\n <Element {...mergeProps(otherProps, visuallyHiddenProps)}>\n {children}\n </Element>\n );\n}\n"],"names":[],"version":3,"file":"VisuallyHidden.module.js.map"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { DOMAttributes } from "@react-types/shared";
|
|
2
|
-
import { JSX, JSXElementConstructor, ReactNode } from "react";
|
|
3
|
-
export interface VisuallyHiddenProps extends DOMAttributes {
|
|
4
|
-
/** The content to visually hide. */
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
/**
|
|
7
|
-
* The element type for the container.
|
|
8
|
-
* @default 'div'
|
|
9
|
-
*/
|
|
10
|
-
elementType?: string | JSXElementConstructor<any>;
|
|
11
|
-
/** Whether the element should become visible on focus, for example skip links. */
|
|
12
|
-
isFocusable?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface VisuallyHiddenAria {
|
|
15
|
-
visuallyHiddenProps: DOMAttributes;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Provides props for an element that hides its children visually
|
|
19
|
-
* but keeps content visible to assistive technology.
|
|
20
|
-
*/
|
|
21
|
-
export function useVisuallyHidden(props?: VisuallyHiddenProps): VisuallyHiddenAria;
|
|
22
|
-
/**
|
|
23
|
-
* VisuallyHidden hides its children visually, while keeping content visible
|
|
24
|
-
* to screen readers.
|
|
25
|
-
*/
|
|
26
|
-
export function VisuallyHidden(props: VisuallyHiddenProps): JSX.Element;
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;AAiBA,oCAAqC,SAAQ,aAAa;IACxD,oCAAoC;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,CAAC,CAAC;IAElD,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAeD;IACE,mBAAmB,EAAE,aAAa,CAAA;CACnC;AAED;;;GAGG;AACH,kCAAkC,KAAK,GAAE,mBAAwB,GAAG,kBAAkB,CA8BrF;AAED;;;GAGG;AACH,+BAA+B,KAAK,EAAE,mBAAmB,GAAG,IAAI,OAAO,CAUtE","sources":["packages/@react-aria/visually-hidden/src/packages/@react-aria/visually-hidden/src/VisuallyHidden.tsx","packages/@react-aria/visually-hidden/src/packages/@react-aria/visually-hidden/src/index.ts","packages/@react-aria/visually-hidden/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useVisuallyHidden, VisuallyHidden} from './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/src/VisuallyHidden.tsx
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {DOMAttributes} from '@react-types/shared';
|
|
14
|
-
import {mergeProps} from '@react-aria/utils';
|
|
15
|
-
import React, {CSSProperties, JSX, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';
|
|
16
|
-
import {useFocusWithin} from '@react-aria/interactions';
|
|
17
|
-
|
|
18
|
-
export interface VisuallyHiddenProps extends DOMAttributes {
|
|
19
|
-
/** The content to visually hide. */
|
|
20
|
-
children?: ReactNode,
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The element type for the container.
|
|
24
|
-
* @default 'div'
|
|
25
|
-
*/
|
|
26
|
-
elementType?: string | JSXElementConstructor<any>,
|
|
27
|
-
|
|
28
|
-
/** Whether the element should become visible on focus, for example skip links. */
|
|
29
|
-
isFocusable?: boolean
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const styles: CSSProperties = {
|
|
33
|
-
border: 0,
|
|
34
|
-
clip: 'rect(0 0 0 0)',
|
|
35
|
-
clipPath: 'inset(50%)',
|
|
36
|
-
height: '1px',
|
|
37
|
-
margin: '-1px',
|
|
38
|
-
overflow: 'hidden',
|
|
39
|
-
padding: 0,
|
|
40
|
-
position: 'absolute',
|
|
41
|
-
width: '1px',
|
|
42
|
-
whiteSpace: 'nowrap'
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export interface VisuallyHiddenAria {
|
|
46
|
-
visuallyHiddenProps: DOMAttributes
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Provides props for an element that hides its children visually
|
|
51
|
-
* but keeps content visible to assistive technology.
|
|
52
|
-
*/
|
|
53
|
-
export function useVisuallyHidden(props: VisuallyHiddenProps = {}): VisuallyHiddenAria {
|
|
54
|
-
let {
|
|
55
|
-
style,
|
|
56
|
-
isFocusable
|
|
57
|
-
} = props;
|
|
58
|
-
|
|
59
|
-
let [isFocused, setFocused] = useState(false);
|
|
60
|
-
let {focusWithinProps} = useFocusWithin({
|
|
61
|
-
isDisabled: !isFocusable,
|
|
62
|
-
onFocusWithinChange: (val) => setFocused(val)
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// If focused, don't hide the element.
|
|
66
|
-
let combinedStyles = useMemo(() => {
|
|
67
|
-
if (isFocused) {
|
|
68
|
-
return style;
|
|
69
|
-
} else if (style) {
|
|
70
|
-
return {...styles, ...style};
|
|
71
|
-
} else {
|
|
72
|
-
return styles;
|
|
73
|
-
}
|
|
74
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
-
}, [isFocused]);
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
visuallyHiddenProps: {
|
|
79
|
-
...focusWithinProps,
|
|
80
|
-
style: combinedStyles
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* VisuallyHidden hides its children visually, while keeping content visible
|
|
87
|
-
* to screen readers.
|
|
88
|
-
*/
|
|
89
|
-
export function VisuallyHidden(props: VisuallyHiddenProps): JSX.Element {
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
-
let {children, elementType: Element = 'div', isFocusable, style, ...otherProps} = props;
|
|
92
|
-
let {visuallyHiddenProps} = useVisuallyHidden(props);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<Element {...mergeProps(otherProps, visuallyHiddenProps)}>
|
|
96
|
-
{children}
|
|
97
|
-
</Element>
|
|
98
|
-
);
|
|
99
|
-
}
|