@karakuri-ui/react 0.2.3 → 0.3.0
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/README.md +0 -1
- package/dist/components/ui/accordion.d.mts +40 -0
- package/dist/components/ui/accordion.d.ts +40 -0
- package/dist/components/ui/accordion.js +215 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +176 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +38 -0
- package/dist/components/ui/alert.d.ts +38 -0
- package/dist/components/ui/alert.js +217 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +180 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +223 -0
- package/dist/components/ui/avatar.d.ts +223 -0
- package/dist/components/ui/avatar.js +245 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +204 -0
- package/dist/components/ui/avatar.mjs.map +1 -0
- package/dist/components/ui/badge.d.mts +31 -0
- package/dist/components/ui/badge.d.ts +31 -0
- package/dist/components/ui/badge.js +205 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/badge.mjs +170 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/breadcrumb.d.mts +46 -0
- package/dist/components/ui/breadcrumb.d.ts +46 -0
- package/dist/components/ui/breadcrumb.js +201 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +160 -0
- package/dist/components/ui/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/button-group.d.mts +22 -0
- package/dist/components/ui/button-group.d.ts +22 -0
- package/dist/components/ui/button-group.js +107 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button-group.mjs +72 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +31 -0
- package/dist/components/ui/button.d.ts +31 -0
- package/dist/components/ui/button.js +176 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +141 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +60 -0
- package/dist/components/ui/card.d.ts +60 -0
- package/dist/components/ui/card.js +361 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +319 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.d.mts → components/ui/chart.d.mts} +2 -18
- package/dist/{chart.d.ts → components/ui/chart.d.ts} +2 -18
- package/dist/{chart.js → components/ui/chart.js} +30 -55
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +22 -46
- package/dist/components/ui/chart.mjs.map +1 -0
- package/dist/components/ui/checkbox.d.mts +24 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/checkbox.js +173 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/checkbox.mjs +138 -0
- package/dist/components/ui/checkbox.mjs.map +1 -0
- package/dist/components/ui/divider.d.mts +27 -0
- package/dist/components/ui/divider.d.ts +27 -0
- package/dist/components/ui/divider.js +147 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/divider.mjs +112 -0
- package/dist/components/ui/divider.mjs.map +1 -0
- package/dist/components/ui/drawer.d.mts +36 -0
- package/dist/components/ui/drawer.d.ts +36 -0
- package/dist/components/ui/drawer.js +211 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +165 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +34 -0
- package/dist/components/ui/dropdown.d.ts +34 -0
- package/dist/components/ui/dropdown.js +295 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +248 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +26 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +141 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +103 -0
- package/dist/components/ui/field.mjs.map +1 -0
- package/dist/components/ui/icon-button.d.mts +20 -0
- package/dist/components/ui/icon-button.d.ts +20 -0
- package/dist/components/ui/icon-button.js +147 -0
- package/dist/components/ui/icon-button.js.map +1 -0
- package/dist/components/ui/icon-button.mjs +112 -0
- package/dist/components/ui/icon-button.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +55 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +468 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +242 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/components/ui/input.d.mts +20 -0
- package/dist/components/ui/input.d.ts +20 -0
- package/dist/components/ui/input.js +250 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/input.mjs +215 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/metric-card.d.mts +38 -0
- package/dist/components/ui/metric-card.d.ts +38 -0
- package/dist/components/ui/metric-card.js +250 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +209 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +47 -0
- package/dist/components/ui/modal.d.ts +47 -0
- package/dist/components/ui/modal.js +371 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +313 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +120 -0
- package/dist/components/ui/navigation-menu.d.ts +120 -0
- package/dist/components/ui/navigation-menu.js +521 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +478 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +113 -0
- package/dist/components/ui/pagination.d.ts +113 -0
- package/dist/components/ui/pagination.js +484 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +438 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +29 -0
- package/dist/components/ui/popover.d.ts +29 -0
- package/dist/components/ui/popover.js +165 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +124 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/progress.d.mts +35 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.js +194 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/progress.mjs +159 -0
- package/dist/components/ui/progress.mjs.map +1 -0
- package/dist/components/ui/radio-group.d.mts +35 -0
- package/dist/components/ui/radio-group.d.ts +35 -0
- package/dist/components/ui/radio-group.js +174 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +137 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +25 -0
- package/dist/components/ui/segmented.d.ts +25 -0
- package/dist/components/ui/segmented.js +238 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +201 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +20 -0
- package/dist/components/ui/select.d.ts +20 -0
- package/dist/components/ui/select.js +308 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +267 -0
- package/dist/components/ui/select.mjs.map +1 -0
- package/dist/components/ui/skeleton.d.mts +26 -0
- package/dist/components/ui/skeleton.d.ts +26 -0
- package/dist/components/ui/skeleton.js +144 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/skeleton.mjs +109 -0
- package/dist/components/ui/skeleton.mjs.map +1 -0
- package/dist/components/ui/slider.d.mts +38 -0
- package/dist/components/ui/slider.d.ts +38 -0
- package/dist/components/ui/slider.js +180 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/slider.mjs +145 -0
- package/dist/components/ui/slider.mjs.map +1 -0
- package/dist/components/ui/spinner.d.mts +23 -0
- package/dist/components/ui/spinner.d.ts +23 -0
- package/dist/components/ui/spinner.js +471 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spinner.mjs +436 -0
- package/dist/components/ui/spinner.mjs.map +1 -0
- package/dist/components/ui/switch.d.mts +22 -0
- package/dist/components/ui/switch.d.ts +22 -0
- package/dist/components/ui/switch.js +173 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/switch.mjs +138 -0
- package/dist/components/ui/switch.mjs.map +1 -0
- package/dist/components/ui/table.d.mts +60 -0
- package/dist/components/ui/table.d.ts +60 -0
- package/dist/components/ui/table.js +231 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +190 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +31 -0
- package/dist/components/ui/tabs.d.ts +31 -0
- package/dist/components/ui/tabs.js +233 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +194 -0
- package/dist/components/ui/tabs.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts +19 -0
- package/dist/components/ui/textarea.d.ts +19 -0
- package/dist/components/ui/textarea.js +181 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/textarea.mjs +146 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/ui/toast.d.mts +93 -0
- package/dist/components/ui/toast.d.ts +93 -0
- package/dist/components/ui/toast.js +429 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toast.mjs +393 -0
- package/dist/components/ui/toast.mjs.map +1 -0
- package/dist/components/ui/toggle-group.d.mts +42 -0
- package/dist/components/ui/toggle-group.d.ts +42 -0
- package/dist/components/ui/toggle-group.js +183 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +146 -0
- package/dist/components/ui/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggle.d.mts +19 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.js +194 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/toggle.mjs +159 -0
- package/dist/components/ui/toggle.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +26 -0
- package/dist/components/ui/tooltip.d.ts +26 -0
- package/dist/components/ui/tooltip.js +128 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +88 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/lib/code-generator.d.mts +60 -0
- package/dist/lib/code-generator.d.ts +60 -0
- package/dist/lib/code-generator.js +224 -0
- package/dist/lib/code-generator.js.map +1 -0
- package/dist/lib/code-generator.mjs +159 -0
- package/dist/lib/code-generator.mjs.map +1 -0
- package/dist/lib/utils.d.mts +10 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +33 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/chart.js.map +0 -1
- package/dist/chart.mjs.map +0 -1
- package/dist/index.d.mts +0 -1636
- package/dist/index.d.ts +0 -1636
- package/dist/index.js +0 -7291
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7048
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const dividerVariants = cva("shrink-0", {
|
|
7
|
+
variants: {
|
|
8
|
+
orientation: {
|
|
9
|
+
horizontal: "w-full",
|
|
10
|
+
vertical: "h-full self-stretch"
|
|
11
|
+
},
|
|
12
|
+
variant: {
|
|
13
|
+
solid: "border-solid",
|
|
14
|
+
dashed: "border-dashed",
|
|
15
|
+
dotted: "border-dotted"
|
|
16
|
+
},
|
|
17
|
+
color: {
|
|
18
|
+
default: "border-border-subtle",
|
|
19
|
+
muted: "border-border-subtle",
|
|
20
|
+
strong: "border-border-strong"
|
|
21
|
+
},
|
|
22
|
+
spacing: {
|
|
23
|
+
sm: "",
|
|
24
|
+
md: "",
|
|
25
|
+
default: "",
|
|
26
|
+
lg: ""
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
compoundVariants: [
|
|
30
|
+
// Horizontal spacing
|
|
31
|
+
{ orientation: "horizontal", spacing: "sm", className: "my-2" },
|
|
32
|
+
{ orientation: "horizontal", spacing: "md", className: "my-3" },
|
|
33
|
+
{ orientation: "horizontal", spacing: "default", className: "my-4" },
|
|
34
|
+
{ orientation: "horizontal", spacing: "lg", className: "my-8" },
|
|
35
|
+
// Vertical spacing
|
|
36
|
+
{ orientation: "vertical", spacing: "sm", className: "mx-2" },
|
|
37
|
+
{ orientation: "vertical", spacing: "md", className: "mx-3" },
|
|
38
|
+
{ orientation: "vertical", spacing: "default", className: "mx-4" },
|
|
39
|
+
{ orientation: "vertical", spacing: "lg", className: "mx-8" },
|
|
40
|
+
// Horizontal line style (border-top)
|
|
41
|
+
{ orientation: "horizontal", className: "border-t border-l-0" },
|
|
42
|
+
// Vertical line style (border-left)
|
|
43
|
+
{ orientation: "vertical", className: "border-l border-t-0" }
|
|
44
|
+
],
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
orientation: "horizontal",
|
|
47
|
+
variant: "solid",
|
|
48
|
+
color: "default",
|
|
49
|
+
spacing: "default"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const Divider = React.forwardRef(({
|
|
53
|
+
className,
|
|
54
|
+
orientation = "horizontal",
|
|
55
|
+
variant = "solid",
|
|
56
|
+
color = "default",
|
|
57
|
+
spacing = "default",
|
|
58
|
+
label,
|
|
59
|
+
labelPosition = "center",
|
|
60
|
+
decorative = true,
|
|
61
|
+
...props
|
|
62
|
+
}, ref) => {
|
|
63
|
+
const lineClass = cn(
|
|
64
|
+
"flex-1",
|
|
65
|
+
variant === "dashed" ? "border-dashed" : variant === "dotted" ? "border-dotted" : "border-solid",
|
|
66
|
+
color === "muted" ? "border-border-subtle" : color === "strong" ? "border-border-strong" : "border-border-subtle",
|
|
67
|
+
"border-t"
|
|
68
|
+
);
|
|
69
|
+
const spacingClass = spacing === "sm" ? "my-2" : spacing === "md" ? "my-3" : spacing === "lg" ? "my-8" : "my-4";
|
|
70
|
+
if (label && orientation === "horizontal") {
|
|
71
|
+
return /* @__PURE__ */ React.createElement(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
role: decorative ? "none" : "separator",
|
|
75
|
+
"aria-orientation": "horizontal",
|
|
76
|
+
className: cn(
|
|
77
|
+
"flex items-center w-full",
|
|
78
|
+
spacingClass,
|
|
79
|
+
className
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ React.createElement("div", { className: cn(
|
|
83
|
+
lineClass,
|
|
84
|
+
labelPosition === "left" ? "max-w-[10%]" : ""
|
|
85
|
+
) }),
|
|
86
|
+
/* @__PURE__ */ React.createElement("span", { className: "px-3 text-sm text-text-muted shrink-0 select-none" }, label),
|
|
87
|
+
/* @__PURE__ */ React.createElement("div", { className: cn(
|
|
88
|
+
lineClass,
|
|
89
|
+
labelPosition === "right" ? "max-w-[10%]" : ""
|
|
90
|
+
) })
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ React.createElement(
|
|
94
|
+
SeparatorPrimitive.Root,
|
|
95
|
+
{
|
|
96
|
+
ref,
|
|
97
|
+
decorative,
|
|
98
|
+
orientation,
|
|
99
|
+
className: cn(
|
|
100
|
+
dividerVariants({ orientation, variant, color, spacing }),
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
...props
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
Divider.displayName = "Divider";
|
|
108
|
+
export {
|
|
109
|
+
Divider,
|
|
110
|
+
dividerVariants
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=divider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/divider.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as SeparatorPrimitive from '@radix-ui/react-separator'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Divider ─────────────────────────────────────────────────\n\nconst dividerVariants = cva('shrink-0', {\n variants: {\n orientation: {\n horizontal: 'w-full',\n vertical: 'h-full self-stretch',\n },\n variant: {\n solid: 'border-solid',\n dashed: 'border-dashed',\n dotted: 'border-dotted',\n },\n color: {\n default: 'border-border-subtle',\n muted: 'border-border-subtle',\n strong: 'border-border-strong',\n },\n spacing: {\n sm: '',\n md: '',\n default: '',\n lg: '',\n },\n },\n compoundVariants: [\n // Horizontal spacing\n { orientation: 'horizontal', spacing: 'sm', className: 'my-2' },\n { orientation: 'horizontal', spacing: 'md', className: 'my-3' },\n { orientation: 'horizontal', spacing: 'default', className: 'my-4' },\n { orientation: 'horizontal', spacing: 'lg', className: 'my-8' },\n // Vertical spacing\n { orientation: 'vertical', spacing: 'sm', className: 'mx-2' },\n { orientation: 'vertical', spacing: 'md', className: 'mx-3' },\n { orientation: 'vertical', spacing: 'default', className: 'mx-4' },\n { orientation: 'vertical', spacing: 'lg', className: 'mx-8' },\n // Horizontal line style (border-top)\n { orientation: 'horizontal', className: 'border-t border-l-0' },\n // Vertical line style (border-left)\n { orientation: 'vertical', className: 'border-l border-t-0' },\n ],\n defaultVariants: {\n orientation: 'horizontal',\n variant: 'solid',\n color: 'default',\n spacing: 'default',\n },\n})\n\nexport interface DividerProps\n extends Omit<React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>, 'children' | 'color' | 'orientation'> {\n /** Direction of the divider */\n orientation?: 'horizontal' | 'vertical'\n /** Line style */\n variant?: 'solid' | 'dashed' | 'dotted'\n /** Line color intensity */\n color?: 'default' | 'muted' | 'strong'\n /** Spacing around the divider */\n spacing?: 'sm' | 'md' | 'default' | 'lg'\n /** Content to display on the divider line (horizontal only) */\n label?: React.ReactNode\n /** Label position along the line */\n labelPosition?: 'left' | 'center' | 'right'\n}\n\nconst Divider = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n DividerProps\n>(({\n className,\n orientation = 'horizontal',\n variant = 'solid',\n color = 'default',\n spacing = 'default',\n label,\n labelPosition = 'center',\n decorative = true,\n ...props\n}, ref) => {\n // Line style class for label mode\n const lineClass = cn(\n 'flex-1',\n variant === 'dashed' ? 'border-dashed' : variant === 'dotted' ? 'border-dotted' : 'border-solid',\n color === 'muted' ? 'border-border-subtle' : color === 'strong' ? 'border-border-strong' : 'border-border-subtle',\n 'border-t'\n )\n\n // Spacing class for label wrapper\n const spacingClass =\n spacing === 'sm' ? 'my-2'\n : spacing === 'md' ? 'my-3'\n : spacing === 'lg' ? 'my-8'\n : 'my-4'\n\n // Horizontal with label: render as flex container with two lines\n if (label && orientation === 'horizontal') {\n return (\n <div\n role={decorative ? 'none' : 'separator'}\n aria-orientation=\"horizontal\"\n className={cn(\n 'flex items-center w-full',\n spacingClass,\n className\n )}\n >\n <div className={cn(\n lineClass,\n labelPosition === 'left' ? 'max-w-[10%]' : ''\n )} />\n <span className=\"px-3 text-sm text-text-muted shrink-0 select-none\">{label}</span>\n <div className={cn(\n lineClass,\n labelPosition === 'right' ? 'max-w-[10%]' : ''\n )} />\n </div>\n )\n }\n\n // Default: Radix Separator\n return (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n dividerVariants({ orientation, variant, color, spacing }),\n className\n )}\n {...props}\n />\n )\n})\nDivider.displayName = 'Divider'\n\n// ─── Exports ─────────────────────────────────────────────────\n\nexport { Divider, dividerVariants }\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,wBAAwB;AACpC,SAAS,WAA8B;AACvC,SAAS,UAAU;AAInB,MAAM,kBAAkB,IAAI,YAAY;AAAA,EACtC,UAAU;AAAA,IACR,aAAa;AAAA,MACX,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACP,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,IAAI;AAAA,IACN;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA;AAAA,IAEhB,EAAE,aAAa,cAAc,SAAS,MAAM,WAAW,OAAO;AAAA,IAC9D,EAAE,aAAa,cAAc,SAAS,MAAM,WAAW,OAAO;AAAA,IAC9D,EAAE,aAAa,cAAc,SAAS,WAAW,WAAW,OAAO;AAAA,IACnE,EAAE,aAAa,cAAc,SAAS,MAAM,WAAW,OAAO;AAAA;AAAA,IAE9D,EAAE,aAAa,YAAY,SAAS,MAAM,WAAW,OAAO;AAAA,IAC5D,EAAE,aAAa,YAAY,SAAS,MAAM,WAAW,OAAO;AAAA,IAC5D,EAAE,aAAa,YAAY,SAAS,WAAW,WAAW,OAAO;AAAA,IACjE,EAAE,aAAa,YAAY,SAAS,MAAM,WAAW,OAAO;AAAA;AAAA,IAE5D,EAAE,aAAa,cAAc,WAAW,sBAAsB;AAAA;AAAA,IAE9D,EAAE,aAAa,YAAY,WAAW,sBAAsB;AAAA,EAC9D;AAAA,EACA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,EACX;AACF,CAAC;AAkBD,MAAM,UAAU,MAAM,WAGpB,CAAC;AAAA,EACD;AAAA,EACA,cAAc;AAAA,EACd,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,GAAG;AACL,GAAG,QAAQ;AAET,QAAM,YAAY;AAAA,IAChB;AAAA,IACA,YAAY,WAAW,kBAAkB,YAAY,WAAW,kBAAkB;AAAA,IAClF,UAAU,UAAU,yBAAyB,UAAU,WAAW,yBAAyB;AAAA,IAC3F;AAAA,EACF;AAGA,QAAM,eACJ,YAAY,OAAO,SACjB,YAAY,OAAO,SACnB,YAAY,OAAO,SACnB;AAGJ,MAAI,SAAS,gBAAgB,cAAc;AACzC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,aAAa,SAAS;AAAA,QAC5B,oBAAiB;AAAA,QACjB,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA;AAAA,MAEA,oCAAC,SAAI,WAAW;AAAA,QACd;AAAA,QACA,kBAAkB,SAAS,gBAAgB;AAAA,MAC7C,GAAG;AAAA,MACH,oCAAC,UAAK,WAAU,uDAAqD,KAAM;AAAA,MAC3E,oCAAC,SAAI,WAAW;AAAA,QACd;AAAA,QACA,kBAAkB,UAAU,gBAAgB;AAAA,MAC9C,GAAG;AAAA,IACL;AAAA,EAEJ;AAGA,SACE;AAAA,IAAC,mBAAmB;AAAA,IAAnB;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT,gBAAgB,EAAE,aAAa,SAAS,OAAO,QAAQ,CAAC;AAAA,QACxD;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AACD,QAAQ,cAAc;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
type DrawerSide = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
7
|
+
declare const drawerSizeHorizontal: (props?: ({
|
|
8
|
+
size?: "sm" | "lg" | "md" | "xl" | "full" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare const drawerSizeVertical: (props?: ({
|
|
11
|
+
size?: "sm" | "lg" | "md" | "xl" | "full" | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
declare function Drawer(props: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
14
|
+
declare const DrawerTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
declare const DrawerPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
16
|
+
declare const DrawerClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
interface DrawerContentProps extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, 'children'> {
|
|
19
|
+
/** Side from which the drawer slides in */
|
|
20
|
+
side?: DrawerSide;
|
|
21
|
+
/** Panel size (width for left/right, height for top/bottom) */
|
|
22
|
+
size?: DrawerSize;
|
|
23
|
+
/** Show built-in close button */
|
|
24
|
+
showCloseButton?: boolean;
|
|
25
|
+
/** Custom close icon (replaces default X) */
|
|
26
|
+
closeIcon?: React.ReactNode;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
declare const DrawerHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
declare const DrawerTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
32
|
+
declare const DrawerDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
33
|
+
declare const DrawerBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
declare const DrawerFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
|
|
36
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerSide, type DrawerSize, DrawerTitle, DrawerTrigger, drawerSizeHorizontal, drawerSizeVertical };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
type DrawerSide = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
7
|
+
declare const drawerSizeHorizontal: (props?: ({
|
|
8
|
+
size?: "sm" | "lg" | "md" | "xl" | "full" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare const drawerSizeVertical: (props?: ({
|
|
11
|
+
size?: "sm" | "lg" | "md" | "xl" | "full" | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
declare function Drawer(props: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>): React.JSX.Element;
|
|
14
|
+
declare const DrawerTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
declare const DrawerPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
16
|
+
declare const DrawerClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
interface DrawerContentProps extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, 'children'> {
|
|
19
|
+
/** Side from which the drawer slides in */
|
|
20
|
+
side?: DrawerSide;
|
|
21
|
+
/** Panel size (width for left/right, height for top/bottom) */
|
|
22
|
+
size?: DrawerSize;
|
|
23
|
+
/** Show built-in close button */
|
|
24
|
+
showCloseButton?: boolean;
|
|
25
|
+
/** Custom close icon (replaces default X) */
|
|
26
|
+
closeIcon?: React.ReactNode;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
declare const DrawerHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
declare const DrawerTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
32
|
+
declare const DrawerDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
33
|
+
declare const DrawerBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
declare const DrawerFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
|
|
36
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerSide, type DrawerSize, DrawerTitle, DrawerTrigger, drawerSizeHorizontal, drawerSizeVertical };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var drawer_exports = {};
|
|
31
|
+
__export(drawer_exports, {
|
|
32
|
+
Drawer: () => Drawer,
|
|
33
|
+
DrawerBody: () => DrawerBody,
|
|
34
|
+
DrawerClose: () => DrawerClose,
|
|
35
|
+
DrawerContent: () => DrawerContent,
|
|
36
|
+
DrawerDescription: () => DrawerDescription,
|
|
37
|
+
DrawerFooter: () => DrawerFooter,
|
|
38
|
+
DrawerHeader: () => DrawerHeader,
|
|
39
|
+
DrawerOverlay: () => DrawerOverlay,
|
|
40
|
+
DrawerPortal: () => DrawerPortal,
|
|
41
|
+
DrawerTitle: () => DrawerTitle,
|
|
42
|
+
DrawerTrigger: () => DrawerTrigger,
|
|
43
|
+
drawerSizeHorizontal: () => drawerSizeHorizontal,
|
|
44
|
+
drawerSizeVertical: () => drawerSizeVertical
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(drawer_exports);
|
|
47
|
+
var React = __toESM(require("react"));
|
|
48
|
+
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
49
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
50
|
+
var import_utils = require("../../lib/utils");
|
|
51
|
+
const DefaultCloseIcon = ({ className }) => /* @__PURE__ */ React.createElement(
|
|
52
|
+
"svg",
|
|
53
|
+
{
|
|
54
|
+
className,
|
|
55
|
+
fill: "none",
|
|
56
|
+
viewBox: "0 0 24 24",
|
|
57
|
+
stroke: "currentColor",
|
|
58
|
+
strokeWidth: 2,
|
|
59
|
+
"aria-hidden": "true"
|
|
60
|
+
},
|
|
61
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
62
|
+
);
|
|
63
|
+
const ANIMATION_CLASSES = {
|
|
64
|
+
right: "data-[state=open]:animate-drawer-right-enter data-[state=closed]:animate-drawer-right-exit",
|
|
65
|
+
left: "data-[state=open]:animate-drawer-left-enter data-[state=closed]:animate-drawer-left-exit",
|
|
66
|
+
top: "data-[state=open]:animate-drawer-top-enter data-[state=closed]:animate-drawer-top-exit",
|
|
67
|
+
bottom: "data-[state=open]:animate-drawer-bottom-enter data-[state=closed]:animate-drawer-bottom-exit"
|
|
68
|
+
};
|
|
69
|
+
const drawerSizeHorizontal = (0, import_class_variance_authority.cva)("", {
|
|
70
|
+
variants: {
|
|
71
|
+
size: {
|
|
72
|
+
sm: "w-[320px]",
|
|
73
|
+
md: "w-[400px]",
|
|
74
|
+
lg: "w-[480px]",
|
|
75
|
+
xl: "w-[640px]",
|
|
76
|
+
full: "w-full"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: { size: "md" }
|
|
80
|
+
});
|
|
81
|
+
const drawerSizeVertical = (0, import_class_variance_authority.cva)("", {
|
|
82
|
+
variants: {
|
|
83
|
+
size: {
|
|
84
|
+
sm: "h-[320px]",
|
|
85
|
+
md: "h-[400px]",
|
|
86
|
+
lg: "h-[480px]",
|
|
87
|
+
xl: "h-[640px]",
|
|
88
|
+
full: "h-full"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
defaultVariants: { size: "md" }
|
|
92
|
+
});
|
|
93
|
+
function Drawer(props) {
|
|
94
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.Root, { ...props });
|
|
95
|
+
}
|
|
96
|
+
const DrawerTrigger = DialogPrimitive.Trigger;
|
|
97
|
+
const DrawerPortal = DialogPrimitive.Portal;
|
|
98
|
+
const DrawerClose = DialogPrimitive.Close;
|
|
99
|
+
const DrawerOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
100
|
+
DialogPrimitive.Overlay,
|
|
101
|
+
{
|
|
102
|
+
ref,
|
|
103
|
+
className: (0, import_utils.cn)(
|
|
104
|
+
"fixed inset-0 z-overlay bg-black/50",
|
|
105
|
+
"data-[state=open]:animate-modal-overlay-enter data-[state=closed]:animate-modal-overlay-exit",
|
|
106
|
+
className
|
|
107
|
+
),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
));
|
|
111
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
112
|
+
const SIDE_POSITION = {
|
|
113
|
+
right: "inset-y-0 right-0",
|
|
114
|
+
left: "inset-y-0 left-0",
|
|
115
|
+
top: "inset-x-0 top-0",
|
|
116
|
+
bottom: "inset-x-0 bottom-0"
|
|
117
|
+
};
|
|
118
|
+
const DrawerContent = React.forwardRef(({ className, children, side = "right", size = "md", showCloseButton = true, closeIcon, ...props }, ref) => {
|
|
119
|
+
const isHorizontal = side === "left" || side === "right";
|
|
120
|
+
const sizeClass = isHorizontal ? drawerSizeHorizontal({ size }) : drawerSizeVertical({ size });
|
|
121
|
+
return /* @__PURE__ */ React.createElement(DrawerPortal, null, /* @__PURE__ */ React.createElement(DrawerOverlay, null), /* @__PURE__ */ React.createElement(
|
|
122
|
+
DialogPrimitive.Content,
|
|
123
|
+
{
|
|
124
|
+
ref,
|
|
125
|
+
className: (0, import_utils.cn)(
|
|
126
|
+
"fixed z-modal flex flex-col bg-background text-foreground shadow-xl",
|
|
127
|
+
"focus:outline-none",
|
|
128
|
+
SIDE_POSITION[side],
|
|
129
|
+
isHorizontal ? "max-w-full h-full" : "max-h-full w-full",
|
|
130
|
+
sizeClass,
|
|
131
|
+
ANIMATION_CLASSES[side],
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
...props
|
|
135
|
+
},
|
|
136
|
+
children,
|
|
137
|
+
showCloseButton && /* @__PURE__ */ React.createElement(DialogPrimitive.Close, { className: (0, import_utils.cn)(
|
|
138
|
+
"absolute right-4 top-4 rounded-md p-1",
|
|
139
|
+
"text-text-muted hover:text-foreground",
|
|
140
|
+
"transition-colors duration-fast",
|
|
141
|
+
"focus-visible:focus-ring focus-visible:outline-none",
|
|
142
|
+
"disabled:pointer-events-none"
|
|
143
|
+
) }, closeIcon || /* @__PURE__ */ React.createElement(DefaultCloseIcon, { className: "icon-sm" }), /* @__PURE__ */ React.createElement("span", { className: "sr-only" }, "Close"))
|
|
144
|
+
));
|
|
145
|
+
});
|
|
146
|
+
DrawerContent.displayName = "DrawerContent";
|
|
147
|
+
const DrawerHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
ref,
|
|
151
|
+
className: (0, import_utils.cn)("flex flex-col gap-1.5 p-6 pb-0", className),
|
|
152
|
+
...props
|
|
153
|
+
}
|
|
154
|
+
));
|
|
155
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
156
|
+
const DrawerTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
157
|
+
DialogPrimitive.Title,
|
|
158
|
+
{
|
|
159
|
+
ref,
|
|
160
|
+
className: (0, import_utils.cn)("text-lg font-semibold text-foreground", className),
|
|
161
|
+
...props
|
|
162
|
+
}
|
|
163
|
+
));
|
|
164
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
165
|
+
const DrawerDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
166
|
+
DialogPrimitive.Description,
|
|
167
|
+
{
|
|
168
|
+
ref,
|
|
169
|
+
className: (0, import_utils.cn)("text-md text-text-muted", className),
|
|
170
|
+
...props
|
|
171
|
+
}
|
|
172
|
+
));
|
|
173
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
174
|
+
const DrawerBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref,
|
|
178
|
+
className: (0, import_utils.cn)("flex-1 overflow-y-auto p-6", className),
|
|
179
|
+
...props
|
|
180
|
+
}
|
|
181
|
+
));
|
|
182
|
+
DrawerBody.displayName = "DrawerBody";
|
|
183
|
+
const DrawerFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
ref,
|
|
187
|
+
className: (0, import_utils.cn)(
|
|
188
|
+
"flex items-center justify-end gap-3 p-6 pt-0",
|
|
189
|
+
className
|
|
190
|
+
),
|
|
191
|
+
...props
|
|
192
|
+
}
|
|
193
|
+
));
|
|
194
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
195
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
196
|
+
0 && (module.exports = {
|
|
197
|
+
Drawer,
|
|
198
|
+
DrawerBody,
|
|
199
|
+
DrawerClose,
|
|
200
|
+
DrawerContent,
|
|
201
|
+
DrawerDescription,
|
|
202
|
+
DrawerFooter,
|
|
203
|
+
DrawerHeader,
|
|
204
|
+
DrawerOverlay,
|
|
205
|
+
DrawerPortal,
|
|
206
|
+
DrawerTitle,
|
|
207
|
+
DrawerTrigger,
|
|
208
|
+
drawerSizeHorizontal,
|
|
209
|
+
drawerSizeVertical
|
|
210
|
+
});
|
|
211
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/drawer.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom'\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<DrawerSide, string> = {\n right: 'data-[state=open]:animate-drawer-right-enter data-[state=closed]:animate-drawer-right-exit',\n left: 'data-[state=open]:animate-drawer-left-enter data-[state=closed]:animate-drawer-left-exit',\n top: 'data-[state=open]:animate-drawer-top-enter data-[state=closed]:animate-drawer-top-exit',\n bottom: 'data-[state=open]:animate-drawer-bottom-enter data-[state=closed]:animate-drawer-bottom-exit',\n}\n\n// ─── Size variants ──────────────────────────────────────────\nconst drawerSizeHorizontal = cva('', {\n variants: {\n size: {\n sm: 'w-[320px]',\n md: 'w-[400px]',\n lg: 'w-[480px]',\n xl: 'w-[640px]',\n full: 'w-full',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nconst drawerSizeVertical = cva('', {\n variants: {\n size: {\n sm: 'h-[320px]',\n md: 'h-[400px]',\n lg: 'h-[480px]',\n xl: 'h-[640px]',\n full: 'h-full',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\n// ═══════════════════════════════════════════════════════════════\n// Drawer\n// ═══════════════════════════════════════════════════════════════\n\n// ─── Drawer (Root) — wrapper to keep our own component identity separate from DialogPrimitive.Root ──\nfunction Drawer(props: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root {...props} />\n}\n\n// ─── DrawerTrigger ──────────────────────────────────────────\nconst DrawerTrigger = DialogPrimitive.Trigger\n\n// ─── DrawerPortal ───────────────────────────────────────────\nconst DrawerPortal = DialogPrimitive.Portal\n\n// ─── DrawerClose ────────────────────────────────────────────\nconst DrawerClose = DialogPrimitive.Close\n\n// ─── DrawerOverlay ──────────────────────────────────────────\nconst DrawerOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-overlay bg-black/50',\n 'data-[state=open]:animate-modal-overlay-enter data-[state=closed]:animate-modal-overlay-exit',\n className\n )}\n {...props}\n />\n))\nDrawerOverlay.displayName = 'DrawerOverlay'\n\n// ─── DrawerContent ──────────────────────────────────────────\nexport interface DrawerContentProps\n extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, 'children'> {\n /** Side from which the drawer slides in */\n side?: DrawerSide\n /** Panel size (width for left/right, height for top/bottom) */\n size?: DrawerSize\n /** Show built-in close button */\n showCloseButton?: boolean\n /** Custom close icon (replaces default X) */\n closeIcon?: React.ReactNode\n children?: React.ReactNode\n}\n\nconst SIDE_POSITION: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0',\n left: 'inset-y-0 left-0',\n top: 'inset-x-0 top-0',\n bottom: 'inset-x-0 bottom-0',\n}\n\nconst DrawerContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DrawerContentProps\n>(({ className, children, side = 'right', size = 'md', showCloseButton = true, closeIcon, ...props }, ref) => {\n const isHorizontal = side === 'left' || side === 'right'\n const sizeClass = isHorizontal\n ? drawerSizeHorizontal({ size })\n : drawerSizeVertical({ size })\n\n return (\n <DrawerPortal>\n <DrawerOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed z-modal flex flex-col bg-background text-foreground shadow-xl',\n 'focus:outline-none',\n SIDE_POSITION[side],\n isHorizontal ? 'max-w-full h-full' : 'max-h-full w-full',\n sizeClass,\n ANIMATION_CLASSES[side],\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close className={cn(\n 'absolute right-4 top-4 rounded-md p-1',\n 'text-text-muted hover:text-foreground',\n 'transition-colors duration-fast',\n 'focus-visible:focus-ring focus-visible:outline-none',\n 'disabled:pointer-events-none'\n )}>\n {closeIcon || <DefaultCloseIcon className=\"icon-sm\" />}\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DrawerPortal>\n )\n})\nDrawerContent.displayName = 'DrawerContent'\n\n// ─── DrawerHeader ───────────────────────────────────────────\nconst DrawerHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('flex flex-col gap-1.5 p-6 pb-0', className)}\n {...props}\n />\n))\nDrawerHeader.displayName = 'DrawerHeader'\n\n// ─── DrawerTitle ────────────────────────────────────────────\nconst DrawerTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-lg font-semibold text-foreground', className)}\n {...props}\n />\n))\nDrawerTitle.displayName = 'DrawerTitle'\n\n// ─── DrawerDescription ─────────────────────────────────────\nconst DrawerDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-md text-text-muted', className)}\n {...props}\n />\n))\nDrawerDescription.displayName = 'DrawerDescription'\n\n// ─── DrawerBody ─────────────────────────────────────────────\nconst DrawerBody = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('flex-1 overflow-y-auto p-6', className)}\n {...props}\n />\n))\nDrawerBody.displayName = 'DrawerBody'\n\n// ─── DrawerFooter ───────────────────────────────────────────\nconst DrawerFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-end gap-3 p-6 pt-0',\n className\n )}\n {...props}\n />\n))\nDrawerFooter.displayName = 'DrawerFooter'\n\n// ─── Exports ────────────────────────────────────────────────\nexport {\n Drawer,\n DrawerTrigger,\n DrawerPortal,\n DrawerOverlay,\n DrawerContent,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n DrawerClose,\n drawerSizeHorizontal,\n drawerSizeVertical,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,sBAAiC;AACjC,sCAAuC;AACvC,mBAAmB;AAGnB,MAAM,mBAAmB,CAAC,EAAE,UAAU,MACpC;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAY;AAAA;AAAA,EAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAC9E;AAQF,MAAM,oBAAgD;AAAA,EACpD,OAAQ;AAAA,EACR,MAAQ;AAAA,EACR,KAAQ;AAAA,EACR,QAAQ;AACV;AAGA,MAAM,2BAAuB,qCAAI,IAAI;AAAA,EACnC,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAM;AAAA,MACN,IAAM;AAAA,MACN,IAAM;AAAA,MACN,IAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;AAED,MAAM,yBAAqB,qCAAI,IAAI;AAAA,EACjC,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAM;AAAA,MACN,IAAM;AAAA,MACN,IAAM;AAAA,MACN,IAAM;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import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const DefaultCloseIcon = ({ className }) => /* @__PURE__ */ React.createElement(
|
|
7
|
+
"svg",
|
|
8
|
+
{
|
|
9
|
+
className,
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: 2,
|
|
14
|
+
"aria-hidden": "true"
|
|
15
|
+
},
|
|
16
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
17
|
+
);
|
|
18
|
+
const ANIMATION_CLASSES = {
|
|
19
|
+
right: "data-[state=open]:animate-drawer-right-enter data-[state=closed]:animate-drawer-right-exit",
|
|
20
|
+
left: "data-[state=open]:animate-drawer-left-enter data-[state=closed]:animate-drawer-left-exit",
|
|
21
|
+
top: "data-[state=open]:animate-drawer-top-enter data-[state=closed]:animate-drawer-top-exit",
|
|
22
|
+
bottom: "data-[state=open]:animate-drawer-bottom-enter data-[state=closed]:animate-drawer-bottom-exit"
|
|
23
|
+
};
|
|
24
|
+
const drawerSizeHorizontal = cva("", {
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
sm: "w-[320px]",
|
|
28
|
+
md: "w-[400px]",
|
|
29
|
+
lg: "w-[480px]",
|
|
30
|
+
xl: "w-[640px]",
|
|
31
|
+
full: "w-full"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: { size: "md" }
|
|
35
|
+
});
|
|
36
|
+
const drawerSizeVertical = cva("", {
|
|
37
|
+
variants: {
|
|
38
|
+
size: {
|
|
39
|
+
sm: "h-[320px]",
|
|
40
|
+
md: "h-[400px]",
|
|
41
|
+
lg: "h-[480px]",
|
|
42
|
+
xl: "h-[640px]",
|
|
43
|
+
full: "h-full"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: { size: "md" }
|
|
47
|
+
});
|
|
48
|
+
function Drawer(props) {
|
|
49
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.Root, { ...props });
|
|
50
|
+
}
|
|
51
|
+
const DrawerTrigger = DialogPrimitive.Trigger;
|
|
52
|
+
const DrawerPortal = DialogPrimitive.Portal;
|
|
53
|
+
const DrawerClose = DialogPrimitive.Close;
|
|
54
|
+
const DrawerOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
55
|
+
DialogPrimitive.Overlay,
|
|
56
|
+
{
|
|
57
|
+
ref,
|
|
58
|
+
className: cn(
|
|
59
|
+
"fixed inset-0 z-overlay bg-black/50",
|
|
60
|
+
"data-[state=open]:animate-modal-overlay-enter data-[state=closed]:animate-modal-overlay-exit",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
...props
|
|
64
|
+
}
|
|
65
|
+
));
|
|
66
|
+
DrawerOverlay.displayName = "DrawerOverlay";
|
|
67
|
+
const SIDE_POSITION = {
|
|
68
|
+
right: "inset-y-0 right-0",
|
|
69
|
+
left: "inset-y-0 left-0",
|
|
70
|
+
top: "inset-x-0 top-0",
|
|
71
|
+
bottom: "inset-x-0 bottom-0"
|
|
72
|
+
};
|
|
73
|
+
const DrawerContent = React.forwardRef(({ className, children, side = "right", size = "md", showCloseButton = true, closeIcon, ...props }, ref) => {
|
|
74
|
+
const isHorizontal = side === "left" || side === "right";
|
|
75
|
+
const sizeClass = isHorizontal ? drawerSizeHorizontal({ size }) : drawerSizeVertical({ size });
|
|
76
|
+
return /* @__PURE__ */ React.createElement(DrawerPortal, null, /* @__PURE__ */ React.createElement(DrawerOverlay, null), /* @__PURE__ */ React.createElement(
|
|
77
|
+
DialogPrimitive.Content,
|
|
78
|
+
{
|
|
79
|
+
ref,
|
|
80
|
+
className: cn(
|
|
81
|
+
"fixed z-modal flex flex-col bg-background text-foreground shadow-xl",
|
|
82
|
+
"focus:outline-none",
|
|
83
|
+
SIDE_POSITION[side],
|
|
84
|
+
isHorizontal ? "max-w-full h-full" : "max-h-full w-full",
|
|
85
|
+
sizeClass,
|
|
86
|
+
ANIMATION_CLASSES[side],
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
...props
|
|
90
|
+
},
|
|
91
|
+
children,
|
|
92
|
+
showCloseButton && /* @__PURE__ */ React.createElement(DialogPrimitive.Close, { className: cn(
|
|
93
|
+
"absolute right-4 top-4 rounded-md p-1",
|
|
94
|
+
"text-text-muted hover:text-foreground",
|
|
95
|
+
"transition-colors duration-fast",
|
|
96
|
+
"focus-visible:focus-ring focus-visible:outline-none",
|
|
97
|
+
"disabled:pointer-events-none"
|
|
98
|
+
) }, closeIcon || /* @__PURE__ */ React.createElement(DefaultCloseIcon, { className: "icon-sm" }), /* @__PURE__ */ React.createElement("span", { className: "sr-only" }, "Close"))
|
|
99
|
+
));
|
|
100
|
+
});
|
|
101
|
+
DrawerContent.displayName = "DrawerContent";
|
|
102
|
+
const DrawerHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
className: cn("flex flex-col gap-1.5 p-6 pb-0", className),
|
|
107
|
+
...props
|
|
108
|
+
}
|
|
109
|
+
));
|
|
110
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
111
|
+
const DrawerTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
112
|
+
DialogPrimitive.Title,
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
));
|
|
119
|
+
DrawerTitle.displayName = "DrawerTitle";
|
|
120
|
+
const DrawerDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
121
|
+
DialogPrimitive.Description,
|
|
122
|
+
{
|
|
123
|
+
ref,
|
|
124
|
+
className: cn("text-md text-text-muted", className),
|
|
125
|
+
...props
|
|
126
|
+
}
|
|
127
|
+
));
|
|
128
|
+
DrawerDescription.displayName = "DrawerDescription";
|
|
129
|
+
const DrawerBody = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
ref,
|
|
133
|
+
className: cn("flex-1 overflow-y-auto p-6", className),
|
|
134
|
+
...props
|
|
135
|
+
}
|
|
136
|
+
));
|
|
137
|
+
DrawerBody.displayName = "DrawerBody";
|
|
138
|
+
const DrawerFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
ref,
|
|
142
|
+
className: cn(
|
|
143
|
+
"flex items-center justify-end gap-3 p-6 pt-0",
|
|
144
|
+
className
|
|
145
|
+
),
|
|
146
|
+
...props
|
|
147
|
+
}
|
|
148
|
+
));
|
|
149
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
150
|
+
export {
|
|
151
|
+
Drawer,
|
|
152
|
+
DrawerBody,
|
|
153
|
+
DrawerClose,
|
|
154
|
+
DrawerContent,
|
|
155
|
+
DrawerDescription,
|
|
156
|
+
DrawerFooter,
|
|
157
|
+
DrawerHeader,
|
|
158
|
+
DrawerOverlay,
|
|
159
|
+
DrawerPortal,
|
|
160
|
+
DrawerTitle,
|
|
161
|
+
DrawerTrigger,
|
|
162
|
+
drawerSizeHorizontal,
|
|
163
|
+
drawerSizeVertical
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=drawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/drawer.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type DrawerSide = 'left' | 'right' | 'top' | 'bottom'\nexport type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<DrawerSide, string> = {\n right: 'data-[state=open]:animate-drawer-right-enter data-[state=closed]:animate-drawer-right-exit',\n left: 'data-[state=open]:animate-drawer-left-enter data-[state=closed]:animate-drawer-left-exit',\n top: 'data-[state=open]:animate-drawer-top-enter data-[state=closed]:animate-drawer-top-exit',\n bottom: 'data-[state=open]:animate-drawer-bottom-enter data-[state=closed]:animate-drawer-bottom-exit',\n}\n\n// ─── Size variants ──────────────────────────────────────────\nconst drawerSizeHorizontal = cva('', {\n variants: {\n size: {\n sm: 'w-[320px]',\n md: 'w-[400px]',\n lg: 'w-[480px]',\n xl: 'w-[640px]',\n full: 'w-full',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\nconst drawerSizeVertical = cva('', {\n variants: {\n size: {\n sm: 'h-[320px]',\n md: 'h-[400px]',\n lg: 'h-[480px]',\n xl: 'h-[640px]',\n full: 'h-full',\n },\n },\n defaultVariants: { size: 'md' },\n})\n\n// ═══════════════════════════════════════════════════════════════\n// Drawer\n// ═══════════════════════════════════════════════════════════════\n\n// ─── Drawer (Root) — wrapper to keep our own component identity separate from DialogPrimitive.Root ──\nfunction Drawer(props: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root {...props} />\n}\n\n// ─── DrawerTrigger ──────────────────────────────────────────\nconst DrawerTrigger = DialogPrimitive.Trigger\n\n// ─── DrawerPortal ───────────────────────────────────────────\nconst DrawerPortal = DialogPrimitive.Portal\n\n// ─── DrawerClose ────────────────────────────────────────────\nconst DrawerClose = DialogPrimitive.Close\n\n// ─── DrawerOverlay ──────────────────────────────────────────\nconst DrawerOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-overlay bg-black/50',\n 'data-[state=open]:animate-modal-overlay-enter data-[state=closed]:animate-modal-overlay-exit',\n className\n )}\n {...props}\n />\n))\nDrawerOverlay.displayName = 'DrawerOverlay'\n\n// ─── DrawerContent ──────────────────────────────────────────\nexport interface DrawerContentProps\n extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, 'children'> {\n /** Side from which the drawer slides in */\n side?: DrawerSide\n /** Panel size (width for left/right, height for top/bottom) */\n size?: DrawerSize\n /** Show built-in close button */\n showCloseButton?: boolean\n /** Custom close icon (replaces default X) */\n closeIcon?: React.ReactNode\n children?: React.ReactNode\n}\n\nconst SIDE_POSITION: Record<DrawerSide, string> = {\n right: 'inset-y-0 right-0',\n left: 'inset-y-0 left-0',\n top: 'inset-x-0 top-0',\n bottom: 'inset-x-0 bottom-0',\n}\n\nconst DrawerContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DrawerContentProps\n>(({ className, children, side = 'right', size = 'md', showCloseButton = true, closeIcon, ...props }, ref) => {\n const isHorizontal = side === 'left' || side === 'right'\n const sizeClass = isHorizontal\n ? drawerSizeHorizontal({ size })\n : drawerSizeVertical({ size })\n\n return (\n <DrawerPortal>\n <DrawerOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed z-modal flex flex-col bg-background text-foreground shadow-xl',\n 'focus:outline-none',\n SIDE_POSITION[side],\n isHorizontal ? 'max-w-full h-full' : 'max-h-full w-full',\n sizeClass,\n ANIMATION_CLASSES[side],\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close className={cn(\n 'absolute right-4 top-4 rounded-md p-1',\n 'text-text-muted hover:text-foreground',\n 'transition-colors duration-fast',\n 'focus-visible:focus-ring focus-visible:outline-none',\n 'disabled:pointer-events-none'\n )}>\n {closeIcon || <DefaultCloseIcon className=\"icon-sm\" />}\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DrawerPortal>\n )\n})\nDrawerContent.displayName = 'DrawerContent'\n\n// ─── DrawerHeader ───────────────────────────────────────────\nconst DrawerHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('flex flex-col gap-1.5 p-6 pb-0', className)}\n {...props}\n />\n))\nDrawerHeader.displayName = 'DrawerHeader'\n\n// ─── DrawerTitle ────────────────────────────────────────────\nconst DrawerTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-lg font-semibold text-foreground', className)}\n {...props}\n />\n))\nDrawerTitle.displayName = 'DrawerTitle'\n\n// ─── DrawerDescription ─────────────────────────────────────\nconst DrawerDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-md text-text-muted', className)}\n {...props}\n />\n))\nDrawerDescription.displayName = 'DrawerDescription'\n\n// ─── DrawerBody ─────────────────────────────────────────────\nconst DrawerBody = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn('flex-1 overflow-y-auto p-6', className)}\n {...props}\n />\n))\nDrawerBody.displayName = 'DrawerBody'\n\n// ─── DrawerFooter ───────────────────────────────────────────\nconst DrawerFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-end gap-3 p-6 pt-0',\n className\n )}\n {...props}\n />\n))\nDrawerFooter.displayName = 'DrawerFooter'\n\n// ─── Exports ────────────────────────────────────────────────\nexport {\n Drawer,\n DrawerTrigger,\n DrawerPortal,\n DrawerOverlay,\n DrawerContent,\n DrawerHeader,\n DrawerTitle,\n DrawerDescription,\n DrawerBody,\n DrawerFooter,\n DrawerClose,\n drawerSizeHorizontal,\n drawerSizeVertical,\n}\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,qBAAqB;AACjC,SAAS,WAA8B;AACvC,SAAS,UAAU;AAGnB,MAAM,mBAAmB,CAAC,EAAE,UAAU,MACpC;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAY;AAAA;AAAA,EAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAC9E;AAQF,MAAM,oBAAgD;AAAA,EACpD,OAAQ;AAAA,EACR,MAAQ;AAAA,EACR,KAAQ;AAAA,EACR,QAAQ;AACV;AAGA,MAAM,uBAAuB,IAAI,IAAI;AAAA,EACnC,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAM;AAAA,MACN,IAAM;AAAA,MACN,IAAM;AAAA,MACN,IAAM;AAAA,MACN,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;AAED,MAAM,qBAAqB,IAAI,IAAI;AAAA,EACjC,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IA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