@tensor_1/react 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chart.cjs +127 -0
- package/dist/chart.d.cts +24 -0
- package/dist/chart.d.ts +3 -0
- package/dist/chart.js +5 -0
- package/dist/components/Alert.d.ts +13 -0
- package/dist/components/Alert.js +14 -0
- package/dist/components/AppShell.d.ts +12 -0
- package/dist/components/AppShell.js +12 -0
- package/dist/components/Avatar.d.ts +30 -0
- package/dist/components/Avatar.js +26 -0
- package/dist/components/Button.d.ts +18 -0
- package/dist/components/Button.js +30 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Card.js +19 -0
- package/dist/components/Chart.d.ts +24 -0
- package/dist/components/Chart.js +83 -0
- package/dist/components/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox.js +35 -0
- package/dist/components/CommandPalette.d.ts +30 -0
- package/dist/components/CommandPalette.js +26 -0
- package/dist/components/Comments.d.ts +19 -0
- package/dist/components/Comments.js +22 -0
- package/dist/components/DetailLayout.d.ts +16 -0
- package/dist/components/DetailLayout.js +11 -0
- package/dist/components/Drawer.d.ts +14 -0
- package/dist/components/Drawer.js +27 -0
- package/dist/components/Field.d.ts +16 -0
- package/dist/components/Field.js +14 -0
- package/dist/components/Input.d.ts +18 -0
- package/dist/components/Input.js +38 -0
- package/dist/components/Kanban.d.ts +21 -0
- package/dist/components/Kanban.js +26 -0
- package/dist/components/Label.d.ts +13 -0
- package/dist/components/Label.js +12 -0
- package/dist/components/List.d.ts +21 -0
- package/dist/components/List.js +21 -0
- package/dist/components/Modal.d.ts +15 -0
- package/dist/components/Modal.js +19 -0
- package/dist/components/PageHeader.d.ts +18 -0
- package/dist/components/PageHeader.js +15 -0
- package/dist/components/Pagination.d.ts +11 -0
- package/dist/components/Pagination.js +53 -0
- package/dist/components/Peek.d.ts +17 -0
- package/dist/components/Peek.js +34 -0
- package/dist/components/Popover.d.ts +18 -0
- package/dist/components/Popover.js +9 -0
- package/dist/components/Progress.d.ts +14 -0
- package/dist/components/Progress.js +20 -0
- package/dist/components/Prose.d.ts +21 -0
- package/dist/components/Prose.js +15 -0
- package/dist/components/Radio.d.ts +14 -0
- package/dist/components/Radio.js +18 -0
- package/dist/components/Select.d.ts +9 -0
- package/dist/components/Select.js +17 -0
- package/dist/components/Sidebar.d.ts +39 -0
- package/dist/components/Sidebar.js +89 -0
- package/dist/components/Spinner.d.ts +10 -0
- package/dist/components/Spinner.js +16 -0
- package/dist/components/Stat.d.ts +21 -0
- package/dist/components/Stat.js +18 -0
- package/dist/components/States.d.ts +38 -0
- package/dist/components/States.js +43 -0
- package/dist/components/StatusPill.d.ts +15 -0
- package/dist/components/StatusPill.js +18 -0
- package/dist/components/Switch.d.ts +9 -0
- package/dist/components/Switch.js +14 -0
- package/dist/components/Table.d.ts +34 -0
- package/dist/components/Table.js +62 -0
- package/dist/components/Tabs.d.ts +19 -0
- package/dist/components/Tabs.js +31 -0
- package/dist/components/Textarea.d.ts +9 -0
- package/dist/components/Textarea.js +18 -0
- package/dist/components/Timeline.d.ts +16 -0
- package/dist/components/Timeline.js +21 -0
- package/dist/components/Toast.d.ts +19 -0
- package/dist/components/Toast.js +29 -0
- package/dist/components/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip.js +7 -0
- package/dist/components/Tree.d.ts +28 -0
- package/dist/components/Tree.js +69 -0
- package/dist/cx.d.ts +3 -0
- package/dist/cx.js +6 -0
- package/dist/hooks/useDialog.d.ts +3 -0
- package/dist/hooks/useDialog.js +21 -0
- package/dist/index.cjs +1040 -0
- package/dist/index.d.cts +534 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +106 -0
- package/package.json +47 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Alert: () => Alert,
|
|
24
|
+
AppShell: () => AppShell,
|
|
25
|
+
Avatar: () => Avatar,
|
|
26
|
+
AvatarGroup: () => AvatarGroup,
|
|
27
|
+
Button: () => Button,
|
|
28
|
+
ButtonGroup: () => ButtonGroup,
|
|
29
|
+
Card: () => Card,
|
|
30
|
+
Checkbox: () => Checkbox,
|
|
31
|
+
CommandGroup: () => CommandGroup,
|
|
32
|
+
CommandItem: () => CommandItem,
|
|
33
|
+
CommandPalette: () => CommandPalette,
|
|
34
|
+
Comment: () => Comment,
|
|
35
|
+
Comments: () => Comments,
|
|
36
|
+
DetailLayout: () => DetailLayout,
|
|
37
|
+
Drawer: () => Drawer,
|
|
38
|
+
EmptyState: () => EmptyState,
|
|
39
|
+
ErrorState: () => ErrorState,
|
|
40
|
+
Field: () => Field,
|
|
41
|
+
Input: () => Input,
|
|
42
|
+
InputGroup: () => InputGroup,
|
|
43
|
+
Kanban: () => Kanban,
|
|
44
|
+
KanbanCard: () => KanbanCard,
|
|
45
|
+
KanbanColumn: () => KanbanColumn,
|
|
46
|
+
Label: () => Label,
|
|
47
|
+
List: () => List,
|
|
48
|
+
ListItem: () => ListItem,
|
|
49
|
+
LoadingState: () => LoadingState,
|
|
50
|
+
Modal: () => Modal,
|
|
51
|
+
NavGroup: () => NavGroup,
|
|
52
|
+
NavItem: () => NavItem,
|
|
53
|
+
Note: () => Note,
|
|
54
|
+
PageHeader: () => PageHeader,
|
|
55
|
+
Pagination: () => Pagination,
|
|
56
|
+
Peek: () => Peek,
|
|
57
|
+
Popover: () => Popover,
|
|
58
|
+
Progress: () => Progress,
|
|
59
|
+
Prose: () => Prose,
|
|
60
|
+
Radio: () => Radio,
|
|
61
|
+
RadioGroup: () => RadioGroup,
|
|
62
|
+
Select: () => Select,
|
|
63
|
+
Sidebar: () => Sidebar,
|
|
64
|
+
SidebarSection: () => SidebarSection,
|
|
65
|
+
Skeleton: () => Skeleton,
|
|
66
|
+
Spinner: () => Spinner,
|
|
67
|
+
Stat: () => Stat,
|
|
68
|
+
StatusPill: () => StatusPill,
|
|
69
|
+
SubNavItem: () => SubNavItem,
|
|
70
|
+
Switch: () => Switch,
|
|
71
|
+
Tab: () => Tab,
|
|
72
|
+
Table: () => Table,
|
|
73
|
+
TableWrap: () => TableWrap,
|
|
74
|
+
Tabs: () => Tabs,
|
|
75
|
+
Td: () => Td,
|
|
76
|
+
Textarea: () => Textarea,
|
|
77
|
+
Th: () => Th,
|
|
78
|
+
Timeline: () => Timeline,
|
|
79
|
+
TimelineItem: () => TimelineItem,
|
|
80
|
+
Toast: () => Toast,
|
|
81
|
+
Toaster: () => Toaster,
|
|
82
|
+
Tooltip: () => Tooltip,
|
|
83
|
+
Tr: () => Tr,
|
|
84
|
+
Tree: () => Tree,
|
|
85
|
+
UserChip: () => UserChip,
|
|
86
|
+
cx: () => cx,
|
|
87
|
+
useDialog: () => useDialog
|
|
88
|
+
});
|
|
89
|
+
module.exports = __toCommonJS(src_exports);
|
|
90
|
+
|
|
91
|
+
// src/cx.ts
|
|
92
|
+
function cx(...args) {
|
|
93
|
+
return args.filter(Boolean).join(" ");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/hooks/useDialog.ts
|
|
97
|
+
var import_react = require("react");
|
|
98
|
+
function useDialog(open) {
|
|
99
|
+
const ref = (0, import_react.useRef)(null);
|
|
100
|
+
(0, import_react.useEffect)(() => {
|
|
101
|
+
const el = ref.current;
|
|
102
|
+
if (!el) return;
|
|
103
|
+
if (open) {
|
|
104
|
+
if (!el.open) el.showModal();
|
|
105
|
+
} else {
|
|
106
|
+
if (el.open) el.close();
|
|
107
|
+
}
|
|
108
|
+
return () => {
|
|
109
|
+
if (el.open) el.close();
|
|
110
|
+
};
|
|
111
|
+
}, [open]);
|
|
112
|
+
return ref;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// src/components/Button.tsx
|
|
116
|
+
var import_react2 = require("react");
|
|
117
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
118
|
+
var Button = (0, import_react2.forwardRef)(
|
|
119
|
+
({ variant = "secondary", size = "md", icon = false, loading = false, className, children, disabled, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
ref,
|
|
123
|
+
className: cx(
|
|
124
|
+
"uix-btn",
|
|
125
|
+
`uix-btn--${variant}`,
|
|
126
|
+
size !== "md" && `uix-btn--${size}`,
|
|
127
|
+
icon && "uix-btn--icon",
|
|
128
|
+
className
|
|
129
|
+
),
|
|
130
|
+
disabled: disabled || loading,
|
|
131
|
+
"data-loading": loading || void 0,
|
|
132
|
+
...props,
|
|
133
|
+
children
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
Button.displayName = "Button";
|
|
138
|
+
function ButtonGroup({ children, className }) {
|
|
139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cx("uix-btn-group", className), children });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// src/components/Input.tsx
|
|
143
|
+
var import_react3 = require("react");
|
|
144
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
145
|
+
var Input = (0, import_react3.forwardRef)(
|
|
146
|
+
({ size = "md", invalid, valid, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
147
|
+
"input",
|
|
148
|
+
{
|
|
149
|
+
ref,
|
|
150
|
+
className: cx("uix-input", size === "sm" && "uix-input--sm", className),
|
|
151
|
+
"aria-invalid": invalid || void 0,
|
|
152
|
+
"data-valid": valid || void 0,
|
|
153
|
+
...props
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
Input.displayName = "Input";
|
|
158
|
+
function InputGroup({ children, leadingIcon, trailingIcon, className }) {
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: cx(
|
|
163
|
+
"uix-input-group",
|
|
164
|
+
leadingIcon && "uix-input-group--has-leading",
|
|
165
|
+
trailingIcon && "uix-input-group--has-trailing",
|
|
166
|
+
className
|
|
167
|
+
),
|
|
168
|
+
children: [
|
|
169
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uix-input-group__icon", children: leadingIcon }),
|
|
170
|
+
children,
|
|
171
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "uix-input-group__icon uix-input-group__icon--trailing", children: trailingIcon })
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// src/components/Textarea.tsx
|
|
178
|
+
var import_react4 = require("react");
|
|
179
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
180
|
+
var Textarea = (0, import_react4.forwardRef)(
|
|
181
|
+
({ invalid, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
182
|
+
"textarea",
|
|
183
|
+
{
|
|
184
|
+
ref,
|
|
185
|
+
className: cx("uix-textarea", className),
|
|
186
|
+
"aria-invalid": invalid || void 0,
|
|
187
|
+
...props
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
Textarea.displayName = "Textarea";
|
|
192
|
+
|
|
193
|
+
// src/components/Select.tsx
|
|
194
|
+
var import_react5 = require("react");
|
|
195
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
196
|
+
var Select = (0, import_react5.forwardRef)(
|
|
197
|
+
({ size = "md", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
198
|
+
"select",
|
|
199
|
+
{
|
|
200
|
+
ref,
|
|
201
|
+
className: cx("uix-select", size === "sm" && "uix-select--sm", className),
|
|
202
|
+
...props
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
);
|
|
206
|
+
Select.displayName = "Select";
|
|
207
|
+
|
|
208
|
+
// src/components/Checkbox.tsx
|
|
209
|
+
var import_react6 = require("react");
|
|
210
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
211
|
+
var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "1.5,6 4.5,9 10.5,3" }) });
|
|
212
|
+
var IndeterminateIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "2", y: "5", width: "8", height: "2", rx: "1", fill: "currentColor" }) });
|
|
213
|
+
var Checkbox = (0, import_react6.forwardRef)(
|
|
214
|
+
({ label, indeterminate, className, ...props }, forwardedRef) => {
|
|
215
|
+
const innerRef = (0, import_react6.useRef)(null);
|
|
216
|
+
(0, import_react6.useEffect)(() => {
|
|
217
|
+
const el = innerRef.current;
|
|
218
|
+
if (el) el.indeterminate = !!indeterminate;
|
|
219
|
+
}, [indeterminate]);
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: cx("uix-checkbox", className), children: [
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
222
|
+
"input",
|
|
223
|
+
{
|
|
224
|
+
type: "checkbox",
|
|
225
|
+
ref: (node) => {
|
|
226
|
+
innerRef.current = node;
|
|
227
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
228
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
229
|
+
},
|
|
230
|
+
...props
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "uix-checkbox__box", children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IndeterminateIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckIcon, {}) }),
|
|
234
|
+
label
|
|
235
|
+
] });
|
|
236
|
+
}
|
|
237
|
+
);
|
|
238
|
+
Checkbox.displayName = "Checkbox";
|
|
239
|
+
|
|
240
|
+
// src/components/Radio.tsx
|
|
241
|
+
var import_react7 = require("react");
|
|
242
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
243
|
+
var Radio = (0, import_react7.forwardRef)(
|
|
244
|
+
({ label, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: cx("uix-radio", className), children: [
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "radio", ref, ...props }),
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uix-radio__dot" }),
|
|
247
|
+
label
|
|
248
|
+
] })
|
|
249
|
+
);
|
|
250
|
+
Radio.displayName = "Radio";
|
|
251
|
+
function RadioGroup({ children, className }) {
|
|
252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cx("uix-radio-group", className), children });
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/components/Switch.tsx
|
|
256
|
+
var import_react8 = require("react");
|
|
257
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
258
|
+
var Switch = (0, import_react8.forwardRef)(
|
|
259
|
+
({ label, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: cx("uix-switch", className), children: [
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { type: "checkbox", role: "switch", ref, ...props }),
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "uix-switch__track" }),
|
|
262
|
+
label
|
|
263
|
+
] })
|
|
264
|
+
);
|
|
265
|
+
Switch.displayName = "Switch";
|
|
266
|
+
|
|
267
|
+
// src/components/Field.tsx
|
|
268
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
269
|
+
function Field({ label, hint, error, success, required, children, className, htmlFor }) {
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cx("uix-field", className), children: [
|
|
271
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "uix-field__label", htmlFor, "data-required": required || void 0, children: label }),
|
|
272
|
+
children,
|
|
273
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__error", children: error }),
|
|
274
|
+
success && !error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__success", children: success }),
|
|
275
|
+
hint && !error && !success && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "uix-field__hint", children: hint })
|
|
276
|
+
] });
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/components/Modal.tsx
|
|
280
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
281
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
282
|
+
function Modal({ open, onClose, title, children, footer, className, style }) {
|
|
283
|
+
const ref = useDialog(open);
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("dialog", { ref, className: cx("uix-dialog", className), style, onClose, children: [
|
|
285
|
+
(title != null || onClose) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "uix-dialog__header", children: [
|
|
286
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "uix-dialog__title", children: title }),
|
|
287
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { className: "uix-dialog__close", onClick: onClose, "aria-label": "Close dialog", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CloseIcon, {}) })
|
|
288
|
+
] }),
|
|
289
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "uix-dialog__body", children }),
|
|
290
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "uix-dialog__footer", children: footer })
|
|
291
|
+
] });
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/components/Drawer.tsx
|
|
295
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
296
|
+
var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
297
|
+
function Drawer({ open, onClose, title, children, footer, className }) {
|
|
298
|
+
const ref = useDialog(open);
|
|
299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("dialog", { ref, className: cx("uix-drawer", className), onClose, children: [
|
|
300
|
+
(title != null || onClose) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "uix-drawer__header", children: [
|
|
301
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontWeight: 600, fontSize: "var(--uix-text-h3)" }, children: title }),
|
|
302
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
303
|
+
"button",
|
|
304
|
+
{
|
|
305
|
+
style: { marginLeft: "auto", border: 0, background: "transparent", color: "var(--uix-text-muted)", cursor: "pointer", width: 30, height: 30, display: "grid", placeItems: "center", borderRadius: "var(--uix-radius-sm)" },
|
|
306
|
+
onClick: onClose,
|
|
307
|
+
"aria-label": "Close drawer",
|
|
308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CloseIcon2, {})
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] }),
|
|
312
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uix-drawer__body", children }),
|
|
313
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "uix-drawer__footer", children: footer })
|
|
314
|
+
] });
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// src/components/Peek.tsx
|
|
318
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
319
|
+
var CloseIcon3 = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
320
|
+
var ChevronUp = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M2 8l4-4 4 4" }) });
|
|
321
|
+
var ChevronDown = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
322
|
+
function Peek({ open, onClose, title, children, footer, onNavPrev, onNavNext, hint, className }) {
|
|
323
|
+
const ref = useDialog(open);
|
|
324
|
+
const hasNav = onNavPrev != null || onNavNext != null;
|
|
325
|
+
const onBackdropClick = (e) => {
|
|
326
|
+
if (!onClose || e.target !== e.currentTarget) return;
|
|
327
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
328
|
+
if (r.width === 0) return;
|
|
329
|
+
const outside = e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;
|
|
330
|
+
if (outside) onClose();
|
|
331
|
+
};
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("dialog", { ref, className: cx("uix-peek", className), onClose, onClick: onBackdropClick, children: [
|
|
333
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uix-peek__header", children: [
|
|
334
|
+
hasNav && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uix-peek__nav", children: [
|
|
335
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__navbtn", onClick: onNavPrev, disabled: !onNavPrev, "aria-label": "Previous record", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronUp, {}) }),
|
|
336
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__navbtn", onClick: onNavNext, disabled: !onNavNext, "aria-label": "Next record", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronDown, {}) })
|
|
337
|
+
] }),
|
|
338
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uix-peek__title", children: title }),
|
|
339
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "uix-peek__hint", children: hint }),
|
|
340
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "uix-peek__close", onClick: onClose, "aria-label": "Close preview", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CloseIcon3, {}) })
|
|
341
|
+
] }),
|
|
342
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uix-peek__body", children }),
|
|
343
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uix-peek__footer", children: footer })
|
|
344
|
+
] });
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/components/Card.tsx
|
|
348
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
349
|
+
function Card({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
350
|
+
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cx("uix-card", className), ...props, children: [
|
|
352
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "uix-card__header", children: [
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { flex: 1 }, children: [
|
|
354
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-card__title", children: title }),
|
|
355
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-card__subtitle", children: subtitle })
|
|
356
|
+
] }),
|
|
357
|
+
headerAction
|
|
358
|
+
] }),
|
|
359
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-card__body", children }),
|
|
360
|
+
footer != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "uix-card__footer", children: footer })
|
|
361
|
+
] });
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// src/components/PageHeader.tsx
|
|
365
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
366
|
+
function PageHeader({ eyebrow, title, subtitle, actions, className, ...props }) {
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("header", { className: cx("uix-page-header", className), ...props, children: [
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "uix-page-header__titles", children: [
|
|
369
|
+
eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-page-header__eyebrow", children: eyebrow }),
|
|
370
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h1", { className: "uix-page-header__title", children: title }),
|
|
371
|
+
subtitle != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "uix-page-header__subtitle", children: subtitle })
|
|
372
|
+
] }),
|
|
373
|
+
actions != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "uix-page-header__actions", children: actions })
|
|
374
|
+
] });
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// src/components/DetailLayout.tsx
|
|
378
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
379
|
+
function DetailLayout({ side, children, className, ...props }) {
|
|
380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cx("uix-detail", className), ...props, children: [
|
|
381
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-detail__main", children }),
|
|
382
|
+
side != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "uix-detail__side", children: side })
|
|
383
|
+
] });
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// src/components/List.tsx
|
|
387
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
388
|
+
function List({ children, className, ...props }) {
|
|
389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cx("uix-list", className), ...props, children });
|
|
390
|
+
}
|
|
391
|
+
function ListItem({ title, meta, trail, leading, children, className, ...props }) {
|
|
392
|
+
const hasTitleBlock = title != null || meta != null;
|
|
393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cx("uix-list__item", className), ...props, children: [
|
|
394
|
+
leading,
|
|
395
|
+
hasTitleBlock && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
396
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uix-list__title", children: title }),
|
|
397
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uix-list__meta", children: meta })
|
|
398
|
+
] }),
|
|
399
|
+
children,
|
|
400
|
+
trail != null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uix-list__trail", children: trail })
|
|
401
|
+
] });
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/components/Tabs.tsx
|
|
405
|
+
var import_react9 = require("react");
|
|
406
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
407
|
+
var TabsCtx = (0, import_react9.createContext)({});
|
|
408
|
+
function Tabs({ variant = "line", value, onChange, children, className }) {
|
|
409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TabsCtx.Provider, { value: { value, onChange }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "tablist", className: cx("uix-tabs", `uix-tabs--${variant}`, className), children }) });
|
|
410
|
+
}
|
|
411
|
+
function Tab({ value, children, disabled, className, onClick, ...props }) {
|
|
412
|
+
const ctx = (0, import_react9.useContext)(TabsCtx);
|
|
413
|
+
const selected = ctx.value === value;
|
|
414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
415
|
+
"button",
|
|
416
|
+
{
|
|
417
|
+
role: "tab",
|
|
418
|
+
className: cx("uix-tab", className),
|
|
419
|
+
"aria-selected": selected,
|
|
420
|
+
disabled,
|
|
421
|
+
onClick: (e) => {
|
|
422
|
+
ctx.onChange?.(value);
|
|
423
|
+
onClick?.(e);
|
|
424
|
+
},
|
|
425
|
+
...props,
|
|
426
|
+
children
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/components/AppShell.tsx
|
|
432
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
433
|
+
function AppShell({ collapsed, sidebar, topbar, children, className, ...props }) {
|
|
434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cx("uix-shell", className), "data-collapsed": collapsed || void 0, ...props, children: [
|
|
435
|
+
sidebar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "uix-shell__sidebar", children: sidebar }),
|
|
436
|
+
topbar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "uix-shell__topbar", children: topbar }),
|
|
437
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("main", { className: "uix-shell__main", children })
|
|
438
|
+
] });
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// src/components/Sidebar.tsx
|
|
442
|
+
var import_react10 = require("react");
|
|
443
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
444
|
+
var ChevronIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "uix-navgroup__chevron", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
445
|
+
function Sidebar({ collapsed, onToggle, brand, toggleIcon, children, className, ...props }) {
|
|
446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("nav", { className: cx("uix-sidebar", className), "data-collapsed": collapsed || void 0, ...props, children: [
|
|
447
|
+
(brand != null || onToggle) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "uix-sidebar__head", children: [
|
|
448
|
+
brand && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "uix-sidebar__brand", children: brand }),
|
|
449
|
+
onToggle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: "uix-sidebar__toggle", onClick: onToggle, "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar", children: toggleIcon ?? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", stroke: "currentColor", strokeWidth: 1.5, "aria-hidden": "true", children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "3", y: "4", width: "12", height: "1.5", rx: ".75" }),
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "3", y: "8.25", width: "8", height: "1.5", rx: ".75" }),
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "3", y: "12.5", width: "12", height: "1.5", rx: ".75" })
|
|
453
|
+
] }) })
|
|
454
|
+
] }),
|
|
455
|
+
children
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
458
|
+
function SidebarSection({ label, children }) {
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
460
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "uix-sidebar__eyebrow", children: label }),
|
|
461
|
+
children
|
|
462
|
+
] });
|
|
463
|
+
}
|
|
464
|
+
function NavItem({ icon, badge, active, as: Tag = "a", children, className, ...props }) {
|
|
465
|
+
if (Tag === "button") {
|
|
466
|
+
const { href: _href, ...btnProps } = props;
|
|
467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
468
|
+
"button",
|
|
469
|
+
{
|
|
470
|
+
className: cx("uix-navitem", className),
|
|
471
|
+
"aria-current": active ? "page" : void 0,
|
|
472
|
+
...btnProps,
|
|
473
|
+
children: [
|
|
474
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__label", children }),
|
|
476
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__badge", children: badge })
|
|
477
|
+
]
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
482
|
+
"a",
|
|
483
|
+
{
|
|
484
|
+
className: cx("uix-navitem", className),
|
|
485
|
+
"aria-current": active ? "page" : void 0,
|
|
486
|
+
...props,
|
|
487
|
+
children: [
|
|
488
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__label", children }),
|
|
490
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__badge", children: badge })
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
function NavGroup({ icon, label, children, defaultExpanded = true }) {
|
|
496
|
+
const [expanded, setExpanded] = (0, import_react10.useState)(defaultExpanded);
|
|
497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "uix-navgroup", children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
499
|
+
"button",
|
|
500
|
+
{
|
|
501
|
+
className: "uix-navitem uix-navgroup__trigger",
|
|
502
|
+
"aria-expanded": expanded,
|
|
503
|
+
onClick: () => setExpanded((v) => !v),
|
|
504
|
+
children: [
|
|
505
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__icon", "aria-hidden": "true", children: icon }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__label", children: label }),
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronIcon, {})
|
|
508
|
+
]
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "uix-navgroup__panel", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children }) })
|
|
512
|
+
] });
|
|
513
|
+
}
|
|
514
|
+
function SubNavItem({ active, as: Tag = "a", children, className, ...props }) {
|
|
515
|
+
const cls = cx("uix-navitem uix-subitem", className);
|
|
516
|
+
if (Tag === "button") {
|
|
517
|
+
const { href: _href, ...btnProps } = props;
|
|
518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className: cls, "aria-current": active ? "page" : void 0, ...btnProps, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__label", children }) });
|
|
519
|
+
}
|
|
520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("a", { className: cls, "aria-current": active ? "page" : void 0, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uix-navitem__label", children }) });
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/components/Alert.tsx
|
|
524
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
525
|
+
function Alert({ tone, title, icon, children, className, ...props }) {
|
|
526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: cx("uix-alert", tone && tone !== "neutral" && `uix-alert--${tone}`, className), ...props, children: [
|
|
527
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uix-alert__icon", children: icon }),
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
529
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uix-alert__title", children: title }),
|
|
530
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uix-alert__body", children })
|
|
531
|
+
] })
|
|
532
|
+
] });
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/components/Spinner.tsx
|
|
536
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
537
|
+
function Spinner({ size = "md", accent, className, ...props }) {
|
|
538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
539
|
+
"span",
|
|
540
|
+
{
|
|
541
|
+
className: cx("uix-spinner", accent && "uix-spinner--accent", size === "lg" && "uix-spinner--lg", className),
|
|
542
|
+
role: "status",
|
|
543
|
+
"aria-label": "Loading",
|
|
544
|
+
...props
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// src/components/Toast.tsx
|
|
550
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
551
|
+
function Toast({ title, message, tone, icon, onClose, leaving, className, ...props }) {
|
|
552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
553
|
+
"div",
|
|
554
|
+
{
|
|
555
|
+
className: cx("uix-toast", tone && `uix-toast--${tone}`, className),
|
|
556
|
+
"data-leaving": leaving || void 0,
|
|
557
|
+
role: "status",
|
|
558
|
+
"aria-live": "polite",
|
|
559
|
+
...props,
|
|
560
|
+
children: [
|
|
561
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "uix-toast__icon", children: icon }),
|
|
562
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "uix-toast__body", children: [
|
|
563
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "uix-toast__title", children: title }),
|
|
564
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "uix-toast__msg", children: message })
|
|
565
|
+
] }),
|
|
566
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { className: "uix-toast__close", onClick: onClose, "aria-label": "Dismiss", children: "\xD7" })
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
function Toaster({ children, className, ...props }) {
|
|
572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: cx("uix-toaster", className), "aria-live": "polite", "aria-atomic": "false", ...props, children });
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// src/components/Table.tsx
|
|
576
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
577
|
+
function TableWrap({ children, className, ...props }) {
|
|
578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx("uix-table-wrap", className), ...props, children });
|
|
579
|
+
}
|
|
580
|
+
function Table({
|
|
581
|
+
density = "standard",
|
|
582
|
+
zebra = true,
|
|
583
|
+
pinnedCol,
|
|
584
|
+
rowPeek,
|
|
585
|
+
v2,
|
|
586
|
+
className,
|
|
587
|
+
children,
|
|
588
|
+
...props
|
|
589
|
+
}) {
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
591
|
+
"table",
|
|
592
|
+
{
|
|
593
|
+
className: cx("uix-table", !zebra && "uix-table--no-zebra", pinnedCol && "uix-table--pinned-col", className),
|
|
594
|
+
"data-density": density !== "standard" ? density : void 0,
|
|
595
|
+
"data-uix-rowpeek": rowPeek || void 0,
|
|
596
|
+
"data-uix-table-v2": v2 || void 0,
|
|
597
|
+
...props,
|
|
598
|
+
children
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
function Th({ sortable, sortDirection, onSort, className, children, onClick, ...props }) {
|
|
603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
604
|
+
"th",
|
|
605
|
+
{
|
|
606
|
+
className,
|
|
607
|
+
"data-sort": sortable || void 0,
|
|
608
|
+
"aria-sort": sortDirection && sortDirection !== "none" ? sortDirection : void 0,
|
|
609
|
+
onClick: sortable ? onSort ?? onClick : onClick,
|
|
610
|
+
...props,
|
|
611
|
+
children
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
function Td({ pinned, className, children, ...props }) {
|
|
616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", { className, "data-pinned": pinned || void 0, ...props, children });
|
|
617
|
+
}
|
|
618
|
+
function Tr({ selected, pinned, className, children, ...props }) {
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
620
|
+
"tr",
|
|
621
|
+
{
|
|
622
|
+
className,
|
|
623
|
+
"aria-selected": selected || void 0,
|
|
624
|
+
"data-pinned": pinned || void 0,
|
|
625
|
+
...props,
|
|
626
|
+
children
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// src/components/Pagination.tsx
|
|
632
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
633
|
+
function getPageNumbers(page, total) {
|
|
634
|
+
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
635
|
+
const pages = [1];
|
|
636
|
+
if (page > 3) pages.push("ellipsis");
|
|
637
|
+
const start = Math.max(2, page - 1);
|
|
638
|
+
const end = Math.min(total - 1, page + 1);
|
|
639
|
+
for (let p = start; p <= end; p++) pages.push(p);
|
|
640
|
+
if (page < total - 2) pages.push("ellipsis");
|
|
641
|
+
pages.push(total);
|
|
642
|
+
return pages;
|
|
643
|
+
}
|
|
644
|
+
function Pagination({ page, pageCount, onChange, className, ...props }) {
|
|
645
|
+
const pages = getPageNumbers(page, pageCount);
|
|
646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("nav", { "aria-label": "Pagination", className: cx("uix-pagination", className), ...props, children: [
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
648
|
+
"button",
|
|
649
|
+
{
|
|
650
|
+
className: "uix-pagination__btn",
|
|
651
|
+
onClick: () => onChange(page - 1),
|
|
652
|
+
disabled: page <= 1,
|
|
653
|
+
"aria-label": "Previous page",
|
|
654
|
+
children: "\u2039"
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
pages.map(
|
|
658
|
+
(p, i) => p === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "uix-pagination__ellipsis", children: "\u2026" }, `e${i}`) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
659
|
+
"button",
|
|
660
|
+
{
|
|
661
|
+
className: "uix-pagination__btn",
|
|
662
|
+
"aria-current": p === page ? "page" : void 0,
|
|
663
|
+
onClick: () => onChange(p),
|
|
664
|
+
children: p
|
|
665
|
+
},
|
|
666
|
+
p
|
|
667
|
+
)
|
|
668
|
+
),
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
670
|
+
"button",
|
|
671
|
+
{
|
|
672
|
+
className: "uix-pagination__btn",
|
|
673
|
+
onClick: () => onChange(page + 1),
|
|
674
|
+
disabled: page >= pageCount,
|
|
675
|
+
"aria-label": "Next page",
|
|
676
|
+
children: "\u203A"
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
] });
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// src/components/StatusPill.tsx
|
|
683
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
684
|
+
function StatusPill({ tone = "neutral", treatment = "filled", dot, children, className, ...props }) {
|
|
685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
686
|
+
"span",
|
|
687
|
+
{
|
|
688
|
+
className: cx("uix-pill", `uix-pill--${tone}`, treatment === "outline" && "uix-pill--outline", className),
|
|
689
|
+
...props,
|
|
690
|
+
children: [
|
|
691
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uix-pill__dot", "aria-hidden": "true" }),
|
|
692
|
+
children
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// src/components/Progress.tsx
|
|
699
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
700
|
+
function Progress({ value = 0, max = 100, indeterminate, className, ...props }) {
|
|
701
|
+
const pct = Math.max(0, Math.min(100, value / (max || 100) * 100));
|
|
702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
703
|
+
"div",
|
|
704
|
+
{
|
|
705
|
+
role: "progressbar",
|
|
706
|
+
"aria-valuemin": 0,
|
|
707
|
+
"aria-valuemax": max,
|
|
708
|
+
"aria-valuenow": indeterminate ? void 0 : value,
|
|
709
|
+
className: cx("uix-progress", indeterminate && "uix-progress--indeterminate", className),
|
|
710
|
+
...props,
|
|
711
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "uix-progress__bar", style: indeterminate ? void 0 : { width: `${pct}%` } })
|
|
712
|
+
}
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// src/components/Stat.tsx
|
|
717
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
718
|
+
function Stat({ label, value, icon, meta, trend, className, ...props }) {
|
|
719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: cx("uix-stat", className), ...props, children: [
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uix-stat__label", children: [
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: label }),
|
|
722
|
+
icon
|
|
723
|
+
] }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uix-stat__value", children: value }),
|
|
725
|
+
(meta != null || trend != null) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uix-stat__meta", children: [
|
|
726
|
+
trend != null && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: cx("uix-stat__trend", `uix-stat__trend--${trend.direction}`), children: trend.label }),
|
|
727
|
+
meta
|
|
728
|
+
] })
|
|
729
|
+
] });
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// src/components/Tooltip.tsx
|
|
733
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
734
|
+
function Tooltip({ label, children, ...props }) {
|
|
735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { "data-uix-tip": label, ...props, children });
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// src/components/States.tsx
|
|
739
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
740
|
+
function EmptyState({ icon, title, children, action, className, ...props }) {
|
|
741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cx("uix-empty", className), ...props, children: [
|
|
742
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uix-empty__icon", children: icon }),
|
|
743
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uix-empty__title", children: title }),
|
|
744
|
+
children,
|
|
745
|
+
action
|
|
746
|
+
] });
|
|
747
|
+
}
|
|
748
|
+
function ErrorState({ icon, title, detail, action, className, ...props }) {
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: cx("uix-empty", "uix-empty--danger", className), role: "alert", ...props, children: [
|
|
750
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uix-empty__icon uix-empty__icon--danger", children: icon }),
|
|
751
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uix-empty__title", children: title }),
|
|
752
|
+
detail != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { children: detail }),
|
|
753
|
+
action
|
|
754
|
+
] });
|
|
755
|
+
}
|
|
756
|
+
function Skeleton({ variant = "block", width, height, className, style, ...props }) {
|
|
757
|
+
const dims = { width, height, ...style };
|
|
758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
className: cx(
|
|
762
|
+
"uix-skeleton",
|
|
763
|
+
variant === "text" && "uix-skeleton--text",
|
|
764
|
+
variant === "circle" && "uix-skeleton--circle",
|
|
765
|
+
className
|
|
766
|
+
),
|
|
767
|
+
style: dims,
|
|
768
|
+
...props
|
|
769
|
+
}
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
function LoadingState({ rows = 3, className, ...props }) {
|
|
773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cx("uix-stack", className), role: "status", "aria-busy": "true", ...props, children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Skeleton, { variant: "text", width: `${92 - i % 3 * 14}%` }, i)) });
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/components/Label.tsx
|
|
777
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
778
|
+
function Label({ color, dot, children, className, style, ...props }) {
|
|
779
|
+
const merged = color ? { "--label-color": color, ...style } : style;
|
|
780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: cx("uix-label", className), style: merged, ...props, children: [
|
|
781
|
+
dot && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "uix-label__dot", "aria-hidden": "true" }),
|
|
782
|
+
children
|
|
783
|
+
] });
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// src/components/Avatar.tsx
|
|
787
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
788
|
+
function Avatar({ size = "md", src, alt, children, status, className, ...props }) {
|
|
789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: cx("uix-avatar", size !== "md" && `uix-avatar--${size}`, className), ...props, children: [
|
|
790
|
+
src ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src, alt: alt ?? "" }) : children,
|
|
791
|
+
status && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "uix-avatar__status" })
|
|
792
|
+
] });
|
|
793
|
+
}
|
|
794
|
+
function AvatarGroup({ children, className, ...props }) {
|
|
795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: cx("uix-avatar-group", className), ...props, children });
|
|
796
|
+
}
|
|
797
|
+
function UserChip({ avatar, name, sub, className, children, ...props }) {
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: cx("uix-user-chip", className), ...props, children: [
|
|
799
|
+
avatar,
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { children: [
|
|
801
|
+
name != null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "uix-user-chip__name", children: name }),
|
|
802
|
+
sub != null && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "uix-user-chip__sub", style: { display: "block" }, children: sub })
|
|
803
|
+
] }),
|
|
804
|
+
children
|
|
805
|
+
] });
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// src/components/Comments.tsx
|
|
809
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
810
|
+
function Comments({ children, className, ...props }) {
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cx("uix-comments", className), ...props, children });
|
|
812
|
+
}
|
|
813
|
+
function Comment({ avatar, author, meta, children, className, ...props }) {
|
|
814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cx("uix-comment", className), ...props, children: [
|
|
815
|
+
avatar ?? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { "aria-hidden": "true" }),
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "uix-comment__body", children: [
|
|
817
|
+
(author != null || meta != null) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "uix-comment__meta", children: [
|
|
818
|
+
author != null && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "uix-comment__author", children: author }),
|
|
819
|
+
author != null && meta != null ? " \xB7 " : null,
|
|
820
|
+
meta
|
|
821
|
+
] }),
|
|
822
|
+
children
|
|
823
|
+
] })
|
|
824
|
+
] });
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// src/components/Timeline.tsx
|
|
828
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
829
|
+
function Timeline({ children, className, ...props }) {
|
|
830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cx("uix-timeline", className), ...props, children });
|
|
831
|
+
}
|
|
832
|
+
function TimelineItem({ meta, children, className, ...props }) {
|
|
833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx("uix-timeline__item", className), ...props, children: [
|
|
834
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "uix-timeline__rail", children: [
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "uix-timeline__node" }),
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "uix-timeline__line" })
|
|
837
|
+
] }),
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "uix-timeline__body", children: [
|
|
839
|
+
meta != null && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "uix-timeline__meta", children: meta }),
|
|
840
|
+
children
|
|
841
|
+
] })
|
|
842
|
+
] });
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// src/components/Prose.tsx
|
|
846
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
847
|
+
function Prose({ children, className, ...props }) {
|
|
848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx("uix-prose", className), ...props, children });
|
|
849
|
+
}
|
|
850
|
+
function Note({ tone, icon, children, className, ...props }) {
|
|
851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cx("uix-note", tone && `uix-note--${tone}`, className), ...props, children: [
|
|
852
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "uix-note__icon", children: icon }),
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "uix-note__body", children })
|
|
854
|
+
] });
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// src/components/Popover.tsx
|
|
858
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
859
|
+
function Popover({ popover = "auto", children, className, ...props }) {
|
|
860
|
+
const popoverAttr = { popover };
|
|
861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cx("uix-popover", className), ...popoverAttr, ...props, children });
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
// src/components/CommandPalette.tsx
|
|
865
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
866
|
+
function CommandPalette({ inputProps, children, className, ...props }) {
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { className: "uix-cmdk__input", ...inputProps }),
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "uix-cmdk__list", children })
|
|
870
|
+
] });
|
|
871
|
+
}
|
|
872
|
+
function CommandGroup({ label, children }) {
|
|
873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
874
|
+
label != null && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "uix-cmdk__group", children: label }),
|
|
875
|
+
children
|
|
876
|
+
] });
|
|
877
|
+
}
|
|
878
|
+
function CommandItem({ icon, shortcut, active, children, className, ...props }) {
|
|
879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: cx("uix-cmdk__item", className), "data-active": active || void 0, ...props, children: [
|
|
880
|
+
icon,
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children }),
|
|
882
|
+
shortcut
|
|
883
|
+
] });
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// src/components/Kanban.tsx
|
|
887
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
888
|
+
function Kanban({ children, className, ...props }) {
|
|
889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cx("uix-kanban", className), ...props, children });
|
|
890
|
+
}
|
|
891
|
+
function KanbanColumn({ title, count, children, className, ...props }) {
|
|
892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: cx("uix-kanban__col", className), ...props, children: [
|
|
893
|
+
(title != null || count != null) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "uix-kanban__head", children: [
|
|
894
|
+
title,
|
|
895
|
+
count != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "uix-kanban__count", children: count })
|
|
896
|
+
] }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-kanban__body", children })
|
|
898
|
+
] });
|
|
899
|
+
}
|
|
900
|
+
function KanbanCard({ title, meta, children, className, ...props }) {
|
|
901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: cx("uix-kanban__card", className), ...props, children: [
|
|
902
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-kanban__card-title", children: title }),
|
|
903
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uix-kanban__card-meta", children: meta }),
|
|
904
|
+
children
|
|
905
|
+
] });
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// src/components/Tree.tsx
|
|
909
|
+
var import_react11 = require("react");
|
|
910
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
911
|
+
var ChevronIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M2 4l4 4 4-4" }) });
|
|
912
|
+
function TreeNode({ node, expanded, selected, onToggle, onSelect, level = 0 }) {
|
|
913
|
+
const hasChildren = Array.isArray(node.children) && node.children.length > 0;
|
|
914
|
+
const isExpanded = expanded.has(node.id);
|
|
915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("li", { children: [
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
917
|
+
"button",
|
|
918
|
+
{
|
|
919
|
+
className: "uix-tree__row",
|
|
920
|
+
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
921
|
+
"aria-selected": selected === node.id,
|
|
922
|
+
onClick: () => {
|
|
923
|
+
if (hasChildren) onToggle(node.id);
|
|
924
|
+
onSelect?.(node.id);
|
|
925
|
+
},
|
|
926
|
+
children: [
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "uix-tree__toggle", children: hasChildren && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ChevronIcon2, {}) }),
|
|
928
|
+
node.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "aria-hidden": "true", children: node.icon }),
|
|
929
|
+
node.label
|
|
930
|
+
]
|
|
931
|
+
}
|
|
932
|
+
),
|
|
933
|
+
hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("ul", { children: node.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
934
|
+
TreeNode,
|
|
935
|
+
{
|
|
936
|
+
node: child,
|
|
937
|
+
expanded,
|
|
938
|
+
selected,
|
|
939
|
+
onToggle,
|
|
940
|
+
onSelect,
|
|
941
|
+
level: level + 1
|
|
942
|
+
},
|
|
943
|
+
child.id
|
|
944
|
+
)) })
|
|
945
|
+
] });
|
|
946
|
+
}
|
|
947
|
+
function Tree({ nodes, expanded: controlledExpanded, defaultExpanded, selected, onToggle, onSelect, className, ...props }) {
|
|
948
|
+
const [internalExpanded, setInternalExpanded] = (0, import_react11.useState)(defaultExpanded ?? /* @__PURE__ */ new Set());
|
|
949
|
+
const expanded = controlledExpanded ?? internalExpanded;
|
|
950
|
+
function handleToggle(id) {
|
|
951
|
+
if (!controlledExpanded) {
|
|
952
|
+
setInternalExpanded((prev) => {
|
|
953
|
+
const next = new Set(prev);
|
|
954
|
+
if (next.has(id)) next.delete(id);
|
|
955
|
+
else next.add(id);
|
|
956
|
+
return next;
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
onToggle?.(id);
|
|
960
|
+
}
|
|
961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("ul", { className: cx("uix-tree", className), role: "tree", ...props, children: nodes.map((node) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
962
|
+
TreeNode,
|
|
963
|
+
{
|
|
964
|
+
node,
|
|
965
|
+
expanded,
|
|
966
|
+
selected,
|
|
967
|
+
onToggle: handleToggle,
|
|
968
|
+
onSelect
|
|
969
|
+
},
|
|
970
|
+
node.id
|
|
971
|
+
)) });
|
|
972
|
+
}
|
|
973
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
974
|
+
0 && (module.exports = {
|
|
975
|
+
Alert,
|
|
976
|
+
AppShell,
|
|
977
|
+
Avatar,
|
|
978
|
+
AvatarGroup,
|
|
979
|
+
Button,
|
|
980
|
+
ButtonGroup,
|
|
981
|
+
Card,
|
|
982
|
+
Checkbox,
|
|
983
|
+
CommandGroup,
|
|
984
|
+
CommandItem,
|
|
985
|
+
CommandPalette,
|
|
986
|
+
Comment,
|
|
987
|
+
Comments,
|
|
988
|
+
DetailLayout,
|
|
989
|
+
Drawer,
|
|
990
|
+
EmptyState,
|
|
991
|
+
ErrorState,
|
|
992
|
+
Field,
|
|
993
|
+
Input,
|
|
994
|
+
InputGroup,
|
|
995
|
+
Kanban,
|
|
996
|
+
KanbanCard,
|
|
997
|
+
KanbanColumn,
|
|
998
|
+
Label,
|
|
999
|
+
List,
|
|
1000
|
+
ListItem,
|
|
1001
|
+
LoadingState,
|
|
1002
|
+
Modal,
|
|
1003
|
+
NavGroup,
|
|
1004
|
+
NavItem,
|
|
1005
|
+
Note,
|
|
1006
|
+
PageHeader,
|
|
1007
|
+
Pagination,
|
|
1008
|
+
Peek,
|
|
1009
|
+
Popover,
|
|
1010
|
+
Progress,
|
|
1011
|
+
Prose,
|
|
1012
|
+
Radio,
|
|
1013
|
+
RadioGroup,
|
|
1014
|
+
Select,
|
|
1015
|
+
Sidebar,
|
|
1016
|
+
SidebarSection,
|
|
1017
|
+
Skeleton,
|
|
1018
|
+
Spinner,
|
|
1019
|
+
Stat,
|
|
1020
|
+
StatusPill,
|
|
1021
|
+
SubNavItem,
|
|
1022
|
+
Switch,
|
|
1023
|
+
Tab,
|
|
1024
|
+
Table,
|
|
1025
|
+
TableWrap,
|
|
1026
|
+
Tabs,
|
|
1027
|
+
Td,
|
|
1028
|
+
Textarea,
|
|
1029
|
+
Th,
|
|
1030
|
+
Timeline,
|
|
1031
|
+
TimelineItem,
|
|
1032
|
+
Toast,
|
|
1033
|
+
Toaster,
|
|
1034
|
+
Tooltip,
|
|
1035
|
+
Tr,
|
|
1036
|
+
Tree,
|
|
1037
|
+
UserChip,
|
|
1038
|
+
cx,
|
|
1039
|
+
useDialog
|
|
1040
|
+
});
|