@react-aria/visually-hidden 3.8.9 → 3.8.11

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.
@@ -0,0 +1,75 @@
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
@@ -0,0 +1 @@
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, 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) {\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"}
@@ -0,0 +1,65 @@
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.mjs.map
@@ -0,0 +1,65 @@
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
@@ -0,0 +1 @@
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, 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) {\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/import.mjs CHANGED
@@ -1,18 +1,6 @@
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";
1
+ import {useVisuallyHidden as $5c3e21d68f1c4674$export$a966af930f325cab, VisuallyHidden as $5c3e21d68f1c4674$export$439d29a4e110a164} from "./VisuallyHidden.mjs";
4
2
 
5
3
  /*
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
4
  * Copyright 2020 Adobe. All rights reserved.
17
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
6
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -25,53 +13,5 @@ import {useFocusWithin as $9BxnE$useFocusWithin} from "@react-aria/interactions"
25
13
  */
26
14
 
27
15
 
28
- const $5c3e21d68f1c4674$var$styles = {
29
- border: 0,
30
- clip: "rect(0 0 0 0)",
31
- clipPath: "inset(50%)",
32
- height: "1px",
33
- margin: "-1px",
34
- overflow: "hidden",
35
- padding: 0,
36
- position: "absolute",
37
- width: "1px",
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
16
  export {$5c3e21d68f1c4674$export$a966af930f325cab as useVisuallyHidden, $5c3e21d68f1c4674$export$439d29a4e110a164 as VisuallyHidden};
77
17
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,29 +1,13 @@
1
- var $2Agrv$reactariautils = require("@react-aria/utils");
2
- var $2Agrv$react = require("react");
3
- var $2Agrv$reactariainteractions = require("@react-aria/interactions");
1
+ var $b5c81b25cdf7a43c$exports = require("./VisuallyHidden.main.js");
4
2
 
5
3
 
6
4
  function $parcel$export(e, n, v, s) {
7
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
6
  }
9
7
 
10
- function $parcel$interopDefault(a) {
11
- return a && a.__esModule ? a.default : a;
12
- }
13
-
14
- $parcel$export(module.exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$export$a966af930f325cab);
15
- $parcel$export(module.exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$export$439d29a4e110a164);
8
+ $parcel$export(module.exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$exports.useVisuallyHidden);
9
+ $parcel$export(module.exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$exports.VisuallyHidden);
16
10
  /*
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
11
  * Copyright 2020 Adobe. All rights reserved.
28
12
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
13
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -36,52 +20,4 @@ $parcel$export(module.exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$export$
36
20
  */
37
21
 
38
22
 
39
- const $b5c81b25cdf7a43c$var$styles = {
40
- border: 0,
41
- clip: "rect(0 0 0 0)",
42
- clipPath: "inset(50%)",
43
- height: "1px",
44
- margin: "-1px",
45
- overflow: "hidden",
46
- padding: 0,
47
- position: "absolute",
48
- width: "1px",
49
- whiteSpace: "nowrap"
50
- };
51
- function $b5c81b25cdf7a43c$export$a966af930f325cab(props = {}) {
52
- let { style: style, isFocusable: isFocusable } = props;
53
- let [isFocused, setFocused] = (0, $2Agrv$react.useState)(false);
54
- let { focusWithinProps: focusWithinProps } = (0, $2Agrv$reactariainteractions.useFocusWithin)({
55
- isDisabled: !isFocusable,
56
- onFocusWithinChange: (val)=>setFocused(val)
57
- });
58
- // If focused, don't hide the element.
59
- let combinedStyles = (0, $2Agrv$react.useMemo)(()=>{
60
- if (isFocused) return style;
61
- else if (style) return {
62
- ...$b5c81b25cdf7a43c$var$styles,
63
- ...style
64
- };
65
- else return $b5c81b25cdf7a43c$var$styles;
66
- // eslint-disable-next-line react-hooks/exhaustive-deps
67
- }, [
68
- isFocused
69
- ]);
70
- return {
71
- visuallyHiddenProps: {
72
- ...focusWithinProps,
73
- style: combinedStyles
74
- }
75
- };
76
- }
77
- function $b5c81b25cdf7a43c$export$439d29a4e110a164(props) {
78
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
79
- let { children: children, elementType: Element = "div", isFocusable: isFocusable, style: style, ...otherProps } = props;
80
- let { visuallyHiddenProps: visuallyHiddenProps } = $b5c81b25cdf7a43c$export$a966af930f325cab(props);
81
- return /*#__PURE__*/ (0, ($parcel$interopDefault($2Agrv$react))).createElement(Element, (0, $2Agrv$reactariautils.mergeProps)(otherProps, visuallyHiddenProps), children);
82
- }
83
-
84
-
85
-
86
-
87
23
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;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;;CDxFC","sources":["packages/@react-aria/visually-hidden/src/index.ts","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 */\nexport {useVisuallyHidden, VisuallyHidden} from './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';\n","/*\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, 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) {\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":"main.js.map"}
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 './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,18 +1,6 @@
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";
1
+ import {useVisuallyHidden as $5c3e21d68f1c4674$export$a966af930f325cab, VisuallyHidden as $5c3e21d68f1c4674$export$439d29a4e110a164} from "./VisuallyHidden.module.js";
4
2
 
5
3
  /*
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
4
  * Copyright 2020 Adobe. All rights reserved.
17
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
6
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -25,53 +13,5 @@ import {useFocusWithin as $9BxnE$useFocusWithin} from "@react-aria/interactions"
25
13
  */
26
14
 
27
15
 
28
- const $5c3e21d68f1c4674$var$styles = {
29
- border: 0,
30
- clip: "rect(0 0 0 0)",
31
- clipPath: "inset(50%)",
32
- height: "1px",
33
- margin: "-1px",
34
- overflow: "hidden",
35
- padding: 0,
36
- position: "absolute",
37
- width: "1px",
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
16
  export {$5c3e21d68f1c4674$export$a966af930f325cab as useVisuallyHidden, $5c3e21d68f1c4674$export$439d29a4e110a164 as VisuallyHidden};
77
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;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;;CDxFC","sources":["packages/@react-aria/visually-hidden/src/index.ts","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 */\nexport {useVisuallyHidden, VisuallyHidden} from './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';\n","/*\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, 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) {\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":"module.js.map"}
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 './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/visually-hidden",
3
- "version": "3.8.9",
3
+ "version": "3.8.11",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -24,9 +24,9 @@
24
24
  "url": "https://github.com/adobe/react-spectrum"
25
25
  },
26
26
  "dependencies": {
27
- "@react-aria/interactions": "^3.21.0",
28
- "@react-aria/utils": "^3.23.1",
29
- "@react-types/shared": "^3.22.0",
27
+ "@react-aria/interactions": "^3.21.2",
28
+ "@react-aria/utils": "^3.24.0",
29
+ "@react-types/shared": "^3.23.0",
30
30
  "@swc/helpers": "^0.5.0"
31
31
  },
32
32
  "peerDependencies": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "f040ff62678e6a31375b96c05396df0bae660350"
38
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
39
39
  }