@codefast/ui 0.3.16-canary.3 → 0.4.0-canary.5
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 +112 -0
- package/README.md +27 -16
- 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 +12 -2
- package/dist/components/alert.mjs +15 -6
- 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.mjs +4 -4
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +1 -1
- package/dist/components/button-group.mjs +6 -7
- package/dist/components/button.d.mts +0 -1
- package/dist/components/button.mjs +7 -7
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +39 -43
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -4
- package/dist/components/carousel.mjs +25 -12
- package/dist/components/chart.d.mts +8 -3
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +6 -6
- package/dist/components/checkbox-group.mjs +6 -7
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +8 -9
- 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 +2 -20
- package/dist/components/drawer.mjs +17 -25
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.mjs +5 -5
- package/dist/components/field.d.mts +1 -1
- package/dist/components/field.mjs +11 -12
- package/dist/components/form.d.mts +6 -7
- 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 +1 -1
- package/dist/components/input-group.mjs +12 -7
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +49 -27
- 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.mjs +9 -9
- 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 -8
- package/dist/components/navigation-menu.mjs +33 -23
- package/dist/components/pagination.d.mts +6 -0
- package/dist/components/pagination.mjs +26 -11
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +1 -1
- package/dist/components/progress-circle.mjs +1 -2
- 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 +5 -5
- package/dist/components/scroll-area.mjs +13 -10
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +2 -2
- package/dist/components/separator.mjs +3 -4
- package/dist/components/sheet.d.mts +13 -14
- package/dist/components/sheet.mjs +41 -39
- package/dist/components/sidebar.d.mts +2 -3
- package/dist/components/sidebar.mjs +46 -46
- 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 +9 -6
- package/dist/components/toggle-group.mjs +19 -20
- package/dist/components/toggle.d.mts +2 -3
- package/dist/components/toggle.mjs +4 -6
- 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 +15 -13
- package/dist/index.mjs +18 -16
- package/dist/primitives/checkbox-group.d.mts +9 -10
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -3
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -4
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -3
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +1 -1
- package/dist/variants/alert.mjs +3 -13
- package/dist/variants/badge.d.mts +6 -4
- package/dist/variants/badge.mjs +7 -34
- package/dist/variants/button-group.d.mts +2 -2
- package/dist/variants/button-group.mjs +3 -14
- package/dist/variants/button.d.mts +12 -10
- package/dist/variants/button.mjs +15 -57
- package/dist/variants/empty.d.mts +1 -1
- package/dist/variants/empty.mjs +2 -7
- package/dist/variants/field.d.mts +3 -3
- package/dist/variants/field.mjs +4 -22
- package/dist/variants/input-group.d.mts +9 -9
- package/dist/variants/input-group.mjs +11 -70
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +5 -4
- package/dist/variants/item.mjs +9 -31
- package/dist/variants/navigation-menu.d.mts +1 -1
- package/dist/variants/navigation-menu.mjs +1 -5
- package/dist/variants/progress-circle.d.mts +1 -1
- package/dist/variants/progress-circle.mjs +1 -5
- package/dist/variants/scroll-area.d.mts +2 -2
- package/dist/variants/scroll-area.mjs +3 -8
- package/dist/variants/separator.mjs +6 -6
- package/dist/variants/sheet.d.mts +4 -4
- package/dist/variants/sheet.mjs +5 -38
- package/dist/variants/sidebar.d.mts +4 -4
- package/dist/variants/sidebar.mjs +6 -23
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +4 -4
- package/dist/variants/toggle.mjs +9 -27
- package/package.json +27 -44
- package/src/components/accordion.tsx +26 -68
- package/src/components/alert-dialog.tsx +70 -86
- package/src/components/alert.tsx +27 -19
- package/src/components/aspect-ratio.tsx +1 -4
- package/src/components/avatar.tsx +99 -12
- package/src/components/badge.tsx +5 -8
- package/src/components/breadcrumb.tsx +18 -24
- package/src/components/button-group.tsx +10 -20
- package/src/components/button.tsx +8 -19
- package/src/components/calendar.tsx +77 -132
- package/src/components/card.tsx +16 -22
- package/src/components/carousel.tsx +40 -58
- package/src/components/chart.tsx +41 -92
- package/src/components/checkbox-cards.tsx +11 -30
- package/src/components/checkbox-group.tsx +6 -28
- package/src/components/checkbox.tsx +6 -26
- package/src/components/collapsible.tsx +1 -4
- package/src/components/command.tsx +52 -65
- package/src/components/context-menu.tsx +46 -125
- package/src/components/dialog.tsx +49 -101
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +17 -79
- package/src/components/dropdown-menu.tsx +39 -118
- package/src/components/empty.tsx +6 -20
- package/src/components/field.tsx +19 -52
- package/src/components/form.tsx +19 -61
- package/src/components/hover-card.tsx +4 -27
- package/src/components/input-group.tsx +13 -52
- package/src/components/input-number.tsx +55 -75
- package/src/components/input-otp.tsx +19 -38
- package/src/components/input-password.tsx +5 -29
- package/src/components/input-search.tsx +6 -23
- package/src/components/input.tsx +1 -17
- package/src/components/item.tsx +17 -31
- package/src/components/kbd.tsx +2 -14
- package/src/components/label.tsx +2 -10
- package/src/components/menubar.tsx +34 -125
- package/src/components/native-select.tsx +21 -30
- package/src/components/navigation-menu.tsx +34 -94
- package/src/components/pagination.tsx +28 -34
- package/src/components/popover.tsx +66 -35
- package/src/components/progress-circle.tsx +7 -25
- package/src/components/progress.tsx +3 -16
- package/src/components/radio-cards.tsx +8 -27
- package/src/components/radio-group.tsx +7 -27
- package/src/components/radio.tsx +3 -24
- package/src/components/resizable.tsx +5 -26
- package/src/components/scroll-area.tsx +12 -32
- package/src/components/select.tsx +37 -60
- package/src/components/separator.tsx +4 -18
- package/src/components/sheet.tsx +37 -74
- package/src/components/sidebar.tsx +47 -177
- package/src/components/skeleton.tsx +1 -3
- package/src/components/slider.tsx +7 -36
- package/src/components/sonner.tsx +16 -6
- package/src/components/spinner.tsx +6 -15
- package/src/components/switch.tsx +8 -30
- package/src/components/table.tsx +18 -35
- package/src/components/tabs.tsx +16 -34
- package/src/components/textarea.tsx +1 -15
- package/src/components/toggle-group.tsx +34 -38
- package/src/components/toggle.tsx +4 -13
- package/src/components/tooltip.tsx +11 -37
- package/src/css/foundation/base.css +74 -0
- package/src/css/foundation/motion.css +69 -0
- package/src/css/foundation/source.css +10 -0
- package/src/css/foundation/tokens.css +107 -0
- package/src/css/foundation/variants.css +121 -0
- package/src/css/preset.css +13 -214
- package/src/css/style.css +9 -1
- package/src/css/{amber.css → themes/amber.css} +29 -0
- package/src/css/{blue.css → themes/blue.css} +29 -0
- package/src/css/{cyan.css → themes/cyan.css} +29 -0
- package/src/css/{emerald.css → themes/emerald.css} +29 -0
- package/src/css/{fuchsia.css → themes/fuchsia.css} +29 -0
- package/src/css/{gray.css → themes/gray.css} +29 -0
- package/src/css/{green.css → themes/green.css} +29 -0
- package/src/css/{indigo.css → themes/indigo.css} +29 -0
- package/src/css/{lime.css → themes/lime.css} +29 -0
- package/src/css/{neutral.css → themes/neutral.css} +29 -0
- package/src/css/{orange.css → themes/orange.css} +29 -0
- package/src/css/{pink.css → themes/pink.css} +29 -0
- package/src/css/{purple.css → themes/purple.css} +29 -0
- package/src/css/{red.css → themes/red.css} +29 -0
- package/src/css/{rose.css → themes/rose.css} +29 -0
- package/src/css/{sky.css → themes/sky.css} +29 -0
- package/src/css/{slate.css → themes/slate.css} +29 -0
- package/src/css/{stone.css → themes/stone.css} +29 -0
- package/src/css/{teal.css → themes/teal.css} +29 -0
- package/src/css/{violet.css → themes/violet.css} +29 -0
- package/src/css/{yellow.css → themes/yellow.css} +29 -0
- package/src/css/{zinc.css → themes/zinc.css} +29 -0
- package/src/hooks/use-animated-value.ts +1 -7
- package/src/hooks/use-copy-to-clipboard.ts +1 -6
- package/src/hooks/use-is-mobile.ts +0 -2
- package/src/hooks/use-media-query.ts +0 -2
- package/src/hooks/use-mutation-observer.ts +0 -3
- package/src/hooks/use-pagination.ts +0 -2
- package/src/index.ts +39 -80
- package/src/primitives/checkbox-group.tsx +25 -39
- package/src/primitives/input-number.tsx +17 -63
- package/src/primitives/input.tsx +8 -24
- package/src/primitives/progress-circle.tsx +13 -43
- package/src/variants/alert.ts +3 -14
- package/src/variants/badge.ts +8 -35
- package/src/variants/button-group.ts +5 -18
- package/src/variants/button.ts +21 -58
- package/src/variants/empty.ts +2 -11
- package/src/variants/field.ts +6 -19
- package/src/variants/input-group.ts +12 -64
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +10 -32
- package/src/variants/navigation-menu.ts +1 -8
- package/src/variants/progress-circle.ts +1 -2
- package/src/variants/scroll-area.ts +3 -9
- package/src/variants/separator.ts +6 -7
- package/src/variants/sheet.ts +6 -39
- package/src/variants/sidebar.ts +7 -27
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +9 -28
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { cn } from "../lib/utils.mjs";
|
|
3
|
-
import { Separator } from "./separator.mjs";
|
|
4
2
|
import { Button } from "./button.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
|
-
import { sidebarMenuButtonVariants } from "../variants/sidebar.mjs";
|
|
8
6
|
import { Skeleton } from "./skeleton.mjs";
|
|
9
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.mjs";
|
|
7
|
+
import { Tooltip as Tooltip$1, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.mjs";
|
|
10
8
|
import { useIsMobile } from "../hooks/use-is-mobile.mjs";
|
|
11
|
-
import {
|
|
9
|
+
import { sidebarMenuButtonVariants } from "../variants/sidebar.mjs";
|
|
12
10
|
import { PanelLeftIcon } from "lucide-react";
|
|
11
|
+
import { Slot } from "radix-ui";
|
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
13
|
import { useCallback, useEffect, useState } from "react";
|
|
15
|
-
import {
|
|
14
|
+
import { Context } from "radix-ui/internal";
|
|
16
15
|
//#region src/components/sidebar.tsx
|
|
17
16
|
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
18
17
|
const SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
|
|
@@ -20,7 +19,7 @@ const SIDEBAR_WIDTH = "16rem";
|
|
|
20
19
|
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
21
20
|
const SIDEBAR_WIDTH_ICON = "3.0625rem";
|
|
22
21
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
23
|
-
const [SidebarContextProvider, useSidebar] = createContext("SidebarProvider");
|
|
22
|
+
const [SidebarContextProvider, useSidebar] = Context.createContext("SidebarProvider");
|
|
24
23
|
/**
|
|
25
24
|
* @since 0.3.16-canary.0
|
|
26
25
|
*/
|
|
@@ -62,7 +61,7 @@ function SidebarProvider({ children, className, defaultOpen = true, onOpenChange
|
|
|
62
61
|
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
63
62
|
delayDuration: 0,
|
|
64
63
|
children: /* @__PURE__ */ jsx("div", {
|
|
65
|
-
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),
|
|
66
65
|
"data-slot": "sidebar-wrapper",
|
|
67
66
|
style: {
|
|
68
67
|
"--sidebar-width": SIDEBAR_WIDTH,
|
|
@@ -82,7 +81,7 @@ const SIDEBAR_NAME = "Sidebar";
|
|
|
82
81
|
function Sidebar({ children, className, collapsible = "offcanvas", side = "left", variant = "sidebar", ...props }) {
|
|
83
82
|
const { isMobile, openMobile, setOpenMobile, state } = useSidebar(SIDEBAR_NAME);
|
|
84
83
|
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
85
|
-
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),
|
|
86
85
|
"data-slot": "sidebar",
|
|
87
86
|
...props,
|
|
88
87
|
children
|
|
@@ -92,7 +91,7 @@ function Sidebar({ children, className, collapsible = "offcanvas", side = "left"
|
|
|
92
91
|
onOpenChange: setOpenMobile,
|
|
93
92
|
...props,
|
|
94
93
|
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
95
|
-
className:
|
|
94
|
+
className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
|
|
96
95
|
"data-mobile": "true",
|
|
97
96
|
"data-sidebar": "sidebar",
|
|
98
97
|
"data-slot": "sidebar",
|
|
@@ -108,21 +107,22 @@ function Sidebar({ children, className, collapsible = "offcanvas", side = "left"
|
|
|
108
107
|
})
|
|
109
108
|
});
|
|
110
109
|
return /* @__PURE__ */ jsxs("div", {
|
|
111
|
-
className: cn("group peer hidden
|
|
110
|
+
className: cn("group peer hidden text-sidebar-foreground md:block", className),
|
|
112
111
|
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
113
112
|
"data-side": side,
|
|
114
113
|
"data-slot": "sidebar",
|
|
115
114
|
"data-state": state,
|
|
116
115
|
"data-variant": variant,
|
|
117
116
|
children: [/* @__PURE__ */ jsx("div", {
|
|
118
|
-
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)"),
|
|
119
118
|
"data-slot": "sidebar-gap"
|
|
120
119
|
}), /* @__PURE__ */ jsx("div", {
|
|
121
|
-
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,
|
|
122
122
|
"data-slot": "sidebar-container",
|
|
123
123
|
...props,
|
|
124
124
|
children: /* @__PURE__ */ jsx("div", {
|
|
125
|
-
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",
|
|
126
126
|
"data-sidebar": "sidebar",
|
|
127
127
|
"data-slot": "sidebar-inner",
|
|
128
128
|
children
|
|
@@ -134,20 +134,19 @@ const SIDEBAR_TRIGGER_NAME = "SidebarTrigger";
|
|
|
134
134
|
/**
|
|
135
135
|
* @since 0.3.16-canary.0
|
|
136
136
|
*/
|
|
137
|
-
function SidebarTrigger({
|
|
137
|
+
function SidebarTrigger({ onClick, ...props }) {
|
|
138
138
|
const { toggleSidebar } = useSidebar(SIDEBAR_TRIGGER_NAME);
|
|
139
139
|
return /* @__PURE__ */ jsxs(Button, {
|
|
140
|
-
className: cn("size-7", className),
|
|
141
140
|
"data-sidebar": "trigger",
|
|
142
141
|
"data-slot": "sidebar-trigger",
|
|
143
|
-
size: "icon",
|
|
142
|
+
size: "icon-sm",
|
|
144
143
|
variant: "ghost",
|
|
145
144
|
onClick: (event) => {
|
|
146
145
|
onClick?.(event);
|
|
147
146
|
toggleSidebar();
|
|
148
147
|
},
|
|
149
148
|
...props,
|
|
150
|
-
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
149
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, { className: "rtl:rotate-180" }), /* @__PURE__ */ jsx("span", {
|
|
151
150
|
className: "sr-only",
|
|
152
151
|
children: "Toggle Sidebar"
|
|
153
152
|
})]
|
|
@@ -160,7 +159,7 @@ const SIDEBAR_RAIL_NAME = "SidebarRail";
|
|
|
160
159
|
function SidebarRail({ className, ...props }) {
|
|
161
160
|
const { toggleSidebar } = useSidebar(SIDEBAR_RAIL_NAME);
|
|
162
161
|
return /* @__PURE__ */ jsx("button", {
|
|
163
|
-
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 rtl:group-data-[collapsible=offcanvas]:-translate-x-0 rtl:in-data-side-right:cursor-w-resize rtl:in-data-side-left:cursor-e-resize [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize rtl:[[data-side=left][data-state=collapsed]_&]:cursor-w-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize rtl:[[data-side=right][data-state=collapsed]_&]:cursor-e-resize", className),
|
|
164
163
|
"data-sidebar": "rail",
|
|
165
164
|
"data-slot": "sidebar-rail",
|
|
166
165
|
title: "Toggle Sidebar",
|
|
@@ -174,7 +173,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
174
173
|
*/
|
|
175
174
|
function SidebarInset({ className, ...props }) {
|
|
176
175
|
return /* @__PURE__ */ jsx("main", {
|
|
177
|
-
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]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-collapsed:ms-2", className),
|
|
178
177
|
"data-slot": "sidebar-inset",
|
|
179
178
|
...props
|
|
180
179
|
});
|
|
@@ -184,7 +183,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
184
183
|
*/
|
|
185
184
|
function SidebarInput({ className, ...props }) {
|
|
186
185
|
return /* @__PURE__ */ jsx(Input, {
|
|
187
|
-
className: cn("h-8 w-full
|
|
186
|
+
className: cn("h-8 w-full bg-background shadow-none", className),
|
|
188
187
|
"data-sidebar": "input",
|
|
189
188
|
"data-slot": "sidebar-input",
|
|
190
189
|
...props
|
|
@@ -195,7 +194,7 @@ function SidebarInput({ className, ...props }) {
|
|
|
195
194
|
*/
|
|
196
195
|
function SidebarHeader({ className, ...props }) {
|
|
197
196
|
return /* @__PURE__ */ jsx("div", {
|
|
198
|
-
className: cn("flex flex-col gap-2
|
|
197
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
199
198
|
"data-sidebar": "header",
|
|
200
199
|
"data-slot": "sidebar-header",
|
|
201
200
|
...props
|
|
@@ -206,7 +205,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
206
205
|
*/
|
|
207
206
|
function SidebarFooter({ className, ...props }) {
|
|
208
207
|
return /* @__PURE__ */ jsx("div", {
|
|
209
|
-
className: cn("flex flex-col gap-2
|
|
208
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
210
209
|
"data-sidebar": "footer",
|
|
211
210
|
"data-slot": "sidebar-footer",
|
|
212
211
|
...props
|
|
@@ -216,8 +215,8 @@ function SidebarFooter({ className, ...props }) {
|
|
|
216
215
|
* @since 0.3.16-canary.0
|
|
217
216
|
*/
|
|
218
217
|
function SidebarSeparator({ className, ...props }) {
|
|
219
|
-
return /* @__PURE__ */ jsx(Separator, {
|
|
220
|
-
className: cn("mx-2 w-auto
|
|
218
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
219
|
+
className: cn("mx-2 w-auto bg-sidebar-border", className),
|
|
221
220
|
"data-sidebar": "separator",
|
|
222
221
|
"data-slot": "sidebar-separator",
|
|
223
222
|
...props
|
|
@@ -228,7 +227,7 @@ function SidebarSeparator({ className, ...props }) {
|
|
|
228
227
|
*/
|
|
229
228
|
function SidebarContent({ className, ...props }) {
|
|
230
229
|
return /* @__PURE__ */ jsx("div", {
|
|
231
|
-
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),
|
|
232
231
|
"data-sidebar": "content",
|
|
233
232
|
"data-slot": "sidebar-content",
|
|
234
233
|
...props
|
|
@@ -239,7 +238,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
239
238
|
*/
|
|
240
239
|
function SidebarGroup({ className, ...props }) {
|
|
241
240
|
return /* @__PURE__ */ jsx("div", {
|
|
242
|
-
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),
|
|
243
242
|
"data-sidebar": "group",
|
|
244
243
|
"data-slot": "sidebar-group",
|
|
245
244
|
...props
|
|
@@ -249,8 +248,8 @@ function SidebarGroup({ className, ...props }) {
|
|
|
249
248
|
* @since 0.3.16-canary.0
|
|
250
249
|
*/
|
|
251
250
|
function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
252
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
253
|
-
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),
|
|
254
253
|
"data-sidebar": "group-label",
|
|
255
254
|
"data-slot": "sidebar-group-label",
|
|
256
255
|
...props
|
|
@@ -260,8 +259,8 @@ function SidebarGroupLabel({ asChild = false, className, ...props }) {
|
|
|
260
259
|
* @since 0.3.16-canary.0
|
|
261
260
|
*/
|
|
262
261
|
function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
263
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
264
|
-
className: cn("absolute top-3.5
|
|
262
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
263
|
+
className: cn("absolute end-3 top-3.5 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),
|
|
265
264
|
"data-sidebar": "group-action",
|
|
266
265
|
"data-slot": "sidebar-group-action",
|
|
267
266
|
...props
|
|
@@ -272,7 +271,7 @@ function SidebarGroupAction({ asChild = false, className, ...props }) {
|
|
|
272
271
|
*/
|
|
273
272
|
function SidebarGroupContent({ className, ...props }) {
|
|
274
273
|
return /* @__PURE__ */ jsx("div", {
|
|
275
|
-
className: cn("w-full
|
|
274
|
+
className: cn("w-full text-sm", className),
|
|
276
275
|
"data-sidebar": "group-content",
|
|
277
276
|
"data-slot": "sidebar-group-content",
|
|
278
277
|
...props
|
|
@@ -304,14 +303,15 @@ const SIDEBAR_MENU_BUTTON_NAME = "SidebarMenuButton";
|
|
|
304
303
|
/**
|
|
305
304
|
* @since 0.3.16-canary.0
|
|
306
305
|
*/
|
|
307
|
-
function SidebarMenuButton({ asChild = false, className, isActive = false, size = "
|
|
308
|
-
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";
|
|
309
308
|
const { isMobile, state } = useSidebar(SIDEBAR_MENU_BUTTON_NAME);
|
|
310
309
|
const button = /* @__PURE__ */ jsx(Component, {
|
|
311
|
-
className:
|
|
310
|
+
className: sidebarMenuButtonVariants({
|
|
312
311
|
size,
|
|
313
|
-
variant
|
|
314
|
-
|
|
312
|
+
variant,
|
|
313
|
+
className
|
|
314
|
+
}),
|
|
315
315
|
"data-active": isActive,
|
|
316
316
|
"data-sidebar": "menu-button",
|
|
317
317
|
"data-size": size,
|
|
@@ -320,7 +320,7 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
320
320
|
});
|
|
321
321
|
if (!tooltip) return button;
|
|
322
322
|
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
323
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
323
|
+
return /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
324
324
|
asChild: true,
|
|
325
325
|
children: button
|
|
326
326
|
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
@@ -334,8 +334,8 @@ function SidebarMenuButton({ asChild = false, className, isActive = false, size
|
|
|
334
334
|
* @since 0.3.16-canary.0
|
|
335
335
|
*/
|
|
336
336
|
function SidebarMenuAction({ asChild = false, className, showOnHover = false, ...props }) {
|
|
337
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
|
|
338
|
-
className: cn("absolute top-1.5
|
|
337
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
338
|
+
className: cn("absolute end-1 top-1.5 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),
|
|
339
339
|
"data-sidebar": "menu-action",
|
|
340
340
|
"data-slot": "sidebar-menu-action",
|
|
341
341
|
...props
|
|
@@ -346,7 +346,7 @@ function SidebarMenuAction({ asChild = false, className, showOnHover = false, ..
|
|
|
346
346
|
*/
|
|
347
347
|
function SidebarMenuBadge({ className, ...props }) {
|
|
348
348
|
return /* @__PURE__ */ jsx("div", {
|
|
349
|
-
className: cn("absolute
|
|
349
|
+
className: cn("pointer-events-none absolute end-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),
|
|
350
350
|
"data-sidebar": "menu-badge",
|
|
351
351
|
"data-slot": "sidebar-menu-badge",
|
|
352
352
|
...props
|
|
@@ -358,12 +358,12 @@ function SidebarMenuBadge({ className, ...props }) {
|
|
|
358
358
|
function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
359
359
|
const [width] = useState(() => `${String(Math.floor(Math.random() * 40) + 50)}%`);
|
|
360
360
|
return /* @__PURE__ */ jsxs("div", {
|
|
361
|
-
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),
|
|
362
362
|
"data-sidebar": "menu-skeleton",
|
|
363
363
|
"data-slot": "sidebar-menu-skeleton",
|
|
364
364
|
...props,
|
|
365
365
|
children: [showIcon ? /* @__PURE__ */ jsx(Skeleton, {
|
|
366
|
-
className:
|
|
366
|
+
className: "size-4 rounded-md",
|
|
367
367
|
"data-sidebar": "menu-skeleton-icon"
|
|
368
368
|
}) : null, /* @__PURE__ */ jsx(Skeleton, {
|
|
369
369
|
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
@@ -377,7 +377,7 @@ function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
|
|
|
377
377
|
*/
|
|
378
378
|
function SidebarMenuSub({ className, ...props }) {
|
|
379
379
|
return /* @__PURE__ */ jsx("ul", {
|
|
380
|
-
className: cn("mx-3.5 flex min-w-0 flex-col gap-1 px-2.5 py-0.5
|
|
380
|
+
className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-s border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden rtl:-translate-x-px", className),
|
|
381
381
|
"data-sidebar": "menu-sub",
|
|
382
382
|
"data-slot": "sidebar-menu-sub",
|
|
383
383
|
...props
|
|
@@ -398,8 +398,8 @@ function SidebarMenuSubItem({ className, ...props }) {
|
|
|
398
398
|
* @since 0.3.16-canary.0
|
|
399
399
|
*/
|
|
400
400
|
function SidebarMenuSubButton({ asChild = false, className, isActive = false, size = "md", ...props }) {
|
|
401
|
-
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
402
|
-
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 rtl:translate-x-px 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),
|
|
403
403
|
"data-active": isActive,
|
|
404
404
|
"data-sidebar": "menu-sub-button",
|
|
405
405
|
"data-size": size,
|
|
@@ -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
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { Slider as Slider$1 } from "radix-ui";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
-
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
6
5
|
//#region src/components/slider.tsx
|
|
7
6
|
/**
|
|
8
7
|
* @since 0.3.16-canary.0
|
|
@@ -17,24 +16,23 @@ function Slider({ className, defaultValue, max = 100, min = 0, value, ...props }
|
|
|
17
16
|
min,
|
|
18
17
|
max
|
|
19
18
|
]);
|
|
20
|
-
return /* @__PURE__ */ jsxs(
|
|
21
|
-
className: cn("relative flex w-full items-center
|
|
19
|
+
return /* @__PURE__ */ jsxs(Slider$1.Root, {
|
|
20
|
+
className: cn("relative flex w-full touch-none items-center select-none data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col data-disabled:opacity-50", className),
|
|
22
21
|
"data-slot": "slider",
|
|
23
22
|
defaultValue,
|
|
24
23
|
max,
|
|
25
24
|
min,
|
|
26
25
|
value,
|
|
27
26
|
...props,
|
|
28
|
-
children: [/* @__PURE__ */ jsx(
|
|
29
|
-
className:
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Slider$1.Track, {
|
|
28
|
+
className: "relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5",
|
|
30
29
|
"data-slot": "slider-track",
|
|
31
|
-
children: /* @__PURE__ */ jsx(
|
|
32
|
-
className:
|
|
30
|
+
children: /* @__PURE__ */ jsx(Slider$1.Range, {
|
|
31
|
+
className: "absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full",
|
|
33
32
|
"data-slot": "slider-range"
|
|
34
33
|
})
|
|
35
|
-
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
|
|
36
|
-
"
|
|
37
|
-
className: cn("flex size-4 items-center justify-center", "rounded-full border-2 border-primary", "bg-primary shadow-sm outline-hidden", "after:size-full after:rounded-full after:bg-background after:transition-[width,height] after:duration-200 after:ease-spring", "motion-reduce:after:transition-none motion-reduce:after:duration-0", "focus-visible:ring-4 focus-visible:ring-primary/20", "active:not-data-disabled:after:size-1", "dark:focus-visible:ring-primary/40"),
|
|
34
|
+
}), Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
35
|
+
className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] select-none hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50",
|
|
38
36
|
"data-slot": "slider-thumb"
|
|
39
37
|
}, index))]
|
|
40
38
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { cn } from "../lib/utils.mjs";
|
|
1
|
+
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
|
|
3
2
|
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { useTheme } from "next-themes";
|
|
5
4
|
import { Toaster as Toaster$1, toast, useSonner } from "sonner";
|
|
@@ -10,13 +9,22 @@ import { Toaster as Toaster$1, toast, useSonner } from "sonner";
|
|
|
10
9
|
function Toaster({ ...props }) {
|
|
11
10
|
const { theme = "system" } = useTheme();
|
|
12
11
|
return /* @__PURE__ */ jsx(Toaster$1, {
|
|
13
|
-
className:
|
|
12
|
+
className: "toaster group",
|
|
13
|
+
icons: {
|
|
14
|
+
error: /* @__PURE__ */ jsx(OctagonXIcon, { className: "size-4" }),
|
|
15
|
+
info: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }),
|
|
16
|
+
loading: /* @__PURE__ */ jsx(Loader2Icon, { className: "size-4 animate-spin" }),
|
|
17
|
+
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
18
|
+
warning: /* @__PURE__ */ jsx(TriangleAlertIcon, { className: "size-4" })
|
|
19
|
+
},
|
|
14
20
|
style: {
|
|
21
|
+
"--border-radius": "var(--radius)",
|
|
15
22
|
"--normal-bg": "var(--popover)",
|
|
16
23
|
"--normal-border": "var(--border)",
|
|
17
24
|
"--normal-text": "var(--popover-foreground)"
|
|
18
25
|
},
|
|
19
26
|
theme,
|
|
27
|
+
toastOptions: { classNames: { toast: "rounded-2xl" } },
|
|
20
28
|
...props
|
|
21
29
|
});
|
|
22
30
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { VisuallyHidden } from "radix-ui";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
5
4
|
//#region src/components/spinner.tsx
|
|
6
5
|
const SPINNER_COUNT = 8;
|
|
7
6
|
/**
|
|
@@ -10,10 +9,10 @@ const SPINNER_COUNT = 8;
|
|
|
10
9
|
function Spinner({ children, className, loading = true, ...props }) {
|
|
11
10
|
if (!loading) return children;
|
|
12
11
|
const spinner = /* @__PURE__ */ jsx("span", {
|
|
13
|
-
className: cn("relative flex size-4 items-center justify-center
|
|
12
|
+
className: cn("relative flex size-4 items-center justify-center opacity-60", className),
|
|
14
13
|
...props,
|
|
15
14
|
children: Array.from({ length: SPINNER_COUNT }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
16
|
-
className:
|
|
15
|
+
className: "absolute h-full rotate-(--spinner-rotate) before:block before:h-1/3 before:w-full before:animate-out before:rounded-full before:bg-current before:delay-(--spinner-delay) before:animation-duration-(--spinner-duration) before:fade-out-25 before:repeat-infinite motion-reduce:before:animate-none",
|
|
17
16
|
style: {
|
|
18
17
|
"--spinner-delay": `-${((SPINNER_COUNT - index) * 100).toString()}ms`,
|
|
19
18
|
"--spinner-duration": `${(SPINNER_COUNT * 100).toString()}ms`,
|
|
@@ -28,12 +27,12 @@ function Spinner({ children, className, loading = true, ...props }) {
|
|
|
28
27
|
children: [
|
|
29
28
|
/* @__PURE__ */ jsx("span", {
|
|
30
29
|
"aria-hidden": true,
|
|
31
|
-
className:
|
|
30
|
+
className: "invisible contents",
|
|
32
31
|
children
|
|
33
32
|
}),
|
|
34
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children }),
|
|
33
|
+
/* @__PURE__ */ jsx(VisuallyHidden.Root, { children }),
|
|
35
34
|
/* @__PURE__ */ jsx("span", {
|
|
36
|
-
className:
|
|
35
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
37
36
|
children: spinner
|
|
38
37
|
})
|
|
39
38
|
]
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { Switch as Switch$1 } from "radix-ui";
|
|
1
2
|
import { ComponentProps, JSX } from "react";
|
|
2
|
-
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
3
3
|
|
|
4
4
|
//#region src/components/switch.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* @since 0.3.16-canary.0
|
|
7
7
|
*/
|
|
8
|
-
type SwitchProps = ComponentProps<typeof
|
|
8
|
+
type SwitchProps = ComponentProps<typeof Switch$1.Root> & {
|
|
9
|
+
size?: "default" | "sm";
|
|
10
|
+
};
|
|
9
11
|
/**
|
|
10
12
|
* @since 0.3.16-canary.0
|
|
11
13
|
*/
|
|
12
14
|
declare function Switch({
|
|
13
15
|
className,
|
|
16
|
+
size,
|
|
14
17
|
...props
|
|
15
18
|
}: SwitchProps): JSX.Element;
|
|
16
19
|
//#endregion
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { Switch as Switch$1 } from "radix-ui";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
5
4
|
//#region src/components/switch.tsx
|
|
6
5
|
/**
|
|
7
6
|
* @since 0.3.16-canary.0
|
|
8
7
|
*/
|
|
9
|
-
function Switch({ className, ...props }) {
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
className: cn("peer group/switch inline-flex
|
|
8
|
+
function Switch({ className, size = "default", ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
10
|
+
className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all duration-control ease-snappy outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-4.5 data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
11
|
+
"data-size": size,
|
|
12
12
|
"data-slot": "switch",
|
|
13
13
|
...props,
|
|
14
|
-
children: /* @__PURE__ */ jsx(
|
|
15
|
-
className:
|
|
14
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
15
|
+
className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform duration-control-indicator ease-spring group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-3.5 group-data-[size=sm]/switch:data-checked:translate-x-2.5 rtl:group-data-[size=default]/switch:data-checked:-translate-x-3.5 rtl:group-data-[size=sm]/switch:data-checked:-translate-x-2.5 dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 rtl:group-data-[size=default]/switch:data-unchecked:-translate-x-0 rtl:group-data-[size=sm]/switch:data-unchecked:-translate-x-0 dark:data-unchecked:bg-foreground",
|
|
16
16
|
"data-slot": "switch-thumb"
|
|
17
17
|
})
|
|
18
18
|
});
|
|
@@ -6,10 +6,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
function Table({ className, ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
className:
|
|
10
|
-
"data-slot": "table-
|
|
9
|
+
className: "relative w-full overflow-x-auto",
|
|
10
|
+
"data-slot": "table-container",
|
|
11
11
|
children: /* @__PURE__ */ jsx("table", {
|
|
12
|
-
className: cn("w-full text-sm",
|
|
12
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
13
13
|
"data-slot": "table",
|
|
14
14
|
...props
|
|
15
15
|
})
|
|
@@ -20,7 +20,7 @@ function Table({ className, ...props }) {
|
|
|
20
20
|
*/
|
|
21
21
|
function TableHeader({ className, ...props }) {
|
|
22
22
|
return /* @__PURE__ */ jsx("thead", {
|
|
23
|
-
className: cn("
|
|
23
|
+
className: cn("[&_tr]:border-b", className),
|
|
24
24
|
"data-slot": "table-header",
|
|
25
25
|
...props
|
|
26
26
|
});
|
|
@@ -30,7 +30,7 @@ function TableHeader({ className, ...props }) {
|
|
|
30
30
|
*/
|
|
31
31
|
function TableBody({ className, ...props }) {
|
|
32
32
|
return /* @__PURE__ */ jsx("tbody", {
|
|
33
|
-
className: cn("
|
|
33
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
34
34
|
"data-slot": "table-body",
|
|
35
35
|
...props
|
|
36
36
|
});
|
|
@@ -40,7 +40,7 @@ function TableBody({ className, ...props }) {
|
|
|
40
40
|
*/
|
|
41
41
|
function TableFooter({ className, ...props }) {
|
|
42
42
|
return /* @__PURE__ */ jsx("tfoot", {
|
|
43
|
-
className: cn("bg-muted/50 font-medium
|
|
43
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
44
44
|
"data-slot": "table-footer",
|
|
45
45
|
...props
|
|
46
46
|
});
|
|
@@ -50,7 +50,7 @@ function TableFooter({ className, ...props }) {
|
|
|
50
50
|
*/
|
|
51
51
|
function TableRow({ className, ...props }) {
|
|
52
52
|
return /* @__PURE__ */ jsx("tr", {
|
|
53
|
-
className: cn("border-b
|
|
53
|
+
className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-selected:bg-muted", className),
|
|
54
54
|
"data-slot": "table-row",
|
|
55
55
|
...props
|
|
56
56
|
});
|
|
@@ -60,7 +60,7 @@ function TableRow({ className, ...props }) {
|
|
|
60
60
|
*/
|
|
61
61
|
function TableHead({ className, ...props }) {
|
|
62
62
|
return /* @__PURE__ */ jsx("th", {
|
|
63
|
-
className: cn("
|
|
63
|
+
className: cn("h-10 px-2 text-start align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pe-0", className),
|
|
64
64
|
"data-slot": "table-head",
|
|
65
65
|
...props
|
|
66
66
|
});
|
|
@@ -70,7 +70,7 @@ function TableHead({ className, ...props }) {
|
|
|
70
70
|
*/
|
|
71
71
|
function TableCell({ className, ...props }) {
|
|
72
72
|
return /* @__PURE__ */ jsx("td", {
|
|
73
|
-
className: cn("p-2
|
|
73
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0", className),
|
|
74
74
|
"data-slot": "table-cell",
|
|
75
75
|
...props
|
|
76
76
|
});
|
|
@@ -80,7 +80,7 @@ function TableCell({ className, ...props }) {
|
|
|
80
80
|
*/
|
|
81
81
|
function TableCaption({ className, ...props }) {
|
|
82
82
|
return /* @__PURE__ */ jsx("caption", {
|
|
83
|
-
className: cn("mt-4
|
|
83
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
84
84
|
"data-slot": "table-caption",
|
|
85
85
|
...props
|
|
86
86
|
});
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
+
import { TabsListVariants } from "../variants/tabs.mjs";
|
|
2
|
+
import { Tabs as Tabs$1 } from "radix-ui";
|
|
1
3
|
import { ComponentProps, JSX } from "react";
|
|
2
|
-
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
4
|
|
|
4
5
|
//#region src/components/tabs.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
7
8
|
*/
|
|
8
|
-
type TabsProps = ComponentProps<typeof
|
|
9
|
+
type TabsProps = ComponentProps<typeof Tabs$1.Root>;
|
|
9
10
|
/**
|
|
10
11
|
* @since 0.3.16-canary.0
|
|
11
12
|
*/
|
|
12
13
|
declare function Tabs({
|
|
13
14
|
className,
|
|
15
|
+
orientation,
|
|
14
16
|
...props
|
|
15
17
|
}: TabsProps): JSX.Element;
|
|
16
18
|
/**
|
|
17
19
|
* @since 0.3.16-canary.0
|
|
18
20
|
*/
|
|
19
|
-
type TabsListProps = ComponentProps<typeof
|
|
21
|
+
type TabsListProps = ComponentProps<typeof Tabs$1.List> & TabsListVariants;
|
|
20
22
|
/**
|
|
21
23
|
* @since 0.3.16-canary.0
|
|
22
24
|
*/
|
|
23
25
|
declare function TabsList({
|
|
24
26
|
className,
|
|
27
|
+
variant,
|
|
25
28
|
...props
|
|
26
29
|
}: TabsListProps): JSX.Element;
|
|
27
30
|
/**
|
|
28
31
|
* @since 0.3.16-canary.0
|
|
29
32
|
*/
|
|
30
|
-
type TabsTriggerProps = ComponentProps<typeof
|
|
33
|
+
type TabsTriggerProps = ComponentProps<typeof Tabs$1.Trigger>;
|
|
31
34
|
/**
|
|
32
35
|
* @since 0.3.16-canary.0
|
|
33
36
|
*/
|
|
@@ -38,7 +41,7 @@ declare function TabsTrigger({
|
|
|
38
41
|
/**
|
|
39
42
|
* @since 0.3.16-canary.0
|
|
40
43
|
*/
|
|
41
|
-
type TabsContentProps = ComponentProps<typeof
|
|
44
|
+
type TabsContentProps = ComponentProps<typeof Tabs$1.Content>;
|
|
42
45
|
/**
|
|
43
46
|
* @since 0.3.16-canary.0
|
|
44
47
|
*/
|