@ship-it-ui/ui 0.0.1 → 0.0.2
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 +9 -4
- package/dist/index.cjs +1907 -1041
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +225 -62
- package/dist/index.d.ts +225 -62
- package/dist/index.js +1681 -776
- package/dist/index.js.map +1 -1
- package/package.json +18 -6
- package/src/styles/animations.css +11 -0
- package/src/styles/globals.css +30 -0
package/dist/index.cjs
CHANGED
|
@@ -1,80 +1,200 @@
|
|
|
1
|
-
'use
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var RadixHoverCard = require('@radix-ui/react-hover-card');
|
|
20
|
-
var RadixPopover = require('@radix-ui/react-popover');
|
|
21
|
-
var RadixToast = require('@radix-ui/react-toast');
|
|
22
|
-
var RadixTooltip = require('@radix-ui/react-tooltip');
|
|
23
|
-
var RadixMenubar = require('@radix-ui/react-menubar');
|
|
24
|
-
var RadixTabs = require('@radix-ui/react-tabs');
|
|
25
|
-
|
|
26
|
-
function _interopNamespace(e) {
|
|
27
|
-
if (e && e.__esModule) return e;
|
|
28
|
-
var n = Object.create(null);
|
|
29
|
-
if (e) {
|
|
30
|
-
Object.keys(e).forEach(function (k) {
|
|
31
|
-
if (k !== 'default') {
|
|
32
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () { return e[k]; }
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
39
19
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
// src/index.ts
|
|
33
|
+
var index_exports = {};
|
|
34
|
+
__export(index_exports, {
|
|
35
|
+
Alert: () => Alert,
|
|
36
|
+
AlertDialog: () => AlertDialog,
|
|
37
|
+
AlertDialogAction: () => AlertDialogAction,
|
|
38
|
+
AlertDialogCancel: () => AlertDialogCancel,
|
|
39
|
+
AlertDialogRoot: () => AlertDialogRoot,
|
|
40
|
+
AlertDialogTrigger: () => AlertDialogTrigger,
|
|
41
|
+
Avatar: () => Avatar,
|
|
42
|
+
AvatarGroup: () => AvatarGroup,
|
|
43
|
+
Badge: () => Badge,
|
|
44
|
+
Banner: () => Banner,
|
|
45
|
+
Breadcrumbs: () => Breadcrumbs,
|
|
46
|
+
Button: () => Button,
|
|
47
|
+
ButtonGroup: () => ButtonGroup,
|
|
48
|
+
Calendar: () => Calendar,
|
|
49
|
+
Card: () => Card,
|
|
50
|
+
CardLink: () => CardLink,
|
|
51
|
+
Checkbox: () => Checkbox,
|
|
52
|
+
Chip: () => Chip,
|
|
53
|
+
Combobox: () => Combobox,
|
|
54
|
+
CommandPalette: () => CommandPalette,
|
|
55
|
+
ContextMenu: () => ContextMenu,
|
|
56
|
+
ContextMenuContent: () => ContextMenuContent,
|
|
57
|
+
ContextMenuItem: () => ContextMenuItem,
|
|
58
|
+
ContextMenuPortal: () => ContextMenuPortal,
|
|
59
|
+
ContextMenuRoot: () => ContextMenuRoot,
|
|
60
|
+
ContextMenuSeparator: () => ContextMenuSeparator,
|
|
61
|
+
ContextMenuTrigger: () => ContextMenuTrigger,
|
|
62
|
+
Crumb: () => Crumb,
|
|
63
|
+
DataTable: () => DataTable,
|
|
64
|
+
DatePicker: () => DatePicker,
|
|
65
|
+
Dialog: () => Dialog,
|
|
66
|
+
DialogClose: () => DialogClose,
|
|
67
|
+
DialogContent: () => DialogContent,
|
|
68
|
+
DialogOverlay: () => DialogOverlay,
|
|
69
|
+
DialogPortal: () => DialogPortal,
|
|
70
|
+
DialogRoot: () => DialogRoot,
|
|
71
|
+
DialogTrigger: () => DialogTrigger,
|
|
72
|
+
Dots: () => Dots,
|
|
73
|
+
Drawer: () => Drawer,
|
|
74
|
+
DropdownMenu: () => DropdownMenu,
|
|
75
|
+
DropdownMenuContent: () => DropdownMenuContent,
|
|
76
|
+
DropdownMenuGroup: () => DropdownMenuGroup,
|
|
77
|
+
DropdownMenuLabel: () => DropdownMenuLabel,
|
|
78
|
+
DropdownMenuPortal: () => DropdownMenuPortal,
|
|
79
|
+
DropdownMenuRadioGroup: () => DropdownMenuRadioGroup,
|
|
80
|
+
DropdownMenuRoot: () => DropdownMenuRoot,
|
|
81
|
+
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
82
|
+
EmptyState: () => EmptyState,
|
|
83
|
+
FAB: () => FAB,
|
|
84
|
+
Field: () => Field,
|
|
85
|
+
FileChip: () => FileChip,
|
|
86
|
+
HoverCard: () => HoverCard,
|
|
87
|
+
HoverCardContent: () => HoverCardContent,
|
|
88
|
+
HoverCardPortal: () => HoverCardPortal,
|
|
89
|
+
HoverCardRoot: () => HoverCardRoot,
|
|
90
|
+
HoverCardTrigger: () => HoverCardTrigger,
|
|
91
|
+
IconButton: () => IconButton,
|
|
92
|
+
Input: () => Input,
|
|
93
|
+
Kbd: () => Kbd,
|
|
94
|
+
MenuCheckboxItem: () => MenuCheckboxItem,
|
|
95
|
+
MenuItem: () => MenuItem,
|
|
96
|
+
MenuSeparator: () => MenuSeparator,
|
|
97
|
+
Menubar: () => Menubar,
|
|
98
|
+
MenubarContent: () => MenubarContent,
|
|
99
|
+
MenubarItem: () => MenubarItem,
|
|
100
|
+
MenubarMenu: () => MenubarMenu,
|
|
101
|
+
MenubarSeparator: () => MenubarSeparator,
|
|
102
|
+
MenubarTrigger: () => MenubarTrigger,
|
|
103
|
+
NavItem: () => NavItem,
|
|
104
|
+
NavSection: () => NavSection,
|
|
105
|
+
OTP: () => OTP,
|
|
106
|
+
Pagination: () => Pagination,
|
|
107
|
+
Popover: () => Popover,
|
|
108
|
+
PopoverAnchor: () => PopoverAnchor,
|
|
109
|
+
PopoverArrow: () => PopoverArrow,
|
|
110
|
+
PopoverClose: () => PopoverClose,
|
|
111
|
+
PopoverContent: () => PopoverContent,
|
|
112
|
+
PopoverPortal: () => PopoverPortal,
|
|
113
|
+
PopoverRoot: () => PopoverRoot,
|
|
114
|
+
PopoverTrigger: () => PopoverTrigger,
|
|
115
|
+
Progress: () => Progress,
|
|
116
|
+
RadialProgress: () => RadialProgress,
|
|
117
|
+
Radio: () => Radio,
|
|
118
|
+
RadioGroup: () => RadioGroup,
|
|
119
|
+
SearchInput: () => SearchInput,
|
|
120
|
+
Select: () => Select,
|
|
121
|
+
SelectContent: () => SelectContent,
|
|
122
|
+
SelectGroup: () => SelectGroup,
|
|
123
|
+
SelectItem: () => SelectItem,
|
|
124
|
+
SelectLabel: () => SelectLabel,
|
|
125
|
+
SelectRoot: () => SelectRoot,
|
|
126
|
+
SelectTrigger: () => SelectTrigger,
|
|
127
|
+
SelectValue: () => SelectValue,
|
|
128
|
+
Sheet: () => Sheet,
|
|
129
|
+
Sidebar: () => Sidebar,
|
|
130
|
+
Skeleton: () => Skeleton,
|
|
131
|
+
SkeletonGroup: () => SkeletonGroup,
|
|
132
|
+
Slider: () => Slider,
|
|
133
|
+
Sparkline: () => Sparkline,
|
|
134
|
+
Spinner: () => Spinner2,
|
|
135
|
+
SplitButton: () => SplitButton,
|
|
136
|
+
StatCard: () => StatCard,
|
|
137
|
+
StatusDot: () => StatusDot,
|
|
138
|
+
Stepper: () => Stepper,
|
|
139
|
+
Switch: () => Switch,
|
|
140
|
+
Tab: () => Tab,
|
|
141
|
+
Tabs: () => Tabs,
|
|
142
|
+
TabsContent: () => TabsContent,
|
|
143
|
+
TabsList: () => TabsList,
|
|
144
|
+
Tag: () => Tag,
|
|
145
|
+
Textarea: () => Textarea,
|
|
146
|
+
Timeline: () => Timeline,
|
|
147
|
+
TimelineItem: () => TimelineItem,
|
|
148
|
+
ToastCard: () => ToastCard,
|
|
149
|
+
ToastProvider: () => ToastProvider,
|
|
150
|
+
Tooltip: () => Tooltip,
|
|
151
|
+
TooltipArrow: () => TooltipArrow,
|
|
152
|
+
TooltipContent: () => TooltipContent,
|
|
153
|
+
TooltipPortal: () => TooltipPortal,
|
|
154
|
+
TooltipProvider: () => TooltipProvider,
|
|
155
|
+
TooltipRoot: () => TooltipRoot,
|
|
156
|
+
TooltipTrigger: () => TooltipTrigger,
|
|
157
|
+
Topbar: () => Topbar,
|
|
158
|
+
Tree: () => Tree,
|
|
159
|
+
badgeStyles: () => badgeStyles,
|
|
160
|
+
buttonStyles: () => buttonStyles,
|
|
161
|
+
cardStyles: () => cardStyles,
|
|
162
|
+
cn: () => cn,
|
|
163
|
+
filterCommandItems: () => filterCommandItems,
|
|
164
|
+
iconButtonStyles: () => iconButtonStyles,
|
|
165
|
+
useControllableState: () => useControllableState,
|
|
166
|
+
useDisclosure: () => useDisclosure,
|
|
167
|
+
useEscape: () => useEscape,
|
|
168
|
+
useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect,
|
|
169
|
+
useKeyboardList: () => useKeyboardList,
|
|
170
|
+
useOutsideClick: () => useOutsideClick,
|
|
171
|
+
useTheme: () => useTheme,
|
|
172
|
+
useToast: () => useToast
|
|
173
|
+
});
|
|
174
|
+
module.exports = __toCommonJS(index_exports);
|
|
60
175
|
|
|
61
176
|
// src/utils/cn.ts
|
|
177
|
+
var import_clsx = require("clsx");
|
|
178
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
62
179
|
function cn(...inputs) {
|
|
63
|
-
return
|
|
180
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
64
181
|
}
|
|
182
|
+
|
|
183
|
+
// src/hooks/useControllableState.ts
|
|
184
|
+
var import_react = require("react");
|
|
65
185
|
function useControllableState({
|
|
66
186
|
value: controlledValue,
|
|
67
187
|
defaultValue,
|
|
68
188
|
onChange
|
|
69
189
|
}) {
|
|
70
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
190
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react.useState)(defaultValue);
|
|
71
191
|
const isControlled = controlledValue !== void 0;
|
|
72
192
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
73
|
-
const onChangeRef =
|
|
193
|
+
const onChangeRef = (0, import_react.useRef)(onChange);
|
|
74
194
|
onChangeRef.current = onChange;
|
|
75
|
-
const valueRef =
|
|
195
|
+
const valueRef = (0, import_react.useRef)(value);
|
|
76
196
|
valueRef.current = value;
|
|
77
|
-
const setValue =
|
|
197
|
+
const setValue = (0, import_react.useCallback)(
|
|
78
198
|
(next) => {
|
|
79
199
|
const resolved = typeof next === "function" ? next(valueRef.current) : next;
|
|
80
200
|
if (!isControlled) {
|
|
@@ -88,31 +208,48 @@ function useControllableState({
|
|
|
88
208
|
);
|
|
89
209
|
return [value, setValue];
|
|
90
210
|
}
|
|
211
|
+
|
|
212
|
+
// src/hooks/useDisclosure.ts
|
|
213
|
+
var import_react2 = require("react");
|
|
91
214
|
function useDisclosure(initial = false) {
|
|
92
|
-
const [open, setOpen] =
|
|
93
|
-
const onOpen =
|
|
94
|
-
const onClose =
|
|
95
|
-
const onToggle =
|
|
215
|
+
const [open, setOpen] = (0, import_react2.useState)(initial);
|
|
216
|
+
const onOpen = (0, import_react2.useCallback)(() => setOpen(true), []);
|
|
217
|
+
const onClose = (0, import_react2.useCallback)(() => setOpen(false), []);
|
|
218
|
+
const onToggle = (0, import_react2.useCallback)(() => setOpen((o) => !o), []);
|
|
96
219
|
return { open, onOpen, onClose, onToggle, setOpen };
|
|
97
220
|
}
|
|
221
|
+
|
|
222
|
+
// src/hooks/useEscape.ts
|
|
223
|
+
var import_react3 = require("react");
|
|
98
224
|
function useEscape(handler, enabled = true) {
|
|
99
|
-
|
|
225
|
+
const handlerRef = (0, import_react3.useRef)(handler);
|
|
226
|
+
(0, import_react3.useEffect)(() => {
|
|
227
|
+
handlerRef.current = handler;
|
|
228
|
+
}, [handler]);
|
|
229
|
+
(0, import_react3.useEffect)(() => {
|
|
100
230
|
if (!enabled) return;
|
|
101
231
|
const onKey = (e) => {
|
|
102
|
-
if (e.key === "Escape")
|
|
232
|
+
if (e.key === "Escape") handlerRef.current();
|
|
103
233
|
};
|
|
104
|
-
|
|
105
|
-
return () =>
|
|
106
|
-
}, [
|
|
234
|
+
document.addEventListener("keydown", onKey);
|
|
235
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
236
|
+
}, [enabled]);
|
|
107
237
|
}
|
|
238
|
+
|
|
239
|
+
// src/hooks/useIsomorphicLayoutEffect.ts
|
|
240
|
+
var import_react4 = require("react");
|
|
241
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react4.useLayoutEffect : import_react4.useEffect;
|
|
242
|
+
|
|
243
|
+
// src/hooks/useKeyboardList.ts
|
|
244
|
+
var import_react5 = require("react");
|
|
108
245
|
function useKeyboardList({
|
|
109
246
|
count,
|
|
110
247
|
loop = true,
|
|
111
248
|
defaultCursor = 0,
|
|
112
249
|
onSelect
|
|
113
250
|
}) {
|
|
114
|
-
const [cursor, setCursor] =
|
|
115
|
-
const move =
|
|
251
|
+
const [cursor, setCursor] = (0, import_react5.useState)(defaultCursor);
|
|
252
|
+
const move = (0, import_react5.useCallback)(
|
|
116
253
|
(delta) => {
|
|
117
254
|
if (count <= 0) return;
|
|
118
255
|
setCursor((c) => {
|
|
@@ -123,7 +260,7 @@ function useKeyboardList({
|
|
|
123
260
|
},
|
|
124
261
|
[count, loop]
|
|
125
262
|
);
|
|
126
|
-
const onKeyDown =
|
|
263
|
+
const onKeyDown = (0, import_react5.useCallback)(
|
|
127
264
|
(event) => {
|
|
128
265
|
if (count <= 0) return;
|
|
129
266
|
switch (event.key) {
|
|
@@ -149,6 +286,8 @@ function useKeyboardList({
|
|
|
149
286
|
onSelect(cursor);
|
|
150
287
|
}
|
|
151
288
|
break;
|
|
289
|
+
default:
|
|
290
|
+
break;
|
|
152
291
|
}
|
|
153
292
|
},
|
|
154
293
|
[count, cursor, move, onSelect]
|
|
@@ -156,23 +295,30 @@ function useKeyboardList({
|
|
|
156
295
|
const safeCursor = count > 0 ? Math.min(cursor, count - 1) : 0;
|
|
157
296
|
return { cursor: safeCursor, setCursor, onKeyDown };
|
|
158
297
|
}
|
|
298
|
+
|
|
299
|
+
// src/hooks/useOutsideClick.ts
|
|
300
|
+
var import_react6 = require("react");
|
|
159
301
|
function useOutsideClick(ref, handler, enabled = true) {
|
|
160
|
-
|
|
302
|
+
(0, import_react6.useEffect)(() => {
|
|
161
303
|
if (!enabled) return;
|
|
162
304
|
const onDown = (e) => {
|
|
163
305
|
const el = ref.current;
|
|
164
306
|
if (el && e.target instanceof Node && !el.contains(e.target)) handler();
|
|
165
307
|
};
|
|
166
|
-
document.addEventListener("
|
|
167
|
-
return () => document.removeEventListener("
|
|
308
|
+
document.addEventListener("pointerdown", onDown);
|
|
309
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
168
310
|
}, [ref, handler, enabled]);
|
|
169
311
|
}
|
|
312
|
+
|
|
313
|
+
// src/hooks/useTheme.ts
|
|
314
|
+
var import_react7 = require("react");
|
|
170
315
|
function useTheme() {
|
|
171
|
-
const [theme, setThemeState] =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
316
|
+
const [theme, setThemeState] = (0, import_react7.useState)("dark");
|
|
317
|
+
const setTheme = (0, import_react7.useCallback)((next) => {
|
|
318
|
+
if (typeof document === "undefined") {
|
|
319
|
+
setThemeState(next);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
176
322
|
if (next === "light") {
|
|
177
323
|
document.documentElement.setAttribute("data-theme", "light");
|
|
178
324
|
} else {
|
|
@@ -180,10 +326,12 @@ function useTheme() {
|
|
|
180
326
|
}
|
|
181
327
|
setThemeState(next);
|
|
182
328
|
}, []);
|
|
183
|
-
const toggle =
|
|
329
|
+
const toggle = (0, import_react7.useCallback)(() => {
|
|
184
330
|
setTheme(theme === "dark" ? "light" : "dark");
|
|
185
331
|
}, [theme, setTheme]);
|
|
186
|
-
|
|
332
|
+
(0, import_react7.useEffect)(() => {
|
|
333
|
+
const initial = document.documentElement.getAttribute("data-theme");
|
|
334
|
+
setThemeState(initial === "light" ? "light" : "dark");
|
|
187
335
|
const observer = new MutationObserver(() => {
|
|
188
336
|
const attr = document.documentElement.getAttribute("data-theme");
|
|
189
337
|
setThemeState(attr === "light" ? "light" : "dark");
|
|
@@ -196,7 +344,13 @@ function useTheme() {
|
|
|
196
344
|
}, []);
|
|
197
345
|
return { theme, setTheme, toggle };
|
|
198
346
|
}
|
|
199
|
-
|
|
347
|
+
|
|
348
|
+
// src/components/Button/Button.tsx
|
|
349
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
350
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
351
|
+
var import_react8 = require("react");
|
|
352
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
353
|
+
var buttonStyles = (0, import_class_variance_authority.cva)(
|
|
200
354
|
[
|
|
201
355
|
"inline-flex items-center justify-center whitespace-nowrap",
|
|
202
356
|
"font-medium transition-[background,filter,box-shadow,color] duration-(--duration-micro)",
|
|
@@ -233,7 +387,7 @@ var buttonStyles = classVarianceAuthority.cva(
|
|
|
233
387
|
}
|
|
234
388
|
);
|
|
235
389
|
function Spinner({ size }) {
|
|
236
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
237
391
|
"span",
|
|
238
392
|
{
|
|
239
393
|
"aria-hidden": true,
|
|
@@ -243,7 +397,7 @@ function Spinner({ size }) {
|
|
|
243
397
|
);
|
|
244
398
|
}
|
|
245
399
|
var iconSize = { sm: 11, md: 12, lg: 13 };
|
|
246
|
-
var Button =
|
|
400
|
+
var Button = (0, import_react8.forwardRef)(function Button2({
|
|
247
401
|
variant,
|
|
248
402
|
size,
|
|
249
403
|
fullWidth,
|
|
@@ -261,8 +415,8 @@ var Button = react.forwardRef(function Button2({
|
|
|
261
415
|
const iconPx = iconSize[size ?? "md"];
|
|
262
416
|
const composedClassName = cn(buttonStyles({ variant, size, fullWidth }), className);
|
|
263
417
|
if (asChild) {
|
|
264
|
-
return /* @__PURE__ */
|
|
265
|
-
|
|
418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
419
|
+
import_react_slot.Slot,
|
|
266
420
|
{
|
|
267
421
|
ref,
|
|
268
422
|
"aria-busy": loading || void 0,
|
|
@@ -274,7 +428,7 @@ var Button = react.forwardRef(function Button2({
|
|
|
274
428
|
}
|
|
275
429
|
);
|
|
276
430
|
}
|
|
277
|
-
return /* @__PURE__ */
|
|
431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
278
432
|
"button",
|
|
279
433
|
{
|
|
280
434
|
ref,
|
|
@@ -284,15 +438,20 @@ var Button = react.forwardRef(function Button2({
|
|
|
284
438
|
className: composedClassName,
|
|
285
439
|
...props,
|
|
286
440
|
children: [
|
|
287
|
-
loading ? /* @__PURE__ */
|
|
441
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: iconPx }) : icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "inline-flex", children: icon }) : null,
|
|
288
442
|
children,
|
|
289
|
-
trailing && /* @__PURE__ */
|
|
443
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "inline-flex opacity-60", children: trailing })
|
|
290
444
|
]
|
|
291
445
|
}
|
|
292
446
|
);
|
|
293
447
|
});
|
|
294
448
|
Button.displayName = "Button";
|
|
295
|
-
|
|
449
|
+
|
|
450
|
+
// src/components/Button/IconButton.tsx
|
|
451
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
452
|
+
var import_react9 = require("react");
|
|
453
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
454
|
+
var iconButtonStyles = (0, import_class_variance_authority2.cva)(
|
|
296
455
|
[
|
|
297
456
|
"inline-grid place-items-center transition-[background,filter,color] duration-(--duration-micro)",
|
|
298
457
|
"outline-none focus-visible:ring-[3px] focus-visible:ring-accent-dim",
|
|
@@ -300,11 +459,16 @@ var iconButtonStyles = classVarianceAuthority.cva(
|
|
|
300
459
|
],
|
|
301
460
|
{
|
|
302
461
|
variants: {
|
|
462
|
+
// Mirrors `Button`'s variant set, minus `link` — an underlined link
|
|
463
|
+
// affordance is awkward for an icon-only target, so we omit it
|
|
464
|
+
// intentionally. Use `<Button variant="link" icon={…} />` if you need it.
|
|
303
465
|
variant: {
|
|
304
466
|
primary: "bg-accent text-on-accent border border-accent hover:brightness-110",
|
|
305
467
|
secondary: "bg-panel-2 text-text-muted border border-border hover:bg-[color-mix(in_oklab,var(--color-panel-2),white_4%)]",
|
|
306
468
|
ghost: "bg-transparent text-text-muted border border-transparent hover:bg-panel-2 hover:text-text",
|
|
307
|
-
outline: "bg-transparent text-text-muted border border-border-strong hover:bg-panel-2 hover:text-text"
|
|
469
|
+
outline: "bg-transparent text-text-muted border border-border-strong hover:bg-panel-2 hover:text-text",
|
|
470
|
+
destructive: "bg-err text-on-accent border border-err hover:brightness-110 active:brightness-95",
|
|
471
|
+
success: "bg-ok text-on-accent border border-ok hover:brightness-110 active:brightness-95"
|
|
308
472
|
},
|
|
309
473
|
size: {
|
|
310
474
|
sm: "h-[26px] w-[26px] text-[12px] rounded-[5px]",
|
|
@@ -315,8 +479,8 @@ var iconButtonStyles = classVarianceAuthority.cva(
|
|
|
315
479
|
defaultVariants: { variant: "secondary", size: "md" }
|
|
316
480
|
}
|
|
317
481
|
);
|
|
318
|
-
var IconButton =
|
|
319
|
-
return /* @__PURE__ */
|
|
482
|
+
var IconButton = (0, import_react9.forwardRef)(function IconButton2({ variant, size, icon, type, className, ...props }, ref) {
|
|
483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
320
484
|
"button",
|
|
321
485
|
{
|
|
322
486
|
ref,
|
|
@@ -328,9 +492,13 @@ var IconButton = react.forwardRef(function IconButton2({ variant, size, icon, ty
|
|
|
328
492
|
);
|
|
329
493
|
});
|
|
330
494
|
IconButton.displayName = "IconButton";
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
495
|
+
|
|
496
|
+
// src/components/Button/ButtonGroup.tsx
|
|
497
|
+
var import_react10 = require("react");
|
|
498
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
499
|
+
var ButtonGroup = (0, import_react10.forwardRef)(function ButtonGroup2({ orientation = "horizontal", className, children, ...props }, ref) {
|
|
500
|
+
const items = import_react10.Children.toArray(children).filter(import_react10.isValidElement);
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
334
502
|
"div",
|
|
335
503
|
{
|
|
336
504
|
ref,
|
|
@@ -344,7 +512,7 @@ var ButtonGroup = react.forwardRef(function ButtonGroup2({ orientation = "horizo
|
|
|
344
512
|
children: items.map((child, i) => {
|
|
345
513
|
const isFirst = i === 0;
|
|
346
514
|
const childProps = child.props ?? {};
|
|
347
|
-
return
|
|
515
|
+
return (0, import_react10.cloneElement)(child, {
|
|
348
516
|
key: i,
|
|
349
517
|
className: cn(
|
|
350
518
|
childProps.className,
|
|
@@ -357,27 +525,42 @@ var ButtonGroup = react.forwardRef(function ButtonGroup2({ orientation = "horizo
|
|
|
357
525
|
);
|
|
358
526
|
});
|
|
359
527
|
ButtonGroup.displayName = "ButtonGroup";
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
528
|
+
|
|
529
|
+
// src/components/Button/SplitButton.tsx
|
|
530
|
+
var import_react11 = require("react");
|
|
531
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
532
|
+
var SplitButton = (0, import_react11.forwardRef)(function SplitButton2({
|
|
533
|
+
variant = "primary",
|
|
534
|
+
size = "md",
|
|
535
|
+
onClick,
|
|
536
|
+
onMenu,
|
|
537
|
+
disabled,
|
|
538
|
+
menuAriaLabel = "More actions",
|
|
539
|
+
className,
|
|
540
|
+
children,
|
|
541
|
+
...props
|
|
542
|
+
}, ref) {
|
|
543
|
+
const dividerBorder = variant === "primary" || variant === "destructive" || variant === "success" ? "border-r-on-accent/20" : "border-r-border-strong";
|
|
544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref, className: cn("inline-flex", className), ...props, children: [
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
363
546
|
Button,
|
|
364
547
|
{
|
|
365
548
|
variant,
|
|
366
549
|
size,
|
|
367
550
|
onClick,
|
|
368
551
|
disabled,
|
|
369
|
-
className: "rounded-r-none border-r
|
|
552
|
+
className: cn("rounded-r-none border-r", dividerBorder),
|
|
370
553
|
children
|
|
371
554
|
}
|
|
372
555
|
),
|
|
373
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
374
557
|
Button,
|
|
375
558
|
{
|
|
376
559
|
variant,
|
|
377
560
|
size,
|
|
378
561
|
onClick: onMenu,
|
|
379
562
|
disabled,
|
|
380
|
-
"aria-label":
|
|
563
|
+
"aria-label": menuAriaLabel,
|
|
381
564
|
className: "rounded-l-none px-2",
|
|
382
565
|
children: "\u25BE"
|
|
383
566
|
}
|
|
@@ -385,8 +568,12 @@ var SplitButton = react.forwardRef(function SplitButton2({ variant = "primary",
|
|
|
385
568
|
] });
|
|
386
569
|
});
|
|
387
570
|
SplitButton.displayName = "SplitButton";
|
|
388
|
-
|
|
389
|
-
|
|
571
|
+
|
|
572
|
+
// src/components/Button/FAB.tsx
|
|
573
|
+
var import_react12 = require("react");
|
|
574
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
575
|
+
var FAB = (0, import_react12.forwardRef)(function FAB2({ icon = "\u2726", type, className, style, ...props }, ref) {
|
|
576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
390
577
|
"button",
|
|
391
578
|
{
|
|
392
579
|
ref,
|
|
@@ -408,10 +595,15 @@ var FAB = react.forwardRef(function FAB2({ icon = "\u2726", type, className, sty
|
|
|
408
595
|
);
|
|
409
596
|
});
|
|
410
597
|
FAB.displayName = "FAB";
|
|
411
|
-
|
|
412
|
-
|
|
598
|
+
|
|
599
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
600
|
+
var RadixCheckbox = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
601
|
+
var import_react13 = require("react");
|
|
602
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
603
|
+
var Checkbox = (0, import_react13.forwardRef)(function Checkbox2({ label, className, id: idProp, ...props }, ref) {
|
|
604
|
+
const reactId = (0, import_react13.useId)();
|
|
413
605
|
const id = idProp ?? `cb-${reactId}`;
|
|
414
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
415
607
|
"span",
|
|
416
608
|
{
|
|
417
609
|
className: cn(
|
|
@@ -420,8 +612,8 @@ var Checkbox = react.forwardRef(function Checkbox2({ label, className, id: idPro
|
|
|
420
612
|
className
|
|
421
613
|
),
|
|
422
614
|
children: [
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
616
|
+
RadixCheckbox.Root,
|
|
425
617
|
{
|
|
426
618
|
ref,
|
|
427
619
|
id,
|
|
@@ -434,36 +626,45 @@ var Checkbox = react.forwardRef(function Checkbox2({ label, className, id: idPro
|
|
|
434
626
|
"focus-visible:ring-accent-dim outline-none focus-visible:ring-[3px]"
|
|
435
627
|
),
|
|
436
628
|
...props,
|
|
437
|
-
children: /* @__PURE__ */
|
|
629
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadixCheckbox.Indicator, { className: "text-on-accent text-[11px] leading-none", children: props.checked === "indeterminate" ? "\u2212" : "\u2713" })
|
|
438
630
|
}
|
|
439
631
|
),
|
|
440
|
-
label && /* @__PURE__ */
|
|
632
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: "cursor-pointer text-[13px]", children: label })
|
|
441
633
|
]
|
|
442
634
|
}
|
|
443
635
|
);
|
|
444
636
|
});
|
|
445
637
|
Checkbox.displayName = "Checkbox";
|
|
638
|
+
|
|
639
|
+
// src/components/Field/Field.tsx
|
|
640
|
+
var import_react14 = require("react");
|
|
641
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
446
642
|
function Field({ label, hint, error, required, className, children, ...props }) {
|
|
447
|
-
const reactId =
|
|
643
|
+
const reactId = (0, import_react14.useId)();
|
|
448
644
|
const id = `field-${reactId}`;
|
|
449
645
|
const hintId = hint && !error ? `${id}-hint` : void 0;
|
|
450
646
|
const errorId = error ? `${id}-error` : void 0;
|
|
451
647
|
const describedBy = errorId ?? hintId;
|
|
452
|
-
return /* @__PURE__ */
|
|
453
|
-
label && /* @__PURE__ */
|
|
648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("flex flex-col gap-[6px]", className), ...props, children: [
|
|
649
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { htmlFor: id, className: "text-text-muted text-[11px] font-medium", children: [
|
|
454
650
|
label,
|
|
455
|
-
required && /* @__PURE__ */
|
|
651
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-err ml-1", children: "*" })
|
|
456
652
|
] }),
|
|
457
653
|
children({
|
|
458
654
|
id,
|
|
459
655
|
"aria-describedby": describedBy,
|
|
460
656
|
"aria-invalid": error ? true : void 0
|
|
461
657
|
}),
|
|
462
|
-
hint && !error && /* @__PURE__ */
|
|
463
|
-
error && /* @__PURE__ */
|
|
658
|
+
hint && !error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { id: hintId, className: "text-text-dim text-[11px]", children: hint }),
|
|
659
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { id: errorId, className: "text-err text-[11px]", children: error })
|
|
464
660
|
] });
|
|
465
661
|
}
|
|
466
|
-
|
|
662
|
+
|
|
663
|
+
// src/components/Input/Input.tsx
|
|
664
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
665
|
+
var import_react15 = require("react");
|
|
666
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
667
|
+
var inputWrapperStyles = (0, import_class_variance_authority3.cva)(
|
|
467
668
|
[
|
|
468
669
|
"flex items-center gap-[6px] font-sans transition-[border-color,box-shadow] duration-(--duration-micro)",
|
|
469
670
|
"border focus-within:ring-[3px]",
|
|
@@ -478,22 +679,22 @@ var inputWrapperStyles = classVarianceAuthority.cva(
|
|
|
478
679
|
},
|
|
479
680
|
tone: {
|
|
480
681
|
default: "bg-panel border-border focus-within:border-accent focus-within:ring-accent-dim",
|
|
481
|
-
|
|
682
|
+
err: "bg-panel border-err focus-within:border-err focus-within:ring-err/30"
|
|
482
683
|
}
|
|
483
684
|
},
|
|
484
685
|
defaultVariants: { size: "md", tone: "default" }
|
|
485
686
|
}
|
|
486
687
|
);
|
|
487
|
-
var Input =
|
|
488
|
-
const computedTone = error ? "
|
|
489
|
-
return /* @__PURE__ */
|
|
688
|
+
var Input = (0, import_react15.forwardRef)(function Input2({ size, tone, icon, trailing, error, width, className, style, disabled, ...props }, ref) {
|
|
689
|
+
const computedTone = error ? "err" : tone;
|
|
690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
490
691
|
"div",
|
|
491
692
|
{
|
|
492
693
|
className: cn(inputWrapperStyles({ size, tone: computedTone }), className),
|
|
493
694
|
style: { width, ...style },
|
|
494
695
|
children: [
|
|
495
|
-
icon && /* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
696
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-text-dim leading-none", children: icon }),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
497
698
|
"input",
|
|
498
699
|
{
|
|
499
700
|
ref,
|
|
@@ -507,14 +708,26 @@ var Input = react.forwardRef(function Input2({ size, tone, icon, trailing, error
|
|
|
507
708
|
...props
|
|
508
709
|
}
|
|
509
710
|
),
|
|
510
|
-
trailing && /* @__PURE__ */
|
|
711
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-text-dim text-[11px]", children: trailing })
|
|
511
712
|
]
|
|
512
713
|
}
|
|
513
714
|
);
|
|
514
715
|
});
|
|
515
716
|
Input.displayName = "Input";
|
|
516
|
-
|
|
517
|
-
|
|
717
|
+
|
|
718
|
+
// src/components/Input/SearchInput.tsx
|
|
719
|
+
var import_react16 = require("react");
|
|
720
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
721
|
+
var SearchInput = (0, import_react16.forwardRef)(function SearchInput2({
|
|
722
|
+
shortcut = "\u2318K",
|
|
723
|
+
width = 360,
|
|
724
|
+
className,
|
|
725
|
+
style,
|
|
726
|
+
placeholder = "Search\u2026",
|
|
727
|
+
"aria-label": ariaLabel,
|
|
728
|
+
...props
|
|
729
|
+
}, ref) {
|
|
730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
518
731
|
"div",
|
|
519
732
|
{
|
|
520
733
|
className: cn(
|
|
@@ -526,46 +739,57 @@ var SearchInput = react.forwardRef(function SearchInput2({ shortcut = "\u2318K",
|
|
|
526
739
|
),
|
|
527
740
|
style: { width, ...style },
|
|
528
741
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-text-dim leading-none", "aria-hidden": true, children: "\u2315" }),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
531
744
|
"input",
|
|
532
745
|
{
|
|
533
746
|
ref,
|
|
534
747
|
type: "search",
|
|
535
748
|
placeholder,
|
|
749
|
+
"aria-label": ariaLabel ?? (typeof placeholder === "string" ? placeholder : "Search"),
|
|
536
750
|
className: "text-text placeholder:text-text-dim min-w-0 flex-1 border-none bg-transparent text-[13px] outline-none",
|
|
537
751
|
...props
|
|
538
752
|
}
|
|
539
753
|
),
|
|
540
|
-
shortcut && /* @__PURE__ */
|
|
754
|
+
shortcut && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("kbd", { className: "text-text-dim border-border rounded-xs border px-[6px] py-[2px] font-mono text-[10px]", children: shortcut })
|
|
541
755
|
]
|
|
542
756
|
}
|
|
543
757
|
);
|
|
544
758
|
});
|
|
545
759
|
SearchInput.displayName = "SearchInput";
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
760
|
+
|
|
761
|
+
// src/components/OTP/OTP.tsx
|
|
762
|
+
var import_react17 = require("react");
|
|
763
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
764
|
+
var OTP = (0, import_react17.forwardRef)(function OTP2({ length = 6, onComplete, onChange, defaultValue = "", ariaLabel = "Code", className, disabled }, ref) {
|
|
765
|
+
const baseId = (0, import_react17.useId)();
|
|
766
|
+
const refs = (0, import_react17.useRef)([]);
|
|
767
|
+
const [values, setValues] = (0, import_react17.useState)(
|
|
550
768
|
() => Array.from({ length }, (_, i) => defaultValue[i] ?? "")
|
|
551
769
|
);
|
|
552
|
-
|
|
770
|
+
const [completedAnnouncement, setCompletedAnnouncement] = (0, import_react17.useState)("");
|
|
771
|
+
(0, import_react17.useImperativeHandle)(ref, () => ({
|
|
553
772
|
focus: () => refs.current[0]?.focus(),
|
|
554
773
|
reset: () => {
|
|
555
774
|
setValues(Array(length).fill(""));
|
|
775
|
+
setCompletedAnnouncement("");
|
|
556
776
|
refs.current[0]?.focus();
|
|
557
777
|
}
|
|
558
778
|
}));
|
|
559
779
|
const writeAt = (i, char) => {
|
|
560
780
|
if (!/^\d?$/.test(char)) return;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
781
|
+
const next = [...values];
|
|
782
|
+
next[i] = char;
|
|
783
|
+
setValues(next);
|
|
784
|
+
const joined = next.join("");
|
|
785
|
+
onChange?.(joined);
|
|
786
|
+
const isComplete = joined.length === length && next.every((c) => c);
|
|
787
|
+
if (isComplete) {
|
|
788
|
+
onComplete?.(joined);
|
|
789
|
+
setCompletedAnnouncement("Code complete");
|
|
790
|
+
} else {
|
|
791
|
+
setCompletedAnnouncement("");
|
|
792
|
+
}
|
|
569
793
|
if (char && i < length - 1) refs.current[i + 1]?.focus();
|
|
570
794
|
};
|
|
571
795
|
const onKey = (i, e) => {
|
|
@@ -585,45 +809,59 @@ var OTP = react.forwardRef(function OTP2({ length = 6, onComplete, onChange, def
|
|
|
585
809
|
setValues(next);
|
|
586
810
|
const joined = next.join("");
|
|
587
811
|
onChange?.(joined);
|
|
588
|
-
|
|
812
|
+
const isComplete = joined.length === length && next.every((c) => c);
|
|
813
|
+
if (isComplete) {
|
|
814
|
+
onComplete?.(joined);
|
|
815
|
+
setCompletedAnnouncement("Code complete");
|
|
816
|
+
} else {
|
|
817
|
+
setCompletedAnnouncement("");
|
|
818
|
+
}
|
|
589
819
|
refs.current[Math.min(pasted.length, length - 1)]?.focus();
|
|
590
820
|
};
|
|
591
|
-
return /* @__PURE__ */
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: cn("flex gap-2", className), children: [
|
|
822
|
+
values.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
823
|
+
"input",
|
|
824
|
+
{
|
|
825
|
+
id: `${baseId}-${i}`,
|
|
826
|
+
ref: (el) => {
|
|
827
|
+
refs.current[i] = el;
|
|
828
|
+
},
|
|
829
|
+
inputMode: "numeric",
|
|
830
|
+
autoComplete: "one-time-code",
|
|
831
|
+
maxLength: 1,
|
|
832
|
+
value: c,
|
|
833
|
+
disabled,
|
|
834
|
+
"aria-label": `${ariaLabel} ${i + 1} of ${length}`,
|
|
835
|
+
onChange: (e) => writeAt(i, e.target.value),
|
|
836
|
+
onKeyDown: (e) => onKey(i, e),
|
|
837
|
+
onFocus: (e) => e.target.select(),
|
|
838
|
+
onPaste: i === 0 ? onPaste : void 0,
|
|
839
|
+
className: cn(
|
|
840
|
+
"text-text bg-panel h-12 w-10 rounded-md text-center font-mono text-[20px] font-medium",
|
|
841
|
+
"border-border border transition-[border-color,box-shadow] duration-(--duration-micro) outline-none",
|
|
842
|
+
"focus:border-accent focus:ring-accent-dim focus:ring-[3px]",
|
|
843
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
844
|
+
)
|
|
597
845
|
},
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
disabled,
|
|
603
|
-
"aria-label": `${ariaLabel} ${i + 1} of ${length}`,
|
|
604
|
-
onChange: (e) => writeAt(i, e.target.value),
|
|
605
|
-
onKeyDown: (e) => onKey(i, e),
|
|
606
|
-
onFocus: (e) => e.target.select(),
|
|
607
|
-
onPaste: i === 0 ? onPaste : void 0,
|
|
608
|
-
className: cn(
|
|
609
|
-
"text-text bg-panel h-12 w-10 rounded-md text-center font-mono text-[20px] font-medium",
|
|
610
|
-
"border-border border transition-[border-color,box-shadow] duration-(--duration-micro) outline-none",
|
|
611
|
-
"focus:border-accent focus:ring-accent-dim focus:ring-[3px]",
|
|
612
|
-
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
613
|
-
)
|
|
614
|
-
},
|
|
615
|
-
i
|
|
616
|
-
)) });
|
|
846
|
+
i
|
|
847
|
+
)),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true", children: completedAnnouncement })
|
|
849
|
+
] });
|
|
617
850
|
});
|
|
618
851
|
OTP.displayName = "OTP";
|
|
619
|
-
|
|
620
|
-
|
|
852
|
+
|
|
853
|
+
// src/components/Radio/Radio.tsx
|
|
854
|
+
var RadixRadio = __toESM(require("@radix-ui/react-radio-group"), 1);
|
|
855
|
+
var import_react18 = require("react");
|
|
856
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
857
|
+
var RadioGroup = (0, import_react18.forwardRef)(function RadioGroup2({ className, ...props }, ref) {
|
|
858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RadixRadio.Root, { ref, className: cn("flex flex-col gap-2", className), ...props });
|
|
621
859
|
});
|
|
622
860
|
RadioGroup.displayName = "RadioGroup";
|
|
623
|
-
var Radio =
|
|
624
|
-
const reactId =
|
|
861
|
+
var Radio = (0, import_react18.forwardRef)(function Radio2({ label, className, id: idProp, ...props }, ref) {
|
|
862
|
+
const reactId = (0, import_react18.useId)();
|
|
625
863
|
const id = idProp ?? `radio-${reactId}`;
|
|
626
|
-
return /* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
627
865
|
"span",
|
|
628
866
|
{
|
|
629
867
|
className: cn(
|
|
@@ -632,8 +870,8 @@ var Radio = react.forwardRef(function Radio2({ label, className, id: idProp, ...
|
|
|
632
870
|
className
|
|
633
871
|
),
|
|
634
872
|
children: [
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
874
|
+
RadixRadio.Item,
|
|
637
875
|
{
|
|
638
876
|
ref,
|
|
639
877
|
id,
|
|
@@ -645,27 +883,32 @@ var Radio = react.forwardRef(function Radio2({ label, className, id: idProp, ...
|
|
|
645
883
|
"focus-visible:ring-accent-dim outline-none focus-visible:ring-[3px]"
|
|
646
884
|
),
|
|
647
885
|
...props,
|
|
648
|
-
children: /* @__PURE__ */
|
|
886
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RadixRadio.Indicator, { className: "bg-accent block h-[7px] w-[7px] rounded-full" })
|
|
649
887
|
}
|
|
650
888
|
),
|
|
651
|
-
label && /* @__PURE__ */
|
|
889
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: id, className: "cursor-pointer text-[13px]", children: label })
|
|
652
890
|
]
|
|
653
891
|
}
|
|
654
892
|
);
|
|
655
893
|
});
|
|
656
894
|
Radio.displayName = "Radio";
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
var
|
|
660
|
-
var
|
|
895
|
+
|
|
896
|
+
// src/components/Select/Select.tsx
|
|
897
|
+
var RadixSelect = __toESM(require("@radix-ui/react-select"), 1);
|
|
898
|
+
var import_react19 = require("react");
|
|
899
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
900
|
+
var SelectRoot = RadixSelect.Root;
|
|
901
|
+
var SelectValue = RadixSelect.Value;
|
|
902
|
+
var SelectGroup = RadixSelect.Group;
|
|
903
|
+
var SelectLabel = RadixSelect.Label;
|
|
661
904
|
var triggerClasses = {
|
|
662
905
|
sm: "h-7 px-2 text-[12px]",
|
|
663
906
|
md: "h-[34px] px-[10px] text-[13px]",
|
|
664
907
|
lg: "h-10 px-3 text-[14px]"
|
|
665
908
|
};
|
|
666
|
-
var SelectTrigger =
|
|
667
|
-
return /* @__PURE__ */
|
|
668
|
-
|
|
909
|
+
var SelectTrigger = (0, import_react19.forwardRef)(function SelectTrigger2({ size = "md", className, children, ...props }, ref) {
|
|
910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
911
|
+
RadixSelect.Trigger,
|
|
669
912
|
{
|
|
670
913
|
ref,
|
|
671
914
|
className: cn(
|
|
@@ -680,36 +923,36 @@ var SelectTrigger = react.forwardRef(function SelectTrigger2({ size = "md", clas
|
|
|
680
923
|
...props,
|
|
681
924
|
children: [
|
|
682
925
|
children,
|
|
683
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixSelect.Icon, { className: "text-text-dim text-[11px] leading-none", children: "\u25BE" })
|
|
684
927
|
]
|
|
685
928
|
}
|
|
686
929
|
);
|
|
687
930
|
});
|
|
688
931
|
SelectTrigger.displayName = "SelectTrigger";
|
|
689
|
-
var SelectContent =
|
|
932
|
+
var SelectContent = (0, import_react19.forwardRef)(
|
|
690
933
|
function SelectContent2({ className, children, position = "popper", sideOffset = 6, ...props }, ref) {
|
|
691
|
-
return /* @__PURE__ */
|
|
692
|
-
|
|
934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixSelect.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
935
|
+
RadixSelect.Content,
|
|
693
936
|
{
|
|
694
937
|
ref,
|
|
695
938
|
position,
|
|
696
939
|
sideOffset,
|
|
697
940
|
className: cn(
|
|
698
|
-
"bg-panel border-border z-
|
|
941
|
+
"bg-panel border-border z-popover min-w-[var(--radix-select-trigger-width)] rounded-md border p-1 shadow",
|
|
699
942
|
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
700
943
|
className
|
|
701
944
|
),
|
|
702
945
|
...props,
|
|
703
|
-
children: /* @__PURE__ */
|
|
946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixSelect.Viewport, { children })
|
|
704
947
|
}
|
|
705
948
|
) });
|
|
706
949
|
}
|
|
707
950
|
);
|
|
708
951
|
SelectContent.displayName = "SelectContent";
|
|
709
|
-
var SelectItem =
|
|
952
|
+
var SelectItem = (0, import_react19.forwardRef)(
|
|
710
953
|
function SelectItem2({ className, children, ...props }, ref) {
|
|
711
|
-
return /* @__PURE__ */
|
|
712
|
-
|
|
954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
955
|
+
RadixSelect.Item,
|
|
713
956
|
{
|
|
714
957
|
ref,
|
|
715
958
|
className: cn(
|
|
@@ -720,7 +963,7 @@ var SelectItem = react.forwardRef(
|
|
|
720
963
|
className
|
|
721
964
|
),
|
|
722
965
|
...props,
|
|
723
|
-
children: /* @__PURE__ */
|
|
966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadixSelect.ItemText, { children })
|
|
724
967
|
}
|
|
725
968
|
);
|
|
726
969
|
}
|
|
@@ -735,64 +978,91 @@ function Select({
|
|
|
735
978
|
"aria-labelledby": ariaLabelledBy,
|
|
736
979
|
...rootProps
|
|
737
980
|
}) {
|
|
738
|
-
return /* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(RadixSelect.Root, { ...rootProps, children: [
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
740
983
|
SelectTrigger,
|
|
741
984
|
{
|
|
742
985
|
size,
|
|
743
986
|
className,
|
|
744
987
|
"aria-label": ariaLabel,
|
|
745
988
|
"aria-labelledby": ariaLabelledBy,
|
|
746
|
-
children: /* @__PURE__ */
|
|
989
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectValue, { placeholder })
|
|
747
990
|
}
|
|
748
991
|
),
|
|
749
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectContent, { children: options.map((opt) => {
|
|
750
993
|
const value = typeof opt === "string" ? opt : opt.value;
|
|
751
994
|
const label = typeof opt === "string" ? opt : opt.label;
|
|
752
|
-
return /* @__PURE__ */
|
|
995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SelectItem, { value, children: label }, value);
|
|
753
996
|
}) })
|
|
754
997
|
] });
|
|
755
998
|
}
|
|
756
|
-
|
|
999
|
+
|
|
1000
|
+
// src/components/Slider/Slider.tsx
|
|
1001
|
+
var RadixSlider = __toESM(require("@radix-ui/react-slider"), 1);
|
|
1002
|
+
var import_react20 = require("react");
|
|
1003
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1004
|
+
var Slider = (0, import_react20.forwardRef)(function Slider2({
|
|
1005
|
+
showValue,
|
|
1006
|
+
width = 240,
|
|
1007
|
+
className,
|
|
1008
|
+
value,
|
|
1009
|
+
defaultValue,
|
|
1010
|
+
thumbLabels,
|
|
1011
|
+
"aria-label": ariaLabel,
|
|
1012
|
+
"aria-labelledby": ariaLabelledBy,
|
|
1013
|
+
...props
|
|
1014
|
+
}, ref) {
|
|
757
1015
|
const arrValue = Array.isArray(value) ? value : value !== void 0 ? [value] : void 0;
|
|
758
1016
|
const arrDefault = Array.isArray(defaultValue) ? defaultValue : defaultValue !== void 0 ? [defaultValue] : void 0;
|
|
759
1017
|
const display = arrValue?.[0] ?? arrDefault?.[0] ?? props.min ?? 0;
|
|
760
|
-
|
|
1018
|
+
const thumbCount = (arrValue ?? arrDefault)?.length ?? 1;
|
|
1019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
761
1020
|
"span",
|
|
762
1021
|
{
|
|
763
1022
|
ref,
|
|
764
1023
|
className: cn("inline-flex items-center gap-[10px]", className),
|
|
765
1024
|
style: { width },
|
|
766
1025
|
children: [
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1027
|
+
RadixSlider.Root,
|
|
769
1028
|
{
|
|
770
1029
|
value: arrValue,
|
|
771
1030
|
defaultValue: arrDefault,
|
|
772
1031
|
className: "relative flex h-4 flex-1 touch-none items-center select-none",
|
|
773
1032
|
...props,
|
|
774
1033
|
children: [
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1034
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixSlider.Track, { className: "bg-panel-2 relative h-1 grow rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadixSlider.Range, { className: "bg-accent absolute h-full rounded-full" }) }),
|
|
1035
|
+
Array.from({ length: thumbCount }, (_, i) => {
|
|
1036
|
+
const perThumb = thumbLabels?.[i];
|
|
1037
|
+
const thumbAriaLabel = perThumb ?? (ariaLabelledBy ? void 0 : ariaLabel ?? "Value");
|
|
1038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1039
|
+
RadixSlider.Thumb,
|
|
1040
|
+
{
|
|
1041
|
+
className: cn(
|
|
1042
|
+
"bg-text border-accent block h-[14px] w-[14px] rounded-full border-2 shadow",
|
|
1043
|
+
"focus-visible:ring-accent-dim outline-none focus-visible:ring-[3px]",
|
|
1044
|
+
"cursor-grab active:cursor-grabbing"
|
|
1045
|
+
),
|
|
1046
|
+
"aria-label": thumbAriaLabel,
|
|
1047
|
+
"aria-labelledby": perThumb ? void 0 : ariaLabelledBy
|
|
1048
|
+
},
|
|
1049
|
+
i
|
|
1050
|
+
);
|
|
1051
|
+
})
|
|
787
1052
|
]
|
|
788
1053
|
}
|
|
789
1054
|
),
|
|
790
|
-
showValue && /* @__PURE__ */
|
|
1055
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-text-muted min-w-[28px] text-right font-mono text-[11px]", children: display })
|
|
791
1056
|
]
|
|
792
1057
|
}
|
|
793
1058
|
);
|
|
794
1059
|
});
|
|
795
1060
|
Slider.displayName = "Slider";
|
|
1061
|
+
|
|
1062
|
+
// src/components/Switch/Switch.tsx
|
|
1063
|
+
var RadixSwitch = __toESM(require("@radix-ui/react-switch"), 1);
|
|
1064
|
+
var import_react21 = require("react");
|
|
1065
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
796
1066
|
var trackClasses = {
|
|
797
1067
|
sm: "h-4 w-7",
|
|
798
1068
|
md: "h-5 w-9"
|
|
@@ -801,10 +1071,10 @@ var thumbClasses = {
|
|
|
801
1071
|
sm: "h-3 w-3 data-[state=checked]:translate-x-3",
|
|
802
1072
|
md: "h-4 w-4 data-[state=checked]:translate-x-4"
|
|
803
1073
|
};
|
|
804
|
-
var Switch =
|
|
805
|
-
const reactId =
|
|
1074
|
+
var Switch = (0, import_react21.forwardRef)(function Switch2({ label, size = "md", className, id: idProp, ...props }, ref) {
|
|
1075
|
+
const reactId = (0, import_react21.useId)();
|
|
806
1076
|
const id = idProp ?? `sw-${reactId}`;
|
|
807
|
-
return /* @__PURE__ */
|
|
1077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
808
1078
|
"span",
|
|
809
1079
|
{
|
|
810
1080
|
className: cn(
|
|
@@ -813,8 +1083,8 @@ var Switch = react.forwardRef(function Switch2({ label, size = "md", className,
|
|
|
813
1083
|
className
|
|
814
1084
|
),
|
|
815
1085
|
children: [
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1087
|
+
RadixSwitch.Root,
|
|
818
1088
|
{
|
|
819
1089
|
ref,
|
|
820
1090
|
id,
|
|
@@ -826,8 +1096,8 @@ var Switch = react.forwardRef(function Switch2({ label, size = "md", className,
|
|
|
826
1096
|
trackClasses[size]
|
|
827
1097
|
),
|
|
828
1098
|
...props,
|
|
829
|
-
children: /* @__PURE__ */
|
|
830
|
-
|
|
1099
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1100
|
+
RadixSwitch.Thumb,
|
|
831
1101
|
{
|
|
832
1102
|
className: cn(
|
|
833
1103
|
"bg-text absolute top-1/2 left-[1px] -translate-y-1/2 rounded-full shadow-sm",
|
|
@@ -838,13 +1108,18 @@ var Switch = react.forwardRef(function Switch2({ label, size = "md", className,
|
|
|
838
1108
|
)
|
|
839
1109
|
}
|
|
840
1110
|
),
|
|
841
|
-
label && /* @__PURE__ */
|
|
1111
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: id, className: "cursor-pointer text-[13px]", children: label })
|
|
842
1112
|
]
|
|
843
1113
|
}
|
|
844
1114
|
);
|
|
845
1115
|
});
|
|
846
1116
|
Switch.displayName = "Switch";
|
|
847
|
-
|
|
1117
|
+
|
|
1118
|
+
// src/components/Textarea/Textarea.tsx
|
|
1119
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
1120
|
+
var import_react22 = require("react");
|
|
1121
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1122
|
+
var textareaStyles = (0, import_class_variance_authority4.cva)(
|
|
848
1123
|
[
|
|
849
1124
|
"w-full font-sans text-text bg-panel rounded-md p-[10px]",
|
|
850
1125
|
"border outline-none transition-[border-color,box-shadow] duration-(--duration-micro)",
|
|
@@ -856,26 +1131,97 @@ var textareaStyles = classVarianceAuthority.cva(
|
|
|
856
1131
|
variants: {
|
|
857
1132
|
tone: {
|
|
858
1133
|
default: "border-border focus-visible:border-accent focus-visible:ring-accent-dim",
|
|
859
|
-
|
|
1134
|
+
err: "border-err focus-visible:border-err focus-visible:ring-err/30"
|
|
860
1135
|
}
|
|
861
1136
|
},
|
|
862
1137
|
defaultVariants: { tone: "default" }
|
|
863
1138
|
}
|
|
864
1139
|
);
|
|
865
|
-
var Textarea =
|
|
866
|
-
return /* @__PURE__ */
|
|
1140
|
+
var Textarea = (0, import_react22.forwardRef)(function Textarea2({ tone, error, rows = 4, className, ...props }, ref) {
|
|
1141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
867
1142
|
"textarea",
|
|
868
1143
|
{
|
|
869
1144
|
ref,
|
|
870
1145
|
rows,
|
|
871
1146
|
"aria-invalid": error || void 0,
|
|
872
|
-
className: cn(textareaStyles({ tone: error ? "
|
|
1147
|
+
className: cn(textareaStyles({ tone: error ? "err" : tone }), className),
|
|
873
1148
|
...props
|
|
874
1149
|
}
|
|
875
1150
|
);
|
|
876
1151
|
});
|
|
877
1152
|
Textarea.displayName = "Textarea";
|
|
878
|
-
|
|
1153
|
+
|
|
1154
|
+
// src/components/Avatar/Avatar.tsx
|
|
1155
|
+
var RadixAvatar = __toESM(require("@radix-ui/react-avatar"), 1);
|
|
1156
|
+
var import_react24 = require("react");
|
|
1157
|
+
|
|
1158
|
+
// src/components/StatusDot/StatusDot.tsx
|
|
1159
|
+
var import_react23 = require("react");
|
|
1160
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1161
|
+
var stateColor = {
|
|
1162
|
+
ok: "bg-ok",
|
|
1163
|
+
warn: "bg-warn",
|
|
1164
|
+
err: "bg-err",
|
|
1165
|
+
off: "bg-text-dim",
|
|
1166
|
+
sync: "bg-accent",
|
|
1167
|
+
accent: "bg-accent"
|
|
1168
|
+
};
|
|
1169
|
+
var stateText = {
|
|
1170
|
+
ok: "text-ok",
|
|
1171
|
+
warn: "text-warn",
|
|
1172
|
+
err: "text-err",
|
|
1173
|
+
off: "text-text-dim",
|
|
1174
|
+
sync: "text-accent",
|
|
1175
|
+
accent: "text-accent"
|
|
1176
|
+
};
|
|
1177
|
+
var stateLabel = {
|
|
1178
|
+
ok: "Online",
|
|
1179
|
+
warn: "Warning",
|
|
1180
|
+
err: "Error",
|
|
1181
|
+
off: "Offline",
|
|
1182
|
+
sync: "Syncing",
|
|
1183
|
+
accent: "Active"
|
|
1184
|
+
};
|
|
1185
|
+
var StatusDot = (0, import_react23.forwardRef)(function StatusDot2({ state = "ok", label, pulse, size = 8, className, ...props }, ref) {
|
|
1186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1187
|
+
"span",
|
|
1188
|
+
{
|
|
1189
|
+
ref,
|
|
1190
|
+
role: label ? "status" : "img",
|
|
1191
|
+
"aria-label": !label ? stateLabel[state] : void 0,
|
|
1192
|
+
className: cn("inline-flex items-center gap-[6px]", className),
|
|
1193
|
+
...props,
|
|
1194
|
+
children: [
|
|
1195
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1196
|
+
"span",
|
|
1197
|
+
{
|
|
1198
|
+
className: cn(
|
|
1199
|
+
"inline-block rounded-full",
|
|
1200
|
+
stateColor[state],
|
|
1201
|
+
pulse && "animate-[ship-pulse-ring_1.6s_infinite]",
|
|
1202
|
+
stateText[state]
|
|
1203
|
+
),
|
|
1204
|
+
style: { width: size, height: size }
|
|
1205
|
+
}
|
|
1206
|
+
),
|
|
1207
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-text-muted text-[12px]", children: label })
|
|
1208
|
+
]
|
|
1209
|
+
}
|
|
1210
|
+
);
|
|
1211
|
+
});
|
|
1212
|
+
StatusDot.displayName = "StatusDot";
|
|
1213
|
+
|
|
1214
|
+
// src/components/Avatar/sizes.ts
|
|
1215
|
+
var sizePx = {
|
|
1216
|
+
xs: 20,
|
|
1217
|
+
sm: 24,
|
|
1218
|
+
md: 32,
|
|
1219
|
+
lg: 40,
|
|
1220
|
+
xl: 56
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
// src/components/Avatar/Avatar.tsx
|
|
1224
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
879
1225
|
var statusBg = {
|
|
880
1226
|
ok: "bg-ok",
|
|
881
1227
|
warn: "bg-warn",
|
|
@@ -890,11 +1236,11 @@ function hashHue(str) {
|
|
|
890
1236
|
for (let i = 0; i < str.length; i++) h = (h * 31 + str.charCodeAt(i)) % 360;
|
|
891
1237
|
return h;
|
|
892
1238
|
}
|
|
893
|
-
var Avatar =
|
|
1239
|
+
var Avatar = (0, import_react24.forwardRef)(function Avatar2({ name = "?", src, size = "md", status, initials, className, style, ...props }, ref) {
|
|
894
1240
|
const dim = sizePx[size];
|
|
895
1241
|
const hue = hashHue(name);
|
|
896
1242
|
const computedInitials = initials ?? initialsFor(name);
|
|
897
|
-
return /* @__PURE__ */
|
|
1243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
898
1244
|
"span",
|
|
899
1245
|
{
|
|
900
1246
|
ref,
|
|
@@ -902,15 +1248,17 @@ var Avatar = react.forwardRef(function Avatar2({ name = "?", src, size = "md", s
|
|
|
902
1248
|
style: { width: dim, height: dim, ...style },
|
|
903
1249
|
...props,
|
|
904
1250
|
children: [
|
|
905
|
-
/* @__PURE__ */
|
|
906
|
-
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1252
|
+
RadixAvatar.Root,
|
|
907
1253
|
{
|
|
908
1254
|
className: "border-border relative inline-flex h-full w-full shrink-0 overflow-hidden rounded-full border",
|
|
909
|
-
style: {
|
|
1255
|
+
style: {
|
|
1256
|
+
background: src ? void 0 : `oklch(var(--color-avatar-fallback-l) var(--color-avatar-fallback-c) ${hue})`
|
|
1257
|
+
},
|
|
910
1258
|
children: [
|
|
911
|
-
src && /* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
|
|
1259
|
+
src && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RadixAvatar.Image, { src, alt: name, className: "h-full w-full object-cover" }),
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1261
|
+
RadixAvatar.Fallback,
|
|
914
1262
|
{
|
|
915
1263
|
className: "flex h-full w-full items-center justify-center font-sans font-semibold text-white",
|
|
916
1264
|
style: { fontSize: dim * 0.38 },
|
|
@@ -920,11 +1268,11 @@ var Avatar = react.forwardRef(function Avatar2({ name = "?", src, size = "md", s
|
|
|
920
1268
|
]
|
|
921
1269
|
}
|
|
922
1270
|
),
|
|
923
|
-
status && /* @__PURE__ */
|
|
1271
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
924
1272
|
"span",
|
|
925
1273
|
{
|
|
926
1274
|
role: "img",
|
|
927
|
-
"aria-label":
|
|
1275
|
+
"aria-label": stateLabel[status],
|
|
928
1276
|
className: cn(
|
|
929
1277
|
"border-bg absolute right-0 bottom-0 rounded-full border-[2px]",
|
|
930
1278
|
statusBg[status]
|
|
@@ -937,15 +1285,18 @@ var Avatar = react.forwardRef(function Avatar2({ name = "?", src, size = "md", s
|
|
|
937
1285
|
);
|
|
938
1286
|
});
|
|
939
1287
|
Avatar.displayName = "Avatar";
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1288
|
+
|
|
1289
|
+
// src/components/Avatar/AvatarGroup.tsx
|
|
1290
|
+
var import_react25 = require("react");
|
|
1291
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1292
|
+
var AvatarGroup = (0, import_react25.forwardRef)(function AvatarGroup2({ names, max = 3, size = "md", className, ...props }, ref) {
|
|
1293
|
+
const dim = sizePx[size];
|
|
943
1294
|
const visible = names.slice(0, max);
|
|
944
1295
|
const rest = names.length - visible.length;
|
|
945
1296
|
const overlap = -dim * 0.35;
|
|
946
|
-
return /* @__PURE__ */
|
|
947
|
-
visible.map((n, i) => /* @__PURE__ */
|
|
948
|
-
rest > 0 && /* @__PURE__ */
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref, className: cn("inline-flex", className), ...props, children: [
|
|
1298
|
+
visible.map((n, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { marginLeft: i === 0 ? 0 : overlap }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Avatar, { name: n, size }) }, `${n}-${i}`)),
|
|
1299
|
+
rest > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
949
1300
|
"span",
|
|
950
1301
|
{
|
|
951
1302
|
"aria-label": `+${rest} more`,
|
|
@@ -965,7 +1316,12 @@ var AvatarGroup = react.forwardRef(function AvatarGroup2({ names, max = 3, size
|
|
|
965
1316
|
] });
|
|
966
1317
|
});
|
|
967
1318
|
AvatarGroup.displayName = "AvatarGroup";
|
|
968
|
-
|
|
1319
|
+
|
|
1320
|
+
// src/components/Badge/Badge.tsx
|
|
1321
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
1322
|
+
var import_react26 = require("react");
|
|
1323
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1324
|
+
var badgeStyles = (0, import_class_variance_authority5.cva)("inline-flex items-center font-sans leading-none whitespace-nowrap", {
|
|
969
1325
|
variants: {
|
|
970
1326
|
variant: {
|
|
971
1327
|
neutral: "bg-panel-2 text-text-muted border border-border",
|
|
@@ -998,21 +1354,28 @@ var dotColorClass = {
|
|
|
998
1354
|
solid: "bg-bg"
|
|
999
1355
|
};
|
|
1000
1356
|
var dotSize = { sm: "h-[5px] w-[5px]", md: "h-[6px] w-[6px]", lg: "h-[7px] w-[7px]" };
|
|
1001
|
-
var Badge =
|
|
1002
|
-
|
|
1003
|
-
|
|
1357
|
+
var Badge = (0, import_react26.forwardRef)(function Badge2({ variant = "neutral", size = "md", dot, icon, className, children, ...props }, ref) {
|
|
1358
|
+
const sz = size ?? "md";
|
|
1359
|
+
const v = variant ?? "neutral";
|
|
1360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { ref, className: cn(badgeStyles({ variant, size }), className), ...props, children: [
|
|
1361
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1004
1362
|
"span",
|
|
1005
1363
|
{
|
|
1006
1364
|
"aria-hidden": true,
|
|
1007
|
-
className: cn("inline-block rounded-full", dotSize[
|
|
1365
|
+
className: cn("inline-block rounded-full", dotSize[sz], dotColorClass[v])
|
|
1008
1366
|
}
|
|
1009
1367
|
),
|
|
1010
|
-
icon && /* @__PURE__ */
|
|
1368
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "inline-flex leading-none", children: icon }),
|
|
1011
1369
|
children
|
|
1012
1370
|
] });
|
|
1013
1371
|
});
|
|
1014
1372
|
Badge.displayName = "Badge";
|
|
1015
|
-
|
|
1373
|
+
|
|
1374
|
+
// src/components/Card/Card.tsx
|
|
1375
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
1376
|
+
var import_react27 = require("react");
|
|
1377
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1378
|
+
var cardStyles = (0, import_class_variance_authority6.cva)(
|
|
1016
1379
|
"block bg-panel border border-border rounded-base transition-[border-color,transform,box-shadow] duration-(--duration-step)",
|
|
1017
1380
|
{
|
|
1018
1381
|
variants: {
|
|
@@ -1029,7 +1392,7 @@ var cardStyles = classVarianceAuthority.cva(
|
|
|
1029
1392
|
defaultVariants: { variant: "default", interactive: false }
|
|
1030
1393
|
}
|
|
1031
1394
|
);
|
|
1032
|
-
var Card =
|
|
1395
|
+
var Card = (0, import_react27.forwardRef)(function Card2({
|
|
1033
1396
|
variant,
|
|
1034
1397
|
interactive,
|
|
1035
1398
|
title,
|
|
@@ -1039,57 +1402,96 @@ var Card = react.forwardRef(function Card2({
|
|
|
1039
1402
|
className,
|
|
1040
1403
|
children,
|
|
1041
1404
|
onClick,
|
|
1405
|
+
onActivate,
|
|
1042
1406
|
...props
|
|
1043
1407
|
}, ref) {
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1408
|
+
const wantsInteractive = interactive ?? Boolean(onClick);
|
|
1409
|
+
const hasActions = actions != null;
|
|
1410
|
+
if (wantsInteractive && hasActions && process.env.NODE_ENV !== "production") {
|
|
1411
|
+
console.warn(
|
|
1412
|
+
"[Card] `interactive` was requested but `actions` is also set, which would create a nested-interactive a11y violation. The card will render as a plain <div>. Use <CardLink> for whole-card links, or move the actions outside the card."
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
const isInteractive = wantsInteractive && !hasActions;
|
|
1416
|
+
const handleKeyDown = isInteractive ? (e) => {
|
|
1417
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
1418
|
+
if (onActivate) {
|
|
1419
|
+
e.preventDefault();
|
|
1420
|
+
onActivate();
|
|
1421
|
+
} else if (onClick) {
|
|
1422
|
+
e.preventDefault();
|
|
1423
|
+
onClick(e);
|
|
1424
|
+
}
|
|
1425
|
+
} : void 0;
|
|
1426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1046
1427
|
"div",
|
|
1047
1428
|
{
|
|
1048
1429
|
ref,
|
|
1049
1430
|
onClick,
|
|
1050
|
-
onKeyDown:
|
|
1051
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1052
|
-
e.preventDefault();
|
|
1053
|
-
onClick(e);
|
|
1054
|
-
}
|
|
1055
|
-
} : void 0,
|
|
1431
|
+
onKeyDown: handleKeyDown,
|
|
1056
1432
|
role: isInteractive ? "button" : void 0,
|
|
1057
1433
|
tabIndex: isInteractive ? 0 : void 0,
|
|
1058
|
-
className: cn(cardStyles({ variant, interactive:
|
|
1434
|
+
className: cn(cardStyles({ variant, interactive: wantsInteractive }), "p-[18px]", className),
|
|
1059
1435
|
...props,
|
|
1060
1436
|
children: [
|
|
1061
|
-
(title || actions) && /* @__PURE__ */
|
|
1062
|
-
title && /* @__PURE__ */
|
|
1063
|
-
actions && /* @__PURE__ */
|
|
1437
|
+
(title || actions) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("flex items-start gap-3", (description || children) && "mb-[10px]"), children: [
|
|
1438
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1 text-[14px] font-medium", children: title }),
|
|
1439
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex gap-1", children: actions })
|
|
1064
1440
|
] }),
|
|
1065
|
-
description && /* @__PURE__ */
|
|
1441
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("text-text-muted text-[12px] leading-[1.55]", children && "mb-[14px]"), children: description }),
|
|
1066
1442
|
children,
|
|
1067
|
-
footer && /* @__PURE__ */
|
|
1443
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "border-border text-text-dim mt-[14px] border-t pt-3 text-[11px]", children: footer })
|
|
1068
1444
|
]
|
|
1069
1445
|
}
|
|
1070
1446
|
);
|
|
1071
1447
|
});
|
|
1072
1448
|
Card.displayName = "Card";
|
|
1449
|
+
var CardLink = (0, import_react27.forwardRef)(function CardLink2({ variant, title, description, footer, className, children, href, ...props }, ref) {
|
|
1450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1451
|
+
"a",
|
|
1452
|
+
{
|
|
1453
|
+
ref,
|
|
1454
|
+
href,
|
|
1455
|
+
className: cn(
|
|
1456
|
+
cardStyles({ variant, interactive: true }),
|
|
1457
|
+
"focus-visible:ring-accent-dim p-[18px] no-underline outline-none focus-visible:ring-[3px]",
|
|
1458
|
+
className
|
|
1459
|
+
),
|
|
1460
|
+
...props,
|
|
1461
|
+
children: [
|
|
1462
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex items-start", (description || children) && "mb-[10px]"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1 text-[14px] font-medium", children: title }) }),
|
|
1463
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("text-text-muted text-[12px] leading-[1.55]", children && "mb-[14px]"), children: description }),
|
|
1464
|
+
children,
|
|
1465
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "border-border text-text-dim mt-[14px] border-t pt-3 text-[11px]", children: footer })
|
|
1466
|
+
]
|
|
1467
|
+
}
|
|
1468
|
+
);
|
|
1469
|
+
});
|
|
1470
|
+
CardLink.displayName = "CardLink";
|
|
1471
|
+
|
|
1472
|
+
// src/components/Card/StatCard.tsx
|
|
1473
|
+
var import_react28 = require("react");
|
|
1474
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1073
1475
|
var trendClasses = {
|
|
1074
1476
|
up: "text-ok",
|
|
1075
1477
|
down: "text-err",
|
|
1076
1478
|
flat: "text-text-dim"
|
|
1077
1479
|
};
|
|
1078
1480
|
var trendArrows = { up: "\u2191", down: "\u2193", flat: "\u2192" };
|
|
1079
|
-
var StatCard =
|
|
1080
|
-
return /* @__PURE__ */
|
|
1481
|
+
var StatCard = (0, import_react28.forwardRef)(function StatCard2({ label, value, delta, trend = "flat", icon, className, ...props }, ref) {
|
|
1482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1081
1483
|
"div",
|
|
1082
1484
|
{
|
|
1083
1485
|
ref,
|
|
1084
1486
|
className: cn("bg-panel border-border rounded-base block border p-[18px]", className),
|
|
1085
1487
|
...props,
|
|
1086
1488
|
children: [
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
icon && /* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mb-[10px] flex items-center justify-between", children: [
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-text-dim font-mono text-[10px] tracking-wide uppercase", children: label }),
|
|
1491
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-text-dim text-[14px]", children: icon })
|
|
1090
1492
|
] }),
|
|
1091
|
-
/* @__PURE__ */
|
|
1092
|
-
delta !== void 0 && /* @__PURE__ */
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-text font-mono text-[26px] leading-none font-medium tracking-tight", children: value }),
|
|
1494
|
+
delta !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("mt-[6px] font-mono text-[11px]", trendClasses[trend]), children: [
|
|
1093
1495
|
trendArrows[trend],
|
|
1094
1496
|
" ",
|
|
1095
1497
|
delta
|
|
@@ -1099,8 +1501,12 @@ var StatCard = react.forwardRef(function StatCard2({ label, value, delta, trend
|
|
|
1099
1501
|
);
|
|
1100
1502
|
});
|
|
1101
1503
|
StatCard.displayName = "StatCard";
|
|
1102
|
-
|
|
1103
|
-
|
|
1504
|
+
|
|
1505
|
+
// src/components/Chip/Chip.tsx
|
|
1506
|
+
var import_react29 = require("react");
|
|
1507
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1508
|
+
var Chip = (0, import_react29.forwardRef)(function Chip2({ icon, onRemove, className, children, ...props }, ref) {
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1104
1510
|
"span",
|
|
1105
1511
|
{
|
|
1106
1512
|
ref,
|
|
@@ -1111,9 +1517,9 @@ var Chip = react.forwardRef(function Chip2({ icon, removable, onRemove, classNam
|
|
|
1111
1517
|
),
|
|
1112
1518
|
...props,
|
|
1113
1519
|
children: [
|
|
1114
|
-
icon && /* @__PURE__ */
|
|
1520
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-text-dim inline-flex text-[10px]", children: icon }),
|
|
1115
1521
|
children,
|
|
1116
|
-
|
|
1522
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1117
1523
|
"button",
|
|
1118
1524
|
{
|
|
1119
1525
|
type: "button",
|
|
@@ -1128,8 +1534,12 @@ var Chip = react.forwardRef(function Chip2({ icon, removable, onRemove, classNam
|
|
|
1128
1534
|
);
|
|
1129
1535
|
});
|
|
1130
1536
|
Chip.displayName = "Chip";
|
|
1131
|
-
|
|
1132
|
-
|
|
1537
|
+
|
|
1538
|
+
// src/components/Kbd/Kbd.tsx
|
|
1539
|
+
var import_react30 = require("react");
|
|
1540
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1541
|
+
var Kbd = (0, import_react30.forwardRef)(function Kbd2({ className, children, ...props }, ref) {
|
|
1542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1133
1543
|
"kbd",
|
|
1134
1544
|
{
|
|
1135
1545
|
ref,
|
|
@@ -1145,7 +1555,12 @@ var Kbd = react.forwardRef(function Kbd2({ className, children, ...props }, ref)
|
|
|
1145
1555
|
);
|
|
1146
1556
|
});
|
|
1147
1557
|
Kbd.displayName = "Kbd";
|
|
1148
|
-
|
|
1558
|
+
|
|
1559
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
1560
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1561
|
+
var import_react31 = require("react");
|
|
1562
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1563
|
+
var skeletonStyles = (0, import_class_variance_authority7.cva)("block bg-panel-2 animate-[ship-skeleton_1.4s_infinite]", {
|
|
1149
1564
|
variants: {
|
|
1150
1565
|
shape: {
|
|
1151
1566
|
line: "rounded-xs",
|
|
@@ -1156,16 +1571,15 @@ var skeletonStyles = classVarianceAuthority.cva("block bg-panel-2 animate-[ship-
|
|
|
1156
1571
|
defaultVariants: { shape: "line" }
|
|
1157
1572
|
});
|
|
1158
1573
|
var defaultHeight = { line: 14, block: 80, circle: 40 };
|
|
1159
|
-
var Skeleton =
|
|
1574
|
+
var Skeleton = (0, import_react31.forwardRef)(function Skeleton2({ shape = "line", width = "100%", height, standalone = false, className, style, ...props }, ref) {
|
|
1160
1575
|
const h = height ?? defaultHeight[shape];
|
|
1161
1576
|
const w = shape === "circle" ? h : width;
|
|
1162
|
-
|
|
1577
|
+
const a11yProps = standalone ? { role: "status", "aria-busy": true, "aria-label": "Loading" } : { "aria-hidden": true };
|
|
1578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1163
1579
|
"div",
|
|
1164
1580
|
{
|
|
1165
1581
|
ref,
|
|
1166
|
-
|
|
1167
|
-
"aria-busy": "true",
|
|
1168
|
-
"aria-label": "Loading",
|
|
1582
|
+
...a11yProps,
|
|
1169
1583
|
className: cn(skeletonStyles({ shape }), className),
|
|
1170
1584
|
style: { width: w, height: h, ...style },
|
|
1171
1585
|
...props
|
|
@@ -1173,52 +1587,30 @@ var Skeleton = react.forwardRef(function Skeleton2({ shape = "line", width = "10
|
|
|
1173
1587
|
);
|
|
1174
1588
|
});
|
|
1175
1589
|
Skeleton.displayName = "Skeleton";
|
|
1176
|
-
var
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
accent: "bg-accent"
|
|
1183
|
-
};
|
|
1184
|
-
var stateText = {
|
|
1185
|
-
ok: "text-ok",
|
|
1186
|
-
warn: "text-warn",
|
|
1187
|
-
err: "text-err",
|
|
1188
|
-
off: "text-text-dim",
|
|
1189
|
-
sync: "text-accent",
|
|
1190
|
-
accent: "text-accent"
|
|
1191
|
-
};
|
|
1192
|
-
var StatusDot = react.forwardRef(function StatusDot2({ state = "ok", label, pulse, size = 8, className, ...props }, ref) {
|
|
1193
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1194
|
-
"span",
|
|
1590
|
+
var SkeletonGroup = (0, import_react31.forwardRef)(function SkeletonGroup2({ label = "Loading", loading = true, className, children, ...props }, ref) {
|
|
1591
|
+
if (!loading) {
|
|
1592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, className, ...props, children });
|
|
1593
|
+
}
|
|
1594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1595
|
+
"div",
|
|
1195
1596
|
{
|
|
1196
1597
|
ref,
|
|
1197
|
-
role:
|
|
1198
|
-
"aria-
|
|
1199
|
-
|
|
1598
|
+
role: "status",
|
|
1599
|
+
"aria-busy": "true",
|
|
1600
|
+
"aria-label": label,
|
|
1601
|
+
className,
|
|
1200
1602
|
...props,
|
|
1201
|
-
children
|
|
1202
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1203
|
-
"span",
|
|
1204
|
-
{
|
|
1205
|
-
className: cn(
|
|
1206
|
-
"inline-block rounded-full",
|
|
1207
|
-
stateColor[state],
|
|
1208
|
-
pulse && "animate-[ship-pulse-ring_1.6s_infinite]",
|
|
1209
|
-
stateText[state]
|
|
1210
|
-
),
|
|
1211
|
-
style: { width: size, height: size }
|
|
1212
|
-
}
|
|
1213
|
-
),
|
|
1214
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted text-[12px]", children: label })
|
|
1215
|
-
]
|
|
1603
|
+
children
|
|
1216
1604
|
}
|
|
1217
1605
|
);
|
|
1218
1606
|
});
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1607
|
+
SkeletonGroup.displayName = "SkeletonGroup";
|
|
1608
|
+
|
|
1609
|
+
// src/components/Tag/Tag.tsx
|
|
1610
|
+
var import_react32 = require("react");
|
|
1611
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1612
|
+
var Tag = (0, import_react32.forwardRef)(function Tag2({ onRemove, icon, size = 22, className, children, ...props }, ref) {
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1222
1614
|
"span",
|
|
1223
1615
|
{
|
|
1224
1616
|
ref,
|
|
@@ -1230,9 +1622,9 @@ var Tag = react.forwardRef(function Tag2({ onRemove, icon, size = 22, className,
|
|
|
1230
1622
|
style: { height: size },
|
|
1231
1623
|
...props,
|
|
1232
1624
|
children: [
|
|
1233
|
-
icon && /* @__PURE__ */
|
|
1625
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-text-dim inline-flex", children: icon }),
|
|
1234
1626
|
children,
|
|
1235
|
-
onRemove && /* @__PURE__ */
|
|
1627
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1236
1628
|
"button",
|
|
1237
1629
|
{
|
|
1238
1630
|
type: "button",
|
|
@@ -1247,17 +1639,22 @@ var Tag = react.forwardRef(function Tag2({ onRemove, icon, size = 22, className,
|
|
|
1247
1639
|
);
|
|
1248
1640
|
});
|
|
1249
1641
|
Tag.displayName = "Tag";
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
var
|
|
1253
|
-
var
|
|
1642
|
+
|
|
1643
|
+
// src/components/ContextMenu/ContextMenu.tsx
|
|
1644
|
+
var RadixContext = __toESM(require("@radix-ui/react-context-menu"), 1);
|
|
1645
|
+
var import_react33 = require("react");
|
|
1646
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1647
|
+
var ContextMenuRoot = RadixContext.Root;
|
|
1648
|
+
var ContextMenuTrigger = RadixContext.Trigger;
|
|
1649
|
+
var ContextMenuPortal = RadixContext.Portal;
|
|
1650
|
+
var ContextMenuContent = (0, import_react33.forwardRef)(
|
|
1254
1651
|
function ContextMenuContent2({ className, ...props }, ref) {
|
|
1255
|
-
return /* @__PURE__ */
|
|
1256
|
-
|
|
1652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadixContext.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1653
|
+
RadixContext.Content,
|
|
1257
1654
|
{
|
|
1258
1655
|
ref,
|
|
1259
1656
|
className: cn(
|
|
1260
|
-
"bg-panel border-border-strong z-
|
|
1657
|
+
"bg-panel border-border-strong z-popover min-w-[180px] rounded-md border p-1 shadow-lg outline-none",
|
|
1261
1658
|
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
1262
1659
|
className
|
|
1263
1660
|
),
|
|
@@ -1272,27 +1669,27 @@ var itemBase = cn(
|
|
|
1272
1669
|
"data-[highlighted]:bg-panel-2",
|
|
1273
1670
|
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
1274
1671
|
);
|
|
1275
|
-
var ContextMenuItem =
|
|
1672
|
+
var ContextMenuItem = (0, import_react33.forwardRef)(
|
|
1276
1673
|
function ContextMenuItem2({ icon, trailing, destructive, className, children, ...props }, ref) {
|
|
1277
|
-
return /* @__PURE__ */
|
|
1278
|
-
|
|
1674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1675
|
+
RadixContext.Item,
|
|
1279
1676
|
{
|
|
1280
1677
|
ref,
|
|
1281
1678
|
className: cn(itemBase, destructive ? "text-err" : "text-text", className),
|
|
1282
1679
|
...props,
|
|
1283
1680
|
children: [
|
|
1284
|
-
icon && /* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
trailing && /* @__PURE__ */
|
|
1681
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "w-[14px] text-[12px] opacity-70", children: icon }),
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "flex-1", children }),
|
|
1683
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
1287
1684
|
]
|
|
1288
1685
|
}
|
|
1289
1686
|
);
|
|
1290
1687
|
}
|
|
1291
1688
|
);
|
|
1292
1689
|
ContextMenuItem.displayName = "ContextMenuItem";
|
|
1293
|
-
var ContextMenuSeparator =
|
|
1294
|
-
return /* @__PURE__ */
|
|
1295
|
-
|
|
1690
|
+
var ContextMenuSeparator = (0, import_react33.forwardRef)(function ContextMenuSeparator2({ className, ...props }, ref) {
|
|
1691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1692
|
+
RadixContext.Separator,
|
|
1296
1693
|
{
|
|
1297
1694
|
ref,
|
|
1298
1695
|
className: cn("bg-border my-1 h-[1px]", className),
|
|
@@ -1301,19 +1698,24 @@ var ContextMenuSeparator = react.forwardRef(function ContextMenuSeparator2({ cla
|
|
|
1301
1698
|
);
|
|
1302
1699
|
});
|
|
1303
1700
|
ContextMenuSeparator.displayName = "ContextMenuSeparator";
|
|
1304
|
-
var ContextMenu =
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
var
|
|
1308
|
-
var
|
|
1309
|
-
var
|
|
1701
|
+
var ContextMenu = RadixContext.Root;
|
|
1702
|
+
|
|
1703
|
+
// src/components/Dialog/Dialog.tsx
|
|
1704
|
+
var RadixDialog = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1705
|
+
var import_react34 = require("react");
|
|
1706
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1707
|
+
var DialogRoot = RadixDialog.Root;
|
|
1708
|
+
var DialogTrigger = RadixDialog.Trigger;
|
|
1709
|
+
var DialogClose = RadixDialog.Close;
|
|
1710
|
+
var DialogPortal = RadixDialog.Portal;
|
|
1711
|
+
var DialogOverlay = (0, import_react34.forwardRef)(
|
|
1310
1712
|
function DialogOverlay2({ className, ...props }, ref) {
|
|
1311
|
-
return /* @__PURE__ */
|
|
1312
|
-
|
|
1713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1714
|
+
RadixDialog.Overlay,
|
|
1313
1715
|
{
|
|
1314
1716
|
ref,
|
|
1315
1717
|
className: cn(
|
|
1316
|
-
"fixed inset-0
|
|
1718
|
+
"z-overlay fixed inset-0 bg-black/55 backdrop-blur-[4px]",
|
|
1317
1719
|
"data-[state=open]:animate-[ship-fade-in_150ms_ease]",
|
|
1318
1720
|
className
|
|
1319
1721
|
),
|
|
@@ -1323,15 +1725,15 @@ var DialogOverlay = react.forwardRef(
|
|
|
1323
1725
|
}
|
|
1324
1726
|
);
|
|
1325
1727
|
DialogOverlay.displayName = "DialogOverlay";
|
|
1326
|
-
var DialogContent =
|
|
1327
|
-
return /* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
|
|
1728
|
+
var DialogContent = (0, import_react34.forwardRef)(function DialogContent2({ className, width = 460, style, children, ...props }, ref) {
|
|
1729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogPortal, { children: [
|
|
1730
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogOverlay, {}),
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1732
|
+
RadixDialog.Content,
|
|
1331
1733
|
{
|
|
1332
1734
|
ref,
|
|
1333
1735
|
className: cn(
|
|
1334
|
-
"fixed top-1/2 left-1/2
|
|
1736
|
+
"z-modal fixed top-1/2 left-1/2 w-[calc(100%-40px)] -translate-x-1/2 -translate-y-1/2 p-6",
|
|
1335
1737
|
"bg-panel border-border-strong rounded-lg border shadow-lg",
|
|
1336
1738
|
"data-[state=open]:animate-[ship-dialog-in_180ms_var(--easing-out)]",
|
|
1337
1739
|
"outline-none",
|
|
@@ -1346,27 +1748,32 @@ var DialogContent = react.forwardRef(function DialogContent2({ className, width
|
|
|
1346
1748
|
});
|
|
1347
1749
|
DialogContent.displayName = "DialogContent";
|
|
1348
1750
|
function Dialog({ title, description, footer, width, children, ...rootProps }) {
|
|
1349
|
-
return /* @__PURE__ */
|
|
1350
|
-
title && /* @__PURE__ */
|
|
1351
|
-
|
|
1751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { width, children: [
|
|
1752
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1753
|
+
RadixDialog.Title,
|
|
1352
1754
|
{
|
|
1353
1755
|
className: cn("text-[16px] font-medium", description ? "mb-[6px]" : "mb-4"),
|
|
1354
1756
|
children: title
|
|
1355
1757
|
}
|
|
1356
1758
|
),
|
|
1357
|
-
description && /* @__PURE__ */
|
|
1759
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadixDialog.Description, { className: "text-text-muted mb-[18px] text-[13px] leading-[1.55]", children: description }),
|
|
1358
1760
|
children,
|
|
1359
|
-
footer && /* @__PURE__ */
|
|
1761
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mt-5 flex justify-end gap-2", children: footer })
|
|
1360
1762
|
] }) });
|
|
1361
1763
|
}
|
|
1764
|
+
|
|
1765
|
+
// src/components/Dialog/Drawer.tsx
|
|
1766
|
+
var RadixDialog2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1767
|
+
var import_react35 = require("react");
|
|
1768
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1362
1769
|
var sideClasses = {
|
|
1363
1770
|
left: "left-0 border-r border-border-strong data-[state=open]:animate-[ship-slide-in-left_220ms_var(--easing-out)]",
|
|
1364
1771
|
right: "right-0 border-l border-border-strong data-[state=open]:animate-[ship-slide-in-right_220ms_var(--easing-out)]"
|
|
1365
1772
|
};
|
|
1366
|
-
var DrawerHeader = ({ title, onClose }) => /* @__PURE__ */
|
|
1367
|
-
/* @__PURE__ */
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
|
|
1773
|
+
var DrawerHeader = ({ title, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-border flex items-center justify-between border-b p-[16px] px-5", children: [
|
|
1774
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RadixDialog2.Title, { className: "text-[14px] font-medium", children: title }),
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1776
|
+
RadixDialog2.Close,
|
|
1370
1777
|
{
|
|
1371
1778
|
onClick: onClose,
|
|
1372
1779
|
"aria-label": "Close",
|
|
@@ -1375,43 +1782,49 @@ var DrawerHeader = ({ title, onClose }) => /* @__PURE__ */ jsxRuntime.jsxs("div"
|
|
|
1375
1782
|
}
|
|
1376
1783
|
)
|
|
1377
1784
|
] });
|
|
1378
|
-
var Drawer =
|
|
1379
|
-
return /* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1382
|
-
|
|
1785
|
+
var Drawer = (0, import_react35.forwardRef)(function Drawer2({ side = "right", title, width = 420, children, ...rootProps }, ref) {
|
|
1786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogPortal, { children: [
|
|
1787
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogOverlay, {}),
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1789
|
+
RadixDialog2.Content,
|
|
1383
1790
|
{
|
|
1384
1791
|
ref,
|
|
1792
|
+
"aria-describedby": void 0,
|
|
1385
1793
|
className: cn(
|
|
1386
|
-
"bg-panel fixed top-0 bottom-0
|
|
1794
|
+
"bg-panel z-modal fixed top-0 bottom-0 flex flex-col shadow-lg outline-none",
|
|
1387
1795
|
sideClasses[side]
|
|
1388
1796
|
),
|
|
1389
1797
|
style: { width },
|
|
1390
1798
|
children: [
|
|
1391
|
-
title
|
|
1392
|
-
/* @__PURE__ */
|
|
1799
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DrawerHeader, { title }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(RadixDialog2.Title, { className: "sr-only", children: "Drawer" }),
|
|
1800
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 overflow-auto p-5", children })
|
|
1393
1801
|
]
|
|
1394
1802
|
}
|
|
1395
1803
|
)
|
|
1396
1804
|
] }) });
|
|
1397
1805
|
});
|
|
1398
1806
|
Drawer.displayName = "Drawer";
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1807
|
+
|
|
1808
|
+
// src/components/Dialog/Sheet.tsx
|
|
1809
|
+
var RadixDialog3 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1810
|
+
var import_react36 = require("react");
|
|
1811
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1812
|
+
var Sheet = (0, import_react36.forwardRef)(function Sheet2({ title, width = "min(640px, 90vw)", children, ...rootProps }, ref) {
|
|
1813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(DialogPortal, { children: [
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DialogOverlay, {}),
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1816
|
+
RadixDialog3.Content,
|
|
1404
1817
|
{
|
|
1405
1818
|
ref,
|
|
1819
|
+
"aria-describedby": void 0,
|
|
1406
1820
|
className: cn(
|
|
1407
|
-
"fixed bottom-0 left-1/2
|
|
1821
|
+
"z-modal fixed bottom-0 left-1/2 -translate-x-1/2 p-5",
|
|
1408
1822
|
"bg-panel border-border-strong rounded-tl-lg rounded-tr-lg border-t shadow-lg outline-none",
|
|
1409
1823
|
"data-[state=open]:animate-[ship-slide-in-bottom_220ms_var(--easing-out)]"
|
|
1410
1824
|
),
|
|
1411
1825
|
style: { width },
|
|
1412
1826
|
children: [
|
|
1413
|
-
/* @__PURE__ */
|
|
1414
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Title, { className: "mb-1 text-[15px] font-medium", children: title }),
|
|
1827
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RadixDialog3.Title, { className: "mb-1 text-[15px] font-medium", children: title }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RadixDialog3.Title, { className: "sr-only", children: "Sheet" }),
|
|
1415
1828
|
children
|
|
1416
1829
|
]
|
|
1417
1830
|
}
|
|
@@ -1419,64 +1832,74 @@ var Sheet = react.forwardRef(function Sheet2({ title, width = "min(640px, 90vw)"
|
|
|
1419
1832
|
] }) });
|
|
1420
1833
|
});
|
|
1421
1834
|
Sheet.displayName = "Sheet";
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
var
|
|
1425
|
-
var
|
|
1426
|
-
var
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1835
|
+
|
|
1836
|
+
// src/components/Dialog/AlertDialog.tsx
|
|
1837
|
+
var RadixAlert = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
1838
|
+
var import_react37 = require("react");
|
|
1839
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1840
|
+
var AlertDialogRoot = RadixAlert.Root;
|
|
1841
|
+
var AlertDialogTrigger = RadixAlert.Trigger;
|
|
1842
|
+
var AlertDialogAction = RadixAlert.Action;
|
|
1843
|
+
var AlertDialogCancel = RadixAlert.Cancel;
|
|
1844
|
+
var AlertDialog = (0, import_react37.forwardRef)(function AlertDialog2({ title, description, footer, width = 460, children, ...rootProps }, ref) {
|
|
1845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AlertDialogRoot, { ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(RadixAlert.Portal, { children: [
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1847
|
+
RadixAlert.Overlay,
|
|
1430
1848
|
{
|
|
1431
1849
|
className: cn(
|
|
1432
|
-
"fixed inset-0
|
|
1850
|
+
"z-overlay fixed inset-0 bg-black/55 backdrop-blur-[4px]",
|
|
1433
1851
|
"data-[state=open]:animate-[ship-fade-in_150ms_ease]"
|
|
1434
1852
|
)
|
|
1435
1853
|
}
|
|
1436
1854
|
),
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1856
|
+
RadixAlert.Content,
|
|
1439
1857
|
{
|
|
1440
1858
|
ref,
|
|
1441
1859
|
style: { maxWidth: width },
|
|
1442
1860
|
className: cn(
|
|
1443
|
-
"fixed top-1/2 left-1/2
|
|
1861
|
+
"z-modal fixed top-1/2 left-1/2 w-[calc(100%-40px)] -translate-x-1/2 -translate-y-1/2 p-6",
|
|
1444
1862
|
"bg-panel border-border-strong rounded-lg border shadow-lg outline-none",
|
|
1445
1863
|
"data-[state=open]:animate-[ship-dialog-in_180ms_var(--easing-out)]"
|
|
1446
1864
|
),
|
|
1447
1865
|
children: [
|
|
1448
|
-
/* @__PURE__ */
|
|
1449
|
-
|
|
1866
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1867
|
+
RadixAlert.Title,
|
|
1450
1868
|
{
|
|
1451
1869
|
className: cn("text-[16px] font-medium", description ? "mb-[6px]" : "mb-4"),
|
|
1452
1870
|
children: title
|
|
1453
1871
|
}
|
|
1454
1872
|
),
|
|
1455
|
-
description && /* @__PURE__ */
|
|
1873
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RadixAlert.Description, { className: "text-text-muted mb-[18px] text-[13px] leading-[1.55]", children: description }),
|
|
1456
1874
|
children,
|
|
1457
|
-
footer && /* @__PURE__ */
|
|
1875
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "mt-5 flex justify-end gap-2", children: footer })
|
|
1458
1876
|
]
|
|
1459
1877
|
}
|
|
1460
1878
|
)
|
|
1461
1879
|
] }) });
|
|
1462
1880
|
});
|
|
1463
1881
|
AlertDialog.displayName = "AlertDialog";
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
var
|
|
1467
|
-
var
|
|
1468
|
-
var
|
|
1469
|
-
var
|
|
1470
|
-
var
|
|
1882
|
+
|
|
1883
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1884
|
+
var RadixMenu = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
1885
|
+
var import_react38 = require("react");
|
|
1886
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1887
|
+
var DropdownMenuRoot = RadixMenu.Root;
|
|
1888
|
+
var DropdownMenuTrigger = RadixMenu.Trigger;
|
|
1889
|
+
var DropdownMenuPortal = RadixMenu.Portal;
|
|
1890
|
+
var DropdownMenuGroup = RadixMenu.Group;
|
|
1891
|
+
var DropdownMenuLabel = RadixMenu.Label;
|
|
1892
|
+
var DropdownMenuRadioGroup = RadixMenu.RadioGroup;
|
|
1893
|
+
var DropdownMenuContent = (0, import_react38.forwardRef)(
|
|
1471
1894
|
function DropdownMenuContent2({ className, sideOffset = 6, align = "start", ...props }, ref) {
|
|
1472
|
-
return /* @__PURE__ */
|
|
1473
|
-
|
|
1895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RadixMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1896
|
+
RadixMenu.Content,
|
|
1474
1897
|
{
|
|
1475
1898
|
ref,
|
|
1476
1899
|
sideOffset,
|
|
1477
1900
|
align,
|
|
1478
1901
|
className: cn(
|
|
1479
|
-
"bg-panel border-border-strong z-
|
|
1902
|
+
"bg-panel border-border-strong z-popover min-w-[180px] rounded-md border p-1 shadow-lg outline-none",
|
|
1480
1903
|
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
1481
1904
|
className
|
|
1482
1905
|
),
|
|
@@ -1491,32 +1914,32 @@ var itemBase2 = cn(
|
|
|
1491
1914
|
"data-[highlighted]:bg-panel-2",
|
|
1492
1915
|
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
1493
1916
|
);
|
|
1494
|
-
var MenuItem =
|
|
1495
|
-
return /* @__PURE__ */
|
|
1496
|
-
|
|
1917
|
+
var MenuItem = (0, import_react38.forwardRef)(function MenuItem2({ icon, trailing, destructive, className, children, ...props }, ref) {
|
|
1918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1919
|
+
RadixMenu.Item,
|
|
1497
1920
|
{
|
|
1498
1921
|
ref,
|
|
1499
1922
|
className: cn(itemBase2, destructive ? "text-err" : "text-text", className),
|
|
1500
1923
|
...props,
|
|
1501
1924
|
children: [
|
|
1502
|
-
icon && /* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
trailing && /* @__PURE__ */
|
|
1925
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "w-[14px] text-[12px] opacity-70", children: icon }),
|
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "flex-1", children }),
|
|
1927
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
1505
1928
|
]
|
|
1506
1929
|
}
|
|
1507
1930
|
);
|
|
1508
1931
|
});
|
|
1509
1932
|
MenuItem.displayName = "MenuItem";
|
|
1510
|
-
var MenuCheckboxItem =
|
|
1933
|
+
var MenuCheckboxItem = (0, import_react38.forwardRef)(
|
|
1511
1934
|
function MenuCheckboxItem2({ className, children, ...props }, ref) {
|
|
1512
|
-
return /* @__PURE__ */
|
|
1513
|
-
|
|
1935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1936
|
+
RadixMenu.CheckboxItem,
|
|
1514
1937
|
{
|
|
1515
1938
|
ref,
|
|
1516
1939
|
className: cn(itemBase2, "text-text relative pl-[26px]", className),
|
|
1517
1940
|
...props,
|
|
1518
1941
|
children: [
|
|
1519
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RadixMenu.ItemIndicator, { className: "text-accent absolute top-1/2 left-2 -translate-y-1/2 text-[10px]", children: "\u2713" }),
|
|
1520
1943
|
children
|
|
1521
1944
|
]
|
|
1522
1945
|
}
|
|
@@ -1524,10 +1947,10 @@ var MenuCheckboxItem = react.forwardRef(
|
|
|
1524
1947
|
}
|
|
1525
1948
|
);
|
|
1526
1949
|
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
1527
|
-
var MenuSeparator =
|
|
1950
|
+
var MenuSeparator = (0, import_react38.forwardRef)(
|
|
1528
1951
|
function MenuSeparator2({ className, ...props }, ref) {
|
|
1529
|
-
return /* @__PURE__ */
|
|
1530
|
-
|
|
1952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1953
|
+
RadixMenu.Separator,
|
|
1531
1954
|
{
|
|
1532
1955
|
ref,
|
|
1533
1956
|
className: cn("bg-border my-1 h-[1px]", className),
|
|
@@ -1537,19 +1960,24 @@ var MenuSeparator = react.forwardRef(
|
|
|
1537
1960
|
}
|
|
1538
1961
|
);
|
|
1539
1962
|
MenuSeparator.displayName = "MenuSeparator";
|
|
1540
|
-
var DropdownMenu =
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
var
|
|
1544
|
-
var
|
|
1963
|
+
var DropdownMenu = RadixMenu.Root;
|
|
1964
|
+
|
|
1965
|
+
// src/components/HoverCard/HoverCard.tsx
|
|
1966
|
+
var RadixHoverCard = __toESM(require("@radix-ui/react-hover-card"), 1);
|
|
1967
|
+
var import_react39 = require("react");
|
|
1968
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1969
|
+
var HoverCardRoot = RadixHoverCard.Root;
|
|
1970
|
+
var HoverCardTrigger = RadixHoverCard.Trigger;
|
|
1971
|
+
var HoverCardPortal = RadixHoverCard.Portal;
|
|
1972
|
+
var HoverCardContent = (0, import_react39.forwardRef)(
|
|
1545
1973
|
function HoverCardContent2({ className, sideOffset = 4, ...props }, ref) {
|
|
1546
|
-
return /* @__PURE__ */
|
|
1547
|
-
|
|
1974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RadixHoverCard.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1975
|
+
RadixHoverCard.Content,
|
|
1548
1976
|
{
|
|
1549
1977
|
ref,
|
|
1550
1978
|
sideOffset,
|
|
1551
1979
|
className: cn(
|
|
1552
|
-
"rounded-base bg-panel border-border-strong z-
|
|
1980
|
+
"rounded-base bg-panel border-border-strong z-popover border p-[14px] shadow-lg outline-none",
|
|
1553
1981
|
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
1554
1982
|
className
|
|
1555
1983
|
),
|
|
@@ -1560,27 +1988,32 @@ var HoverCardContent = react.forwardRef(
|
|
|
1560
1988
|
);
|
|
1561
1989
|
HoverCardContent.displayName = "HoverCardContent";
|
|
1562
1990
|
function HoverCard({ trigger, content, ...rootProps }) {
|
|
1563
|
-
return /* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(RadixHoverCard.Root, { openDelay: 200, closeDelay: 120, ...rootProps, children: [
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RadixHoverCard.Trigger, { asChild: true, children: trigger }),
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HoverCardContent, { children: content })
|
|
1566
1994
|
] });
|
|
1567
1995
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
var
|
|
1571
|
-
var
|
|
1572
|
-
var
|
|
1573
|
-
var
|
|
1574
|
-
var
|
|
1996
|
+
|
|
1997
|
+
// src/components/Popover/Popover.tsx
|
|
1998
|
+
var RadixPopover = __toESM(require("@radix-ui/react-popover"), 1);
|
|
1999
|
+
var import_react40 = require("react");
|
|
2000
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2001
|
+
var PopoverRoot = RadixPopover.Root;
|
|
2002
|
+
var PopoverTrigger = RadixPopover.Trigger;
|
|
2003
|
+
var PopoverAnchor = RadixPopover.Anchor;
|
|
2004
|
+
var PopoverPortal = RadixPopover.Portal;
|
|
2005
|
+
var PopoverClose = RadixPopover.Close;
|
|
2006
|
+
var PopoverArrow = RadixPopover.Arrow;
|
|
2007
|
+
var PopoverContent = (0, import_react40.forwardRef)(
|
|
1575
2008
|
function PopoverContent2({ className, align = "start", sideOffset = 6, ...props }, ref) {
|
|
1576
|
-
return /* @__PURE__ */
|
|
1577
|
-
|
|
2009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(RadixPopover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2010
|
+
RadixPopover.Content,
|
|
1578
2011
|
{
|
|
1579
2012
|
ref,
|
|
1580
2013
|
align,
|
|
1581
2014
|
sideOffset,
|
|
1582
2015
|
className: cn(
|
|
1583
|
-
"bg-panel border-border-strong z-
|
|
2016
|
+
"bg-panel border-border-strong z-popover rounded-md border p-[6px] shadow-lg outline-none",
|
|
1584
2017
|
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
1585
2018
|
className
|
|
1586
2019
|
),
|
|
@@ -1590,8 +2023,13 @@ var PopoverContent = react.forwardRef(
|
|
|
1590
2023
|
}
|
|
1591
2024
|
);
|
|
1592
2025
|
PopoverContent.displayName = "PopoverContent";
|
|
1593
|
-
var Popover =
|
|
1594
|
-
|
|
2026
|
+
var Popover = RadixPopover.Root;
|
|
2027
|
+
|
|
2028
|
+
// src/components/Toast/Toast.tsx
|
|
2029
|
+
var RadixToast = __toESM(require("@radix-ui/react-toast"), 1);
|
|
2030
|
+
var import_react41 = require("react");
|
|
2031
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2032
|
+
var ToastContext = (0, import_react41.createContext)(null);
|
|
1595
2033
|
var variantIcon = {
|
|
1596
2034
|
default: "\u25CF",
|
|
1597
2035
|
info: "\u2139",
|
|
@@ -1613,32 +2051,41 @@ var variantBorderLeft = {
|
|
|
1613
2051
|
warn: "border-l-warn",
|
|
1614
2052
|
err: "border-l-err"
|
|
1615
2053
|
};
|
|
2054
|
+
var toastIdCounter = 0;
|
|
2055
|
+
var nextToastId = () => `toast-${++toastIdCounter}`;
|
|
1616
2056
|
function ToastProvider({ children }) {
|
|
1617
|
-
const [toasts, setToasts] =
|
|
1618
|
-
const toast =
|
|
1619
|
-
const
|
|
1620
|
-
|
|
2057
|
+
const [toasts, setToasts] = (0, import_react41.useState)([]);
|
|
2058
|
+
const toast = (0, import_react41.useCallback)((t) => {
|
|
2059
|
+
const explicitId = t.id;
|
|
2060
|
+
const id = explicitId ?? nextToastId();
|
|
2061
|
+
const entry = { ...t, id };
|
|
2062
|
+
setToasts((prev) => {
|
|
2063
|
+
if (explicitId !== void 0 && prev.some((existing) => existing.id === explicitId)) {
|
|
2064
|
+
return prev.map((existing) => existing.id === explicitId ? entry : existing);
|
|
2065
|
+
}
|
|
2066
|
+
return [...prev, entry];
|
|
2067
|
+
});
|
|
1621
2068
|
return id;
|
|
1622
2069
|
}, []);
|
|
1623
|
-
const dismiss =
|
|
2070
|
+
const dismiss = (0, import_react41.useCallback)((id) => {
|
|
1624
2071
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1625
2072
|
}, []);
|
|
1626
|
-
const value =
|
|
1627
|
-
return /* @__PURE__ */
|
|
2073
|
+
const value = (0, import_react41.useMemo)(() => ({ toast, dismiss }), [toast, dismiss]);
|
|
2074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToastContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(RadixToast.Provider, { swipeDirection: "right", children: [
|
|
1628
2075
|
children,
|
|
1629
|
-
toasts.map((t) => /* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
2076
|
+
toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToastCard, { toast: t, onDismiss: () => dismiss(t.id) }, t.id)),
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RadixToast.Viewport, { className: "z-toast fixed right-5 bottom-5 flex w-[380px] max-w-[calc(100vw-40px)] flex-col gap-2 outline-none" })
|
|
1631
2078
|
] }) });
|
|
1632
2079
|
}
|
|
1633
2080
|
function useToast() {
|
|
1634
|
-
const ctx =
|
|
2081
|
+
const ctx = (0, import_react41.useContext)(ToastContext);
|
|
1635
2082
|
if (!ctx) throw new Error("useToast must be inside <ToastProvider>");
|
|
1636
2083
|
return ctx;
|
|
1637
2084
|
}
|
|
1638
|
-
var ToastCard =
|
|
2085
|
+
var ToastCard = (0, import_react41.forwardRef)(function ToastCard2({ toast, onDismiss }, ref) {
|
|
1639
2086
|
const variant = toast.variant ?? "default";
|
|
1640
|
-
return /* @__PURE__ */
|
|
1641
|
-
|
|
2087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2088
|
+
RadixToast.Root,
|
|
1642
2089
|
{
|
|
1643
2090
|
ref,
|
|
1644
2091
|
duration: toast.duration ?? 4e3,
|
|
@@ -1652,14 +2099,14 @@ var ToastCard = react.forwardRef(function ToastCard2({ toast, onDismiss }, ref)
|
|
|
1652
2099
|
variantBorderLeft[variant]
|
|
1653
2100
|
),
|
|
1654
2101
|
children: [
|
|
1655
|
-
/* @__PURE__ */
|
|
1656
|
-
/* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
toast.description && /* @__PURE__ */
|
|
1659
|
-
toast.action && /* @__PURE__ */
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: cn("mt-px text-[14px] leading-none", variantTextColor[variant]), children: variantIcon[variant] }),
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RadixToast.Title, { className: "text-text text-[13px] font-medium", children: toast.title }),
|
|
2105
|
+
toast.description && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RadixToast.Description, { className: "text-text-muted mt-[2px] text-[12px] leading-[1.5]", children: toast.description }),
|
|
2106
|
+
toast.action && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mt-2", children: toast.action })
|
|
1660
2107
|
] }),
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2109
|
+
RadixToast.Close,
|
|
1663
2110
|
{
|
|
1664
2111
|
"aria-label": "Dismiss",
|
|
1665
2112
|
className: "text-text-dim hover:text-text -mt-px text-[15px] leading-none",
|
|
@@ -1671,20 +2118,25 @@ var ToastCard = react.forwardRef(function ToastCard2({ toast, onDismiss }, ref)
|
|
|
1671
2118
|
);
|
|
1672
2119
|
});
|
|
1673
2120
|
ToastCard.displayName = "ToastCard";
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
var
|
|
1677
|
-
var
|
|
1678
|
-
var
|
|
1679
|
-
var
|
|
2121
|
+
|
|
2122
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
2123
|
+
var RadixTooltip = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
2124
|
+
var import_react42 = require("react");
|
|
2125
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2126
|
+
var TooltipProvider = RadixTooltip.Provider;
|
|
2127
|
+
var TooltipRoot = RadixTooltip.Root;
|
|
2128
|
+
var TooltipTrigger = RadixTooltip.Trigger;
|
|
2129
|
+
var TooltipPortal = RadixTooltip.Portal;
|
|
2130
|
+
var TooltipArrow = RadixTooltip.Arrow;
|
|
2131
|
+
var TooltipContent = (0, import_react42.forwardRef)(
|
|
1680
2132
|
function TooltipContent2({ className, sideOffset = 6, ...props }, ref) {
|
|
1681
|
-
return /* @__PURE__ */
|
|
1682
|
-
|
|
2133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RadixTooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2134
|
+
RadixTooltip.Content,
|
|
1683
2135
|
{
|
|
1684
2136
|
ref,
|
|
1685
2137
|
sideOffset,
|
|
1686
2138
|
className: cn(
|
|
1687
|
-
"pointer-events-none
|
|
2139
|
+
"z-tooltip pointer-events-none rounded-sm px-2 py-[5px] text-[11px] whitespace-nowrap",
|
|
1688
2140
|
"bg-text text-bg",
|
|
1689
2141
|
"data-[state=delayed-open]:animate-[ship-pop-in_120ms_var(--easing-out)]",
|
|
1690
2142
|
className
|
|
@@ -1696,124 +2148,148 @@ var TooltipContent = react.forwardRef(
|
|
|
1696
2148
|
);
|
|
1697
2149
|
TooltipContent.displayName = "TooltipContent";
|
|
1698
2150
|
function Tooltip({ content, children, side = "top", delayDuration = 400 }) {
|
|
1699
|
-
return /* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
2151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipProvider, { delayDuration, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(TooltipRoot, { children: [
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipTrigger, { asChild: true, children }),
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipContent, { side, children: content })
|
|
1702
2154
|
] }) });
|
|
1703
2155
|
}
|
|
1704
|
-
|
|
2156
|
+
|
|
2157
|
+
// src/patterns/Alert/Alert.tsx
|
|
2158
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
2159
|
+
var import_react43 = require("react");
|
|
2160
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2161
|
+
var alertStyles = (0, import_class_variance_authority8.cva)("flex items-start gap-3 rounded-base border bg-panel p-3 text-[13px]", {
|
|
1705
2162
|
variants: {
|
|
1706
|
-
|
|
1707
|
-
|
|
2163
|
+
tone: {
|
|
2164
|
+
accent: "border-border border-l-2 border-l-accent",
|
|
1708
2165
|
ok: "border-border border-l-2 border-l-ok",
|
|
1709
2166
|
warn: "border-border border-l-2 border-l-warn",
|
|
1710
2167
|
err: "border-border border-l-2 border-l-err"
|
|
1711
2168
|
}
|
|
1712
2169
|
},
|
|
1713
|
-
defaultVariants: {
|
|
2170
|
+
defaultVariants: { tone: "accent" }
|
|
1714
2171
|
});
|
|
1715
2172
|
var iconColorClass = {
|
|
1716
|
-
|
|
2173
|
+
accent: "text-accent",
|
|
1717
2174
|
ok: "text-ok",
|
|
1718
2175
|
warn: "text-warn",
|
|
1719
2176
|
err: "text-err"
|
|
1720
2177
|
};
|
|
1721
2178
|
var defaultGlyph = {
|
|
1722
|
-
|
|
2179
|
+
accent: "\u2139",
|
|
1723
2180
|
ok: "\u2713",
|
|
1724
2181
|
warn: "!",
|
|
1725
2182
|
err: "\xD7"
|
|
1726
2183
|
};
|
|
1727
|
-
var Alert =
|
|
1728
|
-
|
|
2184
|
+
var Alert = (0, import_react43.forwardRef)(function Alert2({
|
|
2185
|
+
tone = "accent",
|
|
2186
|
+
title,
|
|
2187
|
+
description,
|
|
2188
|
+
icon,
|
|
2189
|
+
action,
|
|
2190
|
+
live = "polite",
|
|
2191
|
+
className,
|
|
2192
|
+
children,
|
|
2193
|
+
...props
|
|
2194
|
+
}, ref) {
|
|
2195
|
+
const t = tone ?? "accent";
|
|
2196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
1729
2197
|
"div",
|
|
1730
2198
|
{
|
|
1731
2199
|
ref,
|
|
1732
|
-
role:
|
|
1733
|
-
|
|
2200
|
+
role: live === "assertive" ? "alert" : "status",
|
|
2201
|
+
"aria-live": live === "off" ? void 0 : live,
|
|
2202
|
+
className: cn(alertStyles({ tone }), className),
|
|
1734
2203
|
...props,
|
|
1735
2204
|
children: [
|
|
1736
|
-
/* @__PURE__ */
|
|
1737
|
-
|
|
1738
|
-
{
|
|
1739
|
-
|
|
1740
|
-
className: cn("mt-[1px] text-[14px] leading-none", iconColorClass[variant]),
|
|
1741
|
-
children: icon ?? defaultGlyph[variant]
|
|
1742
|
-
}
|
|
1743
|
-
),
|
|
1744
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1745
|
-
title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: title }),
|
|
1746
|
-
description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-text-muted mt-[2px] text-[12px]", children: description }),
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { "aria-hidden": true, className: cn("mt-[1px] text-[14px] leading-none", iconColorClass[t]), children: icon ?? defaultGlyph[t] }),
|
|
2206
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
2207
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "font-medium", children: title }),
|
|
2208
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "text-text-muted mt-[2px] text-[12px]", children: description }),
|
|
1747
2209
|
children
|
|
1748
2210
|
] }),
|
|
1749
|
-
action && /* @__PURE__ */
|
|
2211
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ml-1 shrink-0", children: action })
|
|
1750
2212
|
]
|
|
1751
2213
|
}
|
|
1752
2214
|
);
|
|
1753
2215
|
});
|
|
1754
2216
|
Alert.displayName = "Alert";
|
|
1755
|
-
|
|
1756
|
-
|
|
2217
|
+
|
|
2218
|
+
// src/patterns/Banner/Banner.tsx
|
|
2219
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
2220
|
+
var import_react44 = require("react");
|
|
2221
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2222
|
+
var bannerStyles = (0, import_class_variance_authority9.cva)(
|
|
2223
|
+
"flex items-center gap-3 border-b border-border px-[14px] py-2 text-[12px]",
|
|
1757
2224
|
{
|
|
1758
2225
|
variants: {
|
|
1759
|
-
|
|
1760
|
-
|
|
2226
|
+
tone: {
|
|
2227
|
+
accent: "bg-[color-mix(in_oklab,var(--color-accent),transparent_82%)] text-accent",
|
|
1761
2228
|
ok: "bg-[color-mix(in_oklab,var(--color-ok),transparent_82%)] text-ok",
|
|
1762
2229
|
warn: "bg-[color-mix(in_oklab,var(--color-warn),transparent_82%)] text-warn",
|
|
1763
2230
|
err: "bg-[color-mix(in_oklab,var(--color-err),transparent_82%)] text-err"
|
|
1764
2231
|
},
|
|
1765
2232
|
sticky: {
|
|
1766
|
-
true: "sticky top-0 z-
|
|
2233
|
+
true: "sticky top-0 z-sticky",
|
|
1767
2234
|
false: ""
|
|
1768
2235
|
}
|
|
1769
2236
|
},
|
|
1770
|
-
defaultVariants: {
|
|
2237
|
+
defaultVariants: { tone: "accent", sticky: false }
|
|
1771
2238
|
}
|
|
1772
2239
|
);
|
|
1773
2240
|
var defaultGlyph2 = {
|
|
1774
|
-
|
|
2241
|
+
accent: "\u2726",
|
|
1775
2242
|
ok: "\u2713",
|
|
1776
2243
|
warn: "!",
|
|
1777
2244
|
err: "\xD7"
|
|
1778
2245
|
};
|
|
1779
|
-
var Banner =
|
|
1780
|
-
|
|
2246
|
+
var Banner = (0, import_react44.forwardRef)(function Banner2({ tone = "accent", sticky, icon, action, live = "polite", className, children, ...props }, ref) {
|
|
2247
|
+
const t = tone ?? "accent";
|
|
2248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
1781
2249
|
"div",
|
|
1782
2250
|
{
|
|
1783
2251
|
ref,
|
|
1784
|
-
role:
|
|
1785
|
-
|
|
2252
|
+
role: live === "assertive" ? "alert" : "status",
|
|
2253
|
+
"aria-live": live === "off" ? void 0 : live,
|
|
2254
|
+
className: cn(bannerStyles({ tone, sticky }), className),
|
|
1786
2255
|
...props,
|
|
1787
2256
|
children: [
|
|
1788
|
-
/* @__PURE__ */
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
action && /* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "aria-hidden": true, className: "leading-none", children: icon ?? defaultGlyph2[t] }),
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "min-w-0 flex-1", children }),
|
|
2259
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ml-auto", children: action })
|
|
1791
2260
|
]
|
|
1792
2261
|
}
|
|
1793
2262
|
);
|
|
1794
2263
|
});
|
|
1795
2264
|
Banner.displayName = "Banner";
|
|
1796
|
-
|
|
1797
|
-
|
|
2265
|
+
|
|
2266
|
+
// src/patterns/Breadcrumbs/Breadcrumbs.tsx
|
|
2267
|
+
var import_react45 = require("react");
|
|
2268
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2269
|
+
var Breadcrumbs = (0, import_react45.forwardRef)(function Breadcrumbs2({ separator = "/", className, children, ...props }, ref) {
|
|
2270
|
+
const crumbs = import_react45.Children.toArray(children).filter(import_react45.isValidElement);
|
|
1798
2271
|
const last = crumbs.length - 1;
|
|
1799
|
-
return /* @__PURE__ */
|
|
2272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("nav", { ref, "aria-label": "Breadcrumb", className: cn("text-[13px]", className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("ol", { className: "text-text-muted flex flex-wrap items-center gap-[6px]", children: crumbs.map((crumb, i) => {
|
|
1800
2273
|
const isCurrent = i === last;
|
|
1801
|
-
return /* @__PURE__ */
|
|
1802
|
-
isCurrent ? /* @__PURE__ */
|
|
1803
|
-
!isCurrent && /* @__PURE__ */
|
|
2274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("li", { className: "inline-flex items-center gap-[6px]", children: [
|
|
2275
|
+
isCurrent ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Crumb, { ...crumb.props, current: true }) : crumb,
|
|
2276
|
+
!isCurrent && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "aria-hidden": true, className: "text-text-dim", children: separator })
|
|
1804
2277
|
] }, i);
|
|
1805
2278
|
}) }) });
|
|
1806
2279
|
});
|
|
1807
2280
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
1808
|
-
var Crumb =
|
|
2281
|
+
var Crumb = (0, import_react45.forwardRef)(function Crumb2({ current, className, href, children, ...props }, ref) {
|
|
1809
2282
|
if (current) {
|
|
1810
|
-
return /* @__PURE__ */
|
|
2283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "aria-current": "page", className: cn("text-text", className), children });
|
|
1811
2284
|
}
|
|
1812
|
-
|
|
2285
|
+
if (href === void 0) {
|
|
2286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: cn("text-text-dim", className), children });
|
|
2287
|
+
}
|
|
2288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1813
2289
|
"a",
|
|
1814
2290
|
{
|
|
1815
2291
|
ref,
|
|
1816
|
-
href
|
|
2292
|
+
href,
|
|
1817
2293
|
className: cn("hover:text-text transition-colors duration-(--duration-micro)", className),
|
|
1818
2294
|
...props,
|
|
1819
2295
|
children
|
|
@@ -1821,6 +2297,10 @@ var Crumb = react.forwardRef(function Crumb2({ current, className, href, childre
|
|
|
1821
2297
|
);
|
|
1822
2298
|
});
|
|
1823
2299
|
Crumb.displayName = "Crumb";
|
|
2300
|
+
|
|
2301
|
+
// src/patterns/Combobox/Combobox.tsx
|
|
2302
|
+
var import_react46 = require("react");
|
|
2303
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1824
2304
|
function normalize(option) {
|
|
1825
2305
|
if (typeof option === "string") {
|
|
1826
2306
|
return { value: option, label: option, searchText: option.toLowerCase() };
|
|
@@ -1836,7 +2316,7 @@ function normalize(option) {
|
|
|
1836
2316
|
};
|
|
1837
2317
|
}
|
|
1838
2318
|
var defaultFilter = (option, query) => option.searchText.includes(query.toLowerCase());
|
|
1839
|
-
var Combobox =
|
|
2319
|
+
var Combobox = (0, import_react46.forwardRef)(function Combobox2({
|
|
1840
2320
|
options,
|
|
1841
2321
|
value: valueProp,
|
|
1842
2322
|
defaultValue,
|
|
@@ -1853,16 +2333,16 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1853
2333
|
id,
|
|
1854
2334
|
"aria-label": ariaLabel
|
|
1855
2335
|
}, ref) {
|
|
1856
|
-
const reactId =
|
|
2336
|
+
const reactId = (0, import_react46.useId)();
|
|
1857
2337
|
const listboxId = `${id ?? reactId}-listbox`;
|
|
1858
2338
|
const inputId = id ?? `${reactId}-input`;
|
|
1859
|
-
const normalized =
|
|
2339
|
+
const normalized = (0, import_react46.useMemo)(() => options.map(normalize), [options]);
|
|
1860
2340
|
const [value, setValue] = useControllableState({
|
|
1861
2341
|
value: valueProp,
|
|
1862
2342
|
defaultValue,
|
|
1863
2343
|
onChange: onValueChange
|
|
1864
2344
|
});
|
|
1865
|
-
const initialQuery =
|
|
2345
|
+
const initialQuery = (0, import_react46.useMemo)(() => {
|
|
1866
2346
|
if (defaultQuery !== void 0) return defaultQuery;
|
|
1867
2347
|
if (defaultValue !== void 0) {
|
|
1868
2348
|
const opt = normalized.find((o) => o.value === defaultValue);
|
|
@@ -1875,10 +2355,10 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1875
2355
|
defaultValue: initialQuery,
|
|
1876
2356
|
onChange: onQueryChange
|
|
1877
2357
|
});
|
|
1878
|
-
const [open, setOpen] =
|
|
1879
|
-
const wrapperRef =
|
|
2358
|
+
const [open, setOpen] = (0, import_react46.useState)(false);
|
|
2359
|
+
const wrapperRef = (0, import_react46.useRef)(null);
|
|
1880
2360
|
useOutsideClick(wrapperRef, () => setOpen(false));
|
|
1881
|
-
const filtered =
|
|
2361
|
+
const filtered = (0, import_react46.useMemo)(
|
|
1882
2362
|
() => query ? normalized.filter((o) => filter(o, query)) : normalized,
|
|
1883
2363
|
[normalized, query, filter]
|
|
1884
2364
|
);
|
|
@@ -1890,7 +2370,7 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1890
2370
|
if (item && !item.disabled) commit(item);
|
|
1891
2371
|
}
|
|
1892
2372
|
});
|
|
1893
|
-
|
|
2373
|
+
(0, import_react46.useEffect)(() => {
|
|
1894
2374
|
setCursor(0);
|
|
1895
2375
|
}, [query, setCursor]);
|
|
1896
2376
|
function commit(option) {
|
|
@@ -1913,8 +2393,8 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1913
2393
|
setOpen(false);
|
|
1914
2394
|
}
|
|
1915
2395
|
};
|
|
1916
|
-
return /* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { ref: wrapperRef, className: "relative", style: { width }, children: [
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1918
2398
|
"input",
|
|
1919
2399
|
{
|
|
1920
2400
|
ref,
|
|
@@ -1948,19 +2428,19 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1948
2428
|
)
|
|
1949
2429
|
}
|
|
1950
2430
|
),
|
|
1951
|
-
open && /* @__PURE__ */
|
|
2431
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1952
2432
|
"ul",
|
|
1953
2433
|
{
|
|
1954
2434
|
id: listboxId,
|
|
1955
2435
|
role: "listbox",
|
|
1956
2436
|
"aria-label": ariaLabel ?? "Suggestions",
|
|
1957
2437
|
className: cn(
|
|
1958
|
-
"absolute top-full right-0 left-0
|
|
2438
|
+
"z-dropdown absolute top-full right-0 left-0 mt-1 max-h-[220px] overflow-auto",
|
|
1959
2439
|
"border-border bg-panel rounded-md border p-1 shadow-lg"
|
|
1960
2440
|
),
|
|
1961
|
-
children: filtered.length === 0 ? /* @__PURE__ */
|
|
2441
|
+
children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("li", { className: "text-text-dim px-2 py-3 text-center text-[12px]", role: "presentation", children: emptyState ?? "No matches" }) : filtered.map((option, i) => {
|
|
1962
2442
|
const isActive = i === cursor;
|
|
1963
|
-
return /* @__PURE__ */
|
|
2443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
1964
2444
|
"li",
|
|
1965
2445
|
{
|
|
1966
2446
|
id: `${listboxId}-option-${i}`,
|
|
@@ -1978,8 +2458,8 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1978
2458
|
option.disabled && "pointer-events-none opacity-40"
|
|
1979
2459
|
),
|
|
1980
2460
|
children: [
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
option.description && /* @__PURE__ */
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: option.label }),
|
|
2462
|
+
option.description && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "text-text-dim text-[11px]", children: option.description })
|
|
1983
2463
|
]
|
|
1984
2464
|
},
|
|
1985
2465
|
option.value
|
|
@@ -1987,14 +2467,19 @@ var Combobox = react.forwardRef(function Combobox2({
|
|
|
1987
2467
|
})
|
|
1988
2468
|
}
|
|
1989
2469
|
),
|
|
1990
|
-
name && /* @__PURE__ */
|
|
2470
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "hidden", name, value: value ?? "", readOnly: true })
|
|
1991
2471
|
] });
|
|
1992
2472
|
});
|
|
1993
2473
|
Combobox.displayName = "Combobox";
|
|
2474
|
+
|
|
2475
|
+
// src/patterns/CommandPalette/CommandPalette.tsx
|
|
2476
|
+
var RadixDialog4 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
2477
|
+
var import_react47 = require("react");
|
|
2478
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1994
2479
|
function flatItems(groups) {
|
|
1995
2480
|
return groups.flatMap((g) => g.items);
|
|
1996
2481
|
}
|
|
1997
|
-
var CommandPalette =
|
|
2482
|
+
var CommandPalette = (0, import_react47.forwardRef)(
|
|
1998
2483
|
function CommandPalette2({
|
|
1999
2484
|
open,
|
|
2000
2485
|
onOpenChange,
|
|
@@ -2007,7 +2492,7 @@ var CommandPalette = react.forwardRef(
|
|
|
2007
2492
|
emptyState,
|
|
2008
2493
|
width = 540
|
|
2009
2494
|
}, ref) {
|
|
2010
|
-
const flat =
|
|
2495
|
+
const flat = (0, import_react47.useMemo)(() => flatItems(groups), [groups]);
|
|
2011
2496
|
const { cursor, setCursor, onKeyDown } = useKeyboardList({
|
|
2012
2497
|
count: flat.length,
|
|
2013
2498
|
defaultCursor: 0,
|
|
@@ -2016,37 +2501,41 @@ var CommandPalette = react.forwardRef(
|
|
|
2016
2501
|
if (item) onSelect(item.id);
|
|
2017
2502
|
}
|
|
2018
2503
|
});
|
|
2019
|
-
|
|
2504
|
+
const reactId = (0, import_react47.useId)();
|
|
2505
|
+
const listboxId = `${reactId}-listbox`;
|
|
2506
|
+
const optionId = (i) => `${listboxId}-option-${i}`;
|
|
2507
|
+
const hasMatches = flat.length > 0;
|
|
2508
|
+
(0, import_react47.useEffect)(() => {
|
|
2020
2509
|
setCursor(0);
|
|
2021
2510
|
}, [query, groups, setCursor]);
|
|
2022
|
-
return /* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
|
|
2511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RadixDialog4.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(RadixDialog4.Portal, { children: [
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2513
|
+
RadixDialog4.Overlay,
|
|
2025
2514
|
{
|
|
2026
2515
|
className: cn(
|
|
2027
|
-
"fixed inset-0
|
|
2516
|
+
"z-overlay fixed inset-0 bg-black/55 backdrop-blur-[4px]",
|
|
2028
2517
|
"data-[state=open]:animate-[ship-fade-in_150ms_ease]"
|
|
2029
2518
|
)
|
|
2030
2519
|
}
|
|
2031
2520
|
),
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2522
|
+
RadixDialog4.Content,
|
|
2034
2523
|
{
|
|
2035
2524
|
ref,
|
|
2036
2525
|
"aria-label": "Command palette",
|
|
2037
2526
|
"aria-describedby": void 0,
|
|
2038
2527
|
style: { width },
|
|
2039
2528
|
className: cn(
|
|
2040
|
-
"fixed top-[20%] left-1/2
|
|
2529
|
+
"z-modal fixed top-[20%] left-1/2 max-w-[calc(100%-40px)] -translate-x-1/2",
|
|
2041
2530
|
"border-border-strong bg-panel overflow-hidden rounded-xl border shadow-lg",
|
|
2042
2531
|
"outline-none data-[state=open]:animate-[ship-dialog-in_180ms_var(--easing-out)]"
|
|
2043
2532
|
),
|
|
2044
2533
|
onKeyDown,
|
|
2045
2534
|
children: [
|
|
2046
|
-
/* @__PURE__ */
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RadixDialog4.Title, { className: "sr-only", children: "Command palette" }),
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "border-border flex items-center gap-[10px] border-b px-4 py-[14px]", children: [
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { "aria-hidden": true, className: "text-text-dim", children: "\u2315" }),
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2050
2539
|
"input",
|
|
2051
2540
|
{
|
|
2052
2541
|
autoFocus: true,
|
|
@@ -2055,22 +2544,27 @@ var CommandPalette = react.forwardRef(
|
|
|
2055
2544
|
onChange: (e) => onQueryChange(e.target.value),
|
|
2056
2545
|
placeholder,
|
|
2057
2546
|
"aria-label": "Search",
|
|
2547
|
+
role: "combobox",
|
|
2058
2548
|
"aria-autocomplete": "list",
|
|
2549
|
+
"aria-expanded": true,
|
|
2550
|
+
"aria-controls": listboxId,
|
|
2551
|
+
"aria-activedescendant": hasMatches ? optionId(cursor) : void 0,
|
|
2059
2552
|
className: "text-text placeholder:text-text-dim flex-1 border-0 bg-transparent text-[14px] outline-none"
|
|
2060
2553
|
}
|
|
2061
2554
|
),
|
|
2062
|
-
/* @__PURE__ */
|
|
2555
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "border-border text-text-dim rounded-xs border px-[6px] py-[2px] font-mono text-[10px]", children: "ESC" })
|
|
2063
2556
|
] }),
|
|
2064
|
-
/* @__PURE__ */
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { id: listboxId, className: "min-h-[220px] p-2", role: "listbox", "aria-label": "Results", children: flat.length === 0 ? emptyState ?? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-text-dim px-3 py-5 text-center text-[12px]", children: "No matches" }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2065
2558
|
CommandGroups,
|
|
2066
2559
|
{
|
|
2067
2560
|
groups,
|
|
2068
2561
|
cursor,
|
|
2069
2562
|
setCursor,
|
|
2070
|
-
onSelect
|
|
2563
|
+
onSelect,
|
|
2564
|
+
optionId
|
|
2071
2565
|
}
|
|
2072
2566
|
) }),
|
|
2073
|
-
footer && /* @__PURE__ */
|
|
2567
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-border text-text-dim flex gap-4 border-t px-[14px] py-[10px] font-mono text-[10px]", children: footer })
|
|
2074
2568
|
]
|
|
2075
2569
|
}
|
|
2076
2570
|
)
|
|
@@ -2078,12 +2572,12 @@ var CommandPalette = react.forwardRef(
|
|
|
2078
2572
|
}
|
|
2079
2573
|
);
|
|
2080
2574
|
CommandPalette.displayName = "CommandPalette";
|
|
2081
|
-
function CommandGroups({ groups, cursor, setCursor, onSelect }) {
|
|
2575
|
+
function CommandGroups({ groups, cursor, setCursor, onSelect, optionId }) {
|
|
2082
2576
|
let runningIndex = 0;
|
|
2083
|
-
return /* @__PURE__ */
|
|
2577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children: groups.map((group, gIdx) => {
|
|
2084
2578
|
if (group.items.length === 0) return null;
|
|
2085
|
-
return /* @__PURE__ */
|
|
2086
|
-
group.label && /* @__PURE__ */
|
|
2579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
2580
|
+
group.label && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "text-text-dim px-2 pt-2 pb-1 font-mono text-[9px] tracking-[1.4px] uppercase", children: [
|
|
2087
2581
|
group.label,
|
|
2088
2582
|
" \xB7 ",
|
|
2089
2583
|
group.items.length
|
|
@@ -2091,9 +2585,10 @@ function CommandGroups({ groups, cursor, setCursor, onSelect }) {
|
|
|
2091
2585
|
group.items.map((item) => {
|
|
2092
2586
|
const myIndex = runningIndex++;
|
|
2093
2587
|
const isActive = cursor === myIndex;
|
|
2094
|
-
return /* @__PURE__ */
|
|
2588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2095
2589
|
"button",
|
|
2096
2590
|
{
|
|
2591
|
+
id: optionId(myIndex),
|
|
2097
2592
|
type: "button",
|
|
2098
2593
|
role: "option",
|
|
2099
2594
|
"aria-selected": isActive,
|
|
@@ -2104,7 +2599,7 @@ function CommandGroups({ groups, cursor, setCursor, onSelect }) {
|
|
|
2104
2599
|
isActive ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2"
|
|
2105
2600
|
),
|
|
2106
2601
|
children: [
|
|
2107
|
-
item.glyph != null && /* @__PURE__ */
|
|
2602
|
+
item.glyph != null && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2108
2603
|
"span",
|
|
2109
2604
|
{
|
|
2110
2605
|
"aria-hidden": true,
|
|
@@ -2115,11 +2610,11 @@ function CommandGroups({ groups, cursor, setCursor, onSelect }) {
|
|
|
2115
2610
|
children: item.glyph
|
|
2116
2611
|
}
|
|
2117
2612
|
),
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2120
|
-
item.description && /* @__PURE__ */
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "block truncate text-[13px]", children: item.label }),
|
|
2615
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-text-dim block truncate text-[11px]", children: item.description })
|
|
2121
2616
|
] }),
|
|
2122
|
-
item.trailing && /* @__PURE__ */
|
|
2617
|
+
item.trailing && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: item.trailing })
|
|
2123
2618
|
]
|
|
2124
2619
|
},
|
|
2125
2620
|
item.id
|
|
@@ -2139,11 +2634,16 @@ function filterCommandItems(query, groups) {
|
|
|
2139
2634
|
})
|
|
2140
2635
|
})).filter((g) => g.items.length > 0);
|
|
2141
2636
|
}
|
|
2637
|
+
|
|
2638
|
+
// src/patterns/DataTable/DataTable.tsx
|
|
2639
|
+
var import_react48 = require("react");
|
|
2640
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2142
2641
|
var alignClass = {
|
|
2143
2642
|
left: "text-left",
|
|
2144
2643
|
right: "text-right",
|
|
2145
2644
|
center: "text-center"
|
|
2146
2645
|
};
|
|
2646
|
+
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
2147
2647
|
function DataTable(props) {
|
|
2148
2648
|
const {
|
|
2149
2649
|
data,
|
|
@@ -2168,16 +2668,16 @@ function DataTable(props) {
|
|
|
2168
2668
|
onChange: onSortChange
|
|
2169
2669
|
});
|
|
2170
2670
|
const [selected, setSelected] = useControllableState({
|
|
2171
|
-
value: selectedProp
|
|
2671
|
+
value: selectedProp,
|
|
2172
2672
|
defaultValue: new Set(defaultSelected ?? []),
|
|
2173
2673
|
onChange: onSelectionChange
|
|
2174
2674
|
});
|
|
2175
|
-
const sortableMap =
|
|
2675
|
+
const sortableMap = (0, import_react48.useMemo)(() => {
|
|
2176
2676
|
const m = /* @__PURE__ */ new Map();
|
|
2177
2677
|
for (const c of columns) if (c.accessor) m.set(c.key, c);
|
|
2178
2678
|
return m;
|
|
2179
2679
|
}, [columns]);
|
|
2180
|
-
const sortedData =
|
|
2680
|
+
const sortedData = (0, import_react48.useMemo)(() => {
|
|
2181
2681
|
if (!sort) return [...data];
|
|
2182
2682
|
const col = sortableMap.get(sort.key);
|
|
2183
2683
|
if (!col || !col.accessor) return [...data];
|
|
@@ -2189,11 +2689,12 @@ function DataTable(props) {
|
|
|
2189
2689
|
return String(av).localeCompare(String(bv)) * factor;
|
|
2190
2690
|
});
|
|
2191
2691
|
}, [data, sort, sortableMap]);
|
|
2192
|
-
const allIds =
|
|
2193
|
-
const
|
|
2194
|
-
const
|
|
2195
|
-
const
|
|
2196
|
-
|
|
2692
|
+
const allIds = (0, import_react48.useMemo)(() => sortedData.map(rowKey), [sortedData, rowKey]);
|
|
2693
|
+
const selectedSet = selected ?? EMPTY_SET;
|
|
2694
|
+
const allSelected = allIds.length > 0 && allIds.every((id) => selectedSet.has(id));
|
|
2695
|
+
const someSelected = !allSelected && allIds.some((id) => selectedSet.has(id));
|
|
2696
|
+
const headerCheckRef = (0, import_react48.useRef)(null);
|
|
2697
|
+
(0, import_react48.useEffect)(() => {
|
|
2197
2698
|
if (headerCheckRef.current) headerCheckRef.current.indeterminate = someSelected;
|
|
2198
2699
|
}, [someSelected]);
|
|
2199
2700
|
const toggleSort = (key) => {
|
|
@@ -2224,10 +2725,10 @@ function DataTable(props) {
|
|
|
2224
2725
|
return next;
|
|
2225
2726
|
});
|
|
2226
2727
|
};
|
|
2227
|
-
return /* @__PURE__ */
|
|
2228
|
-
caption && /* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
selectable && /* @__PURE__ */
|
|
2728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("table", { ref, className: cn("w-full border-collapse text-[12px]", className), children: [
|
|
2729
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("caption", { className: "sr-only", children: caption }),
|
|
2730
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("thead", { className: cn("bg-panel-2", stickyHeader && "z-raised sticky top-0"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tr", { children: [
|
|
2731
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("th", { scope: "col", className: "border-border w-8 border-b px-3 py-2 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2231
2732
|
"input",
|
|
2232
2733
|
{
|
|
2233
2734
|
ref: headerCheckRef,
|
|
@@ -2243,12 +2744,12 @@ function DataTable(props) {
|
|
|
2243
2744
|
const isSorted = sort?.key === col.key;
|
|
2244
2745
|
const ariaSort = !sortable ? void 0 : isSorted ? sort?.direction === "asc" ? "ascending" : "descending" : "none";
|
|
2245
2746
|
const align = col.align ?? "left";
|
|
2246
|
-
|
|
2747
|
+
const indicator = sortable && isSorted && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "aria-hidden": true, className: "ml-1", children: sort?.direction === "asc" ? "\u2191" : "\u2193" });
|
|
2748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2247
2749
|
"th",
|
|
2248
2750
|
{
|
|
2249
2751
|
scope: "col",
|
|
2250
2752
|
"aria-sort": ariaSort,
|
|
2251
|
-
onClick: sortable ? () => toggleSort(col.key) : void 0,
|
|
2252
2753
|
style: col.width != null ? { width: col.width } : void 0,
|
|
2253
2754
|
className: cn(
|
|
2254
2755
|
"border-border border-b px-3 py-2 font-mono text-[10px] font-medium tracking-[1.4px] uppercase select-none",
|
|
@@ -2256,17 +2757,25 @@ function DataTable(props) {
|
|
|
2256
2757
|
sortable && "cursor-pointer",
|
|
2257
2758
|
isSorted ? "text-accent" : "text-text-dim"
|
|
2258
2759
|
),
|
|
2259
|
-
children:
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2760
|
+
children: sortable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2761
|
+
"button",
|
|
2762
|
+
{
|
|
2763
|
+
type: "button",
|
|
2764
|
+
onClick: () => toggleSort(col.key),
|
|
2765
|
+
className: "focus-visible:ring-accent-dim inline-flex cursor-pointer items-center gap-1 font-mono text-[10px] font-medium tracking-[1.4px] uppercase outline-none focus-visible:ring-[3px]",
|
|
2766
|
+
children: [
|
|
2767
|
+
col.header,
|
|
2768
|
+
indicator
|
|
2769
|
+
]
|
|
2770
|
+
}
|
|
2771
|
+
) : col.header
|
|
2263
2772
|
},
|
|
2264
2773
|
col.key
|
|
2265
2774
|
);
|
|
2266
2775
|
})
|
|
2267
2776
|
] }) }),
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
sortedData.length === 0 && /* @__PURE__ */
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("tbody", { children: [
|
|
2778
|
+
sortedData.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2270
2779
|
"td",
|
|
2271
2780
|
{
|
|
2272
2781
|
colSpan: columns.length + (selectable ? 1 : 0),
|
|
@@ -2276,8 +2785,8 @@ function DataTable(props) {
|
|
|
2276
2785
|
) }),
|
|
2277
2786
|
sortedData.map((row) => {
|
|
2278
2787
|
const id = rowKey(row);
|
|
2279
|
-
const isSelected =
|
|
2280
|
-
return /* @__PURE__ */
|
|
2788
|
+
const isSelected = selectedSet.has(id);
|
|
2789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2281
2790
|
"tr",
|
|
2282
2791
|
{
|
|
2283
2792
|
"data-state": isSelected ? "selected" : void 0,
|
|
@@ -2286,7 +2795,7 @@ function DataTable(props) {
|
|
|
2286
2795
|
isSelected ? "bg-accent-dim/50" : "hover:bg-panel-2"
|
|
2287
2796
|
),
|
|
2288
2797
|
children: [
|
|
2289
|
-
selectable && /* @__PURE__ */
|
|
2798
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("td", { className: "px-3 py-[10px]", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2290
2799
|
"input",
|
|
2291
2800
|
{
|
|
2292
2801
|
type: "checkbox",
|
|
@@ -2296,7 +2805,7 @@ function DataTable(props) {
|
|
|
2296
2805
|
className: "cursor-pointer accent-[var(--color-accent)]"
|
|
2297
2806
|
}
|
|
2298
2807
|
) }),
|
|
2299
|
-
columns.map((col) => /* @__PURE__ */
|
|
2808
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("td", { className: cn("px-3 py-[10px]", alignClass[col.align ?? "left"]), children: col.cell ? col.cell(row) : col.accessor ? String(col.accessor(row)) : null }, col.key))
|
|
2300
2809
|
]
|
|
2301
2810
|
},
|
|
2302
2811
|
id
|
|
@@ -2305,29 +2814,24 @@ function DataTable(props) {
|
|
|
2305
2814
|
] })
|
|
2306
2815
|
] });
|
|
2307
2816
|
}
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
"May",
|
|
2314
|
-
"June",
|
|
2315
|
-
"July",
|
|
2316
|
-
"Aug",
|
|
2317
|
-
"Sep",
|
|
2318
|
-
"Oct",
|
|
2319
|
-
"Nov",
|
|
2320
|
-
"Dec"
|
|
2321
|
-
];
|
|
2817
|
+
|
|
2818
|
+
// src/patterns/DatePicker/Calendar.tsx
|
|
2819
|
+
var import_react49 = require("react");
|
|
2820
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2821
|
+
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
2322
2822
|
var DAYS = ["S", "M", "T", "W", "T", "F", "S"];
|
|
2323
2823
|
function isSameDay(a, b) {
|
|
2324
2824
|
if (!a) return false;
|
|
2325
2825
|
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2326
2826
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2827
|
+
function clampDay(year, month, day) {
|
|
2828
|
+
const max = new Date(year, month + 1, 0).getDate();
|
|
2829
|
+
return Math.min(Math.max(1, day), max);
|
|
2830
|
+
}
|
|
2831
|
+
var Calendar = (0, import_react49.forwardRef)(function Calendar2({
|
|
2832
|
+
value,
|
|
2833
|
+
defaultValue,
|
|
2834
|
+
onValueChange,
|
|
2331
2835
|
month: monthProp,
|
|
2332
2836
|
year: yearProp,
|
|
2333
2837
|
defaultMonth,
|
|
@@ -2337,39 +2841,125 @@ var Calendar = react.forwardRef(function Calendar2({
|
|
|
2337
2841
|
className,
|
|
2338
2842
|
...props
|
|
2339
2843
|
}, ref) {
|
|
2340
|
-
const today = /* @__PURE__ */ new Date();
|
|
2844
|
+
const [today] = (0, import_react49.useState)(() => /* @__PURE__ */ new Date());
|
|
2845
|
+
const [hydrated, setHydrated] = (0, import_react49.useState)(false);
|
|
2846
|
+
(0, import_react49.useEffect)(() => setHydrated(true), []);
|
|
2341
2847
|
const [selectedDate, setSelectedDate] = useControllableState({
|
|
2342
|
-
value
|
|
2343
|
-
defaultValue
|
|
2344
|
-
onChange:
|
|
2848
|
+
value,
|
|
2849
|
+
defaultValue,
|
|
2850
|
+
onChange: onValueChange
|
|
2345
2851
|
});
|
|
2346
|
-
const initialMonth = defaultMonth ??
|
|
2347
|
-
const initialYear = defaultYear ??
|
|
2348
|
-
const [internalMonth, setInternalMonth] =
|
|
2349
|
-
const [internalYear, setInternalYear] =
|
|
2852
|
+
const initialMonth = defaultMonth ?? defaultValue?.getMonth() ?? today.getMonth();
|
|
2853
|
+
const initialYear = defaultYear ?? defaultValue?.getFullYear() ?? today.getFullYear();
|
|
2854
|
+
const [internalMonth, setInternalMonth] = (0, import_react49.useState)(initialMonth);
|
|
2855
|
+
const [internalYear, setInternalYear] = (0, import_react49.useState)(initialYear);
|
|
2350
2856
|
const month = monthProp ?? internalMonth;
|
|
2351
2857
|
const year = yearProp ?? internalYear;
|
|
2352
2858
|
const isControlled = monthProp !== void 0 && yearProp !== void 0;
|
|
2353
|
-
const setVisible = (
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2859
|
+
const setVisible = (0, import_react49.useCallback)(
|
|
2860
|
+
(m, y) => {
|
|
2861
|
+
if (!isControlled) {
|
|
2862
|
+
setInternalMonth(m);
|
|
2863
|
+
setInternalYear(y);
|
|
2864
|
+
}
|
|
2865
|
+
onVisibleMonthChange?.({ month: m, year: y });
|
|
2866
|
+
},
|
|
2867
|
+
[isControlled, onVisibleMonthChange]
|
|
2868
|
+
);
|
|
2869
|
+
const goPrev = (0, import_react49.useCallback)(() => {
|
|
2361
2870
|
const m = month === 0 ? 11 : month - 1;
|
|
2362
2871
|
const y = month === 0 ? year - 1 : year;
|
|
2363
2872
|
setVisible(m, y);
|
|
2364
|
-
};
|
|
2365
|
-
const goNext = () => {
|
|
2873
|
+
}, [month, year, setVisible]);
|
|
2874
|
+
const goNext = (0, import_react49.useCallback)(() => {
|
|
2366
2875
|
const m = month === 11 ? 0 : month + 1;
|
|
2367
2876
|
const y = month === 11 ? year + 1 : year;
|
|
2368
2877
|
setVisible(m, y);
|
|
2369
|
-
};
|
|
2878
|
+
}, [month, year, setVisible]);
|
|
2370
2879
|
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
2371
2880
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
2372
|
-
|
|
2881
|
+
const [focusedDate, setFocusedDate] = (0, import_react49.useState)(() => {
|
|
2882
|
+
if (selectedDate) return selectedDate;
|
|
2883
|
+
return new Date(initialYear, initialMonth, 1);
|
|
2884
|
+
});
|
|
2885
|
+
(0, import_react49.useEffect)(() => {
|
|
2886
|
+
if (selectedDate) setFocusedDate(selectedDate);
|
|
2887
|
+
}, [selectedDate]);
|
|
2888
|
+
const focusedInVisibleMonth = focusedDate.getMonth() === month && focusedDate.getFullYear() === year;
|
|
2889
|
+
const effectiveFocusDay = focusedInVisibleMonth ? focusedDate.getDate() : clampDay(year, month, focusedDate.getDate());
|
|
2890
|
+
const dayRefs = (0, import_react49.useRef)(/* @__PURE__ */ new Map());
|
|
2891
|
+
const shouldFocusRef = (0, import_react49.useRef)(false);
|
|
2892
|
+
(0, import_react49.useEffect)(() => {
|
|
2893
|
+
if (!shouldFocusRef.current) return;
|
|
2894
|
+
shouldFocusRef.current = false;
|
|
2895
|
+
const node = dayRefs.current.get(effectiveFocusDay);
|
|
2896
|
+
node?.focus();
|
|
2897
|
+
}, [effectiveFocusDay, month, year]);
|
|
2898
|
+
const moveFocus = (0, import_react49.useCallback)(
|
|
2899
|
+
(next) => {
|
|
2900
|
+
setFocusedDate(next);
|
|
2901
|
+
shouldFocusRef.current = true;
|
|
2902
|
+
const nextMonth = next.getMonth();
|
|
2903
|
+
const nextYear = next.getFullYear();
|
|
2904
|
+
if (nextMonth !== month || nextYear !== year) {
|
|
2905
|
+
setVisible(nextMonth, nextYear);
|
|
2906
|
+
}
|
|
2907
|
+
},
|
|
2908
|
+
[month, year, setVisible]
|
|
2909
|
+
);
|
|
2910
|
+
const onCellKeyDown = (0, import_react49.useCallback)(
|
|
2911
|
+
(e, day) => {
|
|
2912
|
+
const current = new Date(year, month, day);
|
|
2913
|
+
let next = null;
|
|
2914
|
+
let handled = true;
|
|
2915
|
+
switch (e.key) {
|
|
2916
|
+
case "ArrowLeft":
|
|
2917
|
+
next = new Date(year, month, day - 1);
|
|
2918
|
+
break;
|
|
2919
|
+
case "ArrowRight":
|
|
2920
|
+
next = new Date(year, month, day + 1);
|
|
2921
|
+
break;
|
|
2922
|
+
case "ArrowUp":
|
|
2923
|
+
next = new Date(year, month, day - 7);
|
|
2924
|
+
break;
|
|
2925
|
+
case "ArrowDown":
|
|
2926
|
+
next = new Date(year, month, day + 7);
|
|
2927
|
+
break;
|
|
2928
|
+
case "Home": {
|
|
2929
|
+
const dow = current.getDay();
|
|
2930
|
+
next = new Date(year, month, day - dow);
|
|
2931
|
+
break;
|
|
2932
|
+
}
|
|
2933
|
+
case "End": {
|
|
2934
|
+
const dow = current.getDay();
|
|
2935
|
+
next = new Date(year, month, day + (6 - dow));
|
|
2936
|
+
break;
|
|
2937
|
+
}
|
|
2938
|
+
case "PageUp": {
|
|
2939
|
+
const targetMonth = month === 0 ? 11 : month - 1;
|
|
2940
|
+
const targetYear = month === 0 ? year - 1 : year;
|
|
2941
|
+
const targetDay = clampDay(targetYear, targetMonth, day);
|
|
2942
|
+
next = new Date(targetYear, targetMonth, targetDay);
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2945
|
+
case "PageDown": {
|
|
2946
|
+
const targetMonth = month === 11 ? 0 : month + 1;
|
|
2947
|
+
const targetYear = month === 11 ? year + 1 : year;
|
|
2948
|
+
const targetDay = clampDay(targetYear, targetMonth, day);
|
|
2949
|
+
next = new Date(targetYear, targetMonth, targetDay);
|
|
2950
|
+
break;
|
|
2951
|
+
}
|
|
2952
|
+
default:
|
|
2953
|
+
handled = false;
|
|
2954
|
+
}
|
|
2955
|
+
if (handled && next) {
|
|
2956
|
+
e.preventDefault();
|
|
2957
|
+
moveFocus(next);
|
|
2958
|
+
}
|
|
2959
|
+
},
|
|
2960
|
+
[month, year, moveFocus]
|
|
2961
|
+
);
|
|
2962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2373
2963
|
"div",
|
|
2374
2964
|
{
|
|
2375
2965
|
ref,
|
|
@@ -2381,14 +2971,14 @@ var Calendar = react.forwardRef(function Calendar2({
|
|
|
2381
2971
|
),
|
|
2382
2972
|
...props,
|
|
2383
2973
|
children: [
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "text-[13px] font-medium", "aria-live": "polite", children: [
|
|
2386
2976
|
MONTHS[month],
|
|
2387
2977
|
" ",
|
|
2388
2978
|
year
|
|
2389
2979
|
] }),
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex gap-1", children: [
|
|
2981
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2392
2982
|
IconButton,
|
|
2393
2983
|
{
|
|
2394
2984
|
size: "sm",
|
|
@@ -2398,48 +2988,89 @@ var Calendar = react.forwardRef(function Calendar2({
|
|
|
2398
2988
|
onClick: goPrev
|
|
2399
2989
|
}
|
|
2400
2990
|
),
|
|
2401
|
-
/* @__PURE__ */
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(IconButton, { size: "sm", variant: "ghost", icon: "\u203A", "aria-label": "Next month", onClick: goNext })
|
|
2402
2992
|
] })
|
|
2403
2993
|
] }),
|
|
2404
|
-
/* @__PURE__ */
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
"
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
)
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { role: "grid", "aria-label": `${MONTHS[month]} ${year}`, className: "flex flex-col gap-[2px]", children: [
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { role: "row", className: "grid grid-cols-7 gap-[2px]", children: DAYS.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2996
|
+
"div",
|
|
2997
|
+
{
|
|
2998
|
+
role: "columnheader",
|
|
2999
|
+
"aria-label": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][i],
|
|
3000
|
+
className: "text-text-dim p-1 text-center font-mono text-[10px]",
|
|
3001
|
+
children: d
|
|
3002
|
+
},
|
|
3003
|
+
i
|
|
3004
|
+
)) }),
|
|
3005
|
+
(() => {
|
|
3006
|
+
const totalCells = firstDayOfMonth + daysInMonth;
|
|
3007
|
+
const rowCount = Math.ceil(totalCells / 7);
|
|
3008
|
+
const rows = [];
|
|
3009
|
+
for (let r = 0; r < rowCount; r++) {
|
|
3010
|
+
const cells = [];
|
|
3011
|
+
for (let c = 0; c < 7; c++) {
|
|
3012
|
+
const cellIndex = r * 7 + c;
|
|
3013
|
+
const dayNum = cellIndex - firstDayOfMonth + 1;
|
|
3014
|
+
if (dayNum < 1 || dayNum > daysInMonth) {
|
|
3015
|
+
cells.push(/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { role: "gridcell", "aria-hidden": true }, `pad-${r}-${c}`));
|
|
3016
|
+
continue;
|
|
3017
|
+
}
|
|
3018
|
+
const date = new Date(year, month, dayNum);
|
|
3019
|
+
const isSelected = isSameDay(selectedDate, date);
|
|
3020
|
+
const isToday = hydrated && isSameDay(today, date);
|
|
3021
|
+
const disabled = isDateDisabled?.(date) ?? false;
|
|
3022
|
+
const isFocused = dayNum === effectiveFocusDay;
|
|
3023
|
+
const day = dayNum;
|
|
3024
|
+
cells.push(
|
|
3025
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { role: "gridcell", "aria-selected": isSelected, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3026
|
+
"button",
|
|
3027
|
+
{
|
|
3028
|
+
ref: (node) => {
|
|
3029
|
+
if (node) dayRefs.current.set(day, node);
|
|
3030
|
+
else dayRefs.current.delete(day);
|
|
3031
|
+
},
|
|
3032
|
+
type: "button",
|
|
3033
|
+
disabled,
|
|
3034
|
+
"aria-current": isToday ? "date" : void 0,
|
|
3035
|
+
"aria-label": date.toDateString(),
|
|
3036
|
+
tabIndex: isFocused ? 0 : -1,
|
|
3037
|
+
onClick: () => {
|
|
3038
|
+
setSelectedDate(date);
|
|
3039
|
+
setFocusedDate(date);
|
|
3040
|
+
},
|
|
3041
|
+
onKeyDown: (e) => onCellKeyDown(e, day),
|
|
3042
|
+
className: cn(
|
|
3043
|
+
"w-full cursor-pointer rounded-xs border-0 bg-transparent py-[6px] text-center text-[12px] outline-none",
|
|
3044
|
+
"focus-visible:ring-accent-dim focus-visible:ring-[3px]",
|
|
3045
|
+
"disabled:cursor-not-allowed disabled:opacity-30",
|
|
3046
|
+
!isSelected && !disabled && "text-text hover:bg-panel-2",
|
|
3047
|
+
isSelected && "bg-accent text-on-accent font-semibold",
|
|
3048
|
+
!isSelected && isToday && "border-border-strong border"
|
|
3049
|
+
),
|
|
3050
|
+
children: day
|
|
3051
|
+
}
|
|
3052
|
+
) }, day)
|
|
3053
|
+
);
|
|
3054
|
+
}
|
|
3055
|
+
rows.push(
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { role: "row", className: "grid grid-cols-7 gap-[2px]", children: cells }, `row-${r}`)
|
|
3057
|
+
);
|
|
3058
|
+
}
|
|
3059
|
+
return rows;
|
|
3060
|
+
})()
|
|
2435
3061
|
] })
|
|
2436
3062
|
]
|
|
2437
3063
|
}
|
|
2438
3064
|
);
|
|
2439
3065
|
});
|
|
2440
3066
|
Calendar.displayName = "Calendar";
|
|
3067
|
+
|
|
3068
|
+
// src/patterns/DatePicker/DatePicker.tsx
|
|
3069
|
+
var RadixPopover2 = __toESM(require("@radix-ui/react-popover"), 1);
|
|
3070
|
+
var import_react50 = require("react");
|
|
3071
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2441
3072
|
var defaultFormat = (d) => d.toLocaleDateString();
|
|
2442
|
-
var DatePicker =
|
|
3073
|
+
var DatePicker = (0, import_react50.forwardRef)(function DatePicker2({
|
|
2443
3074
|
value: valueProp,
|
|
2444
3075
|
defaultValue,
|
|
2445
3076
|
onValueChange,
|
|
@@ -2453,14 +3084,14 @@ var DatePicker = react.forwardRef(function DatePicker2({
|
|
|
2453
3084
|
id,
|
|
2454
3085
|
name
|
|
2455
3086
|
}, ref) {
|
|
2456
|
-
const [open, setOpen] =
|
|
3087
|
+
const [open, setOpen] = (0, import_react50.useState)(false);
|
|
2457
3088
|
const [value, setValue] = useControllableState({
|
|
2458
3089
|
value: valueProp,
|
|
2459
3090
|
defaultValue,
|
|
2460
3091
|
onChange: onValueChange
|
|
2461
3092
|
});
|
|
2462
|
-
return /* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
3093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(RadixPopover2.Root, { open, onOpenChange: setOpen, children: [
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RadixPopover2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
2464
3095
|
"button",
|
|
2465
3096
|
{
|
|
2466
3097
|
ref,
|
|
@@ -2477,24 +3108,24 @@ var DatePicker = react.forwardRef(function DatePicker2({
|
|
|
2477
3108
|
),
|
|
2478
3109
|
style: { width },
|
|
2479
3110
|
children: [
|
|
2480
|
-
/* @__PURE__ */
|
|
2481
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { "aria-hidden": true, className: "text-text-dim", children: "\u25A2" }),
|
|
3112
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: cn("flex-1 truncate", !value && "text-text-dim"), children: value ? format(value) : emptyLabel ?? placeholder })
|
|
2482
3113
|
]
|
|
2483
3114
|
}
|
|
2484
3115
|
) }),
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
-
|
|
3116
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(RadixPopover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3117
|
+
RadixPopover2.Content,
|
|
2487
3118
|
{
|
|
2488
3119
|
align: "start",
|
|
2489
3120
|
sideOffset: 6,
|
|
2490
|
-
className: "z-
|
|
2491
|
-
children: /* @__PURE__ */
|
|
3121
|
+
className: "z-popover outline-none data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
3122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2492
3123
|
Calendar,
|
|
2493
3124
|
{
|
|
2494
|
-
|
|
3125
|
+
value,
|
|
2495
3126
|
defaultMonth: value?.getMonth(),
|
|
2496
3127
|
defaultYear: value?.getFullYear(),
|
|
2497
|
-
|
|
3128
|
+
onValueChange: (date) => {
|
|
2498
3129
|
setValue(date);
|
|
2499
3130
|
setOpen(false);
|
|
2500
3131
|
},
|
|
@@ -2503,13 +3134,17 @@ var DatePicker = react.forwardRef(function DatePicker2({
|
|
|
2503
3134
|
)
|
|
2504
3135
|
}
|
|
2505
3136
|
) }),
|
|
2506
|
-
name && /* @__PURE__ */
|
|
3137
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { type: "hidden", name, value: value ? value.toISOString() : "", readOnly: true })
|
|
2507
3138
|
] });
|
|
2508
3139
|
});
|
|
2509
3140
|
DatePicker.displayName = "DatePicker";
|
|
2510
|
-
|
|
3141
|
+
|
|
3142
|
+
// src/patterns/Dots/Dots.tsx
|
|
3143
|
+
var import_react51 = require("react");
|
|
3144
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3145
|
+
var Dots = (0, import_react51.forwardRef)(function Dots2({ total, current, onChange, className, "aria-label": ariaLabel = "Progress", ...props }, ref) {
|
|
2511
3146
|
const interactive = typeof onChange === "function";
|
|
2512
|
-
return /* @__PURE__ */
|
|
3147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2513
3148
|
"nav",
|
|
2514
3149
|
{
|
|
2515
3150
|
ref,
|
|
@@ -2523,7 +3158,7 @@ var Dots = react.forwardRef(function Dots2({ total, current, onChange, className
|
|
|
2523
3158
|
isActive ? "w-[18px] bg-accent" : "w-[6px] bg-panel-2"
|
|
2524
3159
|
);
|
|
2525
3160
|
if (interactive) {
|
|
2526
|
-
return /* @__PURE__ */
|
|
3161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2527
3162
|
"button",
|
|
2528
3163
|
{
|
|
2529
3164
|
type: "button",
|
|
@@ -2540,24 +3175,31 @@ var Dots = react.forwardRef(function Dots2({ total, current, onChange, className
|
|
|
2540
3175
|
i
|
|
2541
3176
|
);
|
|
2542
3177
|
}
|
|
2543
|
-
return /* @__PURE__ */
|
|
3178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": true, className: sharedClass }, i);
|
|
2544
3179
|
})
|
|
2545
3180
|
}
|
|
2546
3181
|
);
|
|
2547
3182
|
});
|
|
2548
3183
|
Dots.displayName = "Dots";
|
|
2549
|
-
|
|
3184
|
+
|
|
3185
|
+
// src/patterns/EmptyState/EmptyState.tsx
|
|
3186
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
3187
|
+
var import_react52 = require("react");
|
|
3188
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3189
|
+
var plateStyles = (0, import_class_variance_authority10.cva)("grid h-12 w-12 place-items-center rounded-base text-[22px]", {
|
|
2550
3190
|
variants: {
|
|
2551
3191
|
tone: {
|
|
3192
|
+
neutral: "bg-panel-2 text-text-muted",
|
|
2552
3193
|
accent: "bg-accent-dim text-accent",
|
|
2553
|
-
|
|
2554
|
-
|
|
3194
|
+
ok: "bg-[color-mix(in_oklab,var(--color-ok),transparent_85%)] text-ok",
|
|
3195
|
+
warn: "bg-[color-mix(in_oklab,var(--color-warn),transparent_85%)] text-warn",
|
|
3196
|
+
err: "bg-[color-mix(in_oklab,var(--color-err),transparent_85%)] text-err"
|
|
2555
3197
|
}
|
|
2556
3198
|
},
|
|
2557
|
-
defaultVariants: { tone: "
|
|
3199
|
+
defaultVariants: { tone: "neutral" }
|
|
2558
3200
|
});
|
|
2559
|
-
var EmptyState =
|
|
2560
|
-
return /* @__PURE__ */
|
|
3201
|
+
var EmptyState = (0, import_react52.forwardRef)(function EmptyState2({ icon, title, description, action, chips, tone, className, ...props }, ref) {
|
|
3202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
2561
3203
|
"div",
|
|
2562
3204
|
{
|
|
2563
3205
|
ref,
|
|
@@ -2567,10 +3209,10 @@ var EmptyState = react.forwardRef(function EmptyState2({ icon, title, descriptio
|
|
|
2567
3209
|
),
|
|
2568
3210
|
...props,
|
|
2569
3211
|
children: [
|
|
2570
|
-
icon != null && /* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2572
|
-
description && /* @__PURE__ */
|
|
2573
|
-
chips && chips.length > 0 && /* @__PURE__ */
|
|
3212
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "aria-hidden": true, className: plateStyles({ tone: tone ?? "neutral" }), children: icon }),
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "text-[14px] font-medium", children: title }),
|
|
3214
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "text-text-muted max-w-[260px] text-[12px] leading-[1.5]", children: description }),
|
|
3215
|
+
chips && chips.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex w-full flex-col gap-1", children: chips.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2574
3216
|
"button",
|
|
2575
3217
|
{
|
|
2576
3218
|
type: "button",
|
|
@@ -2590,16 +3232,20 @@ var EmptyState = react.forwardRef(function EmptyState2({ icon, title, descriptio
|
|
|
2590
3232
|
);
|
|
2591
3233
|
});
|
|
2592
3234
|
EmptyState.displayName = "EmptyState";
|
|
3235
|
+
|
|
3236
|
+
// src/patterns/FileChip/FileChip.tsx
|
|
3237
|
+
var import_react53 = require("react");
|
|
3238
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2593
3239
|
function deriveExt(name) {
|
|
2594
3240
|
const dot = name.lastIndexOf(".");
|
|
2595
3241
|
if (dot < 0) return "FILE";
|
|
2596
3242
|
return name.slice(dot + 1).slice(0, 4).toUpperCase();
|
|
2597
3243
|
}
|
|
2598
|
-
var FileChip =
|
|
3244
|
+
var FileChip = (0, import_react53.forwardRef)(function FileChip2({ name, size, progress, icon, onRemove, failed, className, ...props }, ref) {
|
|
2599
3245
|
const ext = deriveExt(name);
|
|
2600
3246
|
const showProgress = typeof progress === "number";
|
|
2601
3247
|
const isComplete = showProgress && progress >= 100;
|
|
2602
|
-
return /* @__PURE__ */
|
|
3248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
2603
3249
|
"div",
|
|
2604
3250
|
{
|
|
2605
3251
|
ref,
|
|
@@ -2609,7 +3255,7 @@ var FileChip = react.forwardRef(function FileChip2({ name, size, progress, icon,
|
|
|
2609
3255
|
),
|
|
2610
3256
|
...props,
|
|
2611
3257
|
children: [
|
|
2612
|
-
/* @__PURE__ */
|
|
3258
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2613
3259
|
"span",
|
|
2614
3260
|
{
|
|
2615
3261
|
"aria-hidden": true,
|
|
@@ -2617,17 +3263,17 @@ var FileChip = react.forwardRef(function FileChip2({ name, size, progress, icon,
|
|
|
2617
3263
|
children: icon ?? ext
|
|
2618
3264
|
}
|
|
2619
3265
|
),
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
/* @__PURE__ */
|
|
2622
|
-
/* @__PURE__ */
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "truncate text-[12px] font-medium", children: name }),
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cn("font-mono text-[10px]", failed ? "text-err" : "text-text-dim"), children: [
|
|
2623
3269
|
size,
|
|
2624
|
-
showProgress && !isComplete && /* @__PURE__ */
|
|
3270
|
+
showProgress && !isComplete && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { children: [
|
|
2625
3271
|
" \xB7 ",
|
|
2626
3272
|
Math.round(progress),
|
|
2627
3273
|
"%"
|
|
2628
3274
|
] })
|
|
2629
3275
|
] }),
|
|
2630
|
-
showProgress && !isComplete && /* @__PURE__ */
|
|
3276
|
+
showProgress && !isComplete && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "bg-panel mt-1 h-[2px] overflow-hidden rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2631
3277
|
"div",
|
|
2632
3278
|
{
|
|
2633
3279
|
className: cn(
|
|
@@ -2638,7 +3284,7 @@ var FileChip = react.forwardRef(function FileChip2({ name, size, progress, icon,
|
|
|
2638
3284
|
}
|
|
2639
3285
|
) })
|
|
2640
3286
|
] }),
|
|
2641
|
-
onRemove && /* @__PURE__ */
|
|
3287
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2642
3288
|
"button",
|
|
2643
3289
|
{
|
|
2644
3290
|
type: "button",
|
|
@@ -2656,9 +3302,14 @@ var FileChip = react.forwardRef(function FileChip2({ name, size, progress, icon,
|
|
|
2656
3302
|
);
|
|
2657
3303
|
});
|
|
2658
3304
|
FileChip.displayName = "FileChip";
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
3305
|
+
|
|
3306
|
+
// src/patterns/Menubar/Menubar.tsx
|
|
3307
|
+
var RadixMenubar = __toESM(require("@radix-ui/react-menubar"), 1);
|
|
3308
|
+
var import_react54 = require("react");
|
|
3309
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3310
|
+
var Menubar = (0, import_react54.forwardRef)(function Menubar2({ className, ...props }, ref) {
|
|
3311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3312
|
+
RadixMenubar.Root,
|
|
2662
3313
|
{
|
|
2663
3314
|
ref,
|
|
2664
3315
|
className: cn(
|
|
@@ -2670,11 +3321,11 @@ var Menubar = react.forwardRef(function Menubar2({ className, ...props }, ref) {
|
|
|
2670
3321
|
);
|
|
2671
3322
|
});
|
|
2672
3323
|
Menubar.displayName = "Menubar";
|
|
2673
|
-
var MenubarMenu =
|
|
2674
|
-
var MenubarTrigger =
|
|
3324
|
+
var MenubarMenu = RadixMenubar.Menu;
|
|
3325
|
+
var MenubarTrigger = (0, import_react54.forwardRef)(
|
|
2675
3326
|
function MenubarTrigger2({ className, ...props }, ref) {
|
|
2676
|
-
return /* @__PURE__ */
|
|
2677
|
-
|
|
3327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3328
|
+
RadixMenubar.Trigger,
|
|
2678
3329
|
{
|
|
2679
3330
|
ref,
|
|
2680
3331
|
className: cn(
|
|
@@ -2690,16 +3341,16 @@ var MenubarTrigger = react.forwardRef(
|
|
|
2690
3341
|
}
|
|
2691
3342
|
);
|
|
2692
3343
|
MenubarTrigger.displayName = "MenubarTrigger";
|
|
2693
|
-
var MenubarContent =
|
|
3344
|
+
var MenubarContent = (0, import_react54.forwardRef)(
|
|
2694
3345
|
function MenubarContent2({ className, sideOffset = 6, align = "start", ...props }, ref) {
|
|
2695
|
-
return /* @__PURE__ */
|
|
2696
|
-
|
|
3346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RadixMenubar.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3347
|
+
RadixMenubar.Content,
|
|
2697
3348
|
{
|
|
2698
3349
|
ref,
|
|
2699
3350
|
sideOffset,
|
|
2700
3351
|
align,
|
|
2701
3352
|
className: cn(
|
|
2702
|
-
"border-border-strong bg-panel z-
|
|
3353
|
+
"border-border-strong bg-panel z-popover min-w-[180px] rounded-md border p-1 shadow-lg outline-none",
|
|
2703
3354
|
"data-[state=open]:animate-[ship-pop-in_140ms_var(--easing-out)]",
|
|
2704
3355
|
className
|
|
2705
3356
|
),
|
|
@@ -2714,25 +3365,25 @@ var itemBase3 = cn(
|
|
|
2714
3365
|
"data-[highlighted]:bg-panel-2",
|
|
2715
3366
|
"data-[disabled]:opacity-40 data-[disabled]:cursor-not-allowed"
|
|
2716
3367
|
);
|
|
2717
|
-
var MenubarItem =
|
|
2718
|
-
return /* @__PURE__ */
|
|
2719
|
-
|
|
3368
|
+
var MenubarItem = (0, import_react54.forwardRef)(function MenubarItem2({ trailing, destructive, className, children, ...props }, ref) {
|
|
3369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3370
|
+
RadixMenubar.Item,
|
|
2720
3371
|
{
|
|
2721
3372
|
ref,
|
|
2722
3373
|
className: cn(itemBase3, destructive ? "text-err" : "text-text", className),
|
|
2723
3374
|
...props,
|
|
2724
3375
|
children: [
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
trailing && /* @__PURE__ */
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "flex-1", children }),
|
|
3377
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-text-dim font-mono text-[10px]", children: trailing })
|
|
2727
3378
|
]
|
|
2728
3379
|
}
|
|
2729
3380
|
);
|
|
2730
3381
|
});
|
|
2731
3382
|
MenubarItem.displayName = "MenubarItem";
|
|
2732
|
-
var MenubarSeparator =
|
|
3383
|
+
var MenubarSeparator = (0, import_react54.forwardRef)(
|
|
2733
3384
|
function MenubarSeparator2({ className, ...props }, ref) {
|
|
2734
|
-
return /* @__PURE__ */
|
|
2735
|
-
|
|
3385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3386
|
+
RadixMenubar.Separator,
|
|
2736
3387
|
{
|
|
2737
3388
|
ref,
|
|
2738
3389
|
className: cn("bg-border my-1 h-px", className),
|
|
@@ -2742,6 +3393,10 @@ var MenubarSeparator = react.forwardRef(
|
|
|
2742
3393
|
}
|
|
2743
3394
|
);
|
|
2744
3395
|
MenubarSeparator.displayName = "MenubarSeparator";
|
|
3396
|
+
|
|
3397
|
+
// src/patterns/Pagination/Pagination.tsx
|
|
3398
|
+
var import_react55 = require("react");
|
|
3399
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2745
3400
|
function buildRange(page, total, siblings) {
|
|
2746
3401
|
if (total <= 0) return [];
|
|
2747
3402
|
const items = [];
|
|
@@ -2754,9 +3409,9 @@ function buildRange(page, total, siblings) {
|
|
|
2754
3409
|
if (total > 1) items.push(total);
|
|
2755
3410
|
return items;
|
|
2756
3411
|
}
|
|
2757
|
-
var Pagination =
|
|
3412
|
+
var Pagination = (0, import_react55.forwardRef)(function Pagination2({ page, total, onPageChange, siblings = 1, className, ...props }, ref) {
|
|
2758
3413
|
const items = buildRange(page, total, siblings);
|
|
2759
|
-
return /* @__PURE__ */
|
|
3414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
2760
3415
|
"nav",
|
|
2761
3416
|
{
|
|
2762
3417
|
ref,
|
|
@@ -2764,7 +3419,7 @@ var Pagination = react.forwardRef(function Pagination2({ page, total, onPageChan
|
|
|
2764
3419
|
className: cn("inline-flex items-center gap-1", className),
|
|
2765
3420
|
...props,
|
|
2766
3421
|
children: [
|
|
2767
|
-
/* @__PURE__ */
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2768
3423
|
IconButton,
|
|
2769
3424
|
{
|
|
2770
3425
|
size: "sm",
|
|
@@ -2777,7 +3432,7 @@ var Pagination = react.forwardRef(function Pagination2({ page, total, onPageChan
|
|
|
2777
3432
|
),
|
|
2778
3433
|
items.map((item, i) => {
|
|
2779
3434
|
if (item === "start-ellipsis" || item === "end-ellipsis") {
|
|
2780
|
-
return /* @__PURE__ */
|
|
3435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2781
3436
|
"span",
|
|
2782
3437
|
{
|
|
2783
3438
|
"aria-hidden": true,
|
|
@@ -2788,7 +3443,7 @@ var Pagination = react.forwardRef(function Pagination2({ page, total, onPageChan
|
|
|
2788
3443
|
);
|
|
2789
3444
|
}
|
|
2790
3445
|
const isActive = item === page;
|
|
2791
|
-
return /* @__PURE__ */
|
|
3446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2792
3447
|
"button",
|
|
2793
3448
|
{
|
|
2794
3449
|
type: "button",
|
|
@@ -2806,7 +3461,7 @@ var Pagination = react.forwardRef(function Pagination2({ page, total, onPageChan
|
|
|
2806
3461
|
item
|
|
2807
3462
|
);
|
|
2808
3463
|
}),
|
|
2809
|
-
/* @__PURE__ */
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2810
3465
|
IconButton,
|
|
2811
3466
|
{
|
|
2812
3467
|
size: "sm",
|
|
@@ -2822,7 +3477,12 @@ var Pagination = react.forwardRef(function Pagination2({ page, total, onPageChan
|
|
|
2822
3477
|
);
|
|
2823
3478
|
});
|
|
2824
3479
|
Pagination.displayName = "Pagination";
|
|
2825
|
-
|
|
3480
|
+
|
|
3481
|
+
// src/patterns/Progress/Progress.tsx
|
|
3482
|
+
var import_class_variance_authority11 = require("class-variance-authority");
|
|
3483
|
+
var import_react56 = require("react");
|
|
3484
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3485
|
+
var trackStyles = (0, import_class_variance_authority11.cva)("w-full rounded-full bg-panel-2 overflow-hidden", {
|
|
2826
3486
|
variants: {
|
|
2827
3487
|
size: {
|
|
2828
3488
|
sm: "h-[3px]",
|
|
@@ -2832,7 +3492,7 @@ var trackStyles = classVarianceAuthority.cva("w-full rounded-full bg-panel-2 ove
|
|
|
2832
3492
|
},
|
|
2833
3493
|
defaultVariants: { size: "md" }
|
|
2834
3494
|
});
|
|
2835
|
-
var fillStyles =
|
|
3495
|
+
var fillStyles = (0, import_class_variance_authority11.cva)("h-full rounded-full transition-[width] duration-(--duration-step)", {
|
|
2836
3496
|
variants: {
|
|
2837
3497
|
tone: {
|
|
2838
3498
|
accent: "bg-accent",
|
|
@@ -2843,7 +3503,7 @@ var fillStyles = classVarianceAuthority.cva("h-full rounded-full transition-[wid
|
|
|
2843
3503
|
},
|
|
2844
3504
|
defaultVariants: { tone: "accent" }
|
|
2845
3505
|
});
|
|
2846
|
-
var Progress =
|
|
3506
|
+
var Progress = (0, import_react56.forwardRef)(function Progress2({
|
|
2847
3507
|
value = 0,
|
|
2848
3508
|
max = 100,
|
|
2849
3509
|
indeterminate = false,
|
|
@@ -2857,15 +3517,15 @@ var Progress = react.forwardRef(function Progress2({
|
|
|
2857
3517
|
const clamped = Math.min(max, Math.max(0, value));
|
|
2858
3518
|
const pct = max > 0 ? clamped / max * 100 : 0;
|
|
2859
3519
|
const display = Math.round(pct);
|
|
2860
|
-
return /* @__PURE__ */
|
|
2861
|
-
label != null && /* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
2863
|
-
showValue && !indeterminate && /* @__PURE__ */
|
|
3520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3521
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex text-[12px]", children: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-text-muted", children: label }),
|
|
3523
|
+
showValue && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "text-text ml-auto font-mono tabular-nums", children: [
|
|
2864
3524
|
display,
|
|
2865
3525
|
"%"
|
|
2866
3526
|
] })
|
|
2867
3527
|
] }),
|
|
2868
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2869
3529
|
"div",
|
|
2870
3530
|
{
|
|
2871
3531
|
role: "progressbar",
|
|
@@ -2874,7 +3534,7 @@ var Progress = react.forwardRef(function Progress2({
|
|
|
2874
3534
|
"aria-valuenow": indeterminate ? void 0 : display,
|
|
2875
3535
|
"aria-label": typeof label === "string" ? label : void 0,
|
|
2876
3536
|
className: trackStyles({ size }),
|
|
2877
|
-
children: indeterminate ? /* @__PURE__ */
|
|
3537
|
+
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2878
3538
|
"span",
|
|
2879
3539
|
{
|
|
2880
3540
|
"aria-hidden": true,
|
|
@@ -2884,19 +3544,23 @@ var Progress = react.forwardRef(function Progress2({
|
|
|
2884
3544
|
"animate-[ship-indeterminate_1.4s_linear_infinite]"
|
|
2885
3545
|
)
|
|
2886
3546
|
}
|
|
2887
|
-
) : /* @__PURE__ */
|
|
3547
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": true, className: fillStyles({ tone }), style: { width: `${pct}%` } })
|
|
2888
3548
|
}
|
|
2889
3549
|
)
|
|
2890
3550
|
] });
|
|
2891
3551
|
});
|
|
2892
3552
|
Progress.displayName = "Progress";
|
|
3553
|
+
|
|
3554
|
+
// src/patterns/RadialProgress/RadialProgress.tsx
|
|
3555
|
+
var import_react57 = require("react");
|
|
3556
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2893
3557
|
var toneStrokeClass = {
|
|
2894
3558
|
accent: "stroke-accent",
|
|
2895
3559
|
ok: "stroke-ok",
|
|
2896
3560
|
warn: "stroke-warn",
|
|
2897
3561
|
err: "stroke-err"
|
|
2898
3562
|
};
|
|
2899
|
-
var RadialProgress =
|
|
3563
|
+
var RadialProgress = (0, import_react57.forwardRef)(
|
|
2900
3564
|
function RadialProgress2({
|
|
2901
3565
|
value,
|
|
2902
3566
|
max = 100,
|
|
@@ -2914,7 +3578,7 @@ var RadialProgress = react.forwardRef(
|
|
|
2914
3578
|
const c = 2 * Math.PI * r;
|
|
2915
3579
|
const dash = pct / 100 * c;
|
|
2916
3580
|
const resolvedTone = tone ?? (clamped >= max ? "ok" : "accent");
|
|
2917
|
-
return /* @__PURE__ */
|
|
3581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
2918
3582
|
"div",
|
|
2919
3583
|
{
|
|
2920
3584
|
ref,
|
|
@@ -2927,8 +3591,8 @@ var RadialProgress = react.forwardRef(
|
|
|
2927
3591
|
style: { width: size, height: size },
|
|
2928
3592
|
...props,
|
|
2929
3593
|
children: [
|
|
2930
|
-
/* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, children: [
|
|
3595
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2932
3596
|
"circle",
|
|
2933
3597
|
{
|
|
2934
3598
|
cx: size / 2,
|
|
@@ -2939,7 +3603,7 @@ var RadialProgress = react.forwardRef(
|
|
|
2939
3603
|
className: "stroke-panel-2"
|
|
2940
3604
|
}
|
|
2941
3605
|
),
|
|
2942
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2943
3607
|
"circle",
|
|
2944
3608
|
{
|
|
2945
3609
|
cx: size / 2,
|
|
@@ -2957,15 +3621,19 @@ var RadialProgress = react.forwardRef(
|
|
|
2957
3621
|
}
|
|
2958
3622
|
)
|
|
2959
3623
|
] }),
|
|
2960
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "absolute inset-0 grid place-items-center font-mono text-[11px] font-medium tabular-nums", children: children ?? `${Math.round(pct)}%` })
|
|
2961
3625
|
]
|
|
2962
3626
|
}
|
|
2963
3627
|
);
|
|
2964
3628
|
}
|
|
2965
3629
|
);
|
|
2966
3630
|
RadialProgress.displayName = "RadialProgress";
|
|
2967
|
-
|
|
2968
|
-
|
|
3631
|
+
|
|
3632
|
+
// src/patterns/Sidebar/Sidebar.tsx
|
|
3633
|
+
var import_react58 = require("react");
|
|
3634
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3635
|
+
var Sidebar = (0, import_react58.forwardRef)(function Sidebar2({ width = 240, className, style, ...props }, ref) {
|
|
3636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2969
3637
|
"aside",
|
|
2970
3638
|
{
|
|
2971
3639
|
ref,
|
|
@@ -2979,76 +3647,75 @@ var Sidebar = react.forwardRef(function Sidebar2({ width = 240, className, style
|
|
|
2979
3647
|
);
|
|
2980
3648
|
});
|
|
2981
3649
|
Sidebar.displayName = "Sidebar";
|
|
2982
|
-
var NavItem =
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3650
|
+
var NavItem = (0, import_react58.forwardRef)(
|
|
3651
|
+
function NavItem2({ icon, label, active, badge, href, disabled, className, ...props }, ref) {
|
|
3652
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
3653
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { "aria-hidden": true, className: "w-[14px] text-center opacity-80", children: icon }),
|
|
3654
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "flex-1 truncate", children: label }),
|
|
3655
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3656
|
+
"span",
|
|
3657
|
+
{
|
|
3658
|
+
className: cn(
|
|
3659
|
+
"rounded-xs px-[6px] py-px font-mono text-[10px]",
|
|
3660
|
+
active ? "bg-accent text-on-accent" : "bg-panel-2 text-text-muted"
|
|
3661
|
+
),
|
|
3662
|
+
children: badge
|
|
3663
|
+
}
|
|
3664
|
+
)
|
|
3665
|
+
] });
|
|
3666
|
+
const baseClass = cn(
|
|
3667
|
+
"flex cursor-pointer items-center gap-[10px] rounded-xs px-2 py-[6px] text-[13px] outline-none",
|
|
3668
|
+
"transition-colors duration-(--duration-micro)",
|
|
3669
|
+
"focus-visible:ring-[3px] focus-visible:ring-accent-dim",
|
|
3670
|
+
active ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2",
|
|
3671
|
+
disabled && "opacity-50 pointer-events-none",
|
|
3672
|
+
className
|
|
3673
|
+
);
|
|
3674
|
+
if (href) {
|
|
3675
|
+
const anchorProps = props;
|
|
3676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3677
|
+
"a",
|
|
3678
|
+
{
|
|
3679
|
+
ref,
|
|
3680
|
+
href,
|
|
3681
|
+
"aria-current": active ? "page" : void 0,
|
|
3682
|
+
"aria-disabled": disabled || void 0,
|
|
3683
|
+
className: baseClass,
|
|
3684
|
+
...anchorProps,
|
|
3685
|
+
children: inner
|
|
3686
|
+
}
|
|
3687
|
+
);
|
|
3688
|
+
}
|
|
3689
|
+
const buttonProps = props;
|
|
3690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3691
|
+
"button",
|
|
3008
3692
|
{
|
|
3009
3693
|
ref,
|
|
3010
|
-
|
|
3694
|
+
type: "button",
|
|
3011
3695
|
"aria-current": active ? "page" : void 0,
|
|
3012
|
-
|
|
3013
|
-
className: baseClass,
|
|
3014
|
-
|
|
3015
|
-
...props,
|
|
3696
|
+
disabled,
|
|
3697
|
+
className: cn(baseClass, "w-full text-left"),
|
|
3698
|
+
...buttonProps,
|
|
3016
3699
|
children: inner
|
|
3017
3700
|
}
|
|
3018
3701
|
);
|
|
3019
3702
|
}
|
|
3020
|
-
|
|
3021
|
-
"a",
|
|
3022
|
-
{
|
|
3023
|
-
ref,
|
|
3024
|
-
role: "button",
|
|
3025
|
-
tabIndex: disabled ? -1 : 0,
|
|
3026
|
-
"aria-current": active ? "page" : void 0,
|
|
3027
|
-
"aria-disabled": disabled || void 0,
|
|
3028
|
-
className: baseClass,
|
|
3029
|
-
onClick,
|
|
3030
|
-
onKeyDown: (e) => {
|
|
3031
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
3032
|
-
e.preventDefault();
|
|
3033
|
-
e.currentTarget.click();
|
|
3034
|
-
}
|
|
3035
|
-
},
|
|
3036
|
-
...props,
|
|
3037
|
-
children: inner
|
|
3038
|
-
}
|
|
3039
|
-
);
|
|
3040
|
-
});
|
|
3703
|
+
);
|
|
3041
3704
|
NavItem.displayName = "NavItem";
|
|
3042
|
-
var NavSection =
|
|
3043
|
-
return /* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3045
|
-
/* @__PURE__ */
|
|
3705
|
+
var NavSection = (0, import_react58.forwardRef)(function NavSection2({ label, action, className, children, ...props }, ref) {
|
|
3706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { ref, className: cn("flex flex-col gap-1", className), ...props, children: [
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-text-dim flex items-center px-2 pt-2 font-mono text-[9px] tracking-[1.4px] uppercase", children: [
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "flex-1", children: label }),
|
|
3046
3709
|
action
|
|
3047
3710
|
] }),
|
|
3048
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex flex-col gap-[2px]", children })
|
|
3049
3712
|
] });
|
|
3050
3713
|
});
|
|
3051
3714
|
NavSection.displayName = "NavSection";
|
|
3715
|
+
|
|
3716
|
+
// src/patterns/Sparkline/Sparkline.tsx
|
|
3717
|
+
var import_react59 = require("react");
|
|
3718
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3052
3719
|
function buildPath(values, w, h) {
|
|
3053
3720
|
if (values.length === 0) return { line: "", area: "" };
|
|
3054
3721
|
const pad = 2;
|
|
@@ -3067,7 +3734,7 @@ function buildPath(values, w, h) {
|
|
|
3067
3734
|
)} L${pad.toFixed(2)},${(h - pad).toFixed(2)} Z`;
|
|
3068
3735
|
return { line, area };
|
|
3069
3736
|
}
|
|
3070
|
-
var Sparkline =
|
|
3737
|
+
var Sparkline = (0, import_react59.forwardRef)(function Sparkline2({
|
|
3071
3738
|
values,
|
|
3072
3739
|
width = 160,
|
|
3073
3740
|
height = 32,
|
|
@@ -3078,8 +3745,8 @@ var Sparkline = react.forwardRef(function Sparkline2({
|
|
|
3078
3745
|
"aria-label": ariaLabel = "Trend",
|
|
3079
3746
|
...props
|
|
3080
3747
|
}, ref) {
|
|
3081
|
-
const { line, area } =
|
|
3082
|
-
return /* @__PURE__ */
|
|
3748
|
+
const { line, area } = (0, import_react59.useMemo)(() => buildPath(values, width, height), [values, width, height]);
|
|
3749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3083
3750
|
"svg",
|
|
3084
3751
|
{
|
|
3085
3752
|
ref,
|
|
@@ -3091,8 +3758,8 @@ var Sparkline = react.forwardRef(function Sparkline2({
|
|
|
3091
3758
|
className: cn("inline-block", className),
|
|
3092
3759
|
...props,
|
|
3093
3760
|
children: [
|
|
3094
|
-
fill && /* @__PURE__ */
|
|
3095
|
-
/* @__PURE__ */
|
|
3761
|
+
fill && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("path", { d: area, fill: stroke, fillOpacity: 0.16, stroke: "none" }),
|
|
3762
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3096
3763
|
"path",
|
|
3097
3764
|
{
|
|
3098
3765
|
d: line,
|
|
@@ -3108,14 +3775,18 @@ var Sparkline = react.forwardRef(function Sparkline2({
|
|
|
3108
3775
|
);
|
|
3109
3776
|
});
|
|
3110
3777
|
Sparkline.displayName = "Sparkline";
|
|
3778
|
+
|
|
3779
|
+
// src/patterns/Spinner/Spinner.tsx
|
|
3780
|
+
var import_react60 = require("react");
|
|
3781
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3111
3782
|
var sizes = {
|
|
3112
3783
|
sm: { box: "h-3 w-3", border: "border-[2px]" },
|
|
3113
3784
|
md: { box: "h-4 w-4", border: "border-[2px]" },
|
|
3114
3785
|
lg: { box: "h-5 w-5", border: "border-[2px]" }
|
|
3115
3786
|
};
|
|
3116
|
-
var Spinner2 =
|
|
3787
|
+
var Spinner2 = (0, import_react60.forwardRef)(function Spinner3({ size = "md", label = "Loading", className, ...props }, ref) {
|
|
3117
3788
|
const s = sizes[size];
|
|
3118
|
-
return /* @__PURE__ */
|
|
3789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3119
3790
|
"span",
|
|
3120
3791
|
{
|
|
3121
3792
|
ref,
|
|
@@ -3123,7 +3794,7 @@ var Spinner2 = react.forwardRef(function Spinner3({ size = "md", label = "Loadin
|
|
|
3123
3794
|
"aria-label": label,
|
|
3124
3795
|
className: cn("inline-block", className),
|
|
3125
3796
|
...props,
|
|
3126
|
-
children: /* @__PURE__ */
|
|
3797
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3127
3798
|
"span",
|
|
3128
3799
|
{
|
|
3129
3800
|
"aria-hidden": true,
|
|
@@ -3138,6 +3809,10 @@ var Spinner2 = react.forwardRef(function Spinner3({ size = "md", label = "Loadin
|
|
|
3138
3809
|
);
|
|
3139
3810
|
});
|
|
3140
3811
|
Spinner2.displayName = "Spinner";
|
|
3812
|
+
|
|
3813
|
+
// src/patterns/Stepper/Stepper.tsx
|
|
3814
|
+
var import_react61 = require("react");
|
|
3815
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3141
3816
|
var dotBase = "h-6 w-6 rounded-full grid place-items-center text-[11px] font-mono font-semibold border";
|
|
3142
3817
|
var dotStateClass = {
|
|
3143
3818
|
done: "bg-accent text-on-accent border-accent",
|
|
@@ -3154,46 +3829,52 @@ function stateFor(index, current) {
|
|
|
3154
3829
|
if (index === current) return "current";
|
|
3155
3830
|
return "upcoming";
|
|
3156
3831
|
}
|
|
3157
|
-
var Stepper =
|
|
3158
|
-
return /* @__PURE__ */
|
|
3159
|
-
"
|
|
3832
|
+
var Stepper = (0, import_react61.forwardRef)(function Stepper2({ steps, current, className, ...props }, ref) {
|
|
3833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3834
|
+
"ol",
|
|
3160
3835
|
{
|
|
3161
3836
|
ref,
|
|
3162
|
-
role: "list",
|
|
3163
3837
|
"aria-label": "Progress",
|
|
3164
|
-
className: cn("flex w-full items-center", className),
|
|
3838
|
+
className: cn("m-0 flex w-full list-none items-center p-0", className),
|
|
3165
3839
|
...props,
|
|
3166
|
-
children: steps.map((
|
|
3840
|
+
children: steps.map((step, i) => {
|
|
3841
|
+
const label = typeof step === "string" ? step : step.label;
|
|
3842
|
+
const id = typeof step === "string" ? void 0 : step.id;
|
|
3167
3843
|
const state = stateFor(i, current);
|
|
3168
3844
|
const connectorActive = i < current;
|
|
3169
|
-
return /* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
"
|
|
3845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react61.Fragment, { children: [
|
|
3846
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
3847
|
+
"li",
|
|
3172
3848
|
{
|
|
3173
|
-
role: "listitem",
|
|
3174
3849
|
"aria-current": state === "current" ? "step" : void 0,
|
|
3175
3850
|
className: "flex items-center gap-2",
|
|
3176
3851
|
children: [
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3852
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: cn(dotBase, dotStateClass[state]), children: state === "done" ? "\u2713" : i + 1 }),
|
|
3853
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: cn("text-[12px]", labelStateClass[state]), children: label })
|
|
3179
3854
|
]
|
|
3180
3855
|
}
|
|
3181
3856
|
),
|
|
3182
|
-
i < steps.length - 1 && /* @__PURE__ */
|
|
3857
|
+
i < steps.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3183
3858
|
"span",
|
|
3184
3859
|
{
|
|
3185
3860
|
"aria-hidden": true,
|
|
3186
3861
|
className: cn("mx-3 h-px flex-1", connectorActive ? "bg-accent" : "bg-border")
|
|
3187
3862
|
}
|
|
3188
3863
|
)
|
|
3189
|
-
] },
|
|
3864
|
+
] }, id ?? i);
|
|
3190
3865
|
})
|
|
3191
3866
|
}
|
|
3192
3867
|
);
|
|
3193
3868
|
});
|
|
3194
3869
|
Stepper.displayName = "Stepper";
|
|
3195
|
-
|
|
3196
|
-
|
|
3870
|
+
|
|
3871
|
+
// src/patterns/Tabs/Tabs.tsx
|
|
3872
|
+
var RadixTabs = __toESM(require("@radix-ui/react-tabs"), 1);
|
|
3873
|
+
var import_class_variance_authority12 = require("class-variance-authority");
|
|
3874
|
+
var import_react62 = require("react");
|
|
3875
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3876
|
+
var TabsVariantContext = (0, import_react62.createContext)("underline");
|
|
3877
|
+
var tabsListStyles = (0, import_class_variance_authority12.cva)("", {
|
|
3197
3878
|
variants: {
|
|
3198
3879
|
variant: {
|
|
3199
3880
|
underline: "flex gap-6 border-b border-border",
|
|
@@ -3201,7 +3882,7 @@ var tabsListStyles = classVarianceAuthority.cva("", {
|
|
|
3201
3882
|
}
|
|
3202
3883
|
}
|
|
3203
3884
|
});
|
|
3204
|
-
var tabsTriggerStyles =
|
|
3885
|
+
var tabsTriggerStyles = (0, import_class_variance_authority12.cva)(
|
|
3205
3886
|
"cursor-pointer outline-none transition-colors duration-(--duration-micro) focus-visible:ring-[3px] focus-visible:ring-accent-dim",
|
|
3206
3887
|
{
|
|
3207
3888
|
variants: {
|
|
@@ -3222,9 +3903,9 @@ var tabsTriggerStyles = classVarianceAuthority.cva(
|
|
|
3222
3903
|
}
|
|
3223
3904
|
}
|
|
3224
3905
|
);
|
|
3225
|
-
var Tabs =
|
|
3226
|
-
return /* @__PURE__ */
|
|
3227
|
-
|
|
3906
|
+
var Tabs = (0, import_react62.forwardRef)(function Tabs2({ variant = "underline", className, ...props }, ref) {
|
|
3907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TabsVariantContext.Provider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3908
|
+
RadixTabs.Root,
|
|
3228
3909
|
{
|
|
3229
3910
|
ref,
|
|
3230
3911
|
className: cn("flex flex-col", variant === "underline" && "gap-3", className),
|
|
@@ -3233,15 +3914,15 @@ var Tabs = react.forwardRef(function Tabs2({ variant = "underline", className, .
|
|
|
3233
3914
|
) });
|
|
3234
3915
|
});
|
|
3235
3916
|
Tabs.displayName = "Tabs";
|
|
3236
|
-
var TabsList =
|
|
3237
|
-
const variant =
|
|
3238
|
-
return /* @__PURE__ */
|
|
3917
|
+
var TabsList = (0, import_react62.forwardRef)(function TabsList2({ className, ...props }, ref) {
|
|
3918
|
+
const variant = (0, import_react62.useContext)(TabsVariantContext);
|
|
3919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(RadixTabs.List, { ref, className: cn(tabsListStyles({ variant }), className), ...props });
|
|
3239
3920
|
});
|
|
3240
3921
|
TabsList.displayName = "TabsList";
|
|
3241
|
-
var Tab =
|
|
3242
|
-
const variant =
|
|
3243
|
-
return /* @__PURE__ */
|
|
3244
|
-
|
|
3922
|
+
var Tab = (0, import_react62.forwardRef)(function Tab2({ className, ...props }, ref) {
|
|
3923
|
+
const variant = (0, import_react62.useContext)(TabsVariantContext);
|
|
3924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3925
|
+
RadixTabs.Trigger,
|
|
3245
3926
|
{
|
|
3246
3927
|
ref,
|
|
3247
3928
|
className: cn(tabsTriggerStyles({ variant }), className),
|
|
@@ -3250,10 +3931,10 @@ var Tab = react.forwardRef(function Tab2({ className, ...props }, ref) {
|
|
|
3250
3931
|
);
|
|
3251
3932
|
});
|
|
3252
3933
|
Tab.displayName = "Tab";
|
|
3253
|
-
var TabsContent =
|
|
3934
|
+
var TabsContent = (0, import_react62.forwardRef)(
|
|
3254
3935
|
function TabsContent2({ className, ...props }, ref) {
|
|
3255
|
-
return /* @__PURE__ */
|
|
3256
|
-
|
|
3936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3937
|
+
RadixTabs.Content,
|
|
3257
3938
|
{
|
|
3258
3939
|
ref,
|
|
3259
3940
|
className: cn(
|
|
@@ -3266,6 +3947,10 @@ var TabsContent = react.forwardRef(
|
|
|
3266
3947
|
}
|
|
3267
3948
|
);
|
|
3268
3949
|
TabsContent.displayName = "TabsContent";
|
|
3950
|
+
|
|
3951
|
+
// src/patterns/Timeline/Timeline.tsx
|
|
3952
|
+
var import_react63 = require("react");
|
|
3953
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3269
3954
|
var ringClass = {
|
|
3270
3955
|
accent: "border-accent",
|
|
3271
3956
|
ok: "border-ok",
|
|
@@ -3273,8 +3958,8 @@ var ringClass = {
|
|
|
3273
3958
|
err: "border-err",
|
|
3274
3959
|
muted: "border-text-dim"
|
|
3275
3960
|
};
|
|
3276
|
-
var Timeline =
|
|
3277
|
-
return /* @__PURE__ */
|
|
3961
|
+
var Timeline = (0, import_react63.forwardRef)(function Timeline2({ events, className, children, ...props }, ref) {
|
|
3962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3278
3963
|
"ol",
|
|
3279
3964
|
{
|
|
3280
3965
|
ref,
|
|
@@ -3284,14 +3969,14 @@ var Timeline = react.forwardRef(function Timeline2({ events, className, children
|
|
|
3284
3969
|
className
|
|
3285
3970
|
),
|
|
3286
3971
|
...props,
|
|
3287
|
-
children: events ? events.map((e, i) => /* @__PURE__ */
|
|
3972
|
+
children: events ? events.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TimelineItem, { tone: e.tone, time: e.time, description: e.description, children: e.title }, i)) : children
|
|
3288
3973
|
}
|
|
3289
3974
|
);
|
|
3290
3975
|
});
|
|
3291
3976
|
Timeline.displayName = "Timeline";
|
|
3292
|
-
var TimelineItem =
|
|
3293
|
-
return /* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3977
|
+
var TimelineItem = (0, import_react63.forwardRef)(function TimelineItem2({ tone = "accent", description, time, className, children, ...props }, ref) {
|
|
3978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("li", { ref, className: cn("relative mb-[18px] last:mb-0", className), ...props, children: [
|
|
3979
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3295
3980
|
"span",
|
|
3296
3981
|
{
|
|
3297
3982
|
"aria-hidden": true,
|
|
@@ -3301,14 +3986,18 @@ var TimelineItem = react.forwardRef(function TimelineItem2({ tone = "accent", de
|
|
|
3301
3986
|
)
|
|
3302
3987
|
}
|
|
3303
3988
|
),
|
|
3304
|
-
/* @__PURE__ */
|
|
3305
|
-
description && /* @__PURE__ */
|
|
3306
|
-
time && /* @__PURE__ */
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "text-[13px] font-medium", children }),
|
|
3990
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "text-text-muted text-[12px]", children: description }),
|
|
3991
|
+
time && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "text-text-dim mt-[2px] font-mono text-[10px]", children: time })
|
|
3307
3992
|
] });
|
|
3308
3993
|
});
|
|
3309
3994
|
TimelineItem.displayName = "TimelineItem";
|
|
3310
|
-
|
|
3311
|
-
|
|
3995
|
+
|
|
3996
|
+
// src/patterns/Topbar/Topbar.tsx
|
|
3997
|
+
var import_react64 = require("react");
|
|
3998
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3999
|
+
var Topbar = (0, import_react64.forwardRef)(function Topbar2({ title, leading, actions, className, children, ...props }, ref) {
|
|
4000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
3312
4001
|
"header",
|
|
3313
4002
|
{
|
|
3314
4003
|
ref,
|
|
@@ -3319,40 +4008,94 @@ var Topbar = react.forwardRef(function Topbar2({ title, leading, actions, classN
|
|
|
3319
4008
|
...props,
|
|
3320
4009
|
children: [
|
|
3321
4010
|
leading,
|
|
3322
|
-
title && /* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
actions && /* @__PURE__ */
|
|
4011
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "text-[13px] font-medium", children: title }),
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex flex-1 items-center" }),
|
|
4013
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex items-center gap-3", children: actions }),
|
|
3325
4014
|
children
|
|
3326
4015
|
]
|
|
3327
4016
|
}
|
|
3328
4017
|
);
|
|
3329
4018
|
});
|
|
3330
4019
|
Topbar.displayName = "Topbar";
|
|
3331
|
-
|
|
4020
|
+
|
|
4021
|
+
// src/patterns/Tree/Tree.tsx
|
|
4022
|
+
var import_react65 = require("react");
|
|
4023
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4024
|
+
var EMPTY_SET2 = /* @__PURE__ */ new Set();
|
|
4025
|
+
function flattenVisible(items, expanded, level, parentId, out) {
|
|
4026
|
+
for (const item of items) {
|
|
4027
|
+
const hasChildren = !!item.children && item.children.length > 0;
|
|
4028
|
+
out.push({ id: item.id, level, hasChildren, parentId });
|
|
4029
|
+
if (hasChildren && expanded.has(item.id)) {
|
|
4030
|
+
flattenVisible(item.children ?? [], expanded, level + 1, item.id, out);
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
var Tree = (0, import_react65.forwardRef)(function Tree2({
|
|
3332
4035
|
items,
|
|
3333
4036
|
expanded: expandedProp,
|
|
3334
4037
|
defaultExpanded,
|
|
3335
4038
|
onExpandedChange,
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
4039
|
+
value: valueProp,
|
|
4040
|
+
defaultValue,
|
|
4041
|
+
onValueChange,
|
|
3339
4042
|
className,
|
|
4043
|
+
onKeyDown,
|
|
3340
4044
|
...props
|
|
3341
4045
|
}, ref) {
|
|
3342
4046
|
const [expanded, setExpanded] = useControllableState({
|
|
3343
|
-
value: expandedProp
|
|
3344
|
-
defaultValue: defaultExpanded ? new Set(defaultExpanded) :
|
|
4047
|
+
value: expandedProp,
|
|
4048
|
+
defaultValue: defaultExpanded ? new Set(defaultExpanded) : void 0,
|
|
3345
4049
|
onChange: onExpandedChange
|
|
3346
4050
|
});
|
|
3347
|
-
const [
|
|
3348
|
-
value:
|
|
3349
|
-
defaultValue
|
|
3350
|
-
onChange:
|
|
4051
|
+
const [value, setValue] = useControllableState({
|
|
4052
|
+
value: valueProp,
|
|
4053
|
+
defaultValue,
|
|
4054
|
+
onChange: onValueChange
|
|
3351
4055
|
});
|
|
3352
|
-
const
|
|
4056
|
+
const expandedSet = expanded ?? EMPTY_SET2;
|
|
4057
|
+
const flatVisible = (0, import_react65.useMemo)(() => {
|
|
4058
|
+
const out = [];
|
|
4059
|
+
flattenVisible(items, expandedSet, 1, null, out);
|
|
4060
|
+
return out;
|
|
4061
|
+
}, [items, expandedSet]);
|
|
4062
|
+
const [activeId, setActiveId] = (0, import_react65.useState)(null);
|
|
4063
|
+
(0, import_react65.useEffect)(() => {
|
|
4064
|
+
if (activeId && !flatVisible.some((f) => f.id === activeId)) {
|
|
4065
|
+
setActiveId(null);
|
|
4066
|
+
}
|
|
4067
|
+
}, [activeId, flatVisible]);
|
|
4068
|
+
const tabStopId = (0, import_react65.useMemo)(() => {
|
|
4069
|
+
if (activeId && flatVisible.some((f) => f.id === activeId)) return activeId;
|
|
4070
|
+
if (value && flatVisible.some((f) => f.id === value)) return value;
|
|
4071
|
+
return flatVisible[0]?.id ?? null;
|
|
4072
|
+
}, [activeId, flatVisible, value]);
|
|
4073
|
+
const listRef = (0, import_react65.useRef)(null);
|
|
4074
|
+
const setRefs = (0, import_react65.useCallback)(
|
|
4075
|
+
(node) => {
|
|
4076
|
+
listRef.current = node;
|
|
4077
|
+
if (typeof ref === "function") ref(node);
|
|
4078
|
+
else if (ref) ref.current = node;
|
|
4079
|
+
},
|
|
4080
|
+
[ref]
|
|
4081
|
+
);
|
|
4082
|
+
const focusItem = (0, import_react65.useCallback)((id) => {
|
|
4083
|
+
const root = listRef.current;
|
|
4084
|
+
if (!root) return;
|
|
4085
|
+
const el = root.querySelector(`[data-treeitem-id="${CSS.escape(id)}"]`);
|
|
4086
|
+
el?.focus();
|
|
4087
|
+
}, []);
|
|
4088
|
+
const moveActive = (0, import_react65.useCallback)(
|
|
4089
|
+
(id) => {
|
|
4090
|
+
setActiveId(id);
|
|
4091
|
+
queueMicrotask(() => focusItem(id));
|
|
4092
|
+
},
|
|
4093
|
+
[focusItem]
|
|
4094
|
+
);
|
|
4095
|
+
const toggle = (0, import_react65.useCallback)(
|
|
3353
4096
|
(id) => {
|
|
3354
4097
|
setExpanded((prev) => {
|
|
3355
|
-
const next = new Set(prev ??
|
|
4098
|
+
const next = new Set(prev ?? EMPTY_SET2);
|
|
3356
4099
|
if (next.has(id)) next.delete(id);
|
|
3357
4100
|
else next.add(id);
|
|
3358
4101
|
return next;
|
|
@@ -3360,22 +4103,138 @@ var Tree = react.forwardRef(function Tree2({
|
|
|
3360
4103
|
},
|
|
3361
4104
|
[setExpanded]
|
|
3362
4105
|
);
|
|
3363
|
-
|
|
4106
|
+
const expand = (0, import_react65.useCallback)(
|
|
4107
|
+
(id) => {
|
|
4108
|
+
setExpanded((prev) => {
|
|
4109
|
+
const base = prev ?? EMPTY_SET2;
|
|
4110
|
+
if (base.has(id)) return base;
|
|
4111
|
+
const next = new Set(base);
|
|
4112
|
+
next.add(id);
|
|
4113
|
+
return next;
|
|
4114
|
+
});
|
|
4115
|
+
},
|
|
4116
|
+
[setExpanded]
|
|
4117
|
+
);
|
|
4118
|
+
const collapse = (0, import_react65.useCallback)(
|
|
4119
|
+
(id) => {
|
|
4120
|
+
setExpanded((prev) => {
|
|
4121
|
+
const base = prev ?? EMPTY_SET2;
|
|
4122
|
+
if (!base.has(id)) return base;
|
|
4123
|
+
const next = new Set(base);
|
|
4124
|
+
next.delete(id);
|
|
4125
|
+
return next;
|
|
4126
|
+
});
|
|
4127
|
+
},
|
|
4128
|
+
[setExpanded]
|
|
4129
|
+
);
|
|
4130
|
+
const selectItem = (0, import_react65.useCallback)(
|
|
4131
|
+
(id) => {
|
|
4132
|
+
setValue(id);
|
|
4133
|
+
},
|
|
4134
|
+
[setValue]
|
|
4135
|
+
);
|
|
4136
|
+
const handleKeyDown = (0, import_react65.useCallback)(
|
|
4137
|
+
(e) => {
|
|
4138
|
+
onKeyDown?.(e);
|
|
4139
|
+
if (e.defaultPrevented) return;
|
|
4140
|
+
if (flatVisible.length === 0) return;
|
|
4141
|
+
const currentId = tabStopId;
|
|
4142
|
+
const currentIndex = currentId ? flatVisible.findIndex((f) => f.id === currentId) : -1;
|
|
4143
|
+
const current = currentIndex >= 0 ? flatVisible[currentIndex] : void 0;
|
|
4144
|
+
switch (e.key) {
|
|
4145
|
+
case "ArrowDown": {
|
|
4146
|
+
e.preventDefault();
|
|
4147
|
+
const next = flatVisible[Math.min(flatVisible.length - 1, currentIndex + 1)];
|
|
4148
|
+
if (next) moveActive(next.id);
|
|
4149
|
+
break;
|
|
4150
|
+
}
|
|
4151
|
+
case "ArrowUp": {
|
|
4152
|
+
e.preventDefault();
|
|
4153
|
+
const prev = flatVisible[Math.max(0, currentIndex - 1)];
|
|
4154
|
+
if (prev) moveActive(prev.id);
|
|
4155
|
+
break;
|
|
4156
|
+
}
|
|
4157
|
+
case "ArrowRight": {
|
|
4158
|
+
if (!current) return;
|
|
4159
|
+
e.preventDefault();
|
|
4160
|
+
if (current.hasChildren) {
|
|
4161
|
+
if (!expandedSet.has(current.id)) {
|
|
4162
|
+
expand(current.id);
|
|
4163
|
+
} else {
|
|
4164
|
+
const child = flatVisible[currentIndex + 1];
|
|
4165
|
+
if (child && child.parentId === current.id) moveActive(child.id);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
break;
|
|
4169
|
+
}
|
|
4170
|
+
case "ArrowLeft": {
|
|
4171
|
+
if (!current) return;
|
|
4172
|
+
e.preventDefault();
|
|
4173
|
+
if (current.hasChildren && expandedSet.has(current.id)) {
|
|
4174
|
+
collapse(current.id);
|
|
4175
|
+
} else if (current.parentId) {
|
|
4176
|
+
moveActive(current.parentId);
|
|
4177
|
+
}
|
|
4178
|
+
break;
|
|
4179
|
+
}
|
|
4180
|
+
case "Home": {
|
|
4181
|
+
e.preventDefault();
|
|
4182
|
+
const first = flatVisible[0];
|
|
4183
|
+
if (first) moveActive(first.id);
|
|
4184
|
+
break;
|
|
4185
|
+
}
|
|
4186
|
+
case "End": {
|
|
4187
|
+
e.preventDefault();
|
|
4188
|
+
const last = flatVisible[flatVisible.length - 1];
|
|
4189
|
+
if (last) moveActive(last.id);
|
|
4190
|
+
break;
|
|
4191
|
+
}
|
|
4192
|
+
case "Enter":
|
|
4193
|
+
case " ": {
|
|
4194
|
+
if (!current) return;
|
|
4195
|
+
e.preventDefault();
|
|
4196
|
+
selectItem(current.id);
|
|
4197
|
+
if (current.hasChildren) toggle(current.id);
|
|
4198
|
+
break;
|
|
4199
|
+
}
|
|
4200
|
+
default:
|
|
4201
|
+
break;
|
|
4202
|
+
}
|
|
4203
|
+
},
|
|
4204
|
+
[
|
|
4205
|
+
collapse,
|
|
4206
|
+
expand,
|
|
4207
|
+
expandedSet,
|
|
4208
|
+
flatVisible,
|
|
4209
|
+
moveActive,
|
|
4210
|
+
onKeyDown,
|
|
4211
|
+
selectItem,
|
|
4212
|
+
tabStopId,
|
|
4213
|
+
toggle
|
|
4214
|
+
]
|
|
4215
|
+
);
|
|
4216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3364
4217
|
"ul",
|
|
3365
4218
|
{
|
|
3366
|
-
ref,
|
|
4219
|
+
ref: setRefs,
|
|
3367
4220
|
role: "tree",
|
|
3368
4221
|
className: cn("flex flex-col gap-px text-[12px]", className),
|
|
4222
|
+
onKeyDown: handleKeyDown,
|
|
3369
4223
|
...props,
|
|
3370
|
-
children: items.map((item) => /* @__PURE__ */
|
|
4224
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3371
4225
|
TreeItemRow,
|
|
3372
4226
|
{
|
|
3373
4227
|
item,
|
|
3374
4228
|
level: 1,
|
|
3375
|
-
expanded:
|
|
3376
|
-
selected,
|
|
3377
|
-
|
|
3378
|
-
|
|
4229
|
+
expanded: expandedSet,
|
|
4230
|
+
selected: value,
|
|
4231
|
+
tabStopId,
|
|
4232
|
+
onFocusItem: setActiveId,
|
|
4233
|
+
onActivate: (id) => {
|
|
4234
|
+
setActiveId(id);
|
|
4235
|
+
selectItem(id);
|
|
4236
|
+
},
|
|
4237
|
+
onToggle: toggle
|
|
3379
4238
|
},
|
|
3380
4239
|
item.id
|
|
3381
4240
|
))
|
|
@@ -3383,36 +4242,37 @@ var Tree = react.forwardRef(function Tree2({
|
|
|
3383
4242
|
);
|
|
3384
4243
|
});
|
|
3385
4244
|
Tree.displayName = "Tree";
|
|
3386
|
-
function TreeItemRow({
|
|
4245
|
+
function TreeItemRow({
|
|
4246
|
+
item,
|
|
4247
|
+
level,
|
|
4248
|
+
expanded,
|
|
4249
|
+
selected,
|
|
4250
|
+
tabStopId,
|
|
4251
|
+
onFocusItem,
|
|
4252
|
+
onActivate,
|
|
4253
|
+
onToggle
|
|
4254
|
+
}) {
|
|
3387
4255
|
const hasChildren = !!item.children && item.children.length > 0;
|
|
3388
4256
|
const isExpanded = hasChildren && expanded.has(item.id);
|
|
3389
4257
|
const isSelected = selected === item.id;
|
|
3390
|
-
|
|
3391
|
-
|
|
4258
|
+
const isTabStop = tabStopId === item.id;
|
|
4259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("li", { role: "none", children: [
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
3392
4261
|
"div",
|
|
3393
4262
|
{
|
|
3394
4263
|
role: "treeitem",
|
|
4264
|
+
"data-treeitem-id": item.id,
|
|
3395
4265
|
"aria-level": level,
|
|
3396
4266
|
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
3397
4267
|
"aria-selected": isSelected,
|
|
3398
|
-
tabIndex:
|
|
4268
|
+
tabIndex: isTabStop ? 0 : -1,
|
|
4269
|
+
onFocus: (e) => {
|
|
4270
|
+
if (e.target === e.currentTarget) onFocusItem(item.id);
|
|
4271
|
+
},
|
|
3399
4272
|
onClick: () => {
|
|
3400
|
-
|
|
4273
|
+
onActivate(item.id);
|
|
3401
4274
|
if (hasChildren) onToggle(item.id);
|
|
3402
4275
|
},
|
|
3403
|
-
onKeyDown: (e) => {
|
|
3404
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
3405
|
-
e.preventDefault();
|
|
3406
|
-
onSelect(item.id);
|
|
3407
|
-
if (hasChildren) onToggle(item.id);
|
|
3408
|
-
} else if (e.key === "ArrowRight" && hasChildren && !isExpanded) {
|
|
3409
|
-
e.preventDefault();
|
|
3410
|
-
onToggle(item.id);
|
|
3411
|
-
} else if (e.key === "ArrowLeft" && hasChildren && isExpanded) {
|
|
3412
|
-
e.preventDefault();
|
|
3413
|
-
onToggle(item.id);
|
|
3414
|
-
}
|
|
3415
|
-
},
|
|
3416
4276
|
style: { paddingLeft: 4 + (level - 1) * 16 },
|
|
3417
4277
|
className: cn(
|
|
3418
4278
|
"flex cursor-pointer items-center gap-[6px] rounded-xs py-[5px] pr-2 outline-none",
|
|
@@ -3420,162 +4280,168 @@ function TreeItemRow({ item, level, expanded, selected, onToggle, onSelect }) {
|
|
|
3420
4280
|
isSelected ? "bg-accent-dim text-accent" : "text-text hover:bg-panel-2"
|
|
3421
4281
|
),
|
|
3422
4282
|
children: [
|
|
3423
|
-
/* @__PURE__ */
|
|
3424
|
-
item.icon && /* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
4283
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "aria-hidden": true, className: "text-text-dim grid w-3 place-items-center text-[10px]", children: hasChildren ? isExpanded ? "\u25BE" : "\u25B8" : "" }),
|
|
4284
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "aria-hidden": true, className: "text-[12px] opacity-80", children: item.icon }),
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "flex-1 truncate", children: item.label }),
|
|
3426
4286
|
item.trailing
|
|
3427
4287
|
]
|
|
3428
4288
|
}
|
|
3429
4289
|
),
|
|
3430
|
-
hasChildren && isExpanded && /* @__PURE__ */
|
|
4290
|
+
hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { role: "group", className: "flex flex-col gap-px", children: (item.children ?? []).map((child) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3431
4291
|
TreeItemRow,
|
|
3432
4292
|
{
|
|
3433
4293
|
item: child,
|
|
3434
4294
|
level: level + 1,
|
|
3435
4295
|
expanded,
|
|
3436
4296
|
selected,
|
|
3437
|
-
|
|
3438
|
-
|
|
4297
|
+
tabStopId,
|
|
4298
|
+
onFocusItem,
|
|
4299
|
+
onActivate,
|
|
4300
|
+
onToggle
|
|
3439
4301
|
},
|
|
3440
4302
|
child.id
|
|
3441
4303
|
)) })
|
|
3442
4304
|
] });
|
|
3443
4305
|
}
|
|
3444
|
-
|
|
3445
|
-
exports
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
4306
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4307
|
+
0 && (module.exports = {
|
|
4308
|
+
Alert,
|
|
4309
|
+
AlertDialog,
|
|
4310
|
+
AlertDialogAction,
|
|
4311
|
+
AlertDialogCancel,
|
|
4312
|
+
AlertDialogRoot,
|
|
4313
|
+
AlertDialogTrigger,
|
|
4314
|
+
Avatar,
|
|
4315
|
+
AvatarGroup,
|
|
4316
|
+
Badge,
|
|
4317
|
+
Banner,
|
|
4318
|
+
Breadcrumbs,
|
|
4319
|
+
Button,
|
|
4320
|
+
ButtonGroup,
|
|
4321
|
+
Calendar,
|
|
4322
|
+
Card,
|
|
4323
|
+
CardLink,
|
|
4324
|
+
Checkbox,
|
|
4325
|
+
Chip,
|
|
4326
|
+
Combobox,
|
|
4327
|
+
CommandPalette,
|
|
4328
|
+
ContextMenu,
|
|
4329
|
+
ContextMenuContent,
|
|
4330
|
+
ContextMenuItem,
|
|
4331
|
+
ContextMenuPortal,
|
|
4332
|
+
ContextMenuRoot,
|
|
4333
|
+
ContextMenuSeparator,
|
|
4334
|
+
ContextMenuTrigger,
|
|
4335
|
+
Crumb,
|
|
4336
|
+
DataTable,
|
|
4337
|
+
DatePicker,
|
|
4338
|
+
Dialog,
|
|
4339
|
+
DialogClose,
|
|
4340
|
+
DialogContent,
|
|
4341
|
+
DialogOverlay,
|
|
4342
|
+
DialogPortal,
|
|
4343
|
+
DialogRoot,
|
|
4344
|
+
DialogTrigger,
|
|
4345
|
+
Dots,
|
|
4346
|
+
Drawer,
|
|
4347
|
+
DropdownMenu,
|
|
4348
|
+
DropdownMenuContent,
|
|
4349
|
+
DropdownMenuGroup,
|
|
4350
|
+
DropdownMenuLabel,
|
|
4351
|
+
DropdownMenuPortal,
|
|
4352
|
+
DropdownMenuRadioGroup,
|
|
4353
|
+
DropdownMenuRoot,
|
|
4354
|
+
DropdownMenuTrigger,
|
|
4355
|
+
EmptyState,
|
|
4356
|
+
FAB,
|
|
4357
|
+
Field,
|
|
4358
|
+
FileChip,
|
|
4359
|
+
HoverCard,
|
|
4360
|
+
HoverCardContent,
|
|
4361
|
+
HoverCardPortal,
|
|
4362
|
+
HoverCardRoot,
|
|
4363
|
+
HoverCardTrigger,
|
|
4364
|
+
IconButton,
|
|
4365
|
+
Input,
|
|
4366
|
+
Kbd,
|
|
4367
|
+
MenuCheckboxItem,
|
|
4368
|
+
MenuItem,
|
|
4369
|
+
MenuSeparator,
|
|
4370
|
+
Menubar,
|
|
4371
|
+
MenubarContent,
|
|
4372
|
+
MenubarItem,
|
|
4373
|
+
MenubarMenu,
|
|
4374
|
+
MenubarSeparator,
|
|
4375
|
+
MenubarTrigger,
|
|
4376
|
+
NavItem,
|
|
4377
|
+
NavSection,
|
|
4378
|
+
OTP,
|
|
4379
|
+
Pagination,
|
|
4380
|
+
Popover,
|
|
4381
|
+
PopoverAnchor,
|
|
4382
|
+
PopoverArrow,
|
|
4383
|
+
PopoverClose,
|
|
4384
|
+
PopoverContent,
|
|
4385
|
+
PopoverPortal,
|
|
4386
|
+
PopoverRoot,
|
|
4387
|
+
PopoverTrigger,
|
|
4388
|
+
Progress,
|
|
4389
|
+
RadialProgress,
|
|
4390
|
+
Radio,
|
|
4391
|
+
RadioGroup,
|
|
4392
|
+
SearchInput,
|
|
4393
|
+
Select,
|
|
4394
|
+
SelectContent,
|
|
4395
|
+
SelectGroup,
|
|
4396
|
+
SelectItem,
|
|
4397
|
+
SelectLabel,
|
|
4398
|
+
SelectRoot,
|
|
4399
|
+
SelectTrigger,
|
|
4400
|
+
SelectValue,
|
|
4401
|
+
Sheet,
|
|
4402
|
+
Sidebar,
|
|
4403
|
+
Skeleton,
|
|
4404
|
+
SkeletonGroup,
|
|
4405
|
+
Slider,
|
|
4406
|
+
Sparkline,
|
|
4407
|
+
Spinner,
|
|
4408
|
+
SplitButton,
|
|
4409
|
+
StatCard,
|
|
4410
|
+
StatusDot,
|
|
4411
|
+
Stepper,
|
|
4412
|
+
Switch,
|
|
4413
|
+
Tab,
|
|
4414
|
+
Tabs,
|
|
4415
|
+
TabsContent,
|
|
4416
|
+
TabsList,
|
|
4417
|
+
Tag,
|
|
4418
|
+
Textarea,
|
|
4419
|
+
Timeline,
|
|
4420
|
+
TimelineItem,
|
|
4421
|
+
ToastCard,
|
|
4422
|
+
ToastProvider,
|
|
4423
|
+
Tooltip,
|
|
4424
|
+
TooltipArrow,
|
|
4425
|
+
TooltipContent,
|
|
4426
|
+
TooltipPortal,
|
|
4427
|
+
TooltipProvider,
|
|
4428
|
+
TooltipRoot,
|
|
4429
|
+
TooltipTrigger,
|
|
4430
|
+
Topbar,
|
|
4431
|
+
Tree,
|
|
4432
|
+
badgeStyles,
|
|
4433
|
+
buttonStyles,
|
|
4434
|
+
cardStyles,
|
|
4435
|
+
cn,
|
|
4436
|
+
filterCommandItems,
|
|
4437
|
+
iconButtonStyles,
|
|
4438
|
+
useControllableState,
|
|
4439
|
+
useDisclosure,
|
|
4440
|
+
useEscape,
|
|
4441
|
+
useIsomorphicLayoutEffect,
|
|
4442
|
+
useKeyboardList,
|
|
4443
|
+
useOutsideClick,
|
|
4444
|
+
useTheme,
|
|
4445
|
+
useToast
|
|
4446
|
+
});
|
|
3581
4447
|
//# sourceMappingURL=index.cjs.map
|