@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
package/package.json
CHANGED
|
@@ -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
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { jsxs as M, jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as S, useRef as T } from "react";
|
|
3
|
-
import { useTranslation as z } from "react-i18next";
|
|
4
|
-
import { c as N } from "./index-D2ZczOXr.js";
|
|
5
|
-
import { B as _ } from "./button-DD_0Xdmr.js";
|
|
6
|
-
import { c as D } from "./createLucideIcon-CrFbzy84.js";
|
|
7
|
-
import { I as k } from "./image-C6RM5hfF.js";
|
|
8
|
-
/**
|
|
9
|
-
* @license lucide-react v1.8.0 - ISC
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the ISC license.
|
|
12
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/
|
|
14
|
-
const E = [
|
|
15
|
-
[
|
|
16
|
-
"path",
|
|
17
|
-
{
|
|
18
|
-
d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
|
|
19
|
-
key: "zw3jo"
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
[
|
|
23
|
-
"path",
|
|
24
|
-
{
|
|
25
|
-
d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
|
|
26
|
-
key: "1wduqc"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
[
|
|
30
|
-
"path",
|
|
31
|
-
{
|
|
32
|
-
d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
|
|
33
|
-
key: "kqbvx6"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
], F = D("layers", E);
|
|
37
|
-
/**
|
|
38
|
-
* @license lucide-react v1.8.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/
|
|
43
|
-
const L = [
|
|
44
|
-
["path", { d: "M12 4v16", key: "1654pz" }],
|
|
45
|
-
["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
|
|
46
|
-
["path", { d: "M9 20h6", key: "s66wpe" }]
|
|
47
|
-
], H = D("type", L), V = ["fg", "muted", "accent", "border", "bg"], w = 380;
|
|
48
|
-
function v(t) {
|
|
49
|
-
const e = {
|
|
50
|
-
fg: "currentColor",
|
|
51
|
-
muted: "currentColor",
|
|
52
|
-
accent: "currentColor",
|
|
53
|
-
border: "currentColor",
|
|
54
|
-
bg: "transparent",
|
|
55
|
-
font: "sans-serif"
|
|
56
|
-
};
|
|
57
|
-
if (!t) return e;
|
|
58
|
-
const n = (o) => {
|
|
59
|
-
const a = t.querySelector(`[data-k="${o}"]`);
|
|
60
|
-
return a && getComputedStyle(a).color || "currentColor";
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
fg: n("fg"),
|
|
64
|
-
muted: n("muted"),
|
|
65
|
-
accent: n("accent"),
|
|
66
|
-
border: n("border"),
|
|
67
|
-
bg: n("bg"),
|
|
68
|
-
font: getComputedStyle(t).fontFamily || "sans-serif"
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
const g = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
72
|
-
function R(t) {
|
|
73
|
-
const e = [t.title];
|
|
74
|
-
t.highlight && e.push(t.highlight);
|
|
75
|
-
for (const n of t.fields) e.push(`• ${n.label}: ${n.value}`);
|
|
76
|
-
return e.join(`
|
|
77
|
-
`);
|
|
78
|
-
}
|
|
79
|
-
function P(t) {
|
|
80
|
-
const e = t.fields.map((o) => `<li>${g(o.label)}: ${g(o.value)}</li>`).join(""), n = t.highlight ? `<p><strong>${g(t.highlight)}</strong></p>` : "";
|
|
81
|
-
return `<p><strong>${g(t.title)}</strong></p>${n}<ul>${e}</ul>`;
|
|
82
|
-
}
|
|
83
|
-
function U(t) {
|
|
84
|
-
return (t.highlight ? 62 : 38) + 28 + t.fields.length * 22 + 8 + 20;
|
|
85
|
-
}
|
|
86
|
-
function C(t, e) {
|
|
87
|
-
const n = w, o = 20, a = o + 18, r = !!t.highlight, s = a + 24, l = (r ? s : a) + 28, c = 22, u = l + t.fields.length * c + 8, h = u + o, p = g(e.font), I = t.fields.map((i, x) => {
|
|
88
|
-
const d = l + x * c;
|
|
89
|
-
return `<text x="${o}" y="${d}" font-family="${p}" font-size="13"><tspan fill="${e.muted}">${g(
|
|
90
|
-
i.label
|
|
91
|
-
)}: </tspan><tspan fill="${e.fg}">${g(i.value)}</tspan></text>`;
|
|
92
|
-
}).join(""), b = r ? `<text x="${o}" y="${s}" font-family="${p}" font-size="14" font-weight="600" fill="${e.accent}">${g(
|
|
93
|
-
t.highlight
|
|
94
|
-
)}</text>` : "";
|
|
95
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${h}" viewBox="0 0 ${n} ${h}" role="img" aria-label="${g(
|
|
96
|
-
t.title
|
|
97
|
-
)}"><rect x="0.5" y="0.5" width="${n - 1}" height="${h - 1}" rx="12" fill="${e.bg}" stroke="${e.border}"/><text x="${o}" y="${a}" font-family="${p}" font-size="16" font-weight="700" fill="${e.fg}">${g(
|
|
98
|
-
t.title
|
|
99
|
-
)}</text>${b}${I}<text x="${o}" y="${u}" font-family="${p}" font-size="10" fill="${e.muted}">AlfaDocs</text></svg>`;
|
|
100
|
-
}
|
|
101
|
-
function j() {
|
|
102
|
-
var t;
|
|
103
|
-
return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
|
|
104
|
-
}
|
|
105
|
-
function A(t, e, n) {
|
|
106
|
-
return new Promise((o, a) => {
|
|
107
|
-
const r = new Image();
|
|
108
|
-
r.decoding = "async", r.onload = () => {
|
|
109
|
-
const s = document.createElement("canvas");
|
|
110
|
-
s.width = e, s.height = n;
|
|
111
|
-
const l = s.getContext("2d");
|
|
112
|
-
if (!l) {
|
|
113
|
-
a(new Error("2D canvas context unavailable"));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
l.drawImage(r, 0, 0, e, n), s.toBlob((c) => {
|
|
117
|
-
c ? o(c) : a(new Error("canvas.toBlob produced no PNG"));
|
|
118
|
-
}, "image/png");
|
|
119
|
-
}, r.onerror = () => a(new Error("SVG failed to decode as an image")), r.src = t;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
async function q(t, e = {}) {
|
|
123
|
-
const { colours: n, scale: o = 1 } = e, a = n ?? v(null), r = C(t, a), s = `data:image/svg+xml,${encodeURIComponent(r)}`, l = Math.round(w * o), c = Math.round(U(t) * o), m = await A(s, l, c);
|
|
124
|
-
return O(m);
|
|
125
|
-
}
|
|
126
|
-
function O(t) {
|
|
127
|
-
return new Promise((e, n) => {
|
|
128
|
-
const o = new FileReader();
|
|
129
|
-
o.onload = () => e(String(o.result)), o.onerror = () => n(o.error ?? new Error("FileReader error")), o.readAsDataURL(t);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
async function G(t, e, n) {
|
|
133
|
-
const o = R(e), a = new Blob([o], { type: "text/plain" });
|
|
134
|
-
if (t === "text")
|
|
135
|
-
return new ClipboardItem({ "text/plain": a });
|
|
136
|
-
const r = C(e, n), s = `data:image/svg+xml,${encodeURIComponent(r)}`, l = await A(s, w, U(e));
|
|
137
|
-
if (t === "image")
|
|
138
|
-
return new ClipboardItem({ "image/png": l, "text/plain": a });
|
|
139
|
-
const c = new Blob([P(e)], { type: "text/html" });
|
|
140
|
-
return new ClipboardItem({
|
|
141
|
-
"text/html": c,
|
|
142
|
-
"image/png": l,
|
|
143
|
-
"text/plain": a
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const W = N(
|
|
147
|
-
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
148
|
-
{
|
|
149
|
-
variants: {
|
|
150
|
-
variant: {
|
|
151
|
-
insert: "",
|
|
152
|
-
copy: ""
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
defaultVariants: { variant: "insert" }
|
|
156
|
-
}
|
|
157
|
-
), K = ["text", "image", "text-image"], X = {
|
|
158
|
-
text: /* @__PURE__ */ f(H, { "aria-hidden": !0 }),
|
|
159
|
-
image: /* @__PURE__ */ f(k, { "aria-hidden": !0 }),
|
|
160
|
-
"text-image": /* @__PURE__ */ f(F, { "aria-hidden": !0 })
|
|
161
|
-
}, B = {
|
|
162
|
-
insert: {
|
|
163
|
-
text: "insert.text",
|
|
164
|
-
image: "insert.image",
|
|
165
|
-
"text-image": "insert.textImage"
|
|
166
|
-
},
|
|
167
|
-
copy: {
|
|
168
|
-
text: "insert.copyText",
|
|
169
|
-
image: "insert.copyImage",
|
|
170
|
-
"text-image": "insert.copyTextImage"
|
|
171
|
-
}
|
|
172
|
-
}, J = S(
|
|
173
|
-
function({
|
|
174
|
-
card: e,
|
|
175
|
-
variant: n = "insert",
|
|
176
|
-
onInsert: o,
|
|
177
|
-
onCopy: a,
|
|
178
|
-
onError: r,
|
|
179
|
-
size: s = "sm",
|
|
180
|
-
intent: l = "primary"
|
|
181
|
-
}, c) {
|
|
182
|
-
const { t: m } = z(), u = T(null), h = (i) => {
|
|
183
|
-
const x = R(e), d = P(e);
|
|
184
|
-
let y = "", Y = "";
|
|
185
|
-
const $ = i === "text" ? null : v(u.current);
|
|
186
|
-
return $ && (y = C(e, $), Y = `data:image/svg+xml,${encodeURIComponent(y)}`), { mode: i, text: x, html: d, svg: y, imageDataUri: Y, pngDataUri: () => $ ? q(e, { colours: $ }) : Promise.resolve("") };
|
|
187
|
-
}, b = n === "copy" ? (i) => {
|
|
188
|
-
if (!j()) {
|
|
189
|
-
r == null || r(new Error("Clipboard write unavailable in this context"));
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const x = v(u.current);
|
|
193
|
-
(async () => {
|
|
194
|
-
try {
|
|
195
|
-
const d = await G(i, e, x);
|
|
196
|
-
await navigator.clipboard.write([d]), a == null || a(i);
|
|
197
|
-
} catch (d) {
|
|
198
|
-
r == null || r(d);
|
|
199
|
-
}
|
|
200
|
-
})();
|
|
201
|
-
} : (i) => {
|
|
202
|
-
o == null || o(h(i));
|
|
203
|
-
};
|
|
204
|
-
return /* @__PURE__ */ M(
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
ref: c,
|
|
208
|
-
"data-component": "insert-result",
|
|
209
|
-
"data-variant": n,
|
|
210
|
-
className: W({ variant: n }),
|
|
211
|
-
children: [
|
|
212
|
-
/* @__PURE__ */ f("span", { ref: u, "aria-hidden": !0, className: "ds:sr-only", children: V.map((i) => /* @__PURE__ */ f(
|
|
213
|
-
"span",
|
|
214
|
-
{
|
|
215
|
-
"data-k": i,
|
|
216
|
-
className: i === "fg" ? "ds:text-foreground" : i === "muted" ? "ds:text-muted-foreground" : i === "accent" ? "ds:text-[color:var(--primary)]" : i === "border" ? "ds:text-[color:var(--border)]" : "ds:text-[color:var(--card)]"
|
|
217
|
-
},
|
|
218
|
-
i
|
|
219
|
-
)) }),
|
|
220
|
-
K.map((i) => /* @__PURE__ */ f(
|
|
221
|
-
_,
|
|
222
|
-
{
|
|
223
|
-
type: "button",
|
|
224
|
-
intent: l,
|
|
225
|
-
size: s,
|
|
226
|
-
startIcon: X[i],
|
|
227
|
-
"aria-label": m(B[n][i]),
|
|
228
|
-
onClick: () => b(i),
|
|
229
|
-
children: m(B[n][i])
|
|
230
|
-
},
|
|
231
|
-
i
|
|
232
|
-
))
|
|
233
|
-
]
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
J.displayName = "InsertButton";
|
|
239
|
-
export {
|
|
240
|
-
J as I,
|
|
241
|
-
q as s
|
|
242
|
-
};
|
|
243
|
-
//# sourceMappingURL=insert-result-DisOY2G-.js.map
|