@spawn-llc/design-system 1.1.1 → 1.2.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/dist/chunk-227VGN2D.js +617 -0
- package/dist/chunk-2UK4FHS3.js +31 -0
- package/dist/chunk-36NOAJFW.js +53 -0
- package/dist/chunk-3EZ5FFYG.js +154 -0
- package/dist/chunk-3PN2XMRA.js +80 -0
- package/dist/chunk-3SLZRFKQ.js +107 -0
- package/dist/chunk-4ABNKOPC.js +18 -0
- package/dist/chunk-4IKPZU4X.js +34 -0
- package/dist/chunk-5YRMB7KW.js +31 -0
- package/dist/chunk-66R4755B.js +37 -0
- package/dist/chunk-ATBQXQM7.js +165 -0
- package/dist/chunk-AUWFUYJI.js +79 -0
- package/dist/chunk-BTGJV2P6.js +237 -0
- package/dist/chunk-BYJWYU66.js +95 -0
- package/dist/chunk-D6UXXTC6.js +18 -0
- package/dist/chunk-DFVSGTAN.js +24 -0
- package/dist/chunk-DQ52UWO2.js +28 -0
- package/dist/chunk-DXXFNPYR.js +20 -0
- package/dist/chunk-GBPD3QPO.js +60 -0
- package/dist/chunk-GHSVAEXO.js +227 -0
- package/dist/chunk-GQIUVLXP.js +42 -0
- package/dist/chunk-HG4AEMA5.js +74 -0
- package/dist/chunk-HK6P54FZ.js +139 -0
- package/dist/chunk-HSP43BHH.js +97 -0
- package/dist/chunk-HYBBZTLY.js +1 -0
- package/dist/chunk-IS2ZVRUW.js +186 -0
- package/dist/chunk-JSULEEYQ.js +9 -0
- package/dist/chunk-K46NYJUT.js +15 -0
- package/dist/chunk-L5SMHZJL.js +162 -0
- package/dist/chunk-LPPLLYOR.js +185 -0
- package/dist/chunk-LYDG55X2.js +194 -0
- package/dist/chunk-MLC45YHE.js +122 -0
- package/dist/chunk-MZEY2L46.js +186 -0
- package/dist/chunk-N34HFTEJ.js +22 -0
- package/dist/chunk-PPW4C342.js +232 -0
- package/dist/chunk-PZCXY6QZ.js +208 -0
- package/dist/chunk-Q3HD7YQZ.js +261 -0
- package/dist/chunk-QF7LZKLC.js +98 -0
- package/dist/chunk-QNUAUOJW.js +15 -0
- package/dist/chunk-QZSQXEOU.js +28 -0
- package/dist/chunk-RBTFEYGV.js +77 -0
- package/dist/chunk-SJMEO63M.js +116 -0
- package/dist/chunk-T6DWCVR3.js +73 -0
- package/dist/chunk-T7GS4AXQ.js +245 -0
- package/dist/chunk-TP35WWVP.js +46 -0
- package/dist/chunk-TQ6CJZMT.js +42 -0
- package/dist/chunk-U7N2A7A3.js +9 -0
- package/dist/chunk-V3NRC7QE.js +142 -0
- package/dist/chunk-VOHNOSMH.js +22 -0
- package/dist/chunk-W3PHWPYP.js +43 -0
- package/dist/chunk-WJ6DNG2Z.js +75 -0
- package/dist/chunk-WMXCMDSQ.js +126 -0
- package/dist/chunk-WSNSTJAR.js +58 -0
- package/dist/chunk-XG3HHC3U.js +79 -0
- package/dist/chunk-XOLQ37I2.js +118 -0
- package/dist/chunk-YFPY5SLS.js +19 -0
- package/dist/chunk-YFVERFQA.js +76 -0
- package/dist/chunk-YL4VCJKF.js +75 -0
- package/dist/chunk-ZMHTPZVQ.js +61 -0
- package/dist/chunk-ZO74KVH3.js +38 -0
- package/dist/components/ui/accordion.d.ts +9 -0
- package/dist/components/ui/accordion.js +3 -0
- package/dist/components/ui/alert-dialog.d.ts +24 -0
- package/dist/components/ui/alert-dialog.js +5 -0
- package/dist/components/ui/alert.d.ts +13 -0
- package/dist/components/ui/alert.js +3 -0
- package/dist/components/ui/aspect-ratio.d.ts +7 -0
- package/dist/components/ui/aspect-ratio.js +3 -0
- package/dist/components/ui/avatar.d.ts +13 -0
- package/dist/components/ui/avatar.js +3 -0
- package/dist/components/ui/badge.d.ts +11 -0
- package/dist/components/ui/badge.js +3 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.js +3 -0
- package/dist/components/ui/button-group.d.ts +15 -0
- package/dist/components/ui/button-group.js +4 -0
- package/dist/components/ui/button.d.ts +9 -0
- package/dist/components/ui/button.js +4 -0
- package/dist/components/ui/calendar.d.ts +16 -0
- package/dist/components/ui/calendar.js +5 -0
- package/dist/components/ui/card.d.ts +13 -0
- package/dist/components/ui/card.js +3 -0
- package/dist/components/ui/carousel.d.ts +34 -0
- package/dist/components/ui/carousel.js +5 -0
- package/dist/components/ui/chart.d.ts +46 -0
- package/dist/components/ui/chart.js +3 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.js +3 -0
- package/dist/components/ui/collapsible.d.ts +8 -0
- package/dist/components/ui/collapsible.js +2 -0
- package/dist/components/ui/combobox.d.ts +26 -0
- package/dist/components/ui/combobox.js +8 -0
- package/dist/components/ui/command.d.ts +22 -0
- package/dist/components/ui/command.js +9 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +3 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dialog.js +5 -0
- package/dist/components/ui/direction.d.ts +1 -0
- package/dist/components/ui/direction.js +2 -0
- package/dist/components/ui/drawer.d.ts +15 -0
- package/dist/components/ui/drawer.js +3 -0
- package/dist/components/ui/dropdown-menu.d.ts +31 -0
- package/dist/components/ui/dropdown-menu.js +3 -0
- package/dist/components/ui/empty.d.ts +15 -0
- package/dist/components/ui/empty.js +3 -0
- package/dist/components/ui/field.d.ts +28 -0
- package/dist/components/ui/field.js +5 -0
- package/dist/components/ui/hover-card.d.ts +8 -0
- package/dist/components/ui/hover-card.js +3 -0
- package/dist/components/ui/input-group.d.ts +23 -0
- package/dist/components/ui/input-group.js +7 -0
- package/dist/components/ui/input-otp.d.ts +13 -0
- package/dist/components/ui/input-otp.js +3 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +3 -0
- package/dist/components/ui/item.d.ts +26 -0
- package/dist/components/ui/item.js +4 -0
- package/dist/components/ui/kbd.d.ts +6 -0
- package/dist/components/ui/kbd.js +3 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.js +3 -0
- package/dist/components/ui/logo.d.ts +17 -0
- package/dist/components/ui/logo.js +3 -0
- package/dist/components/ui/menubar.d.ts +31 -0
- package/dist/components/ui/menubar.js +4 -0
- package/dist/components/ui/native-select.d.ts +10 -0
- package/dist/components/ui/native-select.js +3 -0
- package/dist/components/ui/navigation-menu.d.ts +15 -0
- package/dist/components/ui/navigation-menu.js +3 -0
- package/dist/components/ui/pagination.d.ts +23 -0
- package/dist/components/ui/pagination.js +5 -0
- package/dist/components/ui/popover.d.ts +11 -0
- package/dist/components/ui/popover.js +3 -0
- package/dist/components/ui/progress.d.ts +10 -0
- package/dist/components/ui/progress.js +3 -0
- package/dist/components/ui/radio-group.d.ts +8 -0
- package/dist/components/ui/radio-group.js +3 -0
- package/dist/components/ui/resizable.d.ts +10 -0
- package/dist/components/ui/resizable.js +3 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.js +3 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +3 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/separator.js +3 -0
- package/dist/components/ui/sheet.d.ts +16 -0
- package/dist/components/ui/sheet.js +5 -0
- package/dist/components/ui/sidebar.d.ts +70 -0
- package/dist/components/ui/sidebar.js +11 -0
- package/dist/components/ui/skeleton.d.ts +5 -0
- package/dist/components/ui/skeleton.js +3 -0
- package/dist/components/ui/slider.d.ts +6 -0
- package/dist/components/ui/slider.js +3 -0
- package/dist/components/ui/sonner.d.ts +6 -0
- package/dist/components/ui/sonner.js +2 -0
- package/dist/components/ui/spinner.d.ts +5 -0
- package/dist/components/ui/spinner.js +3 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/switch.js +3 -0
- package/dist/components/ui/table.d.ts +12 -0
- package/dist/components/ui/table.js +3 -0
- package/dist/components/ui/tabs.d.ts +14 -0
- package/dist/components/ui/tabs.js +3 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.js +3 -0
- package/dist/components/ui/toggle-group.d.ts +14 -0
- package/dist/components/ui/toggle-group.js +4 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +3 -0
- package/dist/components/ui/tooltip.d.ts +9 -0
- package/dist/components/ui/tooltip.js +3 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +2 -0
- package/dist/index.d.ts +98 -640
- package/dist/index.js +60 -5573
- package/dist/lib/button-variants.d.ts +17 -0
- package/dist/lib/button-variants.js +1 -0
- package/dist/lib/contrast.d.ts +9 -0
- package/dist/lib/contrast.js +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/variants.d.ts +3 -0
- package/dist/variants.js +1 -0
- package/package.json +13 -5
- /package/dist/{tokens.d.ts → tokens.generated.d.ts} +0 -0
- /package/dist/{tokens.js → tokens.generated.js} +0 -0
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
import { TooltipTrigger, Tooltip, TooltipContent } from './chunk-GBPD3QPO.js';
|
|
2
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription } from './chunk-WMXCMDSQ.js';
|
|
3
|
+
import { Skeleton } from './chunk-QNUAUOJW.js';
|
|
4
|
+
import { Input } from './chunk-DXXFNPYR.js';
|
|
5
|
+
import { Button } from './chunk-N34HFTEJ.js';
|
|
6
|
+
import { Separator } from './chunk-DFVSGTAN.js';
|
|
7
|
+
import { useIsMobile } from './chunk-YFPY5SLS.js';
|
|
8
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
11
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
12
|
+
import { cva } from 'class-variance-authority';
|
|
13
|
+
import { PanelLeftIcon } from 'lucide-react';
|
|
14
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
17
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
18
|
+
var SIDEBAR_WIDTH = "16rem";
|
|
19
|
+
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
20
|
+
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
21
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
22
|
+
var SidebarContext = React.createContext(null);
|
|
23
|
+
function useSidebar() {
|
|
24
|
+
const context = React.useContext(SidebarContext);
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
27
|
+
}
|
|
28
|
+
return context;
|
|
29
|
+
}
|
|
30
|
+
function SidebarProvider({
|
|
31
|
+
defaultOpen = true,
|
|
32
|
+
open: openProp,
|
|
33
|
+
onOpenChange: setOpenProp,
|
|
34
|
+
className,
|
|
35
|
+
style,
|
|
36
|
+
children,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
const isMobile = useIsMobile();
|
|
40
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
41
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
42
|
+
const open = openProp ?? _open;
|
|
43
|
+
const setOpen = React.useCallback(
|
|
44
|
+
(value) => {
|
|
45
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
46
|
+
if (setOpenProp) {
|
|
47
|
+
setOpenProp(openState);
|
|
48
|
+
} else {
|
|
49
|
+
_setOpen(openState);
|
|
50
|
+
}
|
|
51
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
52
|
+
},
|
|
53
|
+
[setOpenProp, open]
|
|
54
|
+
);
|
|
55
|
+
const toggleSidebar = React.useCallback(() => {
|
|
56
|
+
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
57
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
const handleKeyDown = (event) => {
|
|
60
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
toggleSidebar();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
66
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
67
|
+
}, [toggleSidebar]);
|
|
68
|
+
const state = open ? "expanded" : "collapsed";
|
|
69
|
+
const contextValue = React.useMemo(
|
|
70
|
+
() => ({
|
|
71
|
+
state,
|
|
72
|
+
open,
|
|
73
|
+
setOpen,
|
|
74
|
+
isMobile,
|
|
75
|
+
openMobile,
|
|
76
|
+
setOpenMobile,
|
|
77
|
+
toggleSidebar
|
|
78
|
+
}),
|
|
79
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
80
|
+
);
|
|
81
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
"data-slot": "sidebar-wrapper",
|
|
85
|
+
style: {
|
|
86
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
87
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
88
|
+
...style
|
|
89
|
+
},
|
|
90
|
+
className: cn(
|
|
91
|
+
"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
|
|
92
|
+
className
|
|
93
|
+
),
|
|
94
|
+
...props,
|
|
95
|
+
children
|
|
96
|
+
}
|
|
97
|
+
) });
|
|
98
|
+
}
|
|
99
|
+
function Sidebar({
|
|
100
|
+
side = "left",
|
|
101
|
+
variant = "sidebar",
|
|
102
|
+
collapsible = "offcanvas",
|
|
103
|
+
className,
|
|
104
|
+
children,
|
|
105
|
+
dir,
|
|
106
|
+
...props
|
|
107
|
+
}) {
|
|
108
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
109
|
+
if (collapsible === "none") {
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
"data-slot": "sidebar",
|
|
114
|
+
className: cn(
|
|
115
|
+
"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
|
|
116
|
+
className
|
|
117
|
+
),
|
|
118
|
+
...props,
|
|
119
|
+
children
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
if (isMobile) {
|
|
124
|
+
return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
|
|
125
|
+
SheetContent,
|
|
126
|
+
{
|
|
127
|
+
dir,
|
|
128
|
+
"data-sidebar": "sidebar",
|
|
129
|
+
"data-slot": "sidebar",
|
|
130
|
+
"data-mobile": "true",
|
|
131
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
132
|
+
style: {
|
|
133
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
134
|
+
},
|
|
135
|
+
side,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsxs(SheetHeader, { className: "sr-only", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }),
|
|
139
|
+
/* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
) });
|
|
145
|
+
}
|
|
146
|
+
return /* @__PURE__ */ jsxs(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
150
|
+
"data-state": state,
|
|
151
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
152
|
+
"data-variant": variant,
|
|
153
|
+
"data-side": side,
|
|
154
|
+
"data-slot": "sidebar",
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsx(
|
|
157
|
+
"div",
|
|
158
|
+
{
|
|
159
|
+
"data-slot": "sidebar-gap",
|
|
160
|
+
className: cn(
|
|
161
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
162
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
163
|
+
"group-data-[side=right]:rotate-180",
|
|
164
|
+
variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
"div",
|
|
170
|
+
{
|
|
171
|
+
"data-slot": "sidebar-container",
|
|
172
|
+
"data-side": side,
|
|
173
|
+
className: cn(
|
|
174
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",
|
|
175
|
+
// Adjust the padding for floating and inset variants.
|
|
176
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
177
|
+
className
|
|
178
|
+
),
|
|
179
|
+
...props,
|
|
180
|
+
children: /* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
"data-sidebar": "sidebar",
|
|
184
|
+
"data-slot": "sidebar-inner",
|
|
185
|
+
className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",
|
|
186
|
+
children
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
function SidebarTrigger({
|
|
196
|
+
className,
|
|
197
|
+
onClick,
|
|
198
|
+
...props
|
|
199
|
+
}) {
|
|
200
|
+
const { toggleSidebar } = useSidebar();
|
|
201
|
+
return /* @__PURE__ */ jsxs(
|
|
202
|
+
Button,
|
|
203
|
+
{
|
|
204
|
+
"data-sidebar": "trigger",
|
|
205
|
+
"data-slot": "sidebar-trigger",
|
|
206
|
+
variant: "ghost",
|
|
207
|
+
size: "icon-sm",
|
|
208
|
+
className: cn(className),
|
|
209
|
+
onClick: (event) => {
|
|
210
|
+
onClick?.(event);
|
|
211
|
+
toggleSidebar();
|
|
212
|
+
},
|
|
213
|
+
...props,
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsx(PanelLeftIcon, {}),
|
|
216
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
function SidebarRail({ className, ...props }) {
|
|
222
|
+
const { toggleSidebar } = useSidebar();
|
|
223
|
+
return /* @__PURE__ */ jsx(
|
|
224
|
+
"button",
|
|
225
|
+
{
|
|
226
|
+
"data-sidebar": "rail",
|
|
227
|
+
"data-slot": "sidebar-rail",
|
|
228
|
+
"aria-label": "Toggle Sidebar",
|
|
229
|
+
tabIndex: -1,
|
|
230
|
+
onClick: toggleSidebar,
|
|
231
|
+
title: "Toggle Sidebar",
|
|
232
|
+
className: cn(
|
|
233
|
+
"absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
|
|
234
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
235
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
236
|
+
"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
|
|
237
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
238
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
239
|
+
className
|
|
240
|
+
),
|
|
241
|
+
...props
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
function SidebarInset({ className, ...props }) {
|
|
246
|
+
return /* @__PURE__ */ jsx(
|
|
247
|
+
"main",
|
|
248
|
+
{
|
|
249
|
+
"data-slot": "sidebar-inset",
|
|
250
|
+
className: cn(
|
|
251
|
+
"relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
|
|
252
|
+
className
|
|
253
|
+
),
|
|
254
|
+
...props
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
function SidebarInput({
|
|
259
|
+
className,
|
|
260
|
+
...props
|
|
261
|
+
}) {
|
|
262
|
+
return /* @__PURE__ */ jsx(
|
|
263
|
+
Input,
|
|
264
|
+
{
|
|
265
|
+
"data-slot": "sidebar-input",
|
|
266
|
+
"data-sidebar": "input",
|
|
267
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
268
|
+
...props
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function SidebarHeader({ className, ...props }) {
|
|
273
|
+
return /* @__PURE__ */ jsx(
|
|
274
|
+
"div",
|
|
275
|
+
{
|
|
276
|
+
"data-slot": "sidebar-header",
|
|
277
|
+
"data-sidebar": "header",
|
|
278
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
279
|
+
...props
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
function SidebarFooter({ className, ...props }) {
|
|
284
|
+
return /* @__PURE__ */ jsx(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
"data-slot": "sidebar-footer",
|
|
288
|
+
"data-sidebar": "footer",
|
|
289
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
290
|
+
...props
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
function SidebarSeparator({
|
|
295
|
+
className,
|
|
296
|
+
...props
|
|
297
|
+
}) {
|
|
298
|
+
return /* @__PURE__ */ jsx(
|
|
299
|
+
Separator,
|
|
300
|
+
{
|
|
301
|
+
"data-slot": "sidebar-separator",
|
|
302
|
+
"data-sidebar": "separator",
|
|
303
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
304
|
+
...props
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
function SidebarContent({ className, ...props }) {
|
|
309
|
+
return /* @__PURE__ */ jsx(
|
|
310
|
+
"div",
|
|
311
|
+
{
|
|
312
|
+
"data-slot": "sidebar-content",
|
|
313
|
+
"data-sidebar": "content",
|
|
314
|
+
className: cn(
|
|
315
|
+
"no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
316
|
+
className
|
|
317
|
+
),
|
|
318
|
+
...props
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
function SidebarGroup({ className, ...props }) {
|
|
323
|
+
return /* @__PURE__ */ jsx(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
"data-slot": "sidebar-group",
|
|
327
|
+
"data-sidebar": "group",
|
|
328
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
329
|
+
...props
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
function SidebarGroupLabel({
|
|
334
|
+
className,
|
|
335
|
+
render,
|
|
336
|
+
...props
|
|
337
|
+
}) {
|
|
338
|
+
return useRender({
|
|
339
|
+
defaultTagName: "div",
|
|
340
|
+
props: mergeProps(
|
|
341
|
+
{
|
|
342
|
+
className: cn(
|
|
343
|
+
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
344
|
+
className
|
|
345
|
+
)
|
|
346
|
+
},
|
|
347
|
+
props
|
|
348
|
+
),
|
|
349
|
+
render,
|
|
350
|
+
state: {
|
|
351
|
+
slot: "sidebar-group-label",
|
|
352
|
+
sidebar: "group-label"
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function SidebarGroupAction({
|
|
357
|
+
className,
|
|
358
|
+
render,
|
|
359
|
+
...props
|
|
360
|
+
}) {
|
|
361
|
+
return useRender({
|
|
362
|
+
defaultTagName: "button",
|
|
363
|
+
props: mergeProps(
|
|
364
|
+
{
|
|
365
|
+
className: cn(
|
|
366
|
+
"absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
|
|
367
|
+
className
|
|
368
|
+
)
|
|
369
|
+
},
|
|
370
|
+
props
|
|
371
|
+
),
|
|
372
|
+
render,
|
|
373
|
+
state: {
|
|
374
|
+
slot: "sidebar-group-action",
|
|
375
|
+
sidebar: "group-action"
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
function SidebarGroupContent({
|
|
380
|
+
className,
|
|
381
|
+
...props
|
|
382
|
+
}) {
|
|
383
|
+
return /* @__PURE__ */ jsx(
|
|
384
|
+
"div",
|
|
385
|
+
{
|
|
386
|
+
"data-slot": "sidebar-group-content",
|
|
387
|
+
"data-sidebar": "group-content",
|
|
388
|
+
className: cn("w-full text-sm", className),
|
|
389
|
+
...props
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
function SidebarMenu({ className, ...props }) {
|
|
394
|
+
return /* @__PURE__ */ jsx(
|
|
395
|
+
"ul",
|
|
396
|
+
{
|
|
397
|
+
"data-slot": "sidebar-menu",
|
|
398
|
+
"data-sidebar": "menu",
|
|
399
|
+
className: cn("flex w-full min-w-0 flex-col gap-0", className),
|
|
400
|
+
...props
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
405
|
+
return /* @__PURE__ */ jsx(
|
|
406
|
+
"li",
|
|
407
|
+
{
|
|
408
|
+
"data-slot": "sidebar-menu-item",
|
|
409
|
+
"data-sidebar": "menu-item",
|
|
410
|
+
className: cn("group/menu-item relative", className),
|
|
411
|
+
...props
|
|
412
|
+
}
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
var sidebarMenuButtonVariants = cva(
|
|
416
|
+
"peer/menu-button group/menu-button relative flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:before:absolute data-active:before:left-0 data-active:before:inset-y-1 data-active:before:w-[3px] data-active:before:bg-sidebar-primary [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
|
|
417
|
+
{
|
|
418
|
+
variants: {
|
|
419
|
+
variant: {
|
|
420
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
421
|
+
outline: "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"
|
|
422
|
+
},
|
|
423
|
+
size: {
|
|
424
|
+
default: "h-8 text-sm",
|
|
425
|
+
sm: "h-7 text-xs",
|
|
426
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
defaultVariants: {
|
|
430
|
+
variant: "default",
|
|
431
|
+
size: "default"
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
);
|
|
435
|
+
function SidebarMenuButton({
|
|
436
|
+
render,
|
|
437
|
+
isActive = false,
|
|
438
|
+
variant = "default",
|
|
439
|
+
size = "default",
|
|
440
|
+
tooltip,
|
|
441
|
+
className,
|
|
442
|
+
...props
|
|
443
|
+
}) {
|
|
444
|
+
const { isMobile, state } = useSidebar();
|
|
445
|
+
const comp = useRender({
|
|
446
|
+
defaultTagName: "button",
|
|
447
|
+
props: mergeProps(
|
|
448
|
+
{
|
|
449
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className)
|
|
450
|
+
},
|
|
451
|
+
props
|
|
452
|
+
),
|
|
453
|
+
render: !tooltip ? render : /* @__PURE__ */ jsx(TooltipTrigger, { render }),
|
|
454
|
+
state: {
|
|
455
|
+
slot: "sidebar-menu-button",
|
|
456
|
+
sidebar: "menu-button",
|
|
457
|
+
size,
|
|
458
|
+
active: isActive
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
if (!tooltip) {
|
|
462
|
+
return comp;
|
|
463
|
+
}
|
|
464
|
+
if (typeof tooltip === "string") {
|
|
465
|
+
tooltip = {
|
|
466
|
+
children: tooltip
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
470
|
+
comp,
|
|
471
|
+
/* @__PURE__ */ jsx(
|
|
472
|
+
TooltipContent,
|
|
473
|
+
{
|
|
474
|
+
side: "right",
|
|
475
|
+
align: "center",
|
|
476
|
+
hidden: state !== "collapsed" || isMobile,
|
|
477
|
+
...tooltip
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
] });
|
|
481
|
+
}
|
|
482
|
+
function SidebarMenuAction({
|
|
483
|
+
className,
|
|
484
|
+
render,
|
|
485
|
+
showOnHover = false,
|
|
486
|
+
...props
|
|
487
|
+
}) {
|
|
488
|
+
return useRender({
|
|
489
|
+
defaultTagName: "button",
|
|
490
|
+
props: mergeProps(
|
|
491
|
+
{
|
|
492
|
+
className: cn(
|
|
493
|
+
"absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
|
|
494
|
+
showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",
|
|
495
|
+
className
|
|
496
|
+
)
|
|
497
|
+
},
|
|
498
|
+
props
|
|
499
|
+
),
|
|
500
|
+
render,
|
|
501
|
+
state: {
|
|
502
|
+
slot: "sidebar-menu-action",
|
|
503
|
+
sidebar: "menu-action"
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
function SidebarMenuBadge({
|
|
508
|
+
className,
|
|
509
|
+
...props
|
|
510
|
+
}) {
|
|
511
|
+
return /* @__PURE__ */ jsx(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
"data-slot": "sidebar-menu-badge",
|
|
515
|
+
"data-sidebar": "menu-badge",
|
|
516
|
+
className: cn(
|
|
517
|
+
"pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",
|
|
518
|
+
className
|
|
519
|
+
),
|
|
520
|
+
...props
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
function SidebarMenuSkeleton({
|
|
525
|
+
className,
|
|
526
|
+
showIcon = false,
|
|
527
|
+
...props
|
|
528
|
+
}) {
|
|
529
|
+
const [width] = React.useState(() => {
|
|
530
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
531
|
+
});
|
|
532
|
+
return /* @__PURE__ */ jsxs(
|
|
533
|
+
"div",
|
|
534
|
+
{
|
|
535
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
536
|
+
"data-sidebar": "menu-skeleton",
|
|
537
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
538
|
+
...props,
|
|
539
|
+
children: [
|
|
540
|
+
showIcon && /* @__PURE__ */ jsx(
|
|
541
|
+
Skeleton,
|
|
542
|
+
{
|
|
543
|
+
className: "size-4 rounded-md",
|
|
544
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
/* @__PURE__ */ jsx(
|
|
548
|
+
Skeleton,
|
|
549
|
+
{
|
|
550
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
551
|
+
"data-sidebar": "menu-skeleton-text",
|
|
552
|
+
style: {
|
|
553
|
+
"--skeleton-width": width
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
562
|
+
return /* @__PURE__ */ jsx(
|
|
563
|
+
"ul",
|
|
564
|
+
{
|
|
565
|
+
"data-slot": "sidebar-menu-sub",
|
|
566
|
+
"data-sidebar": "menu-sub",
|
|
567
|
+
className: cn(
|
|
568
|
+
"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",
|
|
569
|
+
className
|
|
570
|
+
),
|
|
571
|
+
...props
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
function SidebarMenuSubItem({
|
|
576
|
+
className,
|
|
577
|
+
...props
|
|
578
|
+
}) {
|
|
579
|
+
return /* @__PURE__ */ jsx(
|
|
580
|
+
"li",
|
|
581
|
+
{
|
|
582
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
583
|
+
"data-sidebar": "menu-sub-item",
|
|
584
|
+
className: cn("group/menu-sub-item relative", className),
|
|
585
|
+
...props
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
function SidebarMenuSubButton({
|
|
590
|
+
render,
|
|
591
|
+
size = "md",
|
|
592
|
+
isActive = false,
|
|
593
|
+
className,
|
|
594
|
+
...props
|
|
595
|
+
}) {
|
|
596
|
+
return useRender({
|
|
597
|
+
defaultTagName: "a",
|
|
598
|
+
props: mergeProps(
|
|
599
|
+
{
|
|
600
|
+
className: cn(
|
|
601
|
+
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
|
|
602
|
+
className
|
|
603
|
+
)
|
|
604
|
+
},
|
|
605
|
+
props
|
|
606
|
+
),
|
|
607
|
+
render,
|
|
608
|
+
state: {
|
|
609
|
+
slot: "sidebar-menu-sub-button",
|
|
610
|
+
sidebar: "menu-sub-button",
|
|
611
|
+
size,
|
|
612
|
+
active: isActive
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
3
|
+
import { CheckIcon } from 'lucide-react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Checkbox({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Checkbox$1.Root,
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "checkbox",
|
|
11
|
+
className: cn(
|
|
12
|
+
"peer relative flex size-4 shrink-0 items-center justify-center rounded-[2px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx(
|
|
17
|
+
Checkbox$1.Indicator,
|
|
18
|
+
{
|
|
19
|
+
"data-slot": "checkbox-indicator",
|
|
20
|
+
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
21
|
+
children: /* @__PURE__ */ jsx(
|
|
22
|
+
CheckIcon,
|
|
23
|
+
{}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Checkbox };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
|
+
import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function Slider({
|
|
6
|
+
className,
|
|
7
|
+
defaultValue,
|
|
8
|
+
value,
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
const _values = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max];
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Slider$1.Root,
|
|
16
|
+
{
|
|
17
|
+
className: cn("data-horizontal:w-full data-vertical:h-full", className),
|
|
18
|
+
"data-slot": "slider",
|
|
19
|
+
defaultValue,
|
|
20
|
+
value,
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
thumbAlignment: "edge",
|
|
24
|
+
...props,
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Control, { className: "relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(
|
|
27
|
+
Slider$1.Track,
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "slider-track",
|
|
30
|
+
className: "relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
31
|
+
children: /* @__PURE__ */ jsx(
|
|
32
|
+
Slider$1.Indicator,
|
|
33
|
+
{
|
|
34
|
+
"data-slot": "slider-range",
|
|
35
|
+
className: "bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
|
|
41
|
+
Slider$1.Thumb,
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "slider-thumb",
|
|
44
|
+
className: "relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"
|
|
45
|
+
},
|
|
46
|
+
index
|
|
47
|
+
))
|
|
48
|
+
] })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { Slider };
|