@react-aria/visually-hidden 3.2.1 → 3.2.5

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/main.js CHANGED
@@ -1,98 +1,83 @@
1
- var {
2
- useFocus
3
- } = require("@react-aria/interactions");
4
-
5
- var _react2 = require("react");
6
-
7
- var _react = $parcel$interopDefault(_react2);
8
-
9
- var {
10
- useMemo,
11
- useState
12
- } = _react2;
13
-
14
- var {
15
- mergeProps
16
- } = require("@react-aria/utils");
17
-
18
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
1
+ var $l9SOU$reactariautils = require("@react-aria/utils");
2
+ var $l9SOU$react = require("react");
3
+ var $l9SOU$reactariainteractions = require("@react-aria/interactions");
4
+
5
+ function $parcel$exportWildcard(dest, source) {
6
+ Object.keys(source).forEach(function(key) {
7
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
8
+ return;
9
+ }
19
10
 
20
- var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
+ Object.defineProperty(dest, key, {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return source[key];
15
+ }
16
+ });
17
+ });
21
18
 
19
+ return dest;
20
+ }
22
21
  function $parcel$interopDefault(a) {
23
22
  return a && a.__esModule ? a.default : a;
24
23
  }
24
+ function $parcel$export(e, n, v, s) {
25
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
26
+ }
27
+ var $8b518376223642b1$exports = {};
25
28
 
26
- const $c1f76ac3c0285c5bc650b183209bb9$var$styles = {
27
- border: 0,
28
- clip: 'rect(0 0 0 0)',
29
- clipPath: 'inset(50%)',
30
- height: 1,
31
- margin: '0 -1px -1px 0',
32
- overflow: 'hidden',
33
- padding: 0,
34
- position: 'absolute',
35
- width: 1,
36
- whiteSpace: 'nowrap'
37
- };
29
+ $parcel$export($8b518376223642b1$exports, "useVisuallyHidden", () => $8b518376223642b1$export$a966af930f325cab);
30
+ $parcel$export($8b518376223642b1$exports, "VisuallyHidden", () => $8b518376223642b1$export$439d29a4e110a164);
38
31
 
39
- /**
40
- * Provides props for an element that hides its children visually
41
- * but keeps content visible to assistive technology.
42
- */
43
- function useVisuallyHidden(props) {
44
- if (props === void 0) {
45
- props = {};
46
- }
47
32
 
48
- let {
49
- style,
50
- isFocusable
51
- } = props;
52
- let [isFocused, setFocused] = useState(false);
53
- let {
54
- focusProps
55
- } = useFocus({
56
- isDisabled: !isFocusable,
57
- onFocusChange: setFocused
58
- }); // If focused, don't hide the element.
59
33
 
60
- let combinedStyles = useMemo(() => {
61
- if (isFocused) {
62
- return style;
63
- } else if (style) {
64
- return _babelRuntimeHelpersExtends({}, $c1f76ac3c0285c5bc650b183209bb9$var$styles, style);
65
- } else {
66
- return $c1f76ac3c0285c5bc650b183209bb9$var$styles;
67
- }
68
- }, [isFocused]);
69
- return {
70
- visuallyHiddenProps: _babelRuntimeHelpersExtends({}, focusProps, {
71
- style: combinedStyles
72
- })
73
- };
34
+ const $8b518376223642b1$var$styles = {
35
+ border: 0,
36
+ clip: 'rect(0 0 0 0)',
37
+ clipPath: 'inset(50%)',
38
+ height: 1,
39
+ margin: '0 -1px -1px 0',
40
+ overflow: 'hidden',
41
+ padding: 0,
42
+ position: 'absolute',
43
+ width: 1,
44
+ whiteSpace: 'nowrap'
45
+ };
46
+ function $8b518376223642b1$export$a966af930f325cab(props = {
47
+ }) {
48
+ let { style: style , isFocusable: isFocusable } = props;
49
+ let [isFocused, setFocused] = $l9SOU$react.useState(false);
50
+ let { focusProps: focusProps } = $l9SOU$reactariainteractions.useFocus({
51
+ isDisabled: !isFocusable,
52
+ onFocusChange: setFocused
53
+ });
54
+ // If focused, don't hide the element.
55
+ let combinedStyles = $l9SOU$react.useMemo(()=>{
56
+ if (isFocused) return style;
57
+ else if (style) return {
58
+ ...$8b518376223642b1$var$styles,
59
+ ...style
60
+ };
61
+ else return $8b518376223642b1$var$styles;
62
+ }, [
63
+ isFocused
64
+ ]);
65
+ return {
66
+ visuallyHiddenProps: {
67
+ ...focusProps,
68
+ style: combinedStyles
69
+ }
70
+ };
71
+ }
72
+ function $8b518376223642b1$export$439d29a4e110a164(props) {
73
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
74
+ let { children: children , elementType: Element = 'div' , isFocusable: isFocusable , style: style , ...otherProps } = props;
75
+ let { visuallyHiddenProps: visuallyHiddenProps } = $8b518376223642b1$export$a966af930f325cab(props);
76
+ return(/*#__PURE__*/ ($parcel$interopDefault($l9SOU$react)).createElement(Element, $l9SOU$reactariautils.mergeProps(otherProps, visuallyHiddenProps), children));
74
77
  }
75
- /**
76
- * VisuallyHidden hides its children visually, while keeping content visible
77
- * to screen readers.
78
- */
79
-
80
78
 
81
- exports.useVisuallyHidden = useVisuallyHidden;
82
79
 
83
- function VisuallyHidden(props) {
84
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
85
- let {
86
- children,
87
- elementType: Element = 'div'
88
- } = props,
89
- otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["children", "elementType", "isFocusable", "style"]);
80
+ $parcel$exportWildcard(module.exports, $8b518376223642b1$exports);
90
81
 
91
- let {
92
- visuallyHiddenProps
93
- } = useVisuallyHidden(props);
94
- return /*#__PURE__*/_react.createElement(Element, mergeProps(otherProps, visuallyHiddenProps), children);
95
- }
96
82
 
97
- exports.VisuallyHidden = VisuallyHidden;
98
83
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;AC4BD,MAAMG,0CAAqB,GAAG;AAC5BC,EAAAA,MAAM,EAAE,CADoB;AAE5BC,E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B,UAApE,oDAAkFjB,KAAlF;;AACA,MAAI;AAACY,IAAAA;AAAD,MAAwBb,iBAAiB,CAACC,KAAD,CAA7C;AAEA,sBACE,qBAAC,OAAD,EAAakB,UAAU,CAACD,UAAD,EAAaL,mBAAb,CAAvB,EACGE,QADH,CADF;AAKD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/@react-aria/visually-hidden/src/VisuallyHidden.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\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 {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, HTMLAttributes, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocus} from '@react-aria/interactions';\n\ninterface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {\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: 1,\n margin: '0 -1px -1px 0',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: 1,\n whiteSpace: 'nowrap'\n};\n\ninterface VisuallyHiddenAria {\n visuallyHiddenProps: HTMLAttributes<HTMLElement>\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 {focusProps} = useFocus({\n isDisabled: !isFocusable,\n onFocusChange: setFocused\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 }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusProps,\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":["$parcel$interopDefault","a","__esModule","default","styles","border","clip","clipPath","height","margin","overflow","padding","position","width","whiteSpace","useVisuallyHidden","props","style","isFocusable","isFocused","setFocused","useState","focusProps","useFocus","isDisabled","onFocusChange","combinedStyles","useMemo","visuallyHiddenProps","VisuallyHidden","children","elementType","Element","otherProps","mergeProps"],"version":3,"file":"main.js.map"}
1
+ {"mappings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,KAAK,MAAK,UAAU,CAAA,CAAC,GAAG,KAAK;IACvF,GAAG,CAAC,CAAC,sBAAA,mBAAmB,EAAA,CAAC,GAAG,yCAAiB,CAAC,KAAK;IAEnD,MAAM,oEACH,OAAO,EAAK,gCAAU,CAAC,UAAU,EAAE,mBAAmB,GACpD,QAAQ;AAGf,CAAC","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 */\n\nexport * 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 {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, HTMLAttributes, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocus} from '@react-aria/interactions';\n\ninterface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {\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: 1,\n margin: '0 -1px -1px 0',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: 1,\n whiteSpace: 'nowrap'\n};\n\ninterface VisuallyHiddenAria {\n visuallyHiddenProps: HTMLAttributes<HTMLElement>\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 {focusProps} = useFocus({\n isDisabled: !isFocusable,\n onFocusChange: setFocused\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 }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusProps,\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"}
package/dist/module.js CHANGED
@@ -1,73 +1,64 @@
1
- import { useFocus } from "@react-aria/interactions";
2
- import _react, { useMemo, useState } from "react";
3
- import { mergeProps } from "@react-aria/utils";
4
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
5
- import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
6
- const $f431c2c11cc559fa3c5864caafbcfd19$var$styles = {
7
- border: 0,
8
- clip: 'rect(0 0 0 0)',
9
- clipPath: 'inset(50%)',
10
- height: 1,
11
- margin: '0 -1px -1px 0',
12
- overflow: 'hidden',
13
- padding: 0,
14
- position: 'absolute',
15
- width: 1,
16
- whiteSpace: 'nowrap'
17
- };
1
+ import {mergeProps as $hZMlr$mergeProps} from "@react-aria/utils";
2
+ import $hZMlr$react, {useState as $hZMlr$useState, useMemo as $hZMlr$useMemo} from "react";
3
+ import {useFocus as $hZMlr$useFocus} from "@react-aria/interactions";
18
4
 
19
- /**
20
- * Provides props for an element that hides its children visually
21
- * but keeps content visible to assistive technology.
22
- */
23
- export function useVisuallyHidden(props) {
24
- if (props === void 0) {
25
- props = {};
26
- }
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+ var $2b1a1e0abf5e6e14$exports = {};
27
9
 
28
- let {
29
- style,
30
- isFocusable
31
- } = props;
32
- let [isFocused, setFocused] = useState(false);
33
- let {
34
- focusProps
35
- } = useFocus({
36
- isDisabled: !isFocusable,
37
- onFocusChange: setFocused
38
- }); // If focused, don't hide the element.
10
+ $parcel$export($2b1a1e0abf5e6e14$exports, "useVisuallyHidden", () => $2b1a1e0abf5e6e14$export$a966af930f325cab);
11
+ $parcel$export($2b1a1e0abf5e6e14$exports, "VisuallyHidden", () => $2b1a1e0abf5e6e14$export$439d29a4e110a164);
39
12
 
40
- let combinedStyles = useMemo(() => {
41
- if (isFocused) {
42
- return style;
43
- } else if (style) {
44
- return _babelRuntimeHelpersEsmExtends({}, $f431c2c11cc559fa3c5864caafbcfd19$var$styles, style);
45
- } else {
46
- return $f431c2c11cc559fa3c5864caafbcfd19$var$styles;
47
- }
48
- }, [isFocused]);
49
- return {
50
- visuallyHiddenProps: _babelRuntimeHelpersEsmExtends({}, focusProps, {
51
- style: combinedStyles
52
- })
53
- };
54
- }
55
- /**
56
- * VisuallyHidden hides its children visually, while keeping content visible
57
- * to screen readers.
58
- */
59
13
 
60
- export function VisuallyHidden(props) {
61
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
62
- let {
63
- children,
64
- elementType: Element = 'div'
65
- } = props,
66
- otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["children", "elementType", "isFocusable", "style"]);
67
14
 
68
- let {
69
- visuallyHiddenProps
70
- } = useVisuallyHidden(props);
71
- return /*#__PURE__*/_react.createElement(Element, mergeProps(otherProps, visuallyHiddenProps), children);
15
+ const $2b1a1e0abf5e6e14$var$styles = {
16
+ border: 0,
17
+ clip: 'rect(0 0 0 0)',
18
+ clipPath: 'inset(50%)',
19
+ height: 1,
20
+ margin: '0 -1px -1px 0',
21
+ overflow: 'hidden',
22
+ padding: 0,
23
+ position: 'absolute',
24
+ width: 1,
25
+ whiteSpace: 'nowrap'
26
+ };
27
+ function $2b1a1e0abf5e6e14$export$a966af930f325cab(props = {
28
+ }) {
29
+ let { style: style , isFocusable: isFocusable } = props;
30
+ let [isFocused, setFocused] = $hZMlr$useState(false);
31
+ let { focusProps: focusProps } = $hZMlr$useFocus({
32
+ isDisabled: !isFocusable,
33
+ onFocusChange: setFocused
34
+ });
35
+ // If focused, don't hide the element.
36
+ let combinedStyles = $hZMlr$useMemo(()=>{
37
+ if (isFocused) return style;
38
+ else if (style) return {
39
+ ...$2b1a1e0abf5e6e14$var$styles,
40
+ ...style
41
+ };
42
+ else return $2b1a1e0abf5e6e14$var$styles;
43
+ }, [
44
+ isFocused
45
+ ]);
46
+ return {
47
+ visuallyHiddenProps: {
48
+ ...focusProps,
49
+ style: combinedStyles
50
+ }
51
+ };
52
+ }
53
+ function $2b1a1e0abf5e6e14$export$439d29a4e110a164(props) {
54
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
55
+ let { children: children , elementType: Element = 'div' , isFocusable: isFocusable , style: style , ...otherProps } = props;
56
+ let { visuallyHiddenProps: visuallyHiddenProps } = $2b1a1e0abf5e6e14$export$a966af930f325cab(props);
57
+ return(/*#__PURE__*/ $hZMlr$react.createElement(Element, $hZMlr$mergeProps(otherProps, visuallyHiddenProps), children));
72
58
  }
59
+
60
+
61
+
62
+
63
+ export {$2b1a1e0abf5e6e14$export$a966af930f325cab as useVisuallyHidden, $2b1a1e0abf5e6e14$export$439d29a4e110a164 as VisuallyHidden};
73
64
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;AA8BA,MAAMA,4CAAqB,GAAG;AAC5BC,EAAAA,MAAM,EAAE,CADoB;AAE5BC,EAAAA,IAAI,EAAE,eAFsB;AAG5BC,EAAAA,QAAQ,EAAE,YAHkB;AAI5BC,EAAAA,MAAM,EAAE,CAJoB;AAK5BC,EAAAA,MAAM,EAAE,eALoB;AAM5BC,EAAAA,QAAQ,EAAE,QANkB;AAO5BC,EAAAA,OAAO,EAAE,CAPmB;AAQ5BC,EAAAA,QAAQ,EAAE,UARkB;AAS5BC,EAAAA,KAAK,EAAE,CATqB;AAU5BC,EAAAA,UAAU,EAAE;AAVgB,CAA9B;;AAiBA;;;;OAIO,SAASC,iBAAT,CAA2BC,KAA3B,EAAgF;AAAA,MAArDA,KAAqD;AAArDA,IAAAA,KAAqD,GAAxB,EAAwB;AAAA;;AACrF,MAAI;AACFC,IAAAA,KADE;AAEFC,IAAAA;AAFE,MAGAF,KAHJ;AAKA,MAAI,CAACG,SAAD,EAAYC,UAAZ,IAA0BC,QAAQ,CAAC,KAAD,CAAtC;AACA,MAAI;AAACC,IAAAA;AAAD,MAAeC,QAAQ,CAAC;AAC1BC,IAAAA,UAAU,EAAE,CAACN,WADa;AAE1BO,IAAAA,aAAa,EAAEL;AAFW,GAAD,CAA3B,CAPqF,CAYrF;;AACA,MAAIM,cAAc,GAAGC,OAAO,CAAC,MAAM;AACjC,QAAIR,SAAJ,EAAe;AACb,aAAOF,KAAP;AACD,KAFD,MAEO,IAAIA,KAAJ,EAAW;AAChB,gDAAWb,4CAAX,EAAsBa,KAAtB;AACD,KAFM,MAEA;AACL,aAAOb,4CAAP;AACD;AACF,GAR2B,EAQzB,CAACe,SAAD,CARyB,CAA5B;AAUA,SAAO;AACLS,IAAAA,mBAAmB,qCACdN,UADc;AAEjBL,MAAAA,KAAK,EAAES;AAFU;AADd,GAAP;AAMD;AAED;;;;;OAIO,SAASG,cAAT,CAAwBb,KAAxB,EAAoD;AACzD;AACA,MAAI;AAACc,IAAAA,QAAD;AAAWC,IAAAA,WAAW,EAAEC,OAAO,GAAG;AAAlC,MAA8EhB,KAAlF;AAAA,MAAoEiB,UAApE,uDAAkFjB,KAAlF;;AACA,MAAI;AAACY,IAAAA;AAAD,MAAwBb,iBAAiB,CAACC,KAAD,CAA7C;AAEA,sBACE,qBAAC,OAAD,EAAakB,UAAU,CAACD,UAAD,EAAaL,mBAAb,CAAvB,EACGE,QADH,CADF;AAKD","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 {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, HTMLAttributes, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocus} from '@react-aria/interactions';\n\ninterface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {\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: 1,\n margin: '0 -1px -1px 0',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: 1,\n whiteSpace: 'nowrap'\n};\n\ninterface VisuallyHiddenAria {\n visuallyHiddenProps: HTMLAttributes<HTMLElement>\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 {focusProps} = useFocus({\n isDisabled: !isFocusable,\n onFocusChange: setFocused\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 }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusProps,\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":["styles","border","clip","clipPath","height","margin","overflow","padding","position","width","whiteSpace","useVisuallyHidden","props","style","isFocusable","isFocused","setFocused","useState","focusProps","useFocus","isDisabled","onFocusChange","combinedStyles","useMemo","visuallyHiddenProps","VisuallyHidden","children","elementType","Element","otherProps","mergeProps"],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AC8BA,KAAK,CAAC,4BAAM,GAAkB,CAAC;IAC7B,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAe;IACrB,QAAQ,EAAE,CAAY;IACtB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAe;IACvB,QAAQ,EAAE,CAAQ;IAClB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAU;IACpB,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,CAAQ;AACtB,CAAC;SAUe,yCAAiB,CAAC,KAA0B,GAAG,CAAC;AAAA,CAAC,EAAsB,CAAC;IACtF,GAAG,CAAC,CAAC,QACH,KAAK,gBACL,WAAW,EACb,CAAC,GAAG,KAAK;IAET,GAAG,EAAE,SAAS,EAAE,UAAU,IAAI,eAAQ,CAAC,KAAK;IAC5C,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,eAAQ,CAAC,CAAC;QAC3B,UAAU,GAAG,WAAW;QACxB,aAAa,EAAE,UAAU;IAC3B,CAAC;IAED,EAAsC,AAAtC,oCAAsC;IACtC,GAAG,CAAC,cAAc,GAAG,cAAO,KAAO,CAAC;QAClC,EAAE,EAAE,SAAS,EACX,MAAM,CAAC,KAAK;aACP,EAAE,EAAE,KAAK,EACd,MAAM,CAAC,CAAC;eAAG,4BAAM;eAAK,KAAK;QAAA,CAAC;aAE5B,MAAM,CAAC,4BAAM;IAEjB,CAAC,EAAE,CAAC;QAAA,SAAS;IAAA,CAAC;IAEd,MAAM,CAAC,CAAC;QACN,mBAAmB,EAAE,CAAC;eACjB,UAAU;YACb,KAAK,EAAE,cAAc;QACvB,CAAC;IACH,CAAC;AACH,CAAC;SAMe,yCAAc,CAAC,KAA0B,EAAE,CAAC;IAC1D,EAA6D,AAA7D,2DAA6D;IAC7D,GAAG,CAAC,CAAC,WAAA,QAAQ,GAAE,WAAW,EAAE,OAAO,GAAG,CAAK,oBAAE,WAAW,UAAE,KAAK,MAAK,UAAU,CAAA,CAAC,GAAG,KAAK;IACvF,GAAG,CAAC,CAAC,sBAAA,mBAAmB,EAAA,CAAC,GAAG,yCAAiB,CAAC,KAAK;IAEnD,MAAM,0CACH,OAAO,EAAK,iBAAU,CAAC,UAAU,EAAE,mBAAmB,GACpD,QAAQ;AAGf,CAAC","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 */\n\nexport * 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 {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, HTMLAttributes, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocus} from '@react-aria/interactions';\n\ninterface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {\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: 1,\n margin: '0 -1px -1px 0',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: 1,\n whiteSpace: 'nowrap'\n};\n\ninterface VisuallyHiddenAria {\n visuallyHiddenProps: HTMLAttributes<HTMLElement>\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 {focusProps} = useFocus({\n isDisabled: !isFocusable,\n onFocusChange: setFocused\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 }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusProps,\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 +1 @@
1
- {"mappings":"A;AAgBA,6BAA8B,SAAQ,eAAe,WAAW,CAAC;IAC/D,oCAAoC;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;A;A;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,CAAC,CAAC;IAElD,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAeD;IACE,mBAAmB,EAAE,eAAe,WAAW,CAAC,CAAA;CACjD;AAED;A;A;GAGG;AACH,kCAAkC,KAAK,GAAE,mBAAwB,GAAG,kBAAkB,CA6BrF;AAED;A;A;GAGG;AACH,+BAA+B,KAAK,EAAE,mBAAmB,eAUxD","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"],"sourcesContent":[null,null],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";AAgBA,6BAA8B,SAAQ,eAAe,WAAW,CAAC;IAC/D,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,eAAe,WAAW,CAAC,CAAA;CACjD;AAED;;;GAGG;AACH,kCAAkC,KAAK,GAAE,mBAAwB,GAAG,kBAAkB,CA6BrF;AAED;;;GAGG;AACH,+BAA+B,KAAK,EAAE,mBAAmB,eAUxD","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 */\n\nexport * from './VisuallyHidden';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/visually-hidden",
3
- "version": "3.2.1",
3
+ "version": "3.2.5",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.6.2",
23
- "@react-aria/interactions": "^3.2.1",
24
- "@react-aria/utils": "^3.3.0",
23
+ "@react-aria/interactions": "^3.8.1",
24
+ "@react-aria/utils": "^3.11.2",
25
25
  "clsx": "^1.1.1"
26
26
  },
27
27
  "peerDependencies": {
@@ -30,5 +30,5 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "0778f71a3c13e1e24388a23b6d525e3b9f5b98f1"
33
+ "gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
34
34
  }