@alfadocs/ui-kit 0.43.0 → 0.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 (129) hide show
  1. package/dist/_chunks/{alia-sidebar-BpX4z_af.js → alia-sidebar-Be8FhKYd.js} +332 -237
  2. package/dist/_chunks/{autocomplete-DIgdhCGJ.js → autocomplete-CDqxB68B.js} +2 -2
  3. package/dist/_chunks/bmi-calculator-CQqXTVNL.js +258 -0
  4. package/dist/_chunks/{booking-CtLwaxkK.js → booking-DlDVuWMd.js} +2 -2
  5. package/dist/_chunks/{calculator-dialog-DdexHrTP.js → calculator-dialog-D-nfvteH.js} +2 -2
  6. package/dist/_chunks/{cycle-calculator-Dln-y1k_.js → cycle-calculator-KxA8dqDf.js} +73 -54
  7. package/dist/_chunks/dialog-BTpZV6It.js +223 -0
  8. package/dist/_chunks/{due-date-calculator-Cc4dRqTI.js → due-date-calculator-mFxpHLml.js} +73 -49
  9. package/dist/_chunks/{editable-currency-cell-renderer-9jqwDv5x.js → editable-currency-cell-renderer-BEBUQl9P.js} +2 -2
  10. package/dist/_chunks/{freemium-paywall-BLXESpH4.js → freemium-paywall-BYist2sJ.js} +2 -2
  11. package/dist/_chunks/gestational-age-calculator-gWI_uRA1.js +203 -0
  12. package/dist/_chunks/insert-result-C5ABnzDl.js +711 -0
  13. package/dist/_chunks/{marketplace-app-shell-Dc5cTIt8.js → marketplace-app-shell-Gfsf78ge.js} +2 -2
  14. package/dist/_chunks/{patient-search-DPe2ZYEL.js → patient-search-CocVcGJ3.js} +2 -2
  15. package/dist/_chunks/{payment-form-BzVsG6Ks.js → payment-form-DqEiEJRO.js} +247 -195
  16. package/dist/_chunks/{pdf-viewer-B6MC6VTx.js → pdf-viewer-CWEXTlwq.js} +2 -2
  17. package/dist/_chunks/{practice-results-CrLpEiiW.js → practice-results-DDi-kvaD.js} +2 -2
  18. package/dist/_chunks/{pregnancy-weight-gain-zZL5Ir2-.js → pregnancy-weight-gain-BtEHaSqy.js} +78 -56
  19. package/dist/_chunks/{search-bar-CP6wUJFY.js → search-bar-CvN_S0jW.js} +2 -2
  20. package/dist/_chunks/{search-input-C1C3jQpD.js → search-input-D3aMvi4l.js} +2 -2
  21. package/dist/_chunks/{sign-document-B-3k_0LO.js → sign-document-BCyLpFHJ.js} +2 -2
  22. package/dist/_chunks/{sign-in-with-alfadocs-button-DeHBFRNS.js → sign-in-with-alfadocs-button-CuYn_kKP.js} +2 -2
  23. package/dist/_chunks/{social-sign-in-button-X54ySJr1.js → social-sign-in-button-uJYLM366.js} +2 -2
  24. package/dist/_chunks/{spinner-CCByyvcb.js → spinner-OjQNn8oN.js} +7 -3
  25. package/dist/_chunks/{transcript-panel-CR7VY1uw.js → transcript-panel-B4HiC7ed.js} +2 -2
  26. package/dist/_chunks/{unit-converter-CuXCXJhK.js → unit-converter-u3CwNDpP.js} +96 -74
  27. package/dist/_chunks/{wallet-pay-button-DK4ESYge.js → wallet-pay-button-DuDPBlCO.js} +2 -2
  28. package/dist/agent-catalog.json +1 -1
  29. package/dist/components/_shared/banded-gauge.d.ts +193 -0
  30. package/dist/components/_shared/index.d.ts +1 -1
  31. package/dist/components/_shared/insert-result.d.ts +173 -10
  32. package/dist/components/autocomplete/index.js +1 -1
  33. package/dist/components/bmi-calculator/bmi-calculator.d.ts +6 -0
  34. package/dist/components/bmi-calculator/index.js +1 -1
  35. package/dist/components/booking/index.js +1 -1
  36. package/dist/components/calculator-dialog/index.js +1 -1
  37. package/dist/components/cycle-calculator/cycle-calculator.d.ts +6 -0
  38. package/dist/components/cycle-calculator/index.js +1 -1
  39. package/dist/components/data-table/index.js +1 -1
  40. package/dist/components/dialog/dialog.d.ts +1 -0
  41. package/dist/components/dialog/index.js +1 -1
  42. package/dist/components/due-date-calculator/due-date-calculator.d.ts +6 -0
  43. package/dist/components/due-date-calculator/index.js +1 -1
  44. package/dist/components/freemium-paywall/index.js +1 -1
  45. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +6 -0
  46. package/dist/components/gestational-age-calculator/index.js +1 -1
  47. package/dist/components/index.d.ts +1 -1
  48. package/dist/components/patient-search/index.js +1 -1
  49. package/dist/components/payment-form/index.js +1 -1
  50. package/dist/components/payment-form/payment-form.d.ts +24 -2
  51. package/dist/components/pdf-viewer/index.js +1 -1
  52. package/dist/components/practice-results/index.js +1 -1
  53. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  54. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +6 -0
  55. package/dist/components/search-bar/index.js +1 -1
  56. package/dist/components/search-input/index.js +1 -1
  57. package/dist/components/sign-document/index.js +1 -1
  58. package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
  59. package/dist/components/social-sign-in-button/index.js +1 -1
  60. package/dist/components/spinner/index.js +1 -1
  61. package/dist/components/spinner/spinner.d.ts +2 -2
  62. package/dist/components/transcript-panel/index.js +1 -1
  63. package/dist/components/unit-converter/index.js +1 -1
  64. package/dist/components/unit-converter/unit-converter.d.ts +6 -0
  65. package/dist/components/wallet-pay-button/index.js +1 -1
  66. package/dist/i18n/locales/ar.d.ts +1 -1
  67. package/dist/i18n/locales/ar.js +1 -1
  68. package/dist/i18n/locales/de.d.ts +1 -1
  69. package/dist/i18n/locales/de.js +1 -1
  70. package/dist/i18n/locales/el.d.ts +1 -1
  71. package/dist/i18n/locales/el.js +1 -1
  72. package/dist/i18n/locales/en.d.ts +1 -1
  73. package/dist/i18n/locales/en.js +1 -1
  74. package/dist/i18n/locales/es.d.ts +1 -1
  75. package/dist/i18n/locales/es.js +1 -1
  76. package/dist/i18n/locales/fr.d.ts +1 -1
  77. package/dist/i18n/locales/fr.js +1 -1
  78. package/dist/i18n/locales/hi.d.ts +1 -1
  79. package/dist/i18n/locales/hi.js +1 -1
  80. package/dist/i18n/locales/it.d.ts +1 -1
  81. package/dist/i18n/locales/it.js +1 -1
  82. package/dist/i18n/locales/ja.d.ts +1 -1
  83. package/dist/i18n/locales/ja.js +1 -1
  84. package/dist/i18n/locales/nl.d.ts +1 -1
  85. package/dist/i18n/locales/nl.js +1 -1
  86. package/dist/i18n/locales/pl.d.ts +1 -1
  87. package/dist/i18n/locales/pl.js +1 -1
  88. package/dist/i18n/locales/pt.d.ts +1 -1
  89. package/dist/i18n/locales/pt.js +1 -1
  90. package/dist/i18n/locales/ro.d.ts +1 -1
  91. package/dist/i18n/locales/ro.js +1 -1
  92. package/dist/i18n/locales/ru.d.ts +1 -1
  93. package/dist/i18n/locales/ru.js +1 -1
  94. package/dist/i18n/locales/sq.d.ts +1 -1
  95. package/dist/i18n/locales/sq.js +1 -1
  96. package/dist/i18n/locales/sv.d.ts +1 -1
  97. package/dist/i18n/locales/sv.js +1 -1
  98. package/dist/i18n/locales/tr.d.ts +1 -1
  99. package/dist/i18n/locales/tr.js +1 -1
  100. package/dist/i18n/locales/zh.d.ts +1 -1
  101. package/dist/i18n/locales/zh.js +1 -1
  102. package/dist/index.js +497 -496
  103. package/dist/locales/ar.json +1 -1
  104. package/dist/locales/de.json +1 -1
  105. package/dist/locales/el.json +1 -1
  106. package/dist/locales/en.json +1 -1
  107. package/dist/locales/es.json +1 -1
  108. package/dist/locales/fr.json +1 -1
  109. package/dist/locales/hi.json +1 -1
  110. package/dist/locales/it.json +1 -1
  111. package/dist/locales/ja.json +1 -1
  112. package/dist/locales/nl.json +1 -1
  113. package/dist/locales/pl.json +1 -1
  114. package/dist/locales/pt.json +1 -1
  115. package/dist/locales/ro.json +1 -1
  116. package/dist/locales/ru.json +1 -1
  117. package/dist/locales/sq.json +1 -1
  118. package/dist/locales/sv.json +1 -1
  119. package/dist/locales/tr.json +1 -1
  120. package/dist/locales/zh.json +1 -1
  121. package/dist/patterns/alia-assistant/alia-types.d.ts +20 -0
  122. package/dist/patterns/alia-assistant/index.js +1 -1
  123. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  124. package/dist/tokens.css +1 -1
  125. package/package.json +1 -1
  126. package/dist/_chunks/bmi-calculator-DuVSFDuw.js +0 -259
  127. package/dist/_chunks/dialog-DOYgd75U.js +0 -224
  128. package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js +0 -179
  129. package/dist/_chunks/insert-result-DisOY2G-.js +0 -243
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "0.43.0",
3
+ "version": "0.45.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",
@@ -1,259 +0,0 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as q, useId as J, useState as c, useMemo as Q, useEffect as k } from "react";
3
- import { c as K } from "./index-D2ZczOXr.js";
4
- import { useTranslation as X } from "react-i18next";
5
- import { R as E } from "./radio-TWf9Q-mp.js";
6
- import { R as Z } from "./radio-group-CLjK-SlK.js";
7
- import { F as S } from "./form-field-BOm9hK35.js";
8
- import { N as C } from "./number-input-Dj5L3pXK.js";
9
- import { C as ee } from "./chart-Cg3e9EH9.js";
10
- import { C as H } from "./card-DPmk26CL.js";
11
- import { B as te } from "./badge-zsf5i5bH.js";
12
- import { I as ae } from "./insert-result-DisOY2G-.js";
13
- import { a as le, b as ie, e as re, c as oe, f as L, l as V, k as ne } from "./bmi-BxD-tFzU.js";
14
- const se = K("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
15
- variants: {
16
- width: {
17
- full: "ds:w-full",
18
- auto: "ds:inline-flex"
19
- }
20
- },
21
- defaultVariants: { width: "full" }
22
- }), ce = {
23
- underweight: "info",
24
- normal: "success",
25
- overweight: "warning",
26
- obese: "error"
27
- }, me = K("", {
28
- variants: {
29
- category: {
30
- underweight: "--info",
31
- normal: "--success",
32
- overweight: "--warning",
33
- obese: "--destructive"
34
- }
35
- }
36
- }), ue = "--color-orange-600";
37
- function de(i) {
38
- if (typeof document > "u") return;
39
- const r = document.documentElement, o = getComputedStyle(r), n = i === "overweight" && r.classList.contains("theme-light") && !r.classList.contains("theme-accessible") ? ue : me({ category: i });
40
- return o.getPropertyValue(n).trim() || void 0;
41
- }
42
- function ge(i) {
43
- const [r, o] = c(void 0);
44
- return k(() => {
45
- if (i === null) {
46
- o(void 0);
47
- return;
48
- }
49
- const n = () => o(de(i));
50
- if (n(), typeof document > "u") return;
51
- const f = new MutationObserver(n);
52
- return f.observe(document.documentElement, {
53
- attributes: !0,
54
- attributeFilter: ["class"]
55
- }), () => f.disconnect();
56
- }, [i]), r;
57
- }
58
- const y = (i) => Math.round(i * 10) / 10, be = q(
59
- ({
60
- defaultUnitSystem: i = "metric",
61
- onResultChange: r,
62
- onInsert: o,
63
- insertVariant: n = "insert",
64
- onCopy: f,
65
- onError: A,
66
- id: M,
67
- width: O,
68
- className: W
69
- }, D) => {
70
- const { t: e, i18n: w } = X(), N = J(), [m, _] = c(i), [h, F] = c(null), [p, I] = c(null), [u, $] = c(null), [d, B] = c(null), [g, T] = c(null), j = (R) => {
71
- const x = R;
72
- if (x !== m) {
73
- if (x === "imperial") {
74
- if (h !== null) {
75
- const { ft: U, in: Y } = oe(h);
76
- $(U), B(y(Y));
77
- }
78
- p !== null && T(y(ne(p)));
79
- } else
80
- (u !== null || d !== null) && F(y(L(u ?? 0, d ?? 0))), g !== null && I(y(V(g)));
81
- _(x);
82
- }
83
- }, z = m === "metric" ? h : u !== null || d !== null ? L(u ?? 0, d ?? 0) : null, P = m === "metric" ? p : g !== null ? V(g) : null, l = re(P, z), a = l !== null ? ie(l) : null, G = ge(a), v = Q(
84
- () => new Intl.NumberFormat(w.language, {
85
- minimumFractionDigits: 1,
86
- maximumFractionDigits: 1
87
- }),
88
- [w.language]
89
- );
90
- k(() => {
91
- r == null || r(
92
- l !== null && a !== null ? { bmi: l, category: a } : null
93
- );
94
- }, [l, a, r]);
95
- const b = m === "metric";
96
- return /* @__PURE__ */ s(
97
- "div",
98
- {
99
- ref: D,
100
- "data-component": "bmi-calculator",
101
- "data-component-id": M,
102
- className: se({ width: O, className: W }),
103
- children: [
104
- /* @__PURE__ */ s(
105
- Z,
106
- {
107
- label: e("bmiCalculator.unitSystem.label"),
108
- variant: "horizontal",
109
- value: m,
110
- onValueChange: j,
111
- children: [
112
- /* @__PURE__ */ t(E, { label: e("bmiCalculator.unitSystem.metric"), value: "metric" }),
113
- /* @__PURE__ */ t(
114
- E,
115
- {
116
- label: e("bmiCalculator.unitSystem.imperial"),
117
- value: "imperial"
118
- }
119
- )
120
- ]
121
- }
122
- ),
123
- /* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
124
- b ? /* @__PURE__ */ t(
125
- S,
126
- {
127
- label: `${e("bmiCalculator.height")} (${e("bmiCalculator.units.cm")})`,
128
- children: /* @__PURE__ */ t(
129
- C,
130
- {
131
- mode: "decimal",
132
- min: 0,
133
- step: 0.5,
134
- value: h,
135
- onChange: F
136
- }
137
- )
138
- }
139
- ) : /* @__PURE__ */ s("div", { role: "group", "aria-labelledby": N, children: [
140
- /* @__PURE__ */ t(
141
- "span",
142
- {
143
- id: N,
144
- className: "type-label ds:mb-[var(--spacing-xs)] ds:block ds:text-foreground",
145
- children: e("bmiCalculator.height")
146
- }
147
- ),
148
- /* @__PURE__ */ s("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
149
- /* @__PURE__ */ t(
150
- C,
151
- {
152
- mode: "integer",
153
- min: 0,
154
- value: u,
155
- onChange: $,
156
- "aria-label": e("bmiCalculator.feet")
157
- }
158
- ),
159
- /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("bmiCalculator.units.ft") }),
160
- /* @__PURE__ */ t(
161
- C,
162
- {
163
- mode: "decimal",
164
- min: 0,
165
- max: 11.9,
166
- step: 0.5,
167
- value: d,
168
- onChange: B,
169
- "aria-label": e("bmiCalculator.inches")
170
- }
171
- ),
172
- /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("bmiCalculator.units.in") })
173
- ] })
174
- ] }),
175
- /* @__PURE__ */ t(
176
- S,
177
- {
178
- label: `${e("bmiCalculator.weight")} (${e(
179
- b ? "bmiCalculator.units.kg" : "bmiCalculator.units.lb"
180
- )})`,
181
- children: /* @__PURE__ */ t(
182
- C,
183
- {
184
- mode: "decimal",
185
- min: 0,
186
- step: b ? 0.1 : 0.5,
187
- value: b ? p : g,
188
- onChange: b ? I : T
189
- }
190
- )
191
- }
192
- )
193
- ] }),
194
- /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: l !== null && a !== null ? e("bmiCalculator.gaugeAria", {
195
- bmi: v.format(l),
196
- category: e(`bmiCalculator.category.${a}`)
197
- }) : "" }),
198
- l !== null && a !== null ? /* @__PURE__ */ t(H, { variant: "elevated", children: /* @__PURE__ */ s(H.Body, { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-md)]", children: [
199
- /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center", children: [
200
- /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("bmiCalculator.category.label") }),
201
- /* @__PURE__ */ t(te, { variant: ce[a], size: "lg", children: e(`bmiCalculator.category.${a}`) }),
202
- /* @__PURE__ */ t("p", { className: "type-body ds:text-muted-foreground", children: e(`bmiCalculator.range.${a}`) })
203
- ] }),
204
- /* @__PURE__ */ t(
205
- "div",
206
- {
207
- "data-bmi-category": a,
208
- className: "ds:w-[240px] ds:max-w-full",
209
- children: /* @__PURE__ */ t(
210
- ee,
211
- {
212
- type: "radialBar",
213
- title: e("bmiCalculator.gaugeAria", {
214
- bmi: v.format(l),
215
- category: e(`bmiCalculator.category.${a}`)
216
- }),
217
- series: [le(l)],
218
- labels: [e(`bmiCalculator.category.${a}`)],
219
- colors: G ? [G] : void 0,
220
- radialValueFormatter: () => v.format(l),
221
- height: 240
222
- }
223
- )
224
- }
225
- ),
226
- n === "copy" || o ? /* @__PURE__ */ t(
227
- ae,
228
- {
229
- onInsert: o,
230
- variant: n,
231
- onCopy: f,
232
- onError: A,
233
- card: {
234
- title: e("insert.title.bmi"),
235
- highlight: e(`bmiCalculator.category.${a}`),
236
- fields: [
237
- {
238
- label: e("insert.title.bmi"),
239
- value: v.format(l)
240
- },
241
- {
242
- label: e("bmiCalculator.category.label"),
243
- value: e(`bmiCalculator.category.${a}`)
244
- }
245
- ]
246
- }
247
- }
248
- ) : null
249
- ] }) }) : /* @__PURE__ */ t("p", { className: "type-body ds:text-muted-foreground", children: e("bmiCalculator.empty") })
250
- ]
251
- }
252
- );
253
- }
254
- );
255
- be.displayName = "BmiCalculator";
256
- export {
257
- be as B
258
- };
259
- //# sourceMappingURL=bmi-calculator-DuVSFDuw.js.map
@@ -1,224 +0,0 @@
1
- import { jsx as s, jsxs as v } from "react/jsx-runtime";
2
- import { useRef as R, useEffect as T, useMemo as O, forwardRef as d, useContext as j, createContext as E } from "react";
3
- import * as t from "@radix-ui/react-dialog";
4
- import { c as _ } from "./index-D2ZczOXr.js";
5
- import { useTranslation as k } from "react-i18next";
6
- import { I as z } from "./icon-button-CKEOrN37.js";
7
- import { u as I } from "./use-controllable-state-BiY4xTzM.js";
8
- import { u as B } from "./registry-nPAVE19X.js";
9
- import { X as S } from "./x-CCcI3eJp.js";
10
- const A = {
11
- id: "dialog",
12
- capabilities: ["open", "close", "dismiss"],
13
- state: {
14
- isOpen: {
15
- type: "boolean",
16
- description: "True when the dialog is currently open.",
17
- read: (o) => o.getIsOpen()
18
- }
19
- },
20
- actions: {
21
- open: {
22
- safety: "read",
23
- description: "Open the dialog.",
24
- invoke: (o) => {
25
- o.open();
26
- }
27
- },
28
- close: {
29
- safety: "write",
30
- description: "Close the dialog. Reversible by reopening.",
31
- invoke: (o) => {
32
- o.close();
33
- }
34
- },
35
- dismiss: {
36
- safety: "destructive",
37
- description: "Dismiss the dialog. Loses any in-progress input that has not been committed.",
38
- invoke: (o) => {
39
- o.close();
40
- }
41
- }
42
- },
43
- domHooks: {
44
- root: { attr: "data-component", value: "dialog" },
45
- instanceId: {
46
- attr: "data-component-id",
47
- sourceProp: "id",
48
- description: "Sourced from the id prop on Dialog.Root."
49
- }
50
- }
51
- }, H = [
52
- "ds-dialog__backdrop",
53
- "ds:backdrop-blur-sm",
54
- "ds:data-[state=open]:animate-in ds:data-[state=open]:fade-in-0",
55
- "ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0",
56
- "ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
57
- ].join(" "), V = [
58
- "ds-dialog",
59
- "ds:fixed ds:z-[var(--z-modal)]",
60
- "ds:bg-[var(--popover)] ds:text-[var(--popover-foreground)]",
61
- "ds:shadow-[var(--shadow-xl)]",
62
- "ds:p-[var(--spacing-lg)]",
63
- "ds:focus-visible:outline-none",
64
- "ds:data-[state=open]:animate-in ds:data-[state=open]:fade-in-0 ds:data-[state=open]:zoom-in-95",
65
- "ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=closed]:zoom-out-95",
66
- "ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
67
- ].join(" "), g = "ds:start-1/2 ds:top-1/2 ds:-translate-x-1/2 ds:-translate-y-1/2 ds:w-[calc(100%-var(--spacing-lg)*2)]", F = _(V, {
68
- variants: {
69
- size: {
70
- sm: `${g} ds:max-w-[448px] ds:rounded-[var(--radius-lg)] ds:overflow-y-auto ds:max-h-[85dvh]`,
71
- md: `${g} ds:max-w-[560px] ds:rounded-[var(--radius-lg)] ds:overflow-y-auto ds:max-h-[85dvh]`,
72
- lg: `${g} ds:max-w-[720px] ds:rounded-[var(--radius-lg)] ds:overflow-y-auto ds:max-h-[85dvh]`,
73
- fullscreen: "ds:start-0 ds:top-0 ds:w-[100dvw] ds:h-[100dvh] ds:max-w-none ds:rounded-none ds:overflow-y-auto"
74
- }
75
- },
76
- defaultVariants: { size: "md" }
77
- }), f = E(void 0), u = ({
78
- children: o,
79
- id: e,
80
- open: a,
81
- defaultOpen: r,
82
- onOpenChange: c,
83
- ...p
84
- }) => {
85
- const [m, n] = I({
86
- value: a,
87
- defaultValue: r ?? !1,
88
- onChange: c
89
- }), i = m ?? !1, l = R(i);
90
- T(() => {
91
- l.current = i;
92
- }, [i]);
93
- const N = O(
94
- () => ({
95
- getIsOpen: () => l.current,
96
- open: () => n(!0),
97
- close: () => n(!1)
98
- }),
99
- [n]
100
- );
101
- return B(A, N, e), /* @__PURE__ */ s(f.Provider, { value: e, children: /* @__PURE__ */ s(t.Root, { open: i, onOpenChange: n, ...p, children: o }) });
102
- };
103
- u.displayName = "Dialog.Root";
104
- const h = d(({ children: o, ...e }, a) => /* @__PURE__ */ s(t.Trigger, { ref: a, ...e, children: o }));
105
- h.displayName = "Dialog.Trigger";
106
- const x = d(({ children: o, ...e }, a) => /* @__PURE__ */ s(t.Close, { ref: a, ...e, children: o }));
107
- x.displayName = "Dialog.Close";
108
- const D = d(
109
- ({
110
- size: o = "md",
111
- variant: e = "default",
112
- hideCloseButton: a = !0,
113
- className: r,
114
- children: c,
115
- ...p
116
- }, m) => {
117
- const { t: n } = k(), i = j(f), l = e === "alert" ? { role: "alertdialog" } : {};
118
- return /* @__PURE__ */ v(t.Portal, { children: [
119
- /* @__PURE__ */ s(
120
- t.Overlay,
121
- {
122
- "data-component": "dialog-overlay",
123
- className: H
124
- }
125
- ),
126
- /* @__PURE__ */ v(
127
- t.Content,
128
- {
129
- ref: m,
130
- ...l,
131
- "data-component": "dialog",
132
- "data-component-id": i,
133
- className: F({ size: o, className: r }),
134
- ...p,
135
- children: [
136
- c,
137
- !a && // Positioning wrapper. The interactive close is an IconButton
138
- // (ghost / sm) — same lucide `X` glyph, 32px target, 16px icon,
139
- // hover wash and focus ring that the vanilla `.ds-dialog__close`
140
- // contract reproduces from the same tokens, so the React and
141
- // non-React close buttons render identically.
142
- /* @__PURE__ */ s("div", { className: "ds:absolute ds:end-[var(--spacing-md)] ds:top-[var(--spacing-md)]", children: /* @__PURE__ */ s(t.Close, { asChild: !0, children: /* @__PURE__ */ s(
143
- z,
144
- {
145
- icon: /* @__PURE__ */ s(S, {}),
146
- intent: "ghost",
147
- size: "sm",
148
- "aria-label": n("common.close", "Close")
149
- }
150
- ) }) })
151
- ]
152
- }
153
- )
154
- ] });
155
- }
156
- );
157
- D.displayName = "Dialog.Content";
158
- const y = d(
159
- ({ className: o, ...e }, a) => /* @__PURE__ */ s(
160
- "div",
161
- {
162
- ref: a,
163
- className: [
164
- // `ds-dialog__header` is the shared vanilla contract (src/styles.css);
165
- // the Tailwind utilities reproduce it for hosts that render through
166
- // this component, keeping the two surfaces identical.
167
- "ds-dialog__header",
168
- "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:pe-[var(--spacing-xl)]",
169
- o
170
- ].filter(Boolean).join(" "),
171
- ...e
172
- }
173
- )
174
- );
175
- y.displayName = "Dialog.Header";
176
- const C = d(({ className: o, ...e }, a) => /* @__PURE__ */ s(
177
- t.Title,
178
- {
179
- ref: a,
180
- className: ["ds-dialog__title type-title-card ds:break-words", o].filter(Boolean).join(" "),
181
- ...e
182
- }
183
- ));
184
- C.displayName = "Dialog.Title";
185
- const b = d(({ className: o, ...e }, a) => /* @__PURE__ */ s(
186
- t.Description,
187
- {
188
- ref: a,
189
- className: ["type-body-sm ds:text-[var(--muted-foreground)]", o].filter(Boolean).join(" "),
190
- ...e
191
- }
192
- ));
193
- b.displayName = "Dialog.Description";
194
- const w = d(
195
- ({ className: o, divider: e = !1, ...a }, r) => /* @__PURE__ */ s(
196
- "div",
197
- {
198
- ref: r,
199
- className: [
200
- "ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-sm)]",
201
- "ds:mt-[var(--spacing-md)]",
202
- e && "ds:border-t ds:border-[color:var(--border)] ds:pt-[var(--spacing-md)]",
203
- o
204
- ].filter(Boolean).join(" "),
205
- ...a
206
- }
207
- )
208
- );
209
- w.displayName = "Dialog.Footer";
210
- const J = Object.assign(u, {
211
- Root: u,
212
- Trigger: h,
213
- Content: D,
214
- Header: y,
215
- Title: C,
216
- Description: b,
217
- Footer: w,
218
- Close: x
219
- });
220
- export {
221
- J as D,
222
- A as d
223
- };
224
- //# sourceMappingURL=dialog-DOYgd75U.js.map
@@ -1,179 +0,0 @@
1
- import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as T, useState as f, useMemo as m, useEffect as S } from "react";
3
- import { c as k } from "./index-D2ZczOXr.js";
4
- import { useTranslation as B } from "react-i18next";
5
- import { R as h } from "./radio-TWf9Q-mp.js";
6
- import { R as E } from "./radio-group-CLjK-SlK.js";
7
- import { F } from "./form-field-BOm9hK35.js";
8
- import { D as I } from "./date-picker-Bq7xhMA-.js";
9
- import { C as x } from "./card-DPmk26CL.js";
10
- import { B as A } from "./badge-zsf5i5bH.js";
11
- import { I as M } from "./insert-result-DisOY2G-.js";
12
- import { c as j, g as R, G as z } from "./gestation-mWF4AXea.js";
13
- import { s as V } from "./subDays-Dv7q9S7u.js";
14
- import { i as _ } from "./date-picker-variants-DLi1Va_e.js";
15
- const O = k("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
16
- variants: {
17
- width: { full: "ds:w-full", auto: "ds:inline-flex" }
18
- },
19
- defaultVariants: { width: "full" }
20
- }), P = {
21
- preconception: "neutral",
22
- first: "info",
23
- second: "success",
24
- third: "warning",
25
- postterm: "error"
26
- }, Y = T(
27
- ({
28
- defaultMethod: v = "lmp",
29
- onResultChange: d,
30
- onInsert: g,
31
- insertVariant: u = "insert",
32
- onCopy: y,
33
- onError: b,
34
- id: C,
35
- width: N,
36
- className: D
37
- }, w) => {
38
- const { t: e, i18n: p } = B(), [o, $] = f(v), [i, G] = f(void 0), n = m(() => /* @__PURE__ */ new Date(), []), t = m(() => {
39
- if (!i) return null;
40
- const l = o === "lmp" ? i : V(i, z), r = j({ method: "lmp", date: l }, n);
41
- return {
42
- result: {
43
- gestationalAge: r.gestationalAge,
44
- trimester: r.trimester,
45
- dueDate: r.dueDate
46
- },
47
- milestones: R(r.gestationalStart)
48
- };
49
- }, [o, i, n]), L = m(
50
- () => new Intl.DateTimeFormat(p.language, { dateStyle: "medium" }),
51
- [p.language]
52
- );
53
- S(() => {
54
- d == null || d((t == null ? void 0 : t.result) ?? null);
55
- }, [t, d]);
56
- const c = (l) => l ? e("gestationalAgeCalculator.gestation", {
57
- weeks: l.weeks,
58
- days: l.days
59
- }) : "—";
60
- return /* @__PURE__ */ s(
61
- "div",
62
- {
63
- ref: w,
64
- "data-component": "gestational-age-calculator",
65
- "data-component-id": C,
66
- className: O({ width: N, className: D }),
67
- children: [
68
- /* @__PURE__ */ s(
69
- E,
70
- {
71
- label: e("gestationalAgeCalculator.method.label"),
72
- variant: "horizontal",
73
- value: o,
74
- onValueChange: (l) => $(l),
75
- children: [
76
- /* @__PURE__ */ a(h, { label: e("gestationalAgeCalculator.method.lmp"), value: "lmp" }),
77
- /* @__PURE__ */ a(h, { label: e("gestationalAgeCalculator.method.edd"), value: "edd" })
78
- ]
79
- }
80
- ),
81
- /* @__PURE__ */ a(
82
- F,
83
- {
84
- label: e(
85
- o === "lmp" ? "gestationalAgeCalculator.lmpDate" : "gestationalAgeCalculator.eddDate"
86
- ),
87
- children: /* @__PURE__ */ a(
88
- I,
89
- {
90
- value: i,
91
- onChange: G,
92
- maxDate: o === "lmp" ? n : void 0
93
- }
94
- )
95
- }
96
- ),
97
- /* @__PURE__ */ a("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: t ? `${e("gestationalAgeCalculator.gestationLabel")}: ${c(
98
- t.result.gestationalAge
99
- )}. ${e("gestationalAgeCalculator.trimesterLabel")}: ${e(
100
- `gestationalAgeCalculator.trimester.${t.result.trimester}`
101
- )}.` : "" }),
102
- t ? /* @__PURE__ */ a(x, { variant: "elevated", children: /* @__PURE__ */ s(x.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
103
- /* @__PURE__ */ s("dl", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
104
- /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]", children: [
105
- /* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("gestationalAgeCalculator.trimesterLabel") }),
106
- /* @__PURE__ */ a("dd", { children: /* @__PURE__ */ a(
107
- A,
108
- {
109
- variant: P[t.result.trimester],
110
- size: "lg",
111
- children: e(
112
- `gestationalAgeCalculator.trimester.${t.result.trimester}`
113
- )
114
- }
115
- ) })
116
- ] }),
117
- /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-end ds:gap-[var(--spacing-xs)] ds:text-end", children: [
118
- /* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("gestationalAgeCalculator.gestationLabel") }),
119
- /* @__PURE__ */ a("dd", { className: "type-metric ds:text-foreground", children: c(t.result.gestationalAge) })
120
- ] })
121
- ] }),
122
- /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
123
- /* @__PURE__ */ a("span", { className: "type-label ds:text-muted-foreground", children: e("gestationalAgeCalculator.milestonesLabel") }),
124
- /* @__PURE__ */ a("ul", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: t.milestones.map((l) => {
125
- const r = _(n, l.date);
126
- return /* @__PURE__ */ s(
127
- "li",
128
- {
129
- className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)]",
130
- children: [
131
- /* @__PURE__ */ a("span", { className: "type-body ds:text-foreground", children: e(`gestationalAgeCalculator.milestone.${l.key}`) }),
132
- /* @__PURE__ */ s("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
133
- /* @__PURE__ */ a("span", { className: "type-body ds:text-muted-foreground", children: L.format(l.date) }),
134
- r ? /* @__PURE__ */ a(A, { variant: "success", children: e("gestationalAgeCalculator.reached") }) : null
135
- ] })
136
- ]
137
- },
138
- l.key
139
- );
140
- }) })
141
- ] }),
142
- u === "copy" || g ? /* @__PURE__ */ a(
143
- M,
144
- {
145
- onInsert: g,
146
- variant: u,
147
- onCopy: y,
148
- onError: b,
149
- card: {
150
- title: e("insert.title.gestationalAge"),
151
- highlight: e(
152
- `gestationalAgeCalculator.trimester.${t.result.trimester}`
153
- ),
154
- fields: [
155
- {
156
- label: e("gestationalAgeCalculator.gestationLabel"),
157
- value: c(t.result.gestationalAge)
158
- },
159
- {
160
- label: e("gestationalAgeCalculator.trimesterLabel"),
161
- value: e(
162
- `gestationalAgeCalculator.trimester.${t.result.trimester}`
163
- )
164
- }
165
- ]
166
- }
167
- }
168
- ) : null
169
- ] }) }) : /* @__PURE__ */ a("p", { className: "type-body ds:text-muted-foreground", children: e("gestationalAgeCalculator.empty") })
170
- ]
171
- }
172
- );
173
- }
174
- );
175
- Y.displayName = "GestationalAgeCalculator";
176
- export {
177
- Y as G
178
- };
179
- //# sourceMappingURL=gestational-age-calculator-ZMSrzkRW.js.map