@alfadocs/ui-kit 1.4.12 → 1.4.13

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 (100) hide show
  1. package/dist/_chunks/actions-cell-renderer-BD-jruqA.js +1784 -0
  2. package/dist/_chunks/{anamnesis-summary-rows-DAIpD0Or.js → anamnesis-summary-rows-B5MAYkJ-.js} +2150 -2092
  3. package/dist/_chunks/{bmi-calculator-CxPn0T0s.js → bmi-calculator-DC5SaqXT.js} +2 -2
  4. package/dist/_chunks/{cycle-calculator-D9M7IKfh.js → cycle-calculator-B_NlctlQ.js} +2 -2
  5. package/dist/_chunks/{due-date-calculator-BkqZEvL4.js → due-date-calculator-le1z3KpW.js} +2 -2
  6. package/dist/_chunks/{fetal-weight-C7JXGg6E.js → fetal-weight-DXA6ZpMq.js} +2 -2
  7. package/dist/_chunks/{file-manager-DzWYcRpE.js → file-manager-BjCM2fZB.js} +2 -2
  8. package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js → hcg-doubling-BT6lki_i.js} +2 -2
  9. package/dist/_chunks/{link-cell-renderer-DCCca2m3.js → link-cell-renderer-C7GvyK66.js} +2 -2
  10. package/dist/_chunks/number-input-CM1q9zvH.js +414 -0
  11. package/dist/_chunks/{optical-prescription-Brs0CeP3.js → optical-prescription-CQR_WJiS.js} +2 -2
  12. package/dist/_chunks/{patient-details-CGhnfdUB.js → patient-details-CnFgF3MU.js} +2 -2
  13. package/dist/_chunks/{patient-table-D2fhV4mV.js → patient-table-BXzcrC79.js} +3 -3
  14. package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js → pregnancy-dating-4tPV_Yko.js} +2 -2
  15. package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js → pregnancy-weight-gain-BBgbWBGe.js} +2 -2
  16. package/dist/_chunks/{signature-status-chip-DUcTgQ0E.js → signature-status-chip-DlLJk1VA.js} +16 -14
  17. package/dist/_chunks/{unit-converter-BeTicruA.js → unit-converter-Dsk__pjA.js} +2 -2
  18. package/dist/agent-catalog.json +14 -8
  19. package/dist/agent-i18n/en.json +3 -2
  20. package/dist/components/bmi-calculator/index.js +1 -1
  21. package/dist/components/cycle-calculator/index.js +1 -1
  22. package/dist/components/data-table/data-table.d.ts +19 -0
  23. package/dist/components/data-table/expanded-row-renderer.d.ts +47 -0
  24. package/dist/components/data-table/index.d.ts +2 -0
  25. package/dist/components/data-table/index.js +31 -27
  26. package/dist/components/due-date-calculator/index.js +1 -1
  27. package/dist/components/fetal-weight/index.js +1 -1
  28. package/dist/components/file-manager/index.js +1 -1
  29. package/dist/components/hcg-doubling/index.js +1 -1
  30. package/dist/components/number-input/index.js +1 -1
  31. package/dist/components/number-input/number-input.d.ts +11 -0
  32. package/dist/components/optical-prescription/index.js +1 -1
  33. package/dist/components/patient-details/index.js +1 -1
  34. package/dist/components/patient-table/index.js +1 -1
  35. package/dist/components/pregnancy-dating/index.js +1 -1
  36. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  37. package/dist/components/signature-status-chip/index.js +1 -1
  38. package/dist/components/unit-converter/index.js +1 -1
  39. package/dist/host-compat.css +4 -1
  40. package/dist/i18n/locales/ar.d.ts +1 -0
  41. package/dist/i18n/locales/ar.js +1 -0
  42. package/dist/i18n/locales/de.d.ts +1 -0
  43. package/dist/i18n/locales/de.js +1 -0
  44. package/dist/i18n/locales/el.d.ts +1 -0
  45. package/dist/i18n/locales/el.js +1 -0
  46. package/dist/i18n/locales/en.d.ts +1 -0
  47. package/dist/i18n/locales/en.js +1 -0
  48. package/dist/i18n/locales/es.d.ts +1 -0
  49. package/dist/i18n/locales/es.js +1 -0
  50. package/dist/i18n/locales/fr.d.ts +1 -0
  51. package/dist/i18n/locales/fr.js +1 -0
  52. package/dist/i18n/locales/hi.d.ts +1 -0
  53. package/dist/i18n/locales/hi.js +1 -0
  54. package/dist/i18n/locales/it.d.ts +1 -0
  55. package/dist/i18n/locales/it.js +1 -0
  56. package/dist/i18n/locales/ja.d.ts +1 -0
  57. package/dist/i18n/locales/ja.js +1 -0
  58. package/dist/i18n/locales/nl.d.ts +1 -0
  59. package/dist/i18n/locales/nl.js +1 -0
  60. package/dist/i18n/locales/pl.d.ts +1 -0
  61. package/dist/i18n/locales/pl.js +1 -0
  62. package/dist/i18n/locales/pt.d.ts +1 -0
  63. package/dist/i18n/locales/pt.js +1 -0
  64. package/dist/i18n/locales/ro.d.ts +1 -0
  65. package/dist/i18n/locales/ro.js +1 -0
  66. package/dist/i18n/locales/ru.d.ts +1 -0
  67. package/dist/i18n/locales/ru.js +1 -0
  68. package/dist/i18n/locales/sq.d.ts +1 -0
  69. package/dist/i18n/locales/sq.js +1 -0
  70. package/dist/i18n/locales/sv.d.ts +1 -0
  71. package/dist/i18n/locales/sv.js +1 -0
  72. package/dist/i18n/locales/tr.d.ts +1 -0
  73. package/dist/i18n/locales/tr.js +1 -0
  74. package/dist/i18n/locales/zh.d.ts +1 -0
  75. package/dist/i18n/locales/zh.js +1 -0
  76. package/dist/index.js +779 -775
  77. package/dist/locales/ar.json +1 -0
  78. package/dist/locales/de.json +1 -0
  79. package/dist/locales/el.json +1 -0
  80. package/dist/locales/en.json +1 -0
  81. package/dist/locales/es.json +1 -0
  82. package/dist/locales/fr.json +1 -0
  83. package/dist/locales/hi.json +1 -0
  84. package/dist/locales/it.json +1 -0
  85. package/dist/locales/ja.json +1 -0
  86. package/dist/locales/nl.json +1 -0
  87. package/dist/locales/pl.json +1 -0
  88. package/dist/locales/pt.json +1 -0
  89. package/dist/locales/ro.json +1 -0
  90. package/dist/locales/ru.json +1 -0
  91. package/dist/locales/sq.json +1 -0
  92. package/dist/locales/sv.json +1 -0
  93. package/dist/locales/tr.json +1 -0
  94. package/dist/locales/zh.json +1 -0
  95. package/dist/patterns/anamnesis/anamnesis-intake.d.ts +5 -1
  96. package/dist/patterns/anamnesis/index.js +1 -1
  97. package/dist/tokens.css +5 -2
  98. package/package.json +1 -1
  99. package/dist/_chunks/actions-cell-renderer-C67oj7mR.js +0 -1581
  100. package/dist/_chunks/number-input-DOe5VYei.js +0 -370
@@ -1,370 +0,0 @@
1
- import { jsxs as Ie, jsx as F } from "react/jsx-runtime";
2
- import { useMemo as Y, forwardRef as De, useRef as K, useCallback as z, useState as q, useEffect as xe } from "react";
3
- import { c as Ce } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Fe } from "react-i18next";
5
- import { u as Se } from "./use-controllable-state-BiY4xTzM.js";
6
- import { u as Ve } from "./form-field-context-B3APVHKx.js";
7
- import { c as Me } from "./compose-refs-C0k0tdqF.js";
8
- import { u as ke } from "./registry-DvAUVLHh.js";
9
- import { C as Te } from "./chevron-down-DWE7GSq9.js";
10
- import { C as Pe } from "./chevron-up-umRGgtJA.js";
11
- const ze = {
12
- id: "number-input",
13
- capabilities: ["set_value"],
14
- state: {
15
- value: {
16
- type: "number | null",
17
- descriptionKey: "ui.agent.numberInput.state.value",
18
- description: "Current numeric value, or null when empty.",
19
- read: (n) => n.getValue()
20
- },
21
- isEmpty: {
22
- type: "boolean",
23
- descriptionKey: "ui.agent.numberInput.state.isEmpty",
24
- description: "Whether the input has no value.",
25
- read: (n) => n.getValue() === null
26
- }
27
- },
28
- actions: {
29
- set_value: {
30
- safety: "write",
31
- argsType: "{ value: number | null }",
32
- argsSchema: {
33
- type: "object",
34
- properties: { value: { type: ["number", "null"] } },
35
- required: ["value"]
36
- },
37
- idempotent: !0,
38
- examples: [{ args: { value: 42 } }, { args: { value: null } }],
39
- descriptionKey: "ui.agent.numberInput.actions.setValue",
40
- description: "Replace the numeric value, or pass null to clear.",
41
- invoke: (n, s) => {
42
- n.setValue(s.value);
43
- }
44
- },
45
- clear: {
46
- safety: "destructive",
47
- idempotent: !0,
48
- descriptionKey: "ui.agent.numberInput.actions.clear",
49
- description: "Empty the input. Loses any typed value.",
50
- invoke: (n) => {
51
- n.clear();
52
- }
53
- },
54
- focus: {
55
- safety: "read",
56
- idempotent: !0,
57
- descriptionKey: "ui.agent.numberInput.actions.focus",
58
- description: "Move keyboard focus to the input.",
59
- invoke: (n) => {
60
- n.focus();
61
- }
62
- }
63
- },
64
- domHooks: {
65
- root: {
66
- attr: "data-component",
67
- value: "number-input",
68
- description: "Marks the NumberInput wrapper."
69
- },
70
- instanceId: {
71
- attr: "data-component-id",
72
- sourceProp: "id",
73
- description: "Sourced from the id prop."
74
- }
75
- }
76
- };
77
- function Re(n) {
78
- let s = "";
79
- for (const l of n) {
80
- const r = l.codePointAt(0);
81
- r !== void 0 && (r >= 1632 && r <= 1641 ? s += String.fromCodePoint(48 + (r - 1632)) : r >= 1776 && r <= 1785 ? s += String.fromCodePoint(48 + (r - 1776)) : s += l);
82
- }
83
- return s;
84
- }
85
- function Ae(n, s, l) {
86
- return Y(() => {
87
- var V, M;
88
- const r = new Intl.NumberFormat(n).formatToParts(1234.5), u = ((V = r.find((a) => a.type === "decimal")) == null ? void 0 : V.value) ?? ".", S = ((M = r.find((a) => a.type === "group")) == null ? void 0 : M.value) ?? ",", p = s === "currency" ? new Intl.NumberFormat(n, {
89
- style: "currency",
90
- currency: l ?? "USD"
91
- }) : s === "percentage" ? new Intl.NumberFormat(n, {
92
- style: "percent",
93
- maximumFractionDigits: 4
94
- }) : s === "integer" ? new Intl.NumberFormat(n, { maximumFractionDigits: 0 }) : new Intl.NumberFormat(n, { maximumFractionDigits: 10 }), R = (a) => Number.isFinite(a) ? p.format(a) : "", A = (a) => {
95
- if (!a) return NaN;
96
- const k = Re(a), h = k.trim(), I = h.startsWith("-") || h.startsWith("−");
97
- let d = "";
98
- for (const N of k)
99
- N >= "0" && N <= "9" ? d += N : N === u && (d += ".");
100
- if (!d || d === ".") return NaN;
101
- let m = Number(d);
102
- return Number.isFinite(m) ? (I && (m = -m), s === "percentage" && (m = m / 100), m) : NaN;
103
- };
104
- let g = "decimal";
105
- if (s === "integer")
106
- g = "numeric";
107
- else if (s === "currency")
108
- try {
109
- const { maximumFractionDigits: a } = new Intl.NumberFormat(n, {
110
- style: "currency",
111
- currency: l ?? "USD"
112
- }).resolvedOptions();
113
- g = a === 0 ? "numeric" : "decimal";
114
- } catch {
115
- g = "decimal";
116
- }
117
- return {
118
- format: R,
119
- parse: A,
120
- decimalSeparator: u,
121
- groupingSeparator: S,
122
- inputMode: g
123
- };
124
- }, [n, s, l]);
125
- }
126
- const je = Ce(
127
- [
128
- "ds:flex ds:items-center ds:w-full ds:rounded-[var(--radius-sm)]",
129
- "ds:border ds:bg-input ds:text-foreground",
130
- "ds:shadow-[var(--shadow-input)]",
131
- "ds:transition-[colors,box-shadow] ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
132
- "ds:focus-within:outline-[length:var(--focus-ring-width)] ds:focus-within:outline-solid",
133
- "ds:focus-within:outline-ring ds:focus-within:outline-offset-[length:var(--focus-ring-offset)]",
134
- "ds:has-[:disabled]:cursor-not-allowed ds:has-[:disabled]:opacity-50"
135
- ].join(" "),
136
- {
137
- variants: {
138
- size: {
139
- sm: "ds:h-8 ds:text-[length:var(--font-size-sm)]",
140
- md: "ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]",
141
- lg: "ds:h-12 ds:text-[length:var(--font-size-lg)]"
142
- },
143
- tone: {
144
- default: "ds:border-border",
145
- error: "ds:border-destructive ds:focus-within:outline-destructive"
146
- }
147
- },
148
- defaultVariants: { size: "md", tone: "default" }
149
- }
150
- ), X = [
151
- "ds:inline-flex ds:items-center ds:justify-center",
152
- "ds:h-full ds:shrink-0",
153
- "ds:text-muted-foreground ds:hover:text-foreground",
154
- "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
155
- "ds:disabled:cursor-not-allowed ds:disabled:opacity-50"
156
- ].join(" "), Be = () => typeof navigator < "u" && navigator.language ? navigator.language : "en-US", Ee = (n) => typeof n == "string" && n.trim() !== "" ? n : void 0;
157
- function Ue(n) {
158
- if (!Number.isFinite(n)) return 0;
159
- const s = String(n), l = s.indexOf(".");
160
- return l === -1 ? 0 : s.length - l - 1;
161
- }
162
- function Le(n, s) {
163
- if (s <= 0 || !Number.isFinite(s)) return n;
164
- const r = 10 ** Ue(s);
165
- return Math.round(n * r) / r;
166
- }
167
- const Ke = De(
168
- ({
169
- value: n,
170
- defaultValue: s,
171
- onChange: l,
172
- min: r,
173
- max: u,
174
- step: S = 1,
175
- mode: p = "integer",
176
- currency: R,
177
- locale: A,
178
- size: g = "md",
179
- tone: V,
180
- className: M,
181
- id: a,
182
- disabled: k,
183
- onFocus: h,
184
- onBlur: I,
185
- onKeyDown: d,
186
- ...m
187
- }, N) => {
188
- const { t: H, i18n: Z } = Fe(), D = Ve(), ee = a ?? D.id, T = !!(D.disabled || k), te = A ?? Ee(Z.language) ?? Be(), j = Ae(te, p, R), {
189
- decimalSeparator: P,
190
- groupingSeparator: W,
191
- format: B,
192
- parse: O
193
- } = j, _ = K(null), ne = Me(N, _), [re, se] = Se({
194
- value: n,
195
- defaultValue: s ?? null,
196
- onChange: l
197
- }), i = re ?? null, $ = K(i);
198
- $.current = i;
199
- const x = z(
200
- (e) => {
201
- const t = p === "percentage" ? e * 100 : e;
202
- return (Number.isInteger(t) ? String(t) : t.toString()).replace(".", P);
203
- },
204
- [p, P]
205
- ), v = z(
206
- (e) => e == null || Number.isNaN(e) ? "" : B(e),
207
- [B]
208
- ), [E, c] = q(
209
- () => v(i)
210
- ), y = K(!1), [oe, b] = q(!1), [U, C] = q(!1), L = z(
211
- (e) => {
212
- if (e >= "0" && e <= "9") return !0;
213
- const t = e.codePointAt(0) ?? 0;
214
- return t >= 1632 && t <= 1641 || t >= 1776 && t <= 1785 ? !0 : e === P || e === W || e === "-" || e === "−";
215
- },
216
- [P, W]
217
- ), ie = z(
218
- (e) => {
219
- let t = "";
220
- for (const o of e)
221
- L(o) && (t += o);
222
- return t;
223
- },
224
- [L]
225
- );
226
- xe(() => {
227
- !y.current && !U && c(v(i));
228
- }, [i, v, U]);
229
- const ae = oe || U || i !== null && (r !== void 0 && i < r || u !== void 0 && i > u), G = D.invalid || ae, ue = G ? "error" : V ?? "default", f = (e) => {
230
- se(e);
231
- }, w = (e) => {
232
- let o = (i ?? 0) + S * e;
233
- r !== void 0 && (o = Math.max(r, o)), u !== void 0 && (o = Math.min(u, o)), o = Le(o, S), f(o), b(!1), c(
234
- y.current ? x(o) : v(o)
235
- );
236
- }, J = (e) => {
237
- f(e), b(!1), c(
238
- y.current ? x(e) : v(e)
239
- );
240
- }, le = (e) => {
241
- if (d == null || d(e), e.defaultPrevented || T) return;
242
- const { key: t, shiftKey: o } = e;
243
- t === "ArrowUp" ? (e.preventDefault(), w(o ? 10 : 1)) : t === "ArrowDown" ? (e.preventDefault(), w(o ? -10 : -1)) : t === "PageUp" ? (e.preventDefault(), w(100)) : t === "PageDown" ? (e.preventDefault(), w(-100)) : t === "Home" && r !== void 0 ? (e.preventDefault(), J(r)) : t === "End" && u !== void 0 && (e.preventDefault(), J(u));
244
- }, de = (e) => {
245
- const t = ie(e.target.value);
246
- if (c(t), t.trim() === "") {
247
- f(null), b(!1), C(!1);
248
- return;
249
- }
250
- const o = O(t);
251
- Number.isNaN(o) || (f(o), C(!1));
252
- }, ce = (e) => {
253
- const { data: t } = e.nativeEvent;
254
- typeof t != "string" || t.length !== 1 || L(t) || e.preventDefault();
255
- }, fe = (e) => {
256
- h == null || h(e), y.current = !0, i != null && c(x(i));
257
- }, pe = (e) => {
258
- if (I == null || I(e), y.current = !1, E.trim() === "") {
259
- f(null), b(!1), C(!1), c("");
260
- return;
261
- }
262
- const t = O(E);
263
- if (Number.isNaN(t)) {
264
- C(!0), b(!1), f(null);
265
- return;
266
- }
267
- const o = r !== void 0 && t < r || u !== void 0 && t > u;
268
- b(o), C(!1), f(t), c(v(t));
269
- }, Q = (e) => {
270
- e.preventDefault();
271
- }, me = () => w(1), ve = () => w(-1), be = Y(
272
- () => ({
273
- getValue: () => $.current,
274
- setValue: (e) => {
275
- f(e), c(
276
- e === null ? "" : y.current ? x(e) : v(e)
277
- );
278
- },
279
- clear: () => {
280
- f(null), c(""), b(!1);
281
- },
282
- focus: () => {
283
- var e;
284
- return (e = _.current) == null ? void 0 : e.focus();
285
- }
286
- }),
287
- // The handle is reconstructed per render; consumers (the agent runtime)
288
- // re-register only when the identity changes, which is a cheap no-op.
289
- // eslint-disable-next-line react-hooks/exhaustive-deps
290
- [x, v]
291
- );
292
- ke(ze, be, a);
293
- const ge = T || r !== void 0 && i !== null && i <= r, he = T || u !== void 0 && i !== null && i >= u, Ne = i ?? void 0, ye = (p === "currency" || p === "percentage") && i !== null && i !== null ? B(i) : void 0, we = j.inputMode === "numeric" ? "[0-9]*" : void 0;
294
- return /* @__PURE__ */ Ie(
295
- "div",
296
- {
297
- className: je({
298
- size: g,
299
- tone: ue,
300
- className: M
301
- }),
302
- "data-component": "number-input",
303
- "data-component-id": a,
304
- "data-mode": p,
305
- children: [
306
- /* @__PURE__ */ F(
307
- "button",
308
- {
309
- type: "button",
310
- tabIndex: -1,
311
- "aria-label": H("inputs.number.decrement", "Decrement"),
312
- onClick: ve,
313
- onMouseDown: Q,
314
- disabled: ge,
315
- className: `${X} ds:ps-2 ds:pe-1`,
316
- children: /* @__PURE__ */ F(Te, { "aria-hidden": "true", className: "ds:size-4" })
317
- }
318
- ),
319
- /* @__PURE__ */ F(
320
- "input",
321
- {
322
- ref: ne,
323
- id: ee,
324
- type: "text",
325
- role: "spinbutton",
326
- inputMode: j.inputMode,
327
- pattern: we,
328
- autoComplete: "off",
329
- value: E,
330
- disabled: T,
331
- "aria-valuemin": r,
332
- "aria-valuemax": u,
333
- "aria-valuenow": Ne,
334
- "aria-valuetext": ye,
335
- "aria-invalid": G || void 0,
336
- "aria-required": D.required || void 0,
337
- "aria-describedby": D.describedBy || void 0,
338
- onBeforeInput: ce,
339
- onChange: de,
340
- onFocus: fe,
341
- onBlur: pe,
342
- onKeyDown: le,
343
- className: "ds:flex-1 ds:w-full ds:min-w-0 ds:bg-transparent ds:outline-none ds:ps-2 ds:pe-2 ds:text-start ds:tabular-nums ds:disabled:cursor-not-allowed",
344
- ...m
345
- }
346
- ),
347
- /* @__PURE__ */ F(
348
- "button",
349
- {
350
- type: "button",
351
- tabIndex: -1,
352
- "aria-label": H("inputs.number.increment", "Increment"),
353
- onClick: me,
354
- onMouseDown: Q,
355
- disabled: he,
356
- className: `${X} ds:ps-1 ds:pe-2`,
357
- children: /* @__PURE__ */ F(Pe, { "aria-hidden": "true", className: "ds:size-4" })
358
- }
359
- )
360
- ]
361
- }
362
- );
363
- }
364
- );
365
- Ke.displayName = "NumberInput";
366
- export {
367
- Ke as N,
368
- Ae as u
369
- };
370
- //# sourceMappingURL=number-input-DOe5VYei.js.map