@hex-core/components 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -9
- package/dist/accordion.d.ts +13 -0
- package/dist/accordion.js +62 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert-dialog.d.ts +34 -0
- package/dist/alert-dialog.js +125 -0
- package/dist/alert-dialog.js.map +1 -0
- package/dist/alert.d.ts +17 -0
- package/dist/alert.js +54 -0
- package/dist/alert.js.map +1 -0
- package/dist/aspect-ratio.d.ts +7 -0
- package/dist/aspect-ratio.js +8 -0
- package/dist/aspect-ratio.js.map +1 -0
- package/dist/avatar.d.ts +11 -0
- package/dist/avatar.js +44 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +22 -0
- package/dist/badge.js +36 -0
- package/dist/badge.js.map +1 -0
- package/dist/breadcrumb.d.ts +27 -0
- package/dist/breadcrumb.js +120 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button-variants-Bx6gCUFp.d.ts +19 -0
- package/dist/button.d.ts +13 -0
- package/dist/button.js +113 -0
- package/dist/button.js.map +1 -0
- package/dist/calendar.d.ts +17 -0
- package/dist/calendar.js +126 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.d.ts +16 -0
- package/dist/card.js +68 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.d.ts +11 -0
- package/dist/checkbox.js +65 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/cluster.d.ts +34 -0
- package/dist/cluster.js +50 -0
- package/dist/cluster.js.map +1 -0
- package/dist/collapsible.d.ts +11 -0
- package/dist/collapsible.js +10 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/color-picker.d.ts +44 -0
- package/dist/color-picker.js +321 -0
- package/dist/color-picker.js.map +1 -0
- package/dist/combobox.d.ts +45 -0
- package/dist/combobox.js +226 -0
- package/dist/combobox.js.map +1 -0
- package/dist/command.d.ts +111 -0
- package/dist/command.js +232 -0
- package/dist/command.js.map +1 -0
- package/dist/container.d.ts +41 -0
- package/dist/container.js +39 -0
- package/dist/container.js.map +1 -0
- package/dist/context-menu.d.ts +37 -0
- package/dist/context-menu.js +130 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/data-table.d.ts +33 -0
- package/dist/data-table.js +103 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-picker.d.ts +43 -0
- package/dist/date-picker.js +221 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/dialog.d.ts +46 -0
- package/dist/dialog.js +125 -0
- package/dist/dialog.js.map +1 -0
- package/dist/drawer.d.ts +41 -0
- package/dist/drawer.js +82 -0
- package/dist/drawer.js.map +1 -0
- package/dist/dropdown-menu.d.ts +39 -0
- package/dist/dropdown-menu.js +133 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/dropzone.d.ts +54 -0
- package/dist/dropzone.js +194 -0
- package/dist/dropzone.js.map +1 -0
- package/dist/file-tree.d.ts +53 -0
- package/dist/file-tree.js +322 -0
- package/dist/file-tree.js.map +1 -0
- package/dist/form.d.ts +45 -0
- package/dist/form.js +114 -0
- package/dist/form.js.map +1 -0
- package/dist/grid.d.ts +50 -0
- package/dist/grid.js +58 -0
- package/dist/grid.js.map +1 -0
- package/dist/hover-card.d.ts +11 -0
- package/dist/hover-card.js +34 -0
- package/dist/hover-card.js.map +1 -0
- package/dist/index.d.ts +98 -1571
- package/dist/index.js +527 -5536
- package/dist/index.js.map +1 -1
- package/dist/input-otp.d.ts +19 -0
- package/dist/input-otp.js +71 -0
- package/dist/input-otp.js.map +1 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +40 -0
- package/dist/input.js.map +1 -0
- package/dist/label.d.ts +11 -0
- package/dist/label.js +22 -0
- package/dist/label.js.map +1 -0
- package/dist/menubar.d.ts +35 -0
- package/dist/menubar.js +106 -0
- package/dist/menubar.js.map +1 -0
- package/dist/multi-combobox.d.ts +51 -0
- package/dist/multi-combobox.js +258 -0
- package/dist/multi-combobox.js.map +1 -0
- package/dist/navigation-menu.d.ts +23 -0
- package/dist/navigation-menu.js +108 -0
- package/dist/navigation-menu.js.map +1 -0
- package/dist/pagination.d.ts +40 -0
- package/dist/pagination.js +195 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.d.ts +13 -0
- package/dist/popover.js +35 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress.d.ts +10 -0
- package/dist/progress.js +38 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.d.ts +9 -0
- package/dist/radio-group.js +44 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/resizable.d.ts +28 -0
- package/dist/resizable.js +66 -0
- package/dist/resizable.js.map +1 -0
- package/dist/schemas.d.ts +121 -0
- package/dist/schemas.js +4643 -0
- package/dist/schemas.js.map +1 -0
- package/dist/scroll-area.d.ts +18 -0
- package/dist/scroll-area.js +55 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.d.ts +21 -0
- package/dist/select.js +136 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +11 -0
- package/dist/separator.js +29 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.d.ts +39 -0
- package/dist/sheet.js +140 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sidebar.d.ts +75 -0
- package/dist/sidebar.js +201 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/skeleton.d.ts +11 -0
- package/dist/skeleton.js +21 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.d.ts +20 -0
- package/dist/slider.js +55 -0
- package/dist/slider.js.map +1 -0
- package/dist/sonner.d.ts +14 -0
- package/dist/sonner.js +27 -0
- package/dist/sonner.js.map +1 -0
- package/dist/spacer.d.ts +38 -0
- package/dist/spacer.js +43 -0
- package/dist/spacer.js.map +1 -0
- package/dist/stack.d.ts +34 -0
- package/dist/stack.js +49 -0
- package/dist/stack.js.map +1 -0
- package/dist/stepper.d.ts +48 -0
- package/dist/stepper.js +226 -0
- package/dist/stepper.js.map +1 -0
- package/dist/switch.d.ts +11 -0
- package/dist/switch.js +47 -0
- package/dist/switch.js.map +1 -0
- package/dist/table.d.ts +24 -0
- package/dist/table.js +85 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.d.ts +13 -0
- package/dist/tabs.js +57 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.d.ts +10 -0
- package/dist/textarea.js +36 -0
- package/dist/textarea.js.map +1 -0
- package/dist/time-picker.d.ts +34 -0
- package/dist/time-picker.js +50 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/timeline.d.ts +42 -0
- package/dist/timeline.js +84 -0
- package/dist/timeline.js.map +1 -0
- package/dist/toggle-group.d.ts +17 -0
- package/dist/toggle-group.js +83 -0
- package/dist/toggle-group.js.map +1 -0
- package/dist/toggle.d.ts +19 -0
- package/dist/toggle.js +49 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.d.ts +13 -0
- package/dist/tooltip.js +33 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +68 -16
package/dist/sidebar.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var SidebarContext = React.createContext(null);
|
|
13
|
+
function useSidebar() {
|
|
14
|
+
const ctx = React.useContext(SidebarContext);
|
|
15
|
+
if (!ctx) {
|
|
16
|
+
throw new Error("useSidebar must be used inside <SidebarProvider>");
|
|
17
|
+
}
|
|
18
|
+
return ctx;
|
|
19
|
+
}
|
|
20
|
+
function SidebarProvider({
|
|
21
|
+
open: openProp,
|
|
22
|
+
defaultOpen = true,
|
|
23
|
+
onOpenChange,
|
|
24
|
+
children,
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
27
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
28
|
+
const isControlled = openProp !== void 0;
|
|
29
|
+
const open = isControlled ? openProp : internalOpen;
|
|
30
|
+
const setOpen = React.useCallback(
|
|
31
|
+
(next) => {
|
|
32
|
+
if (!isControlled) {
|
|
33
|
+
setInternalOpen(next);
|
|
34
|
+
}
|
|
35
|
+
onOpenChange?.(next);
|
|
36
|
+
},
|
|
37
|
+
[isControlled, onOpenChange]
|
|
38
|
+
);
|
|
39
|
+
const value = React.useMemo(() => ({ open, setOpen }), [open, setOpen]);
|
|
40
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
"data-state": open ? "open" : "closed",
|
|
44
|
+
className: cn("flex min-h-screen w-full", className),
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
) });
|
|
48
|
+
}
|
|
49
|
+
SidebarProvider.displayName = "SidebarProvider";
|
|
50
|
+
var sidebarVariants = cva(
|
|
51
|
+
cn(
|
|
52
|
+
"flex h-full shrink-0 flex-col border-foreground/[0.08] border-r bg-background text-foreground",
|
|
53
|
+
"transition-[width] duration-[var(--duration-normal,200ms)] ease-out"
|
|
54
|
+
),
|
|
55
|
+
{
|
|
56
|
+
variants: {
|
|
57
|
+
side: {
|
|
58
|
+
left: "border-r",
|
|
59
|
+
right: "order-last border-l border-r-0"
|
|
60
|
+
},
|
|
61
|
+
state: {
|
|
62
|
+
open: "w-64",
|
|
63
|
+
closed: "w-0 overflow-hidden border-r-0"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
side: "left",
|
|
68
|
+
state: "open"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
var Sidebar = React.forwardRef(
|
|
73
|
+
({ className, side = "left", children, ...props }, ref) => {
|
|
74
|
+
const { open } = useSidebar();
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
"aside",
|
|
77
|
+
{
|
|
78
|
+
ref,
|
|
79
|
+
"data-state": open ? "open" : "closed",
|
|
80
|
+
"aria-hidden": !open || void 0,
|
|
81
|
+
inert: !open,
|
|
82
|
+
className: cn(sidebarVariants({ side, state: open ? "open" : "closed" }), className),
|
|
83
|
+
...props,
|
|
84
|
+
children
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
Sidebar.displayName = "Sidebar";
|
|
90
|
+
var SidebarTrigger = React.forwardRef(
|
|
91
|
+
({ asChild, className, onClick, "aria-label": ariaLabel, ...props }, ref) => {
|
|
92
|
+
const { open, setOpen } = useSidebar();
|
|
93
|
+
const Comp = asChild ? Slot : "button";
|
|
94
|
+
const resolvedAriaLabel = ariaLabel ?? (asChild ? void 0 : open ? "Collapse sidebar" : "Expand sidebar");
|
|
95
|
+
return /* @__PURE__ */ jsx(
|
|
96
|
+
Comp,
|
|
97
|
+
{
|
|
98
|
+
ref,
|
|
99
|
+
type: asChild ? void 0 : "button",
|
|
100
|
+
"aria-label": resolvedAriaLabel,
|
|
101
|
+
"aria-expanded": open,
|
|
102
|
+
onClick: (event) => {
|
|
103
|
+
onClick?.(event);
|
|
104
|
+
if (!event.defaultPrevented) {
|
|
105
|
+
setOpen(!open);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
className: cn(
|
|
109
|
+
"inline-flex h-[var(--control-height-sm,2.25rem)] w-[var(--control-height-sm,2.25rem)] items-center justify-center rounded-md text-muted-foreground",
|
|
110
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out hover:bg-accent hover:text-accent-foreground",
|
|
111
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
...props,
|
|
115
|
+
children: asChild ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsxs(
|
|
117
|
+
"svg",
|
|
118
|
+
{
|
|
119
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
120
|
+
viewBox: "0 0 24 24",
|
|
121
|
+
fill: "none",
|
|
122
|
+
stroke: "currentColor",
|
|
123
|
+
strokeWidth: "2",
|
|
124
|
+
strokeLinecap: "round",
|
|
125
|
+
strokeLinejoin: "round",
|
|
126
|
+
className: "h-4 w-4",
|
|
127
|
+
"aria-hidden": "true",
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
130
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle sidebar" })
|
|
135
|
+
] })
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
SidebarTrigger.displayName = "SidebarTrigger";
|
|
141
|
+
var SidebarHeader = React.forwardRef(
|
|
142
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
ref,
|
|
146
|
+
className: cn("flex items-center gap-[var(--gap-sm,0.5rem)] border-b border-b-foreground/[0.08] p-[var(--space-4,1rem)]", className),
|
|
147
|
+
...props
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
SidebarHeader.displayName = "SidebarHeader";
|
|
152
|
+
var SidebarContent = React.forwardRef(
|
|
153
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
ref,
|
|
157
|
+
className: cn("flex-1 overflow-auto p-[var(--space-2,0.5rem)]", className),
|
|
158
|
+
...props
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
SidebarContent.displayName = "SidebarContent";
|
|
163
|
+
var SidebarFooter = React.forwardRef(
|
|
164
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
ref,
|
|
168
|
+
className: cn("mt-auto border-t border-t-foreground/[0.08] p-[var(--space-4,1rem)]", className),
|
|
169
|
+
...props
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
SidebarFooter.displayName = "SidebarFooter";
|
|
174
|
+
var SidebarItem = React.forwardRef(
|
|
175
|
+
({ asChild, active, className, ...props }, ref) => {
|
|
176
|
+
const Comp = asChild ? Slot : "button";
|
|
177
|
+
return /* @__PURE__ */ jsx(
|
|
178
|
+
Comp,
|
|
179
|
+
{
|
|
180
|
+
ref,
|
|
181
|
+
type: asChild ? void 0 : "button",
|
|
182
|
+
"aria-current": active ? "page" : void 0,
|
|
183
|
+
"data-active": active ? "" : void 0,
|
|
184
|
+
className: cn(
|
|
185
|
+
"inline-flex w-full items-center gap-[var(--gap-sm,0.5rem)] rounded-md px-[var(--space-3,0.75rem)] py-[var(--space-2,0.5rem)] text-sm font-medium",
|
|
186
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
187
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
188
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
189
|
+
"data-[active]:bg-accent data-[active]:text-accent-foreground",
|
|
190
|
+
className
|
|
191
|
+
),
|
|
192
|
+
...props
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
SidebarItem.displayName = "SidebarItem";
|
|
198
|
+
|
|
199
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarProvider, SidebarTrigger, useSidebar };
|
|
200
|
+
//# sourceMappingURL=sidebar.js.map
|
|
201
|
+
//# sourceMappingURL=sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/components/sidebar/sidebar.tsx"],"names":[],"mappings":";;;;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACIA,IAAM,cAAA,GAAuB,oBAA0C,IAAI,CAAA;AAM3E,SAAS,UAAA,GAAkC;AAC1C,EAAA,MAAM,GAAA,GAAY,iBAAW,cAAc,CAAA;AAC3C,EAAA,IAAI,CAAC,GAAA,EAAK;AACT,IAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,EACnE;AACA,EAAA,OAAO,GAAA;AACR;AAmBA,SAAS,eAAA,CAAgB;AAAA,EACxB,IAAA,EAAM,QAAA;AAAA,EACN,WAAA,GAAc,IAAA;AAAA,EACd,YAAA;AAAA,EACA,QAAA;AAAA,EACA;AACD,CAAA,EAAyB;AACxB,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAU,eAAS,WAAW,CAAA;AAClE,EAAA,MAAM,eAAe,QAAA,KAAa,MAAA;AAClC,EAAA,MAAM,IAAA,GAAO,eAAe,QAAA,GAAW,YAAA;AAEvC,EAAA,MAAM,OAAA,GAAgB,KAAA,CAAA,WAAA;AAAA,IACrB,CAAC,IAAA,KAAkB;AAClB,MAAA,IAAI,CAAC,YAAA,EAAc;AAClB,QAAA,eAAA,CAAgB,IAAI,CAAA;AAAA,MACrB;AACA,MAAA,YAAA,GAAe,IAAI,CAAA;AAAA,IACpB,CAAA;AAAA,IACA,CAAC,cAAc,YAAY;AAAA,GAC5B;AAEA,EAAA,MAAM,KAAA,GAAc,KAAA,CAAA,OAAA,CAAQ,OAAO,EAAE,IAAA,EAAM,SAAQ,CAAA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,GAAA;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,gDAAA,EAAkD,SAAS,CAAA;AAAA,MACxE,GAAG;AAAA;AAAA;AAGP;AACA,cAAA,CAAe,WAAA,GAAc,gBAAA;AAG7B,IAAM,aAAA,GAAsB,KAAA,CAAA,UAAA;AAAA,EAC3B,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,IAAS,GAAA,qBACzB,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,qEAAA,EAAuE,SAAS,CAAA;AAAA,MAC7F,GAAG;AAAA;AAAA;AAGP;AACA,aAAA,CAAc,WAAA,GAAc,eAAA;AAa5B,IAAM,WAAA,GAAoB,KAAA,CAAA,UAAA;AAAA,EACzB,CAAC,EAAE,OAAA,EAAS,MAAA,EAAQ,WAAW,GAAG,KAAA,IAAS,GAAA,KAAQ;AAClD,IAAA,MAAM,IAAA,GAAO,UAAU,IAAA,GAAO,QAAA;AAC9B,IAAA,uBACC,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACA,GAAA;AAAA,QACA,IAAA,EAAM,UAAU,MAAA,GAAY,QAAA;AAAA,QAC5B,cAAA,EAAc,SAAS,MAAA,GAAS,MAAA;AAAA,QAChC,aAAA,EAAa,SAAS,EAAA,GAAK,MAAA;AAAA,QAC3B,SAAA,EAAW,EAAA;AAAA,UACV,kJAAA;AAAA,UACA,iEAAA;AAAA,UACA,8CAAA;AAAA,UACA,qGAAA;AAAA,UACA,8DAAA;AAAA,UACA;AAAA,SACD;AAAA,QACC,GAAG;AAAA;AAAA,KACL;AAAA,EAEF;AACD;AACA,WAAA,CAAY,WAAA,GAAc,aAAA","file":"sidebar.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\ninterface SidebarContextValue {\n\t/** Current open/collapsed state. */\n\topen: boolean;\n\t/** Toggle or set open state. */\n\tsetOpen: (open: boolean) => void;\n}\n\nconst SidebarContext = React.createContext<SidebarContextValue | null>(null);\n\n/**\n * Reads sidebar state from context. Throws if used outside SidebarProvider.\n * @returns `{ open, setOpen }` bound to the nearest SidebarProvider.\n */\nfunction useSidebar(): SidebarContextValue {\n\tconst ctx = React.useContext(SidebarContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"useSidebar must be used inside <SidebarProvider>\");\n\t}\n\treturn ctx;\n}\n\ninterface SidebarProviderProps {\n\t/** Controlled open state. */\n\topen?: boolean;\n\t/** Uncontrolled initial open state (defaults to true). */\n\tdefaultOpen?: boolean;\n\t/** Callback fired when open state changes. */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Children — typically a Sidebar + app content sibling. */\n\tchildren: React.ReactNode;\n\t/** Extra class names on the provider wrapper. */\n\tclassName?: string;\n}\n\n/**\n * Hosts sidebar state. Wrap your app shell (Sidebar + main content) in this.\n * @returns A flex container with a SidebarContext provider.\n */\nfunction SidebarProvider({\n\topen: openProp,\n\tdefaultOpen = true,\n\tonOpenChange,\n\tchildren,\n\tclassName,\n}: SidebarProviderProps) {\n\tconst [internalOpen, setInternalOpen] = React.useState(defaultOpen);\n\tconst isControlled = openProp !== undefined;\n\tconst open = isControlled ? openProp : internalOpen;\n\n\tconst setOpen = React.useCallback(\n\t\t(next: boolean) => {\n\t\t\tif (!isControlled) {\n\t\t\t\tsetInternalOpen(next);\n\t\t\t}\n\t\t\tonOpenChange?.(next);\n\t\t},\n\t\t[isControlled, onOpenChange],\n\t);\n\n\tconst value = React.useMemo(() => ({ open, setOpen }), [open, setOpen]);\n\n\treturn (\n\t\t<SidebarContext.Provider value={value}>\n\t\t\t<div\n\t\t\t\tdata-state={open ? \"open\" : \"closed\"}\n\t\t\t\tclassName={cn(\"flex min-h-screen w-full\", className)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</SidebarContext.Provider>\n\t);\n}\nSidebarProvider.displayName = \"SidebarProvider\";\n\nconst sidebarVariants = cva(\n\tcn(\n\t\t\"flex h-full shrink-0 flex-col border-foreground/[0.08] border-r bg-background text-foreground\",\n\t\t\"transition-[width] duration-[var(--duration-normal,200ms)] ease-out\",\n\t),\n\t{\n\t\tvariants: {\n\t\t\tside: {\n\t\t\t\tleft: \"border-r\",\n\t\t\t\tright: \"order-last border-l border-r-0\",\n\t\t\t},\n\t\t\tstate: {\n\t\t\t\topen: \"w-64\",\n\t\t\t\tclosed: \"w-0 overflow-hidden border-r-0\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tside: \"left\",\n\t\t\tstate: \"open\",\n\t\t},\n\t},\n);\n\ninterface SidebarProps\n\textends React.HTMLAttributes<HTMLElement>,\n\t\tPick<VariantProps<typeof sidebarVariants>, \"side\"> {}\n\n/**\n * App-shell sidebar. Reads open state from SidebarProvider and animates width.\n * @returns An aside element that expands/collapses.\n */\nconst Sidebar = React.forwardRef<HTMLElement, SidebarProps>(\n\t({ className, side = \"left\", children, ...props }, ref) => {\n\t\tconst { open } = useSidebar();\n\t\treturn (\n\t\t\t<aside\n\t\t\t\tref={ref}\n\t\t\t\tdata-state={open ? \"open\" : \"closed\"}\n\t\t\t\taria-hidden={!open || undefined}\n\t\t\t\tinert={!open}\n\t\t\t\tclassName={cn(sidebarVariants({ side, state: open ? \"open\" : \"closed\" }), className)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</aside>\n\t\t);\n\t},\n);\nSidebar.displayName = \"Sidebar\";\n\ninterface SidebarTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\t/** Render as the child element (Button, etc.) using Radix Slot. */\n\tasChild?: boolean;\n}\n\n/**\n * Toggles the sidebar open/closed. Renders a button by default; use asChild to style.\n * @returns A button that flips SidebarProvider state.\n */\nconst SidebarTrigger = React.forwardRef<HTMLButtonElement, SidebarTriggerProps>(\n\t({ asChild, className, onClick, \"aria-label\": ariaLabel, ...props }, ref) => {\n\t\tconst { open, setOpen } = useSidebar();\n\t\tconst Comp = asChild ? Slot : \"button\";\n\t\t// When asChild, prefer the consumer's aria-label (or visible text) — don't force ours.\n\t\tconst resolvedAriaLabel =\n\t\t\tariaLabel ?? (asChild ? undefined : open ? \"Collapse sidebar\" : \"Expand sidebar\");\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\tref={ref}\n\t\t\t\ttype={asChild ? undefined : \"button\"}\n\t\t\t\taria-label={resolvedAriaLabel}\n\t\t\t\taria-expanded={open}\n\t\t\t\tonClick={(event: React.MouseEvent<HTMLElement>) => {\n\t\t\t\t\tonClick?.(event as React.MouseEvent<HTMLButtonElement>);\n\t\t\t\t\tif (!event.defaultPrevented) {\n\t\t\t\t\t\tsetOpen(!open);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"inline-flex h-[var(--control-height-sm,2.25rem)] w-[var(--control-height-sm,2.25rem)] items-center justify-center rounded-md text-muted-foreground\",\n\t\t\t\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{asChild ? null : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\tclassName=\"h-4 w-4\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\" />\n\t\t\t\t\t\t\t<line x1=\"9\" y1=\"3\" x2=\"9\" y2=\"21\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t<span className=\"sr-only\">Toggle sidebar</span>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Comp>\n\t\t);\n\t},\n);\nSidebarTrigger.displayName = \"SidebarTrigger\";\n\n/** Header container at the top of the sidebar. */\nconst SidebarHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"flex items-center gap-[var(--gap-sm,0.5rem)] border-b border-b-foreground/[0.08] p-[var(--space-4,1rem)]\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nSidebarHeader.displayName = \"SidebarHeader\";\n\n/** Scrollable main area of the sidebar. */\nconst SidebarContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"flex-1 overflow-auto p-[var(--space-2,0.5rem)]\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nSidebarContent.displayName = \"SidebarContent\";\n\n/** Footer container at the bottom of the sidebar. */\nconst SidebarFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n\t({ className, ...props }, ref) => (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"mt-auto border-t border-t-foreground/[0.08] p-[var(--space-4,1rem)]\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nSidebarFooter.displayName = \"SidebarFooter\";\n\ninterface SidebarItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\t/** Render as the child element (next/link, etc.) via Slot. */\n\tasChild?: boolean;\n\t/** Mark as the current/selected item. */\n\tactive?: boolean;\n}\n\n/**\n * Single selectable row inside SidebarContent. Compose icon + label in children.\n * @returns An accessible button (or Slot) styled as a sidebar row.\n */\nconst SidebarItem = React.forwardRef<HTMLButtonElement, SidebarItemProps>(\n\t({ asChild, active, className, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"button\";\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\tref={ref}\n\t\t\t\ttype={asChild ? undefined : \"button\"}\n\t\t\t\taria-current={active ? \"page\" : undefined}\n\t\t\t\tdata-active={active ? \"\" : undefined}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"inline-flex w-full items-center gap-[var(--gap-sm,0.5rem)] rounded-md px-[var(--space-3,0.75rem)] py-[var(--space-2,0.5rem)] text-sm font-medium\",\n\t\t\t\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out\",\n\t\t\t\t\t\"hover:bg-accent hover:text-accent-foreground\",\n\t\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\"data-[active]:bg-accent data-[active]:text-accent-foreground\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nSidebarItem.displayName = \"SidebarItem\";\n\nexport {\n\tSidebarProvider,\n\tSidebar,\n\tSidebarTrigger,\n\tSidebarHeader,\n\tSidebarContent,\n\tSidebarFooter,\n\tSidebarItem,\n\tuseSidebar,\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A placeholder shimmer element shown while content is loading.
|
|
6
|
+
* Pair with explicit width/height via className.
|
|
7
|
+
* @returns A div with pulsing muted background
|
|
8
|
+
*/
|
|
9
|
+
declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Skeleton };
|
package/dist/skeleton.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/lib/utils.ts
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
function Skeleton({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
className: cn("animate-pulse rounded-md border border-foreground/[0.06] bg-muted", className),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Skeleton };
|
|
20
|
+
//# sourceMappingURL=skeleton.js.map
|
|
21
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/primitives/skeleton/skeleton.tsx"],"names":[],"mappings":";;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACFA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,OAAM,EAAyC;AAChF,EAAA,uBACC,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,mEAAA,EAAqE,SAAS,CAAA;AAAA,MAC3F,GAAG;AAAA;AAAA,GACL;AAEF","file":"skeleton.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\n/**\n * A placeholder shimmer element shown while content is loading.\n * Pair with explicit width/height via className.\n * @returns A div with pulsing muted background\n */\nfunction Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\"animate-pulse rounded-md border border-foreground/[0.06] bg-muted\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Skeleton };\n"]}
|
package/dist/slider.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface SliderProps extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {
|
|
5
|
+
/**
|
|
6
|
+
* Per-thumb accessible labels. When the slider has multiple thumbs, pass
|
|
7
|
+
* one entry per thumb (e.g. ["Minimum", "Maximum"]). For a single-thumb
|
|
8
|
+
* slider, the Root's `aria-label` / `aria-labelledby` is mirrored onto
|
|
9
|
+
* the thumb automatically — pass `thumbLabels` only when those defaults
|
|
10
|
+
* are insufficient.
|
|
11
|
+
*/
|
|
12
|
+
thumbLabels?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A range input with one or more draggable thumbs.
|
|
16
|
+
* Built on Radix UI Slider with keyboard controls (arrows, Home, End, PageUp/Down).
|
|
17
|
+
*/
|
|
18
|
+
declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLSpanElement>>;
|
|
19
|
+
|
|
20
|
+
export { Slider, type SliderProps };
|
package/dist/slider.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
var Slider = React.forwardRef(({ className, thumbLabels, ...props }, ref) => {
|
|
12
|
+
const values = props.value ?? props.defaultValue ?? [0];
|
|
13
|
+
const rootLabel = props["aria-label"];
|
|
14
|
+
const rootLabelledBy = props["aria-labelledby"];
|
|
15
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && thumbLabels && thumbLabels.length !== values.length) {
|
|
16
|
+
console.warn(
|
|
17
|
+
`Slider: thumbLabels.length (${thumbLabels.length}) does not match value.length (${values.length}). Missing labels fall back to indexed names; extra labels are ignored.`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
SliderPrimitive.Root,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
25
|
+
...props,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full border border-foreground/[0.08] bg-secondary", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
|
|
28
|
+
values.map((_, i) => {
|
|
29
|
+
const explicit = thumbLabels?.[i];
|
|
30
|
+
const fallback = values.length === 1 ? rootLabel : rootLabel ? `${rootLabel} (${i + 1} of ${values.length})` : void 0;
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
SliderPrimitive.Thumb,
|
|
33
|
+
{
|
|
34
|
+
"aria-label": explicit ?? fallback,
|
|
35
|
+
"aria-labelledby": explicit || fallback ? void 0 : rootLabelledBy,
|
|
36
|
+
className: cn(
|
|
37
|
+
"block h-5 w-5 rounded-full border-2 border-primary bg-background",
|
|
38
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out shadow-md",
|
|
39
|
+
"hover:shadow-lg hover:scale-110",
|
|
40
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
41
|
+
"disabled:pointer-events-none disabled:opacity-50"
|
|
42
|
+
)
|
|
43
|
+
},
|
|
44
|
+
i
|
|
45
|
+
);
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
Slider.displayName = "Slider";
|
|
52
|
+
|
|
53
|
+
export { Slider };
|
|
54
|
+
//# sourceMappingURL=slider.js.map
|
|
55
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/primitives/slider/slider.tsx"],"names":[],"mappings":";;;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACiBA,IAAM,MAAA,GAAe,iBAGnB,CAAC,EAAE,WAAW,WAAA,EAAa,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAChD,EAAA,MAAM,SAAS,KAAA,CAAM,KAAA,IAAS,KAAA,CAAM,YAAA,IAAgB,CAAC,CAAC,CAAA;AACtD,EAAA,MAAM,SAAA,GAAY,MAAM,YAAY,CAAA;AACpC,EAAA,MAAM,cAAA,GAAiB,MAAM,iBAAiB,CAAA;AAE9C,EAAA,IACC,OAAO,OAAA,KAAY,WAAA,IACnB,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AAA;AACD,aAAA;AAAA,YAXK;AAAA,WAYN;AAAA,QAEF,CAAC;AAAA;AAAA;AAAA,GACF;AAEF,CAAC;AACD,MAAA,CAAO,WAAA,GAAc,QAAA","file":"slider.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as SliderPrimitive from \"@radix-ui/react-slider\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\n// Local ambient — components run in browsers where bundlers (Next, Vite, tsup)\n// replace `process.env.NODE_ENV` at build time. Avoids pulling @types/node into\n// the components package just for one dev-mode warning.\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\n\ninterface SliderProps\n\textends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root> {\n\t/**\n\t * Per-thumb accessible labels. When the slider has multiple thumbs, pass\n\t * one entry per thumb (e.g. [\"Minimum\", \"Maximum\"]). For a single-thumb\n\t * slider, the Root's `aria-label` / `aria-labelledby` is mirrored onto\n\t * the thumb automatically — pass `thumbLabels` only when those defaults\n\t * are insufficient.\n\t */\n\tthumbLabels?: string[];\n}\n\n/**\n * A range input with one or more draggable thumbs.\n * Built on Radix UI Slider with keyboard controls (arrows, Home, End, PageUp/Down).\n */\nconst Slider = React.forwardRef<\n\tReact.ComponentRef<typeof SliderPrimitive.Root>,\n\tSliderProps\n>(({ className, thumbLabels, ...props }, ref) => {\n\tconst values = props.value ?? props.defaultValue ?? [0];\n\tconst rootLabel = props[\"aria-label\"];\n\tconst rootLabelledBy = props[\"aria-labelledby\"];\n\n\tif (\n\t\ttypeof process !== \"undefined\" &&\n\t\tprocess.env?.NODE_ENV !== \"production\" &&\n\t\tthumbLabels &&\n\t\tthumbLabels.length !== values.length\n\t) {\n\t\tconsole.warn(\n\t\t\t`Slider: thumbLabels.length (${thumbLabels.length}) does not match value.length (${values.length}). ` +\n\t\t\t\t`Missing labels fall back to indexed names; extra labels are ignored.`,\n\t\t);\n\t}\n\n\treturn (\n\t\t<SliderPrimitive.Root\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"relative flex w-full touch-none select-none items-center\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<SliderPrimitive.Track className=\"relative h-2 w-full grow overflow-hidden rounded-full border border-foreground/[0.08] bg-secondary\">\n\t\t\t\t<SliderPrimitive.Range className=\"absolute h-full bg-primary\" />\n\t\t\t</SliderPrimitive.Track>\n\t\t\t{values.map((_, i) => {\n\t\t\t\tconst explicit = thumbLabels?.[i];\n\t\t\t\tconst fallback =\n\t\t\t\t\tvalues.length === 1\n\t\t\t\t\t\t? rootLabel\n\t\t\t\t\t\t: rootLabel\n\t\t\t\t\t\t\t? `${rootLabel} (${i + 1} of ${values.length})`\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\treturn (\n\t\t\t\t\t<SliderPrimitive.Thumb\n\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Radix renders one thumb per value by index\n\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\taria-label={explicit ?? fallback}\n\t\t\t\t\t\taria-labelledby={\n\t\t\t\t\t\t\texplicit || fallback ? undefined : rootLabelledBy\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"block h-5 w-5 rounded-full border-2 border-primary bg-background\",\n\t\t\t\t\t\t\t\"transition-all duration-[var(--duration-normal,200ms)] ease-out shadow-md\",\n\t\t\t\t\t\t\t\"hover:shadow-lg hover:scale-110\",\n\t\t\t\t\t\t\t\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\t\t\t\t\t\"disabled:pointer-events-none disabled:opacity-50\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t})}\n\t\t</SliderPrimitive.Root>\n\t);\n});\nSlider.displayName = \"Slider\";\n\nexport type { SliderProps };\n\nexport { Slider };\n"]}
|
package/dist/sonner.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Toaster as Toaster$1 } from 'sonner';
|
|
3
|
+
export { toast } from 'sonner';
|
|
4
|
+
|
|
5
|
+
type ToasterProps = React.ComponentProps<typeof Toaster$1>;
|
|
6
|
+
/**
|
|
7
|
+
* The global toast container. Render once in your app root.
|
|
8
|
+
* Re-export of Sonner's Toaster styled to use Hex UI theme tokens.
|
|
9
|
+
* @param props - Sonner Toaster props (position, richColors, etc.)
|
|
10
|
+
* @returns A styled portal container for toast notifications
|
|
11
|
+
*/
|
|
12
|
+
declare function Toaster({ ...props }: ToasterProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Toaster };
|
package/dist/sonner.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Toaster as Toaster$1 } from 'sonner';
|
|
3
|
+
export { toast } from 'sonner';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Toaster({ ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
Toaster$1,
|
|
9
|
+
{
|
|
10
|
+
theme: "system",
|
|
11
|
+
className: "toaster group",
|
|
12
|
+
toastOptions: {
|
|
13
|
+
classNames: {
|
|
14
|
+
toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
15
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
16
|
+
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
17
|
+
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Toaster };
|
|
26
|
+
//# sourceMappingURL=sonner.js.map
|
|
27
|
+
//# sourceMappingURL=sonner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/sonner/sonner.tsx"],"names":["SonnerToaster"],"mappings":";;;;AAYA,SAAS,OAAA,CAAQ,EAAE,GAAG,KAAA,EAAM,EAAiB;AAC5C,EAAA,uBACC,GAAA;AAAA,IAACA,SAAA;AAAA,IAAA;AAAA,MACA,KAAA,EAAM,QAAA;AAAA,MACN,SAAA,EAAU,eAAA;AAAA,MACV,YAAA,EAAc;AAAA,QACb,UAAA,EAAY;AAAA,UACX,KAAA,EACC,uIAAA;AAAA,UACD,WAAA,EAAa,sCAAA;AAAA,UACb,YAAA,EACC,kEAAA;AAAA,UACD,YAAA,EACC;AAAA;AACF,OACD;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF","file":"sonner.js","sourcesContent":["\"use client\";\n\nimport { Toaster as SonnerToaster, toast } from \"sonner\";\n\ntype ToasterProps = React.ComponentProps<typeof SonnerToaster>;\n\n/**\n * The global toast container. Render once in your app root.\n * Re-export of Sonner's Toaster styled to use Hex UI theme tokens.\n * @param props - Sonner Toaster props (position, richColors, etc.)\n * @returns A styled portal container for toast notifications\n */\nfunction Toaster({ ...props }: ToasterProps) {\n\treturn (\n\t\t<SonnerToaster\n\t\t\ttheme=\"system\"\n\t\t\tclassName=\"toaster group\"\n\t\t\ttoastOptions={{\n\t\t\t\tclassNames: {\n\t\t\t\t\ttoast:\n\t\t\t\t\t\t\"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg\",\n\t\t\t\t\tdescription: \"group-[.toast]:text-muted-foreground\",\n\t\t\t\t\tactionButton:\n\t\t\t\t\t\t\"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n\t\t\t\t\tcancelButton:\n\t\t\t\t\t\t\"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\",\n\t\t\t\t},\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Toaster, toast };\n"]}
|
package/dist/spacer.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* CVA variants for Spacer — declarative whitespace.
|
|
8
|
+
* `size` sets `--spacer-size` to a `--space-*` token (with inline fallback);
|
|
9
|
+
* `axis` consumes that var via the bracket form used everywhere else in the
|
|
10
|
+
* package, so the height or width can never collapse to zero if the size
|
|
11
|
+
* variant is dropped.
|
|
12
|
+
*/
|
|
13
|
+
declare const spacerVariants: (props?: ({
|
|
14
|
+
size?: "sm" | "lg" | "md" | "xl" | "xs" | null | undefined;
|
|
15
|
+
axis?: "both" | "horizontal" | "vertical" | null | undefined;
|
|
16
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
17
|
+
/** Props for the Spacer component. */
|
|
18
|
+
interface SpacerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children">, VariantProps<typeof spacerVariants> {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A declarative whitespace block. Use when you want to insert space between two
|
|
22
|
+
* siblings without relying on margin or gap (e.g. inside a flex container that
|
|
23
|
+
* doesn't own the spacing decision).
|
|
24
|
+
*
|
|
25
|
+
* Renders an empty `<div>` with `aria-hidden` since it has no semantic content.
|
|
26
|
+
*
|
|
27
|
+
* @param props - Spacer props including `size` and `axis` variant keys.
|
|
28
|
+
* @returns An empty div with the requested dimension.
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <h1>Title</h1>
|
|
32
|
+
* <Spacer size="lg" />
|
|
33
|
+
* <p>Body</p>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function Spacer({ className, size, axis, ...props }: SpacerProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
export { Spacer, type SpacerProps, spacerVariants };
|
package/dist/spacer.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/primitives/spacer/spacer.tsx
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
var spacerVariants = cva("shrink-0", {
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
xs: "[--spacer-size:var(--space-1,0.25rem)]",
|
|
14
|
+
sm: "[--spacer-size:var(--space-2,0.5rem)]",
|
|
15
|
+
md: "[--spacer-size:var(--space-4,1rem)]",
|
|
16
|
+
lg: "[--spacer-size:var(--space-8,2rem)]",
|
|
17
|
+
xl: "[--spacer-size:var(--space-16,4rem)]"
|
|
18
|
+
},
|
|
19
|
+
axis: {
|
|
20
|
+
vertical: "h-[var(--spacer-size)] w-0",
|
|
21
|
+
horizontal: "w-[var(--spacer-size)] h-0",
|
|
22
|
+
both: "h-[var(--spacer-size)] w-[var(--spacer-size)]"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
size: "md",
|
|
27
|
+
axis: "vertical"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function Spacer({ className, size, axis, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
className: cn(spacerVariants({ size, axis }), className),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Spacer, spacerVariants };
|
|
42
|
+
//# sourceMappingURL=spacer.js.map
|
|
43
|
+
//# sourceMappingURL=spacer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/primitives/spacer/spacer.tsx"],"names":[],"mappings":";;;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;ACCA,IAAM,cAAA,GAAiB,IAAI,UAAA,EAAY;AAAA,EACtC,QAAA,EAAU;AAAA,IACT,IAAA,EAAM;AAAA,MACL,EAAA,EAAI,wCAAA;AAAA,MACJ,EAAA,EAAI,uCAAA;AAAA,MACJ,EAAA,EAAI,qCAAA;AAAA,MACJ,EAAA,EAAI,qCAAA;AAAA,MACJ,EAAA,EAAI;AAAA,KACL;AAAA,IACA,IAAA,EAAM;AAAA,MACL,QAAA,EAAU,4BAAA;AAAA,MACV,UAAA,EAAY,4BAAA;AAAA,MACZ,IAAA,EAAM;AAAA;AACP,GACD;AAAA,EACA,eAAA,EAAiB;AAAA,IAChB,IAAA,EAAM,IAAA;AAAA,IACN,IAAA,EAAM;AAAA;AAER,CAAC;AAuBD,SAAS,OAAO,EAAE,SAAA,EAAW,MAAM,IAAA,EAAM,GAAG,OAAM,EAAgB;AACjE,EAAA,uBACC,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,aAAA,EAAY,MAAA;AAAA,MACZ,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,MAAM,IAAA,EAAM,GAAG,SAAS,CAAA;AAAA,MACtD,GAAG;AAAA;AAAA,GACL;AAEF","file":"spacer.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","import { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\n\n/**\n * CVA variants for Spacer — declarative whitespace.\n * `size` sets `--spacer-size` to a `--space-*` token (with inline fallback);\n * `axis` consumes that var via the bracket form used everywhere else in the\n * package, so the height or width can never collapse to zero if the size\n * variant is dropped.\n */\nconst spacerVariants = cva(\"shrink-0\", {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: \"[--spacer-size:var(--space-1,0.25rem)]\",\n\t\t\tsm: \"[--spacer-size:var(--space-2,0.5rem)]\",\n\t\t\tmd: \"[--spacer-size:var(--space-4,1rem)]\",\n\t\t\tlg: \"[--spacer-size:var(--space-8,2rem)]\",\n\t\t\txl: \"[--spacer-size:var(--space-16,4rem)]\",\n\t\t},\n\t\taxis: {\n\t\t\tvertical: \"h-[var(--spacer-size)] w-0\",\n\t\t\thorizontal: \"w-[var(--spacer-size)] h-0\",\n\t\t\tboth: \"h-[var(--spacer-size)] w-[var(--spacer-size)]\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t\taxis: \"vertical\",\n\t},\n});\n\n/** Props for the Spacer component. */\nexport interface SpacerProps\n\textends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\">,\n\t\tVariantProps<typeof spacerVariants> {}\n\n/**\n * A declarative whitespace block. Use when you want to insert space between two\n * siblings without relying on margin or gap (e.g. inside a flex container that\n * doesn't own the spacing decision).\n *\n * Renders an empty `<div>` with `aria-hidden` since it has no semantic content.\n *\n * @param props - Spacer props including `size` and `axis` variant keys.\n * @returns An empty div with the requested dimension.\n * @example\n * ```tsx\n * <h1>Title</h1>\n * <Spacer size=\"lg\" />\n * <p>Body</p>\n * ```\n */\nfunction Spacer({ className, size, axis, ...props }: SpacerProps) {\n\treturn (\n\t\t<div\n\t\t\taria-hidden=\"true\"\n\t\t\tclassName={cn(spacerVariants({ size, axis }), className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Spacer, spacerVariants };\n"]}
|
package/dist/stack.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* CVA variants for Stack — vertical flex flow. `gap`, `align`, and `justify`
|
|
8
|
+
* pull from the shared layout-variant maps so any change to the gap scale
|
|
9
|
+
* propagates to Cluster and Grid simultaneously.
|
|
10
|
+
*/
|
|
11
|
+
declare const stackVariants: (props?: ({
|
|
12
|
+
gap?: "sm" | "lg" | "md" | "xl" | "xs" | null | undefined;
|
|
13
|
+
align?: "center" | "start" | "end" | "stretch" | null | undefined;
|
|
14
|
+
justify?: "center" | "start" | "end" | "between" | null | undefined;
|
|
15
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
|
+
/** Props for the Stack component. */
|
|
17
|
+
interface StackProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof stackVariants> {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Vertical flex flow with token-bound gap. Children stack top-to-bottom.
|
|
21
|
+
* @param props - Stack props including `gap`, `align`, and `justify` variant keys.
|
|
22
|
+
* @returns A flex column with consistent vertical spacing.
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Stack gap="lg">
|
|
26
|
+
* <h2>Section title</h2>
|
|
27
|
+
* <p>Paragraph one.</p>
|
|
28
|
+
* <p>Paragraph two.</p>
|
|
29
|
+
* </Stack>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare function Stack({ className, gap, align, justify, ...props }: StackProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
|
|
34
|
+
export { Stack, type StackProps, stackVariants };
|
package/dist/stack.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/primitives/stack/stack.tsx
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/primitives/_shared/layout-variants.ts
|
|
12
|
+
var gapVariants = {
|
|
13
|
+
xs: "gap-[var(--gap-xs,0.25rem)]",
|
|
14
|
+
sm: "gap-[var(--gap-sm,0.5rem)]",
|
|
15
|
+
md: "gap-[var(--gap-md,1rem)]",
|
|
16
|
+
lg: "gap-[var(--gap-lg,1.5rem)]",
|
|
17
|
+
xl: "gap-[var(--gap-xl,2rem)]"
|
|
18
|
+
};
|
|
19
|
+
var justifyVariants = {
|
|
20
|
+
start: "justify-start",
|
|
21
|
+
center: "justify-center",
|
|
22
|
+
end: "justify-end",
|
|
23
|
+
between: "justify-between"
|
|
24
|
+
};
|
|
25
|
+
var flexAlignVariants = {
|
|
26
|
+
start: "items-start",
|
|
27
|
+
center: "items-center",
|
|
28
|
+
end: "items-end",
|
|
29
|
+
stretch: "items-stretch"
|
|
30
|
+
};
|
|
31
|
+
var stackVariants = cva("flex flex-col", {
|
|
32
|
+
variants: {
|
|
33
|
+
gap: gapVariants,
|
|
34
|
+
align: flexAlignVariants,
|
|
35
|
+
justify: justifyVariants
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
gap: "md",
|
|
39
|
+
align: "stretch",
|
|
40
|
+
justify: "start"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
function Stack({ className, gap, align, justify, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx("div", { className: cn(stackVariants({ gap, align, justify }), className), ...props });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { Stack, stackVariants };
|
|
48
|
+
//# sourceMappingURL=stack.js.map
|
|
49
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts","../src/primitives/_shared/layout-variants.ts","../src/primitives/stack/stack.tsx"],"names":[],"mappings":";;;;;;AAQO,SAAS,MAAM,MAAA,EAAsB;AAC3C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC5B;;;ACCO,IAAM,WAAA,GAAc;AAAA,EAC1B,EAAA,EAAI,6BAAA;AAAA,EACJ,EAAA,EAAI,4BAAA;AAAA,EACJ,EAAA,EAAI,0BAAA;AAAA,EACJ,EAAA,EAAI,4BAAA;AAAA,EACJ,EAAA,EAAI;AACL,CAAA;AAGO,IAAM,eAAA,GAAkB;AAAA,EAC9B,KAAA,EAAO,eAAA;AAAA,EACP,MAAA,EAAQ,gBAAA;AAAA,EACR,GAAA,EAAK,aAAA;AAAA,EACL,OAAA,EAAS;AACV,CAAA;AAGO,IAAM,iBAAA,GAAoB;AAAA,EAChC,KAAA,EAAO,aAAA;AAAA,EACP,MAAA,EAAQ,cAAA;AAAA,EACR,GAAA,EAAK,WAAA;AAAA,EACL,OAAA,EAAS;AACV,CAAA;ACnBA,IAAM,aAAA,GAAgB,IAAI,eAAA,EAAiB;AAAA,EAC1C,QAAA,EAAU;AAAA,IACT,GAAA,EAAK,WAAA;AAAA,IACL,KAAA,EAAO,iBAAA;AAAA,IACP,OAAA,EAAS;AAAA,GACV;AAAA,EACA,eAAA,EAAiB;AAAA,IAChB,GAAA,EAAK,IAAA;AAAA,IACL,KAAA,EAAO,SAAA;AAAA,IACP,OAAA,EAAS;AAAA;AAEX,CAAC;AAoBD,SAAS,KAAA,CAAM,EAAE,SAAA,EAAW,GAAA,EAAK,OAAO,OAAA,EAAS,GAAG,OAAM,EAAe;AACxE,EAAA,uBACC,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,cAAc,EAAE,GAAA,EAAK,KAAA,EAAO,OAAA,EAAS,CAAA,EAAG,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAAA;AAEpF","file":"stack.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","/**\n * Single source of truth for layout-primitive CVA variant maps.\n *\n * Stack, Cluster, Grid all share `gap` and `justify` value sets; align values\n * differ slightly (`stretch` for column-like flows, `baseline` for row flows).\n * Centralizing the maps here keeps token names and Tailwind classes in one\n * file — when the gap scale changes (renamed token, new step, etc.), all\n * three components update together.\n */\n\n/** Gap scale bound to `--gap-*` tokens. Used by Stack, Cluster, Grid. */\nexport const gapVariants = {\n\txs: \"gap-[var(--gap-xs,0.25rem)]\",\n\tsm: \"gap-[var(--gap-sm,0.5rem)]\",\n\tmd: \"gap-[var(--gap-md,1rem)]\",\n\tlg: \"gap-[var(--gap-lg,1.5rem)]\",\n\txl: \"gap-[var(--gap-xl,2rem)]\",\n} as const;\n\n/** `justify-content` values shared by Stack and Cluster. */\nexport const justifyVariants = {\n\tstart: \"justify-start\",\n\tcenter: \"justify-center\",\n\tend: \"justify-end\",\n\tbetween: \"justify-between\",\n} as const;\n\n/** Cross-axis `align-items` values for vertical/grid flows (column-like). */\nexport const flexAlignVariants = {\n\tstart: \"items-start\",\n\tcenter: \"items-center\",\n\tend: \"items-end\",\n\tstretch: \"items-stretch\",\n} as const;\n\n/** Cross-axis `align-items` values for horizontal flows. Includes `baseline`. */\nexport const clusterAlignVariants = {\n\tstart: \"items-start\",\n\tcenter: \"items-center\",\n\tend: \"items-end\",\n\tstretch: \"items-stretch\",\n\tbaseline: \"items-baseline\",\n} as const;\n","import { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../../lib/utils.js\";\nimport {\n\tflexAlignVariants,\n\tgapVariants,\n\tjustifyVariants,\n} from \"../_shared/layout-variants.js\";\n\n/**\n * CVA variants for Stack — vertical flex flow. `gap`, `align`, and `justify`\n * pull from the shared layout-variant maps so any change to the gap scale\n * propagates to Cluster and Grid simultaneously.\n */\nconst stackVariants = cva(\"flex flex-col\", {\n\tvariants: {\n\t\tgap: gapVariants,\n\t\talign: flexAlignVariants,\n\t\tjustify: justifyVariants,\n\t},\n\tdefaultVariants: {\n\t\tgap: \"md\",\n\t\talign: \"stretch\",\n\t\tjustify: \"start\",\n\t},\n});\n\n/** Props for the Stack component. */\nexport interface StackProps\n\textends React.HTMLAttributes<HTMLDivElement>,\n\t\tVariantProps<typeof stackVariants> {}\n\n/**\n * Vertical flex flow with token-bound gap. Children stack top-to-bottom.\n * @param props - Stack props including `gap`, `align`, and `justify` variant keys.\n * @returns A flex column with consistent vertical spacing.\n * @example\n * ```tsx\n * <Stack gap=\"lg\">\n * <h2>Section title</h2>\n * <p>Paragraph one.</p>\n * <p>Paragraph two.</p>\n * </Stack>\n * ```\n */\nfunction Stack({ className, gap, align, justify, ...props }: StackProps) {\n\treturn (\n\t\t<div className={cn(stackVariants({ gap, align, justify }), className)} {...props} />\n\t);\n}\n\nexport { Stack, stackVariants };\n"]}
|