@alfadocs/ui-kit-debug 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.
Files changed (61) hide show
  1. package/dist/_chunks/{bmi-calculator-DuVSFDuw.js → bmi-calculator-DFPWL2OJ.js} +92 -78
  2. package/dist/_chunks/bmi-calculator-DFPWL2OJ.js.map +1 -0
  3. package/dist/_chunks/{calculator-dialog-DdexHrTP.js → calculator-dialog-D-nfvteH.js} +2 -2
  4. package/dist/_chunks/{calculator-dialog-DdexHrTP.js.map → calculator-dialog-D-nfvteH.js.map} +1 -1
  5. package/dist/_chunks/{cycle-calculator-Dln-y1k_.js → cycle-calculator-ChHBcjet.js} +58 -50
  6. package/dist/_chunks/cycle-calculator-ChHBcjet.js.map +1 -0
  7. package/dist/_chunks/dialog-BTpZV6It.js +223 -0
  8. package/dist/_chunks/dialog-BTpZV6It.js.map +1 -0
  9. package/dist/_chunks/{due-date-calculator-Cc4dRqTI.js → due-date-calculator-CYXKLoof.js} +50 -38
  10. package/dist/_chunks/due-date-calculator-CYXKLoof.js.map +1 -0
  11. package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js +190 -0
  12. package/dist/_chunks/gestational-age-calculator-sRmoqgVr.js.map +1 -0
  13. package/dist/_chunks/insert-result-CoC1oo6R.js +334 -0
  14. package/dist/_chunks/insert-result-CoC1oo6R.js.map +1 -0
  15. package/dist/_chunks/{pregnancy-weight-gain-zZL5Ir2-.js → pregnancy-weight-gain-C5YhfYnL.js} +66 -57
  16. package/dist/_chunks/pregnancy-weight-gain-C5YhfYnL.js.map +1 -0
  17. package/dist/_chunks/{unit-converter-CuXCXJhK.js → unit-converter-Ds9jalbN.js} +78 -67
  18. package/dist/_chunks/unit-converter-Ds9jalbN.js.map +1 -0
  19. package/dist/agent-catalog.json +1 -1
  20. package/dist/components/_shared/index.d.ts +1 -1
  21. package/dist/components/_shared/index.d.ts.map +1 -1
  22. package/dist/components/_shared/insert-result.d.ts +100 -10
  23. package/dist/components/_shared/insert-result.d.ts.map +1 -1
  24. package/dist/components/bmi-calculator/bmi-calculator.d.ts +6 -0
  25. package/dist/components/bmi-calculator/bmi-calculator.d.ts.map +1 -1
  26. package/dist/components/bmi-calculator/index.js +1 -1
  27. package/dist/components/calculator-dialog/index.js +1 -1
  28. package/dist/components/cycle-calculator/cycle-calculator.d.ts +6 -0
  29. package/dist/components/cycle-calculator/cycle-calculator.d.ts.map +1 -1
  30. package/dist/components/cycle-calculator/index.js +1 -1
  31. package/dist/components/dialog/dialog.d.ts +1 -0
  32. package/dist/components/dialog/dialog.d.ts.map +1 -1
  33. package/dist/components/dialog/index.js +1 -1
  34. package/dist/components/due-date-calculator/due-date-calculator.d.ts +6 -0
  35. package/dist/components/due-date-calculator/due-date-calculator.d.ts.map +1 -1
  36. package/dist/components/due-date-calculator/index.js +1 -1
  37. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +6 -0
  38. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts.map +1 -1
  39. package/dist/components/gestational-age-calculator/index.js +1 -1
  40. package/dist/components/index.d.ts +1 -1
  41. package/dist/components/index.d.ts.map +1 -1
  42. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  43. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +6 -0
  44. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts.map +1 -1
  45. package/dist/components/unit-converter/index.js +1 -1
  46. package/dist/components/unit-converter/unit-converter.d.ts +6 -0
  47. package/dist/components/unit-converter/unit-converter.d.ts.map +1 -1
  48. package/dist/index.js +494 -493
  49. package/dist/tokens.css +1 -1
  50. package/package.json +1 -1
  51. package/dist/_chunks/bmi-calculator-DuVSFDuw.js.map +0 -1
  52. package/dist/_chunks/cycle-calculator-Dln-y1k_.js.map +0 -1
  53. package/dist/_chunks/dialog-DOYgd75U.js +0 -224
  54. package/dist/_chunks/dialog-DOYgd75U.js.map +0 -1
  55. package/dist/_chunks/due-date-calculator-Cc4dRqTI.js.map +0 -1
  56. package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js +0 -179
  57. package/dist/_chunks/gestational-age-calculator-ZMSrzkRW.js.map +0 -1
  58. package/dist/_chunks/insert-result-DisOY2G-.js +0 -243
  59. package/dist/_chunks/insert-result-DisOY2G-.js.map +0 -1
  60. package/dist/_chunks/pregnancy-weight-gain-zZL5Ir2-.js.map +0 -1
  61. package/dist/_chunks/unit-converter-CuXCXJhK.js.map +0 -1
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gestational-age-calculator-sRmoqgVr.js","sources":["../../src/components/gestational-age-calculator/gestational-age-calculator.tsx"],"sourcesContent":["/* ------------------------------------------------------------------ */\n/* GestationalAgeCalculator — current gestational age, trimester and */\n/* milestone dates, from either a known LMP or a known due date. */\n/* */\n/* Reuses the shared `gestation` maths from due-date-calculator: GA day */\n/* 0 is the LMP; from an EDD we back out LMP = EDD − 280 days. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { subDays, isAfter } from 'date-fns';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\nimport { Card } from '../card';\nimport { Badge } from '../badge';\nimport {\n InsertButton,\n type InsertPayload,\n type InsertVariant,\n type InsertMode,\n} from '../_shared/insert-result';\nimport {\n type Trimester,\n type GestationalAge,\n computeDueDate,\n gestationalMilestones,\n GESTATION_DAYS,\n} from '../due-date-calculator';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\nconst TRIMESTER_BADGE: Record<\n Trimester,\n 'neutral' | 'info' | 'success' | 'warning' | 'error'\n> = {\n preconception: 'neutral',\n first: 'info',\n second: 'success',\n third: 'warning',\n postterm: 'error',\n};\n\n/**\n * DS token NAME backing each trimester's result-card chip — the solid-fill\n * companion of the on-screen `TRIMESTER_BADGE` variant (Badge `error` fills\n * `--destructive`; `neutral` fills `--muted`). Passed as the card's\n * `highlightToken` so the inserted PNG chip matches the on-screen trimester\n * badge; `InsertButton` resolves the name to a concrete colour at raster time.\n */\nconst TRIMESTER_HIGHLIGHT_TOKEN: Record<Trimester, string> = {\n preconception: '--muted',\n first: '--info',\n second: '--success',\n third: '--warning',\n postterm: '--destructive',\n};\n\ntype DateMethod = 'lmp' | 'edd';\n\nexport interface GestationalAgeResult {\n gestationalAge: GestationalAge | null;\n trimester: Trimester;\n dueDate: Date;\n}\n\nexport interface GestationalAgeCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Whether the input date is the last period (`lmp`) or the due date (`edd`). */\n defaultMethod?: DateMethod;\n /** Fires whenever a result can be computed (and `null` when it can't). */\n onResultChange?: (result: GestationalAgeResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Which verb the result button performs. Defaults to `'insert'`.\n * Use `'copy'` in an app-shell surface (no editor to insert into) — the\n * button writes the result to the clipboard as a multi-format `ClipboardItem`.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → the default `'AlfaDocs'` wordmark; a string overrides it;\n * `false` removes the brand line.\n */\n insertBrand?: string | false;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport const GestationalAgeCalculator = forwardRef<\n HTMLDivElement,\n GestationalAgeCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n\n const today = useMemo(() => new Date(), []);\n\n const data = useMemo(() => {\n if (!refDate) return null;\n // Normalise to an LMP, then reuse the shared gestation maths.\n const lmp = method === 'lmp' ? refDate : subDays(refDate, GESTATION_DAYS);\n const r = computeDueDate({ method: 'lmp', date: lmp }, today);\n return {\n result: {\n gestationalAge: r.gestationalAge,\n trimester: r.trimester,\n dueDate: r.dueDate,\n } satisfies GestationalAgeResult,\n milestones: gestationalMilestones(r.gestationalStart),\n };\n }, [method, refDate, today]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(data?.result ?? null);\n }, [data, onResultChange]);\n\n const gaText = (ga: GestationalAge | null): string =>\n ga\n ? t('gestationalAgeCalculator.gestation', {\n weeks: ga.weeks,\n days: ga.days,\n })\n : '—';\n\n return (\n <div\n ref={ref}\n data-component=\"gestational-age-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('gestationalAgeCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DateMethod)}\n >\n <Radio label={t('gestationalAgeCalculator.method.lmp')} value=\"lmp\" />\n <Radio label={t('gestationalAgeCalculator.method.edd')} value=\"edd\" />\n </RadioGroup>\n\n <FormField\n label={t(\n method === 'lmp'\n ? 'gestationalAgeCalculator.lmpDate'\n : 'gestationalAgeCalculator.eddDate',\n )}\n >\n <DatePicker\n value={refDate}\n onChange={setRefDate}\n maxDate={method === 'lmp' ? today : undefined}\n />\n </FormField>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {data\n ? `${t('gestationalAgeCalculator.gestationLabel')}: ${gaText(\n data.result.gestationalAge,\n )}. ${t('gestationalAgeCalculator.trimesterLabel')}: ${t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n )}.`\n : ''}\n </p>\n\n {data ? (\n <Card variant=\"elevated\">\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n <dl className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE[data.result.trimester]}\n size=\"lg\"\n >\n {t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n )}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-end ds:gap-[var(--spacing-xs)] ds:text-end\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.gestationLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {gaText(data.result.gestationalAge)}\n </dd>\n </div>\n </dl>\n\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.milestonesLabel')}\n </span>\n <ul className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n {data.milestones.map((m) => {\n const reached = isAfter(today, m.date);\n return (\n <li\n key={m.key}\n className=\"ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-md)]\"\n >\n <span className=\"type-body ds:text-foreground\">\n {t(`gestationalAgeCalculator.milestone.${m.key}`)}\n </span>\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"type-body ds:text-muted-foreground\">\n {dateFormatter.format(m.date)}\n </span>\n {reached ? (\n <Badge variant=\"success\">\n {t('gestationalAgeCalculator.reached')}\n </Badge>\n ) : null}\n </span>\n </li>\n );\n })}\n </ul>\n </div>\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n onInsert={onInsert}\n variant={insertVariant}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.gestationalAge'),\n highlight: t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n ),\n // Chip shares the trimester's semantic token so the\n // inserted PNG chip matches the on-screen trimester badge.\n highlightToken:\n TRIMESTER_HIGHLIGHT_TOKEN[data.result.trimester],\n brand: insertBrand,\n fields: [\n {\n label: t('gestationalAgeCalculator.gestationLabel'),\n value: gaText(data.result.gestationalAge),\n },\n {\n label: t('gestationalAgeCalculator.trimesterLabel'),\n value: t(\n `gestationalAgeCalculator.trimester.${data.result.trimester}`,\n ),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('gestationalAgeCalculator.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nGestationalAgeCalculator.displayName = 'GestationalAgeCalculator';\n"],"names":["rootVariants","cva","TRIMESTER_BADGE","TRIMESTER_HIGHLIGHT_TOKEN","GestationalAgeCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","today","useMemo","data","lmp","subDays","GESTATION_DAYS","computeDueDate","gestationalMilestones","dateFormatter","useEffect","gaText","ga","jsxs","RadioGroup","next","jsx","Radio","FormField","DatePicker","Card","Badge","m","reached","isAfter","InsertButton"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAMA,IAAeC,EAAI,kDAAkD;AAAA,EACzE,UAAU;AAAA,IACR,OAAO,EAAE,MAAM,aAAa,MAAM,iBAAA;AAAA,EAAiB;AAAA,EAErD,iBAAiB,EAAE,OAAO,OAAA;AAC5B,CAAC,GAEKC,IAGF;AAAA,EACF,eAAe;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AACZ,GASMC,IAAuD;AAAA,EAC3D,eAAe;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AACZ,GAyCaC,IAA2BC;AAAA,EAItC,CACE;AAAA,IACE,eAAAC,IAAgB;AAAA,IAChB,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,IAAAC;AAAA,IACA,OAAAC;AAAA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E;AAAA,gBAAA;AAAA,cAkBb,CAAC,EAAA,CACH;AAAA,YAAA,GACF;AAAA,YACCrC,MAAkB,UAAUD,IAC3B,gBAAAgC;AAAA,cAACS;AAAA,cAAA;AAAA,gBACC,UAAAzC;AAAA,gBACA,SAASC;AAAA,gBACT,QAAAC;AAAA,gBACA,SAAAC;AAAA,gBACA,MAAM;AAAA,kBACJ,OAAOM,EAAE,6BAA6B;AAAA,kBACtC,WAAWA;AAAA,oBACT,sCAAsCU,EAAK,OAAO,SAAS;AAAA,kBAAA;AAAA;AAAA;AAAA,kBAI7D,gBACExB,EAA0BwB,EAAK,OAAO,SAAS;AAAA,kBACjD,OAAOf;AAAA,kBACP,QAAQ;AAAA,oBACN;AAAA,sBACE,OAAOK,EAAE,yCAAyC;AAAA,sBAClD,OAAOkB,EAAOR,EAAK,OAAO,cAAc;AAAA,oBAAA;AAAA,oBAE1C;AAAA,sBACE,OAAOV,EAAE,yCAAyC;AAAA,sBAClD,OAAOA;AAAA,wBACL,sCAAsCU,EAAK,OAAO,SAAS;AAAA,sBAAA;AAAA,oBAC7D;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAa,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAvB,EAAE,gCAAgC,EAAA,CACrC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAb,EAAyB,cAAc;"}
@@ -0,0 +1,334 @@
1
+ import { jsxs as E, jsx as p } from "react/jsx-runtime";
2
+ import { forwardRef as J, useRef as Q } from "react";
3
+ import { useTranslation as Z } from "react-i18next";
4
+ import { c as tt } from "./index-D2ZczOXr.js";
5
+ import { B as et } from "./button-DD_0Xdmr.js";
6
+ import { c as L } from "./createLucideIcon-CrFbzy84.js";
7
+ import { I as nt } 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 ot = [
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
+ ], at = L("layers", ot);
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 it = [
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
+ ], rt = L("type", it), st = ["fg", "muted", "accent", "border", "bg"], N = "--primary", D = 380, H = (t) => t.trim().replace(/^--/, "");
48
+ function R(t) {
49
+ const e = /* @__PURE__ */ new Set();
50
+ if (t.highlight) {
51
+ const o = t.highlightToken ?? N;
52
+ e.add(o), e.add(`${o}-foreground`);
53
+ }
54
+ return t.gauge && e.add(t.gauge.colorToken), [...e];
55
+ }
56
+ function M(t, e = []) {
57
+ const o = {
58
+ fg: "currentColor",
59
+ muted: "currentColor",
60
+ accent: "currentColor",
61
+ border: "currentColor",
62
+ bg: "transparent",
63
+ font: "sans-serif",
64
+ tokens: {}
65
+ };
66
+ if (!t) return o;
67
+ const n = (a) => {
68
+ const r = t.querySelector(`[data-k="${a}"]`);
69
+ return r && getComputedStyle(r).color || "currentColor";
70
+ }, i = {};
71
+ for (const a of e) {
72
+ const r = t.querySelector(
73
+ `[data-token="${H(a)}"]`
74
+ );
75
+ if (r) {
76
+ const u = getComputedStyle(r).color;
77
+ u && (i[a] = u);
78
+ }
79
+ }
80
+ return {
81
+ fg: n("fg"),
82
+ muted: n("muted"),
83
+ accent: n("accent"),
84
+ border: n("border"),
85
+ bg: n("bg"),
86
+ font: getComputedStyle(t).fontFamily || "sans-serif",
87
+ tokens: i
88
+ };
89
+ }
90
+ function _(t, e, o) {
91
+ var n;
92
+ return e ? ((n = t.tokens) == null ? void 0 : n[e]) ?? o : o;
93
+ }
94
+ const f = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
95
+ function O(t) {
96
+ const e = [t.title];
97
+ t.highlight && e.push(t.highlight);
98
+ for (const o of t.fields) e.push(`• ${o.label}: ${o.value}`);
99
+ return e.join(`
100
+ `);
101
+ }
102
+ function Y(t) {
103
+ const e = t.fields.map((n) => `<li>${f(n.label)}: ${f(n.value)}</li>`).join(""), o = t.highlight ? `<p><strong>${f(t.highlight)}</strong></p>` : "";
104
+ return `<p><strong>${f(t.title)}</strong></p>${o}<ul>${e}</ul>`;
105
+ }
106
+ const z = "AlfaDocs", m = 20, y = m + 18, T = 22, lt = 10, B = 22, S = 16, F = 12, ct = 12, V = 34, U = 9, k = (V + U) * 2;
107
+ function A(t, e) {
108
+ const o = e !== void 0 ? e : t.brand;
109
+ return o === !1 ? !1 : typeof o == "string" ? o : z;
110
+ }
111
+ function ut(t) {
112
+ if (typeof t.fraction == "number")
113
+ return Math.min(1, Math.max(0, t.fraction));
114
+ const e = parseFloat(t.value);
115
+ return Number.isFinite(e) && typeof t.max == "number" && t.max > 0 ? Math.min(1, Math.max(0, e / t.max)) : 1;
116
+ }
117
+ function W(t, e) {
118
+ const o = !!t.highlight, n = y + lt, i = (o ? n + T + S : y + S) + B - 6, a = i + Math.max(0, t.fields.length - 1) * B, r = o ? n : y, u = t.gauge ? r + k : 0, l = Math.max(a, u), c = e ? l + F + ct - 4 : l, d = Math.round(c + (e ? F : m));
119
+ return { hasChip: o, chipY: n, firstFieldY: i, fieldsEndY: a, footerY: c, height: d };
120
+ }
121
+ function q(t, e) {
122
+ return W(t, e !== !1).height;
123
+ }
124
+ function dt(t, e, o, n, i) {
125
+ const a = V, r = 2 * Math.PI * a, u = ut(t), l = _(e, t.colorToken, e.accent), c = typeof t.segments == "number" && t.segments > 1 ? t.segments : 0, d = c ? 3 : 0, g = c ? r / c - d : r, $ = c ? `${g} ${d}` : "", v = `${r * u} ${r}`, w = `transform="rotate(-90 ${n} ${i})"`, s = f(
126
+ t.label ? `${t.value} — ${t.label}` : t.value
127
+ ), x = `<circle cx="${n}" cy="${i}" r="${a}" fill="none" stroke="${e.border}" stroke-width="${U}"${$ ? ` stroke-dasharray="${$}"` : ""} ${w}/>`, h = `<circle cx="${n}" cy="${i}" r="${a}" fill="none" stroke="${l}" stroke-width="${U}" stroke-linecap="round" stroke-dasharray="${v}" ${w}/>`, b = `<text x="${n}" y="${i + 1}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="16" font-weight="700" fill="${e.fg}">${f(
128
+ t.value
129
+ )}</text>`, C = t.label ? `<text x="${n}" y="${i + 15}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="9" fill="${e.muted}">${f(
130
+ t.label
131
+ )}</text>` : "";
132
+ return `<g role="img" aria-label="${s}"><title>${s}</title>${x}${h}${b}${C}</g>`;
133
+ }
134
+ function ft(t, e, o, n) {
135
+ const i = t.highlight, a = t.highlightToken ?? N, r = _(e, a, e.accent), u = _(e, `${a}-foreground`, e.bg), l = Math.round(i.length * 7.2 + 28), c = m + l / 2, d = n + T / 2 + 1;
136
+ return `<rect x="${m}" y="${n}" width="${l}" height="${T}" rx="${T / 2}" fill="${r}"/><text x="${c}" y="${d}" text-anchor="middle" dominant-baseline="middle" font-family="${o}" font-size="12" font-weight="600" fill="${u}">${f(
137
+ i
138
+ )}</text>`;
139
+ }
140
+ function P(t, e, o = z) {
141
+ const n = D, i = W(t, o !== !1), a = i.height, r = f(e.font);
142
+ t.gauge ? n - m - k - 12 : n - m;
143
+ const u = t.fields.map((g, $) => {
144
+ const v = i.firstFieldY + $ * B;
145
+ return `<text x="${m}" y="${v}" font-family="${r}" font-size="13"><tspan fill="${e.muted}">${f(
146
+ g.label
147
+ )}: </tspan><tspan fill="${e.fg}">${f(g.value)}</tspan></text>`;
148
+ }).join(""), l = i.hasChip ? ft(t, e, r, i.chipY) : "", c = t.gauge ? dt(
149
+ t.gauge,
150
+ e,
151
+ r,
152
+ n - m - k / 2,
153
+ (i.hasChip ? i.chipY : y) + k / 2
154
+ ) : "", d = o !== !1 ? `<text x="${m}" y="${i.footerY}" font-family="${r}" font-size="10" fill="${e.muted}">${f(
155
+ o
156
+ )}</text>` : "";
157
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${a}" viewBox="0 0 ${n} ${a}" role="img" aria-label="${f(
158
+ t.title
159
+ )}"><rect x="0.5" y="0.5" width="${n - 1}" height="${a - 1}" rx="12" fill="${e.bg}" stroke="${e.border}"/><text x="${m}" y="${y}" font-family="${r}" font-size="16" font-weight="700" fill="${e.fg}">${f(
160
+ t.title
161
+ )}</text>${l}${c}${u}${d}</svg>`;
162
+ }
163
+ function mt() {
164
+ var t;
165
+ return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
166
+ }
167
+ function j(t, e, o) {
168
+ return new Promise((n, i) => {
169
+ const a = new Image();
170
+ a.decoding = "async", a.onload = () => {
171
+ const r = document.createElement("canvas");
172
+ r.width = e, r.height = o;
173
+ const u = r.getContext("2d");
174
+ if (!u) {
175
+ i(new Error("2D canvas context unavailable"));
176
+ return;
177
+ }
178
+ u.drawImage(a, 0, 0, e, o), r.toBlob((l) => {
179
+ l ? n(l) : i(new Error("canvas.toBlob produced no PNG"));
180
+ }, "image/png");
181
+ }, a.onerror = () => i(new Error("SVG failed to decode as an image")), a.src = t;
182
+ });
183
+ }
184
+ function K() {
185
+ const t = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
186
+ return Math.max(2, t);
187
+ }
188
+ async function Mt(t, e = {}) {
189
+ return (await X(t, e)).dataUri;
190
+ }
191
+ async function X(t, e = {}) {
192
+ const { colours: o, scale: n = K() } = e, i = o ?? M(null), a = A(t, e.brand), r = P(t, i, a), u = `data:image/svg+xml,${encodeURIComponent(r)}`, l = D, c = q(t, a), d = await j(
193
+ u,
194
+ Math.round(l * n),
195
+ Math.round(c * n)
196
+ );
197
+ return { dataUri: await gt(d), width: l, height: c };
198
+ }
199
+ function gt(t) {
200
+ return new Promise((e, o) => {
201
+ const n = new FileReader();
202
+ n.onload = () => e(String(n.result)), n.onerror = () => o(n.error ?? new Error("FileReader error")), n.readAsDataURL(t);
203
+ });
204
+ }
205
+ async function ht(t, e, o) {
206
+ const n = O(e), i = new Blob([n], { type: "text/plain" });
207
+ if (t === "text")
208
+ return new ClipboardItem({ "text/plain": i });
209
+ const a = A(e, void 0), r = P(e, o, a), u = `data:image/svg+xml,${encodeURIComponent(r)}`, l = K(), c = await j(
210
+ u,
211
+ Math.round(D * l),
212
+ Math.round(q(e, a) * l)
213
+ );
214
+ if (t === "image")
215
+ return new ClipboardItem({ "image/png": c, "text/plain": i });
216
+ const d = new Blob([Y(e)], { type: "text/html" });
217
+ return new ClipboardItem({
218
+ "text/html": d,
219
+ "image/png": c,
220
+ "text/plain": i
221
+ });
222
+ }
223
+ const pt = tt(
224
+ "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
225
+ {
226
+ variants: {
227
+ variant: {
228
+ insert: "",
229
+ copy: ""
230
+ }
231
+ },
232
+ defaultVariants: { variant: "insert" }
233
+ }
234
+ ), $t = ["text", "image", "text-image"], xt = {
235
+ text: /* @__PURE__ */ p(rt, { "aria-hidden": !0 }),
236
+ image: /* @__PURE__ */ p(nt, { "aria-hidden": !0 }),
237
+ "text-image": /* @__PURE__ */ p(at, { "aria-hidden": !0 })
238
+ }, G = {
239
+ insert: {
240
+ text: "insert.text",
241
+ image: "insert.image",
242
+ "text-image": "insert.textImage"
243
+ },
244
+ copy: {
245
+ text: "insert.copyText",
246
+ image: "insert.copyImage",
247
+ "text-image": "insert.copyTextImage"
248
+ }
249
+ }, bt = J(
250
+ function({
251
+ card: e,
252
+ variant: o = "insert",
253
+ onInsert: n,
254
+ onCopy: i,
255
+ onError: a,
256
+ size: r = "sm",
257
+ intent: u = "primary"
258
+ }, l) {
259
+ const { t: c } = Z(), d = Q(null), g = (s) => {
260
+ const x = O(e), h = Y(e);
261
+ let b = "", C = "";
262
+ const I = s === "text" ? null : M(d.current, R(e));
263
+ return I && (b = P(e, I, A(e, void 0)), C = `data:image/svg+xml,${encodeURIComponent(b)}`), { mode: s, text: x, html: h, svg: b, imageDataUri: C, pngDataUri: () => I ? X(e, { colours: I }) : Promise.resolve({ dataUri: "", width: 0, height: 0 }) };
264
+ }, w = o === "copy" ? (s) => {
265
+ if (!mt()) {
266
+ a == null || a(new Error("Clipboard write unavailable in this context"));
267
+ return;
268
+ }
269
+ const x = M(
270
+ d.current,
271
+ R(e)
272
+ );
273
+ (async () => {
274
+ try {
275
+ const h = await ht(s, e, x);
276
+ await navigator.clipboard.write([h]), i == null || i(s);
277
+ } catch (h) {
278
+ a == null || a(h);
279
+ }
280
+ })();
281
+ } : (s) => {
282
+ n == null || n(g(s));
283
+ };
284
+ return /* @__PURE__ */ E(
285
+ "div",
286
+ {
287
+ ref: l,
288
+ "data-component": "insert-result",
289
+ "data-variant": o,
290
+ className: pt({ variant: o }),
291
+ children: [
292
+ /* @__PURE__ */ E("span", { ref: d, "aria-hidden": !0, className: "ds:sr-only", children: [
293
+ st.map((s) => /* @__PURE__ */ p(
294
+ "span",
295
+ {
296
+ "data-k": s,
297
+ className: s === "fg" ? "ds:text-foreground" : s === "muted" ? "ds:text-muted-foreground" : s === "accent" ? "ds:text-[color:var(--primary)]" : s === "border" ? "ds:text-[color:var(--border)]" : "ds:text-[color:var(--card)]"
298
+ },
299
+ s
300
+ )),
301
+ R(e).map((s) => /* @__PURE__ */ p(
302
+ "span",
303
+ {
304
+ "data-token": H(s),
305
+ className: `ds:text-[color:var(${s})]`
306
+ },
307
+ s
308
+ ))
309
+ ] }),
310
+ $t.map((s) => /* @__PURE__ */ p(
311
+ et,
312
+ {
313
+ type: "button",
314
+ intent: u,
315
+ size: r,
316
+ startIcon: xt[s],
317
+ "aria-label": c(G[o][s]),
318
+ onClick: () => w(s),
319
+ children: c(G[o][s])
320
+ },
321
+ s
322
+ ))
323
+ ]
324
+ }
325
+ );
326
+ }
327
+ );
328
+ bt.displayName = "InsertButton";
329
+ export {
330
+ bt as I,
331
+ Mt as a,
332
+ X as s
333
+ };
334
+ //# sourceMappingURL=insert-result-CoC1oo6R.js.map