@nation-a/ui 0.11.2 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +117 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +117 -154
- package/dist/index.js.map +1 -1
- package/dist/styled-system/styles.css +64 -92
- package/dist/types/components/BottomSheet/BottomSheet.stories.d.ts +5 -0
- package/dist/types/components/BottomSheet/index.d.ts +31 -37
- package/dist/types/components/BottomSheet/react-modal-sheet/SheetBackdrop.d.ts +2 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/SheetContainer.d.ts +5 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/SheetContent.d.ts +6 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/SheetHeader.d.ts +6 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/SheetScroller.d.ts +3 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/constants.d.ts +12 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/context.d.ts +9 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/hooks.d.ts +22 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/index.d.ts +10 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/sheet.d.ts +16 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/styles.d.ts +2 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/types.d.ts +87 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/use-prevent-scroll.d.ts +13 -0
- package/dist/types/components/BottomSheet/react-modal-sheet/utils.d.ts +10 -0
- package/dist/types/components/Navigation/navigation.recipe.d.ts +1 -1
- package/dist/types/components/Tabs/tabs.recipe.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/types/components/BottomSheet2/BottomSheet.stories.d.ts +0 -11
- package/dist/types/components/BottomSheet2/index.d.ts +0 -38
- /package/dist/types/components/{BottomSheet2 → BottomSheet}/bottomsheet.recipe.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -5901,7 +5901,7 @@ const dialogRecipe = sva({
|
|
|
5901
5901
|
top: "0",
|
|
5902
5902
|
left: "0",
|
|
5903
5903
|
width: "100vw",
|
|
5904
|
-
zIndex: "
|
|
5904
|
+
zIndex: "popover",
|
|
5905
5905
|
pointerEvents: "auto",
|
|
5906
5906
|
_open: {
|
|
5907
5907
|
animation: "backdrop-in"
|
|
@@ -14060,19 +14060,19 @@ function createScopedAnimate(scope) {
|
|
|
14060
14060
|
return scopedAnimate;
|
|
14061
14061
|
}
|
|
14062
14062
|
const animate = createScopedAnimate();
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14063
|
+
const MAX_HEIGHT = "calc(100% - env(safe-area-inset-top))";
|
|
14064
|
+
const IS_SSR = typeof window === "undefined";
|
|
14065
|
+
const DEFAULT_TWEEN_CONFIG = {
|
|
14066
14066
|
ease: "easeOut",
|
|
14067
14067
|
duration: 0.2
|
|
14068
14068
|
};
|
|
14069
|
-
|
|
14069
|
+
const REDUCED_MOTION_TWEEN_CONFIG = {
|
|
14070
14070
|
ease: "linear",
|
|
14071
14071
|
duration: 0.01
|
|
14072
14072
|
};
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14073
|
+
const DEFAULT_DRAG_CLOSE_THRESHOLD = 0.6;
|
|
14074
|
+
const DEFAULT_DRAG_VELOCITY_THRESHOLD = 500;
|
|
14075
|
+
const useIsomorphicLayoutEffect = IS_SSR ? useEffect : useLayoutEffect;
|
|
14076
14076
|
function useModalEffect({
|
|
14077
14077
|
y,
|
|
14078
14078
|
rootId,
|
|
@@ -14152,19 +14152,19 @@ function useEventCallbacks(isOpen, callbacks) {
|
|
|
14152
14152
|
const handleAnimationComplete = useCallback(() => {
|
|
14153
14153
|
var _a, _b, _c, _d;
|
|
14154
14154
|
if (!didOpen.current) {
|
|
14155
|
-
(_b = (_a = callbacks.current).onOpenEnd) == null ? void 0 : _b.call(_a);
|
|
14155
|
+
(_b = (_a = callbacks.current) == null ? void 0 : _a.onOpenEnd) == null ? void 0 : _b.call(_a);
|
|
14156
14156
|
didOpen.current = true;
|
|
14157
14157
|
} else {
|
|
14158
|
-
(_d = (_c = callbacks.current).onCloseEnd) == null ? void 0 : _d.call(_c);
|
|
14158
|
+
(_d = (_c = callbacks.current) == null ? void 0 : _c.onCloseEnd) == null ? void 0 : _d.call(_c);
|
|
14159
14159
|
didOpen.current = false;
|
|
14160
14160
|
}
|
|
14161
14161
|
}, [isOpen, prevOpen]);
|
|
14162
14162
|
useEffect(() => {
|
|
14163
14163
|
var _a, _b, _c, _d;
|
|
14164
14164
|
if (!prevOpen && isOpen) {
|
|
14165
|
-
(_b = (_a = callbacks.current).onOpenStart) == null ? void 0 : _b.call(_a);
|
|
14165
|
+
(_b = (_a = callbacks.current) == null ? void 0 : _a.onOpenStart) == null ? void 0 : _b.call(_a);
|
|
14166
14166
|
} else if (!isOpen && prevOpen) {
|
|
14167
|
-
(_d = (_c = callbacks.current).onCloseStart) == null ? void 0 : _d.call(_c);
|
|
14167
|
+
(_d = (_c = callbacks.current) == null ? void 0 : _c.onCloseStart) == null ? void 0 : _d.call(_c);
|
|
14168
14168
|
}
|
|
14169
14169
|
}, [isOpen, prevOpen]);
|
|
14170
14170
|
return { handleAnimationComplete };
|
|
@@ -14206,24 +14206,20 @@ function useEffectEvent(handler) {
|
|
|
14206
14206
|
return fn == null ? void 0 : fn(...args);
|
|
14207
14207
|
}, []);
|
|
14208
14208
|
}
|
|
14209
|
-
|
|
14209
|
+
const constraints = { bottom: 0, top: 0, left: 0, right: 0 };
|
|
14210
14210
|
function useDragConstraints() {
|
|
14211
14211
|
const constraintsRef = useRef(null);
|
|
14212
14212
|
const onMeasureDragConstraints = useCallback(() => constraints, []);
|
|
14213
14213
|
return { constraintsRef, onMeasureDragConstraints };
|
|
14214
14214
|
}
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
);
|
|
14218
|
-
var useSheetContext = () => {
|
|
14215
|
+
const SheetContext = createContext$1(void 0);
|
|
14216
|
+
const useSheetContext = () => {
|
|
14219
14217
|
const context2 = useContext(SheetContext);
|
|
14220
14218
|
if (!context2) throw new Error("Sheet context error");
|
|
14221
14219
|
return context2;
|
|
14222
14220
|
};
|
|
14223
|
-
|
|
14224
|
-
function SheetScrollerContextProvider({
|
|
14225
|
-
children
|
|
14226
|
-
}) {
|
|
14221
|
+
const SheetScrollerContext = createContext$1(void 0);
|
|
14222
|
+
function SheetScrollerContextProvider({ children }) {
|
|
14227
14223
|
const sheetContext = useSheetContext();
|
|
14228
14224
|
const [disableDrag, setDisableDrag] = useState(!!sheetContext.disableDrag);
|
|
14229
14225
|
function setDragEnabled() {
|
|
@@ -14232,15 +14228,9 @@ function SheetScrollerContextProvider({
|
|
|
14232
14228
|
function setDragDisabled() {
|
|
14233
14229
|
if (!disableDrag) setDisableDrag(true);
|
|
14234
14230
|
}
|
|
14235
|
-
return /* @__PURE__ */
|
|
14236
|
-
SheetScrollerContext.Provider,
|
|
14237
|
-
{
|
|
14238
|
-
value: { disableDrag, setDragEnabled, setDragDisabled }
|
|
14239
|
-
},
|
|
14240
|
-
children
|
|
14241
|
-
);
|
|
14231
|
+
return /* @__PURE__ */ jsx(SheetScrollerContext.Provider, { value: { disableDrag, setDragEnabled, setDragDisabled }, children });
|
|
14242
14232
|
}
|
|
14243
|
-
|
|
14233
|
+
const useSheetScrollerContext = () => {
|
|
14244
14234
|
const context2 = useContext(SheetScrollerContext);
|
|
14245
14235
|
if (!context2) throw new Error("Sheet scroller context error");
|
|
14246
14236
|
return context2;
|
|
@@ -14305,20 +14295,20 @@ function cached(fn) {
|
|
|
14305
14295
|
return res;
|
|
14306
14296
|
};
|
|
14307
14297
|
}
|
|
14308
|
-
|
|
14298
|
+
const isMac = cached(function() {
|
|
14309
14299
|
return testPlatform(/^Mac/i);
|
|
14310
14300
|
});
|
|
14311
|
-
|
|
14301
|
+
const isIPhone = cached(function() {
|
|
14312
14302
|
return testPlatform(/^iPhone/i);
|
|
14313
14303
|
});
|
|
14314
|
-
|
|
14304
|
+
const isIPad = cached(function() {
|
|
14315
14305
|
return testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
14316
14306
|
isMac() && navigator.maxTouchPoints > 1;
|
|
14317
14307
|
});
|
|
14318
|
-
|
|
14308
|
+
const isIOS = cached(function() {
|
|
14319
14309
|
return isIPhone() || isIPad();
|
|
14320
14310
|
});
|
|
14321
|
-
|
|
14311
|
+
const KEYBOARD_BUFFER = 24;
|
|
14322
14312
|
function chain(...callbacks) {
|
|
14323
14313
|
return (...args) => {
|
|
14324
14314
|
for (const callback of callbacks) {
|
|
@@ -14328,7 +14318,7 @@ function chain(...callbacks) {
|
|
|
14328
14318
|
}
|
|
14329
14319
|
};
|
|
14330
14320
|
}
|
|
14331
|
-
|
|
14321
|
+
const visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
14332
14322
|
function isScrollable(node, checkForOverflow) {
|
|
14333
14323
|
if (!node) {
|
|
14334
14324
|
return false;
|
|
@@ -14352,7 +14342,7 @@ function getScrollParent(node, checkForOverflow) {
|
|
|
14352
14342
|
}
|
|
14353
14343
|
return scrollableNode || document.scrollingElement || document.documentElement;
|
|
14354
14344
|
}
|
|
14355
|
-
|
|
14345
|
+
const nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
14356
14346
|
"checkbox",
|
|
14357
14347
|
"radio",
|
|
14358
14348
|
"range",
|
|
@@ -14363,8 +14353,8 @@ var nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
|
14363
14353
|
"submit",
|
|
14364
14354
|
"reset"
|
|
14365
14355
|
]);
|
|
14366
|
-
|
|
14367
|
-
|
|
14356
|
+
let preventScrollCount = 0;
|
|
14357
|
+
let restore;
|
|
14368
14358
|
function usePreventScroll(options = {}) {
|
|
14369
14359
|
const { isDisabled } = options;
|
|
14370
14360
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -14532,7 +14522,7 @@ function scrollIntoView(target) {
|
|
|
14532
14522
|
function willOpenKeyboard(target) {
|
|
14533
14523
|
return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
14534
14524
|
}
|
|
14535
|
-
|
|
14525
|
+
const styles = {
|
|
14536
14526
|
wrapper: {
|
|
14537
14527
|
position: "fixed",
|
|
14538
14528
|
top: 0,
|
|
@@ -14543,7 +14533,7 @@ var styles = {
|
|
|
14543
14533
|
pointerEvents: "none"
|
|
14544
14534
|
},
|
|
14545
14535
|
backdrop: {
|
|
14546
|
-
zIndex:
|
|
14536
|
+
zIndex: "overlay",
|
|
14547
14537
|
position: "fixed",
|
|
14548
14538
|
top: 0,
|
|
14549
14539
|
left: 0,
|
|
@@ -14556,7 +14546,7 @@ var styles = {
|
|
|
14556
14546
|
WebkitTapHighlightColor: "transparent"
|
|
14557
14547
|
},
|
|
14558
14548
|
container: {
|
|
14559
|
-
zIndex:
|
|
14549
|
+
zIndex: "modal",
|
|
14560
14550
|
position: "absolute",
|
|
14561
14551
|
left: 0,
|
|
14562
14552
|
bottom: 0,
|
|
@@ -14598,7 +14588,7 @@ var styles = {
|
|
|
14598
14588
|
overflowY: "auto"
|
|
14599
14589
|
}
|
|
14600
14590
|
};
|
|
14601
|
-
|
|
14591
|
+
const Sheet$1 = forwardRef(
|
|
14602
14592
|
({
|
|
14603
14593
|
onOpenStart,
|
|
14604
14594
|
onOpenEnd,
|
|
@@ -14632,14 +14622,8 @@ var Sheet = forwardRef(
|
|
|
14632
14622
|
...reduceMotion ? REDUCED_MOTION_TWEEN_CONFIG : tweenConfig
|
|
14633
14623
|
};
|
|
14634
14624
|
const y = useMotionValue(windowHeight);
|
|
14635
|
-
const zIndex2 = useTransform(
|
|
14636
|
-
|
|
14637
|
-
(value) => value + 2 >= windowHeight ? -1 : (style == null ? void 0 : style.zIndex) ?? 9999
|
|
14638
|
-
);
|
|
14639
|
-
const visibility = useTransform(
|
|
14640
|
-
y,
|
|
14641
|
-
(value) => value + 2 >= windowHeight ? "hidden" : "visible"
|
|
14642
|
-
);
|
|
14625
|
+
const zIndex2 = useTransform(y, (value) => value + 2 >= windowHeight ? -1 : (style == null ? void 0 : style.zIndex) ?? 1300);
|
|
14626
|
+
const visibility = useTransform(y, (value) => value + 2 >= windowHeight ? "hidden" : "visible");
|
|
14643
14627
|
const callbacks = useRef({
|
|
14644
14628
|
onOpenStart,
|
|
14645
14629
|
onOpenEnd,
|
|
@@ -14662,9 +14646,7 @@ var Sheet = forwardRef(
|
|
|
14662
14646
|
});
|
|
14663
14647
|
console.assert(
|
|
14664
14648
|
inDescendingOrder(snapPoints) || windowHeight === 0,
|
|
14665
|
-
`Snap points need to be in descending order got: [${snapPoints.join(
|
|
14666
|
-
", "
|
|
14667
|
-
)}]`
|
|
14649
|
+
`Snap points need to be in descending order got: [${snapPoints.join(", ")}]`
|
|
14668
14650
|
);
|
|
14669
14651
|
}
|
|
14670
14652
|
const onDrag = useEffectEvent((_, { delta }) => {
|
|
@@ -14689,9 +14671,7 @@ var Sheet = forwardRef(
|
|
|
14689
14671
|
const currentY = y.get();
|
|
14690
14672
|
let snapTo = 0;
|
|
14691
14673
|
if (snapPoints) {
|
|
14692
|
-
const snapToValues = snapPoints.map(
|
|
14693
|
-
(p) => sheetHeight - Math.min(p, sheetHeight)
|
|
14694
|
-
);
|
|
14674
|
+
const snapToValues = snapPoints.map((p) => sheetHeight - Math.min(p, sheetHeight));
|
|
14695
14675
|
if (detent === "content-height" && !snapToValues.includes(0)) {
|
|
14696
14676
|
snapToValues.unshift(0);
|
|
14697
14677
|
}
|
|
@@ -14703,9 +14683,7 @@ var Sheet = forwardRef(
|
|
|
14703
14683
|
animate(y, snapTo, animationOptions);
|
|
14704
14684
|
if (snapPoints && onSnap) {
|
|
14705
14685
|
const snapValue = Math.abs(Math.round(snapPoints[0] - snapTo));
|
|
14706
|
-
const snapIndex = snapPoints.indexOf(
|
|
14707
|
-
getClosest(snapPoints, snapValue)
|
|
14708
|
-
);
|
|
14686
|
+
const snapIndex = snapPoints.indexOf(getClosest(snapPoints, snapValue));
|
|
14709
14687
|
onSnap(snapIndex);
|
|
14710
14688
|
}
|
|
14711
14689
|
const roundedSheetHeight = Math.round(sheetHeight);
|
|
@@ -14769,24 +14747,13 @@ var Sheet = forwardRef(
|
|
|
14769
14747
|
reduceMotion,
|
|
14770
14748
|
disableDrag
|
|
14771
14749
|
};
|
|
14772
|
-
const sheet = /* @__PURE__ */
|
|
14773
|
-
motion.div,
|
|
14774
|
-
{
|
|
14775
|
-
...rest,
|
|
14776
|
-
ref,
|
|
14777
|
-
style: { ...styles.wrapper, zIndex: zIndex2, visibility, ...style }
|
|
14778
|
-
},
|
|
14779
|
-
/* @__PURE__ */ React__default.createElement(AnimatePresence, null, isOpen ? /* @__PURE__ */ React__default.createElement(SheetScrollerContextProvider, null, Children.map(
|
|
14780
|
-
children,
|
|
14781
|
-
(child, i) => cloneElement(child, { key: `sheet-child-${i}` })
|
|
14782
|
-
)) : null)
|
|
14783
|
-
));
|
|
14750
|
+
const sheet = /* @__PURE__ */ jsx(SheetContext.Provider, { value: context2, children: /* @__PURE__ */ jsx(motion.div, { ...rest, ref, style: { ...styles.wrapper, zIndex: zIndex2, visibility, ...style }, children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsx(SheetScrollerContextProvider, { children: Children.map(children, (child, i) => cloneElement(child, { key: `sheet-child-${i}` })) }) : null }) }) });
|
|
14784
14751
|
if (IS_SSR) return sheet;
|
|
14785
14752
|
return createPortal(sheet, mountPoint ?? document.body);
|
|
14786
14753
|
}
|
|
14787
14754
|
);
|
|
14788
|
-
Sheet.displayName = "Sheet";
|
|
14789
|
-
|
|
14755
|
+
Sheet$1.displayName = "Sheet";
|
|
14756
|
+
const SheetContainer = forwardRef(
|
|
14790
14757
|
({ children, style = {}, className = "", ...rest }, ref) => {
|
|
14791
14758
|
const {
|
|
14792
14759
|
y,
|
|
@@ -14804,7 +14771,7 @@ var SheetContainer = forwardRef(
|
|
|
14804
14771
|
const initialY = snapPoints ? snapPoints[0] - snapPoints[initialSnap] : 0;
|
|
14805
14772
|
const maxSnapHeight = snapPoints ? snapPoints[0] : null;
|
|
14806
14773
|
const height = maxSnapHeight !== null ? `min(${maxSnapHeight}px, ${MAX_HEIGHT})` : MAX_HEIGHT;
|
|
14807
|
-
return /* @__PURE__ */
|
|
14774
|
+
return /* @__PURE__ */ jsx(
|
|
14808
14775
|
motion.div,
|
|
14809
14776
|
{
|
|
14810
14777
|
...rest,
|
|
@@ -14820,20 +14787,20 @@ var SheetContainer = forwardRef(
|
|
|
14820
14787
|
initial: reduceMotion ? false : { y: windowHeight },
|
|
14821
14788
|
animate: { y: initialY, transition: animationOptions },
|
|
14822
14789
|
exit: { y: windowHeight, transition: animationOptions },
|
|
14823
|
-
onAnimationComplete: handleAnimationComplete
|
|
14824
|
-
|
|
14825
|
-
|
|
14790
|
+
onAnimationComplete: handleAnimationComplete,
|
|
14791
|
+
children
|
|
14792
|
+
}
|
|
14826
14793
|
);
|
|
14827
14794
|
}
|
|
14828
14795
|
);
|
|
14829
14796
|
SheetContainer.displayName = "SheetContainer";
|
|
14830
|
-
|
|
14797
|
+
const SheetContent = forwardRef(
|
|
14831
14798
|
({ children, style, disableDrag, className = "", ...rest }, ref) => {
|
|
14832
14799
|
const sheetContext = useSheetContext();
|
|
14833
14800
|
const sheetScrollerContext = useSheetScrollerContext();
|
|
14834
14801
|
const { constraintsRef, onMeasureDragConstraints } = useDragConstraints();
|
|
14835
14802
|
const dragProps = disableDrag || sheetScrollerContext.disableDrag ? void 0 : sheetContext.dragProps;
|
|
14836
|
-
return /* @__PURE__ */
|
|
14803
|
+
return /* @__PURE__ */ jsx(
|
|
14837
14804
|
motion.div,
|
|
14838
14805
|
{
|
|
14839
14806
|
...rest,
|
|
@@ -14842,74 +14809,67 @@ var SheetContent = forwardRef(
|
|
|
14842
14809
|
style: { ...styles.content, ...style },
|
|
14843
14810
|
...dragProps,
|
|
14844
14811
|
dragConstraints: constraintsRef,
|
|
14845
|
-
onMeasureDragConstraints
|
|
14846
|
-
|
|
14847
|
-
|
|
14812
|
+
onMeasureDragConstraints,
|
|
14813
|
+
children
|
|
14814
|
+
}
|
|
14848
14815
|
);
|
|
14849
14816
|
}
|
|
14850
14817
|
);
|
|
14851
14818
|
SheetContent.displayName = "SheetContent";
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
{
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
}
|
|
14887
|
-
))
|
|
14888
|
-
);
|
|
14889
|
-
}
|
|
14890
|
-
);
|
|
14819
|
+
const SheetHeader = forwardRef(({ children, style, disableDrag, ...rest }, ref) => {
|
|
14820
|
+
const { indicatorRotation, dragProps } = useSheetContext();
|
|
14821
|
+
const { constraintsRef, onMeasureDragConstraints } = useDragConstraints();
|
|
14822
|
+
const _dragProps = disableDrag ? void 0 : dragProps;
|
|
14823
|
+
const indicator1Transform = useTransform(indicatorRotation, (r) => `translateX(2px) rotate(${r}deg)`);
|
|
14824
|
+
const indicator2Transform = useTransform(indicatorRotation, (r) => `translateX(-2px) rotate(${-1 * r}deg)`);
|
|
14825
|
+
return /* @__PURE__ */ jsx(
|
|
14826
|
+
motion.div,
|
|
14827
|
+
{
|
|
14828
|
+
...rest,
|
|
14829
|
+
ref: mergeRefs([ref, constraintsRef]),
|
|
14830
|
+
style: { ...styles.headerWrapper, ...style },
|
|
14831
|
+
..._dragProps,
|
|
14832
|
+
dragConstraints: constraintsRef,
|
|
14833
|
+
onMeasureDragConstraints,
|
|
14834
|
+
children: children || /* @__PURE__ */ jsxs("div", { className: "react-modal-sheet-header", style: styles.header, children: [
|
|
14835
|
+
/* @__PURE__ */ jsx(
|
|
14836
|
+
motion.span,
|
|
14837
|
+
{
|
|
14838
|
+
className: "react-modal-sheet-drag-indicator",
|
|
14839
|
+
style: { ...styles.indicator, transform: indicator1Transform }
|
|
14840
|
+
}
|
|
14841
|
+
),
|
|
14842
|
+
/* @__PURE__ */ jsx(
|
|
14843
|
+
motion.span,
|
|
14844
|
+
{
|
|
14845
|
+
className: "react-modal-sheet-drag-indicator",
|
|
14846
|
+
style: { ...styles.indicator, transform: indicator2Transform }
|
|
14847
|
+
}
|
|
14848
|
+
)
|
|
14849
|
+
] })
|
|
14850
|
+
}
|
|
14851
|
+
);
|
|
14852
|
+
});
|
|
14891
14853
|
SheetHeader.displayName = "SheetHeader";
|
|
14892
|
-
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
}
|
|
14910
|
-
);
|
|
14854
|
+
const isClickable = (props) => !!props.onClick || !!props.onTap;
|
|
14855
|
+
const SheetBackdrop = forwardRef(({ style = {}, className = "", ...rest }, ref) => {
|
|
14856
|
+
const Comp = isClickable(rest) ? motion.button : motion.div;
|
|
14857
|
+
const pointerEvents = isClickable(rest) ? "auto" : "none";
|
|
14858
|
+
return /* @__PURE__ */ jsx(
|
|
14859
|
+
Comp,
|
|
14860
|
+
{
|
|
14861
|
+
...rest,
|
|
14862
|
+
ref,
|
|
14863
|
+
className: `react-modal-sheet-backdrop ${className}`,
|
|
14864
|
+
style: { ...styles.backdrop, ...style, pointerEvents },
|
|
14865
|
+
initial: { opacity: 0 },
|
|
14866
|
+
animate: { opacity: 1 },
|
|
14867
|
+
exit: { opacity: 0 }
|
|
14868
|
+
}
|
|
14869
|
+
);
|
|
14870
|
+
});
|
|
14911
14871
|
SheetBackdrop.displayName = "SheetBackdrop";
|
|
14912
|
-
|
|
14872
|
+
const SheetScroller = forwardRef(
|
|
14913
14873
|
({ draggableAt = "top", children, style, className = "", ...rest }, ref) => {
|
|
14914
14874
|
const sheetScrollerContext = useSheetScrollerContext();
|
|
14915
14875
|
function determineDragState(element) {
|
|
@@ -14938,21 +14898,21 @@ var SheetScroller = forwardRef(
|
|
|
14938
14898
|
}
|
|
14939
14899
|
}
|
|
14940
14900
|
const scrollProps = isTouchDevice() ? { onScroll, onTouchStart } : void 0;
|
|
14941
|
-
return /* @__PURE__ */
|
|
14901
|
+
return /* @__PURE__ */ jsx(
|
|
14942
14902
|
"div",
|
|
14943
14903
|
{
|
|
14944
14904
|
...rest,
|
|
14945
14905
|
ref,
|
|
14946
14906
|
className: `react-modal-sheet-scroller ${className}`,
|
|
14947
14907
|
style: { ...styles.scroller, ...style },
|
|
14948
|
-
...scrollProps
|
|
14949
|
-
|
|
14950
|
-
|
|
14908
|
+
...scrollProps,
|
|
14909
|
+
children
|
|
14910
|
+
}
|
|
14951
14911
|
);
|
|
14952
14912
|
}
|
|
14953
14913
|
);
|
|
14954
14914
|
SheetScroller.displayName = "SheetScroller";
|
|
14955
|
-
|
|
14915
|
+
const Sheet = Object.assign(Sheet$1, {
|
|
14956
14916
|
Container: SheetContainer,
|
|
14957
14917
|
Header: SheetHeader,
|
|
14958
14918
|
Content: SheetContent,
|
|
@@ -14971,7 +14931,8 @@ const bottomSheetRecipe = sva({
|
|
|
14971
14931
|
container: {
|
|
14972
14932
|
backgroundColor: "surface.layer_1",
|
|
14973
14933
|
boxShadow: "md",
|
|
14974
|
-
background: "surface.layer_1"
|
|
14934
|
+
background: "surface.layer_1",
|
|
14935
|
+
zIndex: "modal"
|
|
14975
14936
|
},
|
|
14976
14937
|
header: {
|
|
14977
14938
|
display: "flex",
|
|
@@ -14989,11 +14950,13 @@ const bottomSheetRecipe = sva({
|
|
|
14989
14950
|
backgroundColor: "surface.layer_1",
|
|
14990
14951
|
borderTopLeftRadius: 20,
|
|
14991
14952
|
borderTopRightRadius: 20,
|
|
14992
|
-
boxShadow: "overlay"
|
|
14953
|
+
boxShadow: "overlay",
|
|
14954
|
+
zIndex: "modal"
|
|
14993
14955
|
},
|
|
14994
14956
|
backdrop: {
|
|
14995
14957
|
backgroundColor: "shadow.overlay",
|
|
14996
|
-
opacity: 0.5
|
|
14958
|
+
opacity: 0.5,
|
|
14959
|
+
zIndex: "overlay"
|
|
14997
14960
|
}
|
|
14998
14961
|
},
|
|
14999
14962
|
variants: {
|
|
@@ -15015,7 +14978,7 @@ const BottomSheet = forwardRef(
|
|
|
15015
14978
|
const snapPoints = snapPercent ? [snapPercent.max * window.innerHeight, snapPercent.min * window.innerHeight] : void 0;
|
|
15016
14979
|
const styles2 = bottomSheetRecipe({ fullHeight });
|
|
15017
14980
|
return /* @__PURE__ */ jsx(BottomSheetContext.Provider, { value: { rounded, onClose }, children: /* @__PURE__ */ jsx(
|
|
15018
|
-
|
|
14981
|
+
Sheet,
|
|
15019
14982
|
{
|
|
15020
14983
|
ref,
|
|
15021
14984
|
snapPoints,
|
|
@@ -15042,11 +15005,11 @@ const Content$2 = forwardRef(
|
|
|
15042
15005
|
const { rounded } = useContext(BottomSheetContext);
|
|
15043
15006
|
const contentClass = cx(styles2.content, className, cssProp ? css$1(cssProp) : void 0);
|
|
15044
15007
|
return /* @__PURE__ */ jsx(
|
|
15045
|
-
|
|
15008
|
+
Sheet.Container,
|
|
15046
15009
|
{
|
|
15047
15010
|
style: { backgroundColor: "transparent", borderTopLeftRadius: rounded, borderTopRightRadius: rounded },
|
|
15048
15011
|
children: /* @__PURE__ */ jsx(
|
|
15049
|
-
|
|
15012
|
+
Sheet.Content,
|
|
15050
15013
|
{
|
|
15051
15014
|
ref,
|
|
15052
15015
|
className: contentClass,
|
|
@@ -15069,7 +15032,7 @@ const Backdrop = forwardRef(
|
|
|
15069
15032
|
const { onClose } = useContext(BottomSheetContext);
|
|
15070
15033
|
const backdropClass = cx(styles2.backdrop, className);
|
|
15071
15034
|
return /* @__PURE__ */ jsx(
|
|
15072
|
-
|
|
15035
|
+
Sheet.Backdrop,
|
|
15073
15036
|
{
|
|
15074
15037
|
ref,
|
|
15075
15038
|
className: backdropClass,
|
|
@@ -15105,7 +15068,7 @@ BottomSheet.Header = Header;
|
|
|
15105
15068
|
BottomSheet.Content = Content$2;
|
|
15106
15069
|
BottomSheet.Backdrop = Backdrop;
|
|
15107
15070
|
BottomSheet.Handle = Handle;
|
|
15108
|
-
BottomSheet.Scroller =
|
|
15071
|
+
BottomSheet.Scroller = Sheet.Scroller;
|
|
15109
15072
|
const navigationRecipe = sva({
|
|
15110
15073
|
className: "navigation",
|
|
15111
15074
|
slots: anatomy$1.keys(),
|