@alea-design/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/components/accordion/Accordion.js +29 -0
- package/dist/components/ai/AI.d.ts +5 -1
- package/dist/components/ai/AI.js +187 -0
- package/dist/components/app/AppParts.d.ts +16 -4
- package/dist/components/app/AppParts.js +134 -0
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.js +137 -0
- package/dist/components/button/Groups.d.ts +1 -1
- package/dist/components/button/Groups.js +112 -0
- package/dist/components/card/Card.d.ts +3 -2
- package/dist/components/card/Card.js +47 -0
- package/dist/components/chat/Chat.d.ts +4 -2
- package/dist/components/chat/Chat.js +275 -0
- package/dist/components/choice/Choice.js +69 -0
- package/dist/components/color/Color.d.ts +3 -3
- package/dist/components/color/Color.js +98 -0
- package/dist/components/combobox/Autocomplete.d.ts +5 -5
- package/dist/components/combobox/Autocomplete.js +126 -0
- package/dist/components/combobox/ComboBox.d.ts +4 -4
- package/dist/components/combobox/ComboBox.js +112 -0
- package/dist/components/combobox/Highlight.js +50 -0
- package/dist/components/command/CommandPalette.d.ts +10 -3
- package/dist/components/command/CommandPalette.js +56 -0
- package/dist/components/content/Content.d.ts +1 -1
- package/dist/components/content/Content.js +125 -0
- package/dist/components/data/Data.js +79 -0
- package/dist/components/date/Date.js +109 -0
- package/dist/components/display/Display.d.ts +5 -3
- package/dist/components/display/Display.js +89 -0
- package/dist/components/display/Display2.d.ts +3 -1
- package/dist/components/display/Display2.js +75 -0
- package/dist/components/emoji/EmojiPicker.js +52 -0
- package/dist/components/emoji/emoji-data.js +27 -0
- package/dist/components/extras/CodeSteps.d.ts +1 -0
- package/dist/components/extras/CodeSteps.js +19 -0
- package/dist/components/extras/Extras.d.ts +1 -1
- package/dist/components/extras/Extras.js +116 -0
- package/dist/components/feedback/Feedback.d.ts +11 -8
- package/dist/components/feedback/Feedback.js +185 -0
- package/dist/components/feedback/Spinner.js +18 -0
- package/dist/components/feedback/Status.d.ts +6 -2
- package/dist/components/feedback/Status.js +48 -0
- package/dist/components/field/Field.d.ts +1 -1
- package/dist/components/field/Field.js +187 -0
- package/dist/components/field/FieldLoading.d.ts +1 -1
- package/dist/components/field/FieldLoading.js +18 -0
- package/dist/components/filter/FilterBar.js +96 -0
- package/dist/components/form/Form.d.ts +5 -5
- package/dist/components/form/Form.js +53 -0
- package/dist/components/icon/Icon.d.ts +2 -2
- package/dist/components/icon/Icon.js +66 -0
- package/dist/components/icon/icon-cells.js +39 -0
- package/dist/components/icon/icon-contexts.d.ts +1 -1
- package/dist/components/icon/icon-contexts.js +38 -0
- package/dist/components/icon/icon-names.d.ts +1 -1
- package/dist/components/icon/icon-names.js +376 -0
- package/dist/components/layout/Bento.d.ts +1 -1
- package/dist/components/layout/Bento.js +38 -0
- package/dist/components/layout/Layout.d.ts +1 -1
- package/dist/components/layout/Layout.js +54 -0
- package/dist/components/layout/Layout2.d.ts +36 -6
- package/dist/components/layout/Layout2.js +105 -0
- package/dist/components/layout/Layout3.js +35 -0
- package/dist/components/layout/Responsive.d.ts +1 -1
- package/dist/components/layout/Responsive.js +32 -0
- package/dist/components/list/List.d.ts +3 -2
- package/dist/components/list/List.js +82 -0
- package/dist/components/list/Lists2.d.ts +6 -4
- package/dist/components/list/Lists2.js +60 -0
- package/dist/components/media/Media.d.ts +8 -4
- package/dist/components/media/Media.js +188 -0
- package/dist/components/menu/Menu.d.ts +23 -12
- package/dist/components/menu/Menu.js +68 -0
- package/dist/components/more/More.d.ts +7 -7
- package/dist/components/more/More.js +182 -0
- package/dist/components/navigation/Navbar.d.ts +1 -1
- package/dist/components/navigation/Navbar.js +27 -0
- package/dist/components/navigation/Navigation.js +121 -0
- package/dist/components/navigation/Navigation2.d.ts +6 -2
- package/dist/components/navigation/Navigation2.js +355 -0
- package/dist/components/overlay/Drawer.d.ts +11 -6
- package/dist/components/overlay/Drawer.js +39 -0
- package/dist/components/overlay/Modal.d.ts +6 -3
- package/dist/components/overlay/Modal.js +27 -0
- package/dist/components/overlay/Overlay.d.ts +14 -9
- package/dist/components/overlay/Overlay.js +76 -0
- package/dist/components/overlay/Sheet.d.ts +11 -5
- package/dist/components/overlay/Sheet.js +52 -0
- package/dist/components/page/Page.d.ts +5 -5
- package/dist/components/page/Page.js +132 -0
- package/dist/components/page/PageParts.d.ts +5 -5
- package/dist/components/page/PageParts.js +109 -0
- package/dist/components/picker/Picker.d.ts +11 -11
- package/dist/components/picker/Picker.js +294 -0
- package/dist/components/picker/Wheel.js +132 -0
- package/dist/components/rating/Rating.d.ts +2 -1
- package/dist/components/rating/Rating.js +66 -0
- package/dist/components/select/Select.d.ts +8 -6
- package/dist/components/select/Select.js +146 -0
- package/dist/components/shell/AppShell.d.ts +3 -3
- package/dist/components/shell/AppShell.js +56 -0
- package/dist/components/shell/AppSidebar.d.ts +5 -5
- package/dist/components/shell/AppSidebar.js +62 -0
- package/dist/components/slider/Slider.d.ts +2 -1
- package/dist/components/slider/Slider.js +36 -0
- package/dist/components/surface/Surface.d.ts +16 -0
- package/dist/components/surface/Surface.js +7 -0
- package/dist/components/table/Table.d.ts +4 -3
- package/dist/components/table/Table.js +58 -0
- package/dist/components/tabs/Tabs.d.ts +1 -0
- package/dist/components/tabs/Tabs.js +120 -0
- package/dist/components/theme/Theme.d.ts +11 -6
- package/dist/components/theme/Theme.js +186 -0
- package/dist/components/theme/lens.js +104 -0
- package/dist/components/tree/Tree.js +303 -0
- package/dist/components/typography/Typography.js +43 -0
- package/dist/components/upload/Upload.js +71 -0
- package/dist/components/work/Ops.js +24 -0
- package/dist/components/work/Work.d.ts +4 -2
- package/dist/components/work/Work.js +241 -0
- package/dist/css/accordion.css +1 -0
- package/dist/css/ai.css +1 -0
- package/dist/css/app.css +1 -0
- package/dist/css/base.css +1 -0
- package/dist/css/button.css +1 -0
- package/dist/css/card.css +1 -0
- package/dist/css/chat.css +1 -0
- package/dist/css/choice.css +1 -0
- package/dist/css/color.css +1 -0
- package/dist/css/combobox.css +1 -0
- package/dist/css/command.css +1 -0
- package/dist/css/content.css +1 -0
- package/dist/css/data.css +1 -0
- package/dist/css/date.css +1 -0
- package/dist/css/display.css +1 -0
- package/dist/css/emoji.css +1 -0
- package/dist/css/extras.css +1 -0
- package/dist/css/feedback.css +1 -0
- package/dist/css/field.css +1 -0
- package/dist/css/filter.css +1 -0
- package/dist/css/form.css +1 -0
- package/dist/css/groups.json +346 -0
- package/dist/css/icon.css +1 -0
- package/dist/css/layout.css +1 -0
- package/dist/css/list.css +1 -0
- package/dist/css/media.css +1 -0
- package/dist/css/menu.css +1 -0
- package/dist/css/more.css +1 -0
- package/dist/css/navigation.css +1 -0
- package/dist/css/overlay.css +1 -0
- package/dist/css/page.css +1 -0
- package/dist/css/picker.css +1 -0
- package/dist/css/rating.css +1 -0
- package/dist/css/select.css +1 -0
- package/dist/css/shell.css +1 -0
- package/dist/css/slider.css +1 -0
- package/dist/css/surface.css +1 -0
- package/dist/css/table.css +1 -0
- package/dist/css/tabs.css +1 -0
- package/dist/css/tree.css +1 -0
- package/dist/css/typography.css +1 -0
- package/dist/css/upload.css +1 -0
- package/dist/css/work.css +1 -0
- package/dist/i18n/strings.js +842 -0
- package/dist/index.d.ts +71 -70
- package/dist/index.js +398 -7436
- package/dist/styles.css +1 -1
- package/dist/utils/Blueprint.js +131 -0
- package/dist/utils/DotField.js +32 -0
- package/dist/utils/attr.d.ts +1 -1
- package/dist/utils/attr.js +18 -0
- package/dist/utils/blueprintScene.js +161 -0
- package/dist/utils/controlled.js +11 -0
- package/dist/utils/cx.js +11 -0
- package/dist/utils/inert.js +9 -0
- package/dist/utils/refs.d.ts +3 -0
- package/dist/utils/refs.js +11 -0
- package/dist/utils/responsive.js +12 -0
- package/dist/utils/scrollEdges.js +31 -0
- package/dist/utils/space.js +10 -0
- package/dist/utils/vocabulary.d.ts +6 -0
- package/dist/utils/vocabulary.js +17 -0
- package/package.json +12 -8
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as H } from "react/jsx-runtime";
|
|
3
|
+
import { useState as W, useEffect as pe, useMemo as j, useRef as We, useContext as je, createContext as Ke } from "react";
|
|
4
|
+
import { useDragAndDrop as _e, Tree as Ae, Virtualizer as Ge, ListLayout as Je, TreeHeader as Qe, TreeItem as Ue, TreeItemContent as Xe, Button as ge, Checkbox as Ye, TreeLoadMoreItem as Ze, TreeSection as Ce, Collection as et } from "react-aria-components";
|
|
5
|
+
import { FolderOpen as tt, Folder as rt, File as it, GripVertical as nt, ChevronRight as st, Minus as at, Check as lt } from "lucide-react";
|
|
6
|
+
import { withBase as ye, cx as Ne } from "../../utils/cx.js";
|
|
7
|
+
import { useStrings as Se } from "../../i18n/strings.js";
|
|
8
|
+
import { Spinner as ie } from "../feedback/Spinner.js";
|
|
9
|
+
import { Skeleton as we } from "../feedback/Feedback.js";
|
|
10
|
+
import { useBusy as Te } from "../field/FieldLoading.js";
|
|
11
|
+
import { Highlight as ot } from "../combobox/Highlight.js";
|
|
12
|
+
const be = Ke({ size: "md", directory: !1, draggable: !1, canRename: !1, query: "", indeterminate: /* @__PURE__ */ new Set(), loading: /* @__PURE__ */ new Set(), renaming: null, setRenaming: () => {
|
|
13
|
+
}, rename: () => {
|
|
14
|
+
} }), v = (s, a, o = null) => {
|
|
15
|
+
for (const l of s)
|
|
16
|
+
a(l, o), l.children && v(l.children, a, l);
|
|
17
|
+
}, ne = (s, a, o) => s.map((l) => l.id === a ? o(l) : l.children ? { ...l, children: ne(l.children, a, o) } : l);
|
|
18
|
+
function dt(s, a = !0) {
|
|
19
|
+
const o = [];
|
|
20
|
+
return v(s, (l) => {
|
|
21
|
+
var m;
|
|
22
|
+
(!a || (m = l.children) != null && m.length) && o.push(l.id);
|
|
23
|
+
}), o;
|
|
24
|
+
}
|
|
25
|
+
function ct(s, a, o, l) {
|
|
26
|
+
const m = [], I = /* @__PURE__ */ new Set();
|
|
27
|
+
if (v(s, (u) => {
|
|
28
|
+
a.includes(u.id) && v([u], (n) => I.add(n.id));
|
|
29
|
+
}), I.has(o)) return s;
|
|
30
|
+
const y = (u) => u.flatMap((n) => a.includes(n.id) ? (m.push(n), []) : [n.children ? { ...n, children: y(n.children) } : n]), L = y(s), z = a.map((u) => m.find((n) => n.id === u)).filter(Boolean), p = (u) => u.flatMap((n) => n.id === o ? l === "on" ? [{ ...n, children: [...z, ...n.children || []] }] : l === "before" ? [...z, n] : [n, ...z] : [n.children ? { ...n, children: p(n.children) } : n]);
|
|
31
|
+
return p(L);
|
|
32
|
+
}
|
|
33
|
+
function xe(s, a) {
|
|
34
|
+
const o = a.toLowerCase();
|
|
35
|
+
return s.flatMap((l) => {
|
|
36
|
+
const m = l.children ? xe(l.children, a) : void 0;
|
|
37
|
+
return l.title.toLowerCase().includes(o) ? [l] : m != null && m.length ? [{ ...l, children: m }] : [];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function xt({
|
|
41
|
+
data: s,
|
|
42
|
+
onDataChange: a,
|
|
43
|
+
size: o = "md",
|
|
44
|
+
variant: l = "subtle",
|
|
45
|
+
showLines: m,
|
|
46
|
+
indent: I,
|
|
47
|
+
directory: y = !1,
|
|
48
|
+
expandOnClick: L,
|
|
49
|
+
defaultExpandAll: z,
|
|
50
|
+
checkable: p,
|
|
51
|
+
checkStrictly: u,
|
|
52
|
+
checkedKeys: n,
|
|
53
|
+
defaultCheckedKeys: K,
|
|
54
|
+
onCheckedChange: M,
|
|
55
|
+
loadChildren: S,
|
|
56
|
+
isLoading: T,
|
|
57
|
+
loadingRows: _ = 4,
|
|
58
|
+
filterText: Y = "",
|
|
59
|
+
draggable: A = !1,
|
|
60
|
+
onRename: b,
|
|
61
|
+
renderTitle: N,
|
|
62
|
+
virtualized: P,
|
|
63
|
+
maxHeight: $,
|
|
64
|
+
expandedKeys: q,
|
|
65
|
+
defaultExpandedKeys: f,
|
|
66
|
+
onExpandedChange: Z,
|
|
67
|
+
className: ke,
|
|
68
|
+
style: Ie,
|
|
69
|
+
children: ze,
|
|
70
|
+
renderEmptyState: Ee,
|
|
71
|
+
onAction: G,
|
|
72
|
+
selectionMode: J,
|
|
73
|
+
...se
|
|
74
|
+
}) {
|
|
75
|
+
const Q = Se(), [h, C] = W(s || []);
|
|
76
|
+
pe(() => {
|
|
77
|
+
s && C(s);
|
|
78
|
+
}, [s]);
|
|
79
|
+
const ae = (e) => {
|
|
80
|
+
C(e), a == null || a(e);
|
|
81
|
+
}, { byId: E, parentOf: mt } = j(() => {
|
|
82
|
+
const e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
83
|
+
return v(h, (t, d) => {
|
|
84
|
+
e.set(t.id, t), i.set(t.id, d ? d.id : null);
|
|
85
|
+
}), { byId: e, parentOf: i };
|
|
86
|
+
}, [h]), [He, Oe] = W(() => new Set(f ?? (z && s ? dt(s) : []))), O = q ? new Set(q) : He, le = (e) => {
|
|
87
|
+
q || Oe(e), Z == null || Z(e);
|
|
88
|
+
}, x = Y.trim(), U = j(() => x ? xe(h, x) : h, [h, x]), De = j(() => {
|
|
89
|
+
if (!x) return O;
|
|
90
|
+
const e = new Set(O);
|
|
91
|
+
return v(U, (i) => {
|
|
92
|
+
var t;
|
|
93
|
+
(t = i.children) != null && t.length && e.add(i.id);
|
|
94
|
+
}), e;
|
|
95
|
+
}, [x, U, O]), [oe, de] = W(/* @__PURE__ */ new Set()), ce = We(/* @__PURE__ */ new Set());
|
|
96
|
+
pe(() => {
|
|
97
|
+
if (S)
|
|
98
|
+
for (const e of O) {
|
|
99
|
+
const i = E.get(e);
|
|
100
|
+
!i || i.isLeaf || i.children || ce.current.has(e) || (ce.current.add(e), de((t) => new Set(t).add(e)), S(i).then((t) => {
|
|
101
|
+
C((d) => {
|
|
102
|
+
const c = ne(d, e, (g) => ({ ...g, children: t }));
|
|
103
|
+
return a == null || a(c), c;
|
|
104
|
+
});
|
|
105
|
+
}).finally(() => de((t) => {
|
|
106
|
+
const d = new Set(t);
|
|
107
|
+
return d.delete(e), d;
|
|
108
|
+
})));
|
|
109
|
+
}
|
|
110
|
+
}, [O, E]);
|
|
111
|
+
const ee = j(() => {
|
|
112
|
+
const e = new Set(oe);
|
|
113
|
+
return v(h, (i) => {
|
|
114
|
+
i.isLoading && e.add(i.id);
|
|
115
|
+
}), e;
|
|
116
|
+
}, [oe, h]), Fe = Te(!!T || ee.size > 0), [Be, Le] = W(() => new Set(K)), D = n ? new Set(n) : Be, Me = j(() => {
|
|
117
|
+
const e = /* @__PURE__ */ new Set();
|
|
118
|
+
if (!p || u) return e;
|
|
119
|
+
const i = (t) => {
|
|
120
|
+
var d;
|
|
121
|
+
return !!((d = t.children) != null && d.some((c) => D.has(c.id) || i(c)));
|
|
122
|
+
};
|
|
123
|
+
return v(h, (t) => {
|
|
124
|
+
!D.has(t.id) && i(t) && e.add(t.id);
|
|
125
|
+
}), e;
|
|
126
|
+
}, [p, u, h, D]), Pe = (e) => {
|
|
127
|
+
const i = /* @__PURE__ */ new Set();
|
|
128
|
+
v(h, (c) => {
|
|
129
|
+
c.isDisabled || i.add(c.id);
|
|
130
|
+
});
|
|
131
|
+
let t = e === "all" ? i : new Set(e);
|
|
132
|
+
if (!u && e !== "all") {
|
|
133
|
+
const c = [...t].filter((w) => !D.has(w)), g = [...D].filter((w) => !t.has(w)), V = (w, X) => {
|
|
134
|
+
const k = E.get(w);
|
|
135
|
+
k && v([k], (B) => {
|
|
136
|
+
B.isDisabled || (X ? t.add(B.id) : t.delete(B.id));
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
c.forEach((w) => V(w, !0)), g.forEach((w) => V(w, !1));
|
|
140
|
+
const R = (w) => {
|
|
141
|
+
var X;
|
|
142
|
+
for (const k of w) {
|
|
143
|
+
if (!((X = k.children) != null && X.length)) continue;
|
|
144
|
+
R(k.children);
|
|
145
|
+
const B = k.children.filter((re) => !re.isDisabled);
|
|
146
|
+
B.length && B.every((re) => t.has(re.id)) ? t.add(k.id) : t.delete(k.id);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
R(h), t = new Set(t);
|
|
150
|
+
}
|
|
151
|
+
n || Le(t);
|
|
152
|
+
const d = [];
|
|
153
|
+
if (!u) {
|
|
154
|
+
const c = (g) => {
|
|
155
|
+
var V;
|
|
156
|
+
return !!((V = g.children) != null && V.some((R) => t.has(R.id) || c(R)));
|
|
157
|
+
};
|
|
158
|
+
v(h, (g) => {
|
|
159
|
+
!t.has(g.id) && c(g) && d.push(g.id);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
M == null || M([...t], { halfChecked: d });
|
|
163
|
+
}, [ue, te] = W(null), $e = (e, i) => {
|
|
164
|
+
var d;
|
|
165
|
+
te(null);
|
|
166
|
+
const t = i.trim();
|
|
167
|
+
!t || ((d = E.get(e)) == null ? void 0 : d.title) === t || (ae(ne(h, e, (c) => ({ ...c, title: t }))), b == null || b(e, t));
|
|
168
|
+
}, { dragAndDropHooks: qe } = _e({
|
|
169
|
+
getItems: (e) => [...e].map((i) => {
|
|
170
|
+
var t;
|
|
171
|
+
return { "text/plain": ((t = E.get(i)) == null ? void 0 : t.title) ?? String(i) };
|
|
172
|
+
}),
|
|
173
|
+
onMove: (e) => {
|
|
174
|
+
e.target.type === "item" && ae(ct(h, [...e.keys], e.target.key, e.target.dropPosition));
|
|
175
|
+
},
|
|
176
|
+
getDropOperation: (e) => {
|
|
177
|
+
var i;
|
|
178
|
+
return e.type === "item" && e.dropPosition === "on" && ((i = E.get(e.key)) != null && i.isLeaf) ? "cancel" : "move";
|
|
179
|
+
}
|
|
180
|
+
}), fe = L ?? (y || !J || J === "none"), Ve = p ? "multiple" : J, F = !!s, me = (e) => {
|
|
181
|
+
const i = !!S && !e.isLeaf && e.children === void 0;
|
|
182
|
+
return /* @__PURE__ */ r(
|
|
183
|
+
ft,
|
|
184
|
+
{
|
|
185
|
+
id: e.id,
|
|
186
|
+
title: e.title,
|
|
187
|
+
textValue: e.title,
|
|
188
|
+
icon: e.icon,
|
|
189
|
+
description: e.description,
|
|
190
|
+
end: e.end,
|
|
191
|
+
href: e.href,
|
|
192
|
+
isDisabled: e.isDisabled,
|
|
193
|
+
hasChildItems: i || void 0,
|
|
194
|
+
isFolder: !e.isLeaf && (e.children !== void 0 || i),
|
|
195
|
+
renderTitle: N ? (t) => N(e, t) : void 0,
|
|
196
|
+
isLoading: ee.has(e.id),
|
|
197
|
+
children: e.children && /* @__PURE__ */ r(et, { items: e.children, children: me })
|
|
198
|
+
},
|
|
199
|
+
e.id
|
|
200
|
+
);
|
|
201
|
+
}, Re = (e) => {
|
|
202
|
+
var d, c;
|
|
203
|
+
if (e.key !== "F2" || !F || !b && !a || ue !== null) return;
|
|
204
|
+
const i = (c = (d = document.activeElement) == null ? void 0 : d.closest("[data-key]")) == null ? void 0 : c.getAttribute("data-key"), t = i != null ? [...E.values()].find((g) => String(g.id) === i) : void 0;
|
|
205
|
+
t && !t.isDisabled && (e.preventDefault(), te(t.id));
|
|
206
|
+
}, he = /* @__PURE__ */ r(
|
|
207
|
+
Ae,
|
|
208
|
+
{
|
|
209
|
+
...se,
|
|
210
|
+
selectionMode: Ve,
|
|
211
|
+
selectionBehavior: p ? "toggle" : se.selectionBehavior ?? (J === "single" ? "replace" : "toggle"),
|
|
212
|
+
...p ? { selectedKeys: D, onSelectionChange: Pe } : {},
|
|
213
|
+
...F ? { items: U } : {},
|
|
214
|
+
expandedKeys: De,
|
|
215
|
+
onExpandedChange: (e) => le(new Set(e)),
|
|
216
|
+
onAction: fe || G ? (e) => {
|
|
217
|
+
if (fe) {
|
|
218
|
+
const i = new Set(O);
|
|
219
|
+
i.has(e) ? i.delete(e) : i.add(e), le(i);
|
|
220
|
+
}
|
|
221
|
+
G == null || G(e);
|
|
222
|
+
} : void 0,
|
|
223
|
+
dragAndDropHooks: A && F ? qe : void 0,
|
|
224
|
+
renderEmptyState: T ? () => /* @__PURE__ */ r(ut, { rows: _ }) : Ee ?? (() => /* @__PURE__ */ r("div", { className: "alea-tree-empty", children: x ? Q.nothingFor(x) : Q.nothingHere })),
|
|
225
|
+
ref: Fe,
|
|
226
|
+
className: ye("alea-tree", ke),
|
|
227
|
+
"data-loading": T || void 0,
|
|
228
|
+
"data-size": o,
|
|
229
|
+
"data-variant": l !== "subtle" ? l : void 0,
|
|
230
|
+
"data-lines": m || void 0,
|
|
231
|
+
"data-checkable": p || void 0,
|
|
232
|
+
style: { ...I ? { "--alea-tree-indent": `${I}px` } : {}, ...$ || P ? { maxHeight: $ ?? 400, overflow: "auto" } : {}, ...Ie },
|
|
233
|
+
children: F ? me : ze
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
return /* @__PURE__ */ r(be.Provider, { value: { size: o, directory: y, draggable: A && F, canRename: F && !!(b || a), query: x, indeterminate: Me, loading: ee, renaming: ue, setRenaming: te, rename: $e }, children: /* @__PURE__ */ H("div", { className: "alea-tree-wrap", onKeyDown: Re, children: [
|
|
237
|
+
P ? /* @__PURE__ */ r(Ge, { layout: Je, layoutOptions: { rowHeight: P }, children: he }) : he,
|
|
238
|
+
T && U.length > 0 && /* @__PURE__ */ H("div", { className: "alea-tree-loading alea-tree-loading-end", children: [
|
|
239
|
+
/* @__PURE__ */ r("span", { "aria-hidden": "true", className: "alea-tree-loading-spin", children: /* @__PURE__ */ r(ie, { size: "sm" }) }),
|
|
240
|
+
/* @__PURE__ */ r("span", { children: Q.loading })
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ r("span", { className: "alea-visually-hidden", role: "status", children: T ? Q.loading : "" })
|
|
243
|
+
] }) });
|
|
244
|
+
}
|
|
245
|
+
const ve = [64, 48, 56, 40, 72, 52];
|
|
246
|
+
function ut({ rows: s }) {
|
|
247
|
+
return /* @__PURE__ */ r("div", { className: "alea-tree-skeleton", "aria-hidden": "true", children: Array.from({ length: s }, (a, o) => /* @__PURE__ */ H("div", { className: "alea-tree-skeleton-row", style: { "--alea-tree-level": o % 3 === 1 ? 2 : 1 }, children: [
|
|
248
|
+
/* @__PURE__ */ r(we, { shape: "circle", width: 16 }),
|
|
249
|
+
/* @__PURE__ */ r(we, { shape: "text", width: `${ve[o % ve.length]}%` })
|
|
250
|
+
] }, o)) });
|
|
251
|
+
}
|
|
252
|
+
function ft({ title: s, icon: a, description: o, end: l, renderTitle: m, isFolder: I, isLoading: y, children: L, className: z, textValue: p, ...u }) {
|
|
253
|
+
const n = je(be), K = Se(), M = Te(y), S = p ?? (typeof s == "string" ? s : "");
|
|
254
|
+
return /* @__PURE__ */ H(Ue, { ...u, ref: M, textValue: S, className: ye("alea-tree-item", z), "data-loading": y || void 0, children: [
|
|
255
|
+
/* @__PURE__ */ r(Xe, { children: ({ hasChildItems: T, isExpanded: _, selectionMode: Y, selectionBehavior: A, level: b, id: N, allowsDragging: P }) => {
|
|
256
|
+
const $ = a ?? (n.directory ? T || I ? _ ? /* @__PURE__ */ r(tt, {}) : /* @__PURE__ */ r(rt, {}) : /* @__PURE__ */ r(it, {}) : null), q = n.renaming === N;
|
|
257
|
+
return /* @__PURE__ */ H("div", { className: "alea-tree-row", style: { "--alea-tree-level": b }, "data-description": o ? !0 : void 0, children: [
|
|
258
|
+
P && /* @__PURE__ */ r(ge, { slot: "drag", className: "alea-tree-drag", "aria-label": K.moveItem(S), children: /* @__PURE__ */ r(nt, { size: 14, "aria-hidden": "true" }) }),
|
|
259
|
+
T ? /* @__PURE__ */ r(ge, { slot: "chevron", className: "alea-tree-chevron", children: n.loading.has(N) || y ? /* @__PURE__ */ r("span", { "aria-hidden": "true", className: "alea-tree-spin", children: /* @__PURE__ */ r(ie, { size: "sm", "aria-label": "" }) }) : /* @__PURE__ */ r(st, { size: 16, "aria-hidden": "true" }) }) : /* @__PURE__ */ r("span", { className: "alea-tree-spacer" }),
|
|
260
|
+
Y !== "none" && A === "toggle" && /* @__PURE__ */ r(Ye, { slot: "selection", isIndeterminate: n.indeterminate.has(N), className: "alea-check alea-table-check", children: ({ isIndeterminate: f }) => /* @__PURE__ */ r("span", { className: "alea-check-box", "aria-hidden": "true", children: f ? /* @__PURE__ */ r(at, { size: 14, strokeWidth: 3 }) : /* @__PURE__ */ r(lt, { size: 14, strokeWidth: 3 }) }) }),
|
|
261
|
+
$ && /* @__PURE__ */ r("span", { className: "alea-tree-icon", "aria-hidden": "true", children: $ }),
|
|
262
|
+
q ? /* @__PURE__ */ r(
|
|
263
|
+
"input",
|
|
264
|
+
{
|
|
265
|
+
className: "alea-tree-rename",
|
|
266
|
+
defaultValue: S,
|
|
267
|
+
"aria-label": S,
|
|
268
|
+
autoFocus: !0,
|
|
269
|
+
onFocus: (f) => f.currentTarget.select(),
|
|
270
|
+
onKeyDown: (f) => {
|
|
271
|
+
f.stopPropagation(), f.key === "Enter" && n.rename(N, f.currentTarget.value), f.key === "Escape" && n.setRenaming(null);
|
|
272
|
+
},
|
|
273
|
+
onPointerDown: (f) => f.stopPropagation(),
|
|
274
|
+
onClick: (f) => f.stopPropagation(),
|
|
275
|
+
onBlur: (f) => n.rename(N, f.currentTarget.value)
|
|
276
|
+
}
|
|
277
|
+
) : /* @__PURE__ */ H("span", { className: "alea-tree-text", onDoubleClick: n.canRename && !u.isDisabled ? () => n.setRenaming(N) : void 0, children: [
|
|
278
|
+
/* @__PURE__ */ r("span", { className: "alea-tree-title", children: m ? m({ isExpanded: _, level: b }) : n.query && typeof s == "string" ? /* @__PURE__ */ r(ot, { text: s, query: n.query }) : s }),
|
|
279
|
+
o && /* @__PURE__ */ r("span", { className: "alea-tree-desc", children: o })
|
|
280
|
+
] }),
|
|
281
|
+
l && /* @__PURE__ */ r("span", { className: "alea-tree-end", children: l })
|
|
282
|
+
] });
|
|
283
|
+
} }),
|
|
284
|
+
L,
|
|
285
|
+
y && /* @__PURE__ */ H(Ze, { isLoading: !0, className: "alea-tree-loading", children: [
|
|
286
|
+
/* @__PURE__ */ r("span", { "aria-hidden": "true", className: "alea-tree-loading-spin", children: /* @__PURE__ */ r(ie, { size: "sm" }) }),
|
|
287
|
+
/* @__PURE__ */ r("span", { children: K.loading })
|
|
288
|
+
] })
|
|
289
|
+
] });
|
|
290
|
+
}
|
|
291
|
+
function kt({ className: s, ...a }) {
|
|
292
|
+
return /* @__PURE__ */ r(Ce, { ...a, className: Ne("alea-tree-section", s) });
|
|
293
|
+
}
|
|
294
|
+
function It({ className: s, ...a }) {
|
|
295
|
+
return /* @__PURE__ */ r(Qe, { ...a, className: Ne("alea-tree-header", s) });
|
|
296
|
+
}
|
|
297
|
+
export {
|
|
298
|
+
xt as Tree,
|
|
299
|
+
It as TreeHeader,
|
|
300
|
+
ft as TreeItem,
|
|
301
|
+
kt as TreeSection,
|
|
302
|
+
dt as getTreeKeys
|
|
303
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as u, Fragment as k } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as p, createElement as g } from "react";
|
|
4
|
+
import { Link as N } from "react-aria-components";
|
|
5
|
+
import { useStrings as x } from "../../i18n/strings.js";
|
|
6
|
+
import { cx as c, withBase as b } from "../../utils/cx.js";
|
|
7
|
+
import { linkIcon as f } from "../icon/icon-contexts.js";
|
|
8
|
+
const w = { 1: "4xl", 2: "3xl", 3: "2xl", 4: "xl", 5: "lg", 6: "md" }, I = p(function({ level: a = 2, size: d, family: t = "serif", gradient: l, className: n, ...o }, i) {
|
|
9
|
+
return g(`h${a}`, { ...o, ref: i, "data-size": d || w[a], "data-family": t, className: c("alea-heading", l && "alea-gradient-text", n) });
|
|
10
|
+
});
|
|
11
|
+
function T({ as: e = "p", size: a = "base", tone: d = "default", weight: t, truncate: l, lineClamp: n, align: o, className: i, style: s, ...m }) {
|
|
12
|
+
return g(e, { ...m, "data-align": o, "data-size": a, "data-tone": d, "data-weight": t, "data-truncate": l || void 0, "data-clamp": n || void 0, style: n ? { "--alea-clamp": n, ...s } : s, className: c("alea-text", i) });
|
|
13
|
+
}
|
|
14
|
+
function _({ className: e, ...a }) {
|
|
15
|
+
return /* @__PURE__ */ r("p", { ...a, className: c("alea-eyebrow", e) });
|
|
16
|
+
}
|
|
17
|
+
function $({ className: e, ...a }) {
|
|
18
|
+
return /* @__PURE__ */ r("code", { ...a, className: c("alea-code", e) });
|
|
19
|
+
}
|
|
20
|
+
function v({ className: e, ...a }) {
|
|
21
|
+
return /* @__PURE__ */ r("kbd", { ...a, className: c("alea-kbd", e) });
|
|
22
|
+
}
|
|
23
|
+
function B({ variant: e = "inline", external: a, size: d, tone: t, iconStart: l, iconEnd: n, className: o, children: i, ...s }) {
|
|
24
|
+
const m = x();
|
|
25
|
+
return /* @__PURE__ */ r(N, { ...s, target: a ? "_blank" : s.target, rel: a ? "noopener noreferrer" : s.rel, "data-variant": e, "data-size": d, "data-tone": t, className: b("alea-link alea-focus-ring", o), children: (h) => /* @__PURE__ */ u(k, { children: [
|
|
26
|
+
l && /* @__PURE__ */ r("span", { className: "alea-link-icon", "aria-hidden": "true", ...f(t, e), children: l }),
|
|
27
|
+
typeof i == "function" ? i(h) : i,
|
|
28
|
+
n && /* @__PURE__ */ r("span", { className: "alea-link-icon alea-link-icon-end", "aria-hidden": "true", ...f(t, e), children: n }),
|
|
29
|
+
a && /* @__PURE__ */ r("span", { className: "alea-link-ext", "aria-hidden": "true", children: "↗" }),
|
|
30
|
+
a && /* @__PURE__ */ u("span", { className: "alea-visually-hidden", children: [
|
|
31
|
+
" ",
|
|
32
|
+
m.newTab
|
|
33
|
+
] })
|
|
34
|
+
] }) });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
$ as Code,
|
|
38
|
+
_ as Eyebrow,
|
|
39
|
+
I as Heading,
|
|
40
|
+
v as Kbd,
|
|
41
|
+
B as Link,
|
|
42
|
+
T as Text
|
|
43
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { useState as L, useEffect as w } from "react";
|
|
4
|
+
import { DropZone as W, FileTrigger as x, Text as O } from "react-aria-components";
|
|
5
|
+
import { Paperclip as C, UploadCloud as D, FileText as k, Check as P, RotateCw as S, X as Z } from "lucide-react";
|
|
6
|
+
import { withBase as A, cx as M } from "../../utils/cx.js";
|
|
7
|
+
import { Button as E } from "../button/Button.js";
|
|
8
|
+
import { ProgressBar as I } from "../feedback/Feedback.js";
|
|
9
|
+
import { useStrings as K } from "../../i18n/strings.js";
|
|
10
|
+
const N = (r) => r < 1024 ? `${r} B` : r < 1048576 ? `${Math.round(r / 102.4) / 10} KB` : `${Math.round(r / 104857.6) / 10} MB`, X = (r, t) => !t || t.some((o) => o.startsWith(".") ? r.name.toLowerCase().endsWith(o.toLowerCase()) : o.endsWith("/*") ? r.type.startsWith(o.slice(0, -1)) : r.type === o);
|
|
11
|
+
function q({ file: r }) {
|
|
12
|
+
const [t, o] = L(null);
|
|
13
|
+
return w(() => {
|
|
14
|
+
if (!r.type.startsWith("image/") || typeof URL.createObjectURL != "function") return;
|
|
15
|
+
const d = URL.createObjectURL(r);
|
|
16
|
+
return o(d), () => URL.revokeObjectURL(d);
|
|
17
|
+
}, [r]), t ? /* @__PURE__ */ a("img", { className: "alea-upload-thumb", src: t, alt: "" }) : /* @__PURE__ */ a("span", { className: "alea-upload-thumb", "aria-hidden": "true", children: /* @__PURE__ */ a(k, { size: 20 }) });
|
|
18
|
+
}
|
|
19
|
+
function te({ accept: r, allowsMultiple: t = !0, maxSize: o, files: d, onChange: p, label: b, description: m, isDisabled: v, listType: z = "text", variant: h = "dropzone", maxFiles: g, onRetry: y, buttonLabel: T, className: B }) {
|
|
20
|
+
const s = K();
|
|
21
|
+
b ?? (b = s.dropFiles);
|
|
22
|
+
const [R, f] = L([]), c = d ?? R, $ = (e) => {
|
|
23
|
+
d === void 0 && f(e), p == null || p(e);
|
|
24
|
+
}, U = (e) => {
|
|
25
|
+
const n = c.filter((l) => !l.error).length, i = (t ? e : e.slice(0, 1)).map((l, j) => ({
|
|
26
|
+
id: `${l.name}-${l.size}-${Math.random().toString(36).slice(2, 7)}`,
|
|
27
|
+
file: l,
|
|
28
|
+
error: X(l, r) ? o && l.size > o ? s.largerThan(N(o)) : g !== void 0 && t && n + j >= g ? s.tooManyFiles(g) : void 0 : s.typeNotAccepted
|
|
29
|
+
}));
|
|
30
|
+
$(t ? [...c, ...i] : i);
|
|
31
|
+
}, F = /* @__PURE__ */ a(H, { acceptedFileTypes: r, allowsMultiple: t, onSelect: (e) => e && U(Array.from(e)), children: /* @__PURE__ */ a(E, { size: "sm", variant: "secondary", isDisabled: v, iconStart: h === "button" ? /* @__PURE__ */ a(C, {}) : void 0, children: T ?? s.browseFiles }) });
|
|
32
|
+
return /* @__PURE__ */ u("div", { className: M("alea-upload", B), "data-list": z, "data-variant": h, children: [
|
|
33
|
+
h === "button" ? /* @__PURE__ */ u("div", { className: "alea-upload-button", children: [
|
|
34
|
+
F,
|
|
35
|
+
m && /* @__PURE__ */ a("span", { className: "alea-upload-desc", children: m })
|
|
36
|
+
] }) : /* @__PURE__ */ u(G, { isDisabled: v, onDrop: async (e) => {
|
|
37
|
+
const n = e.items.filter((i) => i.kind === "file");
|
|
38
|
+
U(await Promise.all(n.map((i) => i.getFile())));
|
|
39
|
+
}, children: [
|
|
40
|
+
/* @__PURE__ */ a(D, { size: 28, "aria-hidden": "true", className: "alea-upload-icon" }),
|
|
41
|
+
/* @__PURE__ */ a(O, { slot: "label", className: "alea-upload-label", children: b }),
|
|
42
|
+
m && /* @__PURE__ */ a("span", { className: "alea-upload-desc", children: m }),
|
|
43
|
+
F
|
|
44
|
+
] }),
|
|
45
|
+
c.length > 0 && /* @__PURE__ */ a("ul", { className: "alea-upload-list", "aria-label": s.files, children: c.map((e) => {
|
|
46
|
+
const n = e.progress !== void 0 && e.progress < 100 && !e.error, i = e.progress !== void 0 && e.progress >= 100 && !e.error;
|
|
47
|
+
return /* @__PURE__ */ u("li", { className: "alea-upload-item", "data-error": e.error ? !0 : void 0, "data-done": i || void 0, "aria-busy": n || void 0, children: [
|
|
48
|
+
z === "text" ? /* @__PURE__ */ a(k, { size: 18, "aria-hidden": "true", className: "alea-upload-file-icon" }) : /* @__PURE__ */ a(q, { file: e.file }),
|
|
49
|
+
/* @__PURE__ */ u("div", { className: "alea-upload-meta", children: [
|
|
50
|
+
/* @__PURE__ */ a("span", { className: "alea-upload-name", children: e.file.name }),
|
|
51
|
+
/* @__PURE__ */ a("span", { className: "alea-upload-size", children: e.error || (i ? `${N(e.file.size)} · ${s.uploaded}` : N(e.file.size)) }),
|
|
52
|
+
n && /* @__PURE__ */ a(I, { "aria-label": s.uploading(e.file.name), value: e.progress, size: "sm" })
|
|
53
|
+
] }),
|
|
54
|
+
i && /* @__PURE__ */ a(P, { size: 16, "aria-hidden": "true", className: "alea-upload-done" }),
|
|
55
|
+
e.error && y && /* @__PURE__ */ a("button", { type: "button", className: "alea-upload-action alea-focus-ring", "aria-label": `${s.retry}: ${e.file.name}`, onClick: () => y(e), children: /* @__PURE__ */ a(S, { size: 14 }) }),
|
|
56
|
+
/* @__PURE__ */ a("button", { type: "button", className: "alea-upload-action alea-focus-ring", "aria-label": s.removeItem(e.file.name), onClick: () => $(c.filter((l) => l.id !== e.id)), children: /* @__PURE__ */ a(Z, { size: 14 }) })
|
|
57
|
+
] }, e.id);
|
|
58
|
+
}) })
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
function G({ className: r, ...t }) {
|
|
62
|
+
return /* @__PURE__ */ a(W, { ...t, className: A("alea-dropzone", r) });
|
|
63
|
+
}
|
|
64
|
+
function H(r) {
|
|
65
|
+
return /* @__PURE__ */ a(x, { ...r });
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
G as DropZone,
|
|
69
|
+
H as FileTrigger,
|
|
70
|
+
te as FileUpload
|
|
71
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as m, jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { useId as u } from "react";
|
|
4
|
+
import { cx as o } from "../../utils/cx.js";
|
|
5
|
+
import { useStrings as f } from "../../i18n/strings.js";
|
|
6
|
+
function N({ days: a, label: t, uptime: n, unit: d = "day", className: l }) {
|
|
7
|
+
const e = f(), s = a.filter((r) => r === "down").length, c = a.filter((r) => r === "degraded").length, p = e.uptime(t, n, a.length, d, s, c);
|
|
8
|
+
return /* @__PURE__ */ i("div", { className: o("alea-uptime", l), role: "img", "aria-label": p, style: { gridTemplateColumns: `repeat(${a.length}, minmax(0, 1fr))` }, children: a.map((r, h) => /* @__PURE__ */ i("span", { "data-state": r }, h)) });
|
|
9
|
+
}
|
|
10
|
+
function b({ lines: a, title: t, className: n }) {
|
|
11
|
+
const d = f(), l = u();
|
|
12
|
+
return /* @__PURE__ */ m("figure", { className: o("alea-diff", n), "aria-labelledby": t ? l : void 0, children: [
|
|
13
|
+
t && /* @__PURE__ */ i("figcaption", { id: l, className: "alea-diff-title", children: t }),
|
|
14
|
+
/* @__PURE__ */ i("ol", { className: "alea-diff-lines", children: a.map((e, s) => /* @__PURE__ */ m("li", { "data-type": e.type, children: [
|
|
15
|
+
/* @__PURE__ */ i("span", { className: "alea-diff-sign", "aria-hidden": "true", children: e.type === "add" ? "+" : e.type === "remove" ? "−" : " " }),
|
|
16
|
+
/* @__PURE__ */ i("span", { className: "alea-visually-hidden", children: e.type === "add" ? d.diffAdded : e.type === "remove" ? d.diffRemoved : "" }),
|
|
17
|
+
e.text
|
|
18
|
+
] }, s)) })
|
|
19
|
+
] });
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
b as DiffView,
|
|
23
|
+
N as UptimeBar
|
|
24
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { type SurfaceProps } from '../surface/Surface.js';
|
|
2
3
|
export type WorkStatus = 'backlog' | 'todo' | 'progress' | 'review' | 'done' | 'canceled';
|
|
3
4
|
export type WorkPriority = 'none' | 'urgent' | 'high' | 'medium' | 'low';
|
|
4
5
|
export interface StatusIconProps {
|
|
@@ -59,7 +60,7 @@ export interface Issue {
|
|
|
59
60
|
due?: Date;
|
|
60
61
|
href?: string;
|
|
61
62
|
}
|
|
62
|
-
export interface IssueListProps {
|
|
63
|
+
export interface IssueListProps extends SurfaceProps {
|
|
63
64
|
/** The issues: id, title, status and optional key, priority, assignee, labels, due date and href. */
|
|
64
65
|
issues: Issue[];
|
|
65
66
|
/** Groups rows by status, each under a heading with its count. Default true. */
|
|
@@ -77,7 +78,7 @@ export interface IssueListProps {
|
|
|
77
78
|
className?: string;
|
|
78
79
|
}
|
|
79
80
|
/** Dense rows of work: status, priority, key, title, labels, due date and who has it. Grouped by status; arrow keys move through each group, Enter opens. */
|
|
80
|
-
export declare function IssueList({ issues, groupByStatus, onOpen, selectionMode, onSelectionChange, 'aria-label': label, headingLevel, className }: IssueListProps): import("react").JSX.Element;
|
|
81
|
+
export declare function IssueList({ issues, groupByStatus, onOpen, selectionMode, onSelectionChange, 'aria-label': label, headingLevel, surface, radius, className }: IssueListProps): import("react").JSX.Element;
|
|
81
82
|
export interface PropertyListProps {
|
|
82
83
|
/** Label and value pairs: the value can be any node (a picker, a badge, an avatar and a name). */
|
|
83
84
|
items: Array<{
|
|
@@ -169,6 +170,7 @@ export interface InboxItem {
|
|
|
169
170
|
unread?: boolean;
|
|
170
171
|
}
|
|
171
172
|
export interface InboxListProps {
|
|
173
|
+
/** The items, newest first: sender, subject, preview, time and unread state. */
|
|
172
174
|
items: InboxItem[];
|
|
173
175
|
/** The open item, when controlled. */
|
|
174
176
|
selectedId?: string | null;
|