@alfadocs/ui-kit 1.43.0 → 1.45.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 (113) hide show
  1. package/dist/_chunks/ai-sparkle-DXeP_6a0.js +52 -0
  2. package/dist/_chunks/{calendar-ChJQzRw-.js → calendar-U6N0F99w.js} +383 -359
  3. package/dist/_chunks/calendar-workspace-B7KvZ1_D.js +12161 -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/{notes-panel-CRAovkjx.js → notes-panel-Dkk9QPPX.js} +159 -152
  7. package/dist/_chunks/{panel-subview-PMBRPFOa.js → panel-subview-CYnuX-KR.js} +61 -40
  8. package/dist/_chunks/rich-text-editor-BrAvNajV.js +3779 -0
  9. package/dist/_chunks/undo-2-CYNAzclj.js +26 -0
  10. package/dist/_chunks/use-ai-sparkle-CyQSRTCe.js +103 -0
  11. package/dist/_chunks/variables-menu-vXUaSBj4.js +401 -0
  12. package/dist/agent-catalog.json +84 -3
  13. package/dist/agent-i18n/en.json +14 -3
  14. package/dist/components/ai-sparkle/ai-sparkle.d.ts +24 -0
  15. package/dist/components/ai-sparkle/index.d.ts +3 -0
  16. package/dist/components/ai-sparkle/index.js +5 -0
  17. package/dist/components/calendar/calendar.d.ts +6 -0
  18. package/dist/components/calendar/index.js +1 -1
  19. package/dist/components/face-scheme/index.js +1 -1
  20. package/dist/components/index.d.ts +4 -2
  21. package/dist/components/notes-panel/index.js +1 -1
  22. package/dist/components/notes-panel/notes-panel.d.ts +4 -0
  23. package/dist/components/panel-subview/index.js +1 -1
  24. package/dist/components/panel-subview/panel-subview.d.ts +6 -0
  25. package/dist/components/rich-text-editor/editor-toolbar.d.ts +35 -3
  26. package/dist/components/rich-text-editor/index.d.ts +1 -1
  27. package/dist/components/rich-text-editor/index.js +1 -1
  28. package/dist/components/rich-text-editor/rich-text-editor.d.ts +98 -15
  29. package/dist/components/variables-menu/index.d.ts +4 -0
  30. package/dist/components/variables-menu/index.js +6 -0
  31. package/dist/components/variables-menu/variables-menu.agent.d.ts +10 -0
  32. package/dist/components/variables-menu/variables-menu.d.ts +53 -0
  33. package/dist/hooks/index.d.ts +1 -0
  34. package/dist/hooks/index.js +64 -56
  35. package/dist/hooks/use-ai-sparkle.d.ts +109 -0
  36. package/dist/host-compat.css +5 -5
  37. package/dist/i18n/locales/ar.d.ts +77 -6
  38. package/dist/i18n/locales/ar.js +78 -7
  39. package/dist/i18n/locales/de.d.ts +77 -6
  40. package/dist/i18n/locales/de.js +78 -7
  41. package/dist/i18n/locales/el.d.ts +77 -6
  42. package/dist/i18n/locales/el.js +78 -7
  43. package/dist/i18n/locales/en.d.ts +77 -6
  44. package/dist/i18n/locales/en.js +85 -7
  45. package/dist/i18n/locales/es.d.ts +77 -6
  46. package/dist/i18n/locales/es.js +78 -7
  47. package/dist/i18n/locales/fr.d.ts +77 -6
  48. package/dist/i18n/locales/fr.js +78 -7
  49. package/dist/i18n/locales/hi.d.ts +77 -6
  50. package/dist/i18n/locales/hi.js +78 -7
  51. package/dist/i18n/locales/it.d.ts +77 -6
  52. package/dist/i18n/locales/it.js +78 -7
  53. package/dist/i18n/locales/ja.d.ts +77 -6
  54. package/dist/i18n/locales/ja.js +78 -7
  55. package/dist/i18n/locales/nl.d.ts +77 -6
  56. package/dist/i18n/locales/nl.js +78 -7
  57. package/dist/i18n/locales/pl.d.ts +77 -6
  58. package/dist/i18n/locales/pl.js +78 -7
  59. package/dist/i18n/locales/pt.d.ts +77 -6
  60. package/dist/i18n/locales/pt.js +78 -7
  61. package/dist/i18n/locales/ro.d.ts +77 -6
  62. package/dist/i18n/locales/ro.js +78 -7
  63. package/dist/i18n/locales/ru.d.ts +77 -6
  64. package/dist/i18n/locales/ru.js +78 -7
  65. package/dist/i18n/locales/sq.d.ts +77 -6
  66. package/dist/i18n/locales/sq.js +78 -7
  67. package/dist/i18n/locales/sv.d.ts +77 -6
  68. package/dist/i18n/locales/sv.js +78 -7
  69. package/dist/i18n/locales/tr.d.ts +77 -6
  70. package/dist/i18n/locales/tr.js +78 -7
  71. package/dist/i18n/locales/zh.d.ts +77 -6
  72. package/dist/i18n/locales/zh.js +78 -7
  73. package/dist/index.js +1106 -1099
  74. package/dist/locales/ar.json +78 -7
  75. package/dist/locales/de.json +78 -7
  76. package/dist/locales/el.json +78 -7
  77. package/dist/locales/en.json +78 -7
  78. package/dist/locales/es.json +78 -7
  79. package/dist/locales/fr.json +78 -7
  80. package/dist/locales/hi.json +78 -7
  81. package/dist/locales/it.json +78 -7
  82. package/dist/locales/ja.json +78 -7
  83. package/dist/locales/nl.json +78 -7
  84. package/dist/locales/pl.json +78 -7
  85. package/dist/locales/pt.json +78 -7
  86. package/dist/locales/ro.json +78 -7
  87. package/dist/locales/ru.json +78 -7
  88. package/dist/locales/sq.json +78 -7
  89. package/dist/locales/sv.json +78 -7
  90. package/dist/locales/tr.json +78 -7
  91. package/dist/locales/zh.json +78 -7
  92. package/dist/patterns/calendar/calendar-bookings-panel.d.ts +8 -3
  93. package/dist/patterns/calendar/calendar-care-rules.d.ts +49 -0
  94. package/dist/patterns/calendar/calendar-task-editor.d.ts +31 -0
  95. package/dist/patterns/calendar/calendar-workspace.d.ts +8 -1
  96. package/dist/patterns/calendar/calendar-workspace.model.d.ts +39 -12
  97. package/dist/patterns/calendar/calendar.data.d.ts +9 -0
  98. package/dist/patterns/calendar/calendar.journey.d.ts +35 -3
  99. package/dist/patterns/calendar/calendar.model.d.ts +23 -1
  100. package/dist/patterns/calendar/calendar.sheets.d.ts +21 -3
  101. package/dist/patterns/calendar/calendar.surface.d.ts +6 -1
  102. package/dist/patterns/calendar/calendar.types.d.ts +32 -1
  103. package/dist/patterns/calendar/index.js +1 -1
  104. package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts +58 -26
  105. package/dist/patterns/help-me-write-templates/index.d.ts +1 -1
  106. package/dist/patterns/help-me-write-templates/index.js +1 -1
  107. package/dist/tokens.css +6 -6
  108. package/package.json +5 -1
  109. package/dist/_chunks/calendar-workspace-DhXqqu-D.js +0 -11392
  110. package/dist/_chunks/help-me-write-templates-B-m7zgJa.js +0 -775
  111. package/dist/_chunks/highlighter-DSkckT2Q.js +0 -15
  112. package/dist/_chunks/rich-text-editor-DUMeifwc.js +0 -3176
  113. 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,103 @@
1
+ import { useState as v, useEffect as _, useCallback as e } from "react";
2
+ import { u as k } from "./use-prefers-reduced-motion-BMwIQRjB.js";
3
+ const y = {
4
+ intro: 3200,
5
+ landed: 2800
6
+ }, g = {
7
+ intro: "ds:animate-[ai-pill-shimmer_calc(var(--animation-duration)*6)_var(--ease-in-out)_1]",
8
+ working: "ds:animate-[ai-pill-shimmer_calc(var(--animation-duration)*6)_var(--ease-in-out)_infinite]",
9
+ landed: "ds:animate-[ai-pill-shimmer_calc(var(--animation-duration)*4)_var(--ease-out)_1]"
10
+ }, S = {
11
+ intro: "ds:animate-[ai-comet-orbit_calc(var(--animation-duration)*7)_var(--ease-in-out)_1_both]",
12
+ working: "ds:animate-[ai-comet-orbit_calc(var(--animation-duration)*8)_linear_infinite]",
13
+ landed: "ds:animate-[ai-comet-orbit_calc(var(--animation-duration)*5)_var(--ease-out)_1_both]"
14
+ }, w = {
15
+ intro: "ds:[--sparkle-base:8] ds:animate-[ai-sparkle-burst_calc(var(--animation-duration)*5)_var(--ease-in-out)_1_both]",
16
+ working: "ds:[--sparkle-base:0] ds:animate-[ai-sparkle-twinkle_calc(var(--animation-duration)*8)_var(--ease-in-out)_infinite]",
17
+ landed: "ds:[--sparkle-base:6] ds:animate-[ai-sparkle-burst_calc(var(--animation-duration)*5)_var(--ease-in-out)_1_both]"
18
+ }, s = "ds:absolute ds:opacity-0 ds:text-[color:var(--ai-sparkle)] ds:fill-current ds:drop-shadow-[0_0_var(--spacing-2xs)_var(--ai-sparkle)] ds:[animation-delay:calc(var(--animation-duration)*(var(--sparkle-base)+var(--sparkle-stagger)))]", z = [
19
+ {
20
+ key: "start",
21
+ className: `${s} ds:[--sparkle-stagger:0] ds:size-3 ds:[inset-block-start:calc(var(--spacing-xs)*-1)] ds:[inset-inline-start:calc(var(--spacing-2xs)*-1)]`
22
+ },
23
+ {
24
+ key: "top",
25
+ className: `${s} ds:[--sparkle-stagger:0.5] ds:size-4 ds:[inset-block-start:calc(var(--spacing-sm)*-1)] ds:[inset-inline-start:40%]`
26
+ },
27
+ {
28
+ key: "end",
29
+ className: `${s} ds:[--sparkle-stagger:1] ds:size-3 ds:[inset-block-start:calc(var(--spacing-xs)*-1)] ds:[inset-inline-end:var(--spacing-md)]`
30
+ },
31
+ {
32
+ key: "side",
33
+ className: `${s} ds:[--sparkle-stagger:1.5] ds:size-2 ds:[inset-block-start:40%] ds:[inset-inline-end:calc(var(--spacing-sm)*-1)]`
34
+ },
35
+ {
36
+ key: "below",
37
+ className: `${s} ds:[--sparkle-stagger:2] ds:size-3 ds:[inset-block-end:calc(var(--spacing-xs)*-1)] ds:[inset-inline-start:25%]`
38
+ }
39
+ ], h = "ds:pointer-events-none ds:absolute ds:[inset-block-start:0] ds:[inset-inline-start:0] ds:opacity-0 ds:[offset-path:inset(0_round_var(--radius-full))] ds:[offset-rotate:0deg]", C = [
40
+ {
41
+ key: 1,
42
+ lag: "ds:[animation-delay:calc(var(--animation-duration)*0.2)]",
43
+ dot: "ds:size-2.5 ds:opacity-[var(--opacity-90)]"
44
+ },
45
+ {
46
+ key: 2,
47
+ lag: "ds:[animation-delay:calc(var(--animation-duration)*0.4)]",
48
+ dot: "ds:size-2 ds:opacity-[var(--opacity-70)]"
49
+ },
50
+ {
51
+ key: 3,
52
+ lag: "ds:[animation-delay:calc(var(--animation-duration)*0.6)]",
53
+ dot: "ds:size-2 ds:opacity-[var(--opacity-50)]"
54
+ },
55
+ {
56
+ key: 4,
57
+ lag: "ds:[animation-delay:calc(var(--animation-duration)*0.8)]",
58
+ dot: "ds:size-1.5 ds:opacity-[var(--opacity-30)]"
59
+ },
60
+ {
61
+ key: 5,
62
+ lag: "ds:[animation-delay:calc(var(--animation-duration)*1)]",
63
+ dot: "ds:size-1.5 ds:opacity-[var(--opacity-20)]"
64
+ },
65
+ {
66
+ key: 6,
67
+ lag: "ds:[animation-delay:calc(var(--animation-duration)*1.2)]",
68
+ dot: "ds:size-1 ds:opacity-[var(--opacity-10)]"
69
+ }
70
+ ];
71
+ function A(o = {}) {
72
+ const { enabled: r = !0, reducedMotion: d = "auto" } = o, c = k(), n = d === "off" ? !1 : c, [a, i] = v(
73
+ r ? "intro" : null
74
+ );
75
+ _(() => {
76
+ if (a !== "intro" && a !== "landed") return;
77
+ const t = n ? 0 : y[a], p = window.setTimeout(() => i(null), t);
78
+ return () => window.clearTimeout(p);
79
+ }, [a, n]);
80
+ const l = e(() => i("working"), []), m = e(() => i("landed"), []), u = e(() => {
81
+ i((t) => t === "working" ? null : t);
82
+ }, []);
83
+ return {
84
+ state: a,
85
+ props: {
86
+ "data-ai-sparkle": a ?? void 0,
87
+ className: a ? g[a] : ""
88
+ },
89
+ start: l,
90
+ land: m,
91
+ reset: u
92
+ };
93
+ }
94
+ export {
95
+ w as B,
96
+ C,
97
+ z as S,
98
+ h as a,
99
+ S as b,
100
+ g as c,
101
+ A as u
102
+ };
103
+ //# sourceMappingURL=use-ai-sparkle-CyQSRTCe.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "1.43.0",
3
+ "packageVersion": "1.45.0",
4
4
  "components": [
5
5
  {
6
6
  "kind": "component",
@@ -11709,6 +11709,12 @@
11709
11709
  "type": "string",
11710
11710
  "description": "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
11711
11711
  "descriptionKey": "ui.agent.richTextEditor.state.markdown"
11712
+ },
11713
+ {
11714
+ "name": "aiBusy",
11715
+ "type": "boolean",
11716
+ "description": "True while a one-shot AI action (a practice template, spelling or auto-format) is rewriting the note. Read `html` once it is false.",
11717
+ "descriptionKey": "ui.agent.richTextEditor.state.aiBusy"
11712
11718
  }
11713
11719
  ],
11714
11720
  "actions": [
@@ -15378,6 +15384,81 @@
15378
15384
  }
15379
15385
  }
15380
15386
  },
15387
+ {
15388
+ "kind": "component",
15389
+ "id": "variables-menu",
15390
+ "capabilities": [
15391
+ "filter",
15392
+ "select_single",
15393
+ "close"
15394
+ ],
15395
+ "state": [
15396
+ {
15397
+ "name": "query",
15398
+ "type": "string",
15399
+ "description": "Current filter text.",
15400
+ "descriptionKey": "ui.agent.variablesMenu.state.query"
15401
+ },
15402
+ {
15403
+ "name": "visibleTokens",
15404
+ "type": "string[]",
15405
+ "description": "Tokens of the variables currently visible, in row order.",
15406
+ "descriptionKey": "ui.agent.variablesMenu.state.visibleTokens"
15407
+ }
15408
+ ],
15409
+ "actions": [
15410
+ {
15411
+ "name": "select_token",
15412
+ "safety": "write",
15413
+ "argsType": "{ token: string }",
15414
+ "argsSchema": {
15415
+ "type": "object",
15416
+ "properties": {
15417
+ "token": {
15418
+ "type": "string",
15419
+ "description": "Token of the variable to insert, without brackets."
15420
+ }
15421
+ },
15422
+ "required": [
15423
+ "token"
15424
+ ]
15425
+ },
15426
+ "idempotent": false,
15427
+ "examples": [
15428
+ {
15429
+ "args": {
15430
+ "token": "NOME"
15431
+ },
15432
+ "note": "Insert [[NOME]] and close the menu."
15433
+ }
15434
+ ],
15435
+ "description": "Insert the given variable token at the anchor.",
15436
+ "descriptionKey": "ui.agent.variablesMenu.actions.selectToken"
15437
+ },
15438
+ {
15439
+ "name": "close",
15440
+ "safety": "read",
15441
+ "idempotent": true,
15442
+ "description": "Dismiss the menu without inserting anything.",
15443
+ "descriptionKey": "ui.agent.variablesMenu.actions.close"
15444
+ }
15445
+ ],
15446
+ "domHooks": {
15447
+ "root": {
15448
+ "attr": "data-component",
15449
+ "value": "variables-menu"
15450
+ },
15451
+ "instanceId": {
15452
+ "attr": "data-component-id",
15453
+ "sourceProp": "id",
15454
+ "description": "Sourced from the id prop."
15455
+ },
15456
+ "item": {
15457
+ "attr": "data-variable-token",
15458
+ "description": "Each visible row emits its token as data-variable-token."
15459
+ }
15460
+ }
15461
+ },
15381
15462
  {
15382
15463
  "kind": "component",
15383
15464
  "id": "visually-hidden",
@@ -18608,7 +18689,7 @@
18608
18689
  {
18609
18690
  "name": "run_template",
18610
18691
  "safety": "phi",
18611
- "description": "Open the Alia Writing Assistant from the editor's AI pill, open the Templates menu (default template first) and pick a template. It rewrites the selected text, or the whole note when nothing is selected; the draft shows beside the note. Replace swaps the source for the draft, Insert below keeps it and adds the draft after it; the notice that follows offers Undo. Any text typed in the prompt first goes along as extra instructions. Out of AI credits shows a notice instead of a draft.",
18692
+ "description": "Open the Templates menu from the editor's AI pill, or from the bubble that appears over selected text, and pick a template (default first). It runs straight away and rewrites the selected text, or the whole note when nothing is selected; the notice that follows offers Undo. Without patient AI consent the consent banner shows first. Out of AI credits opens the Alia Writing Assistant on the out-of-credits notice.",
18612
18693
  "descriptionKey": "ui.agent.helpMeWriteTemplates.workflows.runTemplate",
18613
18694
  "uiActions": [
18614
18695
  "dropdown-menu.open",
@@ -18634,7 +18715,7 @@
18634
18715
  {
18635
18716
  "name": "manage_templates",
18636
18717
  "safety": "write",
18637
- "description": "Open Manage templates from the Templates menu: list the practice's templates, create or edit one (name, optional short description, instructions for the AI, use as default; names are unique) and delete one after a confirmation. Shown only when the host allows managing.",
18718
+ "description": "Open Manage templates from the Templates menu in the AI pill: list the practice's templates, create or edit one (name, optional short description, instructions for the AI, use as default; names are unique) and delete one after a confirmation. Shown only when the host allows managing.",
18638
18719
  "descriptionKey": "ui.agent.helpMeWriteTemplates.workflows.manageTemplates",
18639
18720
  "uiActions": [
18640
18721
  "dialog.close",