@agent-factory-platform/ui-kit 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +18 -0
  2. package/dist/charts/adapter.js +111 -0
  3. package/dist/charts/basic.js +115 -0
  4. package/dist/charts/chart-tooltip.js +21 -0
  5. package/dist/charts/event-markers-primitive.d.ts +10 -1
  6. package/dist/charts/event-markers-primitive.js +116 -0
  7. package/dist/charts/index.d.ts +1 -0
  8. package/dist/charts/ohlc-annotations.d.ts +56 -0
  9. package/dist/charts/ohlc-annotations.js +84 -0
  10. package/dist/charts/ohlc.d.ts +5 -1
  11. package/dist/charts/ohlc.js +240 -0
  12. package/dist/charts/series.js +584 -0
  13. package/dist/charts/theme.js +35 -0
  14. package/dist/charts/time-combo.js +17 -0
  15. package/dist/component-api.js +3 -5
  16. package/dist/component-api.json.js +9 -0
  17. package/dist/component-manifest.json.js +9 -0
  18. package/dist/components/alert.js +35 -0
  19. package/dist/components/avatar.js +101 -0
  20. package/dist/components/badge.js +111 -0
  21. package/dist/components/button-group.js +22 -0
  22. package/dist/components/button.js +64 -0
  23. package/dist/components/calendar-period-navigator.js +34 -0
  24. package/dist/components/card.js +35 -0
  25. package/dist/components/chart-frame.js +53 -0
  26. package/dist/components/color-picker.js +155 -0
  27. package/dist/components/combobox.js +129 -0
  28. package/dist/components/command-dialog.js +89 -0
  29. package/dist/components/confirm-dialog.js +57 -0
  30. package/dist/components/data-table.js +135 -0
  31. package/dist/components/date-time.js +203 -0
  32. package/dist/components/disclosure.js +29 -0
  33. package/dist/components/drawer.js +150 -0
  34. package/dist/components/dropdown-select.js +191 -0
  35. package/dist/components/field.js +21 -0
  36. package/dist/components/floating-window.js +159 -0
  37. package/dist/components/heading.js +21 -0
  38. package/dist/components/hover-tip.js +90 -0
  39. package/dist/components/icon-tip.js +12 -0
  40. package/dist/components/input-group.js +16 -0
  41. package/dist/components/input-otp.js +56 -0
  42. package/dist/components/input.js +44 -0
  43. package/dist/components/item.js +47 -0
  44. package/dist/components/kbd.js +18 -0
  45. package/dist/components/line-chart.js +79 -0
  46. package/dist/components/listbox.js +33 -0
  47. package/dist/components/live-value.js +26 -0
  48. package/dist/components/modal.js +140 -0
  49. package/dist/components/multi-select.js +54 -0
  50. package/dist/components/native-select.js +17 -0
  51. package/dist/components/navigation.js +42 -0
  52. package/dist/components/page.js +24 -0
  53. package/dist/components/popover-menu.js +164 -0
  54. package/dist/components/progress.js +23 -0
  55. package/dist/components/resizable-pane.js +73 -0
  56. package/dist/components/scroll-load-more.js +61 -0
  57. package/dist/components/seg-slider.js +42 -0
  58. package/dist/components/segmented-control.js +46 -0
  59. package/dist/components/selection-controls.js +119 -0
  60. package/dist/components/sidebar.js +23 -0
  61. package/dist/components/skeleton.js +9 -0
  62. package/dist/components/slider.js +162 -0
  63. package/dist/components/sliding-tabs.js +118 -0
  64. package/dist/components/spinner.js +9 -0
  65. package/dist/components/spotlight-tour.js +122 -0
  66. package/dist/components/stat-card.js +23 -0
  67. package/dist/components/state-view.js +75 -0
  68. package/dist/components/stats-table.js +17 -0
  69. package/dist/components/table.js +24 -0
  70. package/dist/components/tag-pill.d.ts +4 -1
  71. package/dist/components/tag-pill.js +69 -0
  72. package/dist/components/theme-editor.js +159 -0
  73. package/dist/components/toast.js +66 -0
  74. package/dist/components/toolbar.js +46 -0
  75. package/dist/components/utility.js +19 -0
  76. package/dist/components/widget-frame.js +41 -0
  77. package/dist/components/widget-picker.js +87 -0
  78. package/dist/components/workspace-grid.js +468 -0
  79. package/dist/focus-modality.js +3 -15
  80. package/dist/index.d.ts +1 -1
  81. package/dist/index.js +228 -5564
  82. package/dist/lib/cn.js +6 -0
  83. package/dist/lib/focus-modality.js +16 -0
  84. package/dist/lib/motion.js +27 -0
  85. package/dist/lib/viewport.js +13 -0
  86. package/dist/manifest.js +5 -7
  87. package/dist/styles.js +1 -1
  88. package/dist/theme.js +158 -0
  89. package/package.json +1 -1
@@ -0,0 +1,468 @@
1
+ import { jsxs as nt, jsx as N } from "react/jsx-runtime";
2
+ import { useState as et, useRef as V, useEffect as kt, useMemo as J } from "react";
3
+ import St, { useContainerWidth as zt, noCompactor as Rt } from "react-grid-layout";
4
+ import { GripVertical as rt, GripHorizontal as Dt } from "lucide-react";
5
+ /* empty css */
6
+ import { cn as it } from "../lib/cn.js";
7
+ function X(n) {
8
+ return typeof n == "number" && Number.isFinite(n);
9
+ }
10
+ const f = 1e-3, At = 0.3, Pt = {
11
+ ...Rt,
12
+ preventCollision: !0
13
+ };
14
+ function b(n) {
15
+ return Math.round(n / f) * f;
16
+ }
17
+ function W(n) {
18
+ return n.map((t) => ({ ...t }));
19
+ }
20
+ function K(n, t, e, a) {
21
+ if (!Array.isArray(n) || n.length !== t.length) return !1;
22
+ const o = new Map(t.map((i) => [i.i, i])), r = /* @__PURE__ */ new Set();
23
+ for (const i of n) {
24
+ if (!i || typeof i != "object") return !1;
25
+ const s = i;
26
+ if (typeof s.i != "string" || r.has(s.i)) return !1;
27
+ const h = o.get(s.i);
28
+ if (!h || ![s.x, s.y, s.w, s.h].every(X)) return !1;
29
+ const { x: u, y: D, w: z, h: A } = s;
30
+ if (u < -f || D < -f || z < (h.minW ?? 1) - f || A < (h.minH ?? 1) - f || z > (h.maxW ?? e) + f || A > (h.maxH ?? a) + f || u + z > e + f || D + A > a + f) return !1;
31
+ r.add(s.i);
32
+ }
33
+ return n.every((i, s) => n.slice(s + 1).every((h) => !Z(i, h)));
34
+ }
35
+ function ct(n, t) {
36
+ const e = new Map(t.map((a) => [a.i, a]));
37
+ return n.map(({ i: a, x: o, y: r, w: i, h: s }) => ({
38
+ ...e.get(a),
39
+ i: a,
40
+ x: b(o),
41
+ y: b(r),
42
+ w: b(i),
43
+ h: b(s)
44
+ }));
45
+ }
46
+ function Et(n, t, e, a) {
47
+ if (!n || typeof window > "u") return W(t);
48
+ try {
49
+ const o = JSON.parse(window.localStorage.getItem(n) ?? "null");
50
+ return K(o, t, e, a) ? ct(o, t) : (window.localStorage.removeItem(n), W(t));
51
+ } catch {
52
+ return window.localStorage.removeItem(n), W(t);
53
+ }
54
+ }
55
+ function Z(n, t) {
56
+ return n.x < t.x + t.w - f && n.x + n.w > t.x + f && n.y < t.y + t.h - f && n.y + n.h > t.y + f;
57
+ }
58
+ function U(n) {
59
+ var a;
60
+ const t = n;
61
+ if (X(t.clientX) && X(t.clientY)) return { x: t.clientX, y: t.clientY };
62
+ const e = (a = t.changedTouches) == null ? void 0 : a[0];
63
+ return e && X(e.clientX) && X(e.clientY) ? { x: e.clientX, y: e.clientY } : null;
64
+ }
65
+ function Lt(n, t) {
66
+ const e = Math.max(0, Math.min(n.left + n.width, t.left + t.width) - Math.max(n.left, t.left)), a = Math.max(0, Math.min(n.top + n.height, t.top + t.height) - Math.max(n.top, t.top)), o = Math.min(n.width * n.height, t.width * t.height);
67
+ return o > 0 ? e * a / o : 0;
68
+ }
69
+ function ot(n, t) {
70
+ const e = new Map(t.map((a) => [a.i, a]));
71
+ for (const a of n) {
72
+ const o = e.get(a.i);
73
+ o && Object.assign(a, o);
74
+ }
75
+ }
76
+ function T(n, t) {
77
+ return Math.abs(n - t) <= f;
78
+ }
79
+ function Ct(n) {
80
+ if (n.length === 0) return null;
81
+ const t = Math.min(...n.map((r) => r.x)), e = Math.min(...n.map((r) => r.y)), a = Math.max(...n.map((r) => r.x + r.w)), o = Math.max(...n.map((r) => r.y + r.h));
82
+ return { x: t, y: e, w: a - t, h: o - e };
83
+ }
84
+ function Ot(n, t, e) {
85
+ const a = e === "x" ? t.x : t.y, o = a + (e === "x" ? t.w : t.h), r = /* @__PURE__ */ new Set();
86
+ for (const i of n) {
87
+ const s = e === "x" ? i.x : i.y, h = s + (e === "x" ? i.w : i.h);
88
+ s > a + f && s < o - f && r.add(b(s)), h > a + f && h < o - f && r.add(b(h));
89
+ }
90
+ return [...r].filter((i) => n.every((s) => {
91
+ const h = e === "x" ? s.x : s.y;
92
+ return h + (e === "x" ? s.w : s.h) <= i + f || h >= i - f;
93
+ })).sort((i, s) => i - s);
94
+ }
95
+ function lt(n, t) {
96
+ const e = n.reduce((o, r) => o + r.w * r.h, 0);
97
+ if (!T(e, t.w * t.h)) return null;
98
+ if (n.length === 1) {
99
+ const [o] = n;
100
+ return !T(o.x, t.x) || !T(o.y, t.y) || !T(o.w, t.w) || !T(o.h, t.h) ? null : { kind: "leaf", bounds: t, item: { ...o } };
101
+ }
102
+ const a = ["x", "y"].map((o) => ({ axis: o, cuts: Ot(n, t, o) })).filter(({ cuts: o }) => o.length > 0).sort((o, r) => o.cuts.length - r.cuts.length);
103
+ for (const { axis: o, cuts: r } of a) {
104
+ const i = o === "x" ? t.x : t.y, s = i + (o === "x" ? t.w : t.h), h = [i, ...r, s], u = [];
105
+ let D = !0;
106
+ for (let z = 0; z < h.length - 1; z += 1) {
107
+ const A = h[z], L = h[z + 1], B = n.filter((g) => {
108
+ const _ = o === "x" ? g.x : g.y, H = _ + (o === "x" ? g.w : g.h);
109
+ return _ >= A - f && H <= L + f;
110
+ });
111
+ if (B.length === 0) {
112
+ D = !1;
113
+ break;
114
+ }
115
+ const Y = o === "x" ? { x: A, y: t.y, w: L - A, h: t.h } : { x: t.x, y: A, w: t.w, h: L - A }, F = lt(B, Y);
116
+ if (!F) {
117
+ D = !1;
118
+ break;
119
+ }
120
+ u.push(F);
121
+ }
122
+ if (D && u.length > 1) return { kind: "split", bounds: t, axis: o, children: u };
123
+ }
124
+ return null;
125
+ }
126
+ function Q(n, t) {
127
+ return n.kind === "leaf" ? n.item.i === t : n.children.some((e) => Q(e, t));
128
+ }
129
+ function ut(n, t, e) {
130
+ const a = {
131
+ ...n.bounds,
132
+ x: b(n.bounds.x + t),
133
+ y: b(n.bounds.y + e)
134
+ };
135
+ return n.kind === "leaf" ? {
136
+ kind: "leaf",
137
+ bounds: a,
138
+ item: {
139
+ ...n.item,
140
+ x: b(n.item.x + t),
141
+ y: b(n.item.y + e)
142
+ }
143
+ } : {
144
+ kind: "split",
145
+ bounds: a,
146
+ axis: n.axis,
147
+ children: n.children.map((o) => ut(o, t, e))
148
+ };
149
+ }
150
+ function Nt(n, t) {
151
+ let e = n.axis === "x" ? n.bounds.x : n.bounds.y;
152
+ const a = t.map((o) => {
153
+ const r = n.axis === "x" ? o.bounds.x : o.bounds.y, i = ut(o, n.axis === "x" ? e - r : 0, n.axis === "y" ? e - r : 0);
154
+ return e += n.axis === "x" ? o.bounds.w : o.bounds.h, i;
155
+ });
156
+ return { ...n, children: a };
157
+ }
158
+ function ht(n, t, e) {
159
+ if (n.kind === "leaf") return { node: n, changed: !1 };
160
+ const a = n.children.findIndex((s) => Q(s, t)), o = n.children.findIndex((s) => Q(s, e));
161
+ if (a < 0 || o < 0) return { node: n, changed: !1 };
162
+ if (a !== o) {
163
+ const s = [...n.children], [h] = s.splice(a, 1);
164
+ return s.splice(o, 0, h), { node: Nt(n, s), changed: !0 };
165
+ }
166
+ const r = ht(n.children[a], t, e);
167
+ if (!r.changed) return { node: n, changed: !1 };
168
+ const i = [...n.children];
169
+ return i[a] = r.node, { node: { ...n, children: i }, changed: !0 };
170
+ }
171
+ function ft(n, t = /* @__PURE__ */ new Map()) {
172
+ return n.kind === "leaf" ? t.set(n.item.i, n.item) : n.children.forEach((e) => ft(e, t)), t;
173
+ }
174
+ function at(n, t, e) {
175
+ let a = { x: t.x, y: t.y, w: t.w, h: t.h }, o = { x: e.x, y: e.y, w: e.w, h: e.h };
176
+ if (Math.abs(t.w - e.w) <= f && Math.abs(t.h - e.h) <= f)
177
+ a = { ...a, x: e.x, y: e.y }, o = { ...o, x: t.x, y: t.y };
178
+ else if (Math.abs(t.x - e.x) <= f && Math.abs(t.w - e.w) <= f && (Math.abs(t.y + t.h - e.y) <= f || Math.abs(e.y + e.h - t.y) <= f)) {
179
+ const r = Math.min(t.y, e.y);
180
+ t.y < e.y ? (o = { ...o, y: r }, a = { ...a, y: r + e.h }) : (a = { ...a, y: r }, o = { ...o, y: r + t.h });
181
+ } else if (Math.abs(t.y - e.y) <= f && Math.abs(t.h - e.h) <= f && (Math.abs(t.x + t.w - e.x) <= f || Math.abs(e.x + e.w - t.x) <= f)) {
182
+ const r = Math.min(t.x, e.x);
183
+ t.x < e.x ? (o = { ...o, x: r }, a = { ...a, x: r + e.w }) : (a = { ...a, x: r }, o = { ...o, x: r + t.w });
184
+ } else return null;
185
+ return n.map((r) => r.i === t.i ? { ...r, ...a } : r.i === e.i ? { ...r, ...o } : r);
186
+ }
187
+ function q(n, t, e) {
188
+ if (t.i === e.i) return null;
189
+ if (Math.abs(t.w - e.w) <= f && Math.abs(t.h - e.h) <= f)
190
+ return at(n, t, e);
191
+ const a = Ct(n), o = a ? lt(n, a) : null;
192
+ if (o) {
193
+ const r = ht(o, t.i, e.i);
194
+ if (r.changed) {
195
+ const i = ft(r.node);
196
+ return n.map((s) => {
197
+ const h = i.get(s.i);
198
+ return h ? { ...s, x: h.x, y: h.y } : s;
199
+ });
200
+ }
201
+ }
202
+ return at(n, t, e);
203
+ }
204
+ function Wt(n) {
205
+ const t = /* @__PURE__ */ new Map(), e = (a, o, r, i, s, h) => {
206
+ if (i <= r) return;
207
+ const u = `${a}:${o}`, D = t.get(u) ?? [];
208
+ D.push({ id: u, orientation: a, boundary: o, start: r, end: i, before: [s], after: [h] }), t.set(u, D);
209
+ };
210
+ for (let a = 0; a < n.length; a += 1)
211
+ for (let o = a + 1; o < n.length; o += 1) {
212
+ const r = n[a], i = n[o];
213
+ Math.abs(r.x + r.w - i.x) <= f && e("vertical", b(i.x), Math.max(r.y, i.y), Math.min(r.y + r.h, i.y + i.h), r.i, i.i), Math.abs(i.x + i.w - r.x) <= f && e("vertical", b(r.x), Math.max(r.y, i.y), Math.min(r.y + r.h, i.y + i.h), i.i, r.i), Math.abs(r.y + r.h - i.y) <= f && e("horizontal", b(i.y), Math.max(r.x, i.x), Math.min(r.x + r.w, i.x + i.w), r.i, i.i), Math.abs(i.y + i.h - r.y) <= f && e("horizontal", b(r.y), Math.max(r.x, i.x), Math.min(r.x + r.w, i.x + i.w), i.i, r.i);
214
+ }
215
+ return [...t.values()].flatMap((a) => {
216
+ const o = [...a].sort((i, s) => i.start - s.start), r = [];
217
+ for (const i of o) {
218
+ const s = r.at(-1);
219
+ if (!s || i.start > s.end) {
220
+ r.push({ ...i, id: `${i.id}:${i.start}-${i.end}` });
221
+ continue;
222
+ }
223
+ s.end = Math.max(s.end, i.end), s.before = [.../* @__PURE__ */ new Set([...s.before, ...i.before])], s.after = [.../* @__PURE__ */ new Set([...s.after, ...i.after])];
224
+ }
225
+ return r.map((i) => ({
226
+ ...i,
227
+ id: `${i.orientation}:${[...i.before].sort().join("+")}|${[...i.after].sort().join("+")}`
228
+ }));
229
+ });
230
+ }
231
+ function st(n, t, e, a, o) {
232
+ if (e === 0) return n;
233
+ const r = new Set(t.before), i = new Set(t.after), s = n.map((u) => {
234
+ if (t.orientation === "vertical") {
235
+ if (r.has(u.i)) return { ...u, w: b(u.w + e) };
236
+ if (i.has(u.i)) return { ...u, x: b(u.x + e), w: b(u.w - e) };
237
+ } else {
238
+ if (r.has(u.i)) return { ...u, h: b(u.h + e) };
239
+ if (i.has(u.i)) return { ...u, y: b(u.y + e), h: b(u.h - e) };
240
+ }
241
+ return u;
242
+ });
243
+ return s.every((u) => u.x >= 0 && u.y >= 0 && u.x + u.w <= a && u.y + u.h <= o && u.w >= (u.minW ?? 1) && u.h >= (u.minH ?? 1) && u.w <= (u.maxW ?? a) && u.h <= (u.maxH ?? o)) && s.every((u, D) => s.slice(D + 1).every((z) => !Z(u, z))) ? s : null;
244
+ }
245
+ function Gt({
246
+ label: n,
247
+ moveLabel: t,
248
+ resizeLabel: e = n,
249
+ items: a,
250
+ initialLayout: o,
251
+ storageKey: r,
252
+ columns: i = 12,
253
+ rows: s = 12,
254
+ gap: h = 6,
255
+ className: u,
256
+ testId: D,
257
+ onLayoutChange: z
258
+ }) {
259
+ const { width: A, containerRef: L, mounted: B } = zt({ initialWidth: 1200 }), [Y, F] = et(720), [g, _] = et(() => Et(r, o, i, s)), H = V(null), G = V(null), j = V(null);
260
+ kt(() => {
261
+ const c = L.current;
262
+ if (!c) return;
263
+ const l = () => F(Math.max(240, c.clientHeight));
264
+ if (l(), typeof ResizeObserver > "u") return;
265
+ const x = new ResizeObserver(l);
266
+ return x.observe(c), () => x.disconnect();
267
+ }, [L]);
268
+ const xt = J(() => new Map(g.map((c) => [c.i, c])), [g]), pt = J(() => Wt(g), [g]), wt = J(() => g.map((c) => ({ ...c, isResizable: !1 })), [g]), tt = Math.max(16, (Y - h * (s - 1)) / s), I = (A + h) / i, $ = tt + h, C = (c) => {
269
+ if (!K(c, o, i, s)) return !1;
270
+ const l = ct(c, o);
271
+ return _(l), r && window.localStorage.setItem(r, JSON.stringify(l)), z == null || z(l), !0;
272
+ }, dt = (c, l, x, y, M, p) => {
273
+ const v = W(c), m = (l == null ? void 0 : l.i) ?? (x == null ? void 0 : x.i), R = U(M), k = p == null ? void 0 : p.getBoundingClientRect();
274
+ if (!m || !R || !k) {
275
+ H.current = null;
276
+ return;
277
+ }
278
+ H.current = {
279
+ origin: v,
280
+ draggedId: m,
281
+ pointerOffsetX: R.x - k.left,
282
+ pointerOffsetY: R.y - k.top,
283
+ width: k.width,
284
+ height: k.height
285
+ }, G.current = null, j.current = null;
286
+ }, yt = (c, l, x, y, M) => {
287
+ var P;
288
+ const p = H.current, v = U(M), m = (P = L.current) == null ? void 0 : P.getBoundingClientRect();
289
+ if (!p || !v || !m) return;
290
+ const R = p.origin.find((w) => w.i === p.draggedId);
291
+ if (!R) return;
292
+ const k = {
293
+ left: v.x - p.pointerOffsetX,
294
+ top: v.y - p.pointerOffsetY,
295
+ width: p.width,
296
+ height: p.height
297
+ }, O = p.origin.filter((w) => w.i !== R.i).map((w) => {
298
+ const d = {
299
+ left: m.left + w.x * I,
300
+ top: m.top + w.y * $,
301
+ width: w.w * I - h,
302
+ height: w.h * $ - h
303
+ }, gt = v.x >= d.left && v.x <= d.left + d.width && v.y >= d.top && v.y <= d.top + d.height;
304
+ return { item: w, score: gt ? Lt(k, d) : 0 };
305
+ }).filter(({ score: w }) => w >= At).sort((w, d) => d.score - w.score);
306
+ let E = null, S = null;
307
+ for (const w of O) {
308
+ const d = q(p.origin, R, w.item);
309
+ if (d && K(d, o, i, s)) {
310
+ E = w.item.i, S = d;
311
+ break;
312
+ }
313
+ }
314
+ if (S && E) {
315
+ ot(c, S), G.current = W(S), j.current !== E && (j.current = E, _(W(S)));
316
+ return;
317
+ }
318
+ G.current = null, j.current && (j.current = null, ot(c, p.origin), _(W(p.origin)));
319
+ }, bt = (c, l, x, y, M) => {
320
+ var E;
321
+ const p = H.current, v = (p == null ? void 0 : p.origin) ?? W(g), m = G.current;
322
+ if (H.current = null, G.current = null, j.current = null, m && C(m))
323
+ return;
324
+ const R = v.find((S) => S.i === ((l == null ? void 0 : l.i) ?? (x == null ? void 0 : x.i))), k = U(M), O = (E = L.current) == null ? void 0 : E.getBoundingClientRect();
325
+ if (R && k && O) {
326
+ const S = (k.x - O.left) / I, P = (k.y - O.top) / $, w = v.find((d) => d.i !== R.i && S >= d.x && S <= d.x + d.w && P >= d.y && P <= d.y + d.h);
327
+ if (w) {
328
+ const d = q(v, R, w);
329
+ if (d && C(d))
330
+ return;
331
+ }
332
+ }
333
+ C(c) || C(v);
334
+ }, mt = (c, l) => {
335
+ const x = {
336
+ ArrowLeft: [-1, 0],
337
+ ArrowRight: [1, 0],
338
+ ArrowUp: [0, -1],
339
+ ArrowDown: [0, 1]
340
+ }[c.key];
341
+ if (!x) return;
342
+ c.preventDefault();
343
+ const y = g.find((m) => m.i === l);
344
+ if (!y) return;
345
+ const M = {
346
+ ...y,
347
+ x: Math.max(0, Math.min(i - y.w, y.x + x[0])),
348
+ y: Math.max(0, Math.min(s - y.h, y.y + x[1]))
349
+ };
350
+ if (M.x === y.x && M.y === y.y) return;
351
+ const p = g.find((m) => m.i !== l && Z(M, m));
352
+ if (!p) {
353
+ C(g.map((m) => m.i === l ? M : m));
354
+ return;
355
+ }
356
+ const v = q(g, y, p);
357
+ v && C(v);
358
+ }, Mt = (c, l) => {
359
+ const x = l.orientation === "vertical" ? "ArrowLeft" : "ArrowUp", y = l.orientation === "vertical" ? "ArrowRight" : "ArrowDown";
360
+ if (c.key !== x && c.key !== y) return;
361
+ c.preventDefault();
362
+ const M = st(g, l, c.key === y ? 1 : -1, i, s);
363
+ M && C(M);
364
+ }, vt = (c, l) => {
365
+ if (c.button !== 0) return;
366
+ c.preventDefault(), c.stopPropagation();
367
+ const x = c.currentTarget, y = c.pointerId;
368
+ x.setPointerCapture(y);
369
+ const M = g.map((P) => ({ ...P })), p = l.orientation === "vertical" ? c.clientX : c.clientY, v = l.orientation === "vertical" ? I : $;
370
+ let m = M, R = 0, k = 0;
371
+ const O = () => {
372
+ k = 0;
373
+ const P = b(R / v), w = st(M, l, P, i, s);
374
+ if (!w) {
375
+ x.dataset.resizeBlocked = "true";
376
+ return;
377
+ }
378
+ delete x.dataset.resizeBlocked, m = w, _(w);
379
+ }, E = (P) => {
380
+ R = (l.orientation === "vertical" ? P.clientX : P.clientY) - p, k || (k = window.requestAnimationFrame(O));
381
+ }, S = () => {
382
+ window.removeEventListener("pointermove", E), window.removeEventListener("pointerup", S), window.removeEventListener("pointercancel", S), k && (window.cancelAnimationFrame(k), O()), delete x.dataset.resizeBlocked, x.hasPointerCapture(y) && x.releasePointerCapture(y), C(m);
383
+ };
384
+ window.addEventListener("pointermove", E), window.addEventListener("pointerup", S), window.addEventListener("pointercancel", S);
385
+ };
386
+ return /* @__PURE__ */ nt("div", { ref: L, role: "group", "aria-label": n, "data-testid": D, className: it("relative h-full min-h-0 min-w-0", u), children: [
387
+ B && /* @__PURE__ */ N(
388
+ St,
389
+ {
390
+ width: A,
391
+ layout: wt,
392
+ gridConfig: { cols: i, rowHeight: tt, margin: [h, h], containerPadding: [0, 0], maxRows: s },
393
+ dragConfig: { enabled: !0, bounded: !0, handle: ".af-workspace-grid-handle", threshold: 3 },
394
+ resizeConfig: { enabled: !1 },
395
+ compactor: Pt,
396
+ autoSize: !1,
397
+ style: { height: Y },
398
+ className: "h-full",
399
+ onDragStart: dt,
400
+ onDrag: yt,
401
+ onDragStop: bt,
402
+ children: a.map((c) => {
403
+ const l = xt.get(c.id) ?? o.find((x) => x.i === c.id);
404
+ return /* @__PURE__ */ nt(
405
+ "div",
406
+ {
407
+ "data-workspace-grid-item": !0,
408
+ "data-testid": `workspace-grid-item-${c.id}`,
409
+ "data-grid-x": l == null ? void 0 : l.x,
410
+ "data-grid-y": l == null ? void 0 : l.y,
411
+ "data-grid-w": l == null ? void 0 : l.w,
412
+ "data-grid-h": l == null ? void 0 : l.h,
413
+ className: "group/workspace-grid-item min-h-0 min-w-0",
414
+ children: [
415
+ /* @__PURE__ */ N(
416
+ "button",
417
+ {
418
+ type: "button",
419
+ "data-workspace-drag-handle": !0,
420
+ "data-testid": `workspace-drag-handle-${c.id}`,
421
+ "aria-label": t(c.label),
422
+ onKeyDown: (x) => mt(x, c.id),
423
+ className: "af-workspace-grid-handle absolute left-1/2 top-0.5 z-30 grid size-5 -translate-x-1/2 cursor-grab touch-none place-items-center rounded-control bg-surface-raised text-graphite shadow-pop transition-opacity hover:text-ink active:cursor-grabbing",
424
+ children: /* @__PURE__ */ N(rt, { size: 12, "aria-hidden": !0 })
425
+ }
426
+ ),
427
+ /* @__PURE__ */ N("div", { className: "h-full min-h-0 min-w-0", children: c.content })
428
+ ]
429
+ },
430
+ c.id
431
+ );
432
+ })
433
+ }
434
+ ),
435
+ B && pt.map((c) => {
436
+ const l = c.orientation === "vertical", x = c.start * (l ? $ : I), y = (c.end - c.start) * (l ? $ : I) - h, M = c.boundary * (l ? I : $) - h / 2;
437
+ return /* @__PURE__ */ N(
438
+ "div",
439
+ {
440
+ role: "separator",
441
+ tabIndex: 0,
442
+ "aria-label": e,
443
+ "aria-orientation": l ? "vertical" : "horizontal",
444
+ "aria-valuemin": 1,
445
+ "aria-valuemax": l ? i - 1 : s - 1,
446
+ "aria-valuenow": c.boundary,
447
+ "data-workspace-resize-divider": !0,
448
+ "data-orientation": c.orientation,
449
+ "data-boundary": c.boundary,
450
+ "data-before-panels": c.before.join(" "),
451
+ "data-after-panels": c.after.join(" "),
452
+ onPointerDown: (p) => vt(p, c),
453
+ onKeyDown: (p) => Mt(p, c),
454
+ className: it(
455
+ "group absolute z-40 grid touch-none place-items-center outline-none hover:bg-rust/20 focus-visible:bg-rust/20 data-[resize-blocked=true]:cursor-not-allowed data-[resize-blocked=true]:bg-down/25",
456
+ l ? "-translate-x-1/2 cursor-col-resize" : "-translate-y-1/2 cursor-row-resize"
457
+ ),
458
+ style: l ? { left: M, top: x, width: Math.max(10, h), height: y } : { left: x, top: M, width: y, height: Math.max(10, h) },
459
+ children: /* @__PURE__ */ N("span", { className: "grid size-5 place-items-center rounded-control bg-surface-raised text-graphite opacity-0 shadow-pop group-hover:opacity-100 group-focus-visible:opacity-100", children: l ? /* @__PURE__ */ N(rt, { size: 12, "aria-hidden": !0 }) : /* @__PURE__ */ N(Dt, { size: 12, "aria-hidden": !0 }) })
460
+ },
461
+ c.id
462
+ );
463
+ })
464
+ ] });
465
+ }
466
+ export {
467
+ Gt as WorkspaceGrid
468
+ };
@@ -1,17 +1,5 @@
1
- const i = "data-af-input-modality", o = Symbol.for("agent-factory.ui-kit.focus-modality");
2
- function u() {
3
- if (typeof document > "u") return;
4
- const e = globalThis;
5
- if (e[o]) return;
6
- e[o] = !0;
7
- const n = (t) => {
8
- document.documentElement.setAttribute(i, t);
9
- };
10
- document.addEventListener("pointerdown", () => n("pointer"), !0), document.addEventListener("keydown", (t) => {
11
- ["Shift", "Control", "Alt", "Meta"].includes(t.key) || n("keyboard");
12
- }, !0);
13
- }
14
- u();
1
+ import { installUiFocusModality as o } from "./lib/focus-modality.js";
2
+ o();
15
3
  export {
16
- u as installUiFocusModality
4
+ o as installUiFocusModality
17
5
  };
package/dist/index.d.ts CHANGED
@@ -51,7 +51,7 @@ export { HoverTip, type HoverTipVariant } from "./components/hover-tip";
51
51
  export { IconTip } from "./components/icon-tip";
52
52
  export { SlidingTabs, useSlideIndicator } from "./components/sliding-tabs";
53
53
  export { SegSlider } from "./components/seg-slider";
54
- export { TagPill, TagList, type TagLevel, type TagSize } from "./components/tag-pill";
54
+ export { TagPill, TagList, type TagLevel, type TagSize, type TagDotTone } from "./components/tag-pill";
55
55
  export { StatCard } from "./components/stat-card";
56
56
  export { StatsTable } from "./components/stats-table";
57
57
  export { LineChart, Donut } from "./components/line-chart";