@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,26 @@
1
+ import { c as a } from "./createLucideIcon-DhHxpK9K.js";
2
+ /**
3
+ * @license lucide-react v1.22.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const o = [
9
+ ["path", { d: "m9 11-6 6v3h9l3-3", key: "1a3l36" }],
10
+ ["path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4", key: "14a9rk" }]
11
+ ], h = a("highlighter", o);
12
+ /**
13
+ * @license lucide-react v1.22.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */
18
+ const t = [
19
+ ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
20
+ ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
21
+ ], c = a("undo-2", t);
22
+ export {
23
+ h as H,
24
+ c as U
25
+ };
26
+ //# sourceMappingURL=undo-2-CYNAzclj.js.map
@@ -0,0 +1,149 @@
1
+ import { useState as T, useRef as b, useCallback as o } from "react";
2
+ import { useTranslation as Y } from "react-i18next";
3
+ import { u as A } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
4
+ const $ = 16, H = 64;
5
+ function j({
6
+ edge: P,
7
+ targetRef: n,
8
+ cssProperty: c,
9
+ minSize: p,
10
+ maxSize: d,
11
+ defaultSize: k,
12
+ disabled: l = !1,
13
+ onResize: u,
14
+ size: f
15
+ }) {
16
+ const { t: K } = Y(), E = f !== void 0, [h, g] = T(
17
+ E ? f : null
18
+ ), [M, x] = T(!1), m = b(null), w = b(null);
19
+ A(() => {
20
+ const t = n.current;
21
+ if (!t) return;
22
+ const r = t.getBoundingClientRect().width;
23
+ r > 0 && (m.current = r);
24
+ });
25
+ const I = o(
26
+ (t) => Math.min(d, Math.max(p, t)),
27
+ [p, d]
28
+ );
29
+ A(() => {
30
+ var r, e;
31
+ if (!E) return;
32
+ const t = f === null ? null : I(f);
33
+ g(t), t === null ? ((r = n.current) == null || r.style.removeProperty(c), m.current = null) : (e = n.current) == null || e.style.setProperty(c, `${t}px`);
34
+ }, [E, f, I, c, n]);
35
+ const s = o(() => {
36
+ if (h !== null) return h;
37
+ const t = n.current;
38
+ if (t) {
39
+ const r = t.getBoundingClientRect().width;
40
+ if (r > 0)
41
+ return m.current = r, r;
42
+ }
43
+ return m.current ?? k;
44
+ }, [h, k, n]), a = o(
45
+ (t) => {
46
+ var e;
47
+ const r = I(t);
48
+ return g(r), (e = n.current) == null || e.style.setProperty(c, `${r}px`), r;
49
+ },
50
+ [I, c, n]
51
+ ), C = o(() => {
52
+ var t;
53
+ g(null), (t = n.current) == null || t.style.removeProperty(c), m.current = null, u == null || u(null);
54
+ }, [c, u, n]), y = o(() => {
55
+ const t = n.current, r = t ? getComputedStyle(t).direction === "rtl" : !1;
56
+ return (P === "inline-end" ? 1 : -1) * (r ? -1 : 1);
57
+ }, [P, n]), v = o(
58
+ (t) => {
59
+ l || !t.isPrimary || (t.currentTarget.setPointerCapture(t.pointerId), w.current = {
60
+ pointerId: t.pointerId,
61
+ startX: t.clientX,
62
+ startSize: s(),
63
+ sign: y()
64
+ }, x(!0));
65
+ },
66
+ [l, s, y]
67
+ ), _ = o(
68
+ (t) => {
69
+ const r = w.current;
70
+ !r || t.pointerId !== r.pointerId || a(r.startSize + r.sign * (t.clientX - r.startX));
71
+ },
72
+ [a]
73
+ ), D = o(
74
+ (t) => {
75
+ const r = w.current;
76
+ if (!r || t.pointerId !== r.pointerId) return;
77
+ t.currentTarget.releasePointerCapture(t.pointerId), w.current = null, x(!1);
78
+ const e = a(
79
+ r.startSize + r.sign * (t.clientX - r.startX)
80
+ );
81
+ u == null || u(e);
82
+ },
83
+ [a, u]
84
+ ), B = o(
85
+ (t) => {
86
+ if (l) return;
87
+ const r = t.shiftKey ? H : $, e = y();
88
+ let i = null;
89
+ switch (t.key) {
90
+ case "ArrowRight":
91
+ i = s() + e * r;
92
+ break;
93
+ case "ArrowLeft":
94
+ i = s() - e * r;
95
+ break;
96
+ case "Home":
97
+ i = p;
98
+ break;
99
+ case "End":
100
+ i = d;
101
+ break;
102
+ case "Enter":
103
+ t.preventDefault(), C();
104
+ return;
105
+ default:
106
+ return;
107
+ }
108
+ if (i === null) return;
109
+ t.preventDefault();
110
+ const L = a(i);
111
+ u == null || u(L);
112
+ },
113
+ [
114
+ a,
115
+ s,
116
+ l,
117
+ d,
118
+ p,
119
+ u,
120
+ C,
121
+ y
122
+ ]
123
+ ), X = Math.round(s());
124
+ return {
125
+ separatorProps: {
126
+ role: "separator",
127
+ tabIndex: l ? -1 : 0,
128
+ "aria-orientation": "vertical",
129
+ "aria-valuemin": p,
130
+ "aria-valuemax": d,
131
+ "aria-valuenow": X,
132
+ "aria-valuetext": K("resizable.widthAnnounce", { width: X }),
133
+ "aria-disabled": l || void 0,
134
+ onPointerDown: v,
135
+ onPointerMove: _,
136
+ onPointerUp: D,
137
+ onPointerCancel: D,
138
+ onKeyDown: B,
139
+ onDoubleClick: C
140
+ },
141
+ isResizing: M,
142
+ isResized: h !== null,
143
+ reset: C
144
+ };
145
+ }
146
+ export {
147
+ j as u
148
+ };
149
+ //# sourceMappingURL=use-edge-resize-BHesP0kg.js.map
@@ -0,0 +1,72 @@
1
+ import { useRef as m, useState as h, useCallback as v } from "react";
2
+ import { u as R } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
3
+ function b(l = !0) {
4
+ const i = m(null), [o, a] = h(null), d = v(
5
+ (e) => {
6
+ l && a(e);
7
+ },
8
+ [l]
9
+ ), [t, n] = h(!1), r = m(null);
10
+ return R(() => {
11
+ if (!l) {
12
+ r.current = null, n((c) => c && !1);
13
+ return;
14
+ }
15
+ const e = i.current;
16
+ if (!e) return;
17
+ const u = () => {
18
+ o && (r.current = o.scrollWidth);
19
+ const c = r.current;
20
+ if (c == null) return;
21
+ const f = c - e.clientWidth > 1;
22
+ n((w) => w === f ? w : f);
23
+ };
24
+ if (u(), typeof ResizeObserver > "u") return;
25
+ const s = new ResizeObserver(u);
26
+ return s.observe(e), o && s.observe(o), () => s.disconnect();
27
+ }, [l, o]), { containerRef: i, contentRef: d, isOverflowing: t };
28
+ }
29
+ function y(l = !0) {
30
+ const i = m(null), [o, a] = h({ start: !1, end: !1 });
31
+ R(() => {
32
+ const t = i.current;
33
+ if (!t || !l) {
34
+ a(
35
+ (e) => e.start || e.end ? { start: !1, end: !1 } : e
36
+ );
37
+ return;
38
+ }
39
+ const n = () => {
40
+ const e = Math.abs(t.scrollLeft), u = t.scrollWidth - t.clientWidth, s = e > 1, c = u - e > 1;
41
+ a(
42
+ (f) => f.start === s && f.end === c ? f : { start: s, end: c }
43
+ );
44
+ };
45
+ n(), t.addEventListener("scroll", n, { passive: !0 });
46
+ let r;
47
+ return typeof ResizeObserver < "u" && (r = new ResizeObserver(n), r.observe(t), t.firstElementChild && r.observe(t.firstElementChild)), () => {
48
+ t.removeEventListener("scroll", n), r == null || r.disconnect();
49
+ };
50
+ }, [l]);
51
+ const d = v((t) => {
52
+ var s;
53
+ const n = i.current;
54
+ if (!n || typeof window > "u") return;
55
+ const r = window.getComputedStyle(n).direction === "rtl", e = (s = window.matchMedia) == null ? void 0 : s.call(
56
+ window,
57
+ "(prefers-reduced-motion: reduce)"
58
+ ).matches, u = n.clientWidth * 0.85 * t * (r ? -1 : 1);
59
+ n.scrollBy({ left: u, behavior: e ? "auto" : "smooth" });
60
+ }, []);
61
+ return {
62
+ ref: i,
63
+ canScrollStart: o.start,
64
+ canScrollEnd: o.end,
65
+ scrollByPage: d
66
+ };
67
+ }
68
+ export {
69
+ y as a,
70
+ b as u
71
+ };
72
+ //# sourceMappingURL=use-scroll-overflow-UbLrUfBo.js.map
@@ -0,0 +1,401 @@
1
+ import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as Q, useRef as _, useId as q, useMemo as h, useState as Y, useImperativeHandle as J, useEffect as W } from "react";
3
+ import { useTranslation as X } from "react-i18next";
4
+ import { n as z } from "./normalize-diacritics-BNGbFNlJ.js";
5
+ import { u as Z } from "./registry-DvAUVLHh.js";
6
+ import { S as ee } from "./search-QbWPlY5f.js";
7
+ import { F as O } from "./file-text-5yv6r2ls.js";
8
+ import { U as te } from "./user-cog-BTn98Arm.js";
9
+ import { B as se } from "./building-2-D33bLCWL.js";
10
+ import { C as ae } from "./calendar-days-BGWklvE-.js";
11
+ import { U as re } from "./user-B12p7bVF.js";
12
+ import { c as oe } from "./createLucideIcon-DhHxpK9K.js";
13
+ /**
14
+ * @license lucide-react v1.22.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ */
19
+ const ne = [
20
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
21
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
22
+ ["path", { d: "M12 7v5l4 2", key: "1fdv2h" }]
23
+ ], ie = oe("history", ne), de = {
24
+ id: "variables-menu",
25
+ // Ephemeral filter (read) plus a persisted insert (write, not reversible by
26
+ // the same UI — undo lives in the editor, not here) and a close (read).
27
+ capabilities: ["filter", "select_single", "close"],
28
+ state: {
29
+ query: {
30
+ type: "string",
31
+ descriptionKey: "ui.agent.variablesMenu.state.query",
32
+ description: "Current filter text.",
33
+ read: (n) => n.getQuery()
34
+ },
35
+ visibleTokens: {
36
+ type: "string[]",
37
+ descriptionKey: "ui.agent.variablesMenu.state.visibleTokens",
38
+ description: "Tokens of the variables currently visible, in row order.",
39
+ read: (n) => n.getVisibleTokens()
40
+ }
41
+ },
42
+ actions: {
43
+ select_token: {
44
+ // Inserts a `[[TOKEN]]` chip into the host document.
45
+ safety: "write",
46
+ argsType: "{ token: string }",
47
+ argsSchema: {
48
+ type: "object",
49
+ properties: {
50
+ token: {
51
+ type: "string",
52
+ description: "Token of the variable to insert, without brackets."
53
+ }
54
+ },
55
+ required: ["token"]
56
+ },
57
+ idempotent: !1,
58
+ descriptionKey: "ui.agent.variablesMenu.actions.selectToken",
59
+ description: "Insert the given variable token at the anchor.",
60
+ examples: [
61
+ {
62
+ args: { token: "NOME" },
63
+ note: "Insert [[NOME]] and close the menu."
64
+ }
65
+ ],
66
+ invoke: (n, c) => {
67
+ n.selectToken(c.token);
68
+ }
69
+ },
70
+ close: {
71
+ safety: "read",
72
+ idempotent: !0,
73
+ descriptionKey: "ui.agent.variablesMenu.actions.close",
74
+ description: "Dismiss the menu without inserting anything.",
75
+ invoke: (n) => {
76
+ n.close();
77
+ }
78
+ }
79
+ },
80
+ domHooks: {
81
+ root: { attr: "data-component", value: "variables-menu" },
82
+ instanceId: {
83
+ attr: "data-component-id",
84
+ sourceProp: "id",
85
+ description: "Sourced from the id prop."
86
+ },
87
+ item: {
88
+ attr: "data-variable-token",
89
+ description: "Each visible row emits its token as data-variable-token."
90
+ }
91
+ }
92
+ }, C = [
93
+ "patient",
94
+ "appointment",
95
+ "practice",
96
+ "operator",
97
+ "document"
98
+ ], ce = {
99
+ recent: /* @__PURE__ */ a(ie, { "aria-hidden": "true", className: "ds:size-3" }),
100
+ patient: /* @__PURE__ */ a(re, { "aria-hidden": "true", className: "ds:size-3" }),
101
+ appointment: /* @__PURE__ */ a(ae, { "aria-hidden": "true", className: "ds:size-3" }),
102
+ practice: /* @__PURE__ */ a(se, { "aria-hidden": "true", className: "ds:size-3" }),
103
+ operator: /* @__PURE__ */ a(te, { "aria-hidden": "true", className: "ds:size-3" }),
104
+ document: /* @__PURE__ */ a(O, { "aria-hidden": "true", className: "ds:size-3" }),
105
+ other: /* @__PURE__ */ a(O, { "aria-hidden": "true", className: "ds:size-3" })
106
+ };
107
+ function U(n, c) {
108
+ const x = c.trim();
109
+ if (!x) return !0;
110
+ const l = z(x), u = l.replace(/\s+/g, "_"), i = z(n.token);
111
+ return z(n.label).includes(l) || i.includes(l) || i.includes(u);
112
+ }
113
+ const le = {
114
+ patient: "editor.variables.groups.patient",
115
+ appointment: "editor.variables.groups.appointment",
116
+ practice: "editor.variables.groups.practice",
117
+ operator: "editor.variables.groups.operator",
118
+ document: "editor.variables.groups.document",
119
+ other: "editor.variables.groups.other"
120
+ }, pe = {
121
+ patient: "Patient",
122
+ appointment: "Appointment",
123
+ practice: "Practice",
124
+ operator: "Operator",
125
+ document: "Document",
126
+ other: "Other"
127
+ }, ue = [
128
+ "ds:flex ds:flex-col",
129
+ "ds:w-[20rem] ds:overflow-hidden",
130
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
131
+ "ds:bg-[var(--popover)] ds:text-[color:var(--popover-foreground)]",
132
+ "ds:shadow-[var(--shadow-lg)]"
133
+ ].join(" "), me = [
134
+ "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]",
135
+ "ds:px-[var(--spacing-md)] ds:py-[var(--spacing-sm)]",
136
+ "ds:border-b ds:border-[color:var(--border)]"
137
+ ].join(" "), ve = [
138
+ "ds:w-full ds:bg-transparent ds:border-0 ds:outline-none",
139
+ "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]",
140
+ "ds:placeholder:text-[color:var(--muted-foreground)]"
141
+ ].join(" "), fe = [
142
+ "ds:flex ds:flex-col ds:overflow-y-auto",
143
+ "ds:[max-block-size:16.5rem] ds:p-[var(--spacing-2xs)]"
144
+ ].join(" "), ge = [
145
+ "ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
146
+ "ds:px-[var(--spacing-sm)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-2xs)]",
147
+ "ds:text-[length:var(--font-size-2xs)] ds:font-[var(--font-weight-bold)]",
148
+ "ds:tracking-[0.07em] ds:uppercase",
149
+ "ds:text-[color:var(--muted-foreground)]"
150
+ ].join(" "), be = [
151
+ "ds:group ds:flex ds:flex-col ds:justify-center ds:cursor-pointer",
152
+ "ds:gap-0 ds:rounded-[var(--radius-sm)]",
153
+ "ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-xs)]",
154
+ "ds:min-h-8",
155
+ "ds:data-[active=true]:bg-[var(--violet-50)]",
156
+ "ds:[.theme-dark_&]:data-[active=true]:bg-[color-mix(in_oklab,var(--violet-700)_35%,transparent)]"
157
+ ].join(" "), he = "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", xe = "ds:flex-1 ds:truncate ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]", ke = [
158
+ "ds:font-[family-name:var(--font-mono)] ds:text-[length:var(--font-size-2xs)]",
159
+ "ds:text-[color:var(--muted-foreground)]",
160
+ "ds:bg-[var(--muted)] ds:rounded-[var(--radius-sm)]",
161
+ "ds:px-[var(--spacing-2xs)] ds:py-[0.0625rem]",
162
+ "ds:whitespace-nowrap",
163
+ "ds:group-data-[active=true]:bg-[var(--violet-100)]",
164
+ "ds:group-data-[active=true]:text-[color:var(--violet-700)]",
165
+ "ds:[.theme-dark_&]:group-data-[active=true]:bg-[color-mix(in_oklab,var(--violet-800)_55%,transparent)]",
166
+ "ds:[.theme-dark_&]:group-data-[active=true]:text-[color:var(--violet-100)]"
167
+ ].join(" "), ye = [
168
+ "ds:px-[var(--spacing-md)] ds:py-[var(--spacing-lg)] ds:text-center",
169
+ "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]"
170
+ ].join(" "), we = [
171
+ "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-md)]",
172
+ "ds:px-[var(--spacing-md)] ds:py-[var(--spacing-xs)]",
173
+ "ds:border-t ds:border-[color:var(--border)]",
174
+ "ds:bg-[var(--muted)]/40",
175
+ "ds:text-[length:var(--font-size-2xs)] ds:text-[color:var(--muted-foreground)]"
176
+ ].join(" "), j = [
177
+ "ds:font-[family-name:var(--font-mono)] ds:text-[length:var(--font-size-2xs)]",
178
+ "ds:border ds:border-[color:var(--border)] ds:border-b-2",
179
+ "ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-2xs)]",
180
+ "ds:bg-[var(--background)]"
181
+ ].join(" "), Ne = Q(function({
182
+ id: c,
183
+ className: x,
184
+ variables: l,
185
+ recentTokens: u,
186
+ query: i,
187
+ onQueryChange: V,
188
+ onSelect: k,
189
+ onClose: m,
190
+ searchFocusable: A = !0,
191
+ "aria-label": E,
192
+ onActiveDescendantChange: y
193
+ }, H) {
194
+ const { t: p } = X(), R = _(null), P = q().replace(/:/g, ""), v = `${c ?? `variables-menu-${P}`}-list`, T = h(() => {
195
+ const e = /* @__PURE__ */ new Map();
196
+ return l.forEach((r) => e.set(r.token, r)), e;
197
+ }, [l]), w = h(() => {
198
+ const e = [];
199
+ if (u && u.length > 0) {
200
+ const t = u.slice(0, 3).map((s) => T.get(s)).filter((s) => !!s).filter((s) => U(s, i)).map((s) => ({
201
+ key: `recent-${s.token}`,
202
+ group: "recent",
203
+ variable: s
204
+ }));
205
+ t.length > 0 && e.push({
206
+ key: "recent",
207
+ labelKey: "editor.variables.recent",
208
+ defaultLabel: "Recent",
209
+ items: t
210
+ });
211
+ }
212
+ const r = /* @__PURE__ */ new Map();
213
+ return l.forEach((t) => {
214
+ if (!U(t, i)) return;
215
+ const s = t.group && C.includes(t.group) ? t.group : "other", b = r.get(s) ?? [];
216
+ b.push({ key: `${s}-${t.token}`, group: s, variable: t }), r.set(s, b);
217
+ }), [...C, "other"].forEach((t) => {
218
+ const s = r.get(t);
219
+ s && s.length > 0 && e.push({
220
+ key: t,
221
+ labelKey: le[t],
222
+ defaultLabel: pe[t],
223
+ items: s
224
+ });
225
+ }), e;
226
+ }, [l, u, i, T]), o = h(() => w.flatMap((e) => e.items), [w]), [N, S] = Y(null), f = h(() => {
227
+ if (N !== null) {
228
+ const e = o.findIndex(
229
+ (r) => r.variable.token === N
230
+ );
231
+ if (e !== -1) return e;
232
+ }
233
+ return 0;
234
+ }, [N, o]), g = (e) => {
235
+ var r;
236
+ S(((r = o[e]) == null ? void 0 : r.variable.token) ?? null);
237
+ }, D = (e) => {
238
+ o.length !== 0 && g((f + e + o.length) % o.length);
239
+ }, B = () => {
240
+ const e = o[f];
241
+ return e ? (k(e.variable), m("select"), !0) : !1;
242
+ }, K = (e) => {
243
+ switch (e.key) {
244
+ case "ArrowDown":
245
+ return e.preventDefault(), D(1), !0;
246
+ case "ArrowUp":
247
+ return e.preventDefault(), D(-1), !0;
248
+ case "Home":
249
+ return e.preventDefault(), g(0), !0;
250
+ case "End":
251
+ return e.preventDefault(), g(Math.max(0, o.length - 1)), !0;
252
+ case "Enter":
253
+ return e.preventDefault(), B();
254
+ case "Escape":
255
+ return e.preventDefault(), m("escape"), !0;
256
+ default:
257
+ return !1;
258
+ }
259
+ };
260
+ J(H, () => ({
261
+ handleKeyDown: K,
262
+ focusSearch: () => {
263
+ var e;
264
+ return (e = R.current) == null ? void 0 : e.focus();
265
+ }
266
+ }));
267
+ const L = _(i);
268
+ L.current = i;
269
+ const M = _(o);
270
+ M.current = o;
271
+ const G = h(
272
+ () => ({
273
+ getQuery: () => L.current,
274
+ getVisibleTokens: () => M.current.map((e) => e.variable.token),
275
+ selectToken: (e) => {
276
+ const r = M.current.find(
277
+ (t) => t.variable.token === e
278
+ );
279
+ r && (k(r.variable), m("select"));
280
+ },
281
+ close: () => m("escape")
282
+ }),
283
+ [k, m]
284
+ );
285
+ Z(de, G, c);
286
+ const $ = o[f], I = $ ? `${v}-${$.key}` : void 0;
287
+ return W(() => {
288
+ y == null || y(I);
289
+ }, [I]), /* @__PURE__ */ d(
290
+ "div",
291
+ {
292
+ id: c,
293
+ "data-component": "variables-menu",
294
+ "data-component-id": c,
295
+ className: [ue, x].filter(Boolean).join(" "),
296
+ children: [
297
+ A ? /* @__PURE__ */ d("div", { className: me, children: [
298
+ /* @__PURE__ */ a(
299
+ ee,
300
+ {
301
+ "aria-hidden": "true",
302
+ className: "ds:size-3.5 ds:shrink-0 ds:text-[color:var(--muted-foreground)]"
303
+ }
304
+ ),
305
+ /* @__PURE__ */ a(
306
+ "input",
307
+ {
308
+ ref: R,
309
+ role: "combobox",
310
+ "aria-expanded": "true",
311
+ "aria-controls": v,
312
+ "aria-activedescendant": I,
313
+ "aria-autocomplete": "list",
314
+ "aria-label": E ?? p("editor.variables.menuLabel", "Variables"),
315
+ placeholder: p("editor.variables.search", "Search variables…"),
316
+ value: i,
317
+ onChange: (e) => V(e.target.value),
318
+ onKeyDown: K,
319
+ autoComplete: "off",
320
+ className: ve
321
+ }
322
+ )
323
+ ] }) : null,
324
+ /* @__PURE__ */ a(
325
+ "div",
326
+ {
327
+ id: v,
328
+ role: "listbox",
329
+ "aria-label": E ?? p("editor.variables.menuLabel", "Variables"),
330
+ className: fe,
331
+ children: o.length === 0 ? /* @__PURE__ */ a("div", { className: ye, children: p("editor.variables.empty", {
332
+ query: i,
333
+ defaultValue: 'No variables match "{{query}}"'
334
+ }) }) : w.map((e) => {
335
+ const r = `${v}-${e.key}-heading`;
336
+ return /* @__PURE__ */ d("div", { role: "group", "aria-labelledby": r, children: [
337
+ /* @__PURE__ */ d("div", { id: r, className: ge, children: [
338
+ ce[e.key],
339
+ /* @__PURE__ */ a("span", { children: p(e.labelKey, e.defaultLabel) })
340
+ ] }),
341
+ e.items.map((t) => {
342
+ const s = o.indexOf(t), b = s === f;
343
+ return /* @__PURE__ */ a(
344
+ "div",
345
+ {
346
+ id: `${v}-${t.key}`,
347
+ role: "option",
348
+ "aria-selected": b,
349
+ tabIndex: -1,
350
+ "data-active": b,
351
+ "data-variable-token": t.variable.token,
352
+ className: be,
353
+ onMouseDown: (F) => {
354
+ F.preventDefault(), g(s), k(t.variable), m("select");
355
+ },
356
+ onMouseMove: () => {
357
+ f !== s && g(s);
358
+ },
359
+ children: /* @__PURE__ */ d("div", { className: he, children: [
360
+ /* @__PURE__ */ a("span", { className: xe, children: t.variable.label }),
361
+ /* @__PURE__ */ a(
362
+ "span",
363
+ {
364
+ className: ke,
365
+ children: `[[${t.variable.token}]]`
366
+ }
367
+ )
368
+ ] })
369
+ },
370
+ t.key
371
+ );
372
+ })
373
+ ] }, e.key);
374
+ })
375
+ }
376
+ ),
377
+ /* @__PURE__ */ d("div", { className: we, children: [
378
+ /* @__PURE__ */ d("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
379
+ /* @__PURE__ */ a("kbd", { className: j, children: "↑↓" }),
380
+ p("editor.variables.footer.navigate", "navigate")
381
+ ] }),
382
+ /* @__PURE__ */ d("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
383
+ /* @__PURE__ */ a("kbd", { className: j, children: "↵" }),
384
+ p("editor.variables.footer.insert", "insert")
385
+ ] }),
386
+ /* @__PURE__ */ d("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)]", children: [
387
+ /* @__PURE__ */ a("kbd", { className: j, children: "esc" }),
388
+ p("editor.variables.footer.close", "close")
389
+ ] })
390
+ ] })
391
+ ]
392
+ }
393
+ );
394
+ });
395
+ Ne.displayName = "VariablesMenu";
396
+ export {
397
+ ie as H,
398
+ Ne as V,
399
+ de as v
400
+ };
401
+ //# sourceMappingURL=variables-menu-vXUaSBj4.js.map