@alfadocs/ui-kit 0.42.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/_chunks/{ar-Cn_NxqkN.js → ar-DEz65ZJW.js} +2 -2
  2. package/dist/_chunks/bmi-calculator-DFPWL2OJ.js +273 -0
  3. package/dist/_chunks/{booking-4mCw3Mpl.js → booking-CtLwaxkK.js} +4 -4
  4. package/dist/_chunks/{calculator-dialog-B74fqpFZ.js → calculator-dialog-D-nfvteH.js} +2 -2
  5. package/dist/_chunks/{chart-Cbt0_sKv.js → chart-Cg3e9EH9.js} +101 -99
  6. package/dist/_chunks/{cycle-calculator-DsZbyzX6.js → cycle-calculator-ChHBcjet.js} +65 -56
  7. package/dist/_chunks/{date-picker-CvQfs6Xh.js → date-picker-Bq7xhMA-.js} +109 -108
  8. package/dist/_chunks/date-picker-variants-DLi1Va_e.js +3238 -0
  9. package/dist/_chunks/{date-range-picker-U9fn1g9d.js → date-range-picker-DcXuI9y7.js} +20 -19
  10. package/dist/_chunks/{date-time-picker-Cva0ZCWw.js → date-time-picker-RimumeLR.js} +18 -17
  11. package/dist/_chunks/{de-BMM2H7Bs.js → de-bTBGdjPS.js} +2 -2
  12. package/dist/_chunks/dialog-BTpZV6It.js +223 -0
  13. package/dist/_chunks/{due-date-calculator-s_CBgaFs.js → due-date-calculator-CYXKLoof.js} +65 -45
  14. package/dist/_chunks/{editable-currency-cell-renderer-BhUkRiPZ.js → editable-currency-cell-renderer-9jqwDv5x.js} +2 -2
  15. package/dist/_chunks/{el-BYPonAaK.js → el-BWG5RXxa.js} +6 -6
  16. package/dist/_chunks/{es-CMkVCQ4F.js → es-DfO_G435.js} +2 -2
  17. package/dist/_chunks/{fr-BcuWxqft.js → fr-BTn24bs8.js} +2 -2
  18. package/dist/_chunks/{gestation-BXEgDGmP.js → gestation-mWF4AXea.js} +3 -3
  19. package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js +190 -0
  20. package/dist/_chunks/{header-CTZWX-tm.js → header-Ce1Br27u.js} +70 -75
  21. package/dist/_chunks/{hi-wkq_rQAh.js → hi-Dj3oYd84.js} +2 -2
  22. package/dist/_chunks/insert-result-CoC1oo6R.js +334 -0
  23. package/dist/_chunks/{isSameWeek-Bim5ftRd.js → isSameWeek-HfxKk6Lz.js} +2 -2
  24. package/dist/_chunks/{it-GiQrQ9p4.js → it-Y85ofIQQ.js} +7 -7
  25. package/dist/_chunks/{ja-qfYg3Rua.js → ja-CQ7J6YoA.js} +2 -2
  26. package/dist/_chunks/{marketplace-app-shell-kVAVycz_.js → marketplace-app-shell-Dc5cTIt8.js} +186 -149
  27. package/dist/_chunks/{nl-xOogO4sZ.js → nl-D9kHCmp3.js} +2 -2
  28. package/dist/_chunks/{patient-shell-lDX3wwu6.js → patient-shell-CnT4L8gn.js} +2 -2
  29. package/dist/_chunks/{pl-GnOW6eGK.js → pl-B3Smqpkr.js} +3 -3
  30. package/dist/_chunks/{pregnancy-weight-gain-B7kBK-ZR.js → pregnancy-weight-gain-C5YhfYnL.js} +60 -50
  31. package/dist/_chunks/{pt-_bV5b5RW.js → pt-D3J-1c_7.js} +6 -6
  32. package/dist/_chunks/{ro-BEcyh5Nj.js → ro-BKAbbEA3.js} +2 -2
  33. package/dist/_chunks/{ru-Bi86hqMf.js → ru-BeG8f0Ep.js} +3 -3
  34. package/dist/_chunks/{sign-document-QHfcNKFj.js → sign-document-B-3k_0LO.js} +165 -137
  35. package/dist/_chunks/{sq-BujHSAWu.js → sq-_hRPaeUy.js} +6 -6
  36. package/dist/_chunks/subDays-Dv7q9S7u.js +8 -0
  37. package/dist/_chunks/{sv-C8AeDrTA.js → sv-g009fSpe.js} +2 -2
  38. package/dist/_chunks/{tab-bar-C4II-7ej.js → tab-bar-Xetknddo.js} +53 -34
  39. package/dist/_chunks/{tr-CMSs_Vgf.js → tr-OKUOuhMW.js} +2 -2
  40. package/dist/_chunks/{unit-converter-D1UrEUxa.js → unit-converter-Ds9jalbN.js} +78 -67
  41. package/dist/_chunks/{zh-CN-eXB-PFu4.js → zh-CN-De4zwEhx.js} +3 -3
  42. package/dist/agent-catalog.json +1 -1
  43. package/dist/components/_shared/calendar-class-names.d.ts +8 -0
  44. package/dist/components/_shared/index.d.ts +2 -0
  45. package/dist/components/_shared/insert-result.d.ts +149 -4
  46. package/dist/components/badge/badge.d.ts +1 -1
  47. package/dist/components/bmi-calculator/bmi-calculator.d.ts +6 -0
  48. package/dist/components/bmi-calculator/index.js +1 -1
  49. package/dist/components/booking/index.js +1 -1
  50. package/dist/components/calculator-dialog/index.js +1 -1
  51. package/dist/components/card/card.d.ts +1 -1
  52. package/dist/components/chart/chart.d.ts +10 -0
  53. package/dist/components/chart/index.js +1 -1
  54. package/dist/components/cycle-calculator/cycle-calculator.d.ts +6 -0
  55. package/dist/components/cycle-calculator/index.js +1 -1
  56. package/dist/components/data-table/index.js +1 -1
  57. package/dist/components/date-picker/date-picker.d.ts +0 -1
  58. package/dist/components/date-picker/index.js +1 -1
  59. package/dist/components/date-range-picker/date-range-picker.d.ts +0 -1
  60. package/dist/components/date-range-picker/index.js +1 -1
  61. package/dist/components/date-time-picker/date-time-picker.d.ts +0 -1
  62. package/dist/components/date-time-picker/index.js +1 -1
  63. package/dist/components/dialog/dialog.d.ts +1 -0
  64. package/dist/components/dialog/index.js +1 -1
  65. package/dist/components/due-date-calculator/due-date-calculator.d.ts +6 -0
  66. package/dist/components/due-date-calculator/index.js +2 -2
  67. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +6 -0
  68. package/dist/components/gestational-age-calculator/index.js +1 -1
  69. package/dist/components/header/header.d.ts +8 -0
  70. package/dist/components/header/index.js +1 -1
  71. package/dist/components/index.d.ts +1 -1
  72. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  73. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +6 -0
  74. package/dist/components/public-header/public-header.d.ts +1 -1
  75. package/dist/components/sign-document/index.js +1 -1
  76. package/dist/components/sign-document/sign-document.d.ts +12 -0
  77. package/dist/components/stat/stat.d.ts +1 -1
  78. package/dist/components/tab-bar/index.d.ts +1 -1
  79. package/dist/components/tab-bar/index.js +1 -1
  80. package/dist/components/tab-bar/tab-bar.d.ts +44 -1
  81. package/dist/components/unit-converter/index.js +1 -1
  82. package/dist/components/unit-converter/unit-converter.d.ts +6 -0
  83. package/dist/index.js +504 -502
  84. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  85. package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +57 -1
  86. package/dist/patterns/patient-shell/index.js +1 -1
  87. package/dist/tokens.css +1411 -2
  88. package/package.json +1 -1
  89. package/dist/_chunks/bmi-calculator-D4juUcyF.js +0 -219
  90. package/dist/_chunks/dialog-Cee13rHU.js +0 -215
  91. package/dist/_chunks/gestational-age-calculator-CWOG3bkI.js +0 -178
  92. package/dist/_chunks/insert-result-DtQQeSSf.js +0 -227
  93. package/dist/_chunks/react-day-picker-CdtIiKjx.js +0 -3174
  94. package/dist/_chunks/subDays-_T9YeKPX.js +0 -8
@@ -1,67 +1,75 @@
1
1
  import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as B, useState as i, useMemo as g, useEffect as _ } from "react";
3
- import { c as I } from "./index-D2ZczOXr.js";
4
- import { useTranslation as S } from "react-i18next";
2
+ import { forwardRef as F, useState as c, useMemo as g, useEffect as G } from "react";
3
+ import { c as H } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as R } from "react-i18next";
5
5
  import { R as s } from "./radio-TWf9Q-mp.js";
6
6
  import { R as h } from "./radio-group-CLjK-SlK.js";
7
7
  import { F as v } from "./form-field-BOm9hK35.js";
8
- import { D as z } from "./date-picker-CvQfs6Xh.js";
9
- import { N as G } from "./number-input-Dj5L3pXK.js";
10
- import { B as M } from "./badge-zsf5i5bH.js";
11
- import { I as R } from "./insert-result-DtQQeSSf.js";
12
- import { D as b, c as V } from "./gestation-BXEgDGmP.js";
13
- const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
8
+ import { D as S } from "./date-picker-Bq7xhMA-.js";
9
+ import { N as M } from "./number-input-Dj5L3pXK.js";
10
+ import { C as b } from "./card-DPmk26CL.js";
11
+ import { B as z } from "./badge-zsf5i5bH.js";
12
+ import { I as V } from "./insert-result-CoC1oo6R.js";
13
+ import { D as C, c as j } from "./gestation-mWF4AXea.js";
14
+ const K = H("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
14
15
  variants: {
15
16
  width: { full: "ds:w-full", auto: "ds:inline-flex" }
16
17
  },
17
18
  defaultVariants: { width: "full" }
18
- }), H = {
19
+ }), Y = {
19
20
  preconception: "neutral",
20
21
  first: "info",
21
22
  second: "success",
22
23
  third: "warning",
23
24
  postterm: "error"
24
- }, Y = {
25
+ }, O = {
26
+ preconception: "--muted",
27
+ first: "--info",
28
+ second: "--success",
29
+ third: "--warning",
30
+ postterm: "--destructive"
31
+ }, P = {
25
32
  lmp: "dueDateCalculator.lmpDate",
26
33
  conception: "dueDateCalculator.conceptionDate",
27
34
  ivf: "dueDateCalculator.transferDate"
28
- }, K = B(
35
+ }, U = F(
29
36
  ({
30
- defaultMethod: C = "lmp",
37
+ defaultMethod: y = "lmp",
31
38
  onResultChange: d,
32
39
  onInsert: p,
33
40
  insertVariant: D = "insert",
34
- onCopy: y,
35
- onError: x,
36
- id: N,
37
- width: L,
41
+ onCopy: x,
42
+ onError: N,
43
+ insertBrand: L,
44
+ id: E,
45
+ width: w,
38
46
  className: A
39
- }, w) => {
40
- const { t: e, i18n: f } = S(), [r, E] = i(C), [o, T] = i(void 0), [u, $] = i(
41
- b
42
- ), [n, F] = i(5), t = g(() => o ? V(
47
+ }, T) => {
48
+ const { t: e, i18n: f } = R(), [r, I] = c(y), [o, _] = c(void 0), [u, $] = c(
49
+ C
50
+ ), [n, k] = c(5), t = g(() => o ? j(
43
51
  {
44
52
  method: r,
45
53
  date: o,
46
- cycleLength: u ?? b,
54
+ cycleLength: u ?? C,
47
55
  embryoAge: n
48
56
  },
49
57
  /* @__PURE__ */ new Date()
50
- ) : null, [r, o, u, n]), c = g(
58
+ ) : null, [r, o, u, n]), i = g(
51
59
  () => new Intl.DateTimeFormat(f.language, { dateStyle: "long" }),
52
60
  [f.language]
53
61
  );
54
- _(() => {
62
+ G(() => {
55
63
  d == null || d(t);
56
64
  }, [t, d]);
57
- const k = g(() => /* @__PURE__ */ new Date(), []);
65
+ const B = g(() => /* @__PURE__ */ new Date(), []);
58
66
  return /* @__PURE__ */ l(
59
67
  "div",
60
68
  {
61
- ref: w,
69
+ ref: T,
62
70
  "data-component": "due-date-calculator",
63
- "data-component-id": N,
64
- className: j({ width: L, className: A }),
71
+ "data-component-id": E,
72
+ className: K({ width: w, className: A }),
65
73
  children: [
66
74
  /* @__PURE__ */ l(
67
75
  h,
@@ -69,7 +77,7 @@ const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
69
77
  label: e("dueDateCalculator.method.label"),
70
78
  variant: "horizontal",
71
79
  value: r,
72
- onValueChange: (m) => E(m),
80
+ onValueChange: (m) => I(m),
73
81
  children: [
74
82
  /* @__PURE__ */ a(s, { label: e("dueDateCalculator.method.lmp"), value: "lmp" }),
75
83
  /* @__PURE__ */ a(
@@ -84,14 +92,14 @@ const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
84
92
  }
85
93
  ),
86
94
  /* @__PURE__ */ l("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
87
- /* @__PURE__ */ a(v, { label: e(Y[r]), children: /* @__PURE__ */ a(z, { value: o, onChange: T, maxDate: k }) }),
95
+ /* @__PURE__ */ a(v, { label: e(P[r]), children: /* @__PURE__ */ a(S, { value: o, onChange: _, maxDate: B }) }),
88
96
  r === "lmp" && /* @__PURE__ */ a(
89
97
  v,
90
98
  {
91
99
  label: e("dueDateCalculator.cycleLength"),
92
100
  description: e("dueDateCalculator.cycleLengthHint"),
93
101
  children: /* @__PURE__ */ a(
94
- G,
102
+ M,
95
103
  {
96
104
  mode: "integer",
97
105
  min: 20,
@@ -108,7 +116,7 @@ const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
108
116
  label: e("dueDateCalculator.embryoAge"),
109
117
  variant: "horizontal",
110
118
  value: String(n),
111
- onValueChange: (m) => F(Number(m)),
119
+ onValueChange: (m) => k(Number(m)),
112
120
  children: [
113
121
  /* @__PURE__ */ a(s, { label: e("dueDateCalculator.day3"), value: "3" }),
114
122
  /* @__PURE__ */ a(s, { label: e("dueDateCalculator.day5"), value: "5" })
@@ -116,16 +124,23 @@ const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
116
124
  }
117
125
  )
118
126
  ] }),
119
- /* @__PURE__ */ a("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: t ? `${e("dueDateCalculator.result.dueDateLabel")}: ${c.format(
127
+ /* @__PURE__ */ a("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: t ? `${e("dueDateCalculator.result.dueDateLabel")}: ${i.format(
120
128
  t.dueDate
121
129
  )}. ${e("dueDateCalculator.result.trimesterLabel")}: ${e(
122
130
  `dueDateCalculator.trimester.${t.trimester}`
123
131
  )}.` : "" }),
124
- t ? /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
132
+ t ? /* @__PURE__ */ a(b, { variant: "elevated", children: /* @__PURE__ */ l(b.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
125
133
  /* @__PURE__ */ l("dl", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3", children: [
126
134
  /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]", children: [
127
135
  /* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("dueDateCalculator.result.trimesterLabel") }),
128
- /* @__PURE__ */ a("dd", { children: /* @__PURE__ */ a(M, { variant: H[t.trimester], size: "lg", children: e(`dueDateCalculator.trimester.${t.trimester}`) }) })
136
+ /* @__PURE__ */ a("dd", { children: /* @__PURE__ */ a(
137
+ z,
138
+ {
139
+ variant: Y[t.trimester],
140
+ size: "lg",
141
+ children: e(`dueDateCalculator.trimester.${t.trimester}`)
142
+ }
143
+ ) })
129
144
  ] }),
130
145
  /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
131
146
  /* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("dueDateCalculator.result.gestationLabel") }),
@@ -136,23 +151,28 @@ const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
136
151
  ] }),
137
152
  /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
138
153
  /* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("dueDateCalculator.result.dueDateLabel") }),
139
- /* @__PURE__ */ a("dd", { className: "type-metric ds:text-foreground", children: c.format(t.dueDate) })
154
+ /* @__PURE__ */ a("dd", { className: "type-metric ds:text-foreground", children: i.format(t.dueDate) })
140
155
  ] })
141
156
  ] }),
142
157
  D === "copy" || p ? /* @__PURE__ */ a(
143
- R,
158
+ V,
144
159
  {
145
160
  variant: D,
146
161
  onInsert: p,
147
- onCopy: y,
148
- onError: x,
162
+ onCopy: x,
163
+ onError: N,
149
164
  card: {
150
165
  title: e("insert.title.dueDate"),
151
- highlight: c.format(t.dueDate),
166
+ highlight: i.format(t.dueDate),
167
+ // Chip tinted with the trimester's semantic token so the
168
+ // inserted PNG carries the same clinical-stage colour as
169
+ // the on-screen trimester badge.
170
+ highlightToken: O[t.trimester],
171
+ brand: L,
152
172
  fields: [
153
173
  {
154
174
  label: e("dueDateCalculator.result.dueDateLabel"),
155
- value: c.format(t.dueDate)
175
+ value: i.format(t.dueDate)
156
176
  },
157
177
  {
158
178
  label: e("dueDateCalculator.result.gestationLabel"),
@@ -171,14 +191,14 @@ const j = I("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
171
191
  }
172
192
  }
173
193
  ) : null
174
- ] }) : /* @__PURE__ */ a("p", { className: "type-body ds:text-muted-foreground", children: e("dueDateCalculator.empty") })
194
+ ] }) }) : /* @__PURE__ */ a("p", { className: "type-body ds:text-muted-foreground", children: e("dueDateCalculator.empty") })
175
195
  ]
176
196
  }
177
197
  );
178
198
  }
179
199
  );
180
- K.displayName = "DueDateCalculator";
200
+ U.displayName = "DueDateCalculator";
181
201
  export {
182
- K as D
202
+ U as D
183
203
  };
184
- //# sourceMappingURL=due-date-calculator-s_CBgaFs.js.map
204
+ //# sourceMappingURL=due-date-calculator-CYXKLoof.js.map
@@ -26,7 +26,7 @@ import { S as Ie } from "./select-hsCaJSX3.js";
26
26
  import { u as zt } from "./use-prefers-reduced-motion-BMwIQRjB.js";
27
27
  import { u as At } from "./use-theme-C2dHKUAN.js";
28
28
  import { u as Pt } from "./registry-nPAVE19X.js";
29
- import { D as ze } from "./date-range-picker-U9fn1g9d.js";
29
+ import { D as ze } from "./date-range-picker-DcXuI9y7.js";
30
30
  import { M as Ot } from "./multi-select-DOLO3K_z.js";
31
31
  import { A as Ae } from "./autocomplete-DIgdhCGJ.js";
32
32
  import { N as ee } from "./number-input-Dj5L3pXK.js";
@@ -2332,4 +2332,4 @@ export {
2332
2332
  Be as q,
2333
2333
  xn as u
2334
2334
  };
2335
- //# sourceMappingURL=editable-currency-cell-renderer-BhUkRiPZ.js.map
2335
+ //# sourceMappingURL=editable-currency-cell-renderer-9jqwDv5x.js.map
@@ -1,4 +1,4 @@
1
- import { o as s, q as i, r as o, v as d } from "./react-day-picker-CdtIiKjx.js";
1
+ import { q as s, r as i, v as o, w as d } from "./date-picker-variants-DLi1Va_e.js";
2
2
  const u = {
3
3
  lessThanXSeconds: {
4
4
  one: "λιγότερο από ένα δευτερόλεπτο",
@@ -93,7 +93,7 @@ const u = {
93
93
  formats: m,
94
94
  defaultWidth: "full"
95
95
  })
96
- }, b = {
96
+ }, w = {
97
97
  lastWeek: (e) => {
98
98
  switch (e.getDay()) {
99
99
  case 6:
@@ -107,8 +107,8 @@ const u = {
107
107
  tomorrow: "'αύριο στις' p",
108
108
  nextWeek: "eeee 'στις' p",
109
109
  other: "P"
110
- }, w = (e, r) => {
111
- const a = b[e];
110
+ }, b = (e, r) => {
111
+ const a = w[e];
112
112
  return typeof a == "function" ? a(r) : a;
113
113
  }, y = {
114
114
  narrow: ["πΧ", "μΧ"],
@@ -359,7 +359,7 @@ const u = {
359
359
  code: "el",
360
360
  formatDistance: c,
361
361
  formatLong: f,
362
- formatRelative: w,
362
+ formatRelative: b,
363
363
  localize: k,
364
364
  match: q,
365
365
  options: {
@@ -370,4 +370,4 @@ const u = {
370
370
  export {
371
371
  O as el
372
372
  };
373
- //# sourceMappingURL=el-BYPonAaK.js.map
373
+ //# sourceMappingURL=el-BWG5RXxa.js.map
@@ -1,4 +1,4 @@
1
- import { o as d, q as o, r, v as s } from "./react-day-picker-CdtIiKjx.js";
1
+ import { q as d, r as o, v as r, w as s } from "./date-picker-variants-DLi1Va_e.js";
2
2
  const m = {
3
3
  lessThanXSeconds: {
4
4
  one: "menos de un segundo",
@@ -370,4 +370,4 @@ const m = {
370
370
  export {
371
371
  q as es
372
372
  };
373
- //# sourceMappingURL=es-CMkVCQ4F.js.map
373
+ //# sourceMappingURL=es-DfO_G435.js.map
@@ -1,4 +1,4 @@
1
- import { o as m, q as r, r as o, v as d } from "./react-day-picker-CdtIiKjx.js";
1
+ import { q as m, r, v as o, w as d } from "./date-picker-variants-DLi1Va_e.js";
2
2
  const u = {
3
3
  lessThanXSeconds: {
4
4
  one: "moins d’une seconde",
@@ -335,4 +335,4 @@ const u = {
335
335
  export {
336
336
  q as fr
337
337
  };
338
- //# sourceMappingURL=fr-BcuWxqft.js.map
338
+ //# sourceMappingURL=fr-BTn24bs8.js.map
@@ -1,5 +1,5 @@
1
- import { a, d as E } from "./react-day-picker-CdtIiKjx.js";
2
- import { s as i } from "./subDays-_T9YeKPX.js";
1
+ import { a, d as E } from "./date-picker-variants-DLi1Va_e.js";
2
+ import { s as i } from "./subDays-Dv7q9S7u.js";
3
3
  const T = 280, m = 14, u = 266, d = 28;
4
4
  function p(e) {
5
5
  if (e < 0) return "preconception";
@@ -47,4 +47,4 @@ export {
47
47
  g,
48
48
  p as t
49
49
  };
50
- //# sourceMappingURL=gestation-BXEgDGmP.js.map
50
+ //# sourceMappingURL=gestation-mWF4AXea.js.map
@@ -0,0 +1,190 @@
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as L, useState as f, useMemo as m, useEffect as I } from "react";
3
+ import { c as S } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as k } from "react-i18next";
5
+ import { R as h } from "./radio-TWf9Q-mp.js";
6
+ import { R as B } from "./radio-group-CLjK-SlK.js";
7
+ import { F } from "./form-field-BOm9hK35.js";
8
+ import { D as M } 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 R } from "./insert-result-CoC1oo6R.js";
12
+ import { c as _, g as j, G as H } from "./gestation-mWF4AXea.js";
13
+ import { s as z } from "./subDays-Dv7q9S7u.js";
14
+ import { i as O } from "./date-picker-variants-DLi1Va_e.js";
15
+ const V = S("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
+ }), K = {
21
+ preconception: "neutral",
22
+ first: "info",
23
+ second: "success",
24
+ third: "warning",
25
+ postterm: "error"
26
+ }, P = {
27
+ preconception: "--muted",
28
+ first: "--info",
29
+ second: "--success",
30
+ third: "--warning",
31
+ postterm: "--destructive"
32
+ }, Y = L(
33
+ ({
34
+ defaultMethod: v = "lmp",
35
+ onResultChange: d,
36
+ onInsert: g,
37
+ insertVariant: u = "insert",
38
+ onCopy: b,
39
+ onError: y,
40
+ insertBrand: C,
41
+ id: N,
42
+ width: D,
43
+ className: T
44
+ }, w) => {
45
+ const { t: e, i18n: p } = k(), [o, G] = f(v), [i, $] = f(void 0), n = m(() => /* @__PURE__ */ new Date(), []), a = m(() => {
46
+ if (!i) return null;
47
+ const s = o === "lmp" ? i : z(i, H), r = _({ method: "lmp", date: s }, n);
48
+ return {
49
+ result: {
50
+ gestationalAge: r.gestationalAge,
51
+ trimester: r.trimester,
52
+ dueDate: r.dueDate
53
+ },
54
+ milestones: j(r.gestationalStart)
55
+ };
56
+ }, [o, i, n]), E = m(
57
+ () => new Intl.DateTimeFormat(p.language, { dateStyle: "medium" }),
58
+ [p.language]
59
+ );
60
+ I(() => {
61
+ d == null || d((a == null ? void 0 : a.result) ?? null);
62
+ }, [a, d]);
63
+ const c = (s) => s ? e("gestationalAgeCalculator.gestation", {
64
+ weeks: s.weeks,
65
+ days: s.days
66
+ }) : "—";
67
+ return /* @__PURE__ */ l(
68
+ "div",
69
+ {
70
+ ref: w,
71
+ "data-component": "gestational-age-calculator",
72
+ "data-component-id": N,
73
+ className: V({ width: D, className: T }),
74
+ children: [
75
+ /* @__PURE__ */ l(
76
+ B,
77
+ {
78
+ label: e("gestationalAgeCalculator.method.label"),
79
+ variant: "horizontal",
80
+ value: o,
81
+ onValueChange: (s) => G(s),
82
+ children: [
83
+ /* @__PURE__ */ t(h, { label: e("gestationalAgeCalculator.method.lmp"), value: "lmp" }),
84
+ /* @__PURE__ */ t(h, { label: e("gestationalAgeCalculator.method.edd"), value: "edd" })
85
+ ]
86
+ }
87
+ ),
88
+ /* @__PURE__ */ t(
89
+ F,
90
+ {
91
+ label: e(
92
+ o === "lmp" ? "gestationalAgeCalculator.lmpDate" : "gestationalAgeCalculator.eddDate"
93
+ ),
94
+ children: /* @__PURE__ */ t(
95
+ M,
96
+ {
97
+ value: i,
98
+ onChange: $,
99
+ maxDate: o === "lmp" ? n : void 0
100
+ }
101
+ )
102
+ }
103
+ ),
104
+ /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: a ? `${e("gestationalAgeCalculator.gestationLabel")}: ${c(
105
+ a.result.gestationalAge
106
+ )}. ${e("gestationalAgeCalculator.trimesterLabel")}: ${e(
107
+ `gestationalAgeCalculator.trimester.${a.result.trimester}`
108
+ )}.` : "" }),
109
+ a ? /* @__PURE__ */ t(x, { variant: "elevated", children: /* @__PURE__ */ l(x.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
110
+ /* @__PURE__ */ l("dl", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
111
+ /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]", children: [
112
+ /* @__PURE__ */ t("dt", { className: "type-label ds:text-muted-foreground", children: e("gestationalAgeCalculator.trimesterLabel") }),
113
+ /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t(
114
+ A,
115
+ {
116
+ variant: K[a.result.trimester],
117
+ size: "lg",
118
+ children: e(
119
+ `gestationalAgeCalculator.trimester.${a.result.trimester}`
120
+ )
121
+ }
122
+ ) })
123
+ ] }),
124
+ /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:items-end ds:gap-[var(--spacing-xs)] ds:text-end", children: [
125
+ /* @__PURE__ */ t("dt", { className: "type-label ds:text-muted-foreground", children: e("gestationalAgeCalculator.gestationLabel") }),
126
+ /* @__PURE__ */ t("dd", { className: "type-metric ds:text-foreground", children: c(a.result.gestationalAge) })
127
+ ] })
128
+ ] }),
129
+ /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
130
+ /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: e("gestationalAgeCalculator.milestonesLabel") }),
131
+ /* @__PURE__ */ t("ul", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: a.milestones.map((s) => {
132
+ const r = O(n, s.date);
133
+ return /* @__PURE__ */ l(
134
+ "li",
135
+ {
136
+ className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)]",
137
+ children: [
138
+ /* @__PURE__ */ t("span", { className: "type-body ds:text-foreground", children: e(`gestationalAgeCalculator.milestone.${s.key}`) }),
139
+ /* @__PURE__ */ l("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
140
+ /* @__PURE__ */ t("span", { className: "type-body ds:text-muted-foreground", children: E.format(s.date) }),
141
+ r ? /* @__PURE__ */ t(A, { variant: "success", children: e("gestationalAgeCalculator.reached") }) : null
142
+ ] })
143
+ ]
144
+ },
145
+ s.key
146
+ );
147
+ }) })
148
+ ] }),
149
+ u === "copy" || g ? /* @__PURE__ */ t(
150
+ R,
151
+ {
152
+ onInsert: g,
153
+ variant: u,
154
+ onCopy: b,
155
+ onError: y,
156
+ card: {
157
+ title: e("insert.title.gestationalAge"),
158
+ highlight: e(
159
+ `gestationalAgeCalculator.trimester.${a.result.trimester}`
160
+ ),
161
+ // Chip shares the trimester's semantic token so the
162
+ // inserted PNG chip matches the on-screen trimester badge.
163
+ highlightToken: P[a.result.trimester],
164
+ brand: C,
165
+ fields: [
166
+ {
167
+ label: e("gestationalAgeCalculator.gestationLabel"),
168
+ value: c(a.result.gestationalAge)
169
+ },
170
+ {
171
+ label: e("gestationalAgeCalculator.trimesterLabel"),
172
+ value: e(
173
+ `gestationalAgeCalculator.trimester.${a.result.trimester}`
174
+ )
175
+ }
176
+ ]
177
+ }
178
+ }
179
+ ) : null
180
+ ] }) }) : /* @__PURE__ */ t("p", { className: "type-body ds:text-muted-foreground", children: e("gestationalAgeCalculator.empty") })
181
+ ]
182
+ }
183
+ );
184
+ }
185
+ );
186
+ Y.displayName = "GestationalAgeCalculator";
187
+ export {
188
+ Y as G
189
+ };
190
+ //# sourceMappingURL=gestational-age-calculator-sRmoqgVr.js.map