@react-aria/utils 3.23.2 → 3.24.1

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 (171) hide show
  1. package/dist/chain.main.js +26 -0
  2. package/dist/chain.main.js.map +1 -0
  3. package/dist/chain.mjs +21 -0
  4. package/dist/chain.module.js +21 -0
  5. package/dist/chain.module.js.map +1 -0
  6. package/dist/domHelpers.main.js +19 -0
  7. package/dist/domHelpers.main.js.map +1 -0
  8. package/dist/domHelpers.mjs +13 -0
  9. package/dist/domHelpers.module.js +13 -0
  10. package/dist/domHelpers.module.js.map +1 -0
  11. package/dist/filterDOMProps.main.js +45 -0
  12. package/dist/filterDOMProps.main.js.map +1 -0
  13. package/dist/filterDOMProps.mjs +40 -0
  14. package/dist/filterDOMProps.module.js +40 -0
  15. package/dist/filterDOMProps.module.js.map +1 -0
  16. package/dist/focusWithoutScrolling.main.js +72 -0
  17. package/dist/focusWithoutScrolling.main.js.map +1 -0
  18. package/dist/focusWithoutScrolling.mjs +67 -0
  19. package/dist/focusWithoutScrolling.module.js +67 -0
  20. package/dist/focusWithoutScrolling.module.js.map +1 -0
  21. package/dist/getOffset.main.js +24 -0
  22. package/dist/getOffset.main.js.map +1 -0
  23. package/dist/getOffset.mjs +19 -0
  24. package/dist/getOffset.module.js +19 -0
  25. package/dist/getOffset.module.js.map +1 -0
  26. package/dist/getScrollParent.main.js +28 -0
  27. package/dist/getScrollParent.main.js.map +1 -0
  28. package/dist/getScrollParent.mjs +23 -0
  29. package/dist/getScrollParent.module.js +23 -0
  30. package/dist/getScrollParent.module.js.map +1 -0
  31. package/dist/getScrollParents.main.js +30 -0
  32. package/dist/getScrollParents.main.js.map +1 -0
  33. package/dist/getScrollParents.mjs +25 -0
  34. package/dist/getScrollParents.module.js +25 -0
  35. package/dist/getScrollParents.module.js.map +1 -0
  36. package/dist/import.mjs +32 -1232
  37. package/dist/isScrollable.main.js +25 -0
  38. package/dist/isScrollable.main.js.map +1 -0
  39. package/dist/isScrollable.mjs +20 -0
  40. package/dist/isScrollable.module.js +20 -0
  41. package/dist/isScrollable.module.js.map +1 -0
  42. package/dist/isVirtualEvent.main.js +41 -0
  43. package/dist/isVirtualEvent.main.js.map +1 -0
  44. package/dist/isVirtualEvent.mjs +35 -0
  45. package/dist/isVirtualEvent.module.js +35 -0
  46. package/dist/isVirtualEvent.module.js.map +1 -0
  47. package/dist/main.js +80 -1282
  48. package/dist/main.js.map +1 -1
  49. package/dist/mergeProps.main.js +51 -0
  50. package/dist/mergeProps.main.js.map +1 -0
  51. package/dist/mergeProps.mjs +42 -0
  52. package/dist/mergeProps.module.js +42 -0
  53. package/dist/mergeProps.module.js.map +1 -0
  54. package/dist/mergeRefs.main.js +28 -0
  55. package/dist/mergeRefs.main.js.map +1 -0
  56. package/dist/mergeRefs.mjs +23 -0
  57. package/dist/mergeRefs.module.js +23 -0
  58. package/dist/mergeRefs.module.js.map +1 -0
  59. package/dist/module.js +32 -1232
  60. package/dist/module.js.map +1 -1
  61. package/dist/openLink.main.js +143 -0
  62. package/dist/openLink.main.js.map +1 -0
  63. package/dist/openLink.mjs +129 -0
  64. package/dist/openLink.module.js +129 -0
  65. package/dist/openLink.module.js.map +1 -0
  66. package/dist/platform.main.js +64 -0
  67. package/dist/platform.main.js.map +1 -0
  68. package/dist/platform.mjs +51 -0
  69. package/dist/platform.module.js +51 -0
  70. package/dist/platform.module.js.map +1 -0
  71. package/dist/runAfterTransition.main.js +82 -0
  72. package/dist/runAfterTransition.main.js.map +1 -0
  73. package/dist/runAfterTransition.mjs +77 -0
  74. package/dist/runAfterTransition.module.js +77 -0
  75. package/dist/runAfterTransition.module.js.map +1 -0
  76. package/dist/scrollIntoView.main.js +96 -0
  77. package/dist/scrollIntoView.main.js.map +1 -0
  78. package/dist/scrollIntoView.mjs +90 -0
  79. package/dist/scrollIntoView.module.js +90 -0
  80. package/dist/scrollIntoView.module.js.map +1 -0
  81. package/dist/types.d.ts +17 -6
  82. package/dist/types.d.ts.map +1 -1
  83. package/dist/useDeepMemo.main.js +30 -0
  84. package/dist/useDeepMemo.main.js.map +1 -0
  85. package/dist/useDeepMemo.mjs +25 -0
  86. package/dist/useDeepMemo.module.js +25 -0
  87. package/dist/useDeepMemo.module.js.map +1 -0
  88. package/dist/useDescription.main.js +59 -0
  89. package/dist/useDescription.main.js.map +1 -0
  90. package/dist/useDescription.mjs +54 -0
  91. package/dist/useDescription.module.js +54 -0
  92. package/dist/useDescription.module.js.map +1 -0
  93. package/dist/useDrag1D.main.js +139 -0
  94. package/dist/useDrag1D.main.js.map +1 -0
  95. package/dist/useDrag1D.mjs +134 -0
  96. package/dist/useDrag1D.module.js +134 -0
  97. package/dist/useDrag1D.module.js.map +1 -0
  98. package/dist/useEffectEvent.main.js +37 -0
  99. package/dist/useEffectEvent.main.js.map +1 -0
  100. package/dist/useEffectEvent.mjs +32 -0
  101. package/dist/useEffectEvent.module.js +32 -0
  102. package/dist/useEffectEvent.module.js.map +1 -0
  103. package/dist/useEvent.main.js +42 -0
  104. package/dist/useEvent.main.js.map +1 -0
  105. package/dist/useEvent.mjs +37 -0
  106. package/dist/useEvent.module.js +37 -0
  107. package/dist/useEvent.module.js.map +1 -0
  108. package/dist/useFormReset.main.js +41 -0
  109. package/dist/useFormReset.main.js.map +1 -0
  110. package/dist/useFormReset.mjs +36 -0
  111. package/dist/useFormReset.module.js +36 -0
  112. package/dist/useFormReset.module.js.map +1 -0
  113. package/dist/useGlobalListeners.main.js +63 -0
  114. package/dist/useGlobalListeners.main.js.map +1 -0
  115. package/dist/useGlobalListeners.mjs +58 -0
  116. package/dist/useGlobalListeners.module.js +58 -0
  117. package/dist/useGlobalListeners.module.js.map +1 -0
  118. package/dist/useId.main.js +93 -0
  119. package/dist/useId.main.js.map +1 -0
  120. package/dist/useId.mjs +86 -0
  121. package/dist/useId.module.js +86 -0
  122. package/dist/useId.module.js.map +1 -0
  123. package/dist/useLabels.main.js +44 -0
  124. package/dist/useLabels.main.js.map +1 -0
  125. package/dist/useLabels.mjs +39 -0
  126. package/dist/useLabels.module.js +39 -0
  127. package/dist/useLabels.module.js.map +1 -0
  128. package/dist/useLayoutEffect.main.js +27 -0
  129. package/dist/useLayoutEffect.main.js.map +1 -0
  130. package/dist/useLayoutEffect.mjs +18 -0
  131. package/dist/useLayoutEffect.module.js +18 -0
  132. package/dist/useLayoutEffect.module.js.map +1 -0
  133. package/dist/useObjectRef.main.js +37 -0
  134. package/dist/useObjectRef.main.js.map +1 -0
  135. package/dist/useObjectRef.mjs +32 -0
  136. package/dist/useObjectRef.module.js +32 -0
  137. package/dist/useObjectRef.module.js.map +1 -0
  138. package/dist/useResizeObserver.main.js +40 -0
  139. package/dist/useResizeObserver.main.js.map +1 -0
  140. package/dist/useResizeObserver.mjs +35 -0
  141. package/dist/useResizeObserver.module.js +35 -0
  142. package/dist/useResizeObserver.module.js.map +1 -0
  143. package/dist/useSyncRef.main.js +32 -0
  144. package/dist/useSyncRef.main.js.map +1 -0
  145. package/dist/useSyncRef.mjs +27 -0
  146. package/dist/useSyncRef.module.js +27 -0
  147. package/dist/useSyncRef.module.js.map +1 -0
  148. package/dist/useUpdateEffect.main.js +38 -0
  149. package/dist/useUpdateEffect.main.js.map +1 -0
  150. package/dist/useUpdateEffect.mjs +33 -0
  151. package/dist/useUpdateEffect.module.js +33 -0
  152. package/dist/useUpdateEffect.module.js.map +1 -0
  153. package/dist/useValueEffect.main.js +58 -0
  154. package/dist/useValueEffect.main.js.map +1 -0
  155. package/dist/useValueEffect.mjs +53 -0
  156. package/dist/useValueEffect.module.js +53 -0
  157. package/dist/useValueEffect.module.js.map +1 -0
  158. package/dist/useViewportSize.main.js +56 -0
  159. package/dist/useViewportSize.main.js.map +1 -0
  160. package/dist/useViewportSize.mjs +51 -0
  161. package/dist/useViewportSize.module.js +51 -0
  162. package/dist/useViewportSize.module.js.map +1 -0
  163. package/package.json +5 -5
  164. package/src/filterDOMProps.ts +1 -0
  165. package/src/getScrollParent.ts +2 -10
  166. package/src/getScrollParents.ts +26 -0
  167. package/src/index.ts +4 -2
  168. package/src/isScrollable.ts +22 -0
  169. package/src/mergeRefs.ts +2 -2
  170. package/src/openLink.tsx +25 -9
  171. package/src/scrollIntoView.ts +3 -5
@@ -0,0 +1,96 @@
1
+ var $49f0d9486c2408aa$exports = require("./getScrollParents.main.js");
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, "scrollIntoView", () => $449412113267a1fe$export$53a0910f038337bd);
9
+ $parcel$export(module.exports, "scrollIntoViewport", () => $449412113267a1fe$export$c826860796309d1b);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+ function $449412113267a1fe$export$53a0910f038337bd(scrollView, element) {
22
+ let offsetX = $449412113267a1fe$var$relativeOffset(scrollView, element, 'left');
23
+ let offsetY = $449412113267a1fe$var$relativeOffset(scrollView, element, 'top');
24
+ let width = element.offsetWidth;
25
+ let height = element.offsetHeight;
26
+ let x = scrollView.scrollLeft;
27
+ let y = scrollView.scrollTop;
28
+ // Account for top/left border offsetting the scroll top/Left
29
+ let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth } = getComputedStyle(scrollView);
30
+ let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);
31
+ let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
32
+ // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
33
+ let maxX = borderAdjustedX + scrollView.clientWidth;
34
+ let maxY = borderAdjustedY + scrollView.clientHeight;
35
+ if (offsetX <= x) x = offsetX - parseInt(borderLeftWidth, 10);
36
+ else if (offsetX + width > maxX) x += offsetX + width - maxX;
37
+ if (offsetY <= borderAdjustedY) y = offsetY - parseInt(borderTopWidth, 10);
38
+ else if (offsetY + height > maxY) y += offsetY + height - maxY;
39
+ scrollView.scrollLeft = x;
40
+ scrollView.scrollTop = y;
41
+ }
42
+ /**
43
+ * Computes the offset left or top from child to ancestor by accumulating
44
+ * offsetLeft or offsetTop through intervening offsetParents.
45
+ */ function $449412113267a1fe$var$relativeOffset(ancestor, child, axis) {
46
+ const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
47
+ let sum = 0;
48
+ while(child.offsetParent){
49
+ sum += child[prop];
50
+ if (child.offsetParent === ancestor) break;
51
+ else if (child.offsetParent.contains(ancestor)) {
52
+ // If the ancestor is not `position:relative`, then we stop at
53
+ // _its_ offset parent, and we subtract off _its_ offset, so that
54
+ // we end up with the proper offset from child to ancestor.
55
+ sum -= ancestor[prop];
56
+ break;
57
+ }
58
+ child = child.offsetParent;
59
+ }
60
+ return sum;
61
+ }
62
+ function $449412113267a1fe$export$c826860796309d1b(targetElement, opts) {
63
+ if (document.contains(targetElement)) {
64
+ let root = document.scrollingElement || document.documentElement;
65
+ let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
66
+ // If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
67
+ if (!isScrollPrevented) {
68
+ var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
69
+ // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
70
+ _targetElement_scrollIntoView;
71
+ let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
72
+ targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
73
+ block: 'nearest'
74
+ });
75
+ let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
76
+ // Account for sub pixel differences from rounding
77
+ if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
78
+ var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
79
+ opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
80
+ block: 'center',
81
+ inline: 'center'
82
+ });
83
+ (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
84
+ block: 'nearest'
85
+ });
86
+ }
87
+ } else {
88
+ let scrollParents = (0, $49f0d9486c2408aa$exports.getScrollParents)(targetElement);
89
+ // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
90
+ for (let scrollParent of scrollParents)$449412113267a1fe$export$53a0910f038337bd(scrollParent, targetElement);
91
+ }
92
+ }
93
+ }
94
+
95
+
96
+ //# sourceMappingURL=scrollIntoView.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAcM,SAAS,0CAAe,UAAuB,EAAE,OAAoB;IAC1E,IAAI,UAAU,qCAAe,YAAY,SAAS;IAClD,IAAI,UAAU,qCAAe,YAAY,SAAS;IAClD,IAAI,QAAQ,QAAQ,WAAW;IAC/B,IAAI,SAAS,QAAQ,YAAY;IACjC,IAAI,IAAI,WAAW,UAAU;IAC7B,IAAI,IAAI,WAAW,SAAS;IAE5B,6DAA6D;IAC7D,IAAI,kBAAC,cAAc,mBAAE,eA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hF,0BAAA,qCAAA,gCAAA,cAAe,cAAc,cAA7B,oDAAA,mCAAA,eAAgC;gBAAC,OAAO;YAAS;YACjD,IAAI,EAAC,MAAM,OAAO,EAAE,KAAK,MAAM,EAAC,GAAG,cAAc,qBAAqB;YACtE,kDAAkD;YAClD,IAAI,AAAC,KAAK,GAAG,CAAC,eAAe,WAAW,KAAO,KAAK,GAAG,CAAC,cAAc,UAAU,GAAI;oBAClF,wCAAA,yBACA;gBADA,iBAAA,4BAAA,0BAAA,KAAM,iBAAiB,cAAvB,+CAAA,yCAAA,wBAAyB,cAAc,cAAvC,6DAAA,4CAAA,yBAA0C;oBAAC,OAAO;oBAAU,QAAQ;gBAAQ;iBAC5E,iCAAA,cAAc,cAAc,cAA5B,qDAAA,oCAAA,eAA+B;oBAAC,OAAO;gBAAS;YAClD;QACF,OAAO;YACL,IAAI,gBAAgB,CAAA,GAAA,0CAAe,EAAE;YACrC,+JAA+J;YAC/J,KAAK,IAAI,gBAAgB,cACvB,0CAAe,cAA6B;QAEhD;IACF;AACF","sources":["packages/@react-aria/utils/src/scrollIntoView.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getScrollParents} from './getScrollParents';\n\ninterface ScrollIntoViewportOpts {\n /** The optional containing element of the target to be centered in the viewport. */\n containingElement?: Element\n}\n\n/**\n * Scrolls `scrollView` so that `element` is visible.\n * Similar to `element.scrollIntoView({block: 'nearest'})` (not supported in Edge),\n * but doesn't affect parents above `scrollView`.\n */\nexport function scrollIntoView(scrollView: HTMLElement, element: HTMLElement) {\n let offsetX = relativeOffset(scrollView, element, 'left');\n let offsetY = relativeOffset(scrollView, element, 'top');\n let width = element.offsetWidth;\n let height = element.offsetHeight;\n let x = scrollView.scrollLeft;\n let y = scrollView.scrollTop;\n\n // Account for top/left border offsetting the scroll top/Left\n let {borderTopWidth, borderLeftWidth} = getComputedStyle(scrollView);\n let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);\n let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);\n // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width\n let maxX = borderAdjustedX + scrollView.clientWidth;\n let maxY = borderAdjustedY + scrollView.clientHeight;\n\n if (offsetX <= x) {\n x = offsetX - parseInt(borderLeftWidth, 10);\n } else if (offsetX + width > maxX) {\n x += offsetX + width - maxX;\n }\n if (offsetY <= borderAdjustedY) {\n y = offsetY - parseInt(borderTopWidth, 10);\n } else if (offsetY + height > maxY) {\n y += offsetY + height - maxY;\n }\n scrollView.scrollLeft = x;\n scrollView.scrollTop = y;\n}\n\n/**\n * Computes the offset left or top from child to ancestor by accumulating\n * offsetLeft or offsetTop through intervening offsetParents.\n */\nfunction relativeOffset(ancestor: HTMLElement, child: HTMLElement, axis: 'left'|'top') {\n const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';\n let sum = 0;\n while (child.offsetParent) {\n sum += child[prop];\n if (child.offsetParent === ancestor) {\n // Stop once we have found the ancestor we are interested in.\n break;\n } else if (child.offsetParent.contains(ancestor)) {\n // If the ancestor is not `position:relative`, then we stop at\n // _its_ offset parent, and we subtract off _its_ offset, so that\n // we end up with the proper offset from child to ancestor.\n sum -= ancestor[prop];\n break;\n }\n child = child.offsetParent as HTMLElement;\n }\n return sum;\n}\n\n/**\n * Scrolls the `targetElement` so it is visible in the viewport. Accepts an optional `opts.containingElement`\n * that will be centered in the viewport prior to scrolling the targetElement into view. If scrolling is prevented on\n * the body (e.g. targetElement is in a popover), this will only scroll the scroll parents of the targetElement up to but not including the body itself.\n */\nexport function scrollIntoViewport(targetElement: Element, opts?: ScrollIntoViewportOpts) {\n if (document.contains(targetElement)) {\n let root = document.scrollingElement || document.documentElement;\n let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';\n // If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view\n if (!isScrollPrevented) {\n let {left: originalLeft, top: originalTop} = targetElement.getBoundingClientRect();\n\n // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()\n // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically\n targetElement?.scrollIntoView?.({block: 'nearest'});\n let {left: newLeft, top: newTop} = targetElement.getBoundingClientRect();\n // Account for sub pixel differences from rounding\n if ((Math.abs(originalLeft - newLeft) > 1) || (Math.abs(originalTop - newTop) > 1)) {\n opts?.containingElement?.scrollIntoView?.({block: 'center', inline: 'center'});\n targetElement.scrollIntoView?.({block: 'nearest'});\n }\n } else {\n let scrollParents = getScrollParents(targetElement);\n // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.\n for (let scrollParent of scrollParents) {\n scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement);\n }\n }\n }\n}\n"],"names":[],"version":3,"file":"scrollIntoView.main.js.map"}
@@ -0,0 +1,90 @@
1
+ import {getScrollParents as $a40c673dc9f6d9c7$export$94ed1c92c7beeb22} from "./getScrollParents.mjs";
2
+
3
+ /*
4
+ * Copyright 2020 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 $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
15
+ let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'left');
16
+ let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'top');
17
+ let width = element.offsetWidth;
18
+ let height = element.offsetHeight;
19
+ let x = scrollView.scrollLeft;
20
+ let y = scrollView.scrollTop;
21
+ // Account for top/left border offsetting the scroll top/Left
22
+ let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth } = getComputedStyle(scrollView);
23
+ let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);
24
+ let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
25
+ // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
26
+ let maxX = borderAdjustedX + scrollView.clientWidth;
27
+ let maxY = borderAdjustedY + scrollView.clientHeight;
28
+ if (offsetX <= x) x = offsetX - parseInt(borderLeftWidth, 10);
29
+ else if (offsetX + width > maxX) x += offsetX + width - maxX;
30
+ if (offsetY <= borderAdjustedY) y = offsetY - parseInt(borderTopWidth, 10);
31
+ else if (offsetY + height > maxY) y += offsetY + height - maxY;
32
+ scrollView.scrollLeft = x;
33
+ scrollView.scrollTop = y;
34
+ }
35
+ /**
36
+ * Computes the offset left or top from child to ancestor by accumulating
37
+ * offsetLeft or offsetTop through intervening offsetParents.
38
+ */ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
39
+ const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
40
+ let sum = 0;
41
+ while(child.offsetParent){
42
+ sum += child[prop];
43
+ if (child.offsetParent === ancestor) break;
44
+ else if (child.offsetParent.contains(ancestor)) {
45
+ // If the ancestor is not `position:relative`, then we stop at
46
+ // _its_ offset parent, and we subtract off _its_ offset, so that
47
+ // we end up with the proper offset from child to ancestor.
48
+ sum -= ancestor[prop];
49
+ break;
50
+ }
51
+ child = child.offsetParent;
52
+ }
53
+ return sum;
54
+ }
55
+ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
56
+ if (document.contains(targetElement)) {
57
+ let root = document.scrollingElement || document.documentElement;
58
+ let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
59
+ // If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
60
+ if (!isScrollPrevented) {
61
+ var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
62
+ // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
63
+ _targetElement_scrollIntoView;
64
+ let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
65
+ targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
66
+ block: 'nearest'
67
+ });
68
+ let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
69
+ // Account for sub pixel differences from rounding
70
+ if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
71
+ var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
72
+ opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
73
+ block: 'center',
74
+ inline: 'center'
75
+ });
76
+ (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
77
+ block: 'nearest'
78
+ });
79
+ }
80
+ } else {
81
+ let scrollParents = (0, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(targetElement);
82
+ // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
83
+ for (let scrollParent of scrollParents)$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
84
+ }
85
+ }
86
+ }
87
+
88
+
89
+ export {$2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport};
90
+ //# sourceMappingURL=scrollIntoView.module.js.map
@@ -0,0 +1,90 @@
1
+ import {getScrollParents as $a40c673dc9f6d9c7$export$94ed1c92c7beeb22} from "./getScrollParents.module.js";
2
+
3
+ /*
4
+ * Copyright 2020 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 $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
15
+ let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'left');
16
+ let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'top');
17
+ let width = element.offsetWidth;
18
+ let height = element.offsetHeight;
19
+ let x = scrollView.scrollLeft;
20
+ let y = scrollView.scrollTop;
21
+ // Account for top/left border offsetting the scroll top/Left
22
+ let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth } = getComputedStyle(scrollView);
23
+ let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);
24
+ let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);
25
+ // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
26
+ let maxX = borderAdjustedX + scrollView.clientWidth;
27
+ let maxY = borderAdjustedY + scrollView.clientHeight;
28
+ if (offsetX <= x) x = offsetX - parseInt(borderLeftWidth, 10);
29
+ else if (offsetX + width > maxX) x += offsetX + width - maxX;
30
+ if (offsetY <= borderAdjustedY) y = offsetY - parseInt(borderTopWidth, 10);
31
+ else if (offsetY + height > maxY) y += offsetY + height - maxY;
32
+ scrollView.scrollLeft = x;
33
+ scrollView.scrollTop = y;
34
+ }
35
+ /**
36
+ * Computes the offset left or top from child to ancestor by accumulating
37
+ * offsetLeft or offsetTop through intervening offsetParents.
38
+ */ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
39
+ const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
40
+ let sum = 0;
41
+ while(child.offsetParent){
42
+ sum += child[prop];
43
+ if (child.offsetParent === ancestor) break;
44
+ else if (child.offsetParent.contains(ancestor)) {
45
+ // If the ancestor is not `position:relative`, then we stop at
46
+ // _its_ offset parent, and we subtract off _its_ offset, so that
47
+ // we end up with the proper offset from child to ancestor.
48
+ sum -= ancestor[prop];
49
+ break;
50
+ }
51
+ child = child.offsetParent;
52
+ }
53
+ return sum;
54
+ }
55
+ function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
56
+ if (document.contains(targetElement)) {
57
+ let root = document.scrollingElement || document.documentElement;
58
+ let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
59
+ // If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
60
+ if (!isScrollPrevented) {
61
+ var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
62
+ // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
63
+ _targetElement_scrollIntoView;
64
+ let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
65
+ targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
66
+ block: 'nearest'
67
+ });
68
+ let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
69
+ // Account for sub pixel differences from rounding
70
+ if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
71
+ var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
72
+ opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
73
+ block: 'center',
74
+ inline: 'center'
75
+ });
76
+ (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
77
+ block: 'nearest'
78
+ });
79
+ }
80
+ } else {
81
+ let scrollParents = (0, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(targetElement);
82
+ // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
83
+ for (let scrollParent of scrollParents)$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
84
+ }
85
+ }
86
+ }
87
+
88
+
89
+ export {$2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport};
90
+ //# sourceMappingURL=scrollIntoView.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAcM,SAAS,0CAAe,UAAuB,EAAE,OAAoB;IAC1E,IAAI,UAAU,qCAAe,YAAY,SAAS;IAClD,IAAI,UAAU,qCAAe,YAAY,SAAS;IAClD,IAAI,QAAQ,QAAQ,WAAW;IAC/B,IAAI,SAAS,QAAQ,YAAY;IACjC,IAAI,IAAI,WAAW,UAAU;IAC7B,IAAI,IAAI,WAAW,SAAS;IAE5B,6D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KAAK,WAAW,EAAC,GAAG,cAAc,qBAAqB;YAIhF,0BAAA,qCAAA,gCAAA,cAAe,cAAc,cAA7B,oDAAA,mCAAA,eAAgC;gBAAC,OAAO;YAAS;YACjD,IAAI,EAAC,MAAM,OAAO,EAAE,KAAK,MAAM,EAAC,GAAG,cAAc,qBAAqB;YACtE,kDAAkD;YAClD,IAAI,AAAC,KAAK,GAAG,CAAC,eAAe,WAAW,KAAO,KAAK,GAAG,CAAC,cAAc,UAAU,GAAI;oBAClF,wCAAA,yBACA;gBADA,iBAAA,4BAAA,0BAAA,KAAM,iBAAiB,cAAvB,+CAAA,yCAAA,wBAAyB,cAAc,cAAvC,6DAAA,4CAAA,yBAA0C;oBAAC,OAAO;oBAAU,QAAQ;gBAAQ;iBAC5E,iCAAA,cAAc,cAAc,cAA5B,qDAAA,oCAAA,eAA+B;oBAAC,OAAO;gBAAS;YAClD;QACF,OAAO;YACL,IAAI,gBAAgB,CAAA,GAAA,yCAAe,EAAE;YACrC,+JAA+J;YAC/J,KAAK,IAAI,gBAAgB,cACvB,0CAAe,cAA6B;QAEhD;IACF;AACF","sources":["packages/@react-aria/utils/src/scrollIntoView.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getScrollParents} from './getScrollParents';\n\ninterface ScrollIntoViewportOpts {\n /** The optional containing element of the target to be centered in the viewport. */\n containingElement?: Element\n}\n\n/**\n * Scrolls `scrollView` so that `element` is visible.\n * Similar to `element.scrollIntoView({block: 'nearest'})` (not supported in Edge),\n * but doesn't affect parents above `scrollView`.\n */\nexport function scrollIntoView(scrollView: HTMLElement, element: HTMLElement) {\n let offsetX = relativeOffset(scrollView, element, 'left');\n let offsetY = relativeOffset(scrollView, element, 'top');\n let width = element.offsetWidth;\n let height = element.offsetHeight;\n let x = scrollView.scrollLeft;\n let y = scrollView.scrollTop;\n\n // Account for top/left border offsetting the scroll top/Left\n let {borderTopWidth, borderLeftWidth} = getComputedStyle(scrollView);\n let borderAdjustedX = scrollView.scrollLeft + parseInt(borderLeftWidth, 10);\n let borderAdjustedY = scrollView.scrollTop + parseInt(borderTopWidth, 10);\n // Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width\n let maxX = borderAdjustedX + scrollView.clientWidth;\n let maxY = borderAdjustedY + scrollView.clientHeight;\n\n if (offsetX <= x) {\n x = offsetX - parseInt(borderLeftWidth, 10);\n } else if (offsetX + width > maxX) {\n x += offsetX + width - maxX;\n }\n if (offsetY <= borderAdjustedY) {\n y = offsetY - parseInt(borderTopWidth, 10);\n } else if (offsetY + height > maxY) {\n y += offsetY + height - maxY;\n }\n scrollView.scrollLeft = x;\n scrollView.scrollTop = y;\n}\n\n/**\n * Computes the offset left or top from child to ancestor by accumulating\n * offsetLeft or offsetTop through intervening offsetParents.\n */\nfunction relativeOffset(ancestor: HTMLElement, child: HTMLElement, axis: 'left'|'top') {\n const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';\n let sum = 0;\n while (child.offsetParent) {\n sum += child[prop];\n if (child.offsetParent === ancestor) {\n // Stop once we have found the ancestor we are interested in.\n break;\n } else if (child.offsetParent.contains(ancestor)) {\n // If the ancestor is not `position:relative`, then we stop at\n // _its_ offset parent, and we subtract off _its_ offset, so that\n // we end up with the proper offset from child to ancestor.\n sum -= ancestor[prop];\n break;\n }\n child = child.offsetParent as HTMLElement;\n }\n return sum;\n}\n\n/**\n * Scrolls the `targetElement` so it is visible in the viewport. Accepts an optional `opts.containingElement`\n * that will be centered in the viewport prior to scrolling the targetElement into view. If scrolling is prevented on\n * the body (e.g. targetElement is in a popover), this will only scroll the scroll parents of the targetElement up to but not including the body itself.\n */\nexport function scrollIntoViewport(targetElement: Element, opts?: ScrollIntoViewportOpts) {\n if (document.contains(targetElement)) {\n let root = document.scrollingElement || document.documentElement;\n let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';\n // If scrolling is not currently prevented then we aren’t in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view\n if (!isScrollPrevented) {\n let {left: originalLeft, top: originalTop} = targetElement.getBoundingClientRect();\n\n // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()\n // won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically\n targetElement?.scrollIntoView?.({block: 'nearest'});\n let {left: newLeft, top: newTop} = targetElement.getBoundingClientRect();\n // Account for sub pixel differences from rounding\n if ((Math.abs(originalLeft - newLeft) > 1) || (Math.abs(originalTop - newTop) > 1)) {\n opts?.containingElement?.scrollIntoView?.({block: 'center', inline: 'center'});\n targetElement.scrollIntoView?.({block: 'nearest'});\n }\n } else {\n let scrollParents = getScrollParents(targetElement);\n // If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.\n for (let scrollParent of scrollParents) {\n scrollIntoView(scrollParent as HTMLElement, targetElement as HTMLElement);\n }\n }\n }\n}\n"],"names":[],"version":3,"file":"scrollIntoView.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React, { ForwardedRef, ReactNode, HTMLAttributes, MutableRefObject, EffectCallback, RefObject, Dispatch } from "react";
2
- import { AriaLabelingProps, DOMProps, LinkDOMProps, FocusableElement, Orientation } from "@react-types/shared";
1
+ import React, { ForwardedRef, MutableRefObject, ReactNode, HTMLAttributes, EffectCallback, RefObject, Dispatch } from "react";
2
+ import { AriaLabelingProps, DOMProps, LinkDOMProps, FocusableElement, Href, RouterOptions, Orientation } from "@react-types/shared";
3
3
  export const useLayoutEffect: typeof React.useLayoutEffect;
4
4
  /**
5
5
  * If a default is not provided, generate an id.
@@ -45,7 +45,7 @@ export function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersectio
45
45
  /**
46
46
  * Merges multiple refs into one. Works with either callback or object refs.
47
47
  */
48
- export function mergeRefs<T>(...refs: ForwardedRef<T>[]): ForwardedRef<T>;
48
+ export function mergeRefs<T>(...refs: Array<ForwardedRef<T> | MutableRefObject<T>>): ForwardedRef<T>;
49
49
  interface Options {
50
50
  /**
51
51
  * If labelling associated aria properties should be included in the filter.
@@ -77,10 +77,12 @@ export function isAndroid(): any;
77
77
  export function isFirefox(): any;
78
78
  interface Router {
79
79
  isNative: boolean;
80
- open: (target: Element, modifiers: Modifiers) => void;
80
+ open: (target: Element, modifiers: Modifiers, href: Href, routerOptions: RouterOptions | undefined) => void;
81
+ useHref: (href: Href) => string;
81
82
  }
82
83
  interface RouterProviderProps {
83
- navigate: (path: string) => void;
84
+ navigate: (path: Href, routerOptions: RouterOptions | undefined) => void;
85
+ useHref?: (href: Href) => string;
84
86
  children: ReactNode;
85
87
  }
86
88
  /**
@@ -105,6 +107,14 @@ export function getSyntheticLinkProps(props: LinkDOMProps): {
105
107
  'data-ping': string;
106
108
  'data-referrer-policy': React.HTMLAttributeReferrerPolicy;
107
109
  };
110
+ export function useLinkProps(props: LinkDOMProps): {
111
+ href: string;
112
+ target: React.HTMLAttributeAnchorTarget;
113
+ rel: string;
114
+ download: string | boolean;
115
+ ping: string;
116
+ referrerPolicy: React.HTMLAttributeReferrerPolicy;
117
+ };
108
118
  export function runAfterTransition(fn: () => void): void;
109
119
  interface UseDrag1DProps {
110
120
  containerRef: MutableRefObject<HTMLElement>;
@@ -154,8 +164,9 @@ interface ContextValue<T> {
154
164
  ref?: MutableRefObject<T | null>;
155
165
  }
156
166
  export function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T>): void;
157
- export function getScrollParent(node: Element, checkForOverflow?: boolean): Element;
158
167
  export function isScrollable(node: Element, checkForOverflow?: boolean): boolean;
168
+ export function getScrollParent(node: Element, checkForOverflow?: boolean): Element;
169
+ export function getScrollParents(node: Element, checkForOverflow?: boolean): Element[];
159
170
  interface ViewportSize {
160
171
  width: number;
161
172
  height: number;
@@ -1 +1 @@
1
- {"mappings":";;AAiBA,OAAO,MAAM,6CAED,CAAC;ACOb;;;GAGG;AACH,sBAAsB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAgChD;AAED;;;GAGG;AACH,yBAAyB,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBzD;AAED;;;;GAIG;AACH,0BAA0B,QAAQ,GAAE,aAAa,CAAC,GAAG,CAAM,GAAG,MAAM,CAcnE;AC/FD;;GAEG;AACH,sBAAsB,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAQnE;ACvBD,OAAO,MAAM,uBAAwB,OAAO,GAAG,IAAI,GAAG,SAAS,KAAG,QAEjE,CAAC;AAEF,OAAO,MAAM,qBACP,CAAC,MAAM,GAAG,OAAO,MAAM,CAAC,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,KACxD,MAAM,GAAG,OAAO,MAOlB,CAAC;ACGF;IACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,gBAAgB,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAGzC,gBAAgB,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CAAE,GAAG,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC;AAC3G,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE7D,yBAAyB,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAA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0C/F;ACjDD;IACE,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;;GAIG;AACH,+BAA+B,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,QA4B3E;AA0BD;;;;GAIG;AACH,mCAAmC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,sBAAsB,QA2BvF;ACrFD,+BAA+B,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAcxE;AAED,sCAAsC,KAAK,EAAE,YAAY,WAgBxD;ACzCD,4BAA4B,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,CAU5E;ACZD,6BAA6B,CAAC,EAC5B,GAAG,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC,EAC1E,YAAY,EAAE,CAAC,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAgB5B;ACGD,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC","sources":["packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLayoutEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useId.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/chain.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/domHelpers.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeRefs.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/filterDOMProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/focusWithoutScrolling.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getOffset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/platform.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/openLink.tsx","packages/@react-aria/utils/src/packages/@react-aria/utils/src/runAfterTransition.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDrag1D.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useGlobalListeners.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLabels.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useObjectRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useUpdateEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useResizeObserver.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useSyncRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useViewportSize.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDescription.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEffectEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useValueEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/scrollIntoView.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isVirtualEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDeepMemo.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useFormReset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/index.ts","packages/@react-aria/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,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 {useId, mergeIds, useSlotId} from './useId';\nexport {chain} from './chain';\nexport {getOwnerDocument, getOwnerWindow} from './domHelpers';\nexport {mergeProps} from './mergeProps';\nexport {mergeRefs} from './mergeRefs';\nexport {filterDOMProps} from './filterDOMProps';\nexport {focusWithoutScrolling} from './focusWithoutScrolling';\nexport {getOffset} from './getOffset';\nexport {openLink, getSyntheticLinkProps, RouterProvider, shouldClientNavigate, useRouter} from './openLink';\nexport {runAfterTransition} from './runAfterTransition';\nexport {useDrag1D} from './useDrag1D';\nexport {useGlobalListeners} from './useGlobalListeners';\nexport {useLabels} from './useLabels';\nexport {useObjectRef} from './useObjectRef';\nexport {useUpdateEffect} from './useUpdateEffect';\nexport {useLayoutEffect} from './useLayoutEffect';\nexport {useResizeObserver} from './useResizeObserver';\nexport {useSyncRef} from './useSyncRef';\nexport {getScrollParent, isScrollable} from './getScrollParent';\nexport {useViewportSize} from './useViewportSize';\nexport {useDescription} from './useDescription';\nexport {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid, isFirefox} from './platform';\nexport {useEvent} from './useEvent';\nexport {useValueEffect} from './useValueEffect';\nexport {scrollIntoView, scrollIntoViewport} from './scrollIntoView';\nexport {clamp, snapValueToStep} from '@react-stately/utils';\nexport {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';\nexport {useEffectEvent} from './useEffectEvent';\nexport {useDeepMemo} from './useDeepMemo';\nexport {useFormReset} from './useFormReset';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAiBA,OAAO,MAAM,6CAED,CAAC;ACOb;;;GAGG;AACH,sBAAsB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAgChD;AAED;;;GAGG;AACH,yBAAyB,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBzD;AAED;;;;GAIG;AACH,0BAA0B,QAAQ,GAAE,aAAa,CAAC,GAAG,CAAM,GAAG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;ACjDD;IACE,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;;GAIG;AACH,+BAA+B,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,QA4B3E;AA0BD;;;;GAIG;AACH,mCAAmC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,sBAAsB,QAyBvF;ACnFD,+BAA+B,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAcxE;AAED,sCAAsC,KAAK,EAAE,YAAY,WAgBxD;ACzCD,4BAA4B,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,CAU5E;ACZD,6BAA6B,CAAC,EAC5B,GAAG,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC,EAC1E,YAAY,EAAE,CAAC,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAgB5B;ACKD,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC","sources":["packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLayoutEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useId.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/chain.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/domHelpers.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/mergeRefs.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/filterDOMProps.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/focusWithoutScrolling.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getOffset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/platform.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/openLink.tsx","packages/@react-aria/utils/src/packages/@react-aria/utils/src/runAfterTransition.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDrag1D.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useGlobalListeners.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useLabels.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useObjectRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useUpdateEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useResizeObserver.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useSyncRef.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isScrollable.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/getScrollParents.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useViewportSize.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDescription.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEffectEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useValueEffect.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/scrollIntoView.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/isVirtualEvent.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useDeepMemo.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/useFormReset.ts","packages/@react-aria/utils/src/packages/@react-aria/utils/src/index.ts","packages/@react-aria/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,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 {useId, mergeIds, useSlotId} from './useId';\nexport {chain} from './chain';\nexport {getOwnerDocument, getOwnerWindow} from './domHelpers';\nexport {mergeProps} from './mergeProps';\nexport {mergeRefs} from './mergeRefs';\nexport {filterDOMProps} from './filterDOMProps';\nexport {focusWithoutScrolling} from './focusWithoutScrolling';\nexport {getOffset} from './getOffset';\nexport {openLink, getSyntheticLinkProps, RouterProvider, shouldClientNavigate, useRouter, useLinkProps} from './openLink';\nexport {runAfterTransition} from './runAfterTransition';\nexport {useDrag1D} from './useDrag1D';\nexport {useGlobalListeners} from './useGlobalListeners';\nexport {useLabels} from './useLabels';\nexport {useObjectRef} from './useObjectRef';\nexport {useUpdateEffect} from './useUpdateEffect';\nexport {useLayoutEffect} from './useLayoutEffect';\nexport {useResizeObserver} from './useResizeObserver';\nexport {useSyncRef} from './useSyncRef';\nexport {getScrollParent} from './getScrollParent';\nexport {getScrollParents} from './getScrollParents';\nexport {isScrollable} from './isScrollable';\nexport {useViewportSize} from './useViewportSize';\nexport {useDescription} from './useDescription';\nexport {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid, isFirefox} from './platform';\nexport {useEvent} from './useEvent';\nexport {useValueEffect} from './useValueEffect';\nexport {scrollIntoView, scrollIntoViewport} from './scrollIntoView';\nexport {clamp, snapValueToStep} from '@react-stately/utils';\nexport {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';\nexport {useEffectEvent} from './useEffectEvent';\nexport {useDeepMemo} from './useDeepMemo';\nexport {useFormReset} from './useFormReset';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -0,0 +1,30 @@
1
+ var $4FGhO$react = require("react");
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, "useDeepMemo", () => $20e6e72fbf5dc81e$export$722debc0e56fea39);
9
+ /*
10
+ * Copyright 2023 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
+ */ /* eslint-disable rulesdir/pure-render */
20
+ function $20e6e72fbf5dc81e$export$722debc0e56fea39(value, isEqual) {
21
+ // Using a ref during render is ok here because it's only an optimization – both values are equivalent.
22
+ // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.
23
+ let lastValue = (0, $4FGhO$react.useRef)(null);
24
+ if (value && lastValue.current && isEqual(value, lastValue.current)) value = lastValue.current;
25
+ lastValue.current = value;
26
+ return value;
27
+ }
28
+
29
+
30
+ //# sourceMappingURL=useDeepMemo.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,uCAAuC;AAIhC,SAAS,0CAAe,KAAQ,EAAE,OAAgC;IACvE,uGAAuG;IACvG,yGAAyG;IACzG,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAY;IACjC,IAAI,SAAS,UAAU,OAAO,IAAI,QAAQ,OAAO,UAAU,OAAO,GAChE,QAAQ,UAAU,OAAO;IAG3B,UAAU,OAAO,GAAG;IACpB,OAAO;AACT","sources":["packages/@react-aria/utils/src/useDeepMemo.ts"],"sourcesContent":["/*\n * Copyright 2023 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\n/* eslint-disable rulesdir/pure-render */\n\nimport {useRef} from 'react';\n\nexport function useDeepMemo<T>(value: T, isEqual: (a: T, b: T) => boolean): T {\n // Using a ref during render is ok here because it's only an optimization – both values are equivalent.\n // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.\n let lastValue = useRef<T | null>(null);\n if (value && lastValue.current && isEqual(value, lastValue.current)) {\n value = lastValue.current;\n }\n\n lastValue.current = value;\n return value;\n}\n"],"names":[],"version":3,"file":"useDeepMemo.main.js.map"}
@@ -0,0 +1,25 @@
1
+ import {useRef as $jtQ6z$useRef} from "react";
2
+
3
+ /*
4
+ * Copyright 2023 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
+ */ /* eslint-disable rulesdir/pure-render */
14
+ function $5a387cc49350e6db$export$722debc0e56fea39(value, isEqual) {
15
+ // Using a ref during render is ok here because it's only an optimization – both values are equivalent.
16
+ // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.
17
+ let lastValue = (0, $jtQ6z$useRef)(null);
18
+ if (value && lastValue.current && isEqual(value, lastValue.current)) value = lastValue.current;
19
+ lastValue.current = value;
20
+ return value;
21
+ }
22
+
23
+
24
+ export {$5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo};
25
+ //# sourceMappingURL=useDeepMemo.module.js.map
@@ -0,0 +1,25 @@
1
+ import {useRef as $jtQ6z$useRef} from "react";
2
+
3
+ /*
4
+ * Copyright 2023 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
+ */ /* eslint-disable rulesdir/pure-render */
14
+ function $5a387cc49350e6db$export$722debc0e56fea39(value, isEqual) {
15
+ // Using a ref during render is ok here because it's only an optimization – both values are equivalent.
16
+ // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.
17
+ let lastValue = (0, $jtQ6z$useRef)(null);
18
+ if (value && lastValue.current && isEqual(value, lastValue.current)) value = lastValue.current;
19
+ lastValue.current = value;
20
+ return value;
21
+ }
22
+
23
+
24
+ export {$5a387cc49350e6db$export$722debc0e56fea39 as useDeepMemo};
25
+ //# sourceMappingURL=useDeepMemo.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,uCAAuC;AAIhC,SAAS,0CAAe,KAAQ,EAAE,OAAgC;IACvE,uGAAuG;IACvG,yGAAyG;IACzG,IAAI,YAAY,CAAA,GAAA,aAAK,EAAY;IACjC,IAAI,SAAS,UAAU,OAAO,IAAI,QAAQ,OAAO,UAAU,OAAO,GAChE,QAAQ,UAAU,OAAO;IAG3B,UAAU,OAAO,GAAG;IACpB,OAAO;AACT","sources":["packages/@react-aria/utils/src/useDeepMemo.ts"],"sourcesContent":["/*\n * Copyright 2023 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\n/* eslint-disable rulesdir/pure-render */\n\nimport {useRef} from 'react';\n\nexport function useDeepMemo<T>(value: T, isEqual: (a: T, b: T) => boolean): T {\n // Using a ref during render is ok here because it's only an optimization – both values are equivalent.\n // If a render is thrown away, it'll still work the same no matter if the next render is the same or not.\n let lastValue = useRef<T | null>(null);\n if (value && lastValue.current && isEqual(value, lastValue.current)) {\n value = lastValue.current;\n }\n\n lastValue.current = value;\n return value;\n}\n"],"names":[],"version":3,"file":"useDeepMemo.module.js.map"}
@@ -0,0 +1,59 @@
1
+ var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
2
+ var $7PjpK$react = require("react");
3
+
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+
9
+ $parcel$export(module.exports, "useDescription", () => $34da4502ea8120db$export$f8aeda7b10753fa1);
10
+ /*
11
+ * Copyright 2020 Adobe. All rights reserved.
12
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License. You may obtain a copy
14
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software distributed under
17
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
+ * OF ANY KIND, either express or implied. See the License for the specific language
19
+ * governing permissions and limitations under the License.
20
+ */
21
+
22
+ let $34da4502ea8120db$var$descriptionId = 0;
23
+ const $34da4502ea8120db$var$descriptionNodes = new Map();
24
+ function $34da4502ea8120db$export$f8aeda7b10753fa1(description) {
25
+ let [id, setId] = (0, $7PjpK$react.useState)();
26
+ (0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
27
+ if (!description) return;
28
+ let desc = $34da4502ea8120db$var$descriptionNodes.get(description);
29
+ if (!desc) {
30
+ let id = `react-aria-description-${$34da4502ea8120db$var$descriptionId++}`;
31
+ setId(id);
32
+ let node = document.createElement('div');
33
+ node.id = id;
34
+ node.style.display = 'none';
35
+ node.textContent = description;
36
+ document.body.appendChild(node);
37
+ desc = {
38
+ refCount: 0,
39
+ element: node
40
+ };
41
+ $34da4502ea8120db$var$descriptionNodes.set(description, desc);
42
+ } else setId(desc.element.id);
43
+ desc.refCount++;
44
+ return ()=>{
45
+ if (desc && --desc.refCount === 0) {
46
+ desc.element.remove();
47
+ $34da4502ea8120db$var$descriptionNodes.delete(description);
48
+ }
49
+ };
50
+ }, [
51
+ description
52
+ ]);
53
+ return {
54
+ 'aria-describedby': description ? id : undefined
55
+ };
56
+ }
57
+
58
+
59
+ //# sourceMappingURL=useDescription.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMD,IAAI,sCAAgB;AACpB,MAAM,yCAAmB,IAAI;AAEtB,SAAS,0CAAe,WAAoB;IACjD,IAAI,CAAC,IAAI,MAAM,GAAG,CAAA,GAAA,qBAAO;IAEzB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,CAAC,aACH;QAGF,IAAI,OAAO,uCAAiB,GAAG,CAAC;QAChC,IAAI,CAAC,MAAM;YACT,IAAI,KAAK,CAAC,uBAAuB,EAAE,sCAAgB,CAAC;YACpD,MAAM;YAEN,IAAI,OAAO,SAAS,aAAa,CAAC;YAClC,KAAK,EAAE,GAAG;YACV,KAAK,KAAK,CAAC,OAAO,GAAG;YACrB,KAAK,WAAW,GAAG;YACnB,SAAS,IAAI,CAAC,WAAW,CAAC;YAC1B,OAAO;gBAAC,UAAU;gBAAG,SAAS;YAAI;YAClC,uCAAiB,GAAG,CAAC,aAAa;QACpC,OACE,MAAM,KAAK,OAAO,CAAC,EAAE;QAGvB,KAAK,QAAQ;QACb,OAAO;YACL,IAAI,QAAQ,EAAE,KAAK,QAAQ,KAAK,GAAG;gBACjC,KAAK,OAAO,CAAC,MAAM;gBACnB,uCAAiB,MAAM,CAAC;YAC1B;QACF;IACF,GAAG;QAAC;KAAY;IAEhB,OAAO;QACL,oBAAoB,cAAc,KAAK;IACzC;AACF","sources":["packages/@react-aria/utils/src/useDescription.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps} from '@react-types/shared';\nimport {useLayoutEffect} from './useLayoutEffect';\nimport {useState} from 'react';\n\nlet descriptionId = 0;\nconst descriptionNodes = new Map<string, {refCount: number, element: Element}>();\n\nexport function useDescription(description?: string): AriaLabelingProps {\n let [id, setId] = useState<string | undefined>();\n\n useLayoutEffect(() => {\n if (!description) {\n return;\n }\n\n let desc = descriptionNodes.get(description);\n if (!desc) {\n let id = `react-aria-description-${descriptionId++}`;\n setId(id);\n\n let node = document.createElement('div');\n node.id = id;\n node.style.display = 'none';\n node.textContent = description;\n document.body.appendChild(node);\n desc = {refCount: 0, element: node};\n descriptionNodes.set(description, desc);\n } else {\n setId(desc.element.id);\n }\n\n desc.refCount++;\n return () => {\n if (desc && --desc.refCount === 0) {\n desc.element.remove();\n descriptionNodes.delete(description);\n }\n };\n }, [description]);\n\n return {\n 'aria-describedby': description ? id : undefined\n };\n}\n"],"names":[],"version":3,"file":"useDescription.main.js.map"}