xiod-ui 1.0.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/LICENSE +73 -0
- package/README.md +167 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +46 -0
- package/dist/components/agent-steps.d.ts +47 -0
- package/dist/components/agent-steps.js +223 -0
- package/dist/components/alert-dialog.d.ts +21 -0
- package/dist/components/alert-dialog.js +74 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +45 -0
- package/dist/components/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio.js +22 -0
- package/dist/components/autocomplete.d.ts +35 -0
- package/dist/components/autocomplete.js +160 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +65 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +46 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +45 -0
- package/dist/components/button-split.d.ts +19 -0
- package/dist/components/button-split.js +73 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +54 -0
- package/dist/components/calendar.d.ts +63 -0
- package/dist/components/calendar.js +425 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +139 -0
- package/dist/components/carousel.d.ts +59 -0
- package/dist/components/carousel.js +503 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +86 -0
- package/dist/components/circular-progress.d.ts +28 -0
- package/dist/components/circular-progress.js +127 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/color-picker.d.ts +159 -0
- package/dist/components/color-picker.js +1589 -0
- package/dist/components/combobox.d.ts +46 -0
- package/dist/components/combobox.js +237 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +129 -0
- package/dist/components/context-menu.d.ts +38 -0
- package/dist/components/context-menu.js +164 -0
- package/dist/components/copy-to-clipboard.d.ts +32 -0
- package/dist/components/copy-to-clipboard.js +83 -0
- package/dist/components/corner-badge.d.ts +22 -0
- package/dist/components/corner-badge.js +84 -0
- package/dist/components/dashboard-grid.d.ts +83 -0
- package/dist/components/dashboard-grid.js +486 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +261 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +97 -0
- package/dist/components/dot-matrix.d.ts +32 -0
- package/dist/components/dot-matrix.js +707 -0
- package/dist/components/draggable.d.ts +42 -0
- package/dist/components/draggable.js +346 -0
- package/dist/components/drawer.d.ts +66 -0
- package/dist/components/drawer.js +304 -0
- package/dist/components/empty.d.ts +14 -0
- package/dist/components/empty.js +75 -0
- package/dist/components/field.d.ts +12 -0
- package/dist/components/field.js +44 -0
- package/dist/components/fieldset.d.ts +7 -0
- package/dist/components/fieldset.js +21 -0
- package/dist/components/file-upload.d.ts +61 -0
- package/dist/components/file-upload.js +482 -0
- package/dist/components/form.d.ts +6 -0
- package/dist/components/form.js +14 -0
- package/dist/components/frame.d.ts +10 -0
- package/dist/components/frame.js +47 -0
- package/dist/components/gauge.d.ts +27 -0
- package/dist/components/gauge.js +74 -0
- package/dist/components/grid.d.ts +26 -0
- package/dist/components/grid.js +204 -0
- package/dist/components/group.d.ts +19 -0
- package/dist/components/group.js +45 -0
- package/dist/components/input-group.d.ts +15 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +50 -0
- package/dist/components/input-payment.d.ts +131 -0
- package/dist/components/input-payment.js +1140 -0
- package/dist/components/input-phone.d.ts +70 -0
- package/dist/components/input-phone.js +657 -0
- package/dist/components/input-sensitive.d.ts +12 -0
- package/dist/components/input-sensitive.js +169 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.js +26 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +19 -0
- package/dist/components/kinetic-click.d.ts +48 -0
- package/dist/components/kinetic-click.js +1184 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +18 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.js +148 -0
- package/dist/components/loader.d.ts +13 -0
- package/dist/components/loader.js +430 -0
- package/dist/components/marker.d.ts +15 -0
- package/dist/components/marker.js +59 -0
- package/dist/components/menu.d.ts +42 -0
- package/dist/components/menu.js +186 -0
- package/dist/components/menubar.d.ts +40 -0
- package/dist/components/menubar.js +107 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +112 -0
- package/dist/components/meter.d.ts +10 -0
- package/dist/components/meter.js +42 -0
- package/dist/components/morphic-toast.d.ts +61 -0
- package/dist/components/morphic-toast.js +916 -0
- package/dist/components/navigation-menu.d.ts +26 -0
- package/dist/components/navigation-menu.js +116 -0
- package/dist/components/number-field.d.ts +15 -0
- package/dist/components/number-field.js +86 -0
- package/dist/components/option-picker.d.ts +18 -0
- package/dist/components/option-picker.js +89 -0
- package/dist/components/orb.d.ts +38 -0
- package/dist/components/orb.js +1413 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +147 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +79 -0
- package/dist/components/preview-card.d.ts +16 -0
- package/dist/components/preview-card.js +60 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.js +139 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/resizable.d.ts +58 -0
- package/dist/components/resizable.js +964 -0
- package/dist/components/ruler-picker.d.ts +27 -0
- package/dist/components/ruler-picker.js +253 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +34 -0
- package/dist/components/scroll-bar.d.ts +13 -0
- package/dist/components/scroll-bar.js +47 -0
- package/dist/components/select.d.ts +29 -0
- package/dist/components/select.js +140 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +15 -0
- package/dist/components/sidebar.d.ts +65 -0
- package/dist/components/sidebar.js +408 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +12 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +96 -0
- package/dist/components/sortable.d.ts +44 -0
- package/dist/components/sortable.js +327 -0
- package/dist/components/switch.d.ts +15 -0
- package/dist/components/switch.js +63 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +39 -0
- package/dist/components/text.d.ts +14 -0
- package/dist/components/text.js +69 -0
- package/dist/components/textarea.d.ts +9 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme-provider.d.ts +52 -0
- package/dist/components/theme-provider.js +148 -0
- package/dist/components/timeline.d.ts +34 -0
- package/dist/components/timeline.js +147 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/toast.js +161 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +53 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/toggle.js +36 -0
- package/dist/components/toolbar.d.ts +11 -0
- package/dist/components/toolbar.js +49 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/waveform.d.ts +61 -0
- package/dist/components/waveform.js +500 -0
- package/dist/components/wheel-picker.d.ts +44 -0
- package/dist/components/wheel-picker.js +771 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +36 -0
- package/dist/hooks/use-media-query.d.ts +21 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/styles.css +202 -0
- package/dist/themes/afterglow.css +89 -0
- package/dist/themes/afterglow.scoped.css +90 -0
- package/dist/themes/blacklight.css +89 -0
- package/dist/themes/blacklight.scoped.css +90 -0
- package/dist/themes/cathode.css +89 -0
- package/dist/themes/cathode.scoped.css +90 -0
- package/dist/themes/cel.css +89 -0
- package/dist/themes/cel.scoped.css +90 -0
- package/dist/themes/cinder.css +89 -0
- package/dist/themes/cinder.scoped.css +90 -0
- package/dist/themes/clay.css +89 -0
- package/dist/themes/clay.scoped.css +90 -0
- package/dist/themes/cobalt.css +89 -0
- package/dist/themes/cobalt.scoped.css +90 -0
- package/dist/themes/crimson.css +89 -0
- package/dist/themes/crimson.scoped.css +90 -0
- package/dist/themes/ion.css +89 -0
- package/dist/themes/ion.scoped.css +90 -0
- package/dist/themes/iris.css +89 -0
- package/dist/themes/iris.scoped.css +90 -0
- package/dist/themes/lagoon.css +89 -0
- package/dist/themes/lagoon.scoped.css +90 -0
- package/dist/themes/mochi.css +89 -0
- package/dist/themes/mochi.scoped.css +90 -0
- package/dist/themes/riso.css +89 -0
- package/dist/themes/riso.scoped.css +90 -0
- package/dist/themes/roast.css +89 -0
- package/dist/themes/roast.scoped.css +90 -0
- package/dist/themes/sage.css +89 -0
- package/dist/themes/sage.scoped.css +90 -0
- package/dist/themes/sepia.css +89 -0
- package/dist/themes/sepia.scoped.css +90 -0
- package/dist/themes/sorbet.css +89 -0
- package/dist/themes/sorbet.scoped.css +90 -0
- package/dist/themes/taffy.css +89 -0
- package/dist/themes/taffy.scoped.css +90 -0
- package/dist/themes/toxin.css +89 -0
- package/dist/themes/toxin.scoped.css +90 -0
- package/package.json +140 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Input } from "./input.js";
|
|
3
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
4
|
+
import { Separator } from "./separator.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "./tooltip.js";
|
|
7
|
+
import { useIsMobile } from "../hooks/use-media-query.js";
|
|
8
|
+
import { Skeleton } from "./skeleton.js";
|
|
9
|
+
import { cn } from "cn";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
|
+
import * as React$1 from "react";
|
|
13
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
14
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
15
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
16
|
+
import { ViewSidebarLeft } from "xiod-icons/icons/ViewSidebarLeft";
|
|
17
|
+
//#region src/components/sidebar.tsx
|
|
18
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
19
|
+
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
20
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
21
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
22
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
23
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
24
|
+
const SidebarContext = React$1.createContext(null);
|
|
25
|
+
function useSidebar() {
|
|
26
|
+
const context = React$1.useContext(SidebarContext);
|
|
27
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
28
|
+
return context;
|
|
29
|
+
}
|
|
30
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
|
|
31
|
+
const isMobile = useIsMobile();
|
|
32
|
+
const [openMobile, setOpenMobile] = React$1.useState(false);
|
|
33
|
+
const [_open, _setOpen] = React$1.useState(defaultOpen);
|
|
34
|
+
const open = openProp ?? _open;
|
|
35
|
+
const setOpen = React$1.useCallback(async (value) => {
|
|
36
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
37
|
+
if (setOpenProp) setOpenProp(openState);
|
|
38
|
+
else _setOpen(openState);
|
|
39
|
+
await cookieStore.set({
|
|
40
|
+
expires: Date.now() + SIDEBAR_COOKIE_MAX_AGE * 1e3,
|
|
41
|
+
name: SIDEBAR_COOKIE_NAME,
|
|
42
|
+
path: "/",
|
|
43
|
+
value: String(openState)
|
|
44
|
+
});
|
|
45
|
+
}, [setOpenProp, open]);
|
|
46
|
+
const toggleSidebar = React$1.useCallback(() => {
|
|
47
|
+
return isMobile ? setOpenMobile((currentOpen) => !currentOpen) : setOpen((currentOpen) => !currentOpen);
|
|
48
|
+
}, [isMobile, setOpen]);
|
|
49
|
+
React$1.useEffect(() => {
|
|
50
|
+
const handleKeyDown = (event) => {
|
|
51
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
toggleSidebar();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
57
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
58
|
+
}, [toggleSidebar]);
|
|
59
|
+
const state = open ? "expanded" : "collapsed";
|
|
60
|
+
const contextValue = React$1.useMemo(() => ({
|
|
61
|
+
isMobile,
|
|
62
|
+
open,
|
|
63
|
+
openMobile,
|
|
64
|
+
setOpen,
|
|
65
|
+
setOpenMobile,
|
|
66
|
+
state,
|
|
67
|
+
toggleSidebar
|
|
68
|
+
}), [
|
|
69
|
+
state,
|
|
70
|
+
open,
|
|
71
|
+
setOpen,
|
|
72
|
+
isMobile,
|
|
73
|
+
openMobile,
|
|
74
|
+
toggleSidebar
|
|
75
|
+
]);
|
|
76
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
77
|
+
value: contextValue,
|
|
78
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
79
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
80
|
+
"data-slot": "sidebar-wrapper",
|
|
81
|
+
style: {
|
|
82
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
83
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
84
|
+
...style
|
|
85
|
+
},
|
|
86
|
+
...props,
|
|
87
|
+
children
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
|
|
92
|
+
const { isMobile, state, open, setOpen, openMobile, setOpenMobile } = useSidebar();
|
|
93
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
95
|
+
"data-slot": "sidebar",
|
|
96
|
+
...props,
|
|
97
|
+
children
|
|
98
|
+
});
|
|
99
|
+
if (isMobile || variant === "modal") return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
100
|
+
onOpenChange: isMobile ? setOpenMobile : setOpen,
|
|
101
|
+
open: isMobile ? openMobile : open,
|
|
102
|
+
...props,
|
|
103
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
104
|
+
className: "fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
105
|
+
"data-slot": "sheet-backdrop"
|
|
106
|
+
}), /* @__PURE__ */ jsx(Dialog.Viewport, {
|
|
107
|
+
className: cn("fixed inset-0 z-50 flex", side === "left" ? "justify-start" : "justify-end"),
|
|
108
|
+
"data-slot": "sheet-viewport",
|
|
109
|
+
children: /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
110
|
+
className: cn("relative flex max-h-full min-h-0 w-(--sidebar-width) min-w-0 flex-col bg-sidebar text-sidebar-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", side === "left" ? "data-ending-style:-translate-x-8 data-starting-style:-translate-x-8 border-e" : "data-ending-style:translate-x-8 data-starting-style:translate-x-8 border-s", isMobile && "[&>button]:hidden", className),
|
|
111
|
+
"data-mobile": isMobile ? "true" : "false",
|
|
112
|
+
"data-sidebar": "sidebar",
|
|
113
|
+
"data-slot": "sidebar",
|
|
114
|
+
style: { "--sidebar-width": isMobile ? SIDEBAR_WIDTH_MOBILE : SIDEBAR_WIDTH },
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
117
|
+
className: "sr-only",
|
|
118
|
+
children: "Sidebar"
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ jsx(Dialog.Description, {
|
|
121
|
+
className: "sr-only",
|
|
122
|
+
children: "Displays the sidebar overlay."
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "flex h-full w-full flex-col",
|
|
126
|
+
children
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
})] })
|
|
131
|
+
});
|
|
132
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
133
|
+
className: "group peer hidden text-sidebar-foreground md:block",
|
|
134
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
135
|
+
"data-side": side,
|
|
136
|
+
"data-slot": "sidebar",
|
|
137
|
+
"data-state": state,
|
|
138
|
+
"data-variant": variant,
|
|
139
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),
|
|
141
|
+
"data-slot": "sidebar-gap"
|
|
142
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
143
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]", 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", className),
|
|
144
|
+
"data-slot": "sidebar-container",
|
|
145
|
+
...props,
|
|
146
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
147
|
+
className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm/5",
|
|
148
|
+
"data-sidebar": "sidebar",
|
|
149
|
+
"data-slot": "sidebar-inner",
|
|
150
|
+
children
|
|
151
|
+
})
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function SidebarTrigger({ className, onClick, ...props }) {
|
|
156
|
+
const { toggleSidebar } = useSidebar();
|
|
157
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
158
|
+
className: cn("size-7", className),
|
|
159
|
+
"data-sidebar": "trigger",
|
|
160
|
+
"data-slot": "sidebar-trigger",
|
|
161
|
+
onClick: (event) => {
|
|
162
|
+
onClick?.(event);
|
|
163
|
+
toggleSidebar();
|
|
164
|
+
},
|
|
165
|
+
size: "icon",
|
|
166
|
+
variant: "ghost",
|
|
167
|
+
...props,
|
|
168
|
+
children: [/* @__PURE__ */ jsx(ViewSidebarLeft, {}), /* @__PURE__ */ jsx("span", {
|
|
169
|
+
className: "sr-only",
|
|
170
|
+
children: "Toggle Sidebar"
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function SidebarRail({ className, ...props }) {
|
|
175
|
+
const { toggleSidebar } = useSidebar();
|
|
176
|
+
return /* @__PURE__ */ jsx("button", {
|
|
177
|
+
"aria-label": "Toggle Sidebar",
|
|
178
|
+
className: cn("-translate-x-1/2 group-data-[side=left]:-right-4 absolute inset-y-0 z-20 hidden w-4 transition-[color,background-color] ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=right]:left-0 sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
179
|
+
"data-sidebar": "rail",
|
|
180
|
+
"data-slot": "sidebar-rail",
|
|
181
|
+
onClick: toggleSidebar,
|
|
182
|
+
tabIndex: -1,
|
|
183
|
+
title: "Toggle Sidebar",
|
|
184
|
+
type: "button",
|
|
185
|
+
...props
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function SidebarInset({ className, ...props }) {
|
|
189
|
+
return /* @__PURE__ */ jsx("main", {
|
|
190
|
+
className: cn("relative flex w-full flex-1 flex-col bg-background", "md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5", className),
|
|
191
|
+
"data-slot": "sidebar-inset",
|
|
192
|
+
...props
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function SidebarInput({ className, ...props }) {
|
|
196
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
197
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
198
|
+
"data-sidebar": "input",
|
|
199
|
+
"data-slot": "sidebar-input",
|
|
200
|
+
...props
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function SidebarHeader({ className, ...props }) {
|
|
204
|
+
return /* @__PURE__ */ jsx("div", {
|
|
205
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
206
|
+
"data-sidebar": "header",
|
|
207
|
+
"data-slot": "sidebar-header",
|
|
208
|
+
...props
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function SidebarFooter({ className, ...props }) {
|
|
212
|
+
return /* @__PURE__ */ jsx("div", {
|
|
213
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
214
|
+
"data-sidebar": "footer",
|
|
215
|
+
"data-slot": "sidebar-footer",
|
|
216
|
+
...props
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function SidebarSeparator({ className, ...props }) {
|
|
220
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
221
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
222
|
+
"data-sidebar": "separator",
|
|
223
|
+
"data-slot": "sidebar-separator",
|
|
224
|
+
...props
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function SidebarContent({ className, ...props }) {
|
|
228
|
+
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
229
|
+
className: "**:data-[slot=scroll-area-scrollbar]:hidden",
|
|
230
|
+
scrollFade: true,
|
|
231
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
232
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
233
|
+
"data-sidebar": "content",
|
|
234
|
+
"data-slot": "sidebar-content",
|
|
235
|
+
...props
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function SidebarGroup({ className, ...props }) {
|
|
240
|
+
return /* @__PURE__ */ jsx("div", {
|
|
241
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
242
|
+
"data-sidebar": "group",
|
|
243
|
+
"data-slot": "sidebar-group",
|
|
244
|
+
...props
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
function SidebarGroupLabel({ className, render, ...props }) {
|
|
248
|
+
const defaultProps = {
|
|
249
|
+
className: cn("flex h-8 shrink-0 items-center rounded-lg px-2 font-medium text-sidebar-foreground text-xs outline-hidden ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className),
|
|
250
|
+
"data-sidebar": "group-label",
|
|
251
|
+
"data-slot": "sidebar-group-label"
|
|
252
|
+
};
|
|
253
|
+
return useRender({
|
|
254
|
+
defaultTagName: "div",
|
|
255
|
+
props: mergeProps(defaultProps, props),
|
|
256
|
+
render
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function SidebarGroupAction({ className, render, ...props }) {
|
|
260
|
+
const defaultProps = {
|
|
261
|
+
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0", "after:-inset-2 after:absolute md:after:hidden", "group-data-[collapsible=icon]:hidden", className),
|
|
262
|
+
"data-sidebar": "group-action",
|
|
263
|
+
"data-slot": "sidebar-group-action"
|
|
264
|
+
};
|
|
265
|
+
return useRender({
|
|
266
|
+
defaultTagName: "button",
|
|
267
|
+
props: mergeProps(defaultProps, props),
|
|
268
|
+
render
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function SidebarGroupContent({ className, ...props }) {
|
|
272
|
+
return /* @__PURE__ */ jsx("div", {
|
|
273
|
+
className: cn("w-full text-sm", className),
|
|
274
|
+
"data-sidebar": "group-content",
|
|
275
|
+
"data-slot": "sidebar-group-content",
|
|
276
|
+
...props
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function SidebarMenu({ className, ...props }) {
|
|
280
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
281
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
282
|
+
"data-sidebar": "menu",
|
|
283
|
+
"data-slot": "sidebar-menu",
|
|
284
|
+
...props
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
288
|
+
return /* @__PURE__ */ jsx("li", {
|
|
289
|
+
className: cn("group/menu-item relative", className),
|
|
290
|
+
"data-sidebar": "menu-item",
|
|
291
|
+
"data-slot": "sidebar-menu-item",
|
|
292
|
+
...props
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button relative flex w-full items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,color,background-color,box-shadow] 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-64 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-64 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11", {
|
|
296
|
+
defaultVariants: {
|
|
297
|
+
size: "default",
|
|
298
|
+
variant: "default"
|
|
299
|
+
},
|
|
300
|
+
variants: {
|
|
301
|
+
size: {
|
|
302
|
+
default: "h-8 text-sm",
|
|
303
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
|
|
304
|
+
sm: "h-7 text-xs"
|
|
305
|
+
},
|
|
306
|
+
variant: {
|
|
307
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
308
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
function SidebarMenuButton({ isActive = false, variant = "default", size = "default", tooltip, className, render, ...props }) {
|
|
313
|
+
const { isMobile, state } = useSidebar();
|
|
314
|
+
const defaultProps = {
|
|
315
|
+
className: cn(sidebarMenuButtonVariants({
|
|
316
|
+
size,
|
|
317
|
+
variant
|
|
318
|
+
}), className),
|
|
319
|
+
"data-active": isActive,
|
|
320
|
+
"data-sidebar": "menu-button",
|
|
321
|
+
"data-size": size,
|
|
322
|
+
"data-slot": "sidebar-menu-button"
|
|
323
|
+
};
|
|
324
|
+
const buttonProps = mergeProps(defaultProps, props);
|
|
325
|
+
const buttonElement = useRender({
|
|
326
|
+
defaultTagName: "button",
|
|
327
|
+
props: buttonProps,
|
|
328
|
+
render
|
|
329
|
+
});
|
|
330
|
+
if (!tooltip) return buttonElement;
|
|
331
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
332
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: buttonElement }), /* @__PURE__ */ jsx(TooltipPopup, {
|
|
333
|
+
align: "center",
|
|
334
|
+
hidden: state !== "collapsed" || isMobile,
|
|
335
|
+
side: "right",
|
|
336
|
+
...tooltip
|
|
337
|
+
})] });
|
|
338
|
+
}
|
|
339
|
+
function SidebarMenuAction({ className, showOnHover = false, render, ...props }) {
|
|
340
|
+
const defaultProps = {
|
|
341
|
+
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0", "after:-inset-2 after:absolute md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0", className),
|
|
342
|
+
"data-sidebar": "menu-action",
|
|
343
|
+
"data-slot": "sidebar-menu-action"
|
|
344
|
+
};
|
|
345
|
+
return useRender({
|
|
346
|
+
defaultTagName: "button",
|
|
347
|
+
props: mergeProps(defaultProps, props),
|
|
348
|
+
render
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function SidebarMenuBadge({ className, ...props }) {
|
|
352
|
+
return /* @__PURE__ */ jsx("div", {
|
|
353
|
+
className: cn("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-lg px-1 font-medium text-sidebar-foreground text-xs tabular-nums", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
354
|
+
"data-sidebar": "menu-badge",
|
|
355
|
+
"data-slot": "sidebar-menu-badge",
|
|
356
|
+
...props
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
360
|
+
const skeletonId = React$1.useId();
|
|
361
|
+
const width = `${50 + Array.from(skeletonId).reduce((sum, character) => sum + character.codePointAt(0), 0) % 40}%`;
|
|
362
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
363
|
+
className: cn("flex h-8 items-center gap-2 rounded-lg px-2", className),
|
|
364
|
+
"data-sidebar": "menu-skeleton",
|
|
365
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
366
|
+
...props,
|
|
367
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
368
|
+
className: "size-4 rounded-lg",
|
|
369
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
370
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
371
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
372
|
+
"data-sidebar": "menu-skeleton-text",
|
|
373
|
+
style: { "--skeleton-width": width }
|
|
374
|
+
})]
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
function SidebarMenuSub({ className, ...props }) {
|
|
378
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
379
|
+
className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-sidebar-border border-l ps-[calc(--spacing(2.5)-1px)] pe-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className),
|
|
380
|
+
"data-sidebar": "menu-sub",
|
|
381
|
+
"data-slot": "sidebar-menu-sub",
|
|
382
|
+
...props
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function SidebarMenuSubItem({ className, ...props }) {
|
|
386
|
+
return /* @__PURE__ */ jsx("li", {
|
|
387
|
+
className: cn("group/menu-sub-item relative", className),
|
|
388
|
+
"data-sidebar": "menu-sub-item",
|
|
389
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
390
|
+
...props
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
function SidebarMenuSubButton({ size = "md", isActive = false, className, render, ...props }) {
|
|
394
|
+
const defaultProps = {
|
|
395
|
+
className: cn("-translate-x-px flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-[color,background-color,box-shadow] 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-64 aria-disabled:pointer-events-none aria-disabled:opacity-64 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
396
|
+
"data-active": isActive,
|
|
397
|
+
"data-sidebar": "menu-sub-button",
|
|
398
|
+
"data-size": size,
|
|
399
|
+
"data-slot": "sidebar-menu-sub-button"
|
|
400
|
+
};
|
|
401
|
+
return useRender({
|
|
402
|
+
defaultTagName: "a",
|
|
403
|
+
props: mergeProps(defaultProps, props),
|
|
404
|
+
render
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
//#endregion
|
|
408
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, sidebarMenuButtonVariants, useSidebar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/skeleton.tsx
|
|
4
|
+
function Skeleton({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: cn("animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]", className),
|
|
7
|
+
"data-slot": "skeleton",
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Skeleton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
4
|
+
//#region src/components/slider.d.ts
|
|
5
|
+
declare const sliderVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "expressive" | "classic" | "fader" | "segmented" | "dotted" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export interface SliderProps extends Slider$1.Root.Props, VariantProps<typeof sliderVariants> {}
|
|
9
|
+
declare function Slider({ className, children, defaultValue, value, min, max, variant, orientation, ...props }: SliderProps): React$1.JSX.Element;
|
|
10
|
+
declare function SliderValue({ className, ...props }: Slider$1.Value.Props): React$1.JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Slider, SliderValue, sliderVariants };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
7
|
+
//#region src/components/slider.tsx
|
|
8
|
+
const sliderVariants = cva("", {
|
|
9
|
+
variants: { variant: {
|
|
10
|
+
default: "",
|
|
11
|
+
expressive: "",
|
|
12
|
+
classic: "",
|
|
13
|
+
fader: "",
|
|
14
|
+
segmented: "",
|
|
15
|
+
dotted: ""
|
|
16
|
+
} },
|
|
17
|
+
defaultVariants: { variant: "default" }
|
|
18
|
+
});
|
|
19
|
+
function Slider({ className, children, defaultValue, value, min = 0, max = 100, variant, orientation = "horizontal", ...props }) {
|
|
20
|
+
const _values = React$1.useMemo(() => {
|
|
21
|
+
if (value !== void 0) return Array.isArray(value) ? value : [value];
|
|
22
|
+
if (defaultValue !== void 0) return Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
23
|
+
return [min];
|
|
24
|
+
}, [
|
|
25
|
+
value,
|
|
26
|
+
defaultValue,
|
|
27
|
+
min
|
|
28
|
+
]);
|
|
29
|
+
const maskStyle = React$1.useMemo(() => {
|
|
30
|
+
if (variant !== "segmented" && variant !== "dotted") return {};
|
|
31
|
+
const isHorizontal = orientation === "horizontal";
|
|
32
|
+
if (variant === "segmented") {
|
|
33
|
+
const maskUrl = `url("data:image/svg+xml;utf8,${encodeURIComponent(isHorizontal ? `<svg viewBox="0 0 6 24" xmlns="http://www.w3.org/2000/svg"><rect x="1.5" y="0" width="3" height="24" rx="1.5" fill="black"/></svg>` : `<svg viewBox="0 0 24 6" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="1.5" width="24" height="3" rx="1.5" fill="black"/></svg>`)}")`;
|
|
34
|
+
return {
|
|
35
|
+
maskImage: maskUrl,
|
|
36
|
+
WebkitMaskImage: maskUrl,
|
|
37
|
+
maskRepeat: isHorizontal ? "repeat-x" : "repeat-y",
|
|
38
|
+
WebkitMaskRepeat: isHorizontal ? "repeat-x" : "repeat-y",
|
|
39
|
+
maskSize: isHorizontal ? "6px 100%" : "100% 6px",
|
|
40
|
+
WebkitMaskSize: isHorizontal ? "6px 100%" : "100% 6px",
|
|
41
|
+
maskPosition: isHorizontal ? "left center" : "center bottom",
|
|
42
|
+
WebkitMaskPosition: isHorizontal ? "left center" : "center bottom"
|
|
43
|
+
};
|
|
44
|
+
} else {
|
|
45
|
+
const maskUrl = `url("data:image/svg+xml;utf8,${encodeURIComponent(`<svg viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg"><circle cx="4" cy="4" r="2.8" fill="black"/></svg>`)}")`;
|
|
46
|
+
return {
|
|
47
|
+
maskImage: maskUrl,
|
|
48
|
+
WebkitMaskImage: maskUrl,
|
|
49
|
+
maskRepeat: isHorizontal ? "repeat-x" : "repeat-y",
|
|
50
|
+
WebkitMaskRepeat: isHorizontal ? "repeat-x" : "repeat-y",
|
|
51
|
+
maskSize: "8px 8px",
|
|
52
|
+
WebkitMaskSize: "8px 8px",
|
|
53
|
+
maskPosition: isHorizontal ? "left center" : "center bottom",
|
|
54
|
+
WebkitMaskPosition: isHorizontal ? "left center" : "center bottom"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}, [variant, orientation]);
|
|
58
|
+
return /* @__PURE__ */ jsxs(Slider$1.Root, {
|
|
59
|
+
className: cn("data-[orientation=horizontal]:w-full flex items-center data-dragging:cursor-grabbing", sliderVariants({ variant }), className),
|
|
60
|
+
"data-slot": "slider",
|
|
61
|
+
defaultValue,
|
|
62
|
+
max,
|
|
63
|
+
min,
|
|
64
|
+
orientation,
|
|
65
|
+
thumbAlignment: variant === "expressive" ? "center" : "edge-client-only",
|
|
66
|
+
value,
|
|
67
|
+
...props,
|
|
68
|
+
children: [children, /* @__PURE__ */ jsxs(Slider$1.Control, {
|
|
69
|
+
className: cn("group flex touch-none select-none data-disabled:pointer-events-none data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=horizontal]:w-full data-[orientation=horizontal]:min-w-44 data-[orientation=vertical]:flex-col data-disabled:opacity-64 relative items-center", variant === "fader" && "bg-muted/40 dark:bg-muted/10 border border-border shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] p-0.5 rounded-xl data-[orientation=horizontal]:h-10 data-[orientation=vertical]:w-10 sm:data-[orientation=horizontal]:h-8 sm:data-[orientation=vertical]:w-8 overflow-hidden z-0 isolate", variant === "segmented" && "bg-background dark:bg-muted/10 border border-border/80 shadow-[inset_0_1px_2px_rgba(0,0,0,0.03)] rounded-2xl data-[orientation=horizontal]:h-10 data-[orientation=horizontal]:px-[calc(--spacing(2)-1px)] data-[orientation=vertical]:w-10 data-[orientation=vertical]:py-[calc(--spacing(3)-1px)] sm:data-[orientation=horizontal]:h-8 sm:data-[orientation=horizontal]:px-[calc(--spacing(2)-1px)] sm:data-[orientation=vertical]:w-8 sm:data-[orientation=vertical]:py-[calc(--spacing(2.5)-1px)] overflow-hidden z-0 isolate", variant === "dotted" && "bg-background dark:bg-muted/10 border border-border/80 shadow-[inset_0_1px_2px_rgba(0,0,0,0.03)] rounded-xl data-[orientation=horizontal]:h-5 data-[orientation=horizontal]:px-[calc(--spacing(1.5)-1px)] data-[orientation=vertical]:w-5 data-[orientation=vertical]:py-[calc(--spacing(1.5)-1px)] sm:data-[orientation=horizontal]:h-4 sm:data-[orientation=horizontal]:px-[calc(--spacing(1)-1px)] sm:data-[orientation=vertical]:w-4 sm:data-[orientation=vertical]:py-[calc(--spacing(1)-1px)] overflow-hidden z-0 isolate"),
|
|
70
|
+
"data-slot": "slider-control",
|
|
71
|
+
children: [/* @__PURE__ */ jsx(Slider$1.Track, {
|
|
72
|
+
className: cn("relative grow select-none rounded-full transition-transform duration-200 ease-out origin-center", variant === "expressive" ? "bg-muted-foreground/20 data-[orientation=horizontal]:h-2 aria-orientation-vertical:w-2 overflow-hidden" : variant === "classic" ? "before:absolute before:rounded-full before:bg-input data-[orientation=horizontal]:h-1 data-[orientation=vertical]:h-full data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-1 data-[orientation=horizontal]:before:inset-x-0.5 data-[orientation=vertical]:before:inset-x-0 data-[orientation=horizontal]:before:inset-y-0 data-[orientation=vertical]:before:inset-y-0.5" : variant === "fader" ? "bg-transparent w-full h-full rounded-lg overflow-hidden" : variant === "segmented" ? "bg-linear-to-b from-muted-foreground/32 to-muted-foreground/18 dark:from-muted-foreground/24 dark:to-muted-foreground/12 data-[orientation=horizontal]:h-5 aria-orientation-vertical:w-5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=horizontal]:group-hover:scale-y-110 data-[orientation=horizontal]:group-data-dragging:scale-y-90 data-[orientation=vertical]:group-hover:scale-x-110 data-[orientation=vertical]:group-data-dragging:scale-x-90" : variant === "dotted" ? "bg-linear-to-b from-muted-foreground/32 to-muted-foreground/18 dark:from-muted-foreground/24 dark:to-muted-foreground/12 data-[orientation=horizontal]:h-2.5 sm:data-[orientation=horizontal]:h-2 aria-orientation-vertical:w-2.5 sm:aria-orientation-vertical:w-2 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full" : "bg-muted-foreground/20 data-[orientation=horizontal]:h-5 aria-orientation-vertical:w-5 overflow-hidden"),
|
|
73
|
+
style: maskStyle,
|
|
74
|
+
"data-slot": "slider-track",
|
|
75
|
+
children: /* @__PURE__ */ jsx(Slider$1.Indicator, {
|
|
76
|
+
className: cn("relative select-none bg-primary rounded-full", "data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full", variant === "expressive" ? "" : variant === "classic" ? "data-[orientation=horizontal]:ms-0.5 data-[orientation=vertical]:mb-0.5" : variant === "fader" ? "bg-foreground data-[orientation=horizontal]:rounded-s-lg data-[orientation=horizontal]:rounded-e-none data-[orientation=vertical]:rounded-b-none data-[orientation=vertical]:rounded-t-lg" : variant === "segmented" || variant === "dotted" ? "bg-linear-to-b from-foreground to-foreground/80 dark:from-foreground dark:to-foreground/90" : "after:content-[''] after:absolute after:inset-0 after:bg-primary after:rounded-full data-[orientation=horizontal]:after:-right-4 data-[orientation=vertical]:after:-top-4"),
|
|
77
|
+
style: maskStyle,
|
|
78
|
+
"data-slot": "slider-indicator"
|
|
79
|
+
})
|
|
80
|
+
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
81
|
+
className: cn("block shrink-0 select-none bg-card bg-clip-padding border-2 border-transparent shadow-sm/5 outline-none transition-[box-shadow,scale,transform,height,width,border-radius] focus-visible:ring-4 hover:cursor-grab focus-visible:ring-primary/30 data-dragging:cursor-grabbing absolute data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2 aria-orientation-vertical:left-1/2 aria-orientation-vertical:-translate-x-1/2 z-10", variant === "expressive" ? "data-[orientation=horizontal]:h-6 data-[orientation=horizontal]:w-2 data-[orientation=horizontal]:rounded-full aria-orientation-vertical:w-6 aria-orientation-vertical:h-2 aria-orientation-vertical:rounded-full bg-primary border-none shadow-md/20 data-dragging:scale-x-150 data-dragging:scale-y-75 data-[orientation=vertical]:data-dragging:scale-y-150 data-[orientation=vertical]:data-dragging:scale-x-75" : variant === "classic" ? "rounded-full border border-input bg-card shadow-xs/5 before:absolute before:inset-0 before:rounded-full before:shadow-[0_1px_var(--border)] focus-visible:ring-[3px] focus-visible:ring-ring/24 data-[orientation=horizontal]:h-4 data-[orientation=horizontal]:w-6 aria-orientation-vertical:w-4 aria-orientation-vertical:h-6 sm:data-[orientation=horizontal]:h-3.5 sm:data-[orientation=horizontal]:w-5 sm:aria-orientation-vertical:w-3.5 sm:aria-orientation-vertical:h-5 data-dragging:scale-95 dark:focus-visible:ring-ring/48 [:focus-visible,[data-dragging]]:shadow-none" : variant === "fader" ? "bg-foreground data-[orientation=horizontal]:rounded-lg data-[orientation=horizontal]:rounded-e-lg data-[orientation=vertical]:rounded-b-none data-[orientation=vertical]:rounded-t-lg border-0 shadow-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background hover:scale-105 data-dragging:scale-95 data-[orientation=horizontal]:h-[34px] data-[orientation=horizontal]:w-3 data-[orientation=vertical]:w-[34px] data-[orientation=vertical]:h-3 sm:data-[orientation=horizontal]:h-[26px] sm:data-[orientation=horizontal]:w-2.5 sm:data-[orientation=vertical]:w-[26px] sm:data-[orientation=vertical]:h-2.5 before:absolute before:bg-background before:rounded-full data-[orientation=horizontal]:before:w-[3px] data-[orientation=horizontal]:before:h-[22px] data-[orientation=horizontal]:before:top-1/2 data-[orientation=horizontal]:before:-translate-y-1/2 data-[orientation=horizontal]:before:right-1 sm:data-[orientation=horizontal]:before:h-[18px] data-[orientation=vertical]:before:h-[3px] data-[orientation=vertical]:before:w-[22px] data-[orientation=vertical]:before:left-1/2 data-[orientation=vertical]:before:-translate-x-1/2 data-[orientation=vertical]:before:top-1 sm:data-[orientation=vertical]:before:w-[18px] hover:before:bg-background/90" : variant === "segmented" ? "size-0 opacity-0 pointer-events-none border-0 outline-none" : variant === "dotted" ? "rounded-full bg-linear-to-b from-foreground to-foreground/80 dark:from-foreground dark:to-foreground/90 border-0 shadow-[0_1.5px_3px_rgba(0,0,0,0.15)] transition-[transform,scale,box-shadow] duration-200 ease-out hover:scale-125 data-dragging:scale-140 focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-1 focus-visible:ring-offset-background data-[orientation=horizontal]:h-2.5 data-[orientation=horizontal]:w-2.5 data-[orientation=vertical]:w-2.5 data-[orientation=vertical]:h-2.5 sm:data-[orientation=horizontal]:h-2 sm:data-[orientation=horizontal]:w-2 sm:data-[orientation=vertical]:w-2 sm:data-[orientation=vertical]:h-2 cursor-grab data-dragging:cursor-grabbing" : "rounded-full data-[orientation=horizontal]:h-5 data-[orientation=horizontal]:w-8 aria-orientation-vertical:w-5 aria-orientation-vertical:h-8 data-dragging:scale-95"),
|
|
82
|
+
"data-slot": "slider-thumb",
|
|
83
|
+
index
|
|
84
|
+
}, String(index)))]
|
|
85
|
+
})]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function SliderValue({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsx(Slider$1.Value, {
|
|
90
|
+
className: cn("flex justify-end text-sm", className),
|
|
91
|
+
"data-slot": "slider-value",
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { Slider, SliderValue, sliderVariants };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/sortable.d.ts
|
|
5
|
+
export type SortableOrientation = "vertical" | "horizontal" | "grid";
|
|
6
|
+
export declare const sortableVariants: (props?: ({
|
|
7
|
+
orientation?: "horizontal" | "vertical" | "grid" | null | undefined;
|
|
8
|
+
variant?: "default" | "ghost" | "bordered" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export declare const sortableItemVariants: (props?: ({
|
|
11
|
+
variant?: "default" | "flat" | "accent" | null | undefined;
|
|
12
|
+
isDragging?: boolean | null | undefined;
|
|
13
|
+
isHoveredTarget?: boolean | null | undefined;
|
|
14
|
+
isKeyboardActive?: boolean | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
export interface SortableProps extends useRender.ComponentProps<"div">, VariantProps<typeof sortableVariants> {
|
|
17
|
+
items: string[];
|
|
18
|
+
onReorder: (newItems: string[]) => void;
|
|
19
|
+
onRemove?: (id: string) => void;
|
|
20
|
+
orientation?: SortableOrientation;
|
|
21
|
+
}
|
|
22
|
+
declare function Sortable({ className, orientation, variant, items, onReorder, onRemove, render, children, ...props }: SortableProps): React$1.ReactElement;
|
|
23
|
+
export interface SortableItemProps extends useRender.ComponentProps<"div">, VariantProps<typeof sortableItemVariants> {
|
|
24
|
+
id: string;
|
|
25
|
+
}
|
|
26
|
+
declare function SortableItem({ className, variant, id, render, children, ...props }: SortableItemProps): React$1.ReactElement | null;
|
|
27
|
+
export interface SortableItemHandleProps extends useRender.ComponentProps<"div"> {
|
|
28
|
+
id?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function SortableItemHandle({ className, id: _id, render, children, ...props }: SortableItemHandleProps): React$1.ReactElement;
|
|
31
|
+
export interface SortableItemRemoveProps extends useRender.ComponentProps<"button"> {
|
|
32
|
+
id: string;
|
|
33
|
+
}
|
|
34
|
+
declare function SortableItemRemove({ className, id, render, children, ...props }: SortableItemRemoveProps): React$1.ReactElement;
|
|
35
|
+
export interface SortableColumnProps extends useRender.ComponentProps<"div"> {
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
38
|
+
declare function SortableColumn({ className, id, render, children, ...props }: SortableColumnProps): React$1.ReactElement;
|
|
39
|
+
export interface SortableColumnHeaderProps extends useRender.ComponentProps<"div"> {}
|
|
40
|
+
declare function SortableColumnHeader({ className, render, children, ...props }: SortableColumnHeaderProps): React$1.ReactElement;
|
|
41
|
+
export interface SortableColumnTitleProps extends useRender.ComponentProps<"span"> {}
|
|
42
|
+
declare function SortableColumnTitle({ className, render, children, ...props }: SortableColumnTitleProps): React$1.ReactElement;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Sortable, SortableColumn, SortableColumnHeader, SortableColumnTitle, SortableItem, SortableItemHandle, SortableItemRemove };
|