@react-aria/overlays 3.22.0 → 3.22.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 (74) hide show
  1. package/dist/DismissButton.main.js +2 -2
  2. package/dist/DismissButton.mjs +3 -3
  3. package/dist/DismissButton.module.js +2 -2
  4. package/dist/Overlay.mjs +1 -1
  5. package/dist/PortalProvider.mjs +1 -1
  6. package/dist/ar-AE.mjs +1 -1
  7. package/dist/ariaHideOutside.main.js +7 -7
  8. package/dist/ariaHideOutside.mjs +8 -8
  9. package/dist/ariaHideOutside.module.js +7 -7
  10. package/dist/bg-BG.mjs +1 -1
  11. package/dist/calculatePosition.main.js +40 -40
  12. package/dist/calculatePosition.main.js.map +1 -1
  13. package/dist/calculatePosition.mjs +41 -41
  14. package/dist/calculatePosition.module.js +40 -40
  15. package/dist/calculatePosition.module.js.map +1 -1
  16. package/dist/cs-CZ.mjs +1 -1
  17. package/dist/da-DK.mjs +1 -1
  18. package/dist/de-DE.mjs +1 -1
  19. package/dist/el-GR.mjs +1 -1
  20. package/dist/en-US.mjs +1 -1
  21. package/dist/es-ES.mjs +1 -1
  22. package/dist/et-EE.mjs +1 -1
  23. package/dist/fi-FI.mjs +1 -1
  24. package/dist/fr-FR.mjs +1 -1
  25. package/dist/he-IL.mjs +1 -1
  26. package/dist/hr-HR.mjs +1 -1
  27. package/dist/hu-HU.mjs +1 -1
  28. package/dist/intlStrings.mjs +1 -1
  29. package/dist/it-IT.mjs +1 -1
  30. package/dist/ja-JP.mjs +1 -1
  31. package/dist/ko-KR.mjs +1 -1
  32. package/dist/lt-LT.mjs +1 -1
  33. package/dist/lv-LV.mjs +1 -1
  34. package/dist/nb-NO.mjs +1 -1
  35. package/dist/nl-NL.mjs +1 -1
  36. package/dist/pl-PL.mjs +1 -1
  37. package/dist/pt-BR.mjs +1 -1
  38. package/dist/pt-PT.mjs +1 -1
  39. package/dist/ro-RO.mjs +1 -1
  40. package/dist/ru-RU.mjs +1 -1
  41. package/dist/sk-SK.mjs +1 -1
  42. package/dist/sl-SI.mjs +1 -1
  43. package/dist/sr-SP.mjs +1 -1
  44. package/dist/sv-SE.mjs +1 -1
  45. package/dist/tr-TR.mjs +1 -1
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/uk-UA.mjs +1 -1
  48. package/dist/useCloseOnScroll.main.js +2 -2
  49. package/dist/useCloseOnScroll.mjs +3 -3
  50. package/dist/useCloseOnScroll.module.js +2 -2
  51. package/dist/useModal.main.js +4 -4
  52. package/dist/useModal.mjs +5 -5
  53. package/dist/useModal.module.js +4 -4
  54. package/dist/useModalOverlay.mjs +1 -1
  55. package/dist/useOverlay.main.js +1 -1
  56. package/dist/useOverlay.mjs +2 -2
  57. package/dist/useOverlay.module.js +1 -1
  58. package/dist/useOverlayPosition.main.js +25 -16
  59. package/dist/useOverlayPosition.main.js.map +1 -1
  60. package/dist/useOverlayPosition.mjs +26 -17
  61. package/dist/useOverlayPosition.module.js +25 -16
  62. package/dist/useOverlayPosition.module.js.map +1 -1
  63. package/dist/useOverlayTrigger.main.js +5 -5
  64. package/dist/useOverlayTrigger.mjs +6 -6
  65. package/dist/useOverlayTrigger.module.js +5 -5
  66. package/dist/usePopover.mjs +1 -1
  67. package/dist/usePreventScroll.main.js +22 -22
  68. package/dist/usePreventScroll.mjs +23 -23
  69. package/dist/usePreventScroll.module.js +22 -22
  70. package/dist/zh-CN.mjs +1 -1
  71. package/dist/zh-TW.mjs +1 -1
  72. package/package.json +12 -12
  73. package/src/calculatePosition.ts +3 -3
  74. package/src/useOverlayPosition.ts +8 -3
@@ -20,10 +20,10 @@ import {useLocale as $39EOa$useLocale} from "@react-aria/i18n";
20
20
 
21
21
 
22
22
  // @ts-ignore
23
- let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
23
+ let $2a41e45df1593e64$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
24
24
  function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
25
25
  let { direction: direction } = (0, $39EOa$useLocale)();
26
- let { arrowSize: arrowSize = 0, targetRef: targetRef, overlayRef: overlayRef, scrollRef: scrollRef = overlayRef, placement: placement = "bottom", containerPadding: containerPadding = 12, shouldFlip: shouldFlip = true, boundaryElement: boundaryElement = typeof document !== "undefined" ? document.body : null, offset: offset = 0, crossOffset: crossOffset = 0, shouldUpdatePosition: shouldUpdatePosition = true, isOpen: isOpen = true, onClose: onClose, maxHeight: maxHeight, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
26
+ let { arrowSize: arrowSize = 0, targetRef: targetRef, overlayRef: overlayRef, scrollRef: scrollRef = overlayRef, placement: placement = 'bottom', containerPadding: containerPadding = 12, shouldFlip: shouldFlip = true, boundaryElement: boundaryElement = typeof document !== 'undefined' ? document.body : null, offset: offset = 0, crossOffset: crossOffset = 0, shouldUpdatePosition: shouldUpdatePosition = true, isOpen: isOpen = true, onClose: onClose, maxHeight: maxHeight, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
27
27
  let [position, setPosition] = (0, $39EOa$useState)({
28
28
  position: {},
29
29
  arrowOffsetLeft: undefined,
@@ -62,7 +62,14 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
62
62
  if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current) return;
63
63
  // Always reset the overlay's previous max height if not defined by the user so that we can compensate for
64
64
  // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.
65
- if (!maxHeight && overlayRef.current) overlayRef.current.style.maxHeight = "none";
65
+ let overlay = overlayRef.current;
66
+ if (!maxHeight && overlayRef.current) {
67
+ var _window_visualViewport;
68
+ overlay.style.top = '0px';
69
+ overlay.style.bottom = '';
70
+ var _window_visualViewport_height;
71
+ overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + 'px';
72
+ }
66
73
  let position = (0, $edcf132a9284368a$export$b3ceb0cbf1056d98)({
67
74
  placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
68
75
  overlayNode: overlayRef.current,
@@ -79,8 +86,10 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
79
86
  });
80
87
  // Modify overlay styles directly so positioning happens immediately without the need of a second render
81
88
  // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers
82
- Object.keys(position.position).forEach((key)=>overlayRef.current.style[key] = position.position[key] + "px");
83
- overlayRef.current.style.maxHeight = position.maxHeight != null ? position.maxHeight + "px" : undefined;
89
+ overlay.style.top = '';
90
+ overlay.style.bottom = '';
91
+ Object.keys(position.position).forEach((key)=>overlay.style[key] = position.position[key] + 'px');
92
+ overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : undefined;
84
93
  // Trigger a set state for a second render anyway for arrow positioning
85
94
  setPosition(position);
86
95
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -113,11 +122,11 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
113
122
  let onScroll = ()=>{
114
123
  if (isResizing.current) onResize();
115
124
  };
116
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize);
117
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll);
125
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener('resize', onResize);
126
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener('scroll', onScroll);
118
127
  return ()=>{
119
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize);
120
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll);
128
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener('resize', onResize);
129
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener('scroll', onScroll);
121
130
  };
122
131
  }, [
123
132
  updatePosition
@@ -138,7 +147,7 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
138
147
  return {
139
148
  overlayProps: {
140
149
  style: {
141
- position: "absolute",
150
+ position: 'absolute',
142
151
  zIndex: 100000,
143
152
  ...position.position,
144
153
  maxHeight: position.maxHeight
@@ -146,8 +155,8 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
146
155
  },
147
156
  placement: position.placement,
148
157
  arrowProps: {
149
- "aria-hidden": "true",
150
- role: "presentation",
158
+ 'aria-hidden': 'true',
159
+ role: 'presentation',
151
160
  style: {
152
161
  left: position.arrowOffsetLeft,
153
162
  top: position.arrowOffsetTop
@@ -158,19 +167,19 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
158
167
  }
159
168
  function $2a41e45df1593e64$var$useResize(onResize) {
160
169
  (0, $39EOa$useLayoutEffect)(()=>{
161
- window.addEventListener("resize", onResize, false);
170
+ window.addEventListener('resize', onResize, false);
162
171
  return ()=>{
163
- window.removeEventListener("resize", onResize, false);
172
+ window.removeEventListener('resize', onResize, false);
164
173
  };
165
174
  }, [
166
175
  onResize
167
176
  ]);
168
177
  }
169
178
  function $2a41e45df1593e64$var$translateRTL(position, direction) {
170
- if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
171
- return position.replace("start", "left").replace("end", "right");
179
+ if (direction === 'rtl') return position.replace('start', 'right').replace('end', 'left');
180
+ return position.replace('start', 'left').replace('end', 'right');
172
181
  }
173
182
 
174
183
 
175
184
  export {$2a41e45df1593e64$export$d39e1813b3bdd0e1 as useOverlayPosition};
176
- //# sourceMappingURL=useOverlayPosition.mjs.map
185
+ //# sourceMappingURL=useOverlayPosition.module.js.map
@@ -20,10 +20,10 @@ import {useLocale as $39EOa$useLocale} from "@react-aria/i18n";
20
20
 
21
21
 
22
22
  // @ts-ignore
23
- let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
23
+ let $2a41e45df1593e64$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
24
24
  function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
25
25
  let { direction: direction } = (0, $39EOa$useLocale)();
26
- let { arrowSize: arrowSize = 0, targetRef: targetRef, overlayRef: overlayRef, scrollRef: scrollRef = overlayRef, placement: placement = "bottom", containerPadding: containerPadding = 12, shouldFlip: shouldFlip = true, boundaryElement: boundaryElement = typeof document !== "undefined" ? document.body : null, offset: offset = 0, crossOffset: crossOffset = 0, shouldUpdatePosition: shouldUpdatePosition = true, isOpen: isOpen = true, onClose: onClose, maxHeight: maxHeight, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
26
+ let { arrowSize: arrowSize = 0, targetRef: targetRef, overlayRef: overlayRef, scrollRef: scrollRef = overlayRef, placement: placement = 'bottom', containerPadding: containerPadding = 12, shouldFlip: shouldFlip = true, boundaryElement: boundaryElement = typeof document !== 'undefined' ? document.body : null, offset: offset = 0, crossOffset: crossOffset = 0, shouldUpdatePosition: shouldUpdatePosition = true, isOpen: isOpen = true, onClose: onClose, maxHeight: maxHeight, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
27
27
  let [position, setPosition] = (0, $39EOa$useState)({
28
28
  position: {},
29
29
  arrowOffsetLeft: undefined,
@@ -62,7 +62,14 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
62
62
  if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current) return;
63
63
  // Always reset the overlay's previous max height if not defined by the user so that we can compensate for
64
64
  // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.
65
- if (!maxHeight && overlayRef.current) overlayRef.current.style.maxHeight = "none";
65
+ let overlay = overlayRef.current;
66
+ if (!maxHeight && overlayRef.current) {
67
+ var _window_visualViewport;
68
+ overlay.style.top = '0px';
69
+ overlay.style.bottom = '';
70
+ var _window_visualViewport_height;
71
+ overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + 'px';
72
+ }
66
73
  let position = (0, $edcf132a9284368a$export$b3ceb0cbf1056d98)({
67
74
  placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
68
75
  overlayNode: overlayRef.current,
@@ -79,8 +86,10 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
79
86
  });
80
87
  // Modify overlay styles directly so positioning happens immediately without the need of a second render
81
88
  // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers
82
- Object.keys(position.position).forEach((key)=>overlayRef.current.style[key] = position.position[key] + "px");
83
- overlayRef.current.style.maxHeight = position.maxHeight != null ? position.maxHeight + "px" : undefined;
89
+ overlay.style.top = '';
90
+ overlay.style.bottom = '';
91
+ Object.keys(position.position).forEach((key)=>overlay.style[key] = position.position[key] + 'px');
92
+ overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : undefined;
84
93
  // Trigger a set state for a second render anyway for arrow positioning
85
94
  setPosition(position);
86
95
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -113,11 +122,11 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
113
122
  let onScroll = ()=>{
114
123
  if (isResizing.current) onResize();
115
124
  };
116
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize);
117
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll);
125
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener('resize', onResize);
126
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener('scroll', onScroll);
118
127
  return ()=>{
119
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize);
120
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll);
128
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener('resize', onResize);
129
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener('scroll', onScroll);
121
130
  };
122
131
  }, [
123
132
  updatePosition
@@ -138,7 +147,7 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
138
147
  return {
139
148
  overlayProps: {
140
149
  style: {
141
- position: "absolute",
150
+ position: 'absolute',
142
151
  zIndex: 100000,
143
152
  ...position.position,
144
153
  maxHeight: position.maxHeight
@@ -146,8 +155,8 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
146
155
  },
147
156
  placement: position.placement,
148
157
  arrowProps: {
149
- "aria-hidden": "true",
150
- role: "presentation",
158
+ 'aria-hidden': 'true',
159
+ role: 'presentation',
151
160
  style: {
152
161
  left: position.arrowOffsetLeft,
153
162
  top: position.arrowOffsetTop
@@ -158,17 +167,17 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
158
167
  }
159
168
  function $2a41e45df1593e64$var$useResize(onResize) {
160
169
  (0, $39EOa$useLayoutEffect)(()=>{
161
- window.addEventListener("resize", onResize, false);
170
+ window.addEventListener('resize', onResize, false);
162
171
  return ()=>{
163
- window.removeEventListener("resize", onResize, false);
172
+ window.removeEventListener('resize', onResize, false);
164
173
  };
165
174
  }, [
166
175
  onResize
167
176
  ]);
168
177
  }
169
178
  function $2a41e45df1593e64$var$translateRTL(position, direction) {
170
- if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
171
- return position.replace("start", "left").replace("end", "right");
179
+ if (direction === 'rtl') return position.replace('start', 'right').replace('end', 'left');
180
+ return position.replace('start', 'left').replace('end', 'right');
172
181
  }
173
182
 
174
183
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgED,aAAa;AACb,IAAI,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAMtE,SAAS,0CAAmB,KAAwB;IACzD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,aACF,YAAY,cACZ,SAAS,cACT,UAAU,aACV,YAAY,uBACZ,YAAY,4BACZ,mBAAmB,gBACnB,aAAa,uBACb,kBAAkB,OAAO,aAAa,cAAc,SAAS,IAAI,GAAG,cACpE,SAAS,gBACT,cAAc,yBACd,uBAAuB,cACvB,SAAS,eACT,OAAO,aACP,SAAS,uBACT,sBAAsB,GACvB,GAAG;IACJ,IAAI,CAAC,UAAU,YAAY,GAAG,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7B,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,MAAM,SAAS,eAAe;gBAC9B,KAAK,SAAS,cAAc;YAC9B;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,sBAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/@react-aria/overlays/src/useOverlayPosition.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 {calculatePosition, PositionResult} from './calculatePosition';\nimport {DOMAttributes} from '@react-types/shared';\nimport {Placement, PlacementAxis, PositionProps} from '@react-types/overlays';\nimport {RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n * @default 0\n */\n arrowSize?: number,\n /**\n * Element that that serves as the positioning boundary.\n * @default document.body\n */\n boundaryElement?: Element,\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element>,\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element>,\n /**\n * A ref for the scrollable region within the overlay.\n * @default overlayRef\n */\n scrollRef?: RefObject<Element>,\n /**\n * Whether the overlay should update its position automatically.\n * @default true\n */\n shouldUpdatePosition?: boolean,\n /** Handler that is called when the overlay should close. */\n onClose?: () => void,\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number,\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n * @default 0\n */\n arrowBoundaryOffset?: number\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes,\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes,\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis,\n /** Updates the position of the overlay. */\n updatePosition(): void\n}\n\n// @ts-ignore\nlet visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize = 0,\n targetRef,\n overlayRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0\n } = props;\n let [position, setPosition] = useState<PositionResult>({\n position: {},\n arrowOffsetLeft: undefined,\n arrowOffsetTop: undefined,\n maxHeight: undefined,\n placement: undefined\n });\n\n let deps = [\n shouldUpdatePosition,\n placement,\n overlayRef.current,\n targetRef.current,\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n if (!maxHeight && overlayRef.current) {\n (overlayRef.current as HTMLElement).style.maxHeight = 'none';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize,\n arrowBoundaryOffset\n });\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n Object.keys(position.position).forEach(key => (overlayRef.current as HTMLElement).style[key] = position.position[key] + 'px');\n (overlayRef.current as HTMLElement).style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : undefined;\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: 'absolute',\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position.position,\n maxHeight: position.maxHeight\n }\n },\n placement: position.placement,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position.arrowOffsetLeft,\n top: position.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.module.js.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgED,aAAa;AACb,IAAI,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAMtE,SAAS,0CAAmB,KAAwB;IACzD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA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AAgB,CAAC,UAAU;QAC3C,iDAAA,2DAAA,qCAAgB,gBAAgB,CAAC,UAAU;QAC3C,OAAO;YACL,iDAAA,2DAAA,qCAAgB,mBAAmB,CAAC,UAAU;YAC9C,iDAAA,2DAAA,qCAAgB,mBAAmB,CAAC,UAAU;QAChD;IACF,GAAG;QAAC;KAAe;IAEnB,IAAI,QAAQ,CAAA,GAAA,kBAAU,EAAE;QACtB,IAAI,CAAC,WAAW,OAAO,EACrB;IAEJ,GAAG;QAAC;QAAS;KAAW;IAExB,kFAAkF;IAClF,mEAAmE;IACnE,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY;gBACZ;QACA,SAAS,WAAW;IACtB;IAEA,OAAO;QACL,cAAc;YACZ,OAAO;gBACL,UAAU;gBACV,QAAQ;gBACR,GAAG,SAAS,QAAQ;gBACpB,WAAW,SAAS,SAAS;YAC/B;QACF;QACA,WAAW,SAAS,SAAS;QAC7B,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,MAAM,SAAS,eAAe;gBAC9B,KAAK,SAAS,cAAc;YAC9B;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,sBAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/@react-aria/overlays/src/useOverlayPosition.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 {calculatePosition, PositionResult} from './calculatePosition';\nimport {DOMAttributes} from '@react-types/shared';\nimport {Placement, PlacementAxis, PositionProps} from '@react-types/overlays';\nimport {RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n * @default 0\n */\n arrowSize?: number,\n /**\n * Element that that serves as the positioning boundary.\n * @default document.body\n */\n boundaryElement?: Element,\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element>,\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element>,\n /**\n * A ref for the scrollable region within the overlay.\n * @default overlayRef\n */\n scrollRef?: RefObject<Element>,\n /**\n * Whether the overlay should update its position automatically.\n * @default true\n */\n shouldUpdatePosition?: boolean,\n /** Handler that is called when the overlay should close. */\n onClose?: () => void,\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number,\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n * @default 0\n */\n arrowBoundaryOffset?: number\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes,\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes,\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis,\n /** Updates the position of the overlay. */\n updatePosition(): void\n}\n\n// @ts-ignore\nlet visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize = 0,\n targetRef,\n overlayRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0\n } = props;\n let [position, setPosition] = useState<PositionResult>({\n position: {},\n arrowOffsetLeft: undefined,\n arrowOffsetTop: undefined,\n maxHeight: undefined,\n placement: undefined\n });\n\n let deps = [\n shouldUpdatePosition,\n placement,\n overlayRef.current,\n targetRef.current,\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = (overlayRef.current as HTMLElement);\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize,\n arrowBoundaryOffset\n });\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n Object.keys(position.position).forEach(key => overlay.style[key] = position.position[key] + 'px');\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : undefined;\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: 'absolute',\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position.position,\n maxHeight: position.maxHeight\n }\n },\n placement: position.placement,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position.arrowOffsetLeft,\n top: position.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.module.js.map"}
@@ -34,14 +34,14 @@ function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
34
34
  // However, we only add it for menus for now because screen readers often
35
35
  // announce it as a menu even for other values.
36
36
  let ariaHasPopup = undefined;
37
- if (type === "menu") ariaHasPopup = true;
38
- else if (type === "listbox") ariaHasPopup = "listbox";
37
+ if (type === 'menu') ariaHasPopup = true;
38
+ else if (type === 'listbox') ariaHasPopup = 'listbox';
39
39
  let overlayId = (0, $3l9xr$reactariautils.useId)();
40
40
  return {
41
41
  triggerProps: {
42
- "aria-haspopup": ariaHasPopup,
43
- "aria-expanded": isOpen,
44
- "aria-controls": isOpen ? overlayId : null,
42
+ 'aria-haspopup': ariaHasPopup,
43
+ 'aria-expanded': isOpen,
44
+ 'aria-controls': isOpen ? overlayId : null,
45
45
  onPress: state.toggle
46
46
  },
47
47
  overlayProps: {
@@ -28,14 +28,14 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
28
28
  // However, we only add it for menus for now because screen readers often
29
29
  // announce it as a menu even for other values.
30
30
  let ariaHasPopup = undefined;
31
- if (type === "menu") ariaHasPopup = true;
32
- else if (type === "listbox") ariaHasPopup = "listbox";
31
+ if (type === 'menu') ariaHasPopup = true;
32
+ else if (type === 'listbox') ariaHasPopup = 'listbox';
33
33
  let overlayId = (0, $gMvIk$useId)();
34
34
  return {
35
35
  triggerProps: {
36
- "aria-haspopup": ariaHasPopup,
37
- "aria-expanded": isOpen,
38
- "aria-controls": isOpen ? overlayId : null,
36
+ 'aria-haspopup': ariaHasPopup,
37
+ 'aria-expanded': isOpen,
38
+ 'aria-controls': isOpen ? overlayId : null,
39
39
  onPress: state.toggle
40
40
  },
41
41
  overlayProps: {
@@ -46,4 +46,4 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
46
46
 
47
47
 
48
48
  export {$628037886ba31236$export$f9d5c8beee7d008d as useOverlayTrigger};
49
- //# sourceMappingURL=useOverlayTrigger.mjs.map
49
+ //# sourceMappingURL=useOverlayTrigger.module.js.map
@@ -28,14 +28,14 @@ function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
28
28
  // However, we only add it for menus for now because screen readers often
29
29
  // announce it as a menu even for other values.
30
30
  let ariaHasPopup = undefined;
31
- if (type === "menu") ariaHasPopup = true;
32
- else if (type === "listbox") ariaHasPopup = "listbox";
31
+ if (type === 'menu') ariaHasPopup = true;
32
+ else if (type === 'listbox') ariaHasPopup = 'listbox';
33
33
  let overlayId = (0, $gMvIk$useId)();
34
34
  return {
35
35
  triggerProps: {
36
- "aria-haspopup": ariaHasPopup,
37
- "aria-expanded": isOpen,
38
- "aria-controls": isOpen ? overlayId : null,
36
+ 'aria-haspopup': ariaHasPopup,
37
+ 'aria-expanded': isOpen,
38
+ 'aria-controls': isOpen ? overlayId : null,
39
39
  onPress: state.toggle
40
40
  },
41
41
  overlayProps: {
@@ -58,4 +58,4 @@ function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
58
58
 
59
59
 
60
60
  export {$f2f8a6077418541e$export$542a6fd13ac93354 as usePopover};
61
- //# sourceMappingURL=usePopover.mjs.map
61
+ //# sourceMappingURL=usePopover.module.js.map
@@ -18,18 +18,18 @@ $parcel$export(module.exports, "usePreventScroll", () => $5c2f5cd01815d369$expor
18
18
  * governing permissions and limitations under the License.
19
19
  */
20
20
  // @ts-ignore
21
- const $5c2f5cd01815d369$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
21
+ const $5c2f5cd01815d369$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
22
22
  // HTML input types that do not cause the software keyboard to appear.
23
23
  const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
24
- "checkbox",
25
- "radio",
26
- "range",
27
- "color",
28
- "file",
29
- "image",
30
- "button",
31
- "submit",
32
- "reset"
24
+ 'checkbox',
25
+ 'radio',
26
+ 'range',
27
+ 'color',
28
+ 'file',
29
+ 'image',
30
+ 'button',
31
+ 'submit',
32
+ 'reset'
33
33
  ]);
34
34
  // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
35
35
  let $5c2f5cd01815d369$var$preventScrollCount = 0;
@@ -54,7 +54,7 @@ function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {}) {
54
54
  // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
55
55
  // add some padding to prevent the page from shifting when the scrollbar is hidden.
56
56
  function $5c2f5cd01815d369$var$preventScrollStandard() {
57
- return (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"));
57
+ return (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, 'overflow', 'hidden'));
58
58
  }
59
59
  // Mobile Safari is a whole different beast. Even with overflow: hidden,
60
60
  // it still scrolls the page in many situations:
@@ -93,7 +93,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
93
93
  // Prevent scrolling up when at the top and scrolling down when at the bottom
94
94
  // of a nested scrollable area, otherwise mobile Safari will start scrolling
95
95
  // the window instead.
96
- if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto") restoreScrollableStyles = $5c2f5cd01815d369$var$setStyle(scrollable, "overscrollBehavior", "contain");
96
+ if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === 'auto') restoreScrollableStyles = $5c2f5cd01815d369$var$setStyle(scrollable, 'overscrollBehavior', 'contain');
97
97
  };
98
98
  let onTouchMove = (e)=>{
99
99
  // Prevent scrolling the window.
@@ -118,10 +118,10 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
118
118
  // Apply a transform to trick Safari into thinking the input is at the top of the page
119
119
  // so it doesn't try to scroll it into view. When tapping on an input, this needs to
120
120
  // be done before the "focus" event, so we have to focus the element ourselves.
121
- target.style.transform = "translateY(-2000px)";
121
+ target.style.transform = 'translateY(-2000px)';
122
122
  target.focus();
123
123
  requestAnimationFrame(()=>{
124
- target.style.transform = "";
124
+ target.style.transform = '';
125
125
  });
126
126
  }
127
127
  if (restoreScrollableStyles) restoreScrollableStyles();
@@ -134,9 +134,9 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
134
134
  // other than tapping on an input directly, e.g. the next/previous buttons in the
135
135
  // software keyboard. In these cases, it seems applying the transform in the focus event
136
136
  // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
137
- target.style.transform = "translateY(-2000px)";
137
+ target.style.transform = 'translateY(-2000px)';
138
138
  requestAnimationFrame(()=>{
139
- target.style.transform = "";
139
+ target.style.transform = '';
140
140
  // This will have prevented the browser from scrolling the focused element into view,
141
141
  // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
142
142
  if ($5c2f5cd01815d369$var$visualViewport) {
@@ -147,7 +147,7 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
147
147
  });
148
148
  else // Otherwise, wait for the visual viewport to resize before scrolling so we can
149
149
  // measure the correct position to scroll to.
150
- $5c2f5cd01815d369$var$visualViewport.addEventListener("resize", ()=>$5c2f5cd01815d369$var$scrollIntoView(target), {
150
+ $5c2f5cd01815d369$var$visualViewport.addEventListener('resize', ()=>$5c2f5cd01815d369$var$scrollIntoView(target), {
151
151
  once: true
152
152
  });
153
153
  }
@@ -167,22 +167,22 @@ function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
167
167
  // enable us to scroll the window to the top, which is required for the rest of this to work.
168
168
  let scrollX = window.pageXOffset;
169
169
  let scrollY = window.pageYOffset;
170
- restoreStyles = (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(window, "scroll", onWindowScroll), $5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"), $5c2f5cd01815d369$var$setStyle(document.body, "marginTop", `-${scrollY}px`), ()=>{
170
+ restoreStyles = (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(window, 'scroll', onWindowScroll), $5c2f5cd01815d369$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, 'overflow', 'hidden'), $5c2f5cd01815d369$var$setStyle(document.body, 'marginTop', `-${scrollY}px`), ()=>{
171
171
  window.scrollTo(scrollX, scrollY);
172
172
  });
173
173
  // Scroll to the top. The negative margin on the body will make this appear the same.
174
174
  window.scrollTo(0, 0);
175
175
  };
176
- let removeEvents = (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(document, "touchstart", onTouchStart, {
176
+ let removeEvents = (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(document, 'touchstart', onTouchStart, {
177
177
  passive: false,
178
178
  capture: true
179
- }), $5c2f5cd01815d369$var$addEvent(document, "touchmove", onTouchMove, {
179
+ }), $5c2f5cd01815d369$var$addEvent(document, 'touchmove', onTouchMove, {
180
180
  passive: false,
181
181
  capture: true
182
- }), $5c2f5cd01815d369$var$addEvent(document, "touchend", onTouchEnd, {
182
+ }), $5c2f5cd01815d369$var$addEvent(document, 'touchend', onTouchEnd, {
183
183
  passive: false,
184
184
  capture: true
185
- }), $5c2f5cd01815d369$var$addEvent(document, "focus", onFocus, true));
185
+ }), $5c2f5cd01815d369$var$addEvent(document, 'focus', onFocus, true));
186
186
  return ()=>{
187
187
  // Restore styles and scroll the page back to where it was.
188
188
  restoreScrollableStyles === null || restoreScrollableStyles === void 0 ? void 0 : restoreScrollableStyles();
@@ -12,18 +12,18 @@ import {useLayoutEffect as $7mMvr$useLayoutEffect, isIOS as $7mMvr$isIOS, chain
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
  // @ts-ignore
15
- const $49c51c25361d4cd2$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
15
+ const $49c51c25361d4cd2$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
16
16
  // HTML input types that do not cause the software keyboard to appear.
17
17
  const $49c51c25361d4cd2$var$nonTextInputTypes = new Set([
18
- "checkbox",
19
- "radio",
20
- "range",
21
- "color",
22
- "file",
23
- "image",
24
- "button",
25
- "submit",
26
- "reset"
18
+ 'checkbox',
19
+ 'radio',
20
+ 'range',
21
+ 'color',
22
+ 'file',
23
+ 'image',
24
+ 'button',
25
+ 'submit',
26
+ 'reset'
27
27
  ]);
28
28
  // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
29
29
  let $49c51c25361d4cd2$var$preventScrollCount = 0;
@@ -48,7 +48,7 @@ function $49c51c25361d4cd2$export$ee0f7cc6afcd1c18(options = {}) {
48
48
  // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
49
49
  // add some padding to prevent the page from shifting when the scrollbar is hidden.
50
50
  function $49c51c25361d4cd2$var$preventScrollStandard() {
51
- return (0, $7mMvr$chain)($49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"));
51
+ return (0, $7mMvr$chain)($49c51c25361d4cd2$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, 'overflow', 'hidden'));
52
52
  }
53
53
  // Mobile Safari is a whole different beast. Even with overflow: hidden,
54
54
  // it still scrolls the page in many situations:
@@ -87,7 +87,7 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
87
87
  // Prevent scrolling up when at the top and scrolling down when at the bottom
88
88
  // of a nested scrollable area, otherwise mobile Safari will start scrolling
89
89
  // the window instead.
90
- if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto") restoreScrollableStyles = $49c51c25361d4cd2$var$setStyle(scrollable, "overscrollBehavior", "contain");
90
+ if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === 'auto') restoreScrollableStyles = $49c51c25361d4cd2$var$setStyle(scrollable, 'overscrollBehavior', 'contain');
91
91
  };
92
92
  let onTouchMove = (e)=>{
93
93
  // Prevent scrolling the window.
@@ -112,10 +112,10 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
112
112
  // Apply a transform to trick Safari into thinking the input is at the top of the page
113
113
  // so it doesn't try to scroll it into view. When tapping on an input, this needs to
114
114
  // be done before the "focus" event, so we have to focus the element ourselves.
115
- target.style.transform = "translateY(-2000px)";
115
+ target.style.transform = 'translateY(-2000px)';
116
116
  target.focus();
117
117
  requestAnimationFrame(()=>{
118
- target.style.transform = "";
118
+ target.style.transform = '';
119
119
  });
120
120
  }
121
121
  if (restoreScrollableStyles) restoreScrollableStyles();
@@ -128,9 +128,9 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
128
128
  // other than tapping on an input directly, e.g. the next/previous buttons in the
129
129
  // software keyboard. In these cases, it seems applying the transform in the focus event
130
130
  // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
131
- target.style.transform = "translateY(-2000px)";
131
+ target.style.transform = 'translateY(-2000px)';
132
132
  requestAnimationFrame(()=>{
133
- target.style.transform = "";
133
+ target.style.transform = '';
134
134
  // This will have prevented the browser from scrolling the focused element into view,
135
135
  // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
136
136
  if ($49c51c25361d4cd2$var$visualViewport) {
@@ -141,7 +141,7 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
141
141
  });
142
142
  else // Otherwise, wait for the visual viewport to resize before scrolling so we can
143
143
  // measure the correct position to scroll to.
144
- $49c51c25361d4cd2$var$visualViewport.addEventListener("resize", ()=>$49c51c25361d4cd2$var$scrollIntoView(target), {
144
+ $49c51c25361d4cd2$var$visualViewport.addEventListener('resize', ()=>$49c51c25361d4cd2$var$scrollIntoView(target), {
145
145
  once: true
146
146
  });
147
147
  }
@@ -161,22 +161,22 @@ function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
161
161
  // enable us to scroll the window to the top, which is required for the rest of this to work.
162
162
  let scrollX = window.pageXOffset;
163
163
  let scrollY = window.pageYOffset;
164
- restoreStyles = (0, $7mMvr$chain)($49c51c25361d4cd2$var$addEvent(window, "scroll", onWindowScroll), $49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"), $49c51c25361d4cd2$var$setStyle(document.body, "marginTop", `-${scrollY}px`), ()=>{
164
+ restoreStyles = (0, $7mMvr$chain)($49c51c25361d4cd2$var$addEvent(window, 'scroll', onWindowScroll), $49c51c25361d4cd2$var$setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, 'overflow', 'hidden'), $49c51c25361d4cd2$var$setStyle(document.body, 'marginTop', `-${scrollY}px`), ()=>{
165
165
  window.scrollTo(scrollX, scrollY);
166
166
  });
167
167
  // Scroll to the top. The negative margin on the body will make this appear the same.
168
168
  window.scrollTo(0, 0);
169
169
  };
170
- let removeEvents = (0, $7mMvr$chain)($49c51c25361d4cd2$var$addEvent(document, "touchstart", onTouchStart, {
170
+ let removeEvents = (0, $7mMvr$chain)($49c51c25361d4cd2$var$addEvent(document, 'touchstart', onTouchStart, {
171
171
  passive: false,
172
172
  capture: true
173
- }), $49c51c25361d4cd2$var$addEvent(document, "touchmove", onTouchMove, {
173
+ }), $49c51c25361d4cd2$var$addEvent(document, 'touchmove', onTouchMove, {
174
174
  passive: false,
175
175
  capture: true
176
- }), $49c51c25361d4cd2$var$addEvent(document, "touchend", onTouchEnd, {
176
+ }), $49c51c25361d4cd2$var$addEvent(document, 'touchend', onTouchEnd, {
177
177
  passive: false,
178
178
  capture: true
179
- }), $49c51c25361d4cd2$var$addEvent(document, "focus", onFocus, true));
179
+ }), $49c51c25361d4cd2$var$addEvent(document, 'focus', onFocus, true));
180
180
  return ()=>{
181
181
  // Restore styles and scroll the page back to where it was.
182
182
  restoreScrollableStyles === null || restoreScrollableStyles === void 0 ? void 0 : restoreScrollableStyles();
@@ -218,4 +218,4 @@ function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
218
218
 
219
219
 
220
220
  export {$49c51c25361d4cd2$export$ee0f7cc6afcd1c18 as usePreventScroll};
221
- //# sourceMappingURL=usePreventScroll.mjs.map
221
+ //# sourceMappingURL=usePreventScroll.module.js.map