@react-aria/visually-hidden 3.2.3 → 3.2.6
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 +68 -83
- package/dist/main.js.map +1 -1
- package/dist/module.js +57 -66
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -1,98 +1,83 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 $2Agrv$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $2Agrv$react = require("react");
|
|
3
|
+
var $2Agrv$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
|
-
|
|
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 $b5c81b25cdf7a43c$exports = {};
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
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($b5c81b25cdf7a43c$exports, "useVisuallyHidden", () => $b5c81b25cdf7a43c$export$a966af930f325cab);
|
|
30
|
+
$parcel$export($b5c81b25cdf7a43c$exports, "VisuallyHidden", () => $b5c81b25cdf7a43c$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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
34
|
+
const $b5c81b25cdf7a43c$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 $b5c81b25cdf7a43c$export$a966af930f325cab(props = {
|
|
47
|
+
}) {
|
|
48
|
+
let { style: style , isFocusable: isFocusable } = props;
|
|
49
|
+
let [isFocused, setFocused] = $2Agrv$react.useState(false);
|
|
50
|
+
let { focusProps: focusProps } = $2Agrv$reactariainteractions.useFocus({
|
|
51
|
+
isDisabled: !isFocusable,
|
|
52
|
+
onFocusChange: setFocused
|
|
53
|
+
});
|
|
54
|
+
// If focused, don't hide the element.
|
|
55
|
+
let combinedStyles = $2Agrv$react.useMemo(()=>{
|
|
56
|
+
if (isFocused) return style;
|
|
57
|
+
else if (style) return {
|
|
58
|
+
...$b5c81b25cdf7a43c$var$styles,
|
|
59
|
+
...style
|
|
60
|
+
};
|
|
61
|
+
else return $b5c81b25cdf7a43c$var$styles;
|
|
62
|
+
}, [
|
|
63
|
+
isFocused
|
|
64
|
+
]);
|
|
65
|
+
return {
|
|
66
|
+
visuallyHiddenProps: {
|
|
67
|
+
...focusProps,
|
|
68
|
+
style: combinedStyles
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function $b5c81b25cdf7a43c$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 } = $b5c81b25cdf7a43c$export$a966af930f325cab(props);
|
|
76
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($2Agrv$react)).createElement(Element, $2Agrv$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
|
-
|
|
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, $b5c81b25cdf7a43c$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":"
|
|
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,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 */\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 {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
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 $9BxnE$mergeProps} from "@react-aria/utils";
|
|
2
|
+
import $9BxnE$react, {useState as $9BxnE$useState, useMemo as $9BxnE$useMemo} from "react";
|
|
3
|
+
import {useFocus as $9BxnE$useFocus} from "@react-aria/interactions";
|
|
18
4
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 $5c3e21d68f1c4674$exports = {};
|
|
27
9
|
|
|
28
|
-
|
|
29
|
-
|
|
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($5c3e21d68f1c4674$exports, "useVisuallyHidden", () => $5c3e21d68f1c4674$export$a966af930f325cab);
|
|
11
|
+
$parcel$export($5c3e21d68f1c4674$exports, "VisuallyHidden", () => $5c3e21d68f1c4674$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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
15
|
+
const $5c3e21d68f1c4674$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 $5c3e21d68f1c4674$export$a966af930f325cab(props = {
|
|
28
|
+
}) {
|
|
29
|
+
let { style: style , isFocusable: isFocusable } = props;
|
|
30
|
+
let [isFocused, setFocused] = $9BxnE$useState(false);
|
|
31
|
+
let { focusProps: focusProps } = $9BxnE$useFocus({
|
|
32
|
+
isDisabled: !isFocusable,
|
|
33
|
+
onFocusChange: setFocused
|
|
34
|
+
});
|
|
35
|
+
// If focused, don't hide the element.
|
|
36
|
+
let combinedStyles = $9BxnE$useMemo(()=>{
|
|
37
|
+
if (isFocused) return style;
|
|
38
|
+
else if (style) return {
|
|
39
|
+
...$5c3e21d68f1c4674$var$styles,
|
|
40
|
+
...style
|
|
41
|
+
};
|
|
42
|
+
else return $5c3e21d68f1c4674$var$styles;
|
|
43
|
+
}, [
|
|
44
|
+
isFocused
|
|
45
|
+
]);
|
|
46
|
+
return {
|
|
47
|
+
visuallyHiddenProps: {
|
|
48
|
+
...focusProps,
|
|
49
|
+
style: combinedStyles
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function $5c3e21d68f1c4674$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 } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
|
|
57
|
+
return(/*#__PURE__*/ $9BxnE$react.createElement(Element, $9BxnE$mergeProps(otherProps, visuallyHiddenProps), children));
|
|
72
58
|
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export {$5c3e21d68f1c4674$export$a966af930f325cab as useVisuallyHidden, $5c3e21d68f1c4674$export$439d29a4e110a164 as VisuallyHidden};
|
|
73
64
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
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"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
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.
|
|
3
|
+
"version": "3.2.6",
|
|
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.
|
|
24
|
-
"@react-aria/utils": "^3.
|
|
23
|
+
"@react-aria/interactions": "^3.8.2",
|
|
24
|
+
"@react-aria/utils": "^3.11.3",
|
|
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": "
|
|
33
|
+
"gitHead": "ed8d8d984c2f7f2c31e8b18795b97858a95e4729"
|
|
34
34
|
}
|