react-modal-sheet 1.9.0 → 1.10.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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetBackdrop: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onUnmount" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & React.RefAttributes<any>>;
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & React.RefAttributes<any>>;
5
5
  export default SheetBackdrop;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetContainer: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "onUpdate" | "onAnimationStart" | "onUnmount" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
5
5
  children: React.ReactNode;
6
6
  } & React.RefAttributes<any>>;
7
7
  export default SheetContainer;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetContent: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onUnmount" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
5
5
  children?: React.ReactNode;
6
6
  disableDrag?: boolean | undefined;
7
7
  } & React.RefAttributes<any>>;
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
- declare const SheetHeader: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps, "style" | "transformTemplate" | "transformValues" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onUnmount" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "layoutDependency" | "layoutScroll" | "custom" | "inherit"> & {
2
+ declare const SheetHeader: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
+ className?: string | undefined;
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
3
5
  children?: React.ReactNode;
4
6
  disableDrag?: boolean | undefined;
5
7
  } & React.RefAttributes<any>>;
@@ -2,13 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
5
  var React = require('react');
8
6
  var ReactDOM = require('react-dom');
9
- var overlays = require('@react-aria/overlays');
10
7
  var framerMotion = require('framer-motion');
11
- var mergeRefs = _interopDefault(require('react-merge-refs'));
8
+ var utils = require('@react-aria/utils');
12
9
 
13
10
  function _extends() {
14
11
  _extends = Object.assign || function (target) {
@@ -136,6 +133,17 @@ function validateSnapTo(_ref) {
136
133
 
137
134
  return Math.max(Math.round(snapTo), 0);
138
135
  }
136
+ function mergeRefs(refs) {
137
+ return function (value) {
138
+ refs.forEach(function (ref) {
139
+ if (typeof ref === 'function') {
140
+ ref(value);
141
+ } else if (ref) {
142
+ ref.current = value;
143
+ }
144
+ });
145
+ };
146
+ }
139
147
 
140
148
  var useIsomorphicLayoutEffect = IS_SSR ? React.useEffect : React.useLayoutEffect;
141
149
  var useModalEffect = function useModalEffect(isOpen, rootId) {
@@ -234,6 +242,247 @@ var useSheetContext = function useSheetContext() {
234
242
  return context;
235
243
  };
236
244
 
245
+ // Source: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/overlays/src/usePreventScroll.ts
246
+
247
+ var visualViewport = typeof window !== 'undefined' && window.visualViewport; // HTML input types that do not cause the software keyboard to appear.
248
+
249
+ var nonTextInputTypes = /*#__PURE__*/new Set(['checkbox', 'radio', 'range', 'color', 'file', 'image', 'button', 'submit', 'reset']); // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
250
+
251
+ var preventScrollCount = 0;
252
+ var restore;
253
+ /**
254
+ * Prevents scrolling on the document body on mount, and
255
+ * restores it on unmount. Also ensures that content does not
256
+ * shift due to the scrollbars disappearing.
257
+ */
258
+
259
+ function usePreventScroll(options) {
260
+ if (options === void 0) {
261
+ options = {};
262
+ }
263
+
264
+ var _options = options,
265
+ isDisabled = _options.isDisabled;
266
+ utils.useLayoutEffect(function () {
267
+ if (isDisabled) {
268
+ return;
269
+ }
270
+
271
+ preventScrollCount++;
272
+
273
+ if (preventScrollCount === 1) {
274
+ if (utils.isIOS()) {
275
+ restore = preventScrollMobileSafari();
276
+ } else {
277
+ restore = preventScrollStandard();
278
+ }
279
+ }
280
+
281
+ return function () {
282
+ preventScrollCount--;
283
+
284
+ if (preventScrollCount === 0) {
285
+ restore();
286
+ }
287
+ };
288
+ }, [isDisabled]);
289
+ } // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
290
+ // add some padding to prevent the page from shifting when the scrollbar is hidden.
291
+
292
+ function preventScrollStandard() {
293
+ return utils.chain(setStyle(document.documentElement, 'paddingRight', window.innerWidth - document.documentElement.clientWidth + "px"), setStyle(document.documentElement, 'overflow', 'hidden'));
294
+ } // Mobile Safari is a whole different beast. Even with overflow: hidden,
295
+ // it still scrolls the page in many situations:
296
+ //
297
+ // 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
298
+ // 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
299
+ // it, so it becomes scrollable.
300
+ // 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
301
+ // This may cause even fixed position elements to scroll off the screen.
302
+ // 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
303
+ // scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
304
+ //
305
+ // In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
306
+ //
307
+ // 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
308
+ // on the window.
309
+ // 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the
310
+ // top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.
311
+ // 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
312
+ // 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
313
+ // of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
314
+ // into view ourselves, without scrolling the whole page.
315
+ // 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
316
+ // same visually, but makes the actual scroll position always zero. This is required to make all of the
317
+ // above work or Safari will still try to scroll the page when focusing an input.
318
+ // 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
319
+ // to navigate to an input with the next/previous buttons that's outside a modal.
320
+
321
+
322
+ function preventScrollMobileSafari() {
323
+ var scrollable;
324
+ var lastY = 0;
325
+
326
+ var onTouchStart = function onTouchStart(e) {
327
+ // Store the nearest scrollable parent element from the element that the user touched.
328
+ scrollable = utils.getScrollParent(e.target);
329
+
330
+ if (scrollable === document.documentElement && scrollable === document.body) {
331
+ return;
332
+ }
333
+
334
+ lastY = e.changedTouches[0].pageY;
335
+ };
336
+
337
+ var onTouchMove = function onTouchMove(e) {
338
+ // Prevent scrolling the window.
339
+ if (scrollable === document.documentElement || scrollable === document.body) {
340
+ e.preventDefault();
341
+ return;
342
+ } // Prevent scrolling up when at the top and scrolling down when at the bottom
343
+ // of a nested scrollable area, otherwise mobile Safari will start scrolling
344
+ // the window instead. Unfortunately, this disables bounce scrolling when at
345
+ // the top but it's the best we can do.
346
+
347
+
348
+ var y = e.changedTouches[0].pageY;
349
+ var scrollTop = scrollable.scrollTop;
350
+ var bottom = scrollable.scrollHeight - scrollable.clientHeight; // Fix for: https://github.com/adobe/react-spectrum/pull/3780/files
351
+
352
+ if (bottom === 0) {
353
+ return;
354
+ }
355
+
356
+ if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) {
357
+ e.preventDefault();
358
+ }
359
+
360
+ lastY = y;
361
+ };
362
+
363
+ var onTouchEnd = function onTouchEnd(e) {
364
+ var target = e.target; // Apply this change if we're not already focused on the target element
365
+
366
+ if (willOpenKeyboard(target) && target !== document.activeElement) {
367
+ e.preventDefault(); // Apply a transform to trick Safari into thinking the input is at the top of the page
368
+ // so it doesn't try to scroll it into view. When tapping on an input, this needs to
369
+ // be done before the "focus" event, so we have to focus the element ourselves.
370
+
371
+ target.style.transform = 'translateY(-2000px)';
372
+ target.focus();
373
+ requestAnimationFrame(function () {
374
+ target.style.transform = '';
375
+ });
376
+ }
377
+ };
378
+
379
+ var onFocus = function onFocus(e) {
380
+ var target = e.target;
381
+
382
+ if (willOpenKeyboard(target)) {
383
+ // Transform also needs to be applied in the focus event in cases where focus moves
384
+ // other than tapping on an input directly, e.g. the next/previous buttons in the
385
+ // software keyboard. In these cases, it seems applying the transform in the focus event
386
+ // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
387
+ target.style.transform = 'translateY(-2000px)';
388
+ requestAnimationFrame(function () {
389
+ target.style.transform = ''; // This will have prevented the browser from scrolling the focused element into view,
390
+ // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
391
+
392
+ if (visualViewport) {
393
+ if (visualViewport.height < window.innerHeight) {
394
+ // If the keyboard is already visible, do this after one additional frame
395
+ // to wait for the transform to be removed.
396
+ requestAnimationFrame(function () {
397
+ scrollIntoView(target);
398
+ });
399
+ } else {
400
+ // Otherwise, wait for the visual viewport to resize before scrolling so we can
401
+ // measure the correct position to scroll to.
402
+ visualViewport.addEventListener('resize', function () {
403
+ return scrollIntoView(target);
404
+ }, {
405
+ once: true
406
+ });
407
+ }
408
+ }
409
+ });
410
+ }
411
+ };
412
+
413
+ var onWindowScroll = function onWindowScroll() {
414
+ // Last resort. If the window scrolled, scroll it back to the top.
415
+ // It should always be at the top because the body will have a negative margin (see below).
416
+ window.scrollTo(0, 0);
417
+ }; // Record the original scroll position so we can restore it.
418
+ // Then apply a negative margin to the body to offset it by the scroll position. This will
419
+ // enable us to scroll the window to the top, which is required for the rest of this to work.
420
+
421
+
422
+ var scrollX = window.pageXOffset;
423
+ var scrollY = window.pageYOffset;
424
+ var restoreStyles = utils.chain(setStyle(document.documentElement, 'paddingRight', window.innerWidth - document.documentElement.clientWidth + "px"), setStyle(document.documentElement, 'overflow', 'hidden'), setStyle(document.body, 'marginTop', "-" + scrollY + "px")); // Scroll to the top. The negative margin on the body will make this appear the same.
425
+
426
+ window.scrollTo(0, 0);
427
+ var removeEvents = utils.chain(addEvent(document, 'touchstart', onTouchStart, {
428
+ passive: false,
429
+ capture: true
430
+ }), addEvent(document, 'touchmove', onTouchMove, {
431
+ passive: false,
432
+ capture: true
433
+ }), addEvent(document, 'touchend', onTouchEnd, {
434
+ passive: false,
435
+ capture: true
436
+ }), addEvent(document, 'focus', onFocus, true), addEvent(window, 'scroll', onWindowScroll));
437
+ return function () {
438
+ // Restore styles and scroll the page back to where it was.
439
+ restoreStyles();
440
+ removeEvents();
441
+ window.scrollTo(scrollX, scrollY);
442
+ };
443
+ } // Sets a CSS property on an element, and returns a function to revert it to the previous value.
444
+
445
+
446
+ function setStyle(element, style, value) {
447
+ var cur = element.style[style];
448
+ element.style[style] = value;
449
+ return function () {
450
+ element.style[style] = cur;
451
+ };
452
+ } // Adds an event listener to an element, and returns a function to remove it.
453
+
454
+
455
+ function addEvent(target, event, handler, options) {
456
+ target.addEventListener(event, handler, options);
457
+ return function () {
458
+ target.removeEventListener(event, handler, options);
459
+ };
460
+ }
461
+
462
+ function scrollIntoView(target) {
463
+ var root = document.scrollingElement || document.documentElement;
464
+
465
+ while (target && target !== root) {
466
+ // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
467
+ var scrollable = utils.getScrollParent(target);
468
+
469
+ if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
470
+ var scrollableTop = scrollable.getBoundingClientRect().top;
471
+ var targetTop = target.getBoundingClientRect().top;
472
+
473
+ if (targetTop > scrollableTop + target.clientHeight) {
474
+ scrollable.scrollTop += targetTop - scrollableTop;
475
+ }
476
+ }
477
+
478
+ target = scrollable.parentElement;
479
+ }
480
+ }
481
+
482
+ function willOpenKeyboard(target) {
483
+ return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
484
+ }
485
+
237
486
  var styles = {
238
487
  wrapper: {
239
488
  position: 'fixed',
@@ -451,7 +700,7 @@ var Sheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
451
700
  useModalEffect(isOpen, rootId); // Framer Motion should handle body scroll locking but it's not working
452
701
  // properly on iOS. Scroll locking from React Aria seems to work much better.
453
702
 
454
- overlays.usePreventScroll({
703
+ usePreventScroll({
455
704
  isDisabled: !isOpen
456
705
  });
457
706
  var dragProps = React.useMemo(function () {
@@ -463,6 +712,7 @@ var Sheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
463
712
  bottom: 0
464
713
  },
465
714
  dragMomentum: false,
715
+ dragPropagation: false,
466
716
  onDrag: onDrag,
467
717
  onDragEnd: onDragEnd
468
718
  };
@@ -1 +1 @@
1
- {"version":3,"file":"react-modal-sheet.cjs.development.js","sources":["../src/constants.ts","../src/utils.ts","../src/hooks.tsx","../src/context.tsx","../src/styles.ts","../src/sheet.tsx","../src/SheetContainer.tsx","../src/SheetContent.tsx","../src/SheetHeader.tsx","../src/SheetBackdrop.tsx","../src/index.tsx"],"sourcesContent":["export const MAX_HEIGHT = 'calc(100% - env(safe-area-inset-top) - 34px)';\n\nexport const IS_SSR = typeof window === 'undefined';\n\nexport const DEFAULT_SPRING_CONFIG = {\n stiffness: 300,\n damping: 30,\n mass: 0.2,\n};\n\nexport const DRAG_CLOSE_THRESHOLD = 0.6;\n\nexport const DRAG_VELOCITY_THRESHOLD = 500;\n","export function getClosest(nums: number[], goal: number) {\n return nums.reduce((prev, curr) => {\n return Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev;\n });\n}\n\nconst highlightId = 'react-modal-sheet-highlight';\n\nexport function applyRootStyles(rootId: string) {\n const body = document.querySelector('body') as HTMLBodyElement;\n const root = document.querySelector(`#${rootId}`) as HTMLDivElement;\n\n if (root) {\n const p = 24;\n const h = window.innerHeight;\n const s = (h - p) / h;\n body.style.backgroundColor = '#000';\n root.style.overflow = 'hidden';\n root.style.willChange = 'transform';\n root.style.transition = 'transform 200ms linear';\n root.style.transform = `translateY(calc(env(safe-area-inset-top) + ${p / 2}px)) scale(${s})`; // prettier-ignore\n root.style.borderTopRightRadius = '10px';\n root.style.borderTopLeftRadius = '10px';\n\n // Add highlighed overlay to emphasize the modality effect\n const highlight = document.createElement('div');\n highlight.setAttribute('aria-hidden', 'true');\n highlight.id = highlightId;\n highlight.style.position = 'absolute';\n highlight.style.top = '0px';\n highlight.style.left = '0px';\n highlight.style.bottom = '0px';\n highlight.style.right = '0px';\n highlight.style.opacity = '0';\n highlight.style.transition = 'opacity 200ms linear';\n highlight.style.backgroundColor = 'rgba(150, 150, 150, 0.1)';\n\n root.appendChild(highlight);\n requestAnimationFrame(() => (highlight.style.opacity = '1'));\n }\n}\n\nexport function cleanupRootStyles(rootId: string) {\n const body = document.querySelector('body') as HTMLBodyElement;\n const root = document.getElementById(rootId) as HTMLDivElement;\n const highlight = document.getElementById(highlightId) as HTMLDivElement;\n\n function onTransitionEnd() {\n root.style.removeProperty('overflow');\n root.style.removeProperty('will-change');\n root.style.removeProperty('transition');\n body.style.removeProperty('background-color');\n root.removeEventListener('transitionend', onTransitionEnd);\n highlight.parentNode?.removeChild(highlight);\n }\n\n if (root && highlight) {\n // Start animating back\n root.style.removeProperty('border-top-right-radius');\n root.style.removeProperty('border-top-left-radius');\n root.style.removeProperty('transform');\n highlight.style.opacity = '0';\n\n // Remove temp properties after animation is finished\n root.addEventListener('transitionend', onTransitionEnd);\n }\n}\n\nexport function inDescendingOrder(arr: number[]) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i + 1] > arr[i]) return false;\n }\n\n return true;\n}\n\nexport function validateSnapTo({\n snapTo,\n sheetHeight,\n}: {\n snapTo: number;\n sheetHeight: number;\n}) {\n if (snapTo < 0) {\n console.warn(\n `Snap point is out of bounds. Sheet height is ${sheetHeight} but snap point is ${sheetHeight +\n Math.abs(snapTo)}.`\n );\n }\n\n return Math.max(Math.round(snapTo), 0);\n}\n","import * as React from 'react';\n\nimport { IS_SSR } from './constants';\nimport { SheetEvents } from './types';\nimport { applyRootStyles, cleanupRootStyles } from './utils';\n\nexport const useIsomorphicLayoutEffect = IS_SSR\n ? React.useEffect\n : React.useLayoutEffect;\n\nexport const useModalEffect = (isOpen: boolean, rootId?: string) => {\n const prevOpen = usePrevious(isOpen);\n\n // Automatically apply the iOS modal effect to the body when sheet opens/closes\n React.useEffect(() => {\n if (rootId && !prevOpen && isOpen) {\n applyRootStyles(rootId);\n } else if (rootId && !isOpen && prevOpen) {\n cleanupRootStyles(rootId);\n }\n }, [isOpen, prevOpen]); // eslint-disable-line\n\n // Make sure to cleanup modal styles on unmount\n React.useEffect(() => {\n return () => {\n if (rootId && isOpen) cleanupRootStyles(rootId);\n };\n }, [isOpen]); // eslint-disable-line\n};\n\nexport const useEventCallbacks = (\n isOpen: boolean,\n callbacks: React.MutableRefObject<SheetEvents>\n) => {\n const prevOpen = usePrevious(isOpen);\n const didOpen = React.useRef(false);\n\n // Because of AnimatePrecence we don't have access to latest isOpen value\n // so we need to read and write to a ref to determine if we are\n // opening or closing the sheet\n const handleAnimationComplete = React.useCallback(() => {\n if (!didOpen.current) {\n callbacks.current.onOpenEnd?.();\n didOpen.current = true;\n } else {\n callbacks.current.onCloseEnd?.();\n didOpen.current = false;\n }\n }, [isOpen, prevOpen]); // eslint-disable-line\n\n React.useEffect(() => {\n if (!prevOpen && isOpen) {\n callbacks.current.onOpenStart?.();\n } else if (!isOpen && prevOpen) {\n callbacks.current.onCloseStart?.();\n }\n }, [isOpen, prevOpen]); // eslint-disable-line\n\n return { handleAnimationComplete };\n};\n\nexport function useWindowHeight() {\n const [windowHeight, setWindowHeight] = React.useState(0);\n\n useIsomorphicLayoutEffect(() => {\n const updateHeight = () => setWindowHeight(window.innerHeight);\n window.addEventListener('resize', updateHeight);\n updateHeight();\n return () => window.removeEventListener('resize', updateHeight);\n }, []);\n\n return windowHeight;\n}\n\nexport function usePrevious<T>(state: T): T | undefined {\n const ref = React.useRef<T>();\n\n React.useEffect(() => {\n ref.current = state;\n });\n\n return ref.current;\n}\n\n// Userland version of the `useEvent` React hook:\n// RFC: https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md\nexport function useEvent<T extends (...args: any[]) => any>(handler: T) {\n const handlerRef = React.useRef<T>();\n\n useIsomorphicLayoutEffect(() => {\n handlerRef.current = handler;\n });\n\n return React.useCallback((...args: any[]) => {\n const fn = handlerRef.current;\n return fn?.(...args);\n }, []) as T;\n}\n","import * as React from 'react';\nimport { SheetContextType } from './types';\n\nexport const SheetContext = React.createContext<SheetContextType | undefined>(\n undefined\n);\n\nexport const useSheetContext = () => {\n const context = React.useContext(SheetContext);\n if (!context) throw Error('Sheet context error');\n return context;\n};\n","import * as CSS from 'csstype';\n\nconst styles: { [key: string]: CSS.Properties } = {\n wrapper: {\n position: 'fixed',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n zIndex: 9999999,\n overflow: 'hidden',\n pointerEvents: 'none',\n },\n backdrop: {\n zIndex: 1,\n position: 'fixed',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'rgba(51, 51, 51, 0.5)',\n touchAction: 'none', // Disable iOS body scrolling\n border: 'none',\n },\n container: {\n zIndex: 2,\n position: 'absolute',\n left: 0,\n bottom: 0,\n width: '100%',\n backgroundColor: '#fff',\n borderTopRightRadius: '8px',\n borderTopLeftRadius: '8px',\n boxShadow: '0px -2px 16px rgba(0, 0, 0, 0.3)',\n display: 'flex',\n flexDirection: 'column',\n pointerEvents: 'auto',\n },\n headerWrapper: {\n width: '100%',\n },\n header: {\n height: '40px',\n width: '100%',\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n indicator: {\n width: '18px',\n height: '4px',\n borderRadius: '99px',\n backgroundColor: '#ddd',\n },\n content: {\n flex: 1,\n overflow: 'auto',\n position: 'relative',\n },\n};\n\nexport default styles;\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { usePreventScroll } from '@react-aria/overlays';\n\nimport {\n animate,\n AnimatePresence,\n AnimationOptions,\n PanInfo,\n useMotionValue,\n useReducedMotion,\n} from 'framer-motion';\n\nimport {\n useModalEffect,\n useWindowHeight,\n useIsomorphicLayoutEffect,\n useEvent,\n} from './hooks';\n\nimport {\n DEFAULT_SPRING_CONFIG,\n DRAG_CLOSE_THRESHOLD,\n DRAG_VELOCITY_THRESHOLD,\n IS_SSR,\n} from './constants';\n\nimport { SheetContextType, SheetProps } from './types';\nimport { SheetContext } from './context';\nimport { getClosest, inDescendingOrder, validateSnapTo } from './utils';\nimport styles from './styles';\n\nconst Sheet = React.forwardRef<any, SheetProps>(\n (\n {\n onOpenStart,\n onOpenEnd,\n onClose,\n onCloseStart,\n onCloseEnd,\n onSnap,\n children,\n isOpen,\n snapPoints,\n rootId,\n mountPoint,\n style,\n detent = 'full-height',\n initialSnap = 0,\n springConfig = DEFAULT_SPRING_CONFIG,\n disableDrag = false,\n prefersReducedMotion = false,\n ...rest\n },\n ref\n ) => {\n const sheetRef = React.useRef<any>(null);\n const indicatorRotation = useMotionValue(0);\n const windowHeight = useWindowHeight();\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = Boolean(prefersReducedMotion || shouldReduceMotion);\n const animationOptions: AnimationOptions<number> = reduceMotion\n ? { type: 'tween', duration: 0.01 }\n : { type: 'spring', ...springConfig };\n\n // NOTE: the inital value for `y` doesn't matter since it is overwritten by\n // the value driven by the `AnimatePresence` component when the sheet is opened\n // and after that it is driven by the gestures and/or snapping\n const y = useMotionValue(0);\n\n // Keep the callback fns up-to-date so that they can be accessed inside\n // the effect without including them to the dependencies array\n const callbacks = React.useRef({\n onOpenStart,\n onOpenEnd,\n onCloseStart,\n onCloseEnd,\n });\n\n useIsomorphicLayoutEffect(() => {\n callbacks.current = {\n onOpenStart,\n onOpenEnd,\n onCloseStart,\n onCloseEnd,\n };\n });\n\n if (snapPoints) {\n // Convert negative / percentage snap points to absolute values\n snapPoints = snapPoints.map(point => {\n // Percentage values e.g. between 0.0 and 1.0\n if (point > 0 && point <= 1) return Math.round(point * windowHeight);\n return point < 0 ? windowHeight + point : point; // negative values\n });\n\n console.assert(\n inDescendingOrder(snapPoints) || windowHeight === 0,\n `Snap points need to be in descending order got: [${snapPoints}]`\n );\n }\n\n const onDrag = useEvent((_, { delta }: PanInfo) => {\n // Update drag indicator rotation based on drag velocity\n const velocity = y.getVelocity();\n\n if (velocity > 0) indicatorRotation.set(10);\n if (velocity < 0) indicatorRotation.set(-10);\n\n // Make sure user cannot drag beyond the top of the sheet\n y.set(Math.max(y.get() + delta.y, 0));\n });\n\n const onDragEnd = useEvent((_, { velocity }: PanInfo) => {\n if (velocity.y > DRAG_VELOCITY_THRESHOLD) {\n // User flicked the sheet down\n onClose();\n } else {\n const sheetEl = sheetRef.current as HTMLDivElement;\n const sheetHeight = sheetEl.getBoundingClientRect().height;\n const currentY = y.get();\n\n let snapTo = 0;\n\n if (snapPoints) {\n const snapToValues = snapPoints\n .map(p => sheetHeight - p)\n .filter(p => p >= 0); // negative values can occur with `content-height` detent\n\n // Allow snapping to the top of the sheet if detent is set to `content-height`\n if (detent === 'content-height' && !snapToValues.includes(0)) {\n snapToValues.unshift(0);\n }\n\n // Get the closest snap point\n snapTo = getClosest(snapToValues, currentY);\n } else if (currentY / sheetHeight > DRAG_CLOSE_THRESHOLD) {\n // Close if dragged over enough far\n snapTo = sheetHeight;\n }\n\n snapTo = validateSnapTo({ snapTo, sheetHeight });\n\n // Update the spring value so that the sheet is animated to the snap point\n animate(y, snapTo, animationOptions);\n\n if (snapPoints && onSnap) {\n const snapValue = Math.abs(Math.round(snapPoints[0] - snapTo));\n const snapIndex = snapPoints.indexOf(getClosest(snapPoints, snapValue)); // prettier-ignore\n onSnap(snapIndex);\n }\n\n if (snapTo >= sheetHeight) onClose();\n }\n\n // Reset indicator rotation after dragging\n indicatorRotation.set(0);\n });\n\n // Trigger onSnap callback when sheet is opened or closed\n React.useEffect(() => {\n if (!snapPoints || !onSnap) return;\n const snapIndex = isOpen ? initialSnap : snapPoints.length - 1;\n onSnap(snapIndex);\n }, [isOpen]); // eslint-disable-line\n\n React.useImperativeHandle(ref, () => ({\n y,\n snapTo: (snapIndex: number) => {\n const sheetEl = sheetRef.current as HTMLDivElement | null;\n\n if (\n snapPoints &&\n snapPoints[snapIndex] !== undefined &&\n sheetEl !== null\n ) {\n const sheetHeight = sheetEl.getBoundingClientRect().height;\n const snapPoint = snapPoints[snapIndex];\n const snapTo = validateSnapTo({\n snapTo: sheetHeight - snapPoint,\n sheetHeight,\n });\n\n animate(y, snapTo, animationOptions);\n if (onSnap) onSnap(snapIndex);\n if (snapTo >= sheetHeight) onClose();\n }\n },\n }));\n\n useModalEffect(isOpen, rootId);\n\n // Framer Motion should handle body scroll locking but it's not working\n // properly on iOS. Scroll locking from React Aria seems to work much better.\n usePreventScroll({ isDisabled: !isOpen });\n\n const dragProps = React.useMemo(() => {\n const dragProps: SheetContextType['dragProps'] = {\n drag: 'y',\n dragElastic: 0,\n dragConstraints: { top: 0, bottom: 0 },\n dragMomentum: false,\n onDrag,\n onDragEnd,\n };\n\n return disableDrag ? undefined : dragProps;\n }, [disableDrag]); // eslint-disable-line\n\n const context: SheetContextType = {\n y,\n sheetRef,\n isOpen,\n initialSnap,\n snapPoints,\n detent,\n indicatorRotation,\n callbacks,\n dragProps,\n windowHeight,\n animationOptions,\n reduceMotion,\n };\n\n const sheet = (\n <SheetContext.Provider value={context}>\n <div {...rest} ref={ref} style={{ ...styles.wrapper, ...style }}>\n <AnimatePresence>\n {/* NOTE: AnimatePresence requires us to set keys to children */}\n {isOpen\n ? React.Children.map(children, (child: any, i) =>\n React.cloneElement(child, { key: `sheet-child-${i}` })\n )\n : null}\n </AnimatePresence>\n </div>\n </SheetContext.Provider>\n );\n\n if (IS_SSR) return sheet;\n\n return ReactDOM.createPortal(sheet, mountPoint ?? document.body);\n }\n);\n\nexport default Sheet;\n","import * as React from 'react';\nimport { motion } from 'framer-motion';\nimport mergeRefs from 'react-merge-refs';\n\nimport { SheetContainerProps } from './types';\nimport { useSheetContext } from './context';\nimport { useEventCallbacks } from './hooks';\nimport { MAX_HEIGHT } from './constants';\nimport styles from './styles';\n\nconst SheetContainer = React.forwardRef<any, SheetContainerProps>(\n ({ children, style = {}, className = '', ...rest }, ref) => {\n const {\n y,\n isOpen,\n callbacks,\n snapPoints,\n initialSnap = 0,\n sheetRef,\n windowHeight,\n detent,\n animationOptions,\n reduceMotion,\n } = useSheetContext();\n\n const { handleAnimationComplete } = useEventCallbacks(isOpen, callbacks);\n const initialY = snapPoints ? snapPoints[0] - snapPoints[initialSnap] : 0;\n const maxSnapHeight = snapPoints ? snapPoints[0] : null;\n\n const height =\n maxSnapHeight !== null\n ? `min(${maxSnapHeight}px, ${MAX_HEIGHT})`\n : MAX_HEIGHT;\n\n return (\n <motion.div\n {...rest}\n ref={mergeRefs([sheetRef, ref])}\n className={`react-modal-sheet-container ${className}`}\n style={{\n ...styles.container,\n ...style,\n ...(detent === 'full-height' && { height }),\n ...(detent === 'content-height' && { maxHeight: height }),\n y,\n }}\n initial={reduceMotion ? false : { y: windowHeight }}\n animate={{ y: initialY, transition: animationOptions }}\n exit={{ y: windowHeight, transition: animationOptions }}\n onAnimationComplete={handleAnimationComplete}\n >\n {children}\n </motion.div>\n );\n }\n);\n\nexport default SheetContainer;\n","import * as React from 'react';\nimport { motion } from 'framer-motion';\n\nimport { SheetDraggableProps } from './types';\nimport { useSheetContext } from './context';\nimport styles from './styles';\n\nconst SheetContent = React.forwardRef<any, SheetDraggableProps>(\n ({ children, style, disableDrag, className = '', ...rest }, ref) => {\n const { dragProps } = useSheetContext();\n const _dragProps = disableDrag ? undefined : dragProps;\n\n return (\n <motion.div\n {...rest}\n ref={ref}\n className={`react-modal-sheet-content ${className}`}\n style={{ ...styles.content, ...style }}\n {..._dragProps}\n >\n {children}\n </motion.div>\n );\n }\n);\n\nexport default SheetContent;\n","import * as React from 'react';\nimport { motion, useTransform } from 'framer-motion';\n\nimport { SheetDraggableProps } from './types';\nimport { useSheetContext } from './context';\nimport styles from './styles';\n\nconst SheetHeader = React.forwardRef<any, SheetDraggableProps>(\n ({ children, style, disableDrag, ...rest }, ref) => {\n const { indicatorRotation, dragProps } = useSheetContext();\n const _dragProps = disableDrag ? undefined : dragProps;\n\n const indicator1Transform = useTransform(\n indicatorRotation,\n r => `translateX(2px) rotate(${r}deg)`\n );\n\n const indicator2Transform = useTransform(\n indicatorRotation,\n r => `translateX(-2px) rotate(${-1 * r}deg)`\n );\n\n return (\n <motion.div\n {...rest}\n ref={ref}\n style={{ ...styles.headerWrapper, ...style }}\n {..._dragProps}\n >\n {children || (\n <div className=\"react-modal-sheet-header\" style={styles.header}>\n <motion.span\n className=\"react-modal-sheet-drag-indicator\"\n style={{ ...styles.indicator, transform: indicator1Transform }}\n />\n <motion.span\n className=\"react-modal-sheet-drag-indicator\"\n style={{ ...styles.indicator, transform: indicator2Transform }}\n />\n </div>\n )}\n </motion.div>\n );\n }\n);\n\nexport default SheetHeader;\n","import * as React from 'react';\nimport { motion } from 'framer-motion';\n\nimport { SheetBackdropProps } from './types';\nimport styles from './styles';\n\nconst isClickable = (props: any) => !!props.onClick || !!props.onTap;\n\nconst SheetBackdrop = React.forwardRef<any, SheetBackdropProps>(\n ({ style = {}, className = '', ...rest }, ref) => {\n const Comp = isClickable(rest) ? motion.button : motion.div;\n const pointerEvents = isClickable(rest) ? 'auto' : 'none';\n\n return (\n <Comp\n {...rest}\n ref={ref}\n className={`react-modal-sheet-backdrop ${className}`}\n style={{ ...styles.backdrop, ...style, pointerEvents }}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n />\n );\n }\n);\n\nexport default SheetBackdrop;\n","import { MotionValue } from 'framer-motion';\n\nimport Sheet from './sheet';\nimport SheetContainer from './SheetContainer';\nimport SheetContent from './SheetContent';\nimport SheetHeader from './SheetHeader';\nimport SheetBackdrop from './SheetBackdrop';\nimport { SheetCompound } from './types';\n\nexport type SheetRef = {\n y: MotionValue<number>;\n snapTo: (index: number) => void;\n};\n\n// HACK: this is needed to get the typing to work properly...\nconst _SheetCompound: any = Sheet;\n_SheetCompound.Container = SheetContainer;\n_SheetCompound.Header = SheetHeader;\n_SheetCompound.Content = SheetContent;\n_SheetCompound.Backdrop = SheetBackdrop;\n\nexport default _SheetCompound as SheetCompound;\n"],"names":["MAX_HEIGHT","IS_SSR","window","DEFAULT_SPRING_CONFIG","stiffness","damping","mass","DRAG_CLOSE_THRESHOLD","DRAG_VELOCITY_THRESHOLD","getClosest","nums","goal","reduce","prev","curr","Math","abs","highlightId","applyRootStyles","rootId","body","document","querySelector","root","p","h","innerHeight","s","style","backgroundColor","overflow","willChange","transition","transform","borderTopRightRadius","borderTopLeftRadius","highlight","createElement","setAttribute","id","position","top","left","bottom","right","opacity","appendChild","requestAnimationFrame","cleanupRootStyles","getElementById","onTransitionEnd","removeProperty","removeEventListener","parentNode","removeChild","addEventListener","inDescendingOrder","arr","i","length","validateSnapTo","snapTo","sheetHeight","console","warn","max","round","useIsomorphicLayoutEffect","React","useModalEffect","isOpen","prevOpen","usePrevious","useEventCallbacks","callbacks","didOpen","handleAnimationComplete","current","onOpenEnd","onCloseEnd","onOpenStart","onCloseStart","useWindowHeight","windowHeight","setWindowHeight","updateHeight","state","ref","useEvent","handler","handlerRef","fn","args","SheetContext","undefined","useSheetContext","context","Error","styles","wrapper","zIndex","pointerEvents","backdrop","width","height","touchAction","border","container","boxShadow","display","flexDirection","headerWrapper","header","alignItems","justifyContent","indicator","borderRadius","content","flex","Sheet","onClose","onSnap","children","snapPoints","mountPoint","detent","initialSnap","springConfig","disableDrag","prefersReducedMotion","rest","sheetRef","indicatorRotation","useMotionValue","shouldReduceMotion","useReducedMotion","reduceMotion","Boolean","animationOptions","type","duration","y","map","point","assert","onDrag","_","delta","velocity","getVelocity","set","get","onDragEnd","sheetEl","getBoundingClientRect","currentY","snapToValues","filter","includes","unshift","animate","snapValue","snapIndex","indexOf","snapPoint","usePreventScroll","isDisabled","dragProps","drag","dragElastic","dragConstraints","dragMomentum","sheet","Provider","value","AnimatePresence","child","key","ReactDOM","SheetContainer","className","initialY","maxSnapHeight","motion","div","mergeRefs","maxHeight","initial","exit","onAnimationComplete","SheetContent","_dragProps","SheetHeader","indicator1Transform","useTransform","r","indicator2Transform","span","isClickable","props","onClick","onTap","SheetBackdrop","Comp","button","_SheetCompound","Container","Header","Content","Backdrop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,UAAU,GAAG,8CAAnB;AAEA,IAAMC,MAAM,GAAG,OAAOC,MAAP,KAAkB,WAAjC;AAEA,IAAMC,qBAAqB,GAAG;AACnCC,EAAAA,SAAS,EAAE,GADwB;AAEnCC,EAAAA,OAAO,EAAE,EAF0B;AAGnCC,EAAAA,IAAI,EAAE;AAH6B,CAA9B;AAMA,IAAMC,oBAAoB,GAAG,GAA7B;AAEA,IAAMC,uBAAuB,GAAG,GAAhC;;SCZSC,WAAWC,MAAgBC;AACzC,SAAOD,IAAI,CAACE,MAAL,CAAY,UAACC,IAAD,EAAOC,IAAP;AACjB,WAAOC,IAAI,CAACC,GAAL,CAASF,IAAI,GAAGH,IAAhB,IAAwBI,IAAI,CAACC,GAAL,CAASH,IAAI,GAAGF,IAAhB,CAAxB,GAAgDG,IAAhD,GAAuDD,IAA9D;AACD,GAFM,CAAP;AAGD;AAED,IAAMI,WAAW,GAAG,6BAApB;AAEA,SAAgBC,gBAAgBC;AAC9B,MAA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Ae,cAAc,CAACI,QAAf,GAA0BP,aAA1B;;;;"}
1
+ {"version":3,"file":"react-modal-sheet.cjs.development.js","sources":["../src/constants.ts","../src/utils.ts","../src/hooks.tsx","../src/context.tsx","../src/use-prevent-scroll.ts","../src/styles.ts","../src/sheet.tsx","../src/SheetContainer.tsx","../src/SheetContent.tsx","../src/SheetHeader.tsx","../src/SheetBackdrop.tsx","../src/index.tsx"],"sourcesContent":["export const MAX_HEIGHT = 'calc(100% - env(safe-area-inset-top) - 34px)';\n\nexport const IS_SSR = typeof window === 'undefined';\n\nexport const DEFAULT_SPRING_CONFIG = {\n stiffness: 300,\n damping: 30,\n mass: 0.2,\n};\n\nexport const DRAG_CLOSE_THRESHOLD = 0.6;\n\nexport const DRAG_VELOCITY_THRESHOLD = 500;\n","import * as React from 'react';\n\nexport function getClosest(nums: number[], goal: number) {\n return nums.reduce((prev, curr) => {\n return Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev;\n });\n}\n\nconst highlightId = 'react-modal-sheet-highlight';\n\nexport function applyRootStyles(rootId: string) {\n const body = document.querySelector('body') as HTMLBodyElement;\n const root = document.querySelector(`#${rootId}`) as HTMLDivElement;\n\n if (root) {\n const p = 24;\n const h = window.innerHeight;\n const s = (h - p) / h;\n body.style.backgroundColor = '#000';\n root.style.overflow = 'hidden';\n root.style.willChange = 'transform';\n root.style.transition = 'transform 200ms linear';\n root.style.transform = `translateY(calc(env(safe-area-inset-top) + ${p / 2}px)) scale(${s})`; // prettier-ignore\n root.style.borderTopRightRadius = '10px';\n root.style.borderTopLeftRadius = '10px';\n\n // Add highlighed overlay to emphasize the modality effect\n const highlight = document.createElement('div');\n highlight.setAttribute('aria-hidden', 'true');\n highlight.id = highlightId;\n highlight.style.position = 'absolute';\n highlight.style.top = '0px';\n highlight.style.left = '0px';\n highlight.style.bottom = '0px';\n highlight.style.right = '0px';\n highlight.style.opacity = '0';\n highlight.style.transition = 'opacity 200ms linear';\n highlight.style.backgroundColor = 'rgba(150, 150, 150, 0.1)';\n\n root.appendChild(highlight);\n requestAnimationFrame(() => (highlight.style.opacity = '1'));\n }\n}\n\nexport function cleanupRootStyles(rootId: string) {\n const body = document.querySelector('body') as HTMLBodyElement;\n const root = document.getElementById(rootId) as HTMLDivElement;\n const highlight = document.getElementById(highlightId) as HTMLDivElement;\n\n function onTransitionEnd() {\n root.style.removeProperty('overflow');\n root.style.removeProperty('will-change');\n root.style.removeProperty('transition');\n body.style.removeProperty('background-color');\n root.removeEventListener('transitionend', onTransitionEnd);\n highlight.parentNode?.removeChild(highlight);\n }\n\n if (root && highlight) {\n // Start animating back\n root.style.removeProperty('border-top-right-radius');\n root.style.removeProperty('border-top-left-radius');\n root.style.removeProperty('transform');\n highlight.style.opacity = '0';\n\n // Remove temp properties after animation is finished\n root.addEventListener('transitionend', onTransitionEnd);\n }\n}\n\nexport function inDescendingOrder(arr: number[]) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i + 1] > arr[i]) return false;\n }\n\n return true;\n}\n\nexport function validateSnapTo({\n snapTo,\n sheetHeight,\n}: {\n snapTo: number;\n sheetHeight: number;\n}) {\n if (snapTo < 0) {\n console.warn(\n `Snap point is out of bounds. Sheet height is ${sheetHeight} but snap point is ${sheetHeight +\n Math.abs(snapTo)}.`\n );\n }\n\n return Math.max(Math.round(snapTo), 0);\n}\n\nexport function mergeRefs<T = any>(\n refs: React.ForwardedRef<T>[]\n): React.RefCallback<T> {\n return (value: any) => {\n refs.forEach((ref: any) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n });\n };\n}\n","import * as React from 'react';\n\nimport { IS_SSR } from './constants';\nimport { SheetEvents } from './types';\nimport { applyRootStyles, cleanupRootStyles } from './utils';\n\nexport const useIsomorphicLayoutEffect = IS_SSR\n ? React.useEffect\n : React.useLayoutEffect;\n\nexport const useModalEffect = (isOpen: boolean, rootId?: string) => {\n const prevOpen = usePrevious(isOpen);\n\n // Automatically apply the iOS modal effect to the body when sheet opens/closes\n React.useEffect(() => {\n if (rootId && !prevOpen && isOpen) {\n applyRootStyles(rootId);\n } else if (rootId && !isOpen && prevOpen) {\n cleanupRootStyles(rootId);\n }\n }, [isOpen, prevOpen]); // eslint-disable-line\n\n // Make sure to cleanup modal styles on unmount\n React.useEffect(() => {\n return () => {\n if (rootId && isOpen) cleanupRootStyles(rootId);\n };\n }, [isOpen]); // eslint-disable-line\n};\n\nexport const useEventCallbacks = (\n isOpen: boolean,\n callbacks: React.MutableRefObject<SheetEvents>\n) => {\n const prevOpen = usePrevious(isOpen);\n const didOpen = React.useRef(false);\n\n // Because of AnimatePrecence we don't have access to latest isOpen value\n // so we need to read and write to a ref to determine if we are\n // opening or closing the sheet\n const handleAnimationComplete = React.useCallback(() => {\n if (!didOpen.current) {\n callbacks.current.onOpenEnd?.();\n didOpen.current = true;\n } else {\n callbacks.current.onCloseEnd?.();\n didOpen.current = false;\n }\n }, [isOpen, prevOpen]); // eslint-disable-line\n\n React.useEffect(() => {\n if (!prevOpen && isOpen) {\n callbacks.current.onOpenStart?.();\n } else if (!isOpen && prevOpen) {\n callbacks.current.onCloseStart?.();\n }\n }, [isOpen, prevOpen]); // eslint-disable-line\n\n return { handleAnimationComplete };\n};\n\nexport function useWindowHeight() {\n const [windowHeight, setWindowHeight] = React.useState(0);\n\n useIsomorphicLayoutEffect(() => {\n const updateHeight = () => setWindowHeight(window.innerHeight);\n window.addEventListener('resize', updateHeight);\n updateHeight();\n return () => window.removeEventListener('resize', updateHeight);\n }, []);\n\n return windowHeight;\n}\n\nexport function usePrevious<T>(state: T): T | undefined {\n const ref = React.useRef<T>();\n\n React.useEffect(() => {\n ref.current = state;\n });\n\n return ref.current;\n}\n\n// Userland version of the `useEvent` React hook:\n// RFC: https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md\nexport function useEvent<T extends (...args: any[]) => any>(handler: T) {\n const handlerRef = React.useRef<T>();\n\n useIsomorphicLayoutEffect(() => {\n handlerRef.current = handler;\n });\n\n return React.useCallback((...args: any[]) => {\n const fn = handlerRef.current;\n return fn?.(...args);\n }, []) as T;\n}\n","import * as React from 'react';\nimport { SheetContextType } from './types';\n\nexport const SheetContext = React.createContext<SheetContextType | undefined>(\n undefined\n);\n\nexport const useSheetContext = () => {\n const context = React.useContext(SheetContext);\n if (!context) throw Error('Sheet context error');\n return context;\n};\n","// Source: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/overlays/src/usePreventScroll.ts\nimport {\n chain,\n getScrollParent,\n isIOS,\n useLayoutEffect,\n} from '@react-aria/utils';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\n// @ts-ignore\nconst visualViewport = typeof window !== 'undefined' && window.visualViewport;\n\n// HTML input types that do not cause the software keyboard to appear.\nconst nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset',\n]);\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore: any;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}) {\n let { isDisabled } = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n return chain(\n setStyle(\n document.documentElement,\n 'paddingRight',\n `${window.innerWidth - document.documentElement.clientWidth}px`\n ),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the\n// top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top\n// of the page, which prevents it from scrolling the page. After the input is focused, scroll the element\n// into view ourselves, without scrolling the whole page.\n// 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the\n// same visually, but makes the actual scroll position always zero. This is required to make all of the\n// above work or Safari will still try to scroll the page when focusing an input.\n// 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting\n// to navigate to an input with the next/previous buttons that's outside a modal.\nfunction preventScrollMobileSafari() {\n let scrollable: Element;\n let lastY = 0;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n scrollable = getScrollParent(e.target as Element);\n if (\n scrollable === document.documentElement &&\n scrollable === document.body\n ) {\n return;\n }\n\n lastY = e.changedTouches[0].pageY;\n };\n\n let onTouchMove = (e: TouchEvent) => {\n // Prevent scrolling the window.\n if (\n scrollable === document.documentElement ||\n scrollable === document.body\n ) {\n e.preventDefault();\n return;\n }\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead. Unfortunately, this disables bounce scrolling when at\n // the top but it's the best we can do.\n let y = e.changedTouches[0].pageY;\n let scrollTop = scrollable.scrollTop;\n let bottom = scrollable.scrollHeight - scrollable.clientHeight;\n\n // Fix for: https://github.com/adobe/react-spectrum/pull/3780/files\n if (bottom === 0) {\n return;\n }\n\n if ((scrollTop <= 0 && y > lastY) || (scrollTop >= bottom && y < lastY)) {\n e.preventDefault();\n }\n\n lastY = y;\n };\n\n let onTouchEnd = (e: TouchEvent) => {\n let target = e.target as HTMLElement;\n\n // Apply this change if we're not already focused on the target element\n if (willOpenKeyboard(target) && target !== document.activeElement) {\n e.preventDefault();\n\n // Apply a transform to trick Safari into thinking the input is at the top of the page\n // so it doesn't try to scroll it into view. When tapping on an input, this needs to\n // be done before the \"focus\" event, so we have to focus the element ourselves.\n target.style.transform = 'translateY(-2000px)';\n target.focus();\n requestAnimationFrame(() => {\n target.style.transform = '';\n });\n }\n };\n\n let onFocus = (e: FocusEvent) => {\n let target = e.target as HTMLElement;\n if (willOpenKeyboard(target)) {\n // Transform also needs to be applied in the focus event in cases where focus moves\n // other than tapping on an input directly, e.g. the next/previous buttons in the\n // software keyboard. In these cases, it seems applying the transform in the focus event\n // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️\n target.style.transform = 'translateY(-2000px)';\n requestAnimationFrame(() => {\n target.style.transform = '';\n\n // This will have prevented the browser from scrolling the focused element into view,\n // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.\n if (visualViewport) {\n if (visualViewport.height < window.innerHeight) {\n // If the keyboard is already visible, do this after one additional frame\n // to wait for the transform to be removed.\n requestAnimationFrame(() => {\n scrollIntoView(target);\n });\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener(\n 'resize',\n () => scrollIntoView(target),\n { once: true }\n );\n }\n }\n });\n }\n };\n\n let onWindowScroll = () => {\n // Last resort. If the window scrolled, scroll it back to the top.\n // It should always be at the top because the body will have a negative margin (see below).\n window.scrollTo(0, 0);\n };\n\n // Record the original scroll position so we can restore it.\n // Then apply a negative margin to the body to offset it by the scroll position. This will\n // enable us to scroll the window to the top, which is required for the rest of this to work.\n let scrollX = window.pageXOffset;\n let scrollY = window.pageYOffset;\n\n let restoreStyles = chain(\n setStyle(\n document.documentElement,\n 'paddingRight',\n `${window.innerWidth - document.documentElement.clientWidth}px`\n ),\n setStyle(document.documentElement, 'overflow', 'hidden'),\n setStyle(document.body, 'marginTop', `-${scrollY}px`)\n );\n\n // Scroll to the top. The negative margin on the body will make this appear the same.\n window.scrollTo(0, 0);\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {\n passive: false,\n capture: true,\n }),\n addEvent(document, 'touchmove', onTouchMove, {\n passive: false,\n capture: true,\n }),\n addEvent(document, 'touchend', onTouchEnd, {\n passive: false,\n capture: true,\n }),\n addEvent(document, 'focus', onFocus, true),\n addEvent(window, 'scroll', onWindowScroll)\n );\n\n return () => {\n // Restore styles and scroll the page back to where it was.\n restoreStyles();\n removeEvents();\n window.scrollTo(scrollX, scrollY);\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: any, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: EventTarget,\n event: K,\n handler: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n target.addEventListener(event, handler as any, options);\n return () => {\n target.removeEventListener(event, handler as any, options);\n };\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n while (target && target !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(target);\n if (\n scrollable !== document.documentElement &&\n scrollable !== document.body &&\n scrollable !== target\n ) {\n let scrollableTop = scrollable.getBoundingClientRect().top;\n let targetTop = target.getBoundingClientRect().top;\n if (targetTop > scrollableTop + target.clientHeight) {\n scrollable.scrollTop += targetTop - scrollableTop;\n }\n }\n\n target = scrollable.parentElement as any;\n }\n}\n\nfunction willOpenKeyboard(target: Element) {\n return (\n (target instanceof HTMLInputElement &&\n !nonTextInputTypes.has(target.type)) ||\n target instanceof HTMLTextAreaElement ||\n (target instanceof HTMLElement && target.isContentEditable)\n );\n}\n","import * as CSS from 'csstype';\n\nconst styles: { [key: string]: CSS.Properties } = {\n wrapper: {\n position: 'fixed',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n zIndex: 9999999,\n overflow: 'hidden',\n pointerEvents: 'none',\n },\n backdrop: {\n zIndex: 1,\n position: 'fixed',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'rgba(51, 51, 51, 0.5)',\n touchAction: 'none', // Disable iOS body scrolling\n border: 'none',\n },\n container: {\n zIndex: 2,\n position: 'absolute',\n left: 0,\n bottom: 0,\n width: '100%',\n backgroundColor: '#fff',\n borderTopRightRadius: '8px',\n borderTopLeftRadius: '8px',\n boxShadow: '0px -2px 16px rgba(0, 0, 0, 0.3)',\n display: 'flex',\n flexDirection: 'column',\n pointerEvents: 'auto',\n },\n headerWrapper: {\n width: '100%',\n },\n header: {\n height: '40px',\n width: '100%',\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n indicator: {\n width: '18px',\n height: '4px',\n borderRadius: '99px',\n backgroundColor: '#ddd',\n },\n content: {\n flex: 1,\n overflow: 'auto',\n position: 'relative',\n },\n};\n\nexport default styles;\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\n\nimport {\n animate,\n AnimatePresence,\n AnimationOptions,\n PanInfo,\n useMotionValue,\n useReducedMotion,\n} from 'framer-motion';\n\nimport {\n useModalEffect,\n useWindowHeight,\n useIsomorphicLayoutEffect,\n useEvent,\n} from './hooks';\n\nimport {\n DEFAULT_SPRING_CONFIG,\n DRAG_CLOSE_THRESHOLD,\n DRAG_VELOCITY_THRESHOLD,\n IS_SSR,\n} from './constants';\n\nimport { SheetContextType, SheetProps } from './types';\nimport { SheetContext } from './context';\nimport { getClosest, inDescendingOrder, validateSnapTo } from './utils';\nimport { usePreventScroll } from './use-prevent-scroll';\nimport styles from './styles';\n\nconst Sheet = React.forwardRef<any, SheetProps>(\n (\n {\n onOpenStart,\n onOpenEnd,\n onClose,\n onCloseStart,\n onCloseEnd,\n onSnap,\n children,\n isOpen,\n snapPoints,\n rootId,\n mountPoint,\n style,\n detent = 'full-height',\n initialSnap = 0,\n springConfig = DEFAULT_SPRING_CONFIG,\n disableDrag = false,\n prefersReducedMotion = false,\n ...rest\n },\n ref\n ) => {\n const sheetRef = React.useRef<any>(null);\n const indicatorRotation = useMotionValue(0);\n const windowHeight = useWindowHeight();\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = Boolean(prefersReducedMotion || shouldReduceMotion);\n const animationOptions: AnimationOptions<number> = reduceMotion\n ? { type: 'tween', duration: 0.01 }\n : { type: 'spring', ...springConfig };\n\n // NOTE: the inital value for `y` doesn't matter since it is overwritten by\n // the value driven by the `AnimatePresence` component when the sheet is opened\n // and after that it is driven by the gestures and/or snapping\n const y = useMotionValue(0);\n\n // Keep the callback fns up-to-date so that they can be accessed inside\n // the effect without including them to the dependencies array\n const callbacks = React.useRef({\n onOpenStart,\n onOpenEnd,\n onCloseStart,\n onCloseEnd,\n });\n\n useIsomorphicLayoutEffect(() => {\n callbacks.current = {\n onOpenStart,\n onOpenEnd,\n onCloseStart,\n onCloseEnd,\n };\n });\n\n if (snapPoints) {\n // Convert negative / percentage snap points to absolute values\n snapPoints = snapPoints.map(point => {\n // Percentage values e.g. between 0.0 and 1.0\n if (point > 0 && point <= 1) return Math.round(point * windowHeight);\n return point < 0 ? windowHeight + point : point; // negative values\n });\n\n console.assert(\n inDescendingOrder(snapPoints) || windowHeight === 0,\n `Snap points need to be in descending order got: [${snapPoints}]`\n );\n }\n\n const onDrag = useEvent((_, { delta }: PanInfo) => {\n // Update drag indicator rotation based on drag velocity\n const velocity = y.getVelocity();\n\n if (velocity > 0) indicatorRotation.set(10);\n if (velocity < 0) indicatorRotation.set(-10);\n\n // Make sure user cannot drag beyond the top of the sheet\n y.set(Math.max(y.get() + delta.y, 0));\n });\n\n const onDragEnd = useEvent((_, { velocity }: PanInfo) => {\n if (velocity.y > DRAG_VELOCITY_THRESHOLD) {\n // User flicked the sheet down\n onClose();\n } else {\n const sheetEl = sheetRef.current as HTMLDivElement;\n const sheetHeight = sheetEl.getBoundingClientRect().height;\n const currentY = y.get();\n\n let snapTo = 0;\n\n if (snapPoints) {\n const snapToValues = snapPoints\n .map(p => sheetHeight - p)\n .filter(p => p >= 0); // negative values can occur with `content-height` detent\n\n // Allow snapping to the top of the sheet if detent is set to `content-height`\n if (detent === 'content-height' && !snapToValues.includes(0)) {\n snapToValues.unshift(0);\n }\n\n // Get the closest snap point\n snapTo = getClosest(snapToValues, currentY);\n } else if (currentY / sheetHeight > DRAG_CLOSE_THRESHOLD) {\n // Close if dragged over enough far\n snapTo = sheetHeight;\n }\n\n snapTo = validateSnapTo({ snapTo, sheetHeight });\n\n // Update the spring value so that the sheet is animated to the snap point\n animate(y, snapTo, animationOptions);\n\n if (snapPoints && onSnap) {\n const snapValue = Math.abs(Math.round(snapPoints[0] - snapTo));\n const snapIndex = snapPoints.indexOf(getClosest(snapPoints, snapValue)); // prettier-ignore\n onSnap(snapIndex);\n }\n\n if (snapTo >= sheetHeight) onClose();\n }\n\n // Reset indicator rotation after dragging\n indicatorRotation.set(0);\n });\n\n // Trigger onSnap callback when sheet is opened or closed\n React.useEffect(() => {\n if (!snapPoints || !onSnap) return;\n const snapIndex = isOpen ? initialSnap : snapPoints.length - 1;\n onSnap(snapIndex);\n }, [isOpen]); // eslint-disable-line\n\n React.useImperativeHandle(ref, () => ({\n y,\n snapTo: (snapIndex: number) => {\n const sheetEl = sheetRef.current as HTMLDivElement | null;\n\n if (\n snapPoints &&\n snapPoints[snapIndex] !== undefined &&\n sheetEl !== null\n ) {\n const sheetHeight = sheetEl.getBoundingClientRect().height;\n const snapPoint = snapPoints[snapIndex];\n const snapTo = validateSnapTo({\n snapTo: sheetHeight - snapPoint,\n sheetHeight,\n });\n\n animate(y, snapTo, animationOptions);\n if (onSnap) onSnap(snapIndex);\n if (snapTo >= sheetHeight) onClose();\n }\n },\n }));\n\n useModalEffect(isOpen, rootId);\n\n // Framer Motion should handle body scroll locking but it's not working\n // properly on iOS. Scroll locking from React Aria seems to work much better.\n usePreventScroll({ isDisabled: !isOpen });\n\n const dragProps = React.useMemo(() => {\n const dragProps: SheetContextType['dragProps'] = {\n drag: 'y',\n dragElastic: 0,\n dragConstraints: { top: 0, bottom: 0 },\n dragMomentum: false,\n dragPropagation: false,\n onDrag,\n onDragEnd,\n };\n\n return disableDrag ? undefined : dragProps;\n }, [disableDrag]); // eslint-disable-line\n\n const context: SheetContextType = {\n y,\n sheetRef,\n isOpen,\n initialSnap,\n snapPoints,\n detent,\n indicatorRotation,\n callbacks,\n dragProps,\n windowHeight,\n animationOptions,\n reduceMotion,\n };\n\n const sheet = (\n <SheetContext.Provider value={context}>\n <div {...rest} ref={ref} style={{ ...styles.wrapper, ...style }}>\n <AnimatePresence>\n {/* NOTE: AnimatePresence requires us to set keys to children */}\n {isOpen\n ? React.Children.map(children, (child: any, i) =>\n React.cloneElement(child, { key: `sheet-child-${i}` })\n )\n : null}\n </AnimatePresence>\n </div>\n </SheetContext.Provider>\n );\n\n if (IS_SSR) return sheet;\n\n return ReactDOM.createPortal(sheet, mountPoint ?? document.body);\n }\n);\n\nexport default Sheet;\n","import * as React from 'react';\nimport { motion } from 'framer-motion';\n\nimport { SheetContainerProps } from './types';\nimport { useSheetContext } from './context';\nimport { useEventCallbacks } from './hooks';\nimport { MAX_HEIGHT } from './constants';\nimport { mergeRefs } from './utils';\nimport styles from './styles';\n\nconst SheetContainer = React.forwardRef<any, SheetContainerProps>(\n ({ children, style = {}, className = '', ...rest }, ref) => {\n const {\n y,\n isOpen,\n callbacks,\n snapPoints,\n initialSnap = 0,\n sheetRef,\n windowHeight,\n detent,\n animationOptions,\n reduceMotion,\n } = useSheetContext();\n\n const { handleAnimationComplete } = useEventCallbacks(isOpen, callbacks);\n const initialY = snapPoints ? snapPoints[0] - snapPoints[initialSnap] : 0;\n const maxSnapHeight = snapPoints ? snapPoints[0] : null;\n\n const height =\n maxSnapHeight !== null\n ? `min(${maxSnapHeight}px, ${MAX_HEIGHT})`\n : MAX_HEIGHT;\n\n return (\n <motion.div\n {...rest}\n ref={mergeRefs([sheetRef, ref])}\n className={`react-modal-sheet-container ${className}`}\n style={{\n ...styles.container,\n ...style,\n ...(detent === 'full-height' && { height }),\n ...(detent === 'content-height' && { maxHeight: height }),\n y,\n }}\n initial={reduceMotion ? false : { y: windowHeight }}\n animate={{ y: initialY, transition: animationOptions }}\n exit={{ y: windowHeight, transition: animationOptions }}\n onAnimationComplete={handleAnimationComplete}\n >\n {children}\n </motion.div>\n );\n }\n);\n\nexport default SheetContainer;\n","import * as React from 'react';\nimport { motion } from 'framer-motion';\n\nimport { SheetDraggableProps } from './types';\nimport { useSheetContext } from './context';\nimport styles from './styles';\n\nconst SheetContent = React.forwardRef<any, SheetDraggableProps>(\n ({ children, style, disableDrag, className = '', ...rest }, ref) => {\n const { dragProps } = useSheetContext();\n const _dragProps = disableDrag ? undefined : dragProps;\n\n return (\n <motion.div\n {...rest}\n ref={ref}\n className={`react-modal-sheet-content ${className}`}\n style={{ ...styles.content, ...style }}\n {..._dragProps}\n >\n {children}\n </motion.div>\n );\n }\n);\n\nexport default SheetContent;\n","import * as React from 'react';\nimport { motion, useTransform } from 'framer-motion';\n\nimport { SheetDraggableProps } from './types';\nimport { useSheetContext } from './context';\nimport styles from './styles';\n\nconst SheetHeader = React.forwardRef<any, SheetDraggableProps>(\n ({ children, style, disableDrag, ...rest }, ref) => {\n const { indicatorRotation, dragProps } = useSheetContext();\n const _dragProps = disableDrag ? undefined : dragProps;\n\n const indicator1Transform = useTransform(\n indicatorRotation,\n r => `translateX(2px) rotate(${r}deg)`\n );\n\n const indicator2Transform = useTransform(\n indicatorRotation,\n r => `translateX(-2px) rotate(${-1 * r}deg)`\n );\n\n return (\n <motion.div\n {...rest}\n ref={ref}\n style={{ ...styles.headerWrapper, ...style }}\n {..._dragProps}\n >\n {children || (\n <div className=\"react-modal-sheet-header\" style={styles.header}>\n <motion.span\n className=\"react-modal-sheet-drag-indicator\"\n style={{ ...styles.indicator, transform: indicator1Transform }}\n />\n <motion.span\n className=\"react-modal-sheet-drag-indicator\"\n style={{ ...styles.indicator, transform: indicator2Transform }}\n />\n </div>\n )}\n </motion.div>\n );\n }\n);\n\nexport default SheetHeader;\n","import * as React from 'react';\nimport { motion } from 'framer-motion';\n\nimport { SheetBackdropProps } from './types';\nimport styles from './styles';\n\nconst isClickable = (props: any) => !!props.onClick || !!props.onTap;\n\nconst SheetBackdrop = React.forwardRef<any, SheetBackdropProps>(\n ({ style = {}, className = '', ...rest }, ref) => {\n const Comp = isClickable(rest) ? motion.button : motion.div;\n const pointerEvents = isClickable(rest) ? 'auto' : 'none';\n\n return (\n <Comp\n {...rest}\n ref={ref}\n className={`react-modal-sheet-backdrop ${className}`}\n style={{ ...styles.backdrop, ...style, pointerEvents }}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n />\n );\n }\n);\n\nexport default SheetBackdrop;\n","import { MotionValue } from 'framer-motion';\n\nimport Sheet from './sheet';\nimport SheetContainer from './SheetContainer';\nimport SheetContent from './SheetContent';\nimport SheetHeader from './SheetHeader';\nimport SheetBackdrop from './SheetBackdrop';\nimport { SheetCompound } from './types';\n\nexport type SheetRef = {\n y: MotionValue<number>;\n snapTo: (index: number) => void;\n};\n\n// HACK: this is needed to get the typing to work properly...\nconst _SheetCompound: any = Sheet;\n_SheetCompound.Container = SheetContainer;\n_SheetCompound.Header = SheetHeader;\n_SheetCompound.Content = SheetContent;\n_SheetCompound.Backdrop = SheetBackdrop;\n\nexport default _SheetCompound as SheetCompound;\n"],"names":["MAX_HEIGHT","IS_SSR","window","DEFAULT_SPRING_CONFIG","stiffness","damping","mass","DRAG_CLOSE_THRESHOLD","DRAG_VELOCITY_THRESHOLD","getClosest","nums","goal","reduce","prev","curr","Math","abs","highlightId","applyRootStyles","rootId","body","document","querySelector","root","p","h","innerHeight","s","style","backgroundColor","overflow","willChange","transition","transform","borderTopRightRadius","borderTopLeftRadius","highlight","createElement","setAttribute","id","position","top","left","bottom","right","opacity","appendChild","requestAnimationFrame","cleanupRootStyles","getElementById","onTransitionEnd","removeProperty","removeEventListener","parentNode","removeChild","addEventListener","inDescendingOrder","arr","i","length","validateSnapTo","snapTo","sheetHeight","console","warn","max","round","mergeRefs","refs","value","forEach","ref","current","useIsomorphicLayoutEffect","React","useModalEffect","isOpen","prevOpen","usePrevious","useEventCallbacks","callbacks","didOpen","handleAnimationComplete","onOpenEnd","onCloseEnd","onOpenStart","onCloseStart","useWindowHeight","windowHeight","setWindowHeight","updateHeight","state","useEvent","handler","handlerRef","fn","args","SheetContext","undefined","useSheetContext","context","Error","visualViewport","nonTextInputTypes","Set","preventScrollCount","restore","usePreventScroll","options","isDisabled","useLayoutEffect","isIOS","preventScrollMobileSafari","preventScrollStandard","chain","setStyle","documentElement","innerWidth","clientWidth","scrollable","lastY","onTouchStart","e","getScrollParent","target","changedTouches","pageY","onTouchMove","preventDefault","y","scrollTop","scrollHeight","clientHeight","onTouchEnd","willOpenKeyboard","activeElement","focus","onFocus","height","scrollIntoView","once","onWindowScroll","scrollTo","scrollX","pageXOffset","scrollY","pageYOffset","restoreStyles","removeEvents","addEvent","passive","capture","element","cur","event","scrollingElement","scrollableTop","getBoundingClientRect","targetTop","parentElement","HTMLInputElement","has","type","HTMLTextAreaElement","HTMLElement","isContentEditable","styles","wrapper","zIndex","pointerEvents","backdrop","width","touchAction","border","container","boxShadow","display","flexDirection","headerWrapper","header","alignItems","justifyContent","indicator","borderRadius","content","flex","Sheet","onClose","onSnap","children","snapPoints","mountPoint","detent","initialSnap","springConfig","disableDrag","prefersReducedMotion","rest","sheetRef","indicatorRotation","useMotionValue","shouldReduceMotion","useReducedMotion","reduceMotion","Boolean","animationOptions","duration","map","point","assert","onDrag","_","delta","velocity","getVelocity","set","get","onDragEnd","sheetEl","currentY","snapToValues","filter","includes","unshift","animate","snapValue","snapIndex","indexOf","snapPoint","dragProps","drag","dragElastic","dragConstraints","dragMomentum","dragPropagation","sheet","Provider","AnimatePresence","child","key","ReactDOM","SheetContainer","className","initialY","maxSnapHeight","motion","div","maxHeight","initial","exit","onAnimationComplete","SheetContent","_dragProps","SheetHeader","indicator1Transform","useTransform","r","indicator2Transform","span","isClickable","props","onClick","onTap","SheetBackdrop","Comp","button","_SheetCompound","Container","Header","Content","Backdrop"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,UAAU,GAAG,8CAAnB;AAEA,IAAMC,MAAM,GAAG,OAAOC,MAAP,KAAkB,WAAjC;AAEA,IAAMC,qBAAqB,GAAG;AACnCC,EAAAA,SAAS,EAAE,GADwB;AAEnCC,EAAAA,OAAO,EAAE,EAF0B;AAGnCC,EAAAA,IAAI,EAAE;AAH6B,CAA9B;AAMA,IAAMC,oBAAoB,GAAG,GAA7B;AAEA,IAAMC,uBAAuB,GAAG,GAAhC;;SCVSC,WAAWC,MAAgBC;AACzC,SAAOD,IAAI,CAACE,MAAL,CAAY,UAACC,IAAD,EAAOC,IAAP;AACjB,WAAOC,IAAI,CAACC,GAAL,CAASF,IAAI,GAAGH,IAAhB,IAAwBI,IAAI,CAACC,GAAL,CAASH,IAAI,GAAGF,IAAhB,CAAxB,GAAgDG,IAAhD,GAAuDD,IAA9D;AACD,GAFM,CAAP;AAGD;AAED,IAAMI,WAAW,GAAG,6BAApB;AAEA,SAAgBC,gBAAgBC;AAC9B,MAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAT,CAAuB,MA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