@cbrl/design 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/dist/components/alert-dialog.d.ts +14 -0
  4. package/dist/components/alert-dialog.js +82 -0
  5. package/dist/components/app-shell.d.ts +38 -0
  6. package/dist/components/app-shell.js +72 -0
  7. package/dist/components/auth-split-screen.d.ts +30 -0
  8. package/dist/components/auth-split-screen.js +45 -0
  9. package/dist/components/avatar.d.ts +11 -0
  10. package/dist/components/avatar.js +50 -0
  11. package/dist/components/badge.d.ts +9 -0
  12. package/dist/components/badge.js +27 -0
  13. package/dist/components/breadcrumb.d.ts +11 -0
  14. package/dist/components/breadcrumb.js +69 -0
  15. package/dist/components/button.d.ts +10 -0
  16. package/dist/components/button.js +47 -0
  17. package/dist/components/calendar.d.ts +7 -0
  18. package/dist/components/calendar.js +142 -0
  19. package/dist/components/card.d.ts +13 -0
  20. package/dist/components/card.js +57 -0
  21. package/dist/components/checkbox.d.ts +4 -0
  22. package/dist/components/checkbox.js +20 -0
  23. package/dist/components/collapsible.d.ts +5 -0
  24. package/dist/components/collapsible.js +23 -0
  25. package/dist/components/date-field.d.ts +31 -0
  26. package/dist/components/date-field.js +129 -0
  27. package/dist/components/dialog.d.ts +17 -0
  28. package/dist/components/dialog.js +95 -0
  29. package/dist/components/dropdown-menu.d.ts +29 -0
  30. package/dist/components/dropdown-menu.js +127 -0
  31. package/dist/components/empty-state.d.ts +32 -0
  32. package/dist/components/empty-state.js +61 -0
  33. package/dist/components/field.d.ts +25 -0
  34. package/dist/components/field.js +121 -0
  35. package/dist/components/highlighted-textarea.d.ts +6 -0
  36. package/dist/components/highlighted-textarea.js +68 -0
  37. package/dist/components/input-group.d.ts +8 -0
  38. package/dist/components/input-group.js +28 -0
  39. package/dist/components/input.d.ts +3 -0
  40. package/dist/components/input.js +13 -0
  41. package/dist/components/label.d.ts +4 -0
  42. package/dist/components/label.js +14 -0
  43. package/dist/components/list.d.ts +174 -0
  44. package/dist/components/list.js +281 -0
  45. package/dist/components/main.d.ts +10 -0
  46. package/dist/components/main.js +36 -0
  47. package/dist/components/pagination.d.ts +25 -0
  48. package/dist/components/pagination.js +104 -0
  49. package/dist/components/popover.d.ts +6 -0
  50. package/dist/components/popover.js +28 -0
  51. package/dist/components/radio-group.d.ts +5 -0
  52. package/dist/components/radio-group.js +27 -0
  53. package/dist/components/scroll-area.d.ts +5 -0
  54. package/dist/components/scroll-area.js +35 -0
  55. package/dist/components/select.d.ts +15 -0
  56. package/dist/components/select.js +95 -0
  57. package/dist/components/separator.d.ts +4 -0
  58. package/dist/components/separator.js +16 -0
  59. package/dist/components/setting-row.d.ts +8 -0
  60. package/dist/components/setting-row.js +36 -0
  61. package/dist/components/settings-section.d.ts +7 -0
  62. package/dist/components/settings-section.js +36 -0
  63. package/dist/components/sheet.d.ts +14 -0
  64. package/dist/components/sheet.js +89 -0
  65. package/dist/components/sidebar-core.d.ts +33 -0
  66. package/dist/components/sidebar-core.js +220 -0
  67. package/dist/components/sidebar-menu.d.ts +38 -0
  68. package/dist/components/sidebar-menu.js +168 -0
  69. package/dist/components/sidebar.d.ts +3 -0
  70. package/dist/components/skeleton.d.ts +2 -0
  71. package/dist/components/skeleton.js +11 -0
  72. package/dist/components/sonner.d.ts +3 -0
  73. package/dist/components/sonner.js +31 -0
  74. package/dist/components/stepper.d.ts +8 -0
  75. package/dist/components/stepper.js +58 -0
  76. package/dist/components/switch.d.ts +6 -0
  77. package/dist/components/switch.js +19 -0
  78. package/dist/components/table.d.ts +10 -0
  79. package/dist/components/table.js +65 -0
  80. package/dist/components/tabs.d.ts +7 -0
  81. package/dist/components/tabs.js +35 -0
  82. package/dist/components/textarea.d.ts +3 -0
  83. package/dist/components/textarea.js +12 -0
  84. package/dist/components/tooltip.d.ts +7 -0
  85. package/dist/components/tooltip.js +35 -0
  86. package/dist/components/typography.d.ts +9 -0
  87. package/dist/components/typography.js +45 -0
  88. package/dist/components/user-menu.d.ts +24 -0
  89. package/dist/components/user-menu.js +48 -0
  90. package/dist/globals.css +60 -0
  91. package/dist/hooks/use-mobile.d.ts +1 -0
  92. package/dist/hooks/use-mobile.js +17 -0
  93. package/dist/index.d.ts +48 -0
  94. package/dist/index.js +47 -0
  95. package/dist/lib/cn.d.ts +2 -0
  96. package/dist/lib/cn.js +7 -0
  97. package/dist/lib/css-vars.js +5 -0
  98. package/dist/lib/date.js +38 -0
  99. package/dist/lib/nav.d.ts +15 -0
  100. package/dist/lib/nav.js +11 -0
  101. package/dist/lib/toaster-theme.js +5 -0
  102. package/dist/shadcn.css +635 -0
  103. package/dist/tokens.css +160 -0
  104. package/package.json +85 -3
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { RadioGroup as RadioGroup$1 } from "radix-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { CircleIcon } from "lucide-react";
7
+ // src/components/radio-group.tsx
8
+ function RadioGroup({ className, ...props }) {
9
+ return /* @__PURE__ */ jsx(RadioGroup$1.Root, {
10
+ "data-slot": "radio-group",
11
+ className: cn("grid gap-3", className),
12
+ ...props
13
+ });
14
+ }
15
+ function RadioGroupItem({ className, ...props }) {
16
+ return /* @__PURE__ */ jsx(RadioGroup$1.Item, {
17
+ "data-slot": "radio-group-item",
18
+ className: cn("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-shadow outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50", className),
19
+ ...props,
20
+ children: /* @__PURE__ */ jsx(RadioGroup$1.Indicator, {
21
+ "data-slot": "radio-group-indicator",
22
+ className: "relative flex items-center justify-center",
23
+ children: /* @__PURE__ */ jsx(CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
24
+ })
25
+ });
26
+ }
27
+ export { RadioGroup, RadioGroupItem };
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import { ScrollArea as ScrollArea$1 } from "radix-ui";
3
+ declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollArea$1.Root>): React.JSX.Element;
4
+ declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollArea$1.ScrollAreaScrollbar>): React.JSX.Element;
5
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { ScrollArea as ScrollArea$1 } from "radix-ui";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/scroll-area.tsx
7
+ function ScrollArea({ className, children, ...props }) {
8
+ return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
9
+ "data-slot": "scroll-area",
10
+ className: cn("relative overflow-hidden", className),
11
+ ...props,
12
+ children: [
13
+ /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
14
+ "data-slot": "scroll-area-viewport",
15
+ className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
16
+ children
17
+ }),
18
+ /* @__PURE__ */ jsx(ScrollBar, {}),
19
+ /* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
20
+ ]
21
+ });
22
+ }
23
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
24
+ return /* @__PURE__ */ jsx(ScrollArea$1.ScrollAreaScrollbar, {
25
+ "data-slot": "scroll-area-scrollbar",
26
+ orientation,
27
+ className: cn("flex touch-none p-px transition-colors select-none", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent", className),
28
+ ...props,
29
+ children: /* @__PURE__ */ jsx(ScrollArea$1.ScrollAreaThumb, {
30
+ "data-slot": "scroll-area-thumb",
31
+ className: "bg-border relative flex-1 rounded-full"
32
+ })
33
+ });
34
+ }
35
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import { Select as Select$1 } from "radix-ui";
3
+ declare function Select({ ...props }: React.ComponentProps<typeof Select$1.Root>): React.JSX.Element;
4
+ declare function SelectGroup({ ...props }: React.ComponentProps<typeof Select$1.Group>): React.JSX.Element;
5
+ declare function SelectValue({ ...props }: React.ComponentProps<typeof Select$1.Value>): React.JSX.Element;
6
+ declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof Select$1.Trigger> & {
7
+ size?: 'sm' | 'default';
8
+ }): React.JSX.Element;
9
+ declare function SelectContent({ className, children, position, ...props }: React.ComponentProps<typeof Select$1.Content>): React.JSX.Element;
10
+ declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof Select$1.Label>): React.JSX.Element;
11
+ declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof Select$1.Item>): React.JSX.Element;
12
+ declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof Select$1.Separator>): React.JSX.Element;
13
+ declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof Select$1.ScrollUpButton>): React.JSX.Element;
14
+ declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof Select$1.ScrollDownButton>): React.JSX.Element;
15
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { Select as Select$1 } from "radix-ui";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
7
+ // src/components/select.tsx
8
+ function Select({ ...props }) {
9
+ return /* @__PURE__ */ jsx(Select$1.Root, {
10
+ "data-slot": "select",
11
+ ...props
12
+ });
13
+ }
14
+ function SelectGroup({ ...props }) {
15
+ return /* @__PURE__ */ jsx(Select$1.Group, {
16
+ "data-slot": "select-group",
17
+ ...props
18
+ });
19
+ }
20
+ function SelectValue({ ...props }) {
21
+ return /* @__PURE__ */ jsx(Select$1.Value, {
22
+ "data-slot": "select-value",
23
+ ...props
24
+ });
25
+ }
26
+ function SelectTrigger({ className, size = "default", children, ...props }) {
27
+ return /* @__PURE__ */ jsxs(Select$1.Trigger, {
28
+ "data-slot": "select-trigger",
29
+ "data-size": size,
30
+ className: cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:hover:bg-input/50 bg-background flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
31
+ ...props,
32
+ children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
33
+ asChild: true,
34
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" })
35
+ })]
36
+ });
37
+ }
38
+ function SelectContent({ className, children, position = "popper", ...props }) {
39
+ return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(Select$1.Content, {
40
+ "data-slot": "select-content",
41
+ className: cn("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md ring-1", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
42
+ position,
43
+ ...props,
44
+ children: [
45
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
46
+ /* @__PURE__ */ jsx(Select$1.Viewport, {
47
+ className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
48
+ children
49
+ }),
50
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
51
+ ]
52
+ }) });
53
+ }
54
+ function SelectLabel({ className, ...props }) {
55
+ return /* @__PURE__ */ jsx(Select$1.Label, {
56
+ "data-slot": "select-label",
57
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
58
+ ...props
59
+ });
60
+ }
61
+ function SelectItem({ className, children, ...props }) {
62
+ return /* @__PURE__ */ jsxs(Select$1.Item, {
63
+ "data-slot": "select-item",
64
+ className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
65
+ ...props,
66
+ children: [/* @__PURE__ */ jsx("span", {
67
+ className: "absolute right-2 flex size-3.5 items-center justify-center",
68
+ children: /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
69
+ }), /* @__PURE__ */ jsx(Select$1.ItemText, { children })]
70
+ });
71
+ }
72
+ function SelectSeparator({ className, ...props }) {
73
+ return /* @__PURE__ */ jsx(Select$1.Separator, {
74
+ "data-slot": "select-separator",
75
+ className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
76
+ ...props
77
+ });
78
+ }
79
+ function SelectScrollUpButton({ className, ...props }) {
80
+ return /* @__PURE__ */ jsx(Select$1.ScrollUpButton, {
81
+ "data-slot": "select-scroll-up-button",
82
+ className: cn("flex cursor-default items-center justify-center py-1", className),
83
+ ...props,
84
+ children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
85
+ });
86
+ }
87
+ function SelectScrollDownButton({ className, ...props }) {
88
+ return /* @__PURE__ */ jsx(Select$1.ScrollDownButton, {
89
+ "data-slot": "select-scroll-down-button",
90
+ className: cn("flex cursor-default items-center justify-center py-1", className),
91
+ ...props,
92
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
93
+ });
94
+ }
95
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Separator as Separator$1 } from "radix-ui";
3
+ declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof Separator$1.Root>): React.JSX.Element;
4
+ export { Separator };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { Separator as Separator$1 } from "radix-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ // src/components/separator.tsx
7
+ function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
8
+ return /* @__PURE__ */ jsx(Separator$1.Root, {
9
+ "data-slot": "separator",
10
+ decorative,
11
+ orientation,
12
+ className: cn("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch", className),
13
+ ...props
14
+ });
15
+ }
16
+ export { Separator };
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare function SettingRow({ title, description, htmlFor, className, children, ...props }: {
3
+ title: React.ReactNode;
4
+ description?: React.ReactNode;
5
+ htmlFor?: string;
6
+ } & Omit<React.ComponentProps<'div'>, 'title'>): React.JSX.Element;
7
+ declare function SettingRowGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
8
+ export { SettingRow, SettingRowGroup };
@@ -0,0 +1,36 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/setting-row.tsx
5
+ function SettingRow({ title, description, htmlFor, className, children, ...props }) {
6
+ return /* @__PURE__ */ jsxs("div", {
7
+ "data-slot": "setting-row",
8
+ className: cn("flex flex-col gap-2 py-3.5 sm:flex-row sm:items-center sm:gap-4", className),
9
+ ...props,
10
+ children: [/* @__PURE__ */ jsxs("div", {
11
+ className: "min-w-0 flex-1",
12
+ children: [htmlFor ? /* @__PURE__ */ jsx("label", {
13
+ htmlFor,
14
+ className: "text-sm font-medium",
15
+ children: title
16
+ }) : /* @__PURE__ */ jsx("div", {
17
+ className: "text-sm font-medium",
18
+ children: title
19
+ }), description ? /* @__PURE__ */ jsx("p", {
20
+ className: "text-muted-foreground mt-0.5 text-xs",
21
+ children: description
22
+ }) : null]
23
+ }), /* @__PURE__ */ jsx("div", {
24
+ className: "sm:shrink-0",
25
+ children
26
+ })]
27
+ });
28
+ }
29
+ function SettingRowGroup({ className, ...props }) {
30
+ return /* @__PURE__ */ jsx("div", {
31
+ "data-slot": "setting-row-group",
32
+ className: cn("flex flex-col [&>[data-slot=setting-row]+*]:border-t", className),
33
+ ...props
34
+ });
35
+ }
36
+ export { SettingRow, SettingRowGroup };
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ declare function SettingsSection({ title, description, action, className, children, ...props }: {
3
+ title: React.ReactNode;
4
+ description?: React.ReactNode;
5
+ action?: React.ReactNode;
6
+ } & React.ComponentProps<'div'>): React.JSX.Element;
7
+ export { SettingsSection };
@@ -0,0 +1,36 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Separator } from "./separator.js";
3
+ import { Typography } from "./typography.js";
4
+ import "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ // src/components/settings-section.tsx
7
+ function SettingsSection({ title, description, action, className, children, ...props }) {
8
+ return /* @__PURE__ */ jsxs("div", {
9
+ "data-slot": "settings-section",
10
+ className: cn("flex flex-col gap-6", className),
11
+ ...props,
12
+ children: [/* @__PURE__ */ jsxs("div", {
13
+ className: "flex flex-col gap-3",
14
+ children: [/* @__PURE__ */ jsxs("div", {
15
+ className: "flex items-start justify-between gap-4",
16
+ children: [/* @__PURE__ */ jsxs("div", {
17
+ className: "flex flex-col gap-1",
18
+ children: [/* @__PURE__ */ jsx(Typography, {
19
+ variant: "pageTitle",
20
+ children: title
21
+ }), description ? /* @__PURE__ */ jsx(Typography, {
22
+ variant: "muted",
23
+ children: description
24
+ }) : null]
25
+ }), action ? /* @__PURE__ */ jsx("div", {
26
+ className: "shrink-0",
27
+ children: action
28
+ }) : null]
29
+ }), /* @__PURE__ */ jsx(Separator, {})]
30
+ }), /* @__PURE__ */ jsx("div", {
31
+ className: "flex flex-col gap-6",
32
+ children
33
+ })]
34
+ });
35
+ }
36
+ export { SettingsSection };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { Dialog } from "radix-ui";
3
+ declare function Sheet({ ...props }: React.ComponentProps<typeof Dialog.Root>): React.JSX.Element;
4
+ declare function SheetTrigger({ ...props }: React.ComponentProps<typeof Dialog.Trigger>): React.JSX.Element;
5
+ declare function SheetClose({ ...props }: React.ComponentProps<typeof Dialog.Close>): React.JSX.Element;
6
+ declare function SheetContent({ className, children, side, showCloseButton, ...props }: React.ComponentProps<typeof Dialog.Content> & {
7
+ side?: 'top' | 'right' | 'bottom' | 'left';
8
+ showCloseButton?: boolean;
9
+ }): React.JSX.Element;
10
+ declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
+ declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
12
+ declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof Dialog.Title>): React.JSX.Element;
13
+ declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof Dialog.Description>): React.JSX.Element;
14
+ export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { Button } from "./button.js";
4
+ import "react";
5
+ import { Dialog } from "radix-ui";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { XIcon } from "lucide-react";
8
+ // src/components/sheet.tsx
9
+ function Sheet({ ...props }) {
10
+ return /* @__PURE__ */ jsx(Dialog.Root, {
11
+ "data-slot": "sheet",
12
+ ...props
13
+ });
14
+ }
15
+ function SheetTrigger({ ...props }) {
16
+ return /* @__PURE__ */ jsx(Dialog.Trigger, {
17
+ "data-slot": "sheet-trigger",
18
+ ...props
19
+ });
20
+ }
21
+ function SheetClose({ ...props }) {
22
+ return /* @__PURE__ */ jsx(Dialog.Close, {
23
+ "data-slot": "sheet-close",
24
+ ...props
25
+ });
26
+ }
27
+ function SheetPortal({ ...props }) {
28
+ return /* @__PURE__ */ jsx(Dialog.Portal, {
29
+ "data-slot": "sheet-portal",
30
+ ...props
31
+ });
32
+ }
33
+ function SheetOverlay({ className, ...props }) {
34
+ return /* @__PURE__ */ jsx(Dialog.Overlay, {
35
+ "data-slot": "sheet-overlay",
36
+ className: cn("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs", className),
37
+ ...props
38
+ });
39
+ }
40
+ function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
41
+ return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog.Content, {
42
+ "data-slot": "sheet-content",
43
+ "data-side": side,
44
+ className: cn("bg-popover text-popover-foreground data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className),
45
+ ...props,
46
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, {
47
+ "data-slot": "sheet-close",
48
+ asChild: true,
49
+ children: /* @__PURE__ */ jsxs(Button, {
50
+ variant: "ghost",
51
+ className: "absolute top-3 right-3",
52
+ size: "icon-sm",
53
+ children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
54
+ className: "sr-only",
55
+ children: "Close"
56
+ })]
57
+ })
58
+ })]
59
+ })] });
60
+ }
61
+ function SheetHeader({ className, ...props }) {
62
+ return /* @__PURE__ */ jsx("div", {
63
+ "data-slot": "sheet-header",
64
+ className: cn("flex flex-col gap-0.5 p-4", className),
65
+ ...props
66
+ });
67
+ }
68
+ function SheetFooter({ className, ...props }) {
69
+ return /* @__PURE__ */ jsx("div", {
70
+ "data-slot": "sheet-footer",
71
+ className: cn("mt-auto flex flex-col gap-2 p-4", className),
72
+ ...props
73
+ });
74
+ }
75
+ function SheetTitle({ className, ...props }) {
76
+ return /* @__PURE__ */ jsx(Dialog.Title, {
77
+ "data-slot": "sheet-title",
78
+ className: cn("text-foreground text-base font-medium", className),
79
+ ...props
80
+ });
81
+ }
82
+ function SheetDescription({ className, ...props }) {
83
+ return /* @__PURE__ */ jsx(Dialog.Description, {
84
+ "data-slot": "sheet-description",
85
+ className: cn("text-muted-foreground text-sm", className),
86
+ ...props
87
+ });
88
+ }
89
+ export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
@@ -0,0 +1,33 @@
1
+ import { Button } from "./button.js";
2
+ import { Input } from "./input.js";
3
+ import { Separator } from "./separator.js";
4
+ import * as React from "react";
5
+ type SidebarContextProps = {
6
+ state: 'expanded' | 'collapsed';
7
+ open: boolean;
8
+ setOpen: (open: boolean) => void;
9
+ openMobile: boolean;
10
+ setOpenMobile: (open: boolean) => void;
11
+ isMobile: boolean;
12
+ toggleSidebar: () => void;
13
+ };
14
+ export declare function useSidebar(): SidebarContextProps;
15
+ export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<'div'> & {
16
+ defaultOpen?: boolean;
17
+ open?: boolean;
18
+ onOpenChange?: (open: boolean) => void;
19
+ }): React.JSX.Element;
20
+ export declare function Sidebar({ side, variant, collapsible, className, children, dir, ...props }: React.ComponentProps<'div'> & {
21
+ side?: 'left' | 'right';
22
+ variant?: 'sidebar' | 'floating' | 'inset';
23
+ collapsible?: 'offcanvas' | 'icon' | 'none';
24
+ }): React.JSX.Element;
25
+ export declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
26
+ export declare function SidebarRail({ className, ...props }: React.ComponentProps<'button'>): React.JSX.Element;
27
+ export declare function SidebarInset({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
28
+ export declare function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>): React.JSX.Element;
29
+ export declare function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
30
+ export declare function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
31
+ export declare function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
32
+ export declare function SidebarContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
33
+ export {};
@@ -0,0 +1,220 @@
1
+ "use client";
2
+ import { useIsMobile } from "../hooks/use-mobile.js";
3
+ import { cn } from "../lib/cn.js";
4
+ import { cssVars } from "../lib/css-vars.js";
5
+ import { Button } from "./button.js";
6
+ import { Input } from "./input.js";
7
+ import { Separator } from "./separator.js";
8
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
9
+ import * as React from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { PanelLeftIcon } from "lucide-react";
12
+ // src/components/sidebar-core.tsx
13
+ const SIDEBAR_COOKIE_NAME = "sidebar_state";
14
+ const SIDEBAR_COOKIE_MAX_AGE = 604800;
15
+ const SIDEBAR_WIDTH = "14rem";
16
+ const SIDEBAR_WIDTH_MOBILE = "18rem";
17
+ const SIDEBAR_WIDTH_ICON = "3rem";
18
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b";
19
+ const SidebarContext = React.createContext(null);
20
+ function useSidebar() {
21
+ const context = React.useContext(SidebarContext);
22
+ if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
23
+ return context;
24
+ }
25
+ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
26
+ const isMobile = useIsMobile();
27
+ const [openMobile, setOpenMobile] = React.useState(false);
28
+ const [_open, _setOpen] = React.useState(defaultOpen);
29
+ const open = openProp ?? _open;
30
+ const setOpen = React.useCallback((value) => {
31
+ const openState = typeof value === "function" ? value(open) : value;
32
+ if (setOpenProp) setOpenProp(openState);
33
+ else _setOpen(openState);
34
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
35
+ }, [setOpenProp, open]);
36
+ const toggleSidebar = React.useCallback(() => {
37
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
38
+ }, [
39
+ isMobile,
40
+ setOpen,
41
+ setOpenMobile
42
+ ]);
43
+ React.useEffect(() => {
44
+ const handleKeyDown = (event) => {
45
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
46
+ event.preventDefault();
47
+ toggleSidebar();
48
+ }
49
+ };
50
+ window.addEventListener("keydown", handleKeyDown);
51
+ return () => window.removeEventListener("keydown", handleKeyDown);
52
+ }, [toggleSidebar]);
53
+ const state = open ? "expanded" : "collapsed";
54
+ const contextValue = React.useMemo(() => ({
55
+ state,
56
+ open,
57
+ setOpen,
58
+ isMobile,
59
+ openMobile,
60
+ setOpenMobile,
61
+ toggleSidebar
62
+ }), [
63
+ state,
64
+ open,
65
+ setOpen,
66
+ isMobile,
67
+ openMobile,
68
+ setOpenMobile,
69
+ toggleSidebar
70
+ ]);
71
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, {
72
+ value: contextValue,
73
+ children: /* @__PURE__ */ jsx("div", {
74
+ "data-slot": "sidebar-wrapper",
75
+ style: {
76
+ ...cssVars({
77
+ "--sidebar-width": SIDEBAR_WIDTH,
78
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON
79
+ }),
80
+ ...style
81
+ },
82
+ className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-dvh w-full overflow-hidden", className),
83
+ ...props,
84
+ children
85
+ })
86
+ });
87
+ }
88
+ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, dir, ...props }) {
89
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
90
+ if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
91
+ "data-slot": "sidebar",
92
+ className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className),
93
+ ...props,
94
+ children
95
+ });
96
+ if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
97
+ open: openMobile,
98
+ onOpenChange: setOpenMobile,
99
+ ...props,
100
+ children: /* @__PURE__ */ jsxs(SheetContent, {
101
+ dir,
102
+ "data-sidebar": "sidebar",
103
+ "data-slot": "sidebar",
104
+ "data-mobile": "true",
105
+ className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
106
+ style: cssVars({ "--sidebar-width": SIDEBAR_WIDTH_MOBILE }),
107
+ side,
108
+ children: [/* @__PURE__ */ jsxs(SheetHeader, {
109
+ className: "sr-only",
110
+ children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
111
+ }), /* @__PURE__ */ jsx("div", {
112
+ className: "flex h-full w-full flex-col",
113
+ children
114
+ })]
115
+ })
116
+ });
117
+ return /* @__PURE__ */ jsxs("div", {
118
+ className: "group peer text-sidebar-foreground hidden md:block",
119
+ "data-state": state,
120
+ "data-collapsible": state === "collapsed" ? collapsible : "",
121
+ "data-variant": variant,
122
+ "data-side": side,
123
+ "data-slot": "sidebar",
124
+ children: [/* @__PURE__ */ jsx("div", {
125
+ "data-slot": "sidebar-gap",
126
+ className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
127
+ }), /* @__PURE__ */ jsx("div", {
128
+ "data-slot": "sidebar-container",
129
+ "data-side": side,
130
+ className: cn("fixed inset-y-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
131
+ ...props,
132
+ children: /* @__PURE__ */ jsx("div", {
133
+ "data-sidebar": "sidebar",
134
+ "data-slot": "sidebar-inner",
135
+ className: "bg-sidebar group-data-[variant=floating]:ring-sidebar-border flex size-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1",
136
+ children
137
+ })
138
+ })]
139
+ });
140
+ }
141
+ function SidebarTrigger({ className, onClick, ...props }) {
142
+ const { toggleSidebar } = useSidebar();
143
+ return /* @__PURE__ */ jsxs(Button, {
144
+ "data-sidebar": "trigger",
145
+ "data-slot": "sidebar-trigger",
146
+ variant: "ghost",
147
+ size: "icon-sm",
148
+ className: cn(className),
149
+ onClick: (event) => {
150
+ onClick?.(event);
151
+ toggleSidebar();
152
+ },
153
+ ...props,
154
+ children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
155
+ className: "sr-only",
156
+ children: "Toggle Sidebar"
157
+ })]
158
+ });
159
+ }
160
+ function SidebarRail({ className, ...props }) {
161
+ const { toggleSidebar } = useSidebar();
162
+ return /* @__PURE__ */ jsx("button", {
163
+ "data-sidebar": "rail",
164
+ "data-slot": "sidebar-rail",
165
+ "aria-label": "Toggle Sidebar",
166
+ tabIndex: -1,
167
+ onClick: toggleSidebar,
168
+ title: "Toggle Sidebar",
169
+ className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
170
+ ...props
171
+ });
172
+ }
173
+ function SidebarInset({ className, ...props }) {
174
+ return /* @__PURE__ */ jsx("div", {
175
+ "data-slot": "sidebar-inset",
176
+ className: cn("bg-background relative flex min-h-0 w-full flex-1 flex-col overflow-hidden md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
177
+ ...props
178
+ });
179
+ }
180
+ function SidebarInput({ className, ...props }) {
181
+ return /* @__PURE__ */ jsx(Input, {
182
+ "data-slot": "sidebar-input",
183
+ "data-sidebar": "input",
184
+ className: cn("bg-background h-8 w-full shadow-none", className),
185
+ ...props
186
+ });
187
+ }
188
+ function SidebarHeader({ className, ...props }) {
189
+ return /* @__PURE__ */ jsx("div", {
190
+ "data-slot": "sidebar-header",
191
+ "data-sidebar": "header",
192
+ className: cn("flex flex-col gap-2 p-2", className),
193
+ ...props
194
+ });
195
+ }
196
+ function SidebarFooter({ className, ...props }) {
197
+ return /* @__PURE__ */ jsx("div", {
198
+ "data-slot": "sidebar-footer",
199
+ "data-sidebar": "footer",
200
+ className: cn("flex flex-col gap-2 p-2", className),
201
+ ...props
202
+ });
203
+ }
204
+ function SidebarSeparator({ className, ...props }) {
205
+ return /* @__PURE__ */ jsx(Separator, {
206
+ "data-slot": "sidebar-separator",
207
+ "data-sidebar": "separator",
208
+ className: cn("bg-sidebar-border mx-2 w-auto", className),
209
+ ...props
210
+ });
211
+ }
212
+ function SidebarContent({ className, ...props }) {
213
+ return /* @__PURE__ */ jsx("div", {
214
+ "data-slot": "sidebar-content",
215
+ "data-sidebar": "content",
216
+ className: cn("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto overscroll-contain group-data-[collapsible=icon]:overflow-hidden", className),
217
+ ...props
218
+ });
219
+ }
220
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarInset, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };