@kuzenbo/core 0.0.6 → 0.0.7
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/{dialog-Dzvma_bu.js → dialog-B7kMKriQ.js} +3 -3
- package/dist/dialog-B7kMKriQ.js.map +1 -0
- package/dist/{sheet-FVsgl5Wk.js → sheet-CcyewAZj.js} +3 -3
- package/dist/sheet-CcyewAZj.js.map +1 -0
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/alert-dialog.js.map +1 -1
- package/dist/ui/autocomplete.d.ts +2 -2
- package/dist/ui/autocomplete.js +1 -1
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/combobox.js +5 -5
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/command.js +1 -1
- package/dist/ui/container.d.ts +1 -0
- package/dist/ui/container.d.ts.map +1 -1
- package/dist/ui/container.js +6 -2
- package/dist/ui/container.js.map +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/drawer.d.ts +308 -117
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +254 -114
- package/dist/ui/drawer.js.map +1 -1
- package/dist/ui/popover.js +1 -1
- package/dist/ui/popover.js.map +1 -1
- package/dist/ui/preview-card.js +1 -1
- package/dist/ui/preview-card.js.map +1 -1
- package/dist/ui/select.d.ts +2 -2
- package/dist/ui/select.js +1 -1
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/sheet.js +1 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +10 -13
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/typography.d.ts +1 -1
- package/dist/ui/typography.d.ts.map +1 -1
- package/dist/ui/typography.js +20 -20
- package/dist/ui/typography.js.map +1 -1
- package/package.json +6 -6
- package/dist/dialog-Dzvma_bu.js.map +0 -1
- package/dist/sheet-FVsgl5Wk.js.map +0 -1
package/dist/ui/drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","names":[],"sources":["../../src/ui/drawer/drawer-
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","names":[],"sources":["../../src/ui/drawer/drawer-backdrop.tsx","../../src/ui/drawer/drawer-content.tsx","../../src/ui/drawer/drawer-popup.tsx","../../src/ui/drawer/drawer-portal.tsx","../../src/ui/drawer/drawer-size-context.ts","../../src/ui/drawer/drawer-trigger.tsx","../../src/ui/drawer/drawer-viewport.tsx","../../src/ui/drawer/drawer-action-sheet.tsx","../../src/ui/drawer/drawer-actions.tsx","../../src/ui/drawer/drawer-bottom-sheet.tsx","../../src/ui/drawer/drawer-close.tsx","../../src/ui/drawer/drawer-description.tsx","../../src/ui/drawer/drawer-indent.tsx","../../src/ui/drawer/drawer-indent-background.tsx","../../src/ui/drawer/drawer-indent-shell.tsx","../../src/ui/drawer/drawer-handle.tsx","../../src/ui/drawer/drawer-header.tsx","../../src/ui/drawer/drawer-provider.tsx","../../src/ui/drawer/drawer-side-panel.tsx","../../src/ui/drawer/drawer-title.tsx","../../src/ui/drawer/drawer.tsx"],"mappings":";;;;;;;;;KAKY,mBAAA,GAAsB,aAAA,CAAgB,QAAA,CAAS,KAAA;AAAA,cAErD,cAAA;EAAkB,SAAA;EAAA,GAAA;AAAA,GAAyB,mBAAA,KAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;cCE9D,qBAAA,EAcJ,kBAAA,CAdyB,YAAA;;;;;;;;;;;;;;;;cAczB,kBAAA,CAAA,YAAA;;;;;;;;;KAEG,yBAAA,GAA4B,IAAA,CAC/B,YAAA,QAAoB,qBAAA;EAGpB,IAAA,GAAO,MAAA;AAAA;AAAA,KAGG,kBAAA,GAAqB,aAAA,CAAgB,OAAA,CAAQ,KAAA,GACvD,yBAAA;AAAA,cAEI,aAAA;EAAiB,SAAA;EAAA,IAAA;EAAA,GAAA;AAAA,GAA+B,kBAAA,KAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;coBqClB,UAAA;EAAA;IAXW,IAAA,EAAA,YAAA;IAAA,GAAA;EAAA,GAAqC,eAAA,CAAgB,CAAA,IAAE,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmClE,kBAAA,SAAkB,aAAA,CAAA,YAAA"}
|
package/dist/ui/drawer.js
CHANGED
|
@@ -3,13 +3,147 @@
|
|
|
3
3
|
import { a as useComponentSize } from "../size-provider-18EvJgDT.js";
|
|
4
4
|
import { t as createSizeContext } from "../size-context-CvLl3pMC.js";
|
|
5
5
|
import { useMemo } from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { cn, tv } from "tailwind-variants";
|
|
8
8
|
import { DrawerPreview } from "@base-ui/react/drawer";
|
|
9
9
|
|
|
10
|
+
//#region src/ui/drawer/drawer-backdrop.tsx
|
|
11
|
+
const DrawerBackdrop = ({ className, ...props }) => /* @__PURE__ */ jsx(DrawerPreview.Backdrop, {
|
|
12
|
+
className: cn("z-overlay bg-foreground dark:bg-background fixed inset-0 min-h-dvh opacity-[calc(var(--backdrop-opacity)*(1-var(--drawer-swipe-progress)))] transition-opacity duration-[450ms] ease-[cubic-bezier(0.32,0.72,0,1)] [--backdrop-opacity:var(--kb-drawer-backdrop-opacity,0.2)] [--bleed:var(--kb-drawer-bleed,3rem)] data-[ending-style]:opacity-0 data-[ending-style]:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-[starting-style]:opacity-0 data-[swiping]:duration-0 supports-[-webkit-touch-callout:none]:absolute dark:[--backdrop-opacity:var(--kb-drawer-backdrop-opacity-dark,0.7)]", className),
|
|
13
|
+
"data-slot": "drawer-backdrop",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
10
18
|
//#region src/ui/drawer/drawer-size-context.ts
|
|
11
19
|
const { SizeContext: DrawerSizeContext, useResolvedSize: useResolvedDrawerSize } = createSizeContext();
|
|
12
20
|
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/ui/drawer/drawer-content.tsx
|
|
23
|
+
const drawerContentVariants = tv({
|
|
24
|
+
base: "mx-auto w-full",
|
|
25
|
+
defaultVariants: { size: "md" },
|
|
26
|
+
variants: { size: {
|
|
27
|
+
lg: "max-w-[var(--kb-drawer-content-max-width-lg,36rem)]",
|
|
28
|
+
md: "max-w-[var(--kb-drawer-content-max-width-md,32rem)]",
|
|
29
|
+
sm: "max-w-[var(--kb-drawer-content-max-width-sm,28rem)]",
|
|
30
|
+
xl: "max-w-[var(--kb-drawer-content-max-width-xl,40rem)]",
|
|
31
|
+
xs: "max-w-[var(--kb-drawer-content-max-width-xs,24rem)]"
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
34
|
+
const DrawerContent = ({ className, size, ...props }) => {
|
|
35
|
+
const resolvedSize = useResolvedDrawerSize(size);
|
|
36
|
+
return /* @__PURE__ */ jsx(DrawerPreview.Content, {
|
|
37
|
+
className: cn(drawerContentVariants({ size: resolvedSize }), className),
|
|
38
|
+
"data-size": resolvedSize,
|
|
39
|
+
"data-slot": "drawer-content",
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/ui/drawer/drawer-popup.tsx
|
|
46
|
+
const drawerPopupSizeVariants = tv({
|
|
47
|
+
defaultVariants: { size: "md" },
|
|
48
|
+
variants: { size: {
|
|
49
|
+
lg: "text-sm data-[swipe-direction=down]:px-7 data-[swipe-direction=down]:pt-5 data-[swipe-direction=down]:pb-[calc(1.75rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(var(--kb-drawer-side-width-lg,22rem)+var(--bleed))] data-[swipe-direction=left]:p-7 data-[swipe-direction=left]:pl-[calc(1.75rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(var(--kb-drawer-side-width-lg,22rem)+var(--bleed))] data-[swipe-direction=right]:p-7 data-[swipe-direction=right]:pr-[calc(1.75rem+var(--bleed))] data-[swipe-direction=up]:px-7 data-[swipe-direction=up]:pt-[calc(1.75rem+var(--bleed))] data-[swipe-direction=up]:pb-5",
|
|
50
|
+
md: "text-sm",
|
|
51
|
+
sm: "text-sm data-[swipe-direction=down]:px-5 data-[swipe-direction=down]:pt-3.5 data-[swipe-direction=down]:pb-[calc(1.25rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(var(--kb-drawer-side-width-sm,19rem)+var(--bleed))] data-[swipe-direction=left]:p-5 data-[swipe-direction=left]:pl-[calc(1.25rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(var(--kb-drawer-side-width-sm,19rem)+var(--bleed))] data-[swipe-direction=right]:p-5 data-[swipe-direction=right]:pr-[calc(1.25rem+var(--bleed))] data-[swipe-direction=up]:px-5 data-[swipe-direction=up]:pt-[calc(1.25rem+var(--bleed))] data-[swipe-direction=up]:pb-3.5",
|
|
52
|
+
xl: "text-base data-[swipe-direction=down]:px-8 data-[swipe-direction=down]:pt-6 data-[swipe-direction=down]:pb-[calc(2rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(var(--kb-drawer-side-width-xl,24rem)+var(--bleed))] data-[swipe-direction=left]:p-8 data-[swipe-direction=left]:pl-[calc(2rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(var(--kb-drawer-side-width-xl,24rem)+var(--bleed))] data-[swipe-direction=right]:p-8 data-[swipe-direction=right]:pr-[calc(2rem+var(--bleed))] data-[swipe-direction=up]:px-8 data-[swipe-direction=up]:pt-[calc(2rem+var(--bleed))] data-[swipe-direction=up]:pb-6",
|
|
53
|
+
xs: "text-xs data-[swipe-direction=down]:px-4 data-[swipe-direction=down]:pt-3 data-[swipe-direction=down]:pb-[calc(1rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(var(--kb-drawer-side-width-xs,18rem)+var(--bleed))] data-[swipe-direction=left]:p-4 data-[swipe-direction=left]:pl-[calc(1rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(var(--kb-drawer-side-width-xs,18rem)+var(--bleed))] data-[swipe-direction=right]:p-4 data-[swipe-direction=right]:pr-[calc(1rem+var(--bleed))] data-[swipe-direction=up]:px-4 data-[swipe-direction=up]:pt-[calc(1rem+var(--bleed))] data-[swipe-direction=up]:pb-3"
|
|
54
|
+
} }
|
|
55
|
+
});
|
|
56
|
+
const DrawerPopup = ({ className, size, ...props }) => {
|
|
57
|
+
const resolvedSize = useResolvedDrawerSize(size);
|
|
58
|
+
return /* @__PURE__ */ jsx(DrawerPreview.Popup, {
|
|
59
|
+
className: cn("bg-card text-card-foreground outline-border data-nested-drawer-open:after:bg-foreground/5 relative box-border flex touch-auto flex-col overflow-y-auto overscroll-contain outline transition-[transform,height,box-shadow,padding-bottom] duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] [--bleed:var(--kb-drawer-bleed,3rem)] [--peek:var(--kb-drawer-peek,1rem)] [--stack-height:max(0px,calc(var(--drawer-frontmost-height,var(--drawer-height))-var(--bleed)))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:calc(max(0,1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:var(--kb-drawer-stack-step,0.05)] [--viewport-padding:0px] [transition:transform_450ms_cubic-bezier(0.32,0.72,0,1),height_450ms_cubic-bezier(0.32,0.72,0,1),box-shadow_450ms_cubic-bezier(0.32,0.72,0,1),padding-bottom_450ms_cubic-bezier(0.32,0.72,0,1)] after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:bg-transparent after:transition-[background-color] after:duration-450 after:ease-[cubic-bezier(0.32,0.72,0,1)] after:content-[''] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-expanded:shadow-none data-nested-drawer-open:h-[calc(var(--stack-height)+var(--bleed))] data-nested-drawer-open:overflow-hidden data-nested-drawer-swiping:duration-0 data-swiping:duration-0 data-swiping:select-none data-[swipe-direction=down]:-mb-(--bleed) data-[swipe-direction=down]:h-(--drawer-height,auto) data-[swipe-direction=down]:max-h-[calc(var(--kb-drawer-max-height,80vh)+var(--bleed))] data-[swipe-direction=down]:w-full data-[swipe-direction=down]:origin-[50%_calc(100%-var(--bleed))] data-[swipe-direction=down]:transform-[translateY(calc(var(--drawer-snap-point-offset)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] data-[swipe-direction=down]:rounded-t-2xl data-[swipe-direction=down]:px-6 data-[swipe-direction=down]:pt-4 data-[swipe-direction=down]:pb-[calc(1.5rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=down]:data-ending-style:transform-[translateY(calc(100%-var(--bleed)))] data-[swipe-direction=down]:data-starting-style:transform-[translateY(calc(100%-var(--bleed)))] data-[swipe-direction=down]:data-[nested-drawer-open]:!h-[calc(var(--stack-height)+var(--bleed))] data-[swipe-direction=down]:data-[nested-drawer-open]:transform-[translateY(calc(var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] data-[swipe-direction=left]:mr-auto data-[swipe-direction=left]:-ml-(--bleed) data-[swipe-direction=left]:h-full data-[swipe-direction=left]:w-[calc(var(--kb-drawer-side-width-md,20rem)+var(--bleed))] data-[swipe-direction=left]:max-w-[calc(100vw-3rem+var(--bleed))] data-[swipe-direction=left]:transform-[translateX(var(--drawer-swipe-movement-x))] data-[swipe-direction=left]:p-6 data-[swipe-direction=left]:pl-[calc(1.5rem+var(--bleed))] data-[swipe-direction=left]:data-ending-style:transform-[translateX(calc(-100%+var(--bleed)-var(--viewport-padding)))] data-[swipe-direction=left]:data-starting-style:transform-[translateX(calc(-100%+var(--bleed)-var(--viewport-padding)))] data-[swipe-direction=right]:-mr-(--bleed) data-[swipe-direction=right]:ml-auto data-[swipe-direction=right]:h-full data-[swipe-direction=right]:w-[calc(var(--kb-drawer-side-width-md,20rem)+var(--bleed))] data-[swipe-direction=right]:max-w-[calc(100vw-3rem+var(--bleed))] data-[swipe-direction=right]:transform-[translateX(var(--drawer-swipe-movement-x))] data-[swipe-direction=right]:p-6 data-[swipe-direction=right]:pr-[calc(1.5rem+var(--bleed))] data-[swipe-direction=right]:data-ending-style:transform-[translateX(calc(100%-var(--bleed)+var(--viewport-padding)))] data-[swipe-direction=right]:data-starting-style:transform-[translateX(calc(100%-var(--bleed)+var(--viewport-padding)))] data-[swipe-direction=up]:-mt-(--bleed) data-[swipe-direction=up]:h-(--drawer-height,auto) data-[swipe-direction=up]:max-h-[calc(var(--kb-drawer-max-height,80vh)+var(--bleed))] data-[swipe-direction=up]:w-full data-[swipe-direction=up]:origin-[50%_var(--bleed)] data-[swipe-direction=up]:transform-[translateY(calc(var(--drawer-snap-point-offset)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] data-[swipe-direction=up]:self-start data-[swipe-direction=up]:rounded-b-2xl data-[swipe-direction=up]:px-6 data-[swipe-direction=up]:pt-[calc(1.5rem+var(--bleed))] data-[swipe-direction=up]:pb-4 data-[swipe-direction=up]:data-ending-style:transform-[translateY(calc(-100%+var(--bleed)))] data-[swipe-direction=up]:data-starting-style:transform-[translateY(calc(-100%+var(--bleed)))] data-[swipe-direction=up]:data-[nested-drawer-open]:!h-[calc(var(--stack-height)+var(--bleed))] data-[swipe-direction=up]:data-[nested-drawer-open]:transform-[translateY(calc(var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:ml-0 supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:w-[var(--kb-drawer-side-width-md,20rem)] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:max-w-[calc(100vw-20px)] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:rounded-[10px] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:pl-6 supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:[--bleed:0px] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:mr-0 supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:w-[var(--kb-drawer-side-width-md,20rem)] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:max-w-[calc(100vw-20px)] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:rounded-[10px] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:pr-6 supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:[--bleed:0px]", drawerPopupSizeVariants({ size: resolvedSize }), className),
|
|
60
|
+
"data-size": resolvedSize,
|
|
61
|
+
"data-slot": "drawer-popup",
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/ui/drawer/drawer-portal.tsx
|
|
68
|
+
const DrawerPortal = ({ ...props }) => /* @__PURE__ */ jsx(DrawerPreview.Portal, {
|
|
69
|
+
"data-slot": "drawer-portal",
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/ui/drawer/drawer-trigger.tsx
|
|
75
|
+
const drawerTriggerVariants = tv({
|
|
76
|
+
base: "cursor-clickable border-border bg-background text-foreground hover:bg-muted focus-visible:outline-ring active:bg-muted inline-flex items-center justify-center border font-medium transition-colors select-none focus-visible:outline focus-visible:-outline-offset-1 disabled:pointer-events-none disabled:opacity-50",
|
|
77
|
+
defaultVariants: { size: "md" },
|
|
78
|
+
variants: { size: {
|
|
79
|
+
lg: "h-11 rounded-md px-4 text-base md:text-sm",
|
|
80
|
+
md: "h-10 rounded-md px-3.5 text-base md:text-sm",
|
|
81
|
+
sm: "h-9 rounded-[min(var(--radius-md),10px)] px-3 text-sm",
|
|
82
|
+
xl: "h-12 rounded-md px-4.5 text-base",
|
|
83
|
+
xs: "h-8 rounded-[min(var(--radius-md),8px)] px-2 text-xs"
|
|
84
|
+
} }
|
|
85
|
+
});
|
|
86
|
+
const DrawerTrigger = ({ className, size, ...props }) => {
|
|
87
|
+
const resolvedSize = useResolvedDrawerSize(size);
|
|
88
|
+
return /* @__PURE__ */ jsx(DrawerPreview.Trigger, {
|
|
89
|
+
className: cn(drawerTriggerVariants({ size: resolvedSize }), className),
|
|
90
|
+
"data-size": resolvedSize,
|
|
91
|
+
"data-slot": "drawer-trigger",
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/ui/drawer/drawer-viewport.tsx
|
|
98
|
+
const DrawerViewport = ({ className, ...props }) => /* @__PURE__ */ jsx(DrawerPreview.Viewport, {
|
|
99
|
+
className: cn("z-overlay fixed inset-0 flex items-end justify-center p-(--viewport-padding) [--viewport-padding:0px] data-[swipe-direction=left]:items-stretch data-[swipe-direction=left]:justify-start data-[swipe-direction=right]:items-stretch data-[swipe-direction=right]:justify-end data-[swipe-direction=up]:items-start supports-[-webkit-touch-callout:none]:[--viewport-padding:0.625rem]", className),
|
|
100
|
+
"data-slot": "drawer-viewport",
|
|
101
|
+
...props
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/ui/drawer/drawer-action-sheet.tsx
|
|
106
|
+
const DrawerActionSheet = ({ backdropProps, children, contentProps, destructiveAction, popupProps, portalProps, size: providedSize, trigger, triggerProps, viewportProps, ...rootProps }) => {
|
|
107
|
+
const size = useComponentSize(providedSize);
|
|
108
|
+
const contextValue = useMemo(() => ({ size }), [size]);
|
|
109
|
+
const { className: backdropClassName, ...resolvedBackdropProps } = backdropProps ?? {};
|
|
110
|
+
const { className: contentClassName, ...resolvedContentProps } = contentProps ?? {};
|
|
111
|
+
const { className: popupClassName, ...resolvedPopupProps } = popupProps ?? {};
|
|
112
|
+
const { className: viewportClassName, ...resolvedViewportProps } = viewportProps ?? {};
|
|
113
|
+
return /* @__PURE__ */ jsx(DrawerSizeContext.Provider, {
|
|
114
|
+
value: contextValue,
|
|
115
|
+
children: /* @__PURE__ */ jsxs(DrawerPreview.Root, {
|
|
116
|
+
swipeDirection: "down",
|
|
117
|
+
...rootProps,
|
|
118
|
+
children: [trigger ? /* @__PURE__ */ jsx(DrawerTrigger, {
|
|
119
|
+
...triggerProps,
|
|
120
|
+
children: trigger
|
|
121
|
+
}) : null, /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
122
|
+
...portalProps,
|
|
123
|
+
children: [/* @__PURE__ */ jsx(DrawerBackdrop, {
|
|
124
|
+
className: cn("[--backdrop-opacity:0.4]", backdropClassName),
|
|
125
|
+
...resolvedBackdropProps
|
|
126
|
+
}), /* @__PURE__ */ jsx(DrawerViewport, {
|
|
127
|
+
className: cn("fixed inset-0 flex items-end justify-center", viewportClassName),
|
|
128
|
+
...resolvedViewportProps,
|
|
129
|
+
children: /* @__PURE__ */ jsxs(DrawerPopup, {
|
|
130
|
+
className: cn("pointer-events-none box-border flex w-full max-w-[var(--kb-drawer-action-sheet-max-width,28rem)] [transform:translateY(var(--drawer-swipe-movement-y))] flex-col gap-3 px-4 pb-[calc(1rem+env(safe-area-inset-bottom,0px))] transition-transform duration-[450ms] ease-[cubic-bezier(0.32,0.72,0,1)] outline-none focus-visible:outline-none data-[ending-style]:[transform:translateY(calc(100%+1rem))] data-[ending-style]:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-[starting-style]:[transform:translateY(calc(100%+1rem))] data-[swiping]:select-none", popupClassName),
|
|
131
|
+
...resolvedPopupProps,
|
|
132
|
+
children: [/* @__PURE__ */ jsx(DrawerContent, {
|
|
133
|
+
className: cn("bg-card text-card-foreground outline-border pointer-events-auto overflow-hidden rounded-2xl outline-1", contentClassName),
|
|
134
|
+
...resolvedContentProps,
|
|
135
|
+
children
|
|
136
|
+
}), destructiveAction ? /* @__PURE__ */ jsx("div", {
|
|
137
|
+
className: "bg-card text-card-foreground outline-border pointer-events-auto overflow-hidden rounded-2xl outline-1",
|
|
138
|
+
children: destructiveAction
|
|
139
|
+
}) : null]
|
|
140
|
+
})
|
|
141
|
+
})]
|
|
142
|
+
})]
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
13
147
|
//#endregion
|
|
14
148
|
//#region src/ui/drawer/drawer-actions.tsx
|
|
15
149
|
const drawerActionsVariants = tv({
|
|
@@ -34,12 +168,68 @@ const DrawerActions = ({ className, size, ...props }) => {
|
|
|
34
168
|
};
|
|
35
169
|
|
|
36
170
|
//#endregion
|
|
37
|
-
//#region src/ui/drawer/drawer-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
171
|
+
//#region src/ui/drawer/drawer-handle.tsx
|
|
172
|
+
const drawerHandleVariants = tv({
|
|
173
|
+
base: "bg-muted-foreground/40 mx-auto h-1 shrink-0 rounded-full",
|
|
174
|
+
defaultVariants: { size: "md" },
|
|
175
|
+
variants: { size: {
|
|
176
|
+
lg: "mb-4 w-14",
|
|
177
|
+
md: "mb-4 w-12",
|
|
178
|
+
sm: "mb-3.5 w-11",
|
|
179
|
+
xl: "mb-5 w-16",
|
|
180
|
+
xs: "mb-3 w-10"
|
|
181
|
+
} }
|
|
42
182
|
});
|
|
183
|
+
const DrawerHandle = ({ className, size, ...props }) => {
|
|
184
|
+
const resolvedSize = useResolvedDrawerSize(size);
|
|
185
|
+
return /* @__PURE__ */ jsx("div", {
|
|
186
|
+
"aria-hidden": true,
|
|
187
|
+
className: cn(drawerHandleVariants({ size: resolvedSize }), className),
|
|
188
|
+
"data-size": resolvedSize,
|
|
189
|
+
"data-slot": "drawer-handle",
|
|
190
|
+
...props
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/ui/drawer/drawer-bottom-sheet.tsx
|
|
196
|
+
const DrawerBottomSheet = ({ backdropProps, children, contentProps, popupProps, portalProps, showHandle = true, size: providedSize, trigger, triggerProps, viewportProps, ...rootProps }) => {
|
|
197
|
+
const size = useComponentSize(providedSize);
|
|
198
|
+
const contextValue = useMemo(() => ({ size }), [size]);
|
|
199
|
+
const { className: backdropClassName, ...resolvedBackdropProps } = backdropProps ?? {};
|
|
200
|
+
const { className: contentClassName, ...resolvedContentProps } = contentProps ?? {};
|
|
201
|
+
const { className: popupClassName, ...resolvedPopupProps } = popupProps ?? {};
|
|
202
|
+
const { className: viewportClassName, ...resolvedViewportProps } = viewportProps ?? {};
|
|
203
|
+
return /* @__PURE__ */ jsx(DrawerSizeContext.Provider, {
|
|
204
|
+
value: contextValue,
|
|
205
|
+
children: /* @__PURE__ */ jsxs(DrawerPreview.Root, {
|
|
206
|
+
swipeDirection: "down",
|
|
207
|
+
...rootProps,
|
|
208
|
+
children: [trigger ? /* @__PURE__ */ jsx(DrawerTrigger, {
|
|
209
|
+
...triggerProps,
|
|
210
|
+
children: trigger
|
|
211
|
+
}) : null, /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
212
|
+
...portalProps,
|
|
213
|
+
children: [/* @__PURE__ */ jsx(DrawerBackdrop, {
|
|
214
|
+
className: backdropClassName,
|
|
215
|
+
...resolvedBackdropProps
|
|
216
|
+
}), /* @__PURE__ */ jsx(DrawerViewport, {
|
|
217
|
+
className: cn("fixed inset-0 flex items-end justify-center", viewportClassName),
|
|
218
|
+
...resolvedViewportProps,
|
|
219
|
+
children: /* @__PURE__ */ jsxs(DrawerPopup, {
|
|
220
|
+
className: popupClassName,
|
|
221
|
+
...resolvedPopupProps,
|
|
222
|
+
children: [showHandle ? /* @__PURE__ */ jsx(DrawerHandle, {}) : null, /* @__PURE__ */ jsx(DrawerContent, {
|
|
223
|
+
className: contentClassName,
|
|
224
|
+
...resolvedContentProps,
|
|
225
|
+
children
|
|
226
|
+
})]
|
|
227
|
+
})
|
|
228
|
+
})]
|
|
229
|
+
})]
|
|
230
|
+
})
|
|
231
|
+
});
|
|
232
|
+
};
|
|
43
233
|
|
|
44
234
|
//#endregion
|
|
45
235
|
//#region src/ui/drawer/drawer-close.tsx
|
|
@@ -54,35 +244,14 @@ const drawerCloseVariants = tv({
|
|
|
54
244
|
xs: "size-6 text-sm"
|
|
55
245
|
} }
|
|
56
246
|
});
|
|
57
|
-
const DrawerClose = ({ className, size, ...props }) => {
|
|
247
|
+
const DrawerClose = ({ className, render, size, ...props }) => {
|
|
58
248
|
const resolvedSize = useResolvedDrawerSize(size);
|
|
249
|
+
const hasCustomRender = render !== void 0;
|
|
59
250
|
return /* @__PURE__ */ jsx(DrawerPreview.Close, {
|
|
60
|
-
className: cn(drawerCloseVariants({ size: resolvedSize }), className),
|
|
251
|
+
className: cn(hasCustomRender ? void 0 : drawerCloseVariants({ size: resolvedSize }), className),
|
|
61
252
|
"data-size": resolvedSize,
|
|
62
253
|
"data-slot": "drawer-close",
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/ui/drawer/drawer-content.tsx
|
|
69
|
-
const drawerContentVariants = tv({
|
|
70
|
-
base: "mx-auto w-full",
|
|
71
|
-
defaultVariants: { size: "md" },
|
|
72
|
-
variants: { size: {
|
|
73
|
-
lg: "max-w-[36rem]",
|
|
74
|
-
md: "max-w-[32rem]",
|
|
75
|
-
sm: "max-w-[28rem]",
|
|
76
|
-
xl: "max-w-[40rem]",
|
|
77
|
-
xs: "max-w-[24rem]"
|
|
78
|
-
} }
|
|
79
|
-
});
|
|
80
|
-
const DrawerContent = ({ className, size, ...props }) => {
|
|
81
|
-
const resolvedSize = useResolvedDrawerSize(size);
|
|
82
|
-
return /* @__PURE__ */ jsx(DrawerPreview.Content, {
|
|
83
|
-
className: cn(drawerContentVariants({ size: resolvedSize }), className),
|
|
84
|
-
"data-size": resolvedSize,
|
|
85
|
-
"data-slot": "drawer-content",
|
|
254
|
+
render,
|
|
86
255
|
...props
|
|
87
256
|
});
|
|
88
257
|
};
|
|
@@ -110,30 +279,6 @@ const DrawerDescription = ({ className, size, ...props }) => {
|
|
|
110
279
|
});
|
|
111
280
|
};
|
|
112
281
|
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/ui/drawer/drawer-handle.tsx
|
|
115
|
-
const drawerHandleVariants = tv({
|
|
116
|
-
base: "bg-muted-foreground/40 mx-auto h-1 shrink-0 rounded-full",
|
|
117
|
-
defaultVariants: { size: "md" },
|
|
118
|
-
variants: { size: {
|
|
119
|
-
lg: "mb-4 w-14",
|
|
120
|
-
md: "mb-4 w-12",
|
|
121
|
-
sm: "mb-3.5 w-11",
|
|
122
|
-
xl: "mb-5 w-16",
|
|
123
|
-
xs: "mb-3 w-10"
|
|
124
|
-
} }
|
|
125
|
-
});
|
|
126
|
-
const DrawerHandle = ({ className, size, ...props }) => {
|
|
127
|
-
const resolvedSize = useResolvedDrawerSize(size);
|
|
128
|
-
return /* @__PURE__ */ jsx("div", {
|
|
129
|
-
"aria-hidden": true,
|
|
130
|
-
className: cn(drawerHandleVariants({ size: resolvedSize }), className),
|
|
131
|
-
"data-size": resolvedSize,
|
|
132
|
-
"data-slot": "drawer-handle",
|
|
133
|
-
...props
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
282
|
//#endregion
|
|
138
283
|
//#region src/ui/drawer/drawer-header.tsx
|
|
139
284
|
const drawerHeaderVariants = tv({
|
|
@@ -174,37 +319,59 @@ const DrawerIndentBackground = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
|
174
319
|
});
|
|
175
320
|
|
|
176
321
|
//#endregion
|
|
177
|
-
//#region src/ui/drawer/drawer-
|
|
178
|
-
const
|
|
179
|
-
defaultVariants: { size: "md" },
|
|
180
|
-
variants: { size: {
|
|
181
|
-
lg: "text-sm data-[swipe-direction=down]:px-7 data-[swipe-direction=down]:pt-5 data-[swipe-direction=down]:pb-[calc(1.75rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(22rem+var(--bleed))] data-[swipe-direction=left]:p-7 data-[swipe-direction=left]:pl-[calc(1.75rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(22rem+var(--bleed))] data-[swipe-direction=right]:p-7 data-[swipe-direction=right]:pr-[calc(1.75rem+var(--bleed))] data-[swipe-direction=up]:px-7 data-[swipe-direction=up]:pt-[calc(1.75rem+var(--bleed))] data-[swipe-direction=up]:pb-5",
|
|
182
|
-
md: "text-sm",
|
|
183
|
-
sm: "text-sm data-[swipe-direction=down]:px-5 data-[swipe-direction=down]:pt-3.5 data-[swipe-direction=down]:pb-[calc(1.25rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(19rem+var(--bleed))] data-[swipe-direction=left]:p-5 data-[swipe-direction=left]:pl-[calc(1.25rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(19rem+var(--bleed))] data-[swipe-direction=right]:p-5 data-[swipe-direction=right]:pr-[calc(1.25rem+var(--bleed))] data-[swipe-direction=up]:px-5 data-[swipe-direction=up]:pt-[calc(1.25rem+var(--bleed))] data-[swipe-direction=up]:pb-3.5",
|
|
184
|
-
xl: "text-base data-[swipe-direction=down]:px-8 data-[swipe-direction=down]:pt-6 data-[swipe-direction=down]:pb-[calc(2rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(24rem+var(--bleed))] data-[swipe-direction=left]:p-8 data-[swipe-direction=left]:pl-[calc(2rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(24rem+var(--bleed))] data-[swipe-direction=right]:p-8 data-[swipe-direction=right]:pr-[calc(2rem+var(--bleed))] data-[swipe-direction=up]:px-8 data-[swipe-direction=up]:pt-[calc(2rem+var(--bleed))] data-[swipe-direction=up]:pb-6",
|
|
185
|
-
xs: "text-xs data-[swipe-direction=down]:px-4 data-[swipe-direction=down]:pt-3 data-[swipe-direction=down]:pb-[calc(1rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=left]:w-[calc(18rem+var(--bleed))] data-[swipe-direction=left]:p-4 data-[swipe-direction=left]:pl-[calc(1rem+var(--bleed))] data-[swipe-direction=right]:w-[calc(18rem+var(--bleed))] data-[swipe-direction=right]:p-4 data-[swipe-direction=right]:pr-[calc(1rem+var(--bleed))] data-[swipe-direction=up]:px-4 data-[swipe-direction=up]:pt-[calc(1rem+var(--bleed))] data-[swipe-direction=up]:pb-3"
|
|
186
|
-
} }
|
|
187
|
-
});
|
|
188
|
-
const DrawerPopup = ({ className, size, ...props }) => {
|
|
189
|
-
const resolvedSize = useResolvedDrawerSize(size);
|
|
190
|
-
return /* @__PURE__ */ jsx(DrawerPreview.Popup, {
|
|
191
|
-
className: cn("bg-card text-card-foreground outline-border data-nested-drawer-open:after:bg-foreground/5 relative box-border flex touch-auto flex-col overflow-y-auto overscroll-contain outline transition-[transform,height,box-shadow,padding-bottom] duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] [--bleed:3rem] [--peek:1rem] [--stack-height:max(0px,calc(var(--drawer-frontmost-height,var(--drawer-height))-var(--bleed)))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:calc(max(0,1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05] [--viewport-padding:0px] [transition:transform_450ms_cubic-bezier(0.32,0.72,0,1),height_450ms_cubic-bezier(0.32,0.72,0,1),box-shadow_450ms_cubic-bezier(0.32,0.72,0,1),padding-bottom_450ms_cubic-bezier(0.32,0.72,0,1)] after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:bg-transparent after:transition-[background-color] after:duration-450 after:ease-[cubic-bezier(0.32,0.72,0,1)] after:content-[''] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-expanded:shadow-none data-nested-drawer-open:h-[calc(var(--stack-height)+var(--bleed))] data-nested-drawer-open:overflow-hidden data-nested-drawer-swiping:duration-0 data-swiping:duration-0 data-swiping:select-none data-[swipe-direction=down]:-mb-(--bleed) data-[swipe-direction=down]:h-(--drawer-height,auto) data-[swipe-direction=down]:max-h-[calc(80vh+var(--bleed))] data-[swipe-direction=down]:w-full data-[swipe-direction=down]:origin-[50%_calc(100%-var(--bleed))] data-[swipe-direction=down]:transform-[translateY(calc(var(--drawer-snap-point-offset)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] data-[swipe-direction=down]:rounded-t-2xl data-[swipe-direction=down]:px-6 data-[swipe-direction=down]:pt-4 data-[swipe-direction=down]:pb-[calc(1.5rem+env(safe-area-inset-bottom,0px)+var(--bleed))] data-[swipe-direction=down]:data-ending-style:transform-[translateY(calc(100%-var(--bleed)))] data-[swipe-direction=down]:data-starting-style:transform-[translateY(calc(100%-var(--bleed)))] data-[swipe-direction=down]:data-[nested-drawer-open]:!h-[calc(var(--stack-height)+var(--bleed))] data-[swipe-direction=down]:data-[nested-drawer-open]:transform-[translateY(calc(var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] data-[swipe-direction=left]:mr-auto data-[swipe-direction=left]:-ml-(--bleed) data-[swipe-direction=left]:h-full data-[swipe-direction=left]:w-[calc(20rem+var(--bleed))] data-[swipe-direction=left]:max-w-[calc(100vw-3rem+var(--bleed))] data-[swipe-direction=left]:transform-[translateX(var(--drawer-swipe-movement-x))] data-[swipe-direction=left]:p-6 data-[swipe-direction=left]:pl-[calc(1.5rem+var(--bleed))] data-[swipe-direction=left]:data-ending-style:transform-[translateX(calc(-100%+var(--bleed)-var(--viewport-padding)))] data-[swipe-direction=left]:data-starting-style:transform-[translateX(calc(-100%+var(--bleed)-var(--viewport-padding)))] data-[swipe-direction=right]:-mr-(--bleed) data-[swipe-direction=right]:ml-auto data-[swipe-direction=right]:h-full data-[swipe-direction=right]:w-[calc(20rem+var(--bleed))] data-[swipe-direction=right]:max-w-[calc(100vw-3rem+var(--bleed))] data-[swipe-direction=right]:transform-[translateX(var(--drawer-swipe-movement-x))] data-[swipe-direction=right]:p-6 data-[swipe-direction=right]:pr-[calc(1.5rem+var(--bleed))] data-[swipe-direction=right]:data-ending-style:transform-[translateX(calc(100%-var(--bleed)+var(--viewport-padding)))] data-[swipe-direction=right]:data-starting-style:transform-[translateX(calc(100%-var(--bleed)+var(--viewport-padding)))] data-[swipe-direction=up]:-mt-(--bleed) data-[swipe-direction=up]:h-(--drawer-height,auto) data-[swipe-direction=up]:max-h-[calc(80vh+var(--bleed))] data-[swipe-direction=up]:w-full data-[swipe-direction=up]:origin-[50%_var(--bleed)] data-[swipe-direction=up]:transform-[translateY(calc(var(--drawer-snap-point-offset)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] data-[swipe-direction=up]:self-start data-[swipe-direction=up]:rounded-b-2xl data-[swipe-direction=up]:px-6 data-[swipe-direction=up]:pt-[calc(1.5rem+var(--bleed))] data-[swipe-direction=up]:pb-4 data-[swipe-direction=up]:data-ending-style:transform-[translateY(calc(-100%+var(--bleed)))] data-[swipe-direction=up]:data-starting-style:transform-[translateY(calc(-100%+var(--bleed)))] data-[swipe-direction=up]:data-[nested-drawer-open]:!h-[calc(var(--stack-height)+var(--bleed))] data-[swipe-direction=up]:data-[nested-drawer-open]:transform-[translateY(calc(var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height))))_scale(var(--stack-scale))] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:ml-0 supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:w-[20rem] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:max-w-[calc(100vw-20px)] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:rounded-[10px] supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:pl-6 supports-[-webkit-touch-callout:none]:data-[swipe-direction=left]:[--bleed:0px] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:mr-0 supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:w-[20rem] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:max-w-[calc(100vw-20px)] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:rounded-[10px] supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:pr-6 supports-[-webkit-touch-callout:none]:data-[swipe-direction=right]:[--bleed:0px]", drawerPopupSizeVariants({ size: resolvedSize }), className),
|
|
192
|
-
"data-size": resolvedSize,
|
|
193
|
-
"data-slot": "drawer-popup",
|
|
194
|
-
...props
|
|
195
|
-
});
|
|
196
|
-
};
|
|
322
|
+
//#region src/ui/drawer/drawer-provider.tsx
|
|
323
|
+
const DrawerProvider = ({ ...props }) => /* @__PURE__ */ jsx(DrawerPreview.Provider, { ...props });
|
|
197
324
|
|
|
198
325
|
//#endregion
|
|
199
|
-
//#region src/ui/drawer/drawer-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
});
|
|
326
|
+
//#region src/ui/drawer/drawer-indent-shell.tsx
|
|
327
|
+
const DrawerIndentShell = ({ children, indentBackgroundProps, indentProps }) => /* @__PURE__ */ jsxs(DrawerProvider, { children: [/* @__PURE__ */ jsx(DrawerIndentBackground, { ...indentBackgroundProps }), /* @__PURE__ */ jsx(DrawerIndent, {
|
|
328
|
+
...indentProps,
|
|
329
|
+
children
|
|
330
|
+
})] });
|
|
204
331
|
|
|
205
332
|
//#endregion
|
|
206
|
-
//#region src/ui/drawer/drawer-
|
|
207
|
-
const
|
|
333
|
+
//#region src/ui/drawer/drawer-side-panel.tsx
|
|
334
|
+
const DRAWER_SWIPE_DIRECTION_BY_SIDE = {
|
|
335
|
+
left: "left",
|
|
336
|
+
right: "right"
|
|
337
|
+
};
|
|
338
|
+
const DrawerSidePanel = ({ backdropProps, children, contentProps, popupProps, portalProps, side = "right", size: providedSize, trigger, triggerProps, viewportProps, ...rootProps }) => {
|
|
339
|
+
const size = useComponentSize(providedSize);
|
|
340
|
+
const contextValue = useMemo(() => ({ size }), [size]);
|
|
341
|
+
const { className: backdropClassName, ...resolvedBackdropProps } = backdropProps ?? {};
|
|
342
|
+
const { className: contentClassName, ...resolvedContentProps } = contentProps ?? {};
|
|
343
|
+
const { className: popupClassName, ...resolvedPopupProps } = popupProps ?? {};
|
|
344
|
+
const { className: viewportClassName, ...resolvedViewportProps } = viewportProps ?? {};
|
|
345
|
+
return /* @__PURE__ */ jsx(DrawerSizeContext.Provider, {
|
|
346
|
+
value: contextValue,
|
|
347
|
+
children: /* @__PURE__ */ jsxs(DrawerPreview.Root, {
|
|
348
|
+
swipeDirection: DRAWER_SWIPE_DIRECTION_BY_SIDE[side],
|
|
349
|
+
...rootProps,
|
|
350
|
+
children: [trigger ? /* @__PURE__ */ jsx(DrawerTrigger, {
|
|
351
|
+
...triggerProps,
|
|
352
|
+
children: trigger
|
|
353
|
+
}) : null, /* @__PURE__ */ jsxs(DrawerPortal, {
|
|
354
|
+
...portalProps,
|
|
355
|
+
children: [/* @__PURE__ */ jsx(DrawerBackdrop, {
|
|
356
|
+
className: backdropClassName,
|
|
357
|
+
...resolvedBackdropProps
|
|
358
|
+
}), /* @__PURE__ */ jsx(DrawerViewport, {
|
|
359
|
+
className: cn("fixed inset-0", viewportClassName),
|
|
360
|
+
...resolvedViewportProps,
|
|
361
|
+
children: /* @__PURE__ */ jsx(DrawerPopup, {
|
|
362
|
+
className: popupClassName,
|
|
363
|
+
...resolvedPopupProps,
|
|
364
|
+
children: /* @__PURE__ */ jsx(DrawerContent, {
|
|
365
|
+
className: contentClassName,
|
|
366
|
+
...resolvedContentProps,
|
|
367
|
+
children
|
|
368
|
+
})
|
|
369
|
+
})
|
|
370
|
+
})]
|
|
371
|
+
})]
|
|
372
|
+
})
|
|
373
|
+
});
|
|
374
|
+
};
|
|
208
375
|
|
|
209
376
|
//#endregion
|
|
210
377
|
//#region src/ui/drawer/drawer-title.tsx
|
|
@@ -229,37 +396,6 @@ const DrawerTitle = ({ className, size, ...props }) => {
|
|
|
229
396
|
});
|
|
230
397
|
};
|
|
231
398
|
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/ui/drawer/drawer-trigger.tsx
|
|
234
|
-
const drawerTriggerVariants = tv({
|
|
235
|
-
base: "cursor-clickable border-border bg-background text-foreground hover:bg-muted focus-visible:outline-ring active:bg-muted inline-flex items-center justify-center border font-medium transition-colors select-none focus-visible:outline focus-visible:-outline-offset-1 disabled:pointer-events-none disabled:opacity-50",
|
|
236
|
-
defaultVariants: { size: "md" },
|
|
237
|
-
variants: { size: {
|
|
238
|
-
lg: "h-11 rounded-md px-4 text-base md:text-sm",
|
|
239
|
-
md: "h-10 rounded-md px-3.5 text-base md:text-sm",
|
|
240
|
-
sm: "h-9 rounded-[min(var(--radius-md),10px)] px-3 text-sm",
|
|
241
|
-
xl: "h-12 rounded-md px-4.5 text-base",
|
|
242
|
-
xs: "h-8 rounded-[min(var(--radius-md),8px)] px-2 text-xs"
|
|
243
|
-
} }
|
|
244
|
-
});
|
|
245
|
-
const DrawerTrigger = ({ className, size, ...props }) => {
|
|
246
|
-
const resolvedSize = useResolvedDrawerSize(size);
|
|
247
|
-
return /* @__PURE__ */ jsx(DrawerPreview.Trigger, {
|
|
248
|
-
className: cn(drawerTriggerVariants({ size: resolvedSize }), className),
|
|
249
|
-
"data-size": resolvedSize,
|
|
250
|
-
"data-slot": "drawer-trigger",
|
|
251
|
-
...props
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region src/ui/drawer/drawer-viewport.tsx
|
|
257
|
-
const DrawerViewport = ({ className, ...props }) => /* @__PURE__ */ jsx(DrawerPreview.Viewport, {
|
|
258
|
-
className: cn("z-overlay fixed inset-0 flex items-end justify-center p-(--viewport-padding) [--viewport-padding:0px] data-[swipe-direction=left]:items-stretch data-[swipe-direction=left]:justify-start data-[swipe-direction=right]:items-stretch data-[swipe-direction=right]:justify-end data-[swipe-direction=up]:items-start supports-[-webkit-touch-callout:none]:[--viewport-padding:0.625rem]", className),
|
|
259
|
-
"data-slot": "drawer-viewport",
|
|
260
|
-
...props
|
|
261
|
-
});
|
|
262
|
-
|
|
263
399
|
//#endregion
|
|
264
400
|
//#region src/ui/drawer/drawer.tsx
|
|
265
401
|
const Drawer = ({ size: providedSize, ...props }) => {
|
|
@@ -272,18 +408,22 @@ const Drawer = ({ size: providedSize, ...props }) => {
|
|
|
272
408
|
};
|
|
273
409
|
const DrawerRoot = Drawer;
|
|
274
410
|
Drawer.Root = DrawerRoot;
|
|
411
|
+
Drawer.ActionSheet = DrawerActionSheet;
|
|
275
412
|
Drawer.Actions = DrawerActions;
|
|
276
413
|
Drawer.Backdrop = DrawerBackdrop;
|
|
414
|
+
Drawer.BottomSheet = DrawerBottomSheet;
|
|
277
415
|
Drawer.Close = DrawerClose;
|
|
278
416
|
Drawer.Content = DrawerContent;
|
|
279
417
|
Drawer.Description = DrawerDescription;
|
|
280
418
|
Drawer.Indent = DrawerIndent;
|
|
281
419
|
Drawer.IndentBackground = DrawerIndentBackground;
|
|
420
|
+
Drawer.IndentShell = DrawerIndentShell;
|
|
282
421
|
Drawer.Handle = DrawerHandle;
|
|
283
422
|
Drawer.Header = DrawerHeader;
|
|
284
423
|
Drawer.Popup = DrawerPopup;
|
|
285
424
|
Drawer.Portal = DrawerPortal;
|
|
286
425
|
Drawer.Provider = DrawerProvider;
|
|
426
|
+
Drawer.SidePanel = DrawerSidePanel;
|
|
287
427
|
Drawer.Title = DrawerTitle;
|
|
288
428
|
Drawer.Trigger = DrawerTrigger;
|
|
289
429
|
Drawer.Viewport = DrawerViewport;
|
|
@@ -291,5 +431,5 @@ Drawer.createHandle = DrawerPreview.createHandle;
|
|
|
291
431
|
const createDrawerHandle = DrawerPreview.createHandle;
|
|
292
432
|
|
|
293
433
|
//#endregion
|
|
294
|
-
export { Drawer, DrawerActions, DrawerBackdrop, DrawerClose, DrawerContent, DrawerDescription, DrawerHandle, DrawerHeader, DrawerIndent, DrawerIndentBackground, DrawerPopup, DrawerPortal, DrawerProvider, DrawerRoot, DrawerTitle, DrawerTrigger, DrawerViewport, createDrawerHandle };
|
|
434
|
+
export { Drawer, DrawerActionSheet, DrawerActions, DrawerBackdrop, DrawerBottomSheet, DrawerClose, DrawerContent, DrawerDescription, DrawerHandle, DrawerHeader, DrawerIndent, DrawerIndentBackground, DrawerIndentShell, DrawerPopup, DrawerPortal, DrawerProvider, DrawerRoot, DrawerSidePanel, DrawerTitle, DrawerTrigger, DrawerViewport, createDrawerHandle };
|
|
295
435
|
//# sourceMappingURL=drawer.js.map
|