@alfadocs/ui-kit 1.146.0 → 1.147.1

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 (66) hide show
  1. package/dist/_chunks/{prescription-history-CYCg6nxp.js → prescription-history-CFs3JMIE.js} +718 -717
  2. package/dist/_chunks/registry-connection-panel-ACOsXu3F.js +529 -0
  3. package/dist/agent-catalog.json +4 -4
  4. package/dist/agent-i18n/en.json +2 -2
  5. package/dist/browser-support.js +1 -1
  6. package/dist/components/registry-connection-panel/index.js +1 -1
  7. package/dist/components/registry-connection-panel/registry-connection-panel.d.ts +14 -0
  8. package/dist/i18n/locales/ar.d.ts +1 -0
  9. package/dist/i18n/locales/ar.js +1 -0
  10. package/dist/i18n/locales/de.d.ts +1 -0
  11. package/dist/i18n/locales/de.js +1 -0
  12. package/dist/i18n/locales/el.d.ts +1 -0
  13. package/dist/i18n/locales/el.js +1 -0
  14. package/dist/i18n/locales/en.d.ts +1 -0
  15. package/dist/i18n/locales/en.js +1 -0
  16. package/dist/i18n/locales/es.d.ts +1 -0
  17. package/dist/i18n/locales/es.js +1 -0
  18. package/dist/i18n/locales/fr.d.ts +1 -0
  19. package/dist/i18n/locales/fr.js +1 -0
  20. package/dist/i18n/locales/hi.d.ts +1 -0
  21. package/dist/i18n/locales/hi.js +1 -0
  22. package/dist/i18n/locales/it.d.ts +1 -0
  23. package/dist/i18n/locales/it.js +1 -0
  24. package/dist/i18n/locales/ja.d.ts +1 -0
  25. package/dist/i18n/locales/ja.js +1 -0
  26. package/dist/i18n/locales/nl.d.ts +1 -0
  27. package/dist/i18n/locales/nl.js +1 -0
  28. package/dist/i18n/locales/pl.d.ts +1 -0
  29. package/dist/i18n/locales/pl.js +1 -0
  30. package/dist/i18n/locales/pt.d.ts +1 -0
  31. package/dist/i18n/locales/pt.js +1 -0
  32. package/dist/i18n/locales/ro.d.ts +1 -0
  33. package/dist/i18n/locales/ro.js +1 -0
  34. package/dist/i18n/locales/ru.d.ts +1 -0
  35. package/dist/i18n/locales/ru.js +1 -0
  36. package/dist/i18n/locales/sq.d.ts +1 -0
  37. package/dist/i18n/locales/sq.js +1 -0
  38. package/dist/i18n/locales/sv.d.ts +1 -0
  39. package/dist/i18n/locales/sv.js +1 -0
  40. package/dist/i18n/locales/tr.d.ts +1 -0
  41. package/dist/i18n/locales/tr.js +1 -0
  42. package/dist/i18n/locales/zh.d.ts +1 -0
  43. package/dist/i18n/locales/zh.js +1 -0
  44. package/dist/index.js +2 -2
  45. package/dist/locales/ar.json +1 -0
  46. package/dist/locales/de.json +1 -0
  47. package/dist/locales/el.json +1 -0
  48. package/dist/locales/en.json +1 -0
  49. package/dist/locales/es.json +1 -0
  50. package/dist/locales/fr.json +1 -0
  51. package/dist/locales/hi.json +1 -0
  52. package/dist/locales/it.json +1 -0
  53. package/dist/locales/ja.json +1 -0
  54. package/dist/locales/nl.json +1 -0
  55. package/dist/locales/pl.json +1 -0
  56. package/dist/locales/pt.json +1 -0
  57. package/dist/locales/ro.json +1 -0
  58. package/dist/locales/ru.json +1 -0
  59. package/dist/locales/sq.json +1 -0
  60. package/dist/locales/sv.json +1 -0
  61. package/dist/locales/tr.json +1 -0
  62. package/dist/locales/zh.json +1 -0
  63. package/dist/patterns/prescription/index.js +1 -1
  64. package/dist/patterns/prescription/prescription-composer.d.ts +2 -0
  65. package/package.json +1 -1
  66. package/dist/_chunks/registry-connection-panel-BEAkwivy.js +0 -503
@@ -1,503 +0,0 @@
1
- import { jsx as t, jsxs as v } from "react/jsx-runtime";
2
- import { forwardRef as Be, useId as k, useRef as h, useState as g, useEffect as T, useCallback as f, useMemo as me, useImperativeHandle as _e } from "react";
3
- import { useTranslation as He } from "react-i18next";
4
- import { u as De } from "./registry-DvAUVLHh.js";
5
- import { u as Ke } from "./use-controllable-state-BiY4xTzM.js";
6
- import { f as Oe } from "./intl-locale-FWh-Y5_3.js";
7
- import { A as x } from "./alert-C4WKViaS.js";
8
- import { B as Ee } from "./badge-BUk4RjTS.js";
9
- import { B as q } from "./button-Dp4j9ygh.js";
10
- import { F as pe } from "./form-field-CyHfOVKF.js";
11
- import { P as We } from "./panel-header-CbtlTe85.js";
12
- import { P as he } from "./panel-subview-DjBwNV16.js";
13
- import { P as Ze } from "./password-input-SJGHFdOO.js";
14
- import { S as $e } from "./scroll-area-CY5SLYNw.js";
15
- import { S as Je } from "./select-Bw5FvGJ7.js";
16
- import { T as ge } from "./text-input-B6iAgCr3.js";
17
- import { S as fe } from "./settings-d25ju_6L.js";
18
- import { C as Ge } from "./check-DrFSN__t.js";
19
- import { C as Qe } from "./circle-alert-rGDZ73Wh.js";
20
- import { c as Ue } from "./createLucideIcon-DhHxpK9K.js";
21
- /**
22
- * @license lucide-react v1.22.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */
27
- const Xe = [
28
- ["path", { d: "m19 5 3-3", key: "yk6iyv" }],
29
- ["path", { d: "m2 22 3-3", key: "19mgm9" }],
30
- [
31
- "path",
32
- { d: "M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z", key: "goz73y" }
33
- ],
34
- ["path", { d: "M7.5 13.5 10 11", key: "7xgeeb" }],
35
- ["path", { d: "M10.5 16.5 13 14", key: "10btkg" }],
36
- [
37
- "path",
38
- { d: "m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z", key: "1snsnr" }
39
- ]
40
- ], Ye = Ue("unplug", Xe), et = {
41
- id: "registry-connection-panel",
42
- capabilities: ["view_change", "submit"],
43
- state: {
44
- status: {
45
- type: "'connected' | 'disconnected' | 'incomplete'",
46
- descriptionKey: "ui.agent.registryConnectionPanel.state.status",
47
- description: "Connection state: connected (a session is open), disconnected (settings saved, no session) or incomplete (settings not saved yet).",
48
- read: (i) => i.getStatus()
49
- },
50
- view: {
51
- type: "'overview' | 'connect'",
52
- descriptionKey: "ui.agent.registryConnectionPanel.state.view",
53
- description: "The open view: the overview (status and settings) or the connect view (the one-time code step).",
54
- read: (i) => i.getView()
55
- }
56
- },
57
- actions: {
58
- set_view: {
59
- safety: "write",
60
- argsType: "{ view: 'overview' | 'connect' }",
61
- argsSchema: {
62
- type: "object",
63
- properties: {
64
- view: { type: "string", enum: ["overview", "connect"] }
65
- },
66
- required: ["view"]
67
- },
68
- idempotent: !0,
69
- descriptionKey: "ui.agent.registryConnectionPanel.actions.setView",
70
- description: "Open the overview or the connect view (the code step). Nothing is sent to the registry.",
71
- examples: [{ args: { view: "connect" }, note: "Open the code step." }],
72
- invoke: (i, n) => i.setView(n.view)
73
- },
74
- submit_settings: {
75
- safety: "write",
76
- idempotent: !0,
77
- openWorld: !0,
78
- errors: [
79
- "A required field is empty: the panel shows the message and does not call the host.",
80
- "The host refused the settings. The panel shows the host's message."
81
- ],
82
- descriptionKey: "ui.agent.registryConnectionPanel.actions.submitSettings",
83
- description: "Save the settings as they stand in the panel, through the host. The agent supplies no values and reads none: the fields hold credentials. Required fields are checked first.",
84
- invoke: (i) => i.saveSettings()
85
- },
86
- confirm_code: {
87
- safety: "write",
88
- argsType: "{ code: string }",
89
- argsSchema: {
90
- type: "object",
91
- properties: {
92
- code: {
93
- type: "string",
94
- description: "The one-time code the registry sent."
95
- }
96
- },
97
- required: ["code"]
98
- },
99
- openWorld: !0,
100
- errors: [
101
- "The code is empty: the panel refuses it without calling the host.",
102
- "The host refused the code. The panel shows the host's message."
103
- ],
104
- descriptionKey: "ui.agent.registryConnectionPanel.actions.confirmCode",
105
- description: "Confirm the one-time code, through the host, to open a session. Read status afterwards: the host changes it on success and the panel returns to the overview.",
106
- invoke: (i, n) => i.connect(n.code)
107
- }
108
- },
109
- domHooks: {
110
- root: {
111
- attr: "data-component",
112
- value: "registry-connection-panel",
113
- description: "Marks the RegistryConnectionPanel region."
114
- },
115
- instanceId: {
116
- attr: "data-component-id",
117
- sourceProp: "id",
118
- description: "Sourced from the id prop. Required to address a specific panel from the agent. The root also carries data-status and data-view."
119
- }
120
- }
121
- };
122
- function ve(i) {
123
- return typeof i == "object" && i !== null && typeof i.then == "function";
124
- }
125
- function tt(i) {
126
- if (typeof globalThis.reportError == "function") {
127
- globalThis.reportError(i);
128
- return;
129
- }
130
- setTimeout(() => {
131
- throw i;
132
- }, 0);
133
- }
134
- const nt = {
135
- connected: "success",
136
- disconnected: "neutral",
137
- incomplete: "warning"
138
- }, ye = "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", ot = Be(
139
- ({
140
- registryName: i,
141
- status: n,
142
- connectedUntil: y,
143
- notice: W,
144
- fields: N,
145
- values: R,
146
- fieldErrors: I,
147
- onSaveSettings: Z,
148
- codeExplanation: $,
149
- onRequestCode: L,
150
- onConnect: J,
151
- view: Ce,
152
- defaultView: we = "overview",
153
- onViewChange: be,
154
- error: G,
155
- id: Q,
156
- className: Pe
157
- }, Se) => {
158
- const { t: r, i18n: ke } = He("ui"), U = k(), X = k(), Y = k(), Te = k(), ee = h(null), A = h(null), [xe, C] = Ke({
159
- value: Ce,
160
- defaultValue: we,
161
- onChange: be
162
- }), u = xe ?? "overview", qe = JSON.stringify(R), [V, te] = g(() => ({
163
- ...R
164
- }));
165
- T(() => {
166
- te({ ...R });
167
- }, [qe]);
168
- const [Ne, ne] = g({}), [w, oe] = g(""), [z, b] = g(), [Re, M] = g(!1), [F, re] = g(
169
- () => /* @__PURE__ */ new Set()
170
- ), m = h(/* @__PURE__ */ new Set()), P = h(!0);
171
- T(() => (P.current = !0, () => {
172
- P.current = !1;
173
- }), []);
174
- const c = h({
175
- status: n,
176
- view: u,
177
- draft: V,
178
- fields: N,
179
- onSaveSettings: Z,
180
- onRequestCode: L,
181
- onConnect: J,
182
- code: w
183
- });
184
- c.current = {
185
- status: n,
186
- view: u,
187
- draft: V,
188
- fields: N,
189
- onSaveSettings: Z,
190
- onRequestCode: L,
191
- onConnect: J,
192
- code: w
193
- };
194
- const p = f(
195
- (e, s) => {
196
- if (m.current.has(e)) return Promise.resolve();
197
- let o;
198
- try {
199
- o = s();
200
- } catch (d) {
201
- return tt(d), Promise.resolve();
202
- }
203
- if (!ve(o)) return Promise.resolve();
204
- m.current.add(e), re(new Set(m.current));
205
- const a = () => {
206
- m.current.delete(e), P.current && re(new Set(m.current));
207
- };
208
- return Promise.resolve(o).then(a, a);
209
- },
210
- []
211
- ), S = f(
212
- (e) => {
213
- e !== c.current.view && C(e);
214
- },
215
- [C]
216
- ), ie = h(n);
217
- T(() => {
218
- const e = ie.current;
219
- ie.current = n, e !== "connected" && n === "connected" && c.current.view === "connect" && C("overview");
220
- }, [n, C]), T(() => {
221
- u !== "connect" && (oe(""), b(void 0), M(!1));
222
- }, [u]);
223
- const se = r("registryConnectionPanel.errors.required"), ae = f(() => {
224
- const { fields: e, draft: s } = c.current, o = {};
225
- for (const a of e)
226
- a.required !== !1 && (a.kind === "secret" && a.stored || (s[a.name] ?? "").trim() === "" && (o[a.name] = se));
227
- return o;
228
- }, [se]), j = f(() => {
229
- var o, a;
230
- const e = ae();
231
- ne(e);
232
- const s = Object.keys(e)[0];
233
- if (s !== void 0) {
234
- const d = (a = (o = ee.current) == null ? void 0 : o.querySelector(`[data-field-name="${s}"]`)) == null ? void 0 : a.querySelector('input, button, [role="combobox"]');
235
- return d == null || d.focus(), Promise.resolve();
236
- }
237
- return p(
238
- "save",
239
- () => c.current.onSaveSettings(c.current.draft)
240
- );
241
- }, [ae, p]), B = (e, s) => {
242
- te((o) => ({ ...o, [e]: s })), ne((o) => {
243
- if (!(e in o)) return o;
244
- const { [e]: a, ...d } = o;
245
- return d;
246
- });
247
- }, _ = f(
248
- (e) => {
249
- var o;
250
- const s = e.trim();
251
- return s === "" ? (b(r("registryConnectionPanel.errors.codeRequired")), (o = A.current) == null || o.focus(), Promise.resolve()) : (b(void 0), p("connect", () => c.current.onConnect(s)));
252
- },
253
- [p, r]
254
- ), Ie = f(
255
- () => p("requestCode", () => {
256
- var s, o;
257
- const e = (o = (s = c.current).onRequestCode) == null ? void 0 : o.call(s);
258
- if (ve(e))
259
- return Promise.resolve(e).then(() => {
260
- P.current && M(!0);
261
- });
262
- M(!0);
263
- }),
264
- [p]
265
- ), H = me(
266
- () => ({
267
- getStatus: () => c.current.status,
268
- getView: () => c.current.view,
269
- setView: S,
270
- saveSettings: j,
271
- connect: (e) => _(e)
272
- }),
273
- [S, j, _]
274
- );
275
- _e(Se, () => H, [H]), De(et, H, Q);
276
- const ce = Oe(ke.language), de = me(() => n !== "connected" || !y || Number.isNaN(y.getTime()) ? null : new Intl.DateTimeFormat(ce, { timeStyle: "short" }).format(
277
- y
278
- ), [n, y, ce]), Le = n === "connected" ? de ? r("registryConnectionPanel.status.connectedUntil", { time: de }) : r("registryConnectionPanel.status.connected") : r(n === "incomplete" ? "registryConnectionPanel.status.incomplete" : "registryConnectionPanel.status.disconnected"), Ae = n === "connected" ? /* @__PURE__ */ t(Ge, { "aria-hidden": "true" }) : n === "incomplete" ? /* @__PURE__ */ t(Qe, { "aria-hidden": "true" }) : /* @__PURE__ */ t(Ye, { "aria-hidden": "true" }), D = n === "incomplete" ? r("registryConnectionPanel.help.incomplete", { registryName: i }) : n === "disconnected" ? r("registryConnectionPanel.help.disconnected", { registryName: i }) : null, le = (e) => G ? /* @__PURE__ */ t(x, { variant: "error", "data-registry-error": e, children: /* @__PURE__ */ t(x.Description, { children: G }) }) : null, Ve = (e) => {
279
- e.preventDefault(), j();
280
- }, ze = (e) => {
281
- e.preventDefault(), _(w);
282
- }, Me = (e) => {
283
- const s = e.kind ?? "text", o = (I == null ? void 0 : I[e.name]) ?? Ne[e.name], a = s === "secret" && e.stored === !0, d = [
284
- e.hint,
285
- a ? r("registryConnectionPanel.secretStored") : void 0
286
- ].filter(Boolean).join(" ") || void 0, ue = e.required === !1, je = !ue && !a, O = V[e.name] ?? "", E = o ? "error" : void 0;
287
- return /* @__PURE__ */ t(
288
- pe,
289
- {
290
- "data-field-name": e.name,
291
- label: e.label,
292
- description: d,
293
- error: o,
294
- ...ue ? { optional: !0 } : { required: je },
295
- children: s === "select" ? /* @__PURE__ */ t(
296
- Je,
297
- {
298
- options: (e.options ?? []).map((l) => ({
299
- value: l.value,
300
- label: l.label
301
- })),
302
- value: O,
303
- placeholder: r("registryConnectionPanel.choose"),
304
- tone: E,
305
- onValueChange: (l) => B(e.name, l)
306
- }
307
- ) : s === "secret" ? /* @__PURE__ */ t(
308
- Ze,
309
- {
310
- value: O,
311
- maxLength: e.maxLength,
312
- inputMode: e.inputMode,
313
- autoCapitalize: e.autoCapitalize,
314
- autoComplete: "off",
315
- tone: E,
316
- onChange: (l) => B(e.name, l.target.value)
317
- }
318
- ) : /* @__PURE__ */ t(
319
- ge,
320
- {
321
- value: O,
322
- maxLength: e.maxLength,
323
- inputMode: e.inputMode,
324
- autoCapitalize: e.autoCapitalize,
325
- autoComplete: "off",
326
- tone: E,
327
- onChange: (l) => B(e.name, l.target.value)
328
- }
329
- )
330
- },
331
- e.name
332
- );
333
- }, Fe = r(n === "connected" ? "registryConnectionPanel.connectAgain" : "registryConnectionPanel.connect"), K = n === "incomplete";
334
- return /* @__PURE__ */ t(
335
- "section",
336
- {
337
- ref: ee,
338
- "data-component": "registry-connection-panel",
339
- "data-component-id": Q,
340
- "data-status": n,
341
- "data-view": u,
342
- "aria-labelledby": U,
343
- className: ["ds:flex ds:h-full ds:min-h-0 ds:flex-col", Pe].filter(Boolean).join(" "),
344
- children: /* @__PURE__ */ v(he.Host, { className: "ds:flex-1", children: [
345
- /* @__PURE__ */ t(
346
- We,
347
- {
348
- title: r("registryConnectionPanel.title", { registryName: i }),
349
- icon: /* @__PURE__ */ t(fe, { "aria-hidden": "true" }),
350
- headingId: U,
351
- divider: !0
352
- }
353
- ),
354
- /* @__PURE__ */ t($e, { orientation: "vertical", className: "ds:min-h-0 ds:flex-1", children: /* @__PURE__ */ v("div", { className: ye, children: [
355
- W ? /* @__PURE__ */ t(x, { variant: "info", "data-registry-notice": "", children: /* @__PURE__ */ t(x.Description, { children: W }) }) : null,
356
- u === "overview" ? le("overview") : null,
357
- /* @__PURE__ */ v(
358
- "div",
359
- {
360
- "data-registry-status": "",
361
- className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-sm)]",
362
- children: [
363
- /* @__PURE__ */ t(
364
- Ee,
365
- {
366
- size: "sm",
367
- variant: nt[n],
368
- leading: Ae,
369
- children: Le
370
- }
371
- ),
372
- D ? /* @__PURE__ */ t(
373
- "p",
374
- {
375
- id: X,
376
- className: "ds:m-0 type-body-sm ds:text-muted-foreground",
377
- children: D
378
- }
379
- ) : null,
380
- /* @__PURE__ */ t(
381
- q,
382
- {
383
- type: "button",
384
- intent: n === "connected" ? "secondary" : "primary",
385
- "aria-disabled": K || void 0,
386
- "aria-describedby": K && D ? X : void 0,
387
- onClick: () => {
388
- K || S("connect");
389
- },
390
- "data-action": "connect",
391
- className: "ds:min-h-[var(--min-target-size)]",
392
- children: Fe
393
- }
394
- )
395
- ]
396
- }
397
- ),
398
- /* @__PURE__ */ v(
399
- "form",
400
- {
401
- id: Te,
402
- noValidate: !0,
403
- onSubmit: Ve,
404
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
405
- children: [
406
- /* @__PURE__ */ t("h3", { className: "ds:m-0 type-title-item", children: r("registryConnectionPanel.settings") }),
407
- N.map(Me),
408
- /* @__PURE__ */ t(
409
- q,
410
- {
411
- type: "submit",
412
- intent: n === "incomplete" ? "primary" : "secondary",
413
- loading: F.has("save"),
414
- "data-action": "save",
415
- className: "ds:min-h-[var(--min-target-size)] ds:self-start",
416
- children: r("registryConnectionPanel.save")
417
- }
418
- )
419
- ]
420
- }
421
- )
422
- ] }) }),
423
- /* @__PURE__ */ t(
424
- he,
425
- {
426
- open: u === "connect",
427
- title: r("registryConnectionPanel.connectTitle", { registryName: i }),
428
- icon: /* @__PURE__ */ t(fe, { "aria-hidden": "true" }),
429
- backLabel: r("registryConnectionPanel.back"),
430
- headingLevel: 2,
431
- initialFocusRef: A,
432
- onBack: () => {
433
- m.current.has("connect") || S("overview");
434
- },
435
- footer: /* @__PURE__ */ t(
436
- q,
437
- {
438
- type: "submit",
439
- form: Y,
440
- loading: F.has("connect"),
441
- "data-action": "confirm",
442
- className: "ds:min-h-[var(--min-target-size)]",
443
- children: r("common.confirm")
444
- }
445
- ),
446
- children: /* @__PURE__ */ v(
447
- "form",
448
- {
449
- id: Y,
450
- noValidate: !0,
451
- onSubmit: ze,
452
- className: `ds:-m-[var(--panel-subview-inset)] ${ye}`,
453
- children: [
454
- le("connect"),
455
- $ ? /* @__PURE__ */ t("p", { className: "ds:m-0 type-body", children: $ }) : null,
456
- L ? /* @__PURE__ */ t(
457
- q,
458
- {
459
- type: "button",
460
- intent: "secondary",
461
- loading: F.has("requestCode"),
462
- onClick: () => void Ie(),
463
- "data-action": "request-code",
464
- className: "ds:min-h-[var(--min-target-size)] ds:self-start",
465
- children: r(Re ? "registryConnectionPanel.sendCodeAgain" : "registryConnectionPanel.sendCode")
466
- }
467
- ) : null,
468
- /* @__PURE__ */ t(
469
- pe,
470
- {
471
- label: r("registryConnectionPanel.codeLabel"),
472
- required: !0,
473
- error: z,
474
- children: /* @__PURE__ */ t(
475
- ge,
476
- {
477
- ref: A,
478
- value: w,
479
- autoComplete: "one-time-code",
480
- autoCapitalize: "characters",
481
- tone: z ? "error" : void 0,
482
- onChange: (e) => {
483
- oe(e.target.value), z && b(void 0);
484
- }
485
- }
486
- )
487
- }
488
- )
489
- ]
490
- }
491
- )
492
- }
493
- )
494
- ] })
495
- }
496
- );
497
- }
498
- );
499
- ot.displayName = "RegistryConnectionPanel";
500
- export {
501
- ot as R
502
- };
503
- //# sourceMappingURL=registry-connection-panel-BEAkwivy.js.map