@codefast/ui 0.3.16-canary.2 → 0.4.0-canary.4
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/CHANGELOG.md +81 -0
- package/README.md +28 -17
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +14 -14
- package/dist/components/alert.mjs +17 -28
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +6 -48
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +9 -31
- package/dist/components/button.d.mts +3 -26
- package/dist/components/button.mjs +9 -79
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +41 -44
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -5
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +9 -6
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +3 -21
- package/dist/components/drawer.mjs +19 -27
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +8 -23
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +14 -44
- package/dist/components/form.d.mts +7 -10
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +14 -96
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +50 -28
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +12 -65
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -13
- package/dist/components/navigation-menu.mjs +35 -32
- package/dist/components/pagination.d.mts +7 -1
- package/dist/components/pagination.mjs +27 -12
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -48
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +8 -24
- package/dist/components/scroll-area.mjs +16 -70
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +4 -19
- package/dist/components/separator.mjs +6 -27
- package/dist/components/sheet.d.mts +18 -31
- package/dist/components/sheet.mjs +46 -87
- package/dist/components/sidebar.d.mts +3 -19
- package/dist/components/sidebar.mjs +48 -84
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +11 -7
- package/dist/components/toggle-group.mjs +20 -21
- package/dist/components/toggle.d.mts +4 -24
- package/dist/components/toggle.mjs +6 -45
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +38 -21
- package/dist/index.mjs +40 -23
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +9 -11
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -4
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -5
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -4
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +15 -0
- package/dist/variants/badge.d.mts +22 -0
- package/dist/variants/badge.mjs +19 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +15 -0
- package/dist/variants/button.d.mts +32 -0
- package/dist/variants/button.mjs +34 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +15 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +16 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +34 -0
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +38 -0
- package/dist/variants/item.mjs +38 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +8 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +45 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +58 -0
- package/dist/variants/separator.d.mts +23 -0
- package/dist/variants/separator.mjs +25 -0
- package/dist/variants/sheet.d.mts +20 -0
- package/dist/variants/sheet.mjs +17 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +25 -0
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +25 -0
- package/package.json +186 -55
- package/src/components/accordion.tsx +114 -0
- package/src/components/alert-dialog.tsx +298 -0
- package/src/components/alert.tsx +94 -0
- package/src/components/aspect-ratio.tsx +25 -0
- package/src/components/avatar.tsx +171 -0
- package/src/components/badge.tsx +35 -0
- package/src/components/breadcrumb.tsx +191 -0
- package/src/components/button-group.tsx +97 -0
- package/src/components/button.tsx +55 -0
- package/src/components/calendar.tsx +222 -0
- package/src/components/card.tsx +169 -0
- package/src/components/carousel.tsx +349 -0
- package/src/components/chart.tsx +536 -0
- package/src/components/checkbox-cards.tsx +72 -0
- package/src/components/checkbox-group.tsx +60 -0
- package/src/components/checkbox.tsx +44 -0
- package/src/components/collapsible.tsx +57 -0
- package/src/components/command.tsx +298 -0
- package/src/components/context-menu.tsx +410 -0
- package/src/components/dialog.tsx +243 -0
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +209 -0
- package/src/components/dropdown-menu.tsx +419 -0
- package/src/components/empty.tsx +155 -0
- package/src/components/field.tsx +329 -0
- package/src/components/form.tsx +258 -0
- package/src/components/hover-card.tsx +93 -0
- package/src/components/input-group.tsx +185 -0
- package/src/components/input-number.tsx +141 -0
- package/src/components/input-otp.tsx +132 -0
- package/src/components/input-password.tsx +50 -0
- package/src/components/input-search.tsx +81 -0
- package/src/components/input.tsx +36 -0
- package/src/components/item.tsx +266 -0
- package/src/components/kbd.tsx +47 -0
- package/src/components/label.tsx +36 -0
- package/src/components/menubar.tsx +440 -0
- package/src/components/native-select.tsx +87 -0
- package/src/components/navigation-menu.tsx +235 -0
- package/src/components/pagination.tsx +198 -0
- package/src/components/popover.tsx +170 -0
- package/src/components/progress-circle.tsx +185 -0
- package/src/components/progress.tsx +41 -0
- package/src/components/radio-cards.tsx +66 -0
- package/src/components/radio-group.tsx +59 -0
- package/src/components/radio.tsx +40 -0
- package/src/components/resizable.tsx +78 -0
- package/src/components/scroll-area.tsx +95 -0
- package/src/components/select.tsx +296 -0
- package/src/components/separator.tsx +60 -0
- package/src/components/sheet.tsx +241 -0
- package/src/components/sidebar.tsx +926 -0
- package/src/components/skeleton.tsx +35 -0
- package/src/components/slider.tsx +66 -0
- package/src/components/sonner.tsx +57 -0
- package/src/components/spinner.tsx +66 -0
- package/src/components/switch.tsx +44 -0
- package/src/components/table.tsx +183 -0
- package/src/components/tabs.tsx +110 -0
- package/src/components/textarea.tsx +35 -0
- package/src/components/toggle-group.tsx +137 -0
- package/src/components/toggle.tsx +30 -0
- package/src/components/tooltip.tsx +115 -0
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -195
- package/src/css/style.css +1 -1
- package/src/css/{amber.css → themes/amber.css} +59 -22
- package/src/css/{blue.css → themes/blue.css} +59 -22
- package/src/css/{cyan.css → themes/cyan.css} +59 -22
- package/src/css/{emerald.css → themes/emerald.css} +59 -22
- package/src/css/{fuchsia.css → themes/fuchsia.css} +59 -22
- package/src/css/{gray.css → themes/gray.css} +59 -22
- package/src/css/{green.css → themes/green.css} +59 -22
- package/src/css/{indigo.css → themes/indigo.css} +59 -22
- package/src/css/{lime.css → themes/lime.css} +59 -22
- package/src/css/{neutral.css → themes/neutral.css} +59 -22
- package/src/css/{orange.css → themes/orange.css} +59 -22
- package/src/css/{pink.css → themes/pink.css} +59 -22
- package/src/css/{purple.css → themes/purple.css} +59 -22
- package/src/css/{red.css → themes/red.css} +59 -22
- package/src/css/{rose.css → themes/rose.css} +59 -22
- package/src/css/{sky.css → themes/sky.css} +59 -22
- package/src/css/{slate.css → themes/slate.css} +59 -22
- package/src/css/{stone.css → themes/stone.css} +59 -22
- package/src/css/{teal.css → themes/teal.css} +59 -22
- package/src/css/{violet.css → themes/violet.css} +59 -22
- package/src/css/{yellow.css → themes/yellow.css} +59 -22
- package/src/css/{zinc.css → themes/zinc.css} +59 -22
- package/src/hooks/use-animated-value.ts +91 -0
- package/src/hooks/use-copy-to-clipboard.ts +58 -0
- package/src/hooks/use-is-mobile.ts +25 -0
- package/src/hooks/use-media-query.ts +69 -0
- package/src/hooks/use-mutation-observer.ts +51 -0
- package/src/hooks/use-pagination.ts +164 -0
- package/src/index.ts +679 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +346 -0
- package/src/primitives/input-number.tsx +967 -0
- package/src/primitives/input.tsx +227 -0
- package/src/primitives/progress-circle.tsx +507 -0
- package/src/variants/alert.ts +34 -0
- package/src/variants/badge.ts +39 -0
- package/src/variants/button-group.ts +36 -0
- package/src/variants/button.ts +56 -0
- package/src/variants/empty.ts +34 -0
- package/src/variants/field.ts +37 -0
- package/src/variants/input-group.ts +80 -0
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +68 -0
- package/src/variants/navigation-menu.ts +25 -0
- package/src/variants/progress-circle.ts +46 -0
- package/src/variants/scroll-area.ts +73 -0
- package/src/variants/separator.ts +40 -0
- package/src/variants/sheet.ts +37 -0
- package/src/variants/sidebar.ts +41 -0
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +40 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -1,69 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { buttonVariants } from "../variants/button.mjs";
|
|
3
|
+
import { sheetContentVariants } from "../variants/sheet.mjs";
|
|
4
4
|
import { XIcon } from "lucide-react";
|
|
5
|
+
import { Dialog } from "radix-ui";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
7
7
|
//#region src/components/sheet.tsx
|
|
8
8
|
/**
|
|
9
9
|
* @since 0.3.16-canary.0
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"fixed z-50 flex flex-col overflow-auto",
|
|
14
|
-
"bg-background shadow-lg",
|
|
15
|
-
"ease-ui data-open:animate-in data-open:animation-duration-500",
|
|
16
|
-
"data-closed:animate-out data-closed:animation-duration-500"
|
|
17
|
-
],
|
|
18
|
-
defaultVariants: { side: "right" },
|
|
19
|
-
variants: { side: {
|
|
20
|
-
bottom: [
|
|
21
|
-
"max-h-[80vh]",
|
|
22
|
-
"inset-x-0 bottom-0",
|
|
23
|
-
"border-t",
|
|
24
|
-
"data-open:slide-in-from-bottom",
|
|
25
|
-
"data-closed:slide-out-to-bottom"
|
|
26
|
-
],
|
|
27
|
-
left: [
|
|
28
|
-
"h-full w-3/4",
|
|
29
|
-
"inset-y-0 left-0",
|
|
30
|
-
"border-r",
|
|
31
|
-
"sm:max-w-sm",
|
|
32
|
-
"data-open:slide-in-from-left",
|
|
33
|
-
"data-closed:slide-out-to-left"
|
|
34
|
-
],
|
|
35
|
-
right: [
|
|
36
|
-
"h-full w-3/4",
|
|
37
|
-
"inset-y-0 right-0",
|
|
38
|
-
"border-l",
|
|
39
|
-
"sm:max-w-sm",
|
|
40
|
-
"data-open:slide-in-from-right",
|
|
41
|
-
"data-closed:slide-out-to-right"
|
|
42
|
-
],
|
|
43
|
-
top: [
|
|
44
|
-
"max-h-[80vh]",
|
|
45
|
-
"inset-x-0 top-0",
|
|
46
|
-
"border-b",
|
|
47
|
-
"data-open:slide-in-from-top",
|
|
48
|
-
"data-closed:slide-out-to-top"
|
|
49
|
-
]
|
|
50
|
-
} }
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* @since 0.3.16-canary.0
|
|
54
|
-
*/
|
|
55
|
-
function Sheet({ children, ...props }) {
|
|
56
|
-
return /* @__PURE__ */ jsx(SheetPrimitive.Root, {
|
|
11
|
+
function Sheet({ ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
57
13
|
"data-slot": "sheet",
|
|
58
|
-
...props
|
|
59
|
-
children
|
|
14
|
+
...props
|
|
60
15
|
});
|
|
61
16
|
}
|
|
62
17
|
/**
|
|
63
18
|
* @since 0.3.16-canary.0
|
|
64
19
|
*/
|
|
65
20
|
function SheetTrigger({ ...props }) {
|
|
66
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
67
22
|
"data-slot": "sheet-trigger",
|
|
68
23
|
...props
|
|
69
24
|
});
|
|
@@ -71,37 +26,41 @@ function SheetTrigger({ ...props }) {
|
|
|
71
26
|
/**
|
|
72
27
|
* @since 0.3.16-canary.0
|
|
73
28
|
*/
|
|
74
|
-
function SheetContent({ children, className,
|
|
75
|
-
return /* @__PURE__ */ jsxs(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
...props,
|
|
85
|
-
children: [children, /* @__PURE__ */ jsxs(SheetPrimitive.Close, {
|
|
86
|
-
className: buttonVariants({
|
|
87
|
-
className: ["absolute top-4 right-4 size-7", classNames?.close],
|
|
88
|
-
size: "icon",
|
|
89
|
-
variant: "ghost"
|
|
29
|
+
function SheetContent({ children, className, showCloseButton = true, side = "right", ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsxs(Dialog.Portal, {
|
|
31
|
+
"data-slot": "sheet-portal",
|
|
32
|
+
children: [/* @__PURE__ */ jsx(Dialog.Overlay, {
|
|
33
|
+
className: "fixed inset-0 z-50 bg-black/10 ease-gentle supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:animation-duration-panel-in data-open:fade-in-0 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-panel-out data-closed:fade-out-0",
|
|
34
|
+
"data-slot": "sheet-overlay"
|
|
35
|
+
}), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
36
|
+
className: sheetContentVariants({
|
|
37
|
+
className,
|
|
38
|
+
side
|
|
90
39
|
}),
|
|
91
|
-
"data-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
40
|
+
"data-side": side,
|
|
41
|
+
"data-slot": "sheet-content",
|
|
42
|
+
...props,
|
|
43
|
+
children: [children, showCloseButton ? /* @__PURE__ */ jsxs(Dialog.Close, {
|
|
44
|
+
className: buttonVariants({
|
|
45
|
+
className: "absolute top-4 right-4",
|
|
46
|
+
size: "icon-sm",
|
|
47
|
+
variant: "ghost"
|
|
48
|
+
}),
|
|
49
|
+
"data-slot": "sheet-close",
|
|
50
|
+
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: "sr-only",
|
|
52
|
+
children: "Close"
|
|
53
|
+
})]
|
|
54
|
+
}) : null]
|
|
96
55
|
})]
|
|
97
|
-
})
|
|
56
|
+
});
|
|
98
57
|
}
|
|
99
58
|
/**
|
|
100
59
|
* @since 0.3.16-canary.0
|
|
101
60
|
*/
|
|
102
61
|
function SheetHeader({ className, ...props }) {
|
|
103
|
-
return /* @__PURE__ */ jsx("
|
|
104
|
-
className: cn("flex shrink-0 flex-col gap-1.5
|
|
62
|
+
return /* @__PURE__ */ jsx("div", {
|
|
63
|
+
className: cn("flex shrink-0 flex-col gap-1.5 p-4", className),
|
|
105
64
|
"data-slot": "sheet-header",
|
|
106
65
|
...props
|
|
107
66
|
});
|
|
@@ -110,8 +69,8 @@ function SheetHeader({ className, ...props }) {
|
|
|
110
69
|
* @since 0.3.16-canary.0
|
|
111
70
|
*/
|
|
112
71
|
function SheetBody({ className, ...props }) {
|
|
113
|
-
return /* @__PURE__ */ jsx("
|
|
114
|
-
className: cn("overflow-auto
|
|
72
|
+
return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: cn("min-h-0 flex-1 overflow-y-auto px-4", className),
|
|
115
74
|
"data-slot": "sheet-body",
|
|
116
75
|
...props
|
|
117
76
|
});
|
|
@@ -120,8 +79,8 @@ function SheetBody({ className, ...props }) {
|
|
|
120
79
|
* @since 0.3.16-canary.0
|
|
121
80
|
*/
|
|
122
81
|
function SheetFooter({ className, ...props }) {
|
|
123
|
-
return /* @__PURE__ */ jsx("
|
|
124
|
-
className: cn("flex shrink-0 flex-col
|
|
82
|
+
return /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: cn("mt-auto flex shrink-0 flex-col gap-2 p-4", className),
|
|
125
84
|
"data-slot": "sheet-footer",
|
|
126
85
|
...props
|
|
127
86
|
});
|
|
@@ -130,8 +89,8 @@ function SheetFooter({ className, ...props }) {
|
|
|
130
89
|
* @since 0.3.16-canary.0
|
|
131
90
|
*/
|
|
132
91
|
function SheetTitle({ className, ...props }) {
|
|
133
|
-
return /* @__PURE__ */ jsx(
|
|
134
|
-
className: cn("
|
|
92
|
+
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
93
|
+
className: cn("font-heading font-medium text-foreground", className),
|
|
135
94
|
"data-slot": "sheet-title",
|
|
136
95
|
...props
|
|
137
96
|
});
|
|
@@ -140,7 +99,7 @@ function SheetTitle({ className, ...props }) {
|
|
|
140
99
|
* @since 0.3.16-canary.0
|
|
141
100
|
*/
|
|
142
101
|
function SheetDescription({ className, ...props }) {
|
|
143
|
-
return /* @__PURE__ */ jsx(
|
|
102
|
+
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
144
103
|
className: cn("text-sm text-muted-foreground", className),
|
|
145
104
|
"data-slot": "sheet-description",
|
|
146
105
|
...props
|
|
@@ -149,8 +108,8 @@ function SheetDescription({ className, ...props }) {
|
|
|
149
108
|
/**
|
|
150
109
|
* @since 0.3.16-canary.0
|
|
151
110
|
*/
|
|
152
|
-
function SheetClose({ className, size, variant
|
|
153
|
-
return /* @__PURE__ */ jsx(
|
|
111
|
+
function SheetClose({ className, size, variant, ...props }) {
|
|
112
|
+
return /* @__PURE__ */ jsx(Dialog.Close, {
|
|
154
113
|
className: buttonVariants({
|
|
155
114
|
className,
|
|
156
115
|
size,
|
|
@@ -161,4 +120,4 @@ function SheetClose({ className, size, variant = "outline", ...props }) {
|
|
|
161
120
|
});
|
|
162
121
|
}
|
|
163
122
|
//#endregion
|
|
164
|
-
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger
|
|
123
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
import { VariantProps } from "../lib/utils.mjs";
|
|
2
1
|
import { Button } from "./button.mjs";
|
|
3
2
|
import { Separator } from "./separator.mjs";
|
|
4
3
|
import { Input } from "./input.mjs";
|
|
5
4
|
import { TooltipContent } from "./tooltip.mjs";
|
|
6
|
-
import
|
|
5
|
+
import { SidebarMenuButtonVariants } from "../variants/sidebar.mjs";
|
|
7
6
|
import { ComponentProps, Dispatch, JSX, SetStateAction } from "react";
|
|
8
7
|
|
|
9
8
|
//#region src/components/sidebar.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* @since 0.3.16-canary.0
|
|
12
|
-
*/
|
|
13
|
-
declare const sidebarMenuButtonVariants: _$_codefast_tailwind_variants0.VariantResolver<{
|
|
14
|
-
size: {
|
|
15
|
-
sm: string[];
|
|
16
|
-
md: string[];
|
|
17
|
-
lg: string[];
|
|
18
|
-
};
|
|
19
|
-
variant: {
|
|
20
|
-
default: string;
|
|
21
|
-
outline: string[];
|
|
22
|
-
};
|
|
23
|
-
}, Record<string, never>>;
|
|
24
9
|
interface SidebarContextValue {
|
|
25
10
|
isMobile: boolean;
|
|
26
11
|
open: boolean;
|
|
@@ -78,7 +63,6 @@ type SidebarTriggerProps = ComponentProps<typeof Button>;
|
|
|
78
63
|
* @since 0.3.16-canary.0
|
|
79
64
|
*/
|
|
80
65
|
declare function SidebarTrigger({
|
|
81
|
-
className,
|
|
82
66
|
onClick,
|
|
83
67
|
...props
|
|
84
68
|
}: SidebarTriggerProps): JSX.Element;
|
|
@@ -234,7 +218,7 @@ declare function SidebarMenuItem({
|
|
|
234
218
|
/**
|
|
235
219
|
* @since 0.3.16-canary.0
|
|
236
220
|
*/
|
|
237
|
-
interface SidebarMenuButtonProps extends ComponentProps<"button">,
|
|
221
|
+
interface SidebarMenuButtonProps extends ComponentProps<"button">, SidebarMenuButtonVariants {
|
|
238
222
|
asChild?: boolean;
|
|
239
223
|
isActive?: boolean;
|
|
240
224
|
tooltip?: ComponentProps<typeof TooltipContent> | string;
|
|
@@ -333,4 +317,4 @@ declare function SidebarMenuSubButton({
|
|
|
333
317
|
...props
|
|
334
318
|
}: SidebarMenuSubButtonProps): JSX.Element;
|
|
335
319
|
//#endregion
|
|
336
|
-
export { Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, SidebarGroupAction, type SidebarGroupActionProps, SidebarGroupContent, type SidebarGroupContentProps, SidebarGroupLabel, type SidebarGroupLabelProps, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarInput, type SidebarInputProps, SidebarInset, type SidebarInsetProps, SidebarMenu, SidebarMenuAction, type SidebarMenuActionProps, SidebarMenuBadge, type SidebarMenuBadgeProps, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, type SidebarMenuItemProps, type SidebarMenuProps, SidebarMenuSkeleton, type SidebarMenuSkeletonProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, type SidebarMenuSubItemProps, type SidebarMenuSubProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, type SidebarRailProps, SidebarSeparator, type SidebarSeparatorProps, SidebarTrigger, type SidebarTriggerProps,
|
|
320
|
+
export { Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, SidebarGroupAction, type SidebarGroupActionProps, SidebarGroupContent, type SidebarGroupContentProps, SidebarGroupLabel, type SidebarGroupLabelProps, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarInput, type SidebarInputProps, SidebarInset, type SidebarInsetProps, SidebarMenu, SidebarMenuAction, type SidebarMenuActionProps, SidebarMenuBadge, type SidebarMenuBadgeProps, SidebarMenuButton, type SidebarMenuButtonProps, SidebarMenuItem, type SidebarMenuItemProps, type SidebarMenuProps, SidebarMenuSkeleton, type SidebarMenuSkeletonProps, SidebarMenuSub, SidebarMenuSubButton, type SidebarMenuSubButtonProps, SidebarMenuSubItem, type SidebarMenuSubItemProps, type SidebarMenuSubProps, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarRail, type SidebarRailProps, SidebarSeparator, type SidebarSeparatorProps, SidebarTrigger, type SidebarTriggerProps, useSidebar };
|
|
@@ -1,62 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn, tv } from "../lib/utils.mjs";
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
2
|
import { Button } from "./button.mjs";
|
|
4
|
-
import { Separator } from "./separator.mjs";
|
|
3
|
+
import { Separator as Separator$1 } from "./separator.mjs";
|
|
5
4
|
import { Input } from "./input.mjs";
|
|
6
5
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.mjs";
|
|
7
6
|
import { Skeleton } from "./skeleton.mjs";
|
|
8
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.mjs";
|
|
7
|
+
import { Tooltip as Tooltip$1, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.mjs";
|
|
9
8
|
import { useIsMobile } from "../hooks/use-is-mobile.mjs";
|
|
10
|
-
import {
|
|
9
|
+
import { sidebarMenuButtonVariants } from "../variants/sidebar.mjs";
|
|
11
10
|
import { PanelLeftIcon } from "lucide-react";
|
|
11
|
+
import { Slot } from "radix-ui";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useCallback, useEffect, useState } from "react";
|
|
14
|
-
import {
|
|
14
|
+
import { Context } from "radix-ui/internal";
|
|
15
15
|
//#region src/components/sidebar.tsx
|
|
16
|
-
/**
|
|
17
|
-
* @since 0.3.16-canary.0
|
|
18
|
-
*/
|
|
19
|
-
const sidebarMenuButtonVariants = tv({
|
|
20
|
-
base: [
|
|
21
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden p-2",
|
|
22
|
-
"rounded-md ring-sidebar-ring outline-hidden",
|
|
23
|
-
"text-left text-sm",
|
|
24
|
-
"transition-[width,height,padding]",
|
|
25
|
-
"group-has-data-[sidebar=menu-action]/menu-item:pr-8",
|
|
26
|
-
"group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2!",
|
|
27
|
-
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
28
|
-
"focus-visible:ring-3",
|
|
29
|
-
"active:bg-sidebar-accent active:text-sidebar-accent-foreground",
|
|
30
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
31
|
-
"aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
32
|
-
"data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground",
|
|
33
|
-
"data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground",
|
|
34
|
-
"[&>span:last-child]:truncate",
|
|
35
|
-
"[&>svg]:size-4 [&>svg]:shrink-0"
|
|
36
|
-
],
|
|
37
|
-
defaultVariants: {
|
|
38
|
-
size: "md",
|
|
39
|
-
variant: "default"
|
|
40
|
-
},
|
|
41
|
-
variants: {
|
|
42
|
-
size: {
|
|
43
|
-
sm: ["h-7", "text-xs"],
|
|
44
|
-
md: ["h-8", "text-sm"],
|
|
45
|
-
lg: ["h-12 text-sm", "group-data-[collapsible=icon]:p-0!"]
|
|
46
|
-
},
|
|
47
|
-
variant: {
|
|
48
|
-
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
49
|
-
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))]"]
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
16
|
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
54
17
|
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
55
18
|
const SIDEBAR_WIDTH = "16rem";
|
|
56
19
|
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
57
20
|
const SIDEBAR_WIDTH_ICON = "3.0625rem";
|
|
58
21
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
59
|
-
const [SidebarContextProvider, useSidebar] = createContext("SidebarProvider");
|
|
22
|
+
const [SidebarContextProvider, useSidebar] = Context.createContext("SidebarProvider");
|
|
60
23
|
/**
|
|
61
24
|
* @since 0.3.16-canary.0
|
|
62
25
|
*/
|
|
@@ -98,7 +61,7 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
|
|
|
98
61
|
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
99
62
|
delayDuration: 0,
|
|
100
63
|
children: /* @__PURE__ */ jsx("div", {
|
|
101
|
-
className: cn("group/sidebar-wrapper flex min-h-svh w-full
|
|
64
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
102
65
|
"data-slot": "sidebar-wrapper",
|
|
103
66
|
style: {
|
|
104
67
|
"--sidebar-width": SIDEBAR_WIDTH,
|
|
@@ -118,7 +81,7 @@ const SIDEBAR_NAME = "Sidebar";
|
|
|
118
81
|
function Sidebar({ children, className, collapsible = "offcanvas", side = "left", variant = "sidebar", ...props }) {
|
|
119
82
|
const { isMobile, openMobile, setOpenMobile, state } = useSidebar(SIDEBAR_NAME);
|
|
120
83
|
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
121
|
-
className: cn("flex h-full w-(--sidebar-width) flex-col
|
|
84
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
122
85
|
"data-slot": "sidebar",
|
|
123
86
|
...props,
|
|
124
87
|
children
|
|
@@ -128,7 +91,7 @@ function Sidebar({ children, className, collapsible = "offcanvas", side = "left"
|
|
|
128
91
|
onOpenChange: setOpenMobile,
|
|
129
92
|
...props,
|
|
130
93
|
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
131
|
-
className:
|
|
94
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
132
95
|
"data-mobile": "true",
|
|
133
96
|
"data-sidebar": "sidebar",
|
|
134
97
|
"data-slot": "sidebar",
|
|
@@ -144,21 +107,22 @@ function Sidebar({ children, className, collapsible = "offcanvas", side = "left"
|
|
|
144
107
|
})
|
|
145
108
|
});
|
|
146
109
|
return /* @__PURE__ */ jsxs("div", {
|
|
147
|
-
className: cn("group peer hidden
|
|
110
|
+
className: cn("group peer hidden text-sidebar-foreground md:block", className),
|
|
148
111
|
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
149
112
|
"data-side": side,
|
|
150
113
|
"data-slot": "sidebar",
|
|
151
114
|
"data-state": state,
|
|
152
115
|
"data-variant": variant,
|
|
153
116
|
children: [/* @__PURE__ */ jsx("div", {
|
|
154
|
-
className: cn("relative
|
|
117
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-gentle 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)"),
|
|
155
118
|
"data-slot": "sidebar-gap"
|
|
156
119
|
}), /* @__PURE__ */ jsx("div", {
|
|
157
|
-
className: cn("fixed inset-y-0 z-10 hidden
|
|
120
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-gentle md:flex data-side-right:right-0 data-side-right:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] data-side-left:left-0 data-side-left:group-data-[collapsible=offcanvas]:left-[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-right:border-l group-data-side-left:border-r", className),
|
|
121
|
+
"data-side": side,
|
|
158
122
|
"data-slot": "sidebar-container",
|
|
159
123
|
...props,
|
|
160
124
|
children: /* @__PURE__ */ jsx("div", {
|
|
161
|
-
className:
|
|
125
|
+
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",
|
|
162
126
|
"data-sidebar": "sidebar",
|
|
163
127
|
"data-slot": "sidebar-inner",
|
|
164
128
|
children
|
|
@@ -170,20 +134,19 @@ const SIDEBAR_TRIGGER_NAME = "SidebarTrigger";
|
|
|
170
134
|
/**
|
|
171
135
|
* @since 0.3.16-canary.0
|
|
172
136
|
*/
|
|
173
|
-
function SidebarTrigger({
|
|
137
|
+
function SidebarTrigger({ onClick, ...props }) {
|
|
174
138
|
const { toggleSidebar } = useSidebar(SIDEBAR_TRIGGER_NAME);
|
|
175
139
|
return /* @__PURE__ */ jsxs(Button, {
|
|
176
|
-
className: cn("size-7", className),
|
|
177
140
|
"data-sidebar": "trigger",
|
|
178
141
|
"data-slot": "sidebar-trigger",
|
|
179
|
-
size: "icon",
|
|
142
|
+
size: "icon-sm",
|
|
180
143
|
variant: "ghost",
|
|
181
144
|
onClick: (event) => {
|
|
182
145
|
onClick?.(event);
|
|
183
146
|
toggleSidebar();
|
|
184
147
|
},
|
|
185
148
|
...props,
|
|
186
|
-
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
149
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, { className: "rtl:rotate-180" }), /* @__PURE__ */ jsx("span", {
|
|
187
150
|
className: "sr-only",
|
|
188
151
|
children: "Toggle Sidebar"
|
|
189
152
|
})]
|
|
@@ -196,7 +159,7 @@ const SIDEBAR_RAIL_NAME = "SidebarRail";
|
|
|
196
159
|
function SidebarRail({ className, ...props }) {
|
|
197
160
|
const { toggleSidebar } = useSidebar(SIDEBAR_RAIL_NAME);
|
|
198
161
|
return /* @__PURE__ */ jsx("button", {
|
|
199
|
-
className: cn("absolute inset-y-0 z-20 hidden
|
|
162
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-gentle group-data-[collapsible=offcanvas]:translate-x-0 group-data-side-right:left-0 group-data-side-left:-right-4 after:absolute after:inset-y-0 after:inset-s-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar hover:after:bg-sidebar-border in-data-side-right:cursor-e-resize in-data-side-left:cursor-w-resize sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2 [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", className),
|
|
200
163
|
"data-sidebar": "rail",
|
|
201
164
|
"data-slot": "sidebar-rail",
|
|
202
165
|
title: "Toggle Sidebar",
|
|
@@ -210,7 +173,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
210
173
|
*/
|
|
211
174
|
function SidebarInset({ className, ...props }) {
|
|
212
175
|
return /* @__PURE__ */ jsx("main", {
|
|
213
|
-
className: cn("relative flex w-full
|
|
176
|
+
className: cn("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-collapsed:ml-2", className),
|
|
214
177
|
"data-slot": "sidebar-inset",
|
|
215
178
|
...props
|
|
216
179
|
});
|
|
@@ -220,7 +183,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
220
183
|
*/
|
|
221
184
|
function SidebarInput({ className, ...props }) {
|
|
222
185
|
return /* @__PURE__ */ jsx(Input, {
|
|
223
|
-
className: cn("h-8 w-full
|
|
186
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
224
187
|
"data-sidebar": "input",
|
|
225
188
|
"data-slot": "sidebar-input",
|
|
226
189
|
...props
|
|
@@ -231,7 +194,7 @@ function SidebarInput({ className, ...props }) {
|
|
|
231
194
|
*/
|
|
232
195
|
function SidebarHeader({ className, ...props }) {
|
|
233
196
|
return /* @__PURE__ */ jsx("div", {
|
|
234
|
-
className: cn("flex flex-col gap-2
|
|
197
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
235
198
|
"data-sidebar": "header",
|
|
236
199
|
"data-slot": "sidebar-header",
|
|
237
200
|
...props
|
|
@@ -242,7 +205,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
242
205
|
*/
|
|
243
206
|
function SidebarFooter({ className, ...props }) {
|
|
244
207
|
return /* @__PURE__ */ jsx("div", {
|
|
245
|
-
className: cn("flex flex-col gap-2
|
|
208
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
246
209
|
"data-sidebar": "footer",
|
|
247
210
|
"data-slot": "sidebar-footer",
|
|
248
211
|
...props
|
|
@@ -252,8 +215,8 @@ function SidebarFooter({ className, ...props }) {
|
|
|
252
215
|
* @since 0.3.16-canary.0
|
|
253
216
|
*/
|
|
254
217
|
function SidebarSeparator({ className, ...props }) {
|
|
255
|
-
return /* @__PURE__ */ jsx(Separator, {
|
|
256
|
-
className: cn("mx-2 w-auto
|
|
218
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
219
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
257
220
|
"data-sidebar": "separator",
|
|
258
221
|
"data-slot": "sidebar-separator",
|
|
259
222
|
...props
|
|
@@ -264,7 +227,7 @@ function SidebarSeparator({ className, ...props }) {
|
|
|
264
227
|
*/
|
|
265
228
|
function SidebarContent({ className, ...props }) {
|
|
266
229
|
return /* @__PURE__ */ jsx("div", {
|
|
267
|
-
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto
|
|
230
|
+
className: cn("flex min-h-0 flex-1 scrollbar-none flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
268
231
|
"data-sidebar": "content",
|
|
269
232
|
"data-slot": "sidebar-content",
|
|
270
233
|
...props
|
|
@@ -275,7 +238,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
275
238
|
*/
|
|
276
239
|
function SidebarGroup({ className, ...props }) {
|
|
277
240
|
return /* @__PURE__ */ jsx("div", {
|
|
278
|
-
className: cn("relative flex w-full min-w-0 flex-col
|
|
241
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
279
242
|
"data-sidebar": "group",
|
|
280
243
|
"data-slot": "sidebar-group",
|
|
281
244
|
...props
|
|
@@ -285,8 +248,8 @@ function SidebarGroup({ className, ...props }) {
|
|
|
285
248
|
* @since 0.3.16-canary.0
|
|
286
249
|
*/
|
|
287
250
|
function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
288
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
289
|
-
className: cn("flex h-8 shrink-0 items-center
|
|
251
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
252
|
+
className: cn("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-gentle group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", className),
|
|
290
253
|
"data-sidebar": "group-label",
|
|
291
254
|
"data-slot": "sidebar-group-label",
|
|
292
255
|
...props
|
|
@@ -296,8 +259,8 @@ function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
|
296
259
|
* @since 0.3.16-canary.0
|
|
297
260
|
*/
|
|
298
261
|
function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
299
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
300
|
-
className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center p-0
|
|
262
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
263
|
+
className: cn("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", className),
|
|
301
264
|
"data-sidebar": "group-action",
|
|
302
265
|
"data-slot": "sidebar-group-action",
|
|
303
266
|
...props
|
|
@@ -308,7 +271,7 @@ function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
|
308
271
|
*/
|
|
309
272
|
function SidebarGroupContent({ className, ...props }) {
|
|
310
273
|
return /* @__PURE__ */ jsx("div", {
|
|
311
|
-
className: cn("w-full
|
|
274
|
+
className: cn("w-full text-sm", className),
|
|
312
275
|
"data-sidebar": "group-content",
|
|
313
276
|
"data-slot": "sidebar-group-content",
|
|
314
277
|
...props
|
|
@@ -340,14 +303,15 @@ const SIDEBAR_MENU_BUTTON_NAME = "SidebarMenuButton";
|
|
|
340
303
|
/**
|
|
341
304
|
* @since 0.3.16-canary.0
|
|
342
305
|
*/
|
|
343
|
-
function SidebarMenuButton({ asChild = false, className, isActive = false, size = "
|
|
344
|
-
const Component = asChild ? Slot : "button";
|
|
306
|
+
function SidebarMenuButton({ asChild = false, className, isActive = false, size = "default", tooltip, variant = "default", ...props }) {
|
|
307
|
+
const Component = asChild ? Slot.Root : "button";
|
|
345
308
|
const { isMobile, state } = useSidebar(SIDEBAR_MENU_BUTTON_NAME);
|
|
346
309
|
const button = /* @__PURE__ */ jsx(Component, {
|
|
347
|
-
className:
|
|
310
|
+
className: sidebarMenuButtonVariants({
|
|
348
311
|
size,
|
|
349
|
-
variant
|
|
350
|
-
|
|
312
|
+
variant,
|
|
313
|
+
className
|
|
314
|
+
}),
|
|
351
315
|
"data-active": isActive,
|
|
352
316
|
"data-sidebar": "menu-button",
|
|
353
317
|
"data-size": size,
|
|
@@ -356,7 +320,7 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
356
320
|
});
|
|
357
321
|
if (!tooltip) return button;
|
|
358
322
|
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
359
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
323
|
+
return /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
360
324
|
asChild: true,
|
|
361
325
|
children: button
|
|
362
326
|
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
@@ -370,8 +334,8 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
370
334
|
* @since 0.3.16-canary.0
|
|
371
335
|
*/
|
|
372
336
|
function SidebarMenuAction({ asChild = false, className, showOnHover = false, ...props }) {
|
|
373
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
374
|
-
className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center p-0
|
|
337
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
338
|
+
className: cn("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", 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", className),
|
|
375
339
|
"data-sidebar": "menu-action",
|
|
376
340
|
"data-slot": "sidebar-menu-action",
|
|
377
341
|
...props
|
|
@@ -382,7 +346,7 @@ function SidebarMenuAction({ asChild = false, className, showOnHover = false, ..
|
|
|
382
346
|
*/
|
|
383
347
|
function SidebarMenuBadge({ className, ...props }) {
|
|
384
348
|
return /* @__PURE__ */ jsx("div", {
|
|
385
|
-
className: cn("absolute right-1 flex h-5 min-w-5 items-center justify-center px-1
|
|
349
|
+
className: cn("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", className),
|
|
386
350
|
"data-sidebar": "menu-badge",
|
|
387
351
|
"data-slot": "sidebar-menu-badge",
|
|
388
352
|
...props
|
|
@@ -394,12 +358,12 @@ function SidebarMenuBadge({ className, ...props }) {
|
|
|
394
358
|
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
395
359
|
const [width] = useState(() => `${String(Math.floor(Math.random() * 40) + 50)}%`);
|
|
396
360
|
return /* @__PURE__ */ jsxs("div", {
|
|
397
|
-
className: cn("flex h-8 items-center gap-2 px-2",
|
|
361
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
398
362
|
"data-sidebar": "menu-skeleton",
|
|
399
363
|
"data-slot": "sidebar-menu-skeleton",
|
|
400
364
|
...props,
|
|
401
365
|
children: [showIcon ? /* @__PURE__ */ jsx(Skeleton, {
|
|
402
|
-
className:
|
|
366
|
+
className: "size-4 rounded-md",
|
|
403
367
|
"data-sidebar": "menu-skeleton-icon"
|
|
404
368
|
}) : null, /* @__PURE__ */ jsx(Skeleton, {
|
|
405
369
|
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
@@ -413,7 +377,7 @@ function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
|
413
377
|
*/
|
|
414
378
|
function SidebarMenuSub({ className, ...props }) {
|
|
415
379
|
return /* @__PURE__ */ jsx("ul", {
|
|
416
|
-
className: cn("mx-3.5 flex min-w-0 flex-col gap-1
|
|
380
|
+
className: cn("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", className),
|
|
417
381
|
"data-sidebar": "menu-sub",
|
|
418
382
|
"data-slot": "sidebar-menu-sub",
|
|
419
383
|
...props
|
|
@@ -434,8 +398,8 @@ function SidebarMenuSubItem({ className, ...props }) {
|
|
|
434
398
|
* @since 0.3.16-canary.0
|
|
435
399
|
*/
|
|
436
400
|
function SidebarMenuSubButton({ asChild = false, className, isActive = false, size = "md", ...props }) {
|
|
437
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
438
|
-
className: cn("flex h-7 min-w-0 items-center gap-2 overflow-hidden px-2
|
|
401
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "a", {
|
|
402
|
+
className: cn("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", className),
|
|
439
403
|
"data-active": isActive,
|
|
440
404
|
"data-sidebar": "menu-sub-button",
|
|
441
405
|
"data-size": size,
|
|
@@ -444,4 +408,4 @@ function SidebarMenuSubButton({ asChild = false, className, isActive = false, si
|
|
|
444
408
|
});
|
|
445
409
|
}
|
|
446
410
|
//#endregion
|
|
447
|
-
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger,
|
|
411
|
+
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 };
|
|
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
function Skeleton({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
className: cn("rounded-
|
|
9
|
+
className: cn("animate-shimmer rounded-md bg-linear-to-r from-muted via-white/15 to-muted bg-size-[400%_100%]", className),
|
|
10
10
|
"data-slot": "skeleton",
|
|
11
11
|
...props
|
|
12
12
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Slider as Slider$1 } from "radix-ui";
|
|
1
2
|
import { ComponentProps, JSX } from "react";
|
|
2
|
-
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* @since 0.3.16-canary.0
|
|
7
7
|
*/
|
|
8
|
-
type SliderProps = ComponentProps<typeof
|
|
8
|
+
type SliderProps = ComponentProps<typeof Slider$1.Root>;
|
|
9
9
|
/**
|
|
10
10
|
* @since 0.3.16-canary.0
|
|
11
11
|
*/
|