@deftui/react 0.2.2 → 0.2.3

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,125 +0,0 @@
1
- "use client";
2
- import { cn } from "cn";
3
- import * as React$1 from "react";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- import { Drawer } from "@base-ui/react/drawer";
6
- // src/vendor/shadcn/drawer.tsx
7
- const DrawerContext = React$1.createContext(null);
8
- function useDrawer() {
9
- const context = React$1.useContext(DrawerContext);
10
- if (!context) throw new Error("useDrawer must be used within a Drawer.");
11
- return context;
12
- }
13
- function Drawer$1({ modal = true, showSwipeHandle = false, snapPoints, swipeDirection = "down", ...props }) {
14
- const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
15
- const contextValue = React$1.useMemo(() => ({
16
- hasSnapPoints,
17
- modal,
18
- showSwipeHandle,
19
- swipeDirection
20
- }), [
21
- hasSnapPoints,
22
- modal,
23
- showSwipeHandle,
24
- swipeDirection
25
- ]);
26
- return /* @__PURE__ */ jsx(DrawerContext.Provider, {
27
- value: contextValue,
28
- children: /* @__PURE__ */ jsx(Drawer.Root, {
29
- "data-slot": "drawer",
30
- modal,
31
- snapPoints,
32
- swipeDirection,
33
- ...props
34
- })
35
- });
36
- }
37
- function DrawerTrigger({ ...props }) {
38
- return /* @__PURE__ */ jsx(Drawer.Trigger, {
39
- "data-slot": "drawer-trigger",
40
- ...props
41
- });
42
- }
43
- function DrawerPortal({ ...props }) {
44
- return /* @__PURE__ */ jsx(Drawer.Portal, {
45
- "data-slot": "drawer-portal",
46
- ...props
47
- });
48
- }
49
- function DrawerClose({ ...props }) {
50
- return /* @__PURE__ */ jsx(Drawer.Close, {
51
- "data-slot": "drawer-close",
52
- ...props
53
- });
54
- }
55
- function DrawerOverlay({ className, ...props }) {
56
- return /* @__PURE__ */ jsx(Drawer.Backdrop, {
57
- "data-slot": "drawer-overlay",
58
- className: cn("fixed inset-0 z-50 min-h-dvh bg-black/10 opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))] transition-opacity duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-snap-points:[--drawer-overlay-min-opacity:0.5] data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs supports-[-webkit-touch-callout:none]:absolute", className),
59
- ...props
60
- });
61
- }
62
- function DrawerSwipeHandle({ className, ...props }) {
63
- return /* @__PURE__ */ jsx("div", {
64
- "data-slot": "drawer-swipe-handle",
65
- "aria-hidden": "true",
66
- className: cn("relative z-10 flex shrink-0 cursor-grab transition-opacity duration-200 group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-[swipe-axis=x]/drawer-popup:h-full group-data-[swipe-axis=x]/drawer-popup:w-3 group-data-[swipe-axis=x]/drawer-popup:items-center group-data-[swipe-axis=y]/drawer-popup:h-3 group-data-[swipe-axis=y]/drawer-popup:w-full group-data-[swipe-axis=y]/drawer-popup:justify-center group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:items-start after:block after:shrink-0 after:rounded-full after:bg-muted group-data-[swipe-axis=x]/drawer-popup:after:h-[100px] group-data-[swipe-axis=x]/drawer-popup:after:w-1.5 group-data-[swipe-axis=y]/drawer-popup:after:h-1.5 group-data-[swipe-axis=y]/drawer-popup:after:w-[100px] active:cursor-grabbing", className),
67
- ...props
68
- });
69
- }
70
- function DrawerContent({ className, children, ...props }) {
71
- const { hasSnapPoints, modal, showSwipeHandle, swipeDirection } = useDrawer();
72
- const swipeAxis = swipeDirection === "down" || swipeDirection === "up" ? "y" : "x";
73
- return /* @__PURE__ */ jsxs(DrawerPortal, {
74
- "data-slot": "drawer-portal",
75
- children: [modal === true && /* @__PURE__ */ jsx(DrawerOverlay, { "data-snap-points": hasSnapPoints ? "" : void 0 }), /* @__PURE__ */ jsx(Drawer.Viewport, {
76
- "data-slot": "drawer-viewport",
77
- "data-modal": modal,
78
- className: "pointer-events-none fixed inset-0 z-50 select-none data-[modal=true]:pointer-events-auto",
79
- children: /* @__PURE__ */ jsxs(Drawer.Popup, {
80
- "data-slot": "drawer-popup",
81
- "data-swipe-axis": swipeAxis,
82
- "data-snap-points": hasSnapPoints ? "" : void 0,
83
- className: cn("group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col bg-popover text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [interpolate-size:allow-keywords] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b", "data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95", "after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full", "[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem]", "[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--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:max(0,calc(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]", "data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)]", "data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height)", "data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row", "data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]", "data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]", "data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]", "data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]", className),
84
- ...props,
85
- children: [showSwipeHandle && /* @__PURE__ */ jsx(DrawerSwipeHandle, {}), /* @__PURE__ */ jsx(Drawer.Content, {
86
- "data-slot": "drawer-content",
87
- className: cn("flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-300 ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none"),
88
- children
89
- })]
90
- })
91
- })]
92
- });
93
- }
94
- function DrawerHeader({ className, ...props }) {
95
- return /* @__PURE__ */ jsx("div", {
96
- "data-slot": "drawer-header",
97
- className: cn("flex shrink-0 flex-col gap-0.5 p-4 pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-1.5 md:text-left", className),
98
- ...props
99
- });
100
- }
101
- function DrawerFooter({ className, ...props }) {
102
- return /* @__PURE__ */ jsx("div", {
103
- "data-slot": "drawer-footer",
104
- className: cn("mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0", className),
105
- ...props
106
- });
107
- }
108
- function DrawerTitle({ className, ...props }) {
109
- return /* @__PURE__ */ jsx(Drawer.Title, {
110
- "data-slot": "drawer-title",
111
- className: cn("font-medium text-foreground", className),
112
- ...props
113
- });
114
- }
115
- function DrawerDescription({ className, ...props }) {
116
- return /* @__PURE__ */ jsx(Drawer.Description, {
117
- "data-slot": "drawer-description",
118
- className: cn("text-sm text-balance text-muted-foreground", className),
119
- ...props
120
- });
121
- }
122
- function createDrawerHandle() {
123
- return Drawer.createHandle();
124
- }
125
- export { Drawer$1 as Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, createDrawerHandle };
@@ -1,5 +0,0 @@
1
- import { AlertDialogHandle, createAlertDialogHandle } from "../vendor/shadcn/alert-dialog.mjs";
2
- import { ComboboxItemCollection, ComboboxPrimitiveValue, CreateComboboxItemsOptions, createComboboxItems } from "../vendor/shadcn/combobox.mjs";
3
- import { DialogHandle, createDialogHandle } from "../vendor/shadcn/dialog.mjs";
4
- import { DrawerHandle, createDrawerHandle } from "../vendor/shadcn/drawer.mjs";
5
- export { type AlertDialogHandle, type ComboboxItemCollection, type ComboboxPrimitiveValue, type CreateComboboxItemsOptions, type DialogHandle, type DrawerHandle, createAlertDialogHandle, createComboboxItems, createDialogHandle, createDrawerHandle };