@alfadocs/ui-kit 1.42.0 → 1.44.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 (126) hide show
  1. package/dist/_chunks/{calendar-ChJQzRw-.js → calendar-U6N0F99w.js} +383 -359
  2. package/dist/_chunks/calendar-workspace-DBYAtdyd.js +12161 -0
  3. package/dist/_chunks/control-room-rail-Cv7GpMqX.js +354 -0
  4. package/dist/_chunks/{face-scheme-Dg6ZyLKb.js → face-scheme-Bm6pe7R8.js} +265 -275
  5. package/dist/_chunks/help-me-write-templates-GUeEn3Ff.js +741 -0
  6. package/dist/_chunks/{marketplace-app-shell-D_g9BaDI.js → marketplace-app-shell-DdwPj03y.js} +3 -3
  7. package/dist/_chunks/{notes-panel-CRAovkjx.js → notes-panel-CY4KmDo-.js} +159 -152
  8. package/dist/_chunks/{panel-subview-PMBRPFOa.js → panel-subview-CYnuX-KR.js} +61 -40
  9. package/dist/_chunks/rich-text-editor-BYE6kK4u.js +3839 -0
  10. package/dist/_chunks/{sidebar-ClTY9lLI.js → sidebar-DbZXLl8h.js} +2 -2
  11. package/dist/_chunks/tab-bar-Cw9UK18Z.js +228 -0
  12. package/dist/_chunks/{tool-rail-D89USYE6.js → tool-rail-CCFqDfAn.js} +282 -276
  13. package/dist/_chunks/undo-2-CYNAzclj.js +26 -0
  14. package/dist/_chunks/use-edge-resize-BHesP0kg.js +149 -0
  15. package/dist/_chunks/use-scroll-overflow-UbLrUfBo.js +72 -0
  16. package/dist/_chunks/variables-menu-vXUaSBj4.js +401 -0
  17. package/dist/agent-catalog.json +84 -3
  18. package/dist/agent-i18n/en.json +14 -3
  19. package/dist/components/calendar/calendar.d.ts +6 -0
  20. package/dist/components/calendar/index.js +1 -1
  21. package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
  22. package/dist/components/control-room-rail/index.js +1 -1
  23. package/dist/components/face-scheme/index.js +1 -1
  24. package/dist/components/index.d.ts +1 -0
  25. package/dist/components/notes-panel/index.js +1 -1
  26. package/dist/components/notes-panel/notes-panel.d.ts +4 -0
  27. package/dist/components/panel-subview/index.js +1 -1
  28. package/dist/components/panel-subview/panel-subview.d.ts +6 -0
  29. package/dist/components/rich-text-editor/editor-toolbar.d.ts +35 -3
  30. package/dist/components/rich-text-editor/index.d.ts +1 -1
  31. package/dist/components/rich-text-editor/index.js +1 -1
  32. package/dist/components/rich-text-editor/rich-text-editor.d.ts +98 -15
  33. package/dist/components/sidebar/index.js +1 -1
  34. package/dist/components/tab-bar/index.js +1 -1
  35. package/dist/components/tool-rail/index.js +1 -1
  36. package/dist/components/tool-rail/tool-rail.d.ts +16 -0
  37. package/dist/components/variables-menu/index.d.ts +4 -0
  38. package/dist/components/variables-menu/index.js +6 -0
  39. package/dist/components/variables-menu/variables-menu.agent.d.ts +10 -0
  40. package/dist/components/variables-menu/variables-menu.d.ts +53 -0
  41. package/dist/hooks/index.d.ts +2 -0
  42. package/dist/hooks/index.js +35 -32
  43. package/dist/hooks/use-edge-resize.d.ts +13 -1
  44. package/dist/host-compat.css +5 -5
  45. package/dist/i18n/locales/ar.d.ts +77 -6
  46. package/dist/i18n/locales/ar.js +78 -7
  47. package/dist/i18n/locales/de.d.ts +77 -6
  48. package/dist/i18n/locales/de.js +78 -7
  49. package/dist/i18n/locales/el.d.ts +77 -6
  50. package/dist/i18n/locales/el.js +78 -7
  51. package/dist/i18n/locales/en.d.ts +77 -6
  52. package/dist/i18n/locales/en.js +85 -7
  53. package/dist/i18n/locales/es.d.ts +77 -6
  54. package/dist/i18n/locales/es.js +78 -7
  55. package/dist/i18n/locales/fr.d.ts +77 -6
  56. package/dist/i18n/locales/fr.js +78 -7
  57. package/dist/i18n/locales/hi.d.ts +77 -6
  58. package/dist/i18n/locales/hi.js +78 -7
  59. package/dist/i18n/locales/it.d.ts +77 -6
  60. package/dist/i18n/locales/it.js +78 -7
  61. package/dist/i18n/locales/ja.d.ts +77 -6
  62. package/dist/i18n/locales/ja.js +78 -7
  63. package/dist/i18n/locales/nl.d.ts +77 -6
  64. package/dist/i18n/locales/nl.js +78 -7
  65. package/dist/i18n/locales/pl.d.ts +77 -6
  66. package/dist/i18n/locales/pl.js +78 -7
  67. package/dist/i18n/locales/pt.d.ts +77 -6
  68. package/dist/i18n/locales/pt.js +78 -7
  69. package/dist/i18n/locales/ro.d.ts +77 -6
  70. package/dist/i18n/locales/ro.js +78 -7
  71. package/dist/i18n/locales/ru.d.ts +77 -6
  72. package/dist/i18n/locales/ru.js +78 -7
  73. package/dist/i18n/locales/sq.d.ts +77 -6
  74. package/dist/i18n/locales/sq.js +78 -7
  75. package/dist/i18n/locales/sv.d.ts +77 -6
  76. package/dist/i18n/locales/sv.js +78 -7
  77. package/dist/i18n/locales/tr.d.ts +77 -6
  78. package/dist/i18n/locales/tr.js +78 -7
  79. package/dist/i18n/locales/zh.d.ts +77 -6
  80. package/dist/i18n/locales/zh.js +78 -7
  81. package/dist/index.js +916 -913
  82. package/dist/locales/ar.json +78 -7
  83. package/dist/locales/de.json +78 -7
  84. package/dist/locales/el.json +78 -7
  85. package/dist/locales/en.json +78 -7
  86. package/dist/locales/es.json +78 -7
  87. package/dist/locales/fr.json +78 -7
  88. package/dist/locales/hi.json +78 -7
  89. package/dist/locales/it.json +78 -7
  90. package/dist/locales/ja.json +78 -7
  91. package/dist/locales/nl.json +78 -7
  92. package/dist/locales/pl.json +78 -7
  93. package/dist/locales/pt.json +78 -7
  94. package/dist/locales/ro.json +78 -7
  95. package/dist/locales/ru.json +78 -7
  96. package/dist/locales/sq.json +78 -7
  97. package/dist/locales/sv.json +78 -7
  98. package/dist/locales/tr.json +78 -7
  99. package/dist/locales/zh.json +78 -7
  100. package/dist/patterns/calendar/calendar-bookings-panel.d.ts +8 -3
  101. package/dist/patterns/calendar/calendar-care-rules.d.ts +49 -0
  102. package/dist/patterns/calendar/calendar-task-editor.d.ts +31 -0
  103. package/dist/patterns/calendar/calendar-workspace.d.ts +8 -1
  104. package/dist/patterns/calendar/calendar-workspace.model.d.ts +39 -12
  105. package/dist/patterns/calendar/calendar.data.d.ts +9 -0
  106. package/dist/patterns/calendar/calendar.journey.d.ts +35 -3
  107. package/dist/patterns/calendar/calendar.model.d.ts +23 -1
  108. package/dist/patterns/calendar/calendar.sheets.d.ts +21 -3
  109. package/dist/patterns/calendar/calendar.surface.d.ts +6 -1
  110. package/dist/patterns/calendar/calendar.types.d.ts +32 -1
  111. package/dist/patterns/calendar/index.js +1 -1
  112. package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts +58 -26
  113. package/dist/patterns/help-me-write-templates/index.d.ts +1 -1
  114. package/dist/patterns/help-me-write-templates/index.js +1 -1
  115. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  116. package/dist/tokens.css +6 -6
  117. package/package.json +5 -1
  118. package/dist/_chunks/calendar-workspace-qlxrxCqm.js +0 -11392
  119. package/dist/_chunks/control-room-rail-CnNZusR5.js +0 -337
  120. package/dist/_chunks/help-me-write-templates-B-m7zgJa.js +0 -775
  121. package/dist/_chunks/highlighter-DSkckT2Q.js +0 -15
  122. package/dist/_chunks/rich-text-editor-DUMeifwc.js +0 -3176
  123. package/dist/_chunks/tab-bar-rDkLiaA6.js +0 -268
  124. package/dist/_chunks/use-edge-resize-ZnGG7gyO.js +0 -139
  125. package/dist/_chunks/use-overflow-collapse-BIOzKbni.js +0 -32
  126. package/dist/_chunks/wand-sparkles-DAjKyhz7.js +0 -27
@@ -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