@alfadocs/ui-kit 1.41.1 → 1.43.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 (32) hide show
  1. package/dist/_chunks/{calendar-workspace-Bx8xxvic.js → calendar-workspace-DhXqqu-D.js} +1981 -1968
  2. package/dist/_chunks/control-room-rail-Cv7GpMqX.js +354 -0
  3. package/dist/_chunks/{marketplace-app-shell-D_g9BaDI.js → marketplace-app-shell-DdwPj03y.js} +3 -3
  4. package/dist/_chunks/{notes-panel-Daq5T_cS.js → notes-panel-CRAovkjx.js} +84 -68
  5. package/dist/_chunks/{sidebar-ClTY9lLI.js → sidebar-DbZXLl8h.js} +2 -2
  6. package/dist/_chunks/tab-bar-Cw9UK18Z.js +228 -0
  7. package/dist/_chunks/{tool-rail-D89USYE6.js → tool-rail-CCFqDfAn.js} +282 -276
  8. package/dist/_chunks/use-edge-resize-BHesP0kg.js +149 -0
  9. package/dist/_chunks/use-scroll-overflow-UbLrUfBo.js +72 -0
  10. package/dist/agent-catalog.json +1 -1
  11. package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
  12. package/dist/components/control-room-rail/index.js +1 -1
  13. package/dist/components/notes-panel/index.js +1 -1
  14. package/dist/components/notes-panel/notes-panel.d.ts +32 -0
  15. package/dist/components/sidebar/index.js +1 -1
  16. package/dist/components/tab-bar/index.js +1 -1
  17. package/dist/components/tool-rail/index.js +1 -1
  18. package/dist/components/tool-rail/tool-rail.d.ts +16 -0
  19. package/dist/hooks/index.d.ts +2 -0
  20. package/dist/hooks/index.js +35 -32
  21. package/dist/hooks/use-edge-resize.d.ts +13 -1
  22. package/dist/index.js +6 -6
  23. package/dist/patterns/calendar/calendar.journey.d.ts +11 -0
  24. package/dist/patterns/calendar/calendar.sheets.d.ts +20 -0
  25. package/dist/patterns/calendar/index.js +1 -1
  26. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  27. package/dist/tokens.css +1 -1
  28. package/package.json +1 -1
  29. package/dist/_chunks/control-room-rail-CnNZusR5.js +0 -337
  30. package/dist/_chunks/tab-bar-rDkLiaA6.js +0 -268
  31. package/dist/_chunks/use-edge-resize-ZnGG7gyO.js +0 -139
  32. package/dist/_chunks/use-overflow-collapse-BIOzKbni.js +0 -32
@@ -0,0 +1,354 @@
1
+ import { jsx as T, jsxs as U, Fragment as go } from "react/jsx-runtime";
2
+ import { useState as E, useCallback as p, useMemo as b, useRef as X, useContext as N, useId as vo, useEffect as ho, createContext as To, forwardRef as bo } from "react";
3
+ import { useTranslation as Co } from "react-i18next";
4
+ import { I as Y } from "./icon-button-CehAeZoP.js";
5
+ import { a as xo } from "./panel-header-D_mTdhUp.js";
6
+ import { T as yo } from "./tool-rail-CCFqDfAn.js";
7
+ import { u as Z } from "./use-persistent-state-nZwZAnE9.js";
8
+ import { S as Ao } from "./star-Bf9L2Uot.js";
9
+ import { X as So } from "./x-B5YnXwCz.js";
10
+ const wo = {
11
+ id: "control-room-rail",
12
+ capabilities: ["open", "close", "select_single"],
13
+ state: {
14
+ activeToolId: {
15
+ type: "string | null",
16
+ descriptionKey: "ui.toolRail.agent.state.activeToolId",
17
+ description: "Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.",
18
+ read: (t) => t.getActiveToolId()
19
+ }
20
+ },
21
+ actions: {
22
+ open: {
23
+ // Pure ephemeral panel state (open) — no data loss, no external effect.
24
+ safety: "read",
25
+ argsType: "{ id: string }",
26
+ argsSchema: {
27
+ type: "object",
28
+ properties: { id: { type: "string" } },
29
+ required: ["id"]
30
+ },
31
+ idempotent: !0,
32
+ descriptionKey: "ui.toolRail.agent.actions.open",
33
+ description: "Open the given tool's panel.",
34
+ examples: [{ args: { id: "inbox" }, note: "Open the inbox tool panel." }],
35
+ invoke: (t, n) => {
36
+ t.open(n.id);
37
+ }
38
+ },
39
+ close: {
40
+ safety: "read",
41
+ idempotent: !0,
42
+ descriptionKey: "ui.toolRail.agent.actions.close",
43
+ description: "Collapse the rail to its strip (no active tool).",
44
+ invoke: (t) => {
45
+ t.close();
46
+ }
47
+ },
48
+ select_tool: {
49
+ safety: "read",
50
+ argsType: "{ id: string | null }",
51
+ argsSchema: {
52
+ type: "object",
53
+ properties: { id: { type: ["string", "null"] } },
54
+ required: ["id"]
55
+ },
56
+ idempotent: !0,
57
+ descriptionKey: "ui.toolRail.agent.actions.selectTool",
58
+ description: "Set the active tool by id (opens its panel), or pass null to collapse.",
59
+ invoke: (t, n) => {
60
+ t.setActiveTool(n.id);
61
+ }
62
+ }
63
+ },
64
+ domHooks: {
65
+ root: {
66
+ attr: "data-component",
67
+ value: "control-room-rail",
68
+ description: "Marks the ControlRoomRail wrapper."
69
+ },
70
+ instanceId: {
71
+ attr: "data-component-id",
72
+ sourceProp: "id",
73
+ description: "Sourced from the id prop. Required to address a specific rail from the agent."
74
+ },
75
+ item: {
76
+ attr: "data-tool-id",
77
+ description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
78
+ }
79
+ }
80
+ }, M = To(null);
81
+ function Oo({
82
+ globalTools: t = [],
83
+ children: n
84
+ }) {
85
+ const [c, s] = E(
86
+ () => /* @__PURE__ */ new Map()
87
+ ), f = p(
88
+ (l, i) => {
89
+ s((u) => {
90
+ const j = new Map(u);
91
+ return j.set(l, i), j;
92
+ });
93
+ },
94
+ []
95
+ ), V = p((l) => {
96
+ s((i) => {
97
+ if (!i.has(l)) return i;
98
+ const u = new Map(i);
99
+ return u.delete(l), u;
100
+ });
101
+ }, []), m = b(
102
+ () => Array.from(c.values()).flat(),
103
+ [c]
104
+ ), h = X(null), P = p((l) => {
105
+ h.current = l;
106
+ }, []), R = p((l) => {
107
+ var i;
108
+ (i = h.current) == null || i.setActiveTool(l);
109
+ }, []), A = p(() => {
110
+ var l;
111
+ (l = h.current) == null || l.setActiveTool(null);
112
+ }, []), C = b(
113
+ () => ({
114
+ globalTools: t,
115
+ contextualTools: m,
116
+ registerContextualTools: f,
117
+ unregisterContextualTools: V,
118
+ registerRail: P,
119
+ openTool: R,
120
+ closeTool: A
121
+ }),
122
+ [
123
+ t,
124
+ m,
125
+ f,
126
+ V,
127
+ P,
128
+ R,
129
+ A
130
+ ]
131
+ );
132
+ return /* @__PURE__ */ T(M.Provider, { value: C, children: n });
133
+ }
134
+ function Eo(t) {
135
+ const n = N(M), c = n == null ? void 0 : n.registerContextualTools, s = n == null ? void 0 : n.unregisterContextualTools, f = vo();
136
+ ho(() => {
137
+ if (!(!c || !s))
138
+ return c(f, t), () => s(f);
139
+ }, [c, s, f, t]);
140
+ }
141
+ function ko() {
142
+ const t = N(M);
143
+ return b(() => {
144
+ if (!t) return [];
145
+ const n = t.contextualTools.map((s) => ({
146
+ ...s,
147
+ scope: "contextual"
148
+ })), c = t.globalTools.map((s) => ({
149
+ ...s,
150
+ scope: "global"
151
+ }));
152
+ return [...n, ...c];
153
+ }, [t]);
154
+ }
155
+ function Xo() {
156
+ const t = N(M), n = p(() => {
157
+ }, []);
158
+ return {
159
+ openTool: (t == null ? void 0 : t.openTool) ?? n,
160
+ closeTool: (t == null ? void 0 : t.closeTool) ?? n
161
+ };
162
+ }
163
+ function Mo() {
164
+ const t = N(M), n = p((c) => {
165
+ }, []);
166
+ return (t == null ? void 0 : t.registerRail) ?? n;
167
+ }
168
+ const $o = bo(function({
169
+ tools: n,
170
+ railLabel: c,
171
+ reorderable: s = !0,
172
+ favoriteIds: f,
173
+ defaultFavoriteIds: V,
174
+ pinnedFavoriteIds: m,
175
+ onFavoriteIdsChange: h,
176
+ persistFavoritesKey: P = "ui.controlRoom.favorites",
177
+ activeToolId: R,
178
+ defaultActiveToolId: A = null,
179
+ onActiveToolChange: C,
180
+ panelWidth: l,
181
+ onPanelWidthChange: i,
182
+ persistPanelWidthKey: u,
183
+ ...j
184
+ }, S) {
185
+ const { t: g } = Co(), [F, W] = E(
186
+ R ?? A ?? null
187
+ ), $ = R !== void 0 ? R : F, I = p(
188
+ (o) => {
189
+ R === void 0 && W(o), C == null || C(o);
190
+ },
191
+ [R, C]
192
+ ), oo = ko(), x = n ?? oo, _ = f !== void 0, [to, eo] = Z(
193
+ P,
194
+ () => V ?? x.filter((o) => o.scope === "global").map((o) => o.id),
195
+ { disabled: _ }
196
+ ), B = _ ? f : to, w = b(() => m != null && m.length ? [
197
+ ...m,
198
+ ...B.filter((o) => !m.includes(o))
199
+ ] : B, [m, B]), H = l !== void 0, [no, D] = Z(u ?? "ui.controlRoom.panelWidth.unused", null, {
200
+ disabled: H || !u
201
+ }), ro = H ? l : u ? no : void 0, so = p(
202
+ (o) => {
203
+ !H && u && D(o), i == null || i(o);
204
+ },
205
+ [
206
+ H,
207
+ u,
208
+ D,
209
+ i
210
+ ]
211
+ ), d = b(() => {
212
+ const o = /* @__PURE__ */ new Map();
213
+ for (const r of x) o.set(r.id, r);
214
+ return o;
215
+ }, [x]), k = b(
216
+ () => new Set(w.filter((o) => d.has(o))),
217
+ [w, d]
218
+ ), G = (o) => {
219
+ const r = o(w.filter((e) => d.has(e)));
220
+ _ || eo((e) => o(e.filter((a) => d.has(a)))), h == null || h(r);
221
+ }, J = b(() => {
222
+ if (!s) return x;
223
+ const o = w.filter((e) => d.has(e)).map((e) => ({
224
+ ...d.get(e),
225
+ scope: "global",
226
+ reorderable: !0
227
+ })), r = x.filter((e) => !k.has(e.id)).map((e) => ({
228
+ ...e,
229
+ scope: "contextual",
230
+ reorderable: !0
231
+ }));
232
+ return [...o, ...r];
233
+ }, [s, x, w, d, k]), [lo, io] = E(""), L = X(!1), ao = (o, r) => {
234
+ const e = r ? g("controlRoom.pinnedAnnounce", {
235
+ tool: o,
236
+ defaultValue: "Pinned {{tool}} to favourites"
237
+ }) : g("controlRoom.unpinnedAnnounce", {
238
+ tool: o,
239
+ defaultValue: "Removed {{tool}} from favourites"
240
+ });
241
+ L.current = !L.current, io(L.current ? e : `${e}​`);
242
+ }, co = (o) => {
243
+ var r;
244
+ ao(((r = d.get(o)) == null ? void 0 : r.label) ?? o, !k.has(o)), G(
245
+ (e) => e.includes(o) ? e.filter((a) => a !== o) : [...e, o]
246
+ );
247
+ }, uo = (o, r) => {
248
+ var a;
249
+ const e = (a = J[o]) == null ? void 0 : a.id;
250
+ e !== void 0 && G((y) => {
251
+ const q = y.filter((v) => d.has(v)), z = q.length;
252
+ if (o < z) {
253
+ if (r >= z) return q.filter((Ro) => Ro !== e);
254
+ const v = q.slice();
255
+ return v.splice(o, 1), v.splice(r, 0, e), v;
256
+ }
257
+ if (r <= z) {
258
+ const v = q.slice();
259
+ return v.splice(Math.min(r, z), 0, e), v;
260
+ }
261
+ return y;
262
+ });
263
+ }, po = ({
264
+ tool: o,
265
+ from: r,
266
+ to: e
267
+ }) => {
268
+ const a = k.size, y = r < a;
269
+ return y && e >= a ? g("controlRoom.unpinnedAnnounce", {
270
+ tool: o.label,
271
+ defaultValue: "Removed {{tool}} from favourites"
272
+ }) : !y && e <= a ? g("controlRoom.pinnedAnnounce", {
273
+ tool: o.label,
274
+ defaultValue: "Pinned {{tool}} to favourites"
275
+ }) : y && e < a ? g("controlRoom.reorderAnnounce", {
276
+ tool: o.label,
277
+ to: e + 1,
278
+ total: a,
279
+ defaultValue: "{{tool}} moved to position {{to}} of {{total}}"
280
+ }) : "";
281
+ }, K = X(null), Q = Mo(), fo = p(
282
+ (o) => {
283
+ K.current = o, Q(o), typeof S == "function" ? S(o) : S && (S.current = o);
284
+ },
285
+ [Q, S]
286
+ ), O = $ != null ? d.get($) ?? null : null, mo = O ? /* @__PURE__ */ U(go, { children: [
287
+ s ? (() => {
288
+ const o = k.has(O.id);
289
+ return /* @__PURE__ */ T(
290
+ Y,
291
+ {
292
+ icon: /* @__PURE__ */ T(
293
+ Ao,
294
+ {
295
+ "aria-hidden": "true",
296
+ fill: o ? "currentColor" : "none",
297
+ className: o ? "ds:text-[color:var(--accent)]" : void 0
298
+ }
299
+ ),
300
+ intent: "ghost",
301
+ size: "sm",
302
+ "aria-pressed": o,
303
+ "aria-label": g("controlRoom.favorite", {
304
+ defaultValue: "Favourite"
305
+ }),
306
+ onClick: () => co(O.id)
307
+ }
308
+ );
309
+ })() : null,
310
+ /* @__PURE__ */ T(
311
+ Y,
312
+ {
313
+ icon: /* @__PURE__ */ T(So, { "aria-hidden": "true" }),
314
+ intent: "ghost",
315
+ size: "sm",
316
+ "aria-label": g("controlRoom.close", { defaultValue: "Close" }),
317
+ onClick: () => {
318
+ var o;
319
+ return (o = K.current) == null ? void 0 : o.close();
320
+ }
321
+ }
322
+ )
323
+ ] }) : null;
324
+ return /* @__PURE__ */ U(xo, { actions: mo, children: [
325
+ /* @__PURE__ */ T(
326
+ yo,
327
+ {
328
+ ref: fo,
329
+ dataComponent: "control-room-rail",
330
+ agentAdapter: wo,
331
+ tools: J,
332
+ activeToolId: R,
333
+ defaultActiveToolId: A,
334
+ onActiveToolChange: I,
335
+ panelWidth: ro,
336
+ onPanelWidthChange: so,
337
+ railLabel: c ?? g("controlRoom.railLabel", { defaultValue: "Control room" }),
338
+ onReorder: s ? uo : void 0,
339
+ formatReorderAnnouncement: s ? po : void 0,
340
+ ...j
341
+ }
342
+ ),
343
+ s ? /* @__PURE__ */ T("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: lo }) : null
344
+ ] });
345
+ });
346
+ export {
347
+ Oo as C,
348
+ $o as a,
349
+ ko as b,
350
+ wo as c,
351
+ Eo as d,
352
+ Xo as u
353
+ };
354
+ //# sourceMappingURL=control-room-rail-Cv7GpMqX.js.map
@@ -7,11 +7,11 @@ import { A as S } from "./avatar-CkDeQOSI.js";
7
7
  import { A as F } from "./alert-CiQ5Pa3Q.js";
8
8
  import { C as w } from "./card-DPmk26CL.js";
9
9
  import { D as m } from "./dropdown-menu-DU-Hrf33.js";
10
- import { T as q } from "./tab-bar-rDkLiaA6.js";
10
+ import { T as q } from "./tab-bar-Cw9UK18Z.js";
11
11
  import { a as A, H as G, g as J, f as z, e as K, c as Q, d as U } from "./header-3o9o9v_T.js";
12
12
  import { H as X } from "./header-settings-CTe45iDy.js";
13
13
  import { S as Y } from "./sign-in-with-alfadocs-button-DWwBJtyE.js";
14
- import { S as Z, g as _, b as aa, a as ea, j as sa, k as ta, i as ra, h as I } from "./sidebar-ClTY9lLI.js";
14
+ import { S as Z, g as _, b as aa, a as ea, j as sa, k as ta, i as ra, h as I } from "./sidebar-DbZXLl8h.js";
15
15
  import { T as na } from "./theme-root-BOO73p5t.js";
16
16
  import { a as da } from "./tooltip-Cp-PLePW.js";
17
17
  import { u as ia } from "./use-theme-CAuo6EYT.js";
@@ -529,4 +529,4 @@ export {
529
529
  ka as M,
530
530
  g as P
531
531
  };
532
- //# sourceMappingURL=marketplace-app-shell-D_g9BaDI.js.map
532
+ //# sourceMappingURL=marketplace-app-shell-DdwPj03y.js.map