@react-aria/focus 3.16.1 → 3.17.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.
Files changed (46) hide show
  1. package/dist/FocusRing.main.js +44 -0
  2. package/dist/FocusRing.main.js.map +1 -0
  3. package/dist/FocusRing.mjs +35 -0
  4. package/dist/FocusRing.module.js +35 -0
  5. package/dist/FocusRing.module.js.map +1 -0
  6. package/dist/FocusScope.main.js +728 -0
  7. package/dist/FocusScope.main.js.map +1 -0
  8. package/dist/FocusScope.mjs +714 -0
  9. package/dist/FocusScope.module.js +714 -0
  10. package/dist/FocusScope.module.js.map +1 -0
  11. package/dist/focusSafely.main.js +39 -0
  12. package/dist/focusSafely.main.js.map +1 -0
  13. package/dist/focusSafely.mjs +34 -0
  14. package/dist/focusSafely.module.js +34 -0
  15. package/dist/focusSafely.module.js.map +1 -0
  16. package/dist/import.mjs +7 -939
  17. package/dist/isElementVisible.main.js +41 -0
  18. package/dist/isElementVisible.main.js.map +1 -0
  19. package/dist/isElementVisible.mjs +36 -0
  20. package/dist/isElementVisible.module.js +36 -0
  21. package/dist/isElementVisible.module.js.map +1 -0
  22. package/dist/main.js +18 -953
  23. package/dist/main.js.map +1 -1
  24. package/dist/module.js +7 -939
  25. package/dist/module.js.map +1 -1
  26. package/dist/types.d.ts +1 -0
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/useFocusRing.main.js +50 -0
  29. package/dist/useFocusRing.main.js.map +1 -0
  30. package/dist/useFocusRing.mjs +45 -0
  31. package/dist/useFocusRing.module.js +45 -0
  32. package/dist/useFocusRing.module.js.map +1 -0
  33. package/dist/useFocusable.main.js +75 -0
  34. package/dist/useFocusable.main.js.map +1 -0
  35. package/dist/useFocusable.mjs +65 -0
  36. package/dist/useFocusable.module.js +65 -0
  37. package/dist/useFocusable.module.js.map +1 -0
  38. package/dist/useHasTabbableChild.main.js +62 -0
  39. package/dist/useHasTabbableChild.main.js.map +1 -0
  40. package/dist/useHasTabbableChild.mjs +57 -0
  41. package/dist/useHasTabbableChild.module.js +57 -0
  42. package/dist/useHasTabbableChild.module.js.map +1 -0
  43. package/package.json +5 -5
  44. package/src/FocusScope.tsx +6 -2
  45. package/src/index.ts +1 -1
  46. package/src/isElementVisible.ts +2 -0
@@ -0,0 +1,41 @@
1
+ var $fhpU6$reactariautils = require("@react-aria/utils");
2
+
3
+
4
+ function $parcel$export(e, n, v, s) {
5
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
+ }
7
+
8
+ $parcel$export(module.exports, "isElementVisible", () => $d5156037ad898a4d$export$e989c0fffaa6b27a);
9
+ /*
10
+ * Copyright 2021 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+ function $d5156037ad898a4d$var$isStyleVisible(element) {
21
+ const windowObject = (0, $fhpU6$reactariautils.getOwnerWindow)(element);
22
+ if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;
23
+ let { display: display, visibility: visibility } = element.style;
24
+ let isVisible = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
25
+ if (isVisible) {
26
+ const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
27
+ let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
28
+ isVisible = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
29
+ }
30
+ return isVisible;
31
+ }
32
+ function $d5156037ad898a4d$var$isAttributeVisible(element, childElement) {
33
+ return !element.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
34
+ !element.hasAttribute("data-react-aria-prevent-focus") && (element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element.hasAttribute("open") : true);
35
+ }
36
+ function $d5156037ad898a4d$export$e989c0fffaa6b27a(element, childElement) {
37
+ return element.nodeName !== "#comment" && $d5156037ad898a4d$var$isStyleVisible(element) && $d5156037ad898a4d$var$isAttributeVisible(element, childElement) && (!element.parentElement || $d5156037ad898a4d$export$e989c0fffaa6b27a(element.parentElement, element));
38
+ }
39
+
40
+
41
+ //# sourceMappingURL=isElementVisible.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAID,SAAS,qCAAe,OAAgB;IACtC,MAAM,eAAe,CAAA,GAAA,oCAAa,EAAE;IACpC,IAAI,CAAE,CAAA,mBAAmB,aAAa,WAAW,AAAD,KAAM,CAAE,CAAA,mBAAmB,aAAa,UAAU,AAAD,GAC/F,OAAO;IAGT,IAAI,WAAC,OAAO,cAAE,UAAU,EAAC,GAAG,QAAQ,KAAK;IAEzC,IAAI,YACF,YAAY,UACZ,eAAe,YACf,eAAe;IAGjB,IAAI,WAAW;QACb,MAAM,oBAAC,gBAAgB,EAAC,GAAG,QAAQ,aAAa,CAAC,WAAW;QAC5D,IAAI,EAAC,SAAS,eAAe,EAAE,YAAY,kBAAkB,EAAC,GAAG,iBAAiB;QAElF,YACE,oBAAoB,UACpB,uBAAuB,YACvB,uBAAuB;IAE3B;IAEA,OAAO;AACT;AAEA,SAAS,yCAAmB,OAAgB,EAAE,YAAsB;IAClE,OACE,CAAC,QAAQ,YAAY,CAAC,aACtB,yCAAyC;IACzC,CAAC,QAAQ,YAAY,CAAC,oCACrB,CAAA,QAAQ,QAAQ,KAAK,aACpB,gBACA,aAAa,QAAQ,KAAK,YACxB,QAAQ,YAAY,CAAC,UACrB,IAAG;AAEX;AAQO,SAAS,0CAAiB,OAAgB,EAAE,YAAsB;IACvE,OACE,QAAQ,QAAQ,KAAK,cACrB,qCAAe,YACf,yCAAmB,SAAS,iBAC3B,CAAA,CAAC,QAAQ,aAAa,IAAI,0CAAiB,QAAQ,aAAa,EAAE,QAAO;AAE9E","sources":["packages/@react-aria/focus/src/isElementVisible.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {getOwnerWindow} from '@react-aria/utils';\n\nfunction isStyleVisible(element: Element) {\n const windowObject = getOwnerWindow(element);\n if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView as unknown as Window;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n // Ignore HiddenSelect when tree walking.\n !element.hasAttribute('data-react-aria-prevent-focus') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and\n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */\nexport function isElementVisible(element: Element, childElement?: Element) {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n"],"names":[],"version":3,"file":"isElementVisible.main.js.map"}
@@ -0,0 +1,36 @@
1
+ import {getOwnerWindow as $djhjW$getOwnerWindow} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2021 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $645f2e67b85a24c9$var$isStyleVisible(element) {
15
+ const windowObject = (0, $djhjW$getOwnerWindow)(element);
16
+ if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;
17
+ let { display: display, visibility: visibility } = element.style;
18
+ let isVisible = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
19
+ if (isVisible) {
20
+ const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
21
+ let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
22
+ isVisible = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
23
+ }
24
+ return isVisible;
25
+ }
26
+ function $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) {
27
+ return !element.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
28
+ !element.hasAttribute("data-react-aria-prevent-focus") && (element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element.hasAttribute("open") : true);
29
+ }
30
+ function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element, childElement) {
31
+ return element.nodeName !== "#comment" && $645f2e67b85a24c9$var$isStyleVisible(element) && $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) && (!element.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element.parentElement, element));
32
+ }
33
+
34
+
35
+ export {$645f2e67b85a24c9$export$e989c0fffaa6b27a as isElementVisible};
36
+ //# sourceMappingURL=isElementVisible.mjs.map
@@ -0,0 +1,36 @@
1
+ import {getOwnerWindow as $djhjW$getOwnerWindow} from "@react-aria/utils";
2
+
3
+ /*
4
+ * Copyright 2021 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ function $645f2e67b85a24c9$var$isStyleVisible(element) {
15
+ const windowObject = (0, $djhjW$getOwnerWindow)(element);
16
+ if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;
17
+ let { display: display, visibility: visibility } = element.style;
18
+ let isVisible = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
19
+ if (isVisible) {
20
+ const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
21
+ let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
22
+ isVisible = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
23
+ }
24
+ return isVisible;
25
+ }
26
+ function $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) {
27
+ return !element.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
28
+ !element.hasAttribute("data-react-aria-prevent-focus") && (element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element.hasAttribute("open") : true);
29
+ }
30
+ function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element, childElement) {
31
+ return element.nodeName !== "#comment" && $645f2e67b85a24c9$var$isStyleVisible(element) && $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) && (!element.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element.parentElement, element));
32
+ }
33
+
34
+
35
+ export {$645f2e67b85a24c9$export$e989c0fffaa6b27a as isElementVisible};
36
+ //# sourceMappingURL=isElementVisible.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAID,SAAS,qCAAe,OAAgB;IACtC,MAAM,eAAe,CAAA,GAAA,qBAAa,EAAE;IACpC,IAAI,CAAE,CAAA,mBAAmB,aAAa,WAAW,AAAD,KAAM,CAAE,CAAA,mBAAmB,aAAa,UAAU,AAAD,GAC/F,OAAO;IAGT,IAAI,WAAC,OAAO,cAAE,UAAU,EAAC,GAAG,QAAQ,KAAK;IAEzC,IAAI,YACF,YAAY,UACZ,eAAe,YACf,eAAe;IAGjB,IAAI,WAAW;QACb,MAAM,oBAAC,gBAAgB,EAAC,GAAG,QAAQ,aAAa,CAAC,WAAW;QAC5D,IAAI,EAAC,SAAS,eAAe,EAAE,YAAY,kBAAkB,EAAC,GAAG,iBAAiB;QAElF,YACE,oBAAoB,UACpB,uBAAuB,YACvB,uBAAuB;IAE3B;IAEA,OAAO;AACT;AAEA,SAAS,yCAAmB,OAAgB,EAAE,YAAsB;IAClE,OACE,CAAC,QAAQ,YAAY,CAAC,aACtB,yCAAyC;IACzC,CAAC,QAAQ,YAAY,CAAC,oCACrB,CAAA,QAAQ,QAAQ,KAAK,aACpB,gBACA,aAAa,QAAQ,KAAK,YACxB,QAAQ,YAAY,CAAC,UACrB,IAAG;AAEX;AAQO,SAAS,0CAAiB,OAAgB,EAAE,YAAsB;IACvE,OACE,QAAQ,QAAQ,KAAK,cACrB,qCAAe,YACf,yCAAmB,SAAS,iBAC3B,CAAA,CAAC,QAAQ,aAAa,IAAI,0CAAiB,QAAQ,aAAa,EAAE,QAAO;AAE9E","sources":["packages/@react-aria/focus/src/isElementVisible.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {getOwnerWindow} from '@react-aria/utils';\n\nfunction isStyleVisible(element: Element) {\n const windowObject = getOwnerWindow(element);\n if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView as unknown as Window;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n // Ignore HiddenSelect when tree walking.\n !element.hasAttribute('data-react-aria-prevent-focus') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and\n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */\nexport function isElementVisible(element: Element, childElement?: Element) {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n"],"names":[],"version":3,"file":"isElementVisible.module.js.map"}