@alfadocs/ui-kit 0.43.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.
- package/dist/_chunks/{bmi-calculator-DuVSFDuw.js → bmi-calculator-DFPWL2OJ.js} +92 -78
- package/dist/_chunks/{calculator-dialog-DdexHrTP.js → calculator-dialog-D-nfvteH.js} +2 -2
- package/dist/_chunks/{cycle-calculator-Dln-y1k_.js → cycle-calculator-ChHBcjet.js} +58 -50
- package/dist/_chunks/dialog-BTpZV6It.js +223 -0
- package/dist/_chunks/{due-date-calculator-Cc4dRqTI.js → due-date-calculator-CYXKLoof.js} +50 -38
- package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js +190 -0
- package/dist/_chunks/insert-result-CoC1oo6R.js +334 -0
- package/dist/_chunks/{pregnancy-weight-gain-zZL5Ir2-.js → pregnancy-weight-gain-C5YhfYnL.js} +66 -57
- package/dist/_chunks/{unit-converter-CuXCXJhK.js → unit-converter-Ds9jalbN.js} +78 -67
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/index.d.ts +1 -1
- package/dist/components/_shared/insert-result.d.ts +100 -10
- package/dist/components/bmi-calculator/bmi-calculator.d.ts +6 -0
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/calculator-dialog/index.js +1 -1
- package/dist/components/cycle-calculator/cycle-calculator.d.ts +6 -0
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/due-date-calculator/due-date-calculator.d.ts +6 -0
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +6 -0
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +6 -0
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/unit-converter/unit-converter.d.ts +6 -0
- package/dist/index.js +494 -493
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/dialog-DOYgd75U.js +0 -224
- package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js +0 -179
- package/dist/_chunks/insert-result-DisOY2G-.js +0 -243
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as j, useEffect as O, useMemo as T, forwardRef as i, useContext as x, createContext as B } from "react";
|
|
3
|
+
import * as s from "@radix-ui/react-dialog";
|
|
4
|
+
import { c as k } from "./index-D2ZczOXr.js";
|
|
5
|
+
import { useTranslation as S } from "react-i18next";
|
|
6
|
+
import { u as w } from "./use-controllable-state-BiY4xTzM.js";
|
|
7
|
+
import { u as A } from "./registry-nPAVE19X.js";
|
|
8
|
+
import { X as E } from "./x-CCcI3eJp.js";
|
|
9
|
+
const H = {
|
|
10
|
+
id: "dialog",
|
|
11
|
+
capabilities: ["open", "close", "dismiss"],
|
|
12
|
+
state: {
|
|
13
|
+
isOpen: {
|
|
14
|
+
type: "boolean",
|
|
15
|
+
description: "True when the dialog is currently open.",
|
|
16
|
+
read: (e) => e.getIsOpen()
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
actions: {
|
|
20
|
+
open: {
|
|
21
|
+
safety: "read",
|
|
22
|
+
description: "Open the dialog.",
|
|
23
|
+
invoke: (e) => {
|
|
24
|
+
e.open();
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
close: {
|
|
28
|
+
safety: "write",
|
|
29
|
+
description: "Close the dialog. Reversible by reopening.",
|
|
30
|
+
invoke: (e) => {
|
|
31
|
+
e.close();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
dismiss: {
|
|
35
|
+
safety: "destructive",
|
|
36
|
+
description: "Dismiss the dialog. Loses any in-progress input that has not been committed.",
|
|
37
|
+
invoke: (e) => {
|
|
38
|
+
e.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
domHooks: {
|
|
43
|
+
root: { attr: "data-component", value: "dialog" },
|
|
44
|
+
instanceId: {
|
|
45
|
+
attr: "data-component-id",
|
|
46
|
+
sourceProp: "id",
|
|
47
|
+
description: "Sourced from the id prop on Dialog.Root."
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, I = [
|
|
51
|
+
"ds-dialog__backdrop",
|
|
52
|
+
"ds:backdrop-blur-sm",
|
|
53
|
+
"ds:data-[state=open]:animate-in ds:data-[state=open]:fade-in-0",
|
|
54
|
+
"ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0",
|
|
55
|
+
"ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
|
|
56
|
+
].join(" "), z = [
|
|
57
|
+
"ds:focus-visible:outline-none",
|
|
58
|
+
"ds:data-[state=open]:animate-in ds:data-[state=open]:fade-in-0 ds:data-[state=open]:zoom-in-95",
|
|
59
|
+
"ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=closed]:zoom-out-95",
|
|
60
|
+
"ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none"
|
|
61
|
+
].join(" "), F = k(`ds-dialog ds-dialog__surface ${z}`, {
|
|
62
|
+
variants: {
|
|
63
|
+
size: {
|
|
64
|
+
sm: "ds-dialog__surface--sm",
|
|
65
|
+
md: "",
|
|
66
|
+
lg: "ds-dialog__surface--lg",
|
|
67
|
+
fullscreen: "ds-dialog__surface--fullscreen"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
defaultVariants: { size: "md" }
|
|
71
|
+
}), f = B(void 0), g = ({
|
|
72
|
+
children: e,
|
|
73
|
+
id: o,
|
|
74
|
+
open: a,
|
|
75
|
+
defaultOpen: r,
|
|
76
|
+
onOpenChange: c,
|
|
77
|
+
...m
|
|
78
|
+
}) => {
|
|
79
|
+
const [p, n] = w({
|
|
80
|
+
value: a,
|
|
81
|
+
defaultValue: r ?? !1,
|
|
82
|
+
onChange: c
|
|
83
|
+
}), d = p ?? !1, l = j(d);
|
|
84
|
+
O(() => {
|
|
85
|
+
l.current = d;
|
|
86
|
+
}, [d]);
|
|
87
|
+
const R = T(
|
|
88
|
+
() => ({
|
|
89
|
+
getIsOpen: () => l.current,
|
|
90
|
+
open: () => n(!0),
|
|
91
|
+
close: () => n(!1)
|
|
92
|
+
}),
|
|
93
|
+
[n]
|
|
94
|
+
);
|
|
95
|
+
return A(H, R, o), /* @__PURE__ */ t(f.Provider, { value: o, children: /* @__PURE__ */ t(s.Root, { open: d, onOpenChange: n, ...m, children: e }) });
|
|
96
|
+
};
|
|
97
|
+
g.displayName = "Dialog.Root";
|
|
98
|
+
const D = i(({ children: e, ...o }, a) => /* @__PURE__ */ t(s.Trigger, { ref: a, ...o, children: e }));
|
|
99
|
+
D.displayName = "Dialog.Trigger";
|
|
100
|
+
const y = i(({ children: e, ...o }, a) => /* @__PURE__ */ t(s.Close, { ref: a, ...o, children: e }));
|
|
101
|
+
y.displayName = "Dialog.Close";
|
|
102
|
+
const v = i(
|
|
103
|
+
({
|
|
104
|
+
size: e = "md",
|
|
105
|
+
variant: o = "default",
|
|
106
|
+
hideCloseButton: a = !0,
|
|
107
|
+
className: r,
|
|
108
|
+
children: c,
|
|
109
|
+
...m
|
|
110
|
+
}, p) => {
|
|
111
|
+
const { t: n } = S(), d = x(f), l = o === "alert" ? { role: "alertdialog" } : {};
|
|
112
|
+
return /* @__PURE__ */ u(s.Portal, { children: [
|
|
113
|
+
/* @__PURE__ */ t(
|
|
114
|
+
s.Overlay,
|
|
115
|
+
{
|
|
116
|
+
"data-component": "dialog-overlay",
|
|
117
|
+
className: I
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ u(
|
|
121
|
+
s.Content,
|
|
122
|
+
{
|
|
123
|
+
ref: p,
|
|
124
|
+
...l,
|
|
125
|
+
"data-component": "dialog",
|
|
126
|
+
"data-component-id": d,
|
|
127
|
+
className: F({ size: e, className: r }),
|
|
128
|
+
...m,
|
|
129
|
+
children: [
|
|
130
|
+
c,
|
|
131
|
+
!a && // The close is a plain button carrying the `ds-dialog__close`
|
|
132
|
+
// contract class — the SAME class a vanilla host renders. The CSS
|
|
133
|
+
// (src/styles.css) owns its position, sizing, glyph size, hover
|
|
134
|
+
// wash, and focus ring from tokens, so the React and non-React
|
|
135
|
+
// close buttons are identical and can't drift.
|
|
136
|
+
/* @__PURE__ */ t(
|
|
137
|
+
s.Close,
|
|
138
|
+
{
|
|
139
|
+
type: "button",
|
|
140
|
+
className: "ds-dialog__close",
|
|
141
|
+
"aria-label": n("common.close", "Close"),
|
|
142
|
+
children: /* @__PURE__ */ t(E, { "aria-hidden": "true" })
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] });
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
v.displayName = "Dialog.Content";
|
|
152
|
+
const C = i(
|
|
153
|
+
({ className: e, ...o }, a) => /* @__PURE__ */ t(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
ref: a,
|
|
157
|
+
className: ["ds-dialog__header", e].filter(Boolean).join(" "),
|
|
158
|
+
...o
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
);
|
|
162
|
+
C.displayName = "Dialog.Header";
|
|
163
|
+
const _ = i(
|
|
164
|
+
({ className: e, ...o }, a) => /* @__PURE__ */ t(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
ref: a,
|
|
168
|
+
className: ["ds-dialog__body", e].filter(Boolean).join(" "),
|
|
169
|
+
...o
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
_.displayName = "Dialog.Body";
|
|
174
|
+
const b = i(({ className: e, ...o }, a) => /* @__PURE__ */ t(
|
|
175
|
+
s.Title,
|
|
176
|
+
{
|
|
177
|
+
ref: a,
|
|
178
|
+
className: ["ds-dialog__title type-title-card ds:break-words", e].filter(Boolean).join(" "),
|
|
179
|
+
...o
|
|
180
|
+
}
|
|
181
|
+
));
|
|
182
|
+
b.displayName = "Dialog.Title";
|
|
183
|
+
const h = i(({ className: e, ...o }, a) => /* @__PURE__ */ t(
|
|
184
|
+
s.Description,
|
|
185
|
+
{
|
|
186
|
+
ref: a,
|
|
187
|
+
className: ["type-body-sm ds:text-[var(--muted-foreground)]", e].filter(Boolean).join(" "),
|
|
188
|
+
...o
|
|
189
|
+
}
|
|
190
|
+
));
|
|
191
|
+
h.displayName = "Dialog.Description";
|
|
192
|
+
const N = i(
|
|
193
|
+
({ className: e, divider: o = !1, ...a }, r) => /* @__PURE__ */ t(
|
|
194
|
+
"div",
|
|
195
|
+
{
|
|
196
|
+
ref: r,
|
|
197
|
+
className: [
|
|
198
|
+
"ds:flex ds:items-center ds:justify-end ds:gap-[var(--spacing-sm)]",
|
|
199
|
+
"ds:mt-[var(--spacing-md)]",
|
|
200
|
+
o && "ds:border-t ds:border-[color:var(--border)] ds:pt-[var(--spacing-md)]",
|
|
201
|
+
e
|
|
202
|
+
].filter(Boolean).join(" "),
|
|
203
|
+
...a
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
);
|
|
207
|
+
N.displayName = "Dialog.Footer";
|
|
208
|
+
const $ = Object.assign(g, {
|
|
209
|
+
Root: g,
|
|
210
|
+
Trigger: D,
|
|
211
|
+
Content: v,
|
|
212
|
+
Header: C,
|
|
213
|
+
Title: b,
|
|
214
|
+
Description: h,
|
|
215
|
+
Body: _,
|
|
216
|
+
Footer: N,
|
|
217
|
+
Close: y
|
|
218
|
+
});
|
|
219
|
+
export {
|
|
220
|
+
$ as D,
|
|
221
|
+
H as d
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=dialog-BTpZV6It.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
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
|
|
8
|
+
import { D as S } from "./date-picker-Bq7xhMA-.js";
|
|
9
9
|
import { N as M } from "./number-input-Dj5L3pXK.js";
|
|
10
|
-
import { C } from "./card-DPmk26CL.js";
|
|
11
|
-
import { B as
|
|
12
|
-
import { I as V } from "./insert-result-
|
|
13
|
-
import { D as
|
|
14
|
-
const
|
|
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)]", {
|
|
15
15
|
variants: {
|
|
16
16
|
width: { full: "ds:w-full", auto: "ds:inline-flex" }
|
|
17
17
|
},
|
|
@@ -22,11 +22,17 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
22
22
|
second: "success",
|
|
23
23
|
third: "warning",
|
|
24
24
|
postterm: "error"
|
|
25
|
-
},
|
|
25
|
+
}, O = {
|
|
26
|
+
preconception: "--muted",
|
|
27
|
+
first: "--info",
|
|
28
|
+
second: "--success",
|
|
29
|
+
third: "--warning",
|
|
30
|
+
postterm: "--destructive"
|
|
31
|
+
}, P = {
|
|
26
32
|
lmp: "dueDateCalculator.lmpDate",
|
|
27
33
|
conception: "dueDateCalculator.conceptionDate",
|
|
28
34
|
ivf: "dueDateCalculator.transferDate"
|
|
29
|
-
},
|
|
35
|
+
}, U = F(
|
|
30
36
|
({
|
|
31
37
|
defaultMethod: y = "lmp",
|
|
32
38
|
onResultChange: d,
|
|
@@ -34,35 +40,36 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
34
40
|
insertVariant: D = "insert",
|
|
35
41
|
onCopy: x,
|
|
36
42
|
onError: N,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
insertBrand: L,
|
|
44
|
+
id: E,
|
|
45
|
+
width: w,
|
|
46
|
+
className: A
|
|
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(
|
|
44
51
|
{
|
|
45
52
|
method: r,
|
|
46
53
|
date: o,
|
|
47
|
-
cycleLength: u ??
|
|
54
|
+
cycleLength: u ?? C,
|
|
48
55
|
embryoAge: n
|
|
49
56
|
},
|
|
50
57
|
/* @__PURE__ */ new Date()
|
|
51
|
-
) : null, [r, o, u, n]),
|
|
58
|
+
) : null, [r, o, u, n]), i = g(
|
|
52
59
|
() => new Intl.DateTimeFormat(f.language, { dateStyle: "long" }),
|
|
53
60
|
[f.language]
|
|
54
61
|
);
|
|
55
|
-
|
|
62
|
+
G(() => {
|
|
56
63
|
d == null || d(t);
|
|
57
64
|
}, [t, d]);
|
|
58
|
-
const
|
|
65
|
+
const B = g(() => /* @__PURE__ */ new Date(), []);
|
|
59
66
|
return /* @__PURE__ */ l(
|
|
60
67
|
"div",
|
|
61
68
|
{
|
|
62
|
-
ref:
|
|
69
|
+
ref: T,
|
|
63
70
|
"data-component": "due-date-calculator",
|
|
64
|
-
"data-component-id":
|
|
65
|
-
className:
|
|
71
|
+
"data-component-id": E,
|
|
72
|
+
className: K({ width: w, className: A }),
|
|
66
73
|
children: [
|
|
67
74
|
/* @__PURE__ */ l(
|
|
68
75
|
h,
|
|
@@ -70,7 +77,7 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
70
77
|
label: e("dueDateCalculator.method.label"),
|
|
71
78
|
variant: "horizontal",
|
|
72
79
|
value: r,
|
|
73
|
-
onValueChange: (m) =>
|
|
80
|
+
onValueChange: (m) => I(m),
|
|
74
81
|
children: [
|
|
75
82
|
/* @__PURE__ */ a(s, { label: e("dueDateCalculator.method.lmp"), value: "lmp" }),
|
|
76
83
|
/* @__PURE__ */ a(
|
|
@@ -85,7 +92,7 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
85
92
|
}
|
|
86
93
|
),
|
|
87
94
|
/* @__PURE__ */ l("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
|
|
88
|
-
/* @__PURE__ */ a(v, { label: e(
|
|
95
|
+
/* @__PURE__ */ a(v, { label: e(P[r]), children: /* @__PURE__ */ a(S, { value: o, onChange: _, maxDate: B }) }),
|
|
89
96
|
r === "lmp" && /* @__PURE__ */ a(
|
|
90
97
|
v,
|
|
91
98
|
{
|
|
@@ -98,7 +105,7 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
98
105
|
min: 20,
|
|
99
106
|
max: 45,
|
|
100
107
|
value: u,
|
|
101
|
-
onChange:
|
|
108
|
+
onChange: $
|
|
102
109
|
}
|
|
103
110
|
)
|
|
104
111
|
}
|
|
@@ -109,7 +116,7 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
109
116
|
label: e("dueDateCalculator.embryoAge"),
|
|
110
117
|
variant: "horizontal",
|
|
111
118
|
value: String(n),
|
|
112
|
-
onValueChange: (m) =>
|
|
119
|
+
onValueChange: (m) => k(Number(m)),
|
|
113
120
|
children: [
|
|
114
121
|
/* @__PURE__ */ a(s, { label: e("dueDateCalculator.day3"), value: "3" }),
|
|
115
122
|
/* @__PURE__ */ a(s, { label: e("dueDateCalculator.day5"), value: "5" })
|
|
@@ -117,17 +124,17 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
117
124
|
}
|
|
118
125
|
)
|
|
119
126
|
] }),
|
|
120
|
-
/* @__PURE__ */ a("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: t ? `${e("dueDateCalculator.result.dueDateLabel")}: ${
|
|
127
|
+
/* @__PURE__ */ a("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: t ? `${e("dueDateCalculator.result.dueDateLabel")}: ${i.format(
|
|
121
128
|
t.dueDate
|
|
122
129
|
)}. ${e("dueDateCalculator.result.trimesterLabel")}: ${e(
|
|
123
130
|
`dueDateCalculator.trimester.${t.trimester}`
|
|
124
131
|
)}.` : "" }),
|
|
125
|
-
t ? /* @__PURE__ */ a(
|
|
132
|
+
t ? /* @__PURE__ */ a(b, { variant: "elevated", children: /* @__PURE__ */ l(b.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
|
|
126
133
|
/* @__PURE__ */ l("dl", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3", children: [
|
|
127
134
|
/* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]", children: [
|
|
128
135
|
/* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("dueDateCalculator.result.trimesterLabel") }),
|
|
129
136
|
/* @__PURE__ */ a("dd", { children: /* @__PURE__ */ a(
|
|
130
|
-
|
|
137
|
+
z,
|
|
131
138
|
{
|
|
132
139
|
variant: Y[t.trimester],
|
|
133
140
|
size: "lg",
|
|
@@ -144,7 +151,7 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
144
151
|
] }),
|
|
145
152
|
/* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
|
|
146
153
|
/* @__PURE__ */ a("dt", { className: "type-label ds:text-muted-foreground", children: e("dueDateCalculator.result.dueDateLabel") }),
|
|
147
|
-
/* @__PURE__ */ a("dd", { className: "type-metric ds:text-foreground", children:
|
|
154
|
+
/* @__PURE__ */ a("dd", { className: "type-metric ds:text-foreground", children: i.format(t.dueDate) })
|
|
148
155
|
] })
|
|
149
156
|
] }),
|
|
150
157
|
D === "copy" || p ? /* @__PURE__ */ a(
|
|
@@ -156,11 +163,16 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
156
163
|
onError: N,
|
|
157
164
|
card: {
|
|
158
165
|
title: e("insert.title.dueDate"),
|
|
159
|
-
highlight:
|
|
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,
|
|
160
172
|
fields: [
|
|
161
173
|
{
|
|
162
174
|
label: e("dueDateCalculator.result.dueDateLabel"),
|
|
163
|
-
value:
|
|
175
|
+
value: i.format(t.dueDate)
|
|
164
176
|
},
|
|
165
177
|
{
|
|
166
178
|
label: e("dueDateCalculator.result.gestationLabel"),
|
|
@@ -185,8 +197,8 @@ const H = S("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
|
|
|
185
197
|
);
|
|
186
198
|
}
|
|
187
199
|
);
|
|
188
|
-
|
|
200
|
+
U.displayName = "DueDateCalculator";
|
|
189
201
|
export {
|
|
190
|
-
|
|
202
|
+
U as D
|
|
191
203
|
};
|
|
192
|
-
//# sourceMappingURL=due-date-calculator-
|
|
204
|
+
//# sourceMappingURL=due-date-calculator-CYXKLoof.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
|