@react-aria/visually-hidden 3.2.8 → 3.4.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/main.js CHANGED
@@ -2,32 +2,15 @@ var $2Agrv$reactariautils = require("@react-aria/utils");
2
2
  var $2Agrv$react = require("react");
3
3
  var $2Agrv$reactariainteractions = require("@react-aria/interactions");
4
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
- }
10
-
11
- Object.defineProperty(dest, key, {
12
- enumerable: true,
13
- get: function get() {
14
- return source[key];
15
- }
16
- });
17
- });
18
-
19
- return dest;
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
20
7
  }
21
8
  function $parcel$interopDefault(a) {
22
9
  return a && a.__esModule ? a.default : a;
23
10
  }
24
- function $parcel$export(e, n, v, s) {
25
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
26
- }
27
- var $b5c81b25cdf7a43c$exports = {};
28
11
 
29
- $parcel$export($b5c81b25cdf7a43c$exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$export$a966af930f325cab);
30
- $parcel$export($b5c81b25cdf7a43c$exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$export$439d29a4e110a164);
12
+ $parcel$export(module.exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$export$a966af930f325cab);
13
+ $parcel$export(module.exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$export$439d29a4e110a164);
31
14
 
32
15
 
33
16
 
@@ -77,7 +60,6 @@ function $b5c81b25cdf7a43c$export$439d29a4e110a164(props) {
77
60
  }
78
61
 
79
62
 
80
- $parcel$exportWildcard(module.exports, $b5c81b25cdf7a43c$exports);
81
63
 
82
64
 
83
65
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@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K,oBAAE,WAAW,UAAE,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"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AC+BA,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,qBAAQ,CAAC,KAAK;IAC5C,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,qCAAQ,CAAC,CAAC;QAC3B,UAAU,GAAG,WAAW;QACxB,aAAa,EAAE,UAAU;IAC3B,CAAC;IAED,EAAsC,AAAtC,oCAAsC;IACtC,GAAG,CAAC,cAAc,GAAG,oBAAO,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,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 */\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 {useFocus} 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: 1,\n margin: '0 -1px -1px 0',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: 1,\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 {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
@@ -2,13 +2,6 @@ import {mergeProps as $9BxnE$mergeProps} from "@react-aria/utils";
2
2
  import $9BxnE$react, {useState as $9BxnE$useState, useMemo as $9BxnE$useMemo} from "react";
3
3
  import {useFocus as $9BxnE$useFocus} from "@react-aria/interactions";
4
4
 
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
- var $5c3e21d68f1c4674$exports = {};
9
-
10
- $parcel$export($5c3e21d68f1c4674$exports, "useVisuallyHidden", () => $5c3e21d68f1c4674$export$a966af930f325cab);
11
- $parcel$export($5c3e21d68f1c4674$exports, "VisuallyHidden", () => $5c3e21d68f1c4674$export$439d29a4e110a164);
12
5
 
13
6
 
14
7
 
@@ -1 +1 @@
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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,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
+ {"mappings":";;;;;;;AC+BA,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 */\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 {useFocus} 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: 1,\n margin: '0 -1px -1px 0',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: 1,\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 {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"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { HTMLAttributes, JSXElementConstructor, ReactNode } from "react";
2
- interface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {
1
+ import { DOMAttributes } from "@react-types/shared";
2
+ import { JSXElementConstructor, ReactNode } from "react";
3
+ export interface VisuallyHiddenProps extends DOMAttributes {
3
4
  /** The content to visually hide. */
4
5
  children?: ReactNode;
5
6
  /**
@@ -10,8 +11,8 @@ interface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {
10
11
  /** Whether the element should become visible on focus, for example skip links. */
11
12
  isFocusable?: boolean;
12
13
  }
13
- interface VisuallyHiddenAria {
14
- visuallyHiddenProps: HTMLAttributes<HTMLElement>;
14
+ export interface VisuallyHiddenAria {
15
+ visuallyHiddenProps: DOMAttributes;
15
16
  }
16
17
  /**
17
18
  * Provides props for an element that hides its children visually
@@ -1 +1 @@
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"}
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,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 */\nexport {useVisuallyHidden, VisuallyHidden} from './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} 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.8",
3
+ "version": "3.4.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -20,15 +20,16 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.6.2",
23
- "@react-aria/interactions": "^3.8.4",
24
- "@react-aria/utils": "^3.12.0",
23
+ "@react-aria/interactions": "^3.10.0",
24
+ "@react-aria/utils": "^3.13.2",
25
+ "@react-types/shared": "^3.14.0",
25
26
  "clsx": "^1.1.1"
26
27
  },
27
28
  "peerDependencies": {
28
- "react": "^16.8.0 || ^17.0.0-rc.1"
29
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public"
32
33
  },
33
- "gitHead": "6a503b715e0dbbf92038cd7f08b1bcdde4c78e82"
34
+ "gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
34
35
  }
@@ -10,11 +10,12 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ import {DOMAttributes} from '@react-types/shared';
13
14
  import {mergeProps} from '@react-aria/utils';
14
- import React, {CSSProperties, HTMLAttributes, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';
15
+ import React, {CSSProperties, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';
15
16
  import {useFocus} from '@react-aria/interactions';
16
17
 
17
- interface VisuallyHiddenProps extends HTMLAttributes<HTMLElement> {
18
+ export interface VisuallyHiddenProps extends DOMAttributes {
18
19
  /** The content to visually hide. */
19
20
  children?: ReactNode,
20
21
 
@@ -41,8 +42,8 @@ const styles: CSSProperties = {
41
42
  whiteSpace: 'nowrap'
42
43
  };
43
44
 
44
- interface VisuallyHiddenAria {
45
- visuallyHiddenProps: HTMLAttributes<HTMLElement>
45
+ export interface VisuallyHiddenAria {
46
+ visuallyHiddenProps: DOMAttributes
46
47
  }
47
48
 
48
49
  /**
package/src/index.ts CHANGED
@@ -9,5 +9,5 @@
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
-
13
- export * from './VisuallyHidden';
12
+ export {useVisuallyHidden, VisuallyHidden} from './VisuallyHidden';
13
+ export type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';