@alfadocs/ui-kit-debug 1.4.12 → 1.4.13
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/actions-cell-renderer-BD-jruqA.js +1784 -0
- package/dist/_chunks/actions-cell-renderer-BD-jruqA.js.map +1 -0
- package/dist/_chunks/{anamnesis-summary-rows-DAIpD0Or.js → anamnesis-summary-rows-B5MAYkJ-.js} +2150 -2092
- package/dist/_chunks/anamnesis-summary-rows-B5MAYkJ-.js.map +1 -0
- package/dist/_chunks/{bmi-calculator-CxPn0T0s.js → bmi-calculator-DC5SaqXT.js} +2 -2
- package/dist/_chunks/{bmi-calculator-CxPn0T0s.js.map → bmi-calculator-DC5SaqXT.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-D9M7IKfh.js → cycle-calculator-B_NlctlQ.js} +2 -2
- package/dist/_chunks/{cycle-calculator-D9M7IKfh.js.map → cycle-calculator-B_NlctlQ.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-BkqZEvL4.js → due-date-calculator-le1z3KpW.js} +2 -2
- package/dist/_chunks/{due-date-calculator-BkqZEvL4.js.map → due-date-calculator-le1z3KpW.js.map} +1 -1
- package/dist/_chunks/{fetal-weight-C7JXGg6E.js → fetal-weight-DXA6ZpMq.js} +2 -2
- package/dist/_chunks/{fetal-weight-C7JXGg6E.js.map → fetal-weight-DXA6ZpMq.js.map} +1 -1
- package/dist/_chunks/{file-manager-DzWYcRpE.js → file-manager-BjCM2fZB.js} +2 -2
- package/dist/_chunks/{file-manager-DzWYcRpE.js.map → file-manager-BjCM2fZB.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js → hcg-doubling-BT6lki_i.js} +2 -2
- package/dist/_chunks/{hcg-doubling-CFJlMH7Z.js.map → hcg-doubling-BT6lki_i.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-DCCca2m3.js → link-cell-renderer-C7GvyK66.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-DCCca2m3.js.map → link-cell-renderer-C7GvyK66.js.map} +1 -1
- package/dist/_chunks/number-input-CM1q9zvH.js +414 -0
- package/dist/_chunks/number-input-CM1q9zvH.js.map +1 -0
- package/dist/_chunks/{optical-prescription-Brs0CeP3.js → optical-prescription-CQR_WJiS.js} +2 -2
- package/dist/_chunks/{optical-prescription-Brs0CeP3.js.map → optical-prescription-CQR_WJiS.js.map} +1 -1
- package/dist/_chunks/{patient-details-CGhnfdUB.js → patient-details-CnFgF3MU.js} +2 -2
- package/dist/_chunks/{patient-details-CGhnfdUB.js.map → patient-details-CnFgF3MU.js.map} +1 -1
- package/dist/_chunks/{patient-table-D2fhV4mV.js → patient-table-BXzcrC79.js} +3 -3
- package/dist/_chunks/{patient-table-D2fhV4mV.js.map → patient-table-BXzcrC79.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js → pregnancy-dating-4tPV_Yko.js} +2 -2
- package/dist/_chunks/{pregnancy-dating-iI6_j2K2.js.map → pregnancy-dating-4tPV_Yko.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js → pregnancy-weight-gain-BBgbWBGe.js} +2 -2
- package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js.map → pregnancy-weight-gain-BBgbWBGe.js.map} +1 -1
- package/dist/_chunks/{signature-status-chip-DUcTgQ0E.js → signature-status-chip-DlLJk1VA.js} +16 -14
- package/dist/_chunks/signature-status-chip-DlLJk1VA.js.map +1 -0
- package/dist/_chunks/{unit-converter-BeTicruA.js → unit-converter-Dsk__pjA.js} +2 -2
- package/dist/_chunks/{unit-converter-BeTicruA.js.map → unit-converter-Dsk__pjA.js.map} +1 -1
- package/dist/agent-catalog.json +14 -8
- package/dist/agent-i18n/en.json +3 -2
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/data-table.agent.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +19 -0
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/expanded-row-renderer.d.ts +47 -0
- package/dist/components/data-table/expanded-row-renderer.d.ts.map +1 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +31 -27
- package/dist/components/due-date-calculator/index.js +1 -1
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/number-input.d.ts +11 -0
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/signature-status-chip/index.js +1 -1
- package/dist/components/signature-status-chip/signature-status-chip.d.ts.map +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/host-compat.css +4 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +1 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +1 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +1 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +1 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +1 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +1 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +1 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +1 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +1 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +1 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +1 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +1 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +779 -775
- package/dist/locales/ar.json +1 -0
- package/dist/locales/de.json +1 -0
- package/dist/locales/el.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/hi.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/locales/ja.json +1 -0
- package/dist/locales/nl.json +1 -0
- package/dist/locales/pl.json +1 -0
- package/dist/locales/pt.json +1 -0
- package/dist/locales/ro.json +1 -0
- package/dist/locales/ru.json +1 -0
- package/dist/locales/sq.json +1 -0
- package/dist/locales/sv.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/locales/zh.json +1 -0
- package/dist/patterns/anamnesis/anamnesis-evolution.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-field.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-i18n.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts +5 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts.map +1 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/tokens.css +5 -2
- package/package.json +1 -1
- package/dist/_chunks/actions-cell-renderer-C67oj7mR.js +0 -1581
- package/dist/_chunks/actions-cell-renderer-C67oj7mR.js.map +0 -1
- package/dist/_chunks/anamnesis-summary-rows-DAIpD0Or.js.map +0 -1
- package/dist/_chunks/number-input-DOe5VYei.js +0 -370
- package/dist/_chunks/number-input-DOe5VYei.js.map +0 -1
- package/dist/_chunks/signature-status-chip-DUcTgQ0E.js.map +0 -1
package/dist/_chunks/{pregnancy-weight-gain-Co-YFMJZ.js.map → pregnancy-weight-gain-BBgbWBGe.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pregnancy-weight-gain-Co-YFMJZ.js","sources":["../../src/components/pregnancy-weight-gain/pregnancy-weight-gain.agent.ts","../../src/components/pregnancy-weight-gain/weight-gain.ts","../../src/components/pregnancy-weight-gain/pregnancy-weight-gain.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — PregnancyWeightGain. */\n/* */\n/* IOM gestational weight-gain calculator. The four measurements (height, */\n/* pre-pregnancy weight, current weight, gestational weeks) and the */\n/* plurality choice live in local `useState`; the assessment is a derived */\n/* `useMemo`. The agent surface is the curated */\n/* `PregnancyWeightGainHandle`, registered with `useAgentRegistration` and */\n/* resolved by the host as (`pregnancy-weight-gain`, id) — the public */\n/* `ref` is unchanged and still points at the wrapper `HTMLDivElement`, */\n/* exactly as the sibling `bmi-calculator` does. */\n/* */\n/* PHI (§6.1 / §7): the calculator is never handed a patient. Its inputs */\n/* are four numbers plus a plurality enum, and the result is bands + */\n/* status enums, so no state slot can leak identity. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type {\n PregnancyWeightGainHandle,\n PregnancyWeightGainInputs,\n} from './pregnancy-weight-gain';\nimport type { Plurality } from '../_shared/obstetrics';\n\nexport const pregnancyWeightGainAgent: AgentAdapter<PregnancyWeightGainHandle> =\n {\n id: 'pregnancy-weight-gain',\n // set_value → `set_value` (the four measurements) + `set_plurality`,\n // read back through the `inputs` / `plurality` / `result` state slots.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ heightCm: number | null, prePregnancyKg: number | null, currentKg: number | null, gestationalWeeks: number | null }',\n descriptionKey: 'ui.agent.pregnancyWeightGain.state.inputs',\n description:\n 'The four entered measurements — height (cm), pre-pregnancy weight (kg), current weight (kg) and completed gestational weeks. Null for anything not yet entered.',\n read: (handle) => handle.getInputs(),\n },\n plurality: {\n type: \"'singleton' | 'twin' | 'triplet'\",\n descriptionKey: 'ui.agent.pregnancyWeightGain.state.plurality',\n description:\n 'Number of babies the assessment is keyed to. Drives which IOM band applies — twins use the higher twin bands, triplets have no published band.',\n read: (handle) => handle.getPlurality(),\n },\n result: {\n type: '{ category: string, plurality: string, actualGainKg: number, status: string | null, recommendedToDate: { min: number, max: number } | null, totalRange: { min: number, max: number } | null, weeklyRate: number | null, rateStatus: string | null } | null',\n descriptionKey: 'ui.agent.pregnancyWeightGain.state.result',\n description:\n 'Computed assessment — actual gain (kg), the IOM recommended-to-date and total bands, and where the gain sits against them (below / within / above). Null until every input is valid; the bands are null when the IOM publishes none (triplets, underweight twins).',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_value: {\n // Fills the same fields a clinician types into. The calculator is a\n // scratchpad — nothing is persisted to a patient record — so `write`,\n // not `phi` (matching the sibling bmi-calculator).\n safety: 'write',\n argsType:\n '{ heightCm?: number | null, prePregnancyKg?: number | null, currentKg?: number | null, gestationalWeeks?: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n heightCm: {\n type: ['number', 'null'],\n minimum: 0,\n description: 'Height in centimetres.',\n },\n prePregnancyKg: {\n type: ['number', 'null'],\n minimum: 0,\n description: 'Pre-pregnancy weight in kilograms.',\n },\n currentKg: {\n type: ['number', 'null'],\n minimum: 0,\n description: 'Current weight in kilograms.',\n },\n gestationalWeeks: {\n type: ['number', 'null'],\n minimum: 0,\n maximum: 42,\n description: 'Completed gestational weeks.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.setValue',\n description:\n 'Set one or more of the four measurements. Omitted fields are left unchanged; the assessment recomputes as soon as all four are valid.',\n examples: [\n {\n args: {\n heightCm: 165,\n prePregnancyKg: 60,\n currentKg: 72,\n gestationalWeeks: 30,\n },\n note: '165 cm, 60 → 72 kg at 30 weeks → +12 kg against the normal-BMI band.',\n },\n ],\n invoke: (handle, args: Partial<PregnancyWeightGainInputs>) => {\n handle.setInputs(args);\n },\n },\n set_plurality: {\n // Re-keys which IOM band applies — a view-config write on the\n // calculator, never a record mutation.\n safety: 'write',\n argsType: \"{ plurality: 'singleton' | 'twin' | 'triplet' }\",\n argsSchema: {\n type: 'object',\n properties: {\n plurality: {\n enum: ['singleton', 'twin', 'triplet'],\n description: 'Number of babies to assess against.',\n },\n },\n required: ['plurality'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.setPlurality',\n description:\n 'Choose the number of babies. Twins use the higher IOM twin bands; triplets have no published IOM range, so only the actual gain is reported.',\n examples: [\n {\n args: { plurality: 'twin' },\n note: 'Assess against the twin bands.',\n },\n ],\n invoke: (handle, args: { plurality: Plurality }) => {\n handle.setPlurality(args.plurality);\n },\n },\n reset: {\n // Clears the entered measurements — recoverable only by re-entering\n // them, so it is destructive from the agent's point of view.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.reset',\n description:\n 'Clear the four measurements and the computed assessment. The plurality choice is a setting and is kept.',\n invoke: (handle) => {\n handle.reset();\n },\n },\n get_result: {\n safety: 'read',\n returns: '{ actualGainKg: number, status: string | null, … } | null',\n returnsSchema: {\n oneOf: [\n {\n type: 'object',\n properties: {\n category: {\n enum: ['underweight', 'normal', 'overweight', 'obese'],\n },\n plurality: { enum: ['singleton', 'twin', 'triplet'] },\n actualGainKg: { type: 'number' },\n status: {\n oneOf: [\n { enum: ['below', 'within', 'above'] },\n { type: 'null' },\n ],\n },\n recommendedToDate: {\n oneOf: [\n {\n type: 'object',\n properties: {\n min: { type: 'number' },\n max: { type: 'number' },\n },\n required: ['min', 'max'],\n },\n { type: 'null' },\n ],\n },\n totalRange: {\n oneOf: [\n {\n type: 'object',\n properties: {\n min: { type: 'number' },\n max: { type: 'number' },\n },\n required: ['min', 'max'],\n },\n { type: 'null' },\n ],\n },\n weeklyRate: { type: ['number', 'null'] },\n rateStatus: {\n oneOf: [\n { enum: ['below', 'within', 'above'] },\n { type: 'null' },\n ],\n },\n },\n required: ['category', 'actualGainKg'],\n },\n { type: 'null' },\n ],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.getResult',\n description:\n 'Read back the computed assessment — the same value the `result` state slot returns. Null until every input is valid.',\n invoke: (handle) => handle.getResult(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'pregnancy-weight-gain',\n description:\n 'Marks the PregnancyWeightGain calculator wrapper. The themed DOM carries the computed result card; an SR-only live region announces the actual gain and status.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the `id` prop, and also the registry key — without an `id` the instance does not register and the handle-driven actions are unreachable.',\n },\n },\n };\n","/* ------------------------------------------------------------------ */\n/* Pregnancy weight-gain guidance — pure, framework-free, testable. */\n/* */\n/* Recommended ranges follow the US IOM/NAM (2009) guidelines, keyed off */\n/* pre-pregnancy BMI category. Singletons use the published total-gain */\n/* band plus a first-trimester gain (≤13 wk) and a per-week 2nd/3rd- */\n/* trimester rate. Twins use the IOM twin total bands, pro-rated linearly */\n/* for the \"to date\" estimate (the IOM does not publish a twin weekly */\n/* rate). The IOM provides NO range for triplets, and none for */\n/* underweight twins — those cases return `null` so the UI can say so */\n/* rather than invent a number. */\n/* */\n/* Guidance only — not a substitute for clinical judgement. */\n/* ------------------------------------------------------------------ */\n\nimport { type BmiCategory, bmiCategory } from '../bmi-calculator/bmi';\nimport type { Plurality } from '../_shared/obstetrics';\n\nexport interface GainBand {\n /** Lower bound, kg. */\n min: number;\n /** Upper bound, kg. */\n max: number;\n}\n\nexport type GainStatus = 'below' | 'within' | 'above';\n\n/** IOM (2009) total recommended gain for a singleton pregnancy, kg. */\nexport const TOTAL_GAIN_BANDS: Record<BmiCategory, GainBand> = {\n underweight: { min: 12.5, max: 18 },\n normal: { min: 11.5, max: 16 },\n overweight: { min: 7, max: 11.5 },\n obese: { min: 5, max: 9 },\n};\n\n/**\n * IOM (2009) total recommended gain for a TWIN pregnancy, kg. The IOM gives\n * no firm range for underweight twins (insufficient evidence), so that\n * category is intentionally absent and resolves to `null`. There is no IOM\n * range for triplets at all.\n */\nexport const TWIN_TOTAL_GAIN_BANDS: Partial<Record<BmiCategory, GainBand>> = {\n normal: { min: 16.8, max: 24.5 },\n overweight: { min: 14.1, max: 22.7 },\n obese: { min: 11.3, max: 19.1 },\n};\n\n/** Resolve the total-gain band for a category + plurality, or `null` if the IOM gives none. */\nexport function totalGainBand(\n category: BmiCategory,\n plurality: Plurality = 'singleton',\n): GainBand | null {\n if (plurality === 'triplet') return null; // no IOM guideline for triplets\n if (plurality === 'twin') return TWIN_TOTAL_GAIN_BANDS[category] ?? null;\n return TOTAL_GAIN_BANDS[category];\n}\n\n/** IOM (2009) mean rate of gain in the 2nd/3rd trimester, kg per week. */\nexport const RATE_BANDS: Record<BmiCategory, GainBand> = {\n underweight: { min: 0.44, max: 0.58 },\n normal: { min: 0.35, max: 0.5 },\n overweight: { min: 0.23, max: 0.33 },\n obese: { min: 0.17, max: 0.27 },\n};\n\n/** First-trimester total gain band, kg (category-independent in IOM). */\nexport const FIRST_TRIMESTER_GAIN: GainBand = { min: 0.5, max: 2 };\n/** Completed weeks counted as the first trimester for gain purposes. */\nexport const FIRST_TRIMESTER_WEEKS = 13;\n\nexport interface WeightGainInput {\n /** Pre-pregnancy BMI (kg/m²) — drives the category. */\n prePregnancyBmi: number;\n /** Pre-pregnancy weight, kg. */\n prePregnancyWeightKg: number;\n /** Current weight, kg. */\n currentWeightKg: number;\n /** Completed gestational weeks. */\n gestationalWeeks: number;\n /** Number of babies. Defaults to `'singleton'`. */\n plurality?: Plurality;\n}\n\nexport interface WeightGainResult {\n category: BmiCategory;\n /** Number of babies the assessment was computed for. */\n plurality: Plurality;\n /**\n * Recommended TOTAL gain across the whole pregnancy, or `null` when the IOM\n * publishes no range (triplets, and underweight twins).\n */\n totalRange: GainBand | null;\n /** Recommended gain accumulated by the current week, or `null` (see above). */\n recommendedToDate: GainBand | null;\n /** Actual gain so far (current − pre-pregnancy), kg. */\n actualGainKg: number;\n /** Where the actual gain sits against the to-date recommendation, or `null`. */\n status: GainStatus | null;\n /**\n * Estimated 2nd/3rd-trimester average weekly gain to date (kg/week), or `null`\n * before week 14 / when no singleton rate band applies. A snapshot estimate\n * (assumes the mid first-trimester gain), not a between-visit measurement.\n */\n weeklyRate: number | null;\n /** Where the weekly rate sits against the IOM rate band, or `null`. */\n rateStatus: GainStatus | null;\n}\n\n/** Mid-point of the category-independent first-trimester gain band, kg. */\nconst FIRST_TRIMESTER_MIDPOINT =\n (FIRST_TRIMESTER_GAIN.min + FIRST_TRIMESTER_GAIN.max) / 2;\n\n/* Singleton (default) keeps a non-null return; multiples may be null. */\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n plurality?: 'singleton',\n): GainBand;\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n plurality: Plurality,\n): GainBand | null;\n/** Recommended cumulative gain by a given gestational week. */\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n plurality: Plurality = 'singleton',\n): GainBand | null {\n if (plurality !== 'singleton') {\n // Twins/triplets: no IOM weekly rate is published, so pro-rate the total\n // band linearly across the 40 weeks. `null` total ⇒ no guideline.\n const total = totalGainBand(category, plurality);\n if (!total) return null;\n if (weeks <= 0) return { min: 0, max: 0 };\n const frac = Math.min(weeks, 40) / 40;\n return { min: total.min * frac, max: total.max * frac };\n }\n if (weeks <= 0) return { min: 0, max: 0 };\n if (weeks <= FIRST_TRIMESTER_WEEKS) {\n const frac = weeks / FIRST_TRIMESTER_WEEKS;\n return {\n min: FIRST_TRIMESTER_GAIN.min * frac,\n max: FIRST_TRIMESTER_GAIN.max * frac,\n };\n }\n const extraWeeks = Math.min(weeks, 40) - FIRST_TRIMESTER_WEEKS;\n const rate = RATE_BANDS[category];\n return {\n min: FIRST_TRIMESTER_GAIN.min + rate.min * extraWeeks,\n max: FIRST_TRIMESTER_GAIN.max + rate.max * extraWeeks,\n };\n}\n\nexport function assessWeightGain(input: WeightGainInput): WeightGainResult {\n const category = bmiCategory(input.prePregnancyBmi);\n const plurality = input.plurality ?? 'singleton';\n const totalRange = totalGainBand(category, plurality);\n const recommendedToDate = totalRange\n ? recommendedGainToDate(category, input.gestationalWeeks, plurality)\n : null;\n const actualGainKg = input.currentWeightKg - input.prePregnancyWeightKg;\n const status: GainStatus | null = recommendedToDate\n ? actualGainKg < recommendedToDate.min\n ? 'below'\n : actualGainKg > recommendedToDate.max\n ? 'above'\n : 'within'\n : null;\n\n // 2nd/3rd-trimester average weekly rate to date — singleton only (the IOM\n // publishes weekly rate bands only for singletons), and only after week 13.\n let weeklyRate: number | null = null;\n let rateStatus: GainStatus | null = null;\n if (\n plurality === 'singleton' &&\n input.gestationalWeeks > FIRST_TRIMESTER_WEEKS\n ) {\n const weeks = input.gestationalWeeks - FIRST_TRIMESTER_WEEKS;\n weeklyRate = (actualGainKg - FIRST_TRIMESTER_MIDPOINT) / weeks;\n const band = RATE_BANDS[category];\n rateStatus =\n weeklyRate < band.min\n ? 'below'\n : weeklyRate > band.max\n ? 'above'\n : 'within';\n }\n\n return {\n category,\n plurality,\n totalRange,\n recommendedToDate,\n actualGainKg,\n status,\n weeklyRate,\n rateStatus,\n };\n}\n","/* ------------------------------------------------------------------ */\n/* PregnancyWeightGain — actual vs IOM-recommended gestational weight */\n/* gain, keyed off pre-pregnancy BMI. */\n/* */\n/* Composes the BMI maths from bmi-calculator and the IOM bands in */\n/* `./weight-gain` (both pure, separately tested). Metric only. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { pregnancyWeightGainAgent } from './pregnancy-weight-gain.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { NumberInput } from '../number-input';\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 { computeBmi } from '../bmi-calculator/bmi';\nimport type { Plurality } from '../_shared/obstetrics';\nimport {\n type WeightGainResult,\n type GainStatus,\n type GainBand,\n assessWeightGain,\n} from './weight-gain';\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 STATUS_BADGE: Record<GainStatus, 'info' | 'success' | 'warning'> = {\n below: 'warning',\n within: 'success',\n above: 'warning',\n};\n\n/**\n * DS token NAME backing each gain-status chip — the solid-fill companion of the\n * on-screen `STATUS_BADGE` variant (Badge `warning` fills `--warning`,\n * `success` fills `--success`). Passed as the card's `highlightToken` so the\n * inserted PNG chip matches the on-screen status badge; `InsertButton` resolves\n * the name to a concrete colour at raster time.\n */\nconst STATUS_HIGHLIGHT_TOKEN: Record<GainStatus, string> = {\n below: '--warning-readable',\n within: '--success',\n above: '--warning-readable',\n};\n\n/**\n * Gain-status chip token. The `below` / `above` statuses resolve to\n * `--warning-readable`, which the result card's colour probe resolves in the live\n * themed DOM: orange-600 in light, non-accessible mode (where bare `--warning`\n * yellow only reaches ~3.2:1 on the white card) and `--warning` elsewhere, whose\n * deepened ramp already clears contrast. Resolving the token NAME at the card\n * means the choice tracks the live theme regardless of where the theme class\n * lives. The `within` (`--success`) status is unchanged.\n */\nfunction statusHighlightToken(status: GainStatus): string {\n return STATUS_HIGHLIGHT_TOKEN[status];\n}\n\n/**\n * Canonical metric snapshot of the four inputs. Measurements only — the\n * calculator is never handed a patient, so no identity can reach the agent.\n */\nexport interface PregnancyWeightGainInputs {\n /** Height, cm. */\n heightCm: number | null;\n /** Pre-pregnancy weight, kg. */\n prePregnancyKg: number | null;\n /** Current weight, kg. */\n currentKg: number | null;\n /** Completed gestational weeks. */\n gestationalWeeks: number | null;\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads and writes\n * the four measurements plus the plurality choice, and reads back the computed\n * IOM assessment. Never exposes patient identity — the component only ever\n * holds numbers. Consumed by the `pregnancy-weight-gain.agent.ts` adapter; the\n * public `ref` stays the DOM element.\n */\nexport interface PregnancyWeightGainHandle {\n /** Canonical metric snapshot of the four inputs. */\n getInputs: () => PregnancyWeightGainInputs;\n /** Set one or more inputs; omitted fields are left unchanged. */\n setInputs: (next: Partial<PregnancyWeightGainInputs>) => void;\n /** Number of babies the assessment is computed for. */\n getPlurality: () => Plurality;\n /** Switch the plurality (re-keys the IOM bands). */\n setPlurality: (next: Plurality) => void;\n /** Current computed assessment, or null until every input is valid. */\n getResult: () => WeightGainResult | null;\n /** Clear the four measurements (plurality is a setting and is kept). */\n reset: () => void;\n}\n\nexport interface PregnancyWeightGainProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial number of babies. Defaults to `'singleton'`. */\n defaultPlurality?: Plurality;\n /** Pre-fill the height (cm) — e.g. shared from a BMI measurement. */\n defaultHeightCm?: number;\n /** Pre-fill the pre-pregnancy weight (kg) from the patient record. */\n defaultPrePregnancyKg?: number;\n /** Fires whenever a result can be computed (and `null` when it can't). */\n onResultChange?: (result: WeightGainResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Verb the result-action buttons perform. Defaults to `'insert'` (editor\n * extension). Pass `'copy'` from an app shell to copy the result to the\n * clipboard instead.\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 → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\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 PregnancyWeightGain = forwardRef<\n HTMLDivElement,\n PregnancyWeightGainProps\n>(\n (\n {\n defaultPlurality = 'singleton',\n defaultHeightCm,\n defaultPrePregnancyKg,\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 [heightCm, setHeightCm] = useState<number | null>(\n defaultHeightCm ?? null,\n );\n const [prePregnancyKg, setPrePregnancyKg] = useState<number | null>(\n defaultPrePregnancyKg ?? null,\n );\n const [currentKg, setCurrentKg] = useState<number | null>(null);\n const [weeks, setWeeks] = useState<number | null>(null);\n const [plurality, setPlurality] = useState<Plurality>(defaultPlurality);\n\n const prePregnancyBmi = computeBmi(prePregnancyKg, heightCm);\n\n const result = useMemo<WeightGainResult | null>(() => {\n if (\n prePregnancyBmi === null ||\n prePregnancyKg === null ||\n currentKg === null ||\n weeks === null\n ) {\n return null;\n }\n return assessWeightGain({\n prePregnancyBmi,\n prePregnancyWeightKg: prePregnancyKg,\n currentWeightKg: currentKg,\n gestationalWeeks: weeks,\n plurality,\n });\n }, [prePregnancyBmi, prePregnancyKg, currentKg, weeks, plurality]);\n\n const kg = useMemo(\n () =>\n new Intl.NumberFormat(i18n.language, {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n // Live refs so the once-built agent handle reads current state without\n // re-creating on every keystroke. Public `ref` stays the DOM node — the\n // agent surface is the separate `PregnancyWeightGainHandle`.\n const liveRef = useRef({\n heightCm,\n prePregnancyKg,\n currentKg,\n weeks,\n plurality,\n result,\n });\n liveRef.current = {\n heightCm,\n prePregnancyKg,\n currentKg,\n weeks,\n plurality,\n result,\n };\n const agentHandle = useMemo<PregnancyWeightGainHandle>(\n () => ({\n getInputs: () => ({\n heightCm: liveRef.current.heightCm,\n prePregnancyKg: liveRef.current.prePregnancyKg,\n currentKg: liveRef.current.currentKg,\n gestationalWeeks: liveRef.current.weeks,\n }),\n setInputs: (next) => {\n if ('heightCm' in next) setHeightCm(next.heightCm ?? null);\n if ('prePregnancyKg' in next) {\n setPrePregnancyKg(next.prePregnancyKg ?? null);\n }\n if ('currentKg' in next) setCurrentKg(next.currentKg ?? null);\n if ('gestationalWeeks' in next) {\n setWeeks(next.gestationalWeeks ?? null);\n }\n },\n getPlurality: () => liveRef.current.plurality,\n setPlurality: (next) => setPlurality(next),\n getResult: () => liveRef.current.result,\n reset: () => {\n setHeightCm(null);\n setPrePregnancyKg(null);\n setCurrentKg(null);\n setWeeks(null);\n },\n }),\n [],\n );\n useAgentRegistration(pregnancyWeightGainAgent, agentHandle, id);\n\n const unit = t('pregnancyWeightGain.units.kg');\n const band = (b: GainBand): string =>\n `${kg.format(b.min)} – ${kg.format(b.max)} ${unit}`;\n\n return (\n <div\n ref={ref}\n data-component=\"pregnancy-weight-gain\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={`${t('pregnancyWeightGain.height')} (${t('pregnancyWeightGain.units.cm')})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.5}\n value={heightCm}\n onChange={setHeightCm}\n />\n </FormField>\n <FormField\n label={`${t('pregnancyWeightGain.prePregnancyWeight')} (${unit})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={prePregnancyKg}\n onChange={setPrePregnancyKg}\n />\n </FormField>\n <FormField\n label={`${t('pregnancyWeightGain.currentWeight')} (${unit})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={currentKg}\n onChange={setCurrentKg}\n />\n </FormField>\n <FormField label={t('pregnancyWeightGain.gestationalWeeks')}>\n <NumberInput\n mode=\"integer\"\n min={0}\n max={42}\n value={weeks}\n onChange={setWeeks}\n />\n </FormField>\n </div>\n\n <RadioGroup\n label={t('pregnancyWeightGain.plurality.label')}\n variant=\"horizontal\"\n value={plurality}\n onValueChange={(next) => setPlurality(next as Plurality)}\n >\n <Radio\n label={t('pregnancyWeightGain.plurality.singleton')}\n value=\"singleton\"\n />\n <Radio label={t('pregnancyWeightGain.plurality.twin')} value=\"twin\" />\n <Radio\n label={t('pregnancyWeightGain.plurality.triplet')}\n value=\"triplet\"\n />\n </RadioGroup>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('pregnancyWeightGain.actualGain')}: ${kg.format(\n result.actualGainKg,\n )} ${unit}.${\n result.status\n ? ` ${t(`pregnancyWeightGain.status.${result.status}`)}.`\n : ` ${t('pregnancyWeightGain.noGuideline')}`\n }`\n : ''}\n </p>\n\n {result ? (\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:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.prePregnancyBmi')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {kg.format(prePregnancyBmi ?? 0)} ·{' '}\n {t(`pregnancyWeightGain.category.${result.category}`)}\n </dd>\n </div>\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('pregnancyWeightGain.actualGain')}\n </dt>\n <dd className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-metric ds:text-foreground\">\n {kg.format(result.actualGainKg)} {unit}\n </span>\n {result.status ? (\n <Badge variant={STATUS_BADGE[result.status]} size=\"lg\">\n {t(`pregnancyWeightGain.status.${result.status}`)}\n </Badge>\n ) : null}\n </dd>\n </div>\n {result.recommendedToDate && result.totalRange ? (\n <>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.recommendedToDate')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {band(result.recommendedToDate)}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.recommendedTotal')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {band(result.totalRange)}\n </dd>\n </div>\n </>\n ) : null}\n </dl>\n {result.totalRange ? null : (\n <p className=\"type-body ds:text-foreground\">\n {t('pregnancyWeightGain.noGuideline')}\n </p>\n )}\n {result.weeklyRate !== null && result.rateStatus ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.weeklyRate')}\n </span>\n <span className=\"type-body ds:text-foreground\">\n {t('pregnancyWeightGain.perWeek', {\n value: kg.format(result.weeklyRate),\n })}\n </span>\n <Badge variant={STATUS_BADGE[result.rateStatus]}>\n {t(`pregnancyWeightGain.status.${result.rateStatus}`)}\n </Badge>\n </div>\n ) : null}\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t(\n plurality === 'singleton'\n ? 'pregnancyWeightGain.disclaimer'\n : 'pregnancyWeightGain.disclaimerMultiple',\n )}\n </p>\n {result.status &&\n result.recommendedToDate &&\n result.totalRange &&\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.weightGain'),\n icon: 'baby',\n highlight: t(`pregnancyWeightGain.status.${result.status}`),\n // Chip shares the gain-status semantic token so the\n // inserted PNG chip matches the on-screen status badge —\n // with the contrast-safe orange override for the\n // `--warning` below/above statuses.\n highlightToken: statusHighlightToken(result.status),\n brand: insertBrand,\n fields: [\n {\n // Actual gain is the headline trend → trending-up glyph.\n icon: 'trending-up',\n label: t('pregnancyWeightGain.actualGain'),\n value: `${kg.format(result.actualGainKg)} ${unit}`,\n },\n {\n // Recommended weight band → scale glyph.\n icon: 'scale',\n label: t('pregnancyWeightGain.recommendedToDate'),\n value: band(result.recommendedToDate),\n },\n {\n // Recommended total weight band → scale glyph.\n icon: 'scale',\n label: t('pregnancyWeightGain.recommendedTotal'),\n value: band(result.totalRange),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('pregnancyWeightGain.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nPregnancyWeightGain.displayName = 'PregnancyWeightGain';\n"],"names":["pregnancyWeightGainAgent","handle","args","TOTAL_GAIN_BANDS","TWIN_TOTAL_GAIN_BANDS","totalGainBand","category","plurality","RATE_BANDS","FIRST_TRIMESTER_GAIN","FIRST_TRIMESTER_WEEKS","FIRST_TRIMESTER_MIDPOINT","recommendedGainToDate","weeks","total","frac","extraWeeks","rate","assessWeightGain","input","bmiCategory","totalRange","recommendedToDate","actualGainKg","status","weeklyRate","rateStatus","band","rootVariants","cva","STATUS_BADGE","STATUS_HIGHLIGHT_TOKEN","statusHighlightToken","PregnancyWeightGain","forwardRef","defaultPlurality","defaultHeightCm","defaultPrePregnancyKg","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","heightCm","setHeightCm","useState","prePregnancyKg","setPrePregnancyKg","currentKg","setCurrentKg","setWeeks","setPlurality","prePregnancyBmi","computeBmi","result","useMemo","kg","useEffect","liveRef","useRef","agentHandle","next","useAgentRegistration","unit","b","jsxs","jsx","FormField","NumberInput","RadioGroup","Radio","Card","Badge","Fragment","InsertButton"],"mappings":";;;;;;;;;;;;;AAwBO,MAAMA,KACX;AAAA,EACE,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,WAAW;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,aAAA;AAAA,IAAa;AAAA,IAExC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA;AAAA;AAAA;AAAA,MAIT,QAAQ;AAAA,MACR,UACE;AAAA,MACF,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,UAAU;AAAA,YACR,MAAM,CAAC,UAAU,MAAM;AAAA,YACvB,SAAS;AAAA,YACT,aAAa;AAAA,UAAA;AAAA,UAEf,gBAAgB;AAAA,YACd,MAAM,CAAC,UAAU,MAAM;AAAA,YACvB,SAAS;AAAA,YACT,aAAa;AAAA,UAAA;AAAA,UAEf,WAAW;AAAA,YACT,MAAM,CAAC,UAAU,MAAM;AAAA,YACvB,SAAS;AAAA,YACT,aAAa;AAAA,UAAA;AAAA,UAEf,kBAAkB;AAAA,YAChB,MAAM,CAAC,UAAU,MAAM;AAAA,YACvB,SAAS;AAAA,YACT,SAAS;AAAA,YACT,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAEF,sBAAsB;AAAA,MAAA;AAAA,MAExB,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AAoB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"pregnancy-weight-gain-BBgbWBGe.js","sources":["../../src/components/pregnancy-weight-gain/pregnancy-weight-gain.agent.ts","../../src/components/pregnancy-weight-gain/weight-gain.ts","../../src/components/pregnancy-weight-gain/pregnancy-weight-gain.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — PregnancyWeightGain. */\n/* */\n/* IOM gestational weight-gain calculator. The four measurements (height, */\n/* pre-pregnancy weight, current weight, gestational weeks) and the */\n/* plurality choice live in local `useState`; the assessment is a derived */\n/* `useMemo`. The agent surface is the curated */\n/* `PregnancyWeightGainHandle`, registered with `useAgentRegistration` and */\n/* resolved by the host as (`pregnancy-weight-gain`, id) — the public */\n/* `ref` is unchanged and still points at the wrapper `HTMLDivElement`, */\n/* exactly as the sibling `bmi-calculator` does. */\n/* */\n/* PHI (§6.1 / §7): the calculator is never handed a patient. Its inputs */\n/* are four numbers plus a plurality enum, and the result is bands + */\n/* status enums, so no state slot can leak identity. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type {\n PregnancyWeightGainHandle,\n PregnancyWeightGainInputs,\n} from './pregnancy-weight-gain';\nimport type { Plurality } from '../_shared/obstetrics';\n\nexport const pregnancyWeightGainAgent: AgentAdapter<PregnancyWeightGainHandle> =\n {\n id: 'pregnancy-weight-gain',\n // set_value → `set_value` (the four measurements) + `set_plurality`,\n // read back through the `inputs` / `plurality` / `result` state slots.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ heightCm: number | null, prePregnancyKg: number | null, currentKg: number | null, gestationalWeeks: number | null }',\n descriptionKey: 'ui.agent.pregnancyWeightGain.state.inputs',\n description:\n 'The four entered measurements — height (cm), pre-pregnancy weight (kg), current weight (kg) and completed gestational weeks. Null for anything not yet entered.',\n read: (handle) => handle.getInputs(),\n },\n plurality: {\n type: \"'singleton' | 'twin' | 'triplet'\",\n descriptionKey: 'ui.agent.pregnancyWeightGain.state.plurality',\n description:\n 'Number of babies the assessment is keyed to. Drives which IOM band applies — twins use the higher twin bands, triplets have no published band.',\n read: (handle) => handle.getPlurality(),\n },\n result: {\n type: '{ category: string, plurality: string, actualGainKg: number, status: string | null, recommendedToDate: { min: number, max: number } | null, totalRange: { min: number, max: number } | null, weeklyRate: number | null, rateStatus: string | null } | null',\n descriptionKey: 'ui.agent.pregnancyWeightGain.state.result',\n description:\n 'Computed assessment — actual gain (kg), the IOM recommended-to-date and total bands, and where the gain sits against them (below / within / above). Null until every input is valid; the bands are null when the IOM publishes none (triplets, underweight twins).',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_value: {\n // Fills the same fields a clinician types into. The calculator is a\n // scratchpad — nothing is persisted to a patient record — so `write`,\n // not `phi` (matching the sibling bmi-calculator).\n safety: 'write',\n argsType:\n '{ heightCm?: number | null, prePregnancyKg?: number | null, currentKg?: number | null, gestationalWeeks?: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n heightCm: {\n type: ['number', 'null'],\n minimum: 0,\n description: 'Height in centimetres.',\n },\n prePregnancyKg: {\n type: ['number', 'null'],\n minimum: 0,\n description: 'Pre-pregnancy weight in kilograms.',\n },\n currentKg: {\n type: ['number', 'null'],\n minimum: 0,\n description: 'Current weight in kilograms.',\n },\n gestationalWeeks: {\n type: ['number', 'null'],\n minimum: 0,\n maximum: 42,\n description: 'Completed gestational weeks.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.setValue',\n description:\n 'Set one or more of the four measurements. Omitted fields are left unchanged; the assessment recomputes as soon as all four are valid.',\n examples: [\n {\n args: {\n heightCm: 165,\n prePregnancyKg: 60,\n currentKg: 72,\n gestationalWeeks: 30,\n },\n note: '165 cm, 60 → 72 kg at 30 weeks → +12 kg against the normal-BMI band.',\n },\n ],\n invoke: (handle, args: Partial<PregnancyWeightGainInputs>) => {\n handle.setInputs(args);\n },\n },\n set_plurality: {\n // Re-keys which IOM band applies — a view-config write on the\n // calculator, never a record mutation.\n safety: 'write',\n argsType: \"{ plurality: 'singleton' | 'twin' | 'triplet' }\",\n argsSchema: {\n type: 'object',\n properties: {\n plurality: {\n enum: ['singleton', 'twin', 'triplet'],\n description: 'Number of babies to assess against.',\n },\n },\n required: ['plurality'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.setPlurality',\n description:\n 'Choose the number of babies. Twins use the higher IOM twin bands; triplets have no published IOM range, so only the actual gain is reported.',\n examples: [\n {\n args: { plurality: 'twin' },\n note: 'Assess against the twin bands.',\n },\n ],\n invoke: (handle, args: { plurality: Plurality }) => {\n handle.setPlurality(args.plurality);\n },\n },\n reset: {\n // Clears the entered measurements — recoverable only by re-entering\n // them, so it is destructive from the agent's point of view.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.reset',\n description:\n 'Clear the four measurements and the computed assessment. The plurality choice is a setting and is kept.',\n invoke: (handle) => {\n handle.reset();\n },\n },\n get_result: {\n safety: 'read',\n returns: '{ actualGainKg: number, status: string | null, … } | null',\n returnsSchema: {\n oneOf: [\n {\n type: 'object',\n properties: {\n category: {\n enum: ['underweight', 'normal', 'overweight', 'obese'],\n },\n plurality: { enum: ['singleton', 'twin', 'triplet'] },\n actualGainKg: { type: 'number' },\n status: {\n oneOf: [\n { enum: ['below', 'within', 'above'] },\n { type: 'null' },\n ],\n },\n recommendedToDate: {\n oneOf: [\n {\n type: 'object',\n properties: {\n min: { type: 'number' },\n max: { type: 'number' },\n },\n required: ['min', 'max'],\n },\n { type: 'null' },\n ],\n },\n totalRange: {\n oneOf: [\n {\n type: 'object',\n properties: {\n min: { type: 'number' },\n max: { type: 'number' },\n },\n required: ['min', 'max'],\n },\n { type: 'null' },\n ],\n },\n weeklyRate: { type: ['number', 'null'] },\n rateStatus: {\n oneOf: [\n { enum: ['below', 'within', 'above'] },\n { type: 'null' },\n ],\n },\n },\n required: ['category', 'actualGainKg'],\n },\n { type: 'null' },\n ],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.pregnancyWeightGain.actions.getResult',\n description:\n 'Read back the computed assessment — the same value the `result` state slot returns. Null until every input is valid.',\n invoke: (handle) => handle.getResult(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'pregnancy-weight-gain',\n description:\n 'Marks the PregnancyWeightGain calculator wrapper. The themed DOM carries the computed result card; an SR-only live region announces the actual gain and status.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the `id` prop, and also the registry key — without an `id` the instance does not register and the handle-driven actions are unreachable.',\n },\n },\n };\n","/* ------------------------------------------------------------------ */\n/* Pregnancy weight-gain guidance — pure, framework-free, testable. */\n/* */\n/* Recommended ranges follow the US IOM/NAM (2009) guidelines, keyed off */\n/* pre-pregnancy BMI category. Singletons use the published total-gain */\n/* band plus a first-trimester gain (≤13 wk) and a per-week 2nd/3rd- */\n/* trimester rate. Twins use the IOM twin total bands, pro-rated linearly */\n/* for the \"to date\" estimate (the IOM does not publish a twin weekly */\n/* rate). The IOM provides NO range for triplets, and none for */\n/* underweight twins — those cases return `null` so the UI can say so */\n/* rather than invent a number. */\n/* */\n/* Guidance only — not a substitute for clinical judgement. */\n/* ------------------------------------------------------------------ */\n\nimport { type BmiCategory, bmiCategory } from '../bmi-calculator/bmi';\nimport type { Plurality } from '../_shared/obstetrics';\n\nexport interface GainBand {\n /** Lower bound, kg. */\n min: number;\n /** Upper bound, kg. */\n max: number;\n}\n\nexport type GainStatus = 'below' | 'within' | 'above';\n\n/** IOM (2009) total recommended gain for a singleton pregnancy, kg. */\nexport const TOTAL_GAIN_BANDS: Record<BmiCategory, GainBand> = {\n underweight: { min: 12.5, max: 18 },\n normal: { min: 11.5, max: 16 },\n overweight: { min: 7, max: 11.5 },\n obese: { min: 5, max: 9 },\n};\n\n/**\n * IOM (2009) total recommended gain for a TWIN pregnancy, kg. The IOM gives\n * no firm range for underweight twins (insufficient evidence), so that\n * category is intentionally absent and resolves to `null`. There is no IOM\n * range for triplets at all.\n */\nexport const TWIN_TOTAL_GAIN_BANDS: Partial<Record<BmiCategory, GainBand>> = {\n normal: { min: 16.8, max: 24.5 },\n overweight: { min: 14.1, max: 22.7 },\n obese: { min: 11.3, max: 19.1 },\n};\n\n/** Resolve the total-gain band for a category + plurality, or `null` if the IOM gives none. */\nexport function totalGainBand(\n category: BmiCategory,\n plurality: Plurality = 'singleton',\n): GainBand | null {\n if (plurality === 'triplet') return null; // no IOM guideline for triplets\n if (plurality === 'twin') return TWIN_TOTAL_GAIN_BANDS[category] ?? null;\n return TOTAL_GAIN_BANDS[category];\n}\n\n/** IOM (2009) mean rate of gain in the 2nd/3rd trimester, kg per week. */\nexport const RATE_BANDS: Record<BmiCategory, GainBand> = {\n underweight: { min: 0.44, max: 0.58 },\n normal: { min: 0.35, max: 0.5 },\n overweight: { min: 0.23, max: 0.33 },\n obese: { min: 0.17, max: 0.27 },\n};\n\n/** First-trimester total gain band, kg (category-independent in IOM). */\nexport const FIRST_TRIMESTER_GAIN: GainBand = { min: 0.5, max: 2 };\n/** Completed weeks counted as the first trimester for gain purposes. */\nexport const FIRST_TRIMESTER_WEEKS = 13;\n\nexport interface WeightGainInput {\n /** Pre-pregnancy BMI (kg/m²) — drives the category. */\n prePregnancyBmi: number;\n /** Pre-pregnancy weight, kg. */\n prePregnancyWeightKg: number;\n /** Current weight, kg. */\n currentWeightKg: number;\n /** Completed gestational weeks. */\n gestationalWeeks: number;\n /** Number of babies. Defaults to `'singleton'`. */\n plurality?: Plurality;\n}\n\nexport interface WeightGainResult {\n category: BmiCategory;\n /** Number of babies the assessment was computed for. */\n plurality: Plurality;\n /**\n * Recommended TOTAL gain across the whole pregnancy, or `null` when the IOM\n * publishes no range (triplets, and underweight twins).\n */\n totalRange: GainBand | null;\n /** Recommended gain accumulated by the current week, or `null` (see above). */\n recommendedToDate: GainBand | null;\n /** Actual gain so far (current − pre-pregnancy), kg. */\n actualGainKg: number;\n /** Where the actual gain sits against the to-date recommendation, or `null`. */\n status: GainStatus | null;\n /**\n * Estimated 2nd/3rd-trimester average weekly gain to date (kg/week), or `null`\n * before week 14 / when no singleton rate band applies. A snapshot estimate\n * (assumes the mid first-trimester gain), not a between-visit measurement.\n */\n weeklyRate: number | null;\n /** Where the weekly rate sits against the IOM rate band, or `null`. */\n rateStatus: GainStatus | null;\n}\n\n/** Mid-point of the category-independent first-trimester gain band, kg. */\nconst FIRST_TRIMESTER_MIDPOINT =\n (FIRST_TRIMESTER_GAIN.min + FIRST_TRIMESTER_GAIN.max) / 2;\n\n/* Singleton (default) keeps a non-null return; multiples may be null. */\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n plurality?: 'singleton',\n): GainBand;\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n plurality: Plurality,\n): GainBand | null;\n/** Recommended cumulative gain by a given gestational week. */\nexport function recommendedGainToDate(\n category: BmiCategory,\n weeks: number,\n plurality: Plurality = 'singleton',\n): GainBand | null {\n if (plurality !== 'singleton') {\n // Twins/triplets: no IOM weekly rate is published, so pro-rate the total\n // band linearly across the 40 weeks. `null` total ⇒ no guideline.\n const total = totalGainBand(category, plurality);\n if (!total) return null;\n if (weeks <= 0) return { min: 0, max: 0 };\n const frac = Math.min(weeks, 40) / 40;\n return { min: total.min * frac, max: total.max * frac };\n }\n if (weeks <= 0) return { min: 0, max: 0 };\n if (weeks <= FIRST_TRIMESTER_WEEKS) {\n const frac = weeks / FIRST_TRIMESTER_WEEKS;\n return {\n min: FIRST_TRIMESTER_GAIN.min * frac,\n max: FIRST_TRIMESTER_GAIN.max * frac,\n };\n }\n const extraWeeks = Math.min(weeks, 40) - FIRST_TRIMESTER_WEEKS;\n const rate = RATE_BANDS[category];\n return {\n min: FIRST_TRIMESTER_GAIN.min + rate.min * extraWeeks,\n max: FIRST_TRIMESTER_GAIN.max + rate.max * extraWeeks,\n };\n}\n\nexport function assessWeightGain(input: WeightGainInput): WeightGainResult {\n const category = bmiCategory(input.prePregnancyBmi);\n const plurality = input.plurality ?? 'singleton';\n const totalRange = totalGainBand(category, plurality);\n const recommendedToDate = totalRange\n ? recommendedGainToDate(category, input.gestationalWeeks, plurality)\n : null;\n const actualGainKg = input.currentWeightKg - input.prePregnancyWeightKg;\n const status: GainStatus | null = recommendedToDate\n ? actualGainKg < recommendedToDate.min\n ? 'below'\n : actualGainKg > recommendedToDate.max\n ? 'above'\n : 'within'\n : null;\n\n // 2nd/3rd-trimester average weekly rate to date — singleton only (the IOM\n // publishes weekly rate bands only for singletons), and only after week 13.\n let weeklyRate: number | null = null;\n let rateStatus: GainStatus | null = null;\n if (\n plurality === 'singleton' &&\n input.gestationalWeeks > FIRST_TRIMESTER_WEEKS\n ) {\n const weeks = input.gestationalWeeks - FIRST_TRIMESTER_WEEKS;\n weeklyRate = (actualGainKg - FIRST_TRIMESTER_MIDPOINT) / weeks;\n const band = RATE_BANDS[category];\n rateStatus =\n weeklyRate < band.min\n ? 'below'\n : weeklyRate > band.max\n ? 'above'\n : 'within';\n }\n\n return {\n category,\n plurality,\n totalRange,\n recommendedToDate,\n actualGainKg,\n status,\n weeklyRate,\n rateStatus,\n };\n}\n","/* ------------------------------------------------------------------ */\n/* PregnancyWeightGain — actual vs IOM-recommended gestational weight */\n/* gain, keyed off pre-pregnancy BMI. */\n/* */\n/* Composes the BMI maths from bmi-calculator and the IOM bands in */\n/* `./weight-gain` (both pure, separately tested). Metric only. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { pregnancyWeightGainAgent } from './pregnancy-weight-gain.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { NumberInput } from '../number-input';\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 { computeBmi } from '../bmi-calculator/bmi';\nimport type { Plurality } from '../_shared/obstetrics';\nimport {\n type WeightGainResult,\n type GainStatus,\n type GainBand,\n assessWeightGain,\n} from './weight-gain';\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 STATUS_BADGE: Record<GainStatus, 'info' | 'success' | 'warning'> = {\n below: 'warning',\n within: 'success',\n above: 'warning',\n};\n\n/**\n * DS token NAME backing each gain-status chip — the solid-fill companion of the\n * on-screen `STATUS_BADGE` variant (Badge `warning` fills `--warning`,\n * `success` fills `--success`). Passed as the card's `highlightToken` so the\n * inserted PNG chip matches the on-screen status badge; `InsertButton` resolves\n * the name to a concrete colour at raster time.\n */\nconst STATUS_HIGHLIGHT_TOKEN: Record<GainStatus, string> = {\n below: '--warning-readable',\n within: '--success',\n above: '--warning-readable',\n};\n\n/**\n * Gain-status chip token. The `below` / `above` statuses resolve to\n * `--warning-readable`, which the result card's colour probe resolves in the live\n * themed DOM: orange-600 in light, non-accessible mode (where bare `--warning`\n * yellow only reaches ~3.2:1 on the white card) and `--warning` elsewhere, whose\n * deepened ramp already clears contrast. Resolving the token NAME at the card\n * means the choice tracks the live theme regardless of where the theme class\n * lives. The `within` (`--success`) status is unchanged.\n */\nfunction statusHighlightToken(status: GainStatus): string {\n return STATUS_HIGHLIGHT_TOKEN[status];\n}\n\n/**\n * Canonical metric snapshot of the four inputs. Measurements only — the\n * calculator is never handed a patient, so no identity can reach the agent.\n */\nexport interface PregnancyWeightGainInputs {\n /** Height, cm. */\n heightCm: number | null;\n /** Pre-pregnancy weight, kg. */\n prePregnancyKg: number | null;\n /** Current weight, kg. */\n currentKg: number | null;\n /** Completed gestational weeks. */\n gestationalWeeks: number | null;\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads and writes\n * the four measurements plus the plurality choice, and reads back the computed\n * IOM assessment. Never exposes patient identity — the component only ever\n * holds numbers. Consumed by the `pregnancy-weight-gain.agent.ts` adapter; the\n * public `ref` stays the DOM element.\n */\nexport interface PregnancyWeightGainHandle {\n /** Canonical metric snapshot of the four inputs. */\n getInputs: () => PregnancyWeightGainInputs;\n /** Set one or more inputs; omitted fields are left unchanged. */\n setInputs: (next: Partial<PregnancyWeightGainInputs>) => void;\n /** Number of babies the assessment is computed for. */\n getPlurality: () => Plurality;\n /** Switch the plurality (re-keys the IOM bands). */\n setPlurality: (next: Plurality) => void;\n /** Current computed assessment, or null until every input is valid. */\n getResult: () => WeightGainResult | null;\n /** Clear the four measurements (plurality is a setting and is kept). */\n reset: () => void;\n}\n\nexport interface PregnancyWeightGainProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial number of babies. Defaults to `'singleton'`. */\n defaultPlurality?: Plurality;\n /** Pre-fill the height (cm) — e.g. shared from a BMI measurement. */\n defaultHeightCm?: number;\n /** Pre-fill the pre-pregnancy weight (kg) from the patient record. */\n defaultPrePregnancyKg?: number;\n /** Fires whenever a result can be computed (and `null` when it can't). */\n onResultChange?: (result: WeightGainResult | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Verb the result-action buttons perform. Defaults to `'insert'` (editor\n * extension). Pass `'copy'` from an app shell to copy the result to the\n * clipboard instead.\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 → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\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 PregnancyWeightGain = forwardRef<\n HTMLDivElement,\n PregnancyWeightGainProps\n>(\n (\n {\n defaultPlurality = 'singleton',\n defaultHeightCm,\n defaultPrePregnancyKg,\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 [heightCm, setHeightCm] = useState<number | null>(\n defaultHeightCm ?? null,\n );\n const [prePregnancyKg, setPrePregnancyKg] = useState<number | null>(\n defaultPrePregnancyKg ?? null,\n );\n const [currentKg, setCurrentKg] = useState<number | null>(null);\n const [weeks, setWeeks] = useState<number | null>(null);\n const [plurality, setPlurality] = useState<Plurality>(defaultPlurality);\n\n const prePregnancyBmi = computeBmi(prePregnancyKg, heightCm);\n\n const result = useMemo<WeightGainResult | null>(() => {\n if (\n prePregnancyBmi === null ||\n prePregnancyKg === null ||\n currentKg === null ||\n weeks === null\n ) {\n return null;\n }\n return assessWeightGain({\n prePregnancyBmi,\n prePregnancyWeightKg: prePregnancyKg,\n currentWeightKg: currentKg,\n gestationalWeeks: weeks,\n plurality,\n });\n }, [prePregnancyBmi, prePregnancyKg, currentKg, weeks, plurality]);\n\n const kg = useMemo(\n () =>\n new Intl.NumberFormat(i18n.language, {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n // Live refs so the once-built agent handle reads current state without\n // re-creating on every keystroke. Public `ref` stays the DOM node — the\n // agent surface is the separate `PregnancyWeightGainHandle`.\n const liveRef = useRef({\n heightCm,\n prePregnancyKg,\n currentKg,\n weeks,\n plurality,\n result,\n });\n liveRef.current = {\n heightCm,\n prePregnancyKg,\n currentKg,\n weeks,\n plurality,\n result,\n };\n const agentHandle = useMemo<PregnancyWeightGainHandle>(\n () => ({\n getInputs: () => ({\n heightCm: liveRef.current.heightCm,\n prePregnancyKg: liveRef.current.prePregnancyKg,\n currentKg: liveRef.current.currentKg,\n gestationalWeeks: liveRef.current.weeks,\n }),\n setInputs: (next) => {\n if ('heightCm' in next) setHeightCm(next.heightCm ?? null);\n if ('prePregnancyKg' in next) {\n setPrePregnancyKg(next.prePregnancyKg ?? null);\n }\n if ('currentKg' in next) setCurrentKg(next.currentKg ?? null);\n if ('gestationalWeeks' in next) {\n setWeeks(next.gestationalWeeks ?? null);\n }\n },\n getPlurality: () => liveRef.current.plurality,\n setPlurality: (next) => setPlurality(next),\n getResult: () => liveRef.current.result,\n reset: () => {\n setHeightCm(null);\n setPrePregnancyKg(null);\n setCurrentKg(null);\n setWeeks(null);\n },\n }),\n [],\n );\n useAgentRegistration(pregnancyWeightGainAgent, agentHandle, id);\n\n const unit = t('pregnancyWeightGain.units.kg');\n const band = (b: GainBand): string =>\n `${kg.format(b.min)} – ${kg.format(b.max)} ${unit}`;\n\n return (\n <div\n ref={ref}\n data-component=\"pregnancy-weight-gain\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={`${t('pregnancyWeightGain.height')} (${t('pregnancyWeightGain.units.cm')})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.5}\n value={heightCm}\n onChange={setHeightCm}\n />\n </FormField>\n <FormField\n label={`${t('pregnancyWeightGain.prePregnancyWeight')} (${unit})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={prePregnancyKg}\n onChange={setPrePregnancyKg}\n />\n </FormField>\n <FormField\n label={`${t('pregnancyWeightGain.currentWeight')} (${unit})`}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={currentKg}\n onChange={setCurrentKg}\n />\n </FormField>\n <FormField label={t('pregnancyWeightGain.gestationalWeeks')}>\n <NumberInput\n mode=\"integer\"\n min={0}\n max={42}\n value={weeks}\n onChange={setWeeks}\n />\n </FormField>\n </div>\n\n <RadioGroup\n label={t('pregnancyWeightGain.plurality.label')}\n variant=\"horizontal\"\n value={plurality}\n onValueChange={(next) => setPlurality(next as Plurality)}\n >\n <Radio\n label={t('pregnancyWeightGain.plurality.singleton')}\n value=\"singleton\"\n />\n <Radio label={t('pregnancyWeightGain.plurality.twin')} value=\"twin\" />\n <Radio\n label={t('pregnancyWeightGain.plurality.triplet')}\n value=\"triplet\"\n />\n </RadioGroup>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('pregnancyWeightGain.actualGain')}: ${kg.format(\n result.actualGainKg,\n )} ${unit}.${\n result.status\n ? ` ${t(`pregnancyWeightGain.status.${result.status}`)}.`\n : ` ${t('pregnancyWeightGain.noGuideline')}`\n }`\n : ''}\n </p>\n\n {result ? (\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:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.prePregnancyBmi')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {kg.format(prePregnancyBmi ?? 0)} ·{' '}\n {t(`pregnancyWeightGain.category.${result.category}`)}\n </dd>\n </div>\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('pregnancyWeightGain.actualGain')}\n </dt>\n <dd className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-metric ds:text-foreground\">\n {kg.format(result.actualGainKg)} {unit}\n </span>\n {result.status ? (\n <Badge variant={STATUS_BADGE[result.status]} size=\"lg\">\n {t(`pregnancyWeightGain.status.${result.status}`)}\n </Badge>\n ) : null}\n </dd>\n </div>\n {result.recommendedToDate && result.totalRange ? (\n <>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.recommendedToDate')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {band(result.recommendedToDate)}\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.recommendedTotal')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {band(result.totalRange)}\n </dd>\n </div>\n </>\n ) : null}\n </dl>\n {result.totalRange ? null : (\n <p className=\"type-body ds:text-foreground\">\n {t('pregnancyWeightGain.noGuideline')}\n </p>\n )}\n {result.weeklyRate !== null && result.rateStatus ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('pregnancyWeightGain.weeklyRate')}\n </span>\n <span className=\"type-body ds:text-foreground\">\n {t('pregnancyWeightGain.perWeek', {\n value: kg.format(result.weeklyRate),\n })}\n </span>\n <Badge variant={STATUS_BADGE[result.rateStatus]}>\n {t(`pregnancyWeightGain.status.${result.rateStatus}`)}\n </Badge>\n </div>\n ) : null}\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t(\n plurality === 'singleton'\n ? 'pregnancyWeightGain.disclaimer'\n : 'pregnancyWeightGain.disclaimerMultiple',\n )}\n </p>\n {result.status &&\n result.recommendedToDate &&\n result.totalRange &&\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.weightGain'),\n icon: 'baby',\n highlight: t(`pregnancyWeightGain.status.${result.status}`),\n // Chip shares the gain-status semantic token so the\n // inserted PNG chip matches the on-screen status badge —\n // with the contrast-safe orange override for the\n // `--warning` below/above statuses.\n highlightToken: statusHighlightToken(result.status),\n brand: insertBrand,\n fields: [\n {\n // Actual gain is the headline trend → trending-up glyph.\n icon: 'trending-up',\n label: t('pregnancyWeightGain.actualGain'),\n value: `${kg.format(result.actualGainKg)} ${unit}`,\n },\n {\n // Recommended weight band → scale glyph.\n icon: 'scale',\n label: t('pregnancyWeightGain.recommendedToDate'),\n value: band(result.recommendedToDate),\n },\n {\n // Recommended total weight band → scale glyph.\n icon: 'scale',\n label: t('pregnancyWeightGain.recommendedTotal'),\n value: band(result.totalRange),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('pregnancyWeightGain.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nPregnancyWeightGain.displayName = 'PregnancyWeightGain';\n"],"names":["pregnancyWeightGainAgent","handle","args","TOTAL_GAIN_BANDS","TWIN_TOTAL_GAIN_BANDS","totalGainBand","category","plurality","RATE_BANDS","FIRST_TRIMESTER_GAIN","FIRST_TRIMESTER_WEEKS","FIRST_TRIMESTER_MIDPOINT","recommendedGainToDate","weeks","total","frac","extraWeeks","rate","assessWeightGain","input","bmiCategory","totalRange","recommendedToDate","actualGainKg","status","weeklyRate","rateStatus","band","rootVariants","cva","STATUS_BADGE","STATUS_HIGHLIGHT_TOKEN","statusHighlightToken","PregnancyWeightGain","forwardRef","defaultPlurality","defaultHeightCm","defaultPrePregnancyKg","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","heightCm","setHeightCm","useState","prePregnancyKg","setPrePregnancyKg","currentKg","setCurrentKg","setWeeks","setPlurality","prePregnancyBmi","computeBmi","result","useMemo","kg","useEffect","liveRef","useRef","agentHandle","next","useAgentRegistration","unit","b","jsxs","jsx","FormField","NumberInput","RadioGroup","Radio","Card","Badge","Fragment","InsertButton"],"mappings":";;;;;;;;;;;;;AAwBO,MAAMA,KACX;AAAA,EACE,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA,IACL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AAmC;AAAA,cAACQ;AAAA,cAAA;AAAA,gBACC,UAAA3C;AAAA,gBACA,SAASC;AAAA,gBACT,QAAAC;AAAA,gBACA,SAAAC;AAAA,gBACA,MAAM;AAAA,kBACJ,OAAOM,EAAE,yBAAyB;AAAA,kBAClC,MAAM;AAAA,kBACN,WAAWA,EAAE,8BAA8Bc,EAAO,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,kBAK1D,gBAAgB9B,GAAqB8B,EAAO,MAAM;AAAA,kBAClD,OAAOnB;AAAA,kBACP,QAAQ;AAAA,oBACN;AAAA;AAAA,sBAEE,MAAM;AAAA,sBACN,OAAOK,EAAE,gCAAgC;AAAA,sBACzC,OAAO,GAAGgB,EAAG,OAAOF,EAAO,YAAY,CAAC,IAAIS,CAAI;AAAA,oBAAA;AAAA,oBAElD;AAAA;AAAA,sBAEE,MAAM;AAAA,sBACN,OAAOvB,EAAE,uCAAuC;AAAA,sBAChD,OAAOrB,EAAKmC,EAAO,iBAAiB;AAAA,oBAAA;AAAA,oBAEtC;AAAA;AAAA,sBAEE,MAAM;AAAA,sBACN,OAAOd,EAAE,sCAAsC;AAAA,sBAC/C,OAAOrB,EAAKmC,EAAO,UAAU;AAAA,oBAAA;AAAA,kBAC/B;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAY,EAAC,KAAA,EAAE,WAAU,sCACV,UAAA1B,EAAE,2BAA2B,EAAA,CAChC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAf,GAAoB,cAAc;"}
|
package/dist/_chunks/{signature-status-chip-DUcTgQ0E.js → signature-status-chip-DlLJk1VA.js}
RENAMED
|
@@ -8,15 +8,17 @@ function T(e, n) {
|
|
|
8
8
|
const s = t.filter((i) => i === "signed").length;
|
|
9
9
|
return s === 0 ? "unsigned" : s === t.length ? "signed" : "partial";
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const A = {
|
|
12
|
+
// Traffic light: green when everyone required has signed, amber when one
|
|
13
|
+
// party is still missing, red when nobody has.
|
|
12
14
|
signed: "success",
|
|
13
15
|
partial: "warning",
|
|
14
|
-
unsigned: "
|
|
16
|
+
unsigned: "error",
|
|
15
17
|
notRequired: "neutral"
|
|
16
|
-
},
|
|
18
|
+
}, b = {
|
|
17
19
|
operator: "Operator",
|
|
18
20
|
patient: "Patient"
|
|
19
|
-
},
|
|
21
|
+
}, w = {
|
|
20
22
|
signed: "signed",
|
|
21
23
|
pending: "pending"
|
|
22
24
|
};
|
|
@@ -36,8 +38,8 @@ const N = C(
|
|
|
36
38
|
title: f,
|
|
37
39
|
...m
|
|
38
40
|
}, h) => {
|
|
39
|
-
const { t: a } = R(),
|
|
40
|
-
switch (
|
|
41
|
+
const { t: a } = R(), o = T(e, n), r = (() => {
|
|
42
|
+
switch (o) {
|
|
41
43
|
case "signed":
|
|
42
44
|
return a("signatureStatusChip.signed", { defaultValue: "Signed" });
|
|
43
45
|
case "unsigned":
|
|
@@ -59,25 +61,25 @@ const N = C(
|
|
|
59
61
|
({ party: g, standing: l }) => a("signatureStatusChip.breakdownItem", {
|
|
60
62
|
defaultValue: "{{party}} {{state}}",
|
|
61
63
|
party: a(`signatureStatusChip.party.${g}`, {
|
|
62
|
-
defaultValue:
|
|
64
|
+
defaultValue: b[g]
|
|
63
65
|
}),
|
|
64
66
|
state: a(`signatureStatusChip.state.${l}`, {
|
|
65
|
-
defaultValue:
|
|
67
|
+
defaultValue: w[l]
|
|
66
68
|
})
|
|
67
69
|
})
|
|
68
|
-
).join(" · "),
|
|
70
|
+
).join(" · "), d = u ? `${r}, ${u}` : r, S = s && u ? `${r} · ${u}` : r;
|
|
69
71
|
return /* @__PURE__ */ q(
|
|
70
72
|
V,
|
|
71
73
|
{
|
|
72
74
|
ref: h,
|
|
73
|
-
variant:
|
|
75
|
+
variant: A[o],
|
|
74
76
|
size: t,
|
|
75
77
|
withDot: !0,
|
|
76
78
|
role: "img",
|
|
77
|
-
"aria-label": c ??
|
|
78
|
-
title: f ??
|
|
79
|
+
"aria-label": c ?? d,
|
|
80
|
+
title: f ?? d,
|
|
79
81
|
"data-component": "signature-status-chip",
|
|
80
|
-
"data-status":
|
|
82
|
+
"data-status": o,
|
|
81
83
|
"data-component-id": i,
|
|
82
84
|
id: i,
|
|
83
85
|
className: p,
|
|
@@ -92,4 +94,4 @@ export {
|
|
|
92
94
|
N as S,
|
|
93
95
|
T as s
|
|
94
96
|
};
|
|
95
|
-
//# sourceMappingURL=signature-status-chip-
|
|
97
|
+
//# sourceMappingURL=signature-status-chip-DlLJk1VA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signature-status-chip-DlLJk1VA.js","sources":["../../src/components/signature-status-chip/signature-status-chip.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Badge, type BadgeProps } from '../badge';\n\n/* ------------------------------------------------------------------ */\n/* State vocabulary */\n/* ------------------------------------------------------------------ */\n\n/** One party's standing on the document. */\nexport type SignatureParty = 'signed' | 'pending' | 'notRequired';\n\n/** The chip's derived state. */\nexport type SignatureStatus = 'signed' | 'partial' | 'unsigned' | 'notRequired';\n\ntype PartyName = 'operator' | 'patient';\ntype RequiredStanding = Exclude<SignatureParty, 'notRequired'>;\n\n/**\n * The rule, exported so hosts can sort/filter by the same state the chip\n * shows: required = parties not `notRequired`; all signed → `signed`, some\n * signed → `partial`, none signed → `unsigned`, nobody required → `notRequired`.\n */\nexport function signatureStatusOf(\n operator: SignatureParty,\n patient: SignatureParty,\n): SignatureStatus {\n const required = [operator, patient].filter((p) => p !== 'notRequired');\n if (required.length === 0) return 'notRequired';\n const signed = required.filter((p) => p === 'signed').length;\n if (signed === 0) return 'unsigned';\n return signed === required.length ? 'signed' : 'partial';\n}\n\n// `partial` shares the warning tone with `unsigned` so a half-signed document\n// never reads as done at a glance — only a fully signed one goes green.\nconst STATUS_VARIANT: Record<\n SignatureStatus,\n NonNullable<BadgeProps['variant']>\n> = {\n // Traffic light: green when everyone required has signed, amber when one\n // party is still missing, red when nobody has.\n signed: 'success',\n partial: 'warning',\n unsigned: 'error',\n notRequired: 'neutral',\n};\n\nconst PARTY_DEFAULT: Record<PartyName, string> = {\n operator: 'Operator',\n patient: 'Patient',\n};\n\nconst STANDING_DEFAULT: Record<RequiredStanding, string> = {\n signed: 'signed',\n pending: 'pending',\n};\n\nfunction requiredParties(\n operator: SignatureParty,\n patient: SignatureParty,\n): Array<{ party: PartyName; standing: RequiredStanding }> {\n const out: Array<{ party: PartyName; standing: RequiredStanding }> = [];\n if (operator !== 'notRequired')\n out.push({ party: 'operator', standing: operator });\n if (patient !== 'notRequired')\n out.push({ party: 'patient', standing: patient });\n return out;\n}\n\n/* ------------------------------------------------------------------ */\n/* Props */\n/* ------------------------------------------------------------------ */\n\nexport interface SignatureStatusChipProps extends Omit<\n HTMLAttributes<HTMLSpanElement>,\n 'children'\n> {\n /** The operator's standing. */\n operator: SignatureParty;\n /** The patient's standing. */\n patient: SignatureParty;\n /** Chip height — maps onto the Badge `sm` / `md` sizes. */\n size?: 'sm' | 'md';\n /**\n * Spell the breakdown in the chip text (\"Signed · Operator signed · Patient\n * signed\") instead of the summary word. Default false — the breakdown is\n * always in the accessible name / title.\n */\n detail?: boolean;\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const SignatureStatusChip = forwardRef<\n HTMLSpanElement,\n SignatureStatusChipProps\n>(\n (\n {\n operator,\n patient,\n size = 'md',\n detail = false,\n id,\n className,\n 'aria-label': ariaLabelProp,\n title: titleProp,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const status = signatureStatusOf(operator, patient);\n\n // In `partial` exactly one required party is pending, so the summary\n // names the missing signature rather than a vague \"partially signed\".\n const summary = (() => {\n switch (status) {\n case 'signed':\n return t('signatureStatusChip.signed', { defaultValue: 'Signed' });\n case 'unsigned':\n return t('signatureStatusChip.unsigned', {\n defaultValue: 'Not signed',\n });\n case 'notRequired':\n return t('signatureStatusChip.notRequired', {\n defaultValue: 'No signature required',\n });\n case 'partial':\n return operator === 'pending'\n ? t('signatureStatusChip.missingOperator', {\n defaultValue: 'Operator signature missing',\n })\n : t('signatureStatusChip.missingPatient', {\n defaultValue: 'Patient signature missing',\n });\n }\n })();\n\n const breakdown = requiredParties(operator, patient)\n .map(({ party, standing }) =>\n t('signatureStatusChip.breakdownItem', {\n defaultValue: '{{party}} {{state}}',\n party: t(`signatureStatusChip.party.${party}`, {\n defaultValue: PARTY_DEFAULT[party],\n }),\n state: t(`signatureStatusChip.state.${standing}`, {\n defaultValue: STANDING_DEFAULT[standing],\n }),\n }),\n )\n .join(' · ');\n\n // The full picture always reaches AT and hover, even in the compact form.\n const label = breakdown ? `${summary}, ${breakdown}` : summary;\n const visible = detail && breakdown ? `${summary} · ${breakdown}` : summary;\n\n return (\n <Badge\n ref={ref}\n variant={STATUS_VARIANT[status]}\n size={size}\n withDot\n role=\"img\"\n aria-label={ariaLabelProp ?? label}\n title={titleProp ?? label}\n data-component=\"signature-status-chip\"\n data-status={status}\n data-component-id={id}\n id={id}\n className={className}\n {...rest}\n >\n {visible}\n </Badge>\n );\n },\n);\n\nSignatureStatusChip.displayName = 'SignatureStatusChip';\n"],"names":["signatureStatusOf","operator","patient","required","p","signed","STATUS_VARIANT","PARTY_DEFAULT","STANDING_DEFAULT","requiredParties","out","SignatureStatusChip","forwardRef","size","detail","id","className","ariaLabelProp","titleProp","rest","ref","t","useTranslation","status","summary","breakdown","party","standing","label","visible","jsx","Badge"],"mappings":";;;;AAsBO,SAASA,EACdC,GACAC,GACiB;AACjB,QAAMC,IAAW,CAACF,GAAUC,CAAO,EAAE,OAAO,CAACE,MAAMA,MAAM,aAAa;AACtE,MAAID,EAAS,WAAW,EAAG,QAAO;AAClC,QAAME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sC;AAAA,YACtC,cAAc;AAAA,UAAA,CACf;AAAA,MAAA;AAAA,IAEX,GAAA,GAEMI,IAAYhB,EAAgBR,GAAUC,CAAO,EAChD;AAAA,MAAI,CAAC,EAAE,OAAAwB,GAAO,UAAAC,QACbN,EAAE,qCAAqC;AAAA,QACrC,cAAc;AAAA,QACd,OAAOA,EAAE,6BAA6BK,CAAK,IAAI;AAAA,UAC7C,cAAcnB,EAAcmB,CAAK;AAAA,QAAA,CAClC;AAAA,QACD,OAAOL,EAAE,6BAA6BM,CAAQ,IAAI;AAAA,UAChD,cAAcnB,EAAiBmB,CAAQ;AAAA,QAAA,CACxC;AAAA,MAAA,CACF;AAAA,IAAA,EAEF,KAAK,KAAK,GAGPC,IAAQH,IAAY,GAAGD,CAAO,KAAKC,CAAS,KAAKD,GACjDK,IAAUf,KAAUW,IAAY,GAAGD,CAAO,MAAMC,CAAS,KAAKD;AAEpE,WACE,gBAAAM;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAX;AAAA,QACA,SAASd,EAAeiB,CAAM;AAAA,QAC9B,MAAAV;AAAA,QACA,SAAO;AAAA,QACP,MAAK;AAAA,QACL,cAAYI,KAAiBW;AAAA,QAC7B,OAAOV,KAAaU;AAAA,QACpB,kBAAe;AAAA,QACf,eAAaL;AAAA,QACb,qBAAmBR;AAAA,QACnB,IAAAA;AAAA,QACA,WAAAC;AAAA,QACC,GAAGG;AAAA,QAEH,UAAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAlB,EAAoB,cAAc;"}
|
|
@@ -4,7 +4,7 @@ import { c as z } from "./index-D2ZczOXr.js";
|
|
|
4
4
|
import { useTranslation as M } from "react-i18next";
|
|
5
5
|
import { u as Y } from "./registry-DvAUVLHh.js";
|
|
6
6
|
import { F as C } from "./form-field-D1oqYisL.js";
|
|
7
|
-
import { N as B } from "./number-input-
|
|
7
|
+
import { N as B } from "./number-input-CM1q9zvH.js";
|
|
8
8
|
import { S } from "./select-BW5ecXlX.js";
|
|
9
9
|
import { I as D } from "./insert-result-98J1QEp7.js";
|
|
10
10
|
const L = [
|
|
@@ -334,4 +334,4 @@ export {
|
|
|
334
334
|
ee as b,
|
|
335
335
|
Q as c
|
|
336
336
|
};
|
|
337
|
-
//# sourceMappingURL=unit-converter-
|
|
337
|
+
//# sourceMappingURL=unit-converter-Dsk__pjA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit-converter-BeTicruA.js","sources":["../../src/components/unit-converter/unit-converter.agent.ts","../../src/components/unit-converter/units.ts","../../src/components/unit-converter/unit-converter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — UnitConverter. */\n/* */\n/* Generic clinical/everyday unit conversion. The agent-relevant surface */\n/* is the read-only converted result plus the structural inputs (category, */\n/* source value, from-unit, to-unit) and `set_value` actions to drive */\n/* them. Values are plain measurements — no patient identity. The handle */\n/* is the curated `UnitConverterHandle`. See `src/docs/26-agent-readiness`.*/\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { UnitConverterHandle } from './unit-converter';\nimport type { UnitCategory } from './units';\n\n/**\n * Measurement families, mirrored from `./units`'s `CATEGORIES`. Inlined as a\n * literal (rather than runtime-imported) so the ESM catalog build can load this\n * pure module without TS path resolution; `satisfies` keeps it in lockstep with\n * the `UnitCategory` union at compile time.\n */\nconst CATEGORIES = [\n 'weight',\n 'length',\n 'temperature',\n 'glucose',\n] as const satisfies readonly UnitCategory[];\n\nexport const unitConverterAgent: AgentAdapter<UnitConverterHandle> = {\n id: 'unit-converter',\n capabilities: ['set_value', 'view_change'],\n state: {\n category: {\n type: \"'weight' | 'length' | 'temperature' | 'glucose'\",\n descriptionKey: 'ui.agent.unitConverter.state.category',\n description:\n 'Active measurement family. Determines which from/to units are selectable.',\n read: (handle) => handle.getCategory(),\n },\n inputs: {\n type: '{ value: number | null, fromId: string, toId: string }',\n descriptionKey: 'ui.agent.unitConverter.state.inputs',\n description:\n 'Source value plus the from-unit and to-unit ids within the active category.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: 'number | null',\n descriptionKey: 'ui.agent.unitConverter.state.result',\n description:\n 'Converted value in the to-unit, or null when the source value is empty.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: ['number', 'null'],\n description: 'Source value to convert, or null to clear.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.setValue',\n description: 'Set the source value to convert.',\n examples: [{ args: { value: 70 }, note: 'Convert 70 of the from-unit.' }],\n invoke: (handle, args: { value: number | null }) => {\n handle.setValue(args.value);\n },\n },\n set_units: {\n safety: 'read',\n argsType: '{ fromId?: string, toId?: string }',\n argsSchema: {\n type: 'object',\n properties: {\n fromId: {\n type: 'string',\n description: 'Source unit id within the active category.',\n },\n toId: {\n type: 'string',\n description: 'Target unit id within the active category.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.setUnits',\n description:\n 'Set the from-unit and/or to-unit. Ids outside the active category are ignored.',\n examples: [\n { args: { fromId: 'kg', toId: 'lb' }, note: 'Convert kg → lb.' },\n ],\n invoke: (handle, args: { fromId?: string; toId?: string }) => {\n handle.setUnits(args);\n },\n },\n set_category: {\n safety: 'read',\n argsType: \"{ category: 'weight' | 'length' | 'temperature' | 'glucose' }\",\n argsSchema: {\n type: 'object',\n properties: {\n category: {\n enum: [...CATEGORIES],\n description: 'Measurement family to switch to.',\n },\n },\n required: ['category'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.setCategory',\n description:\n 'Switch the measurement family. Resets the from/to units to that category defaults.',\n invoke: (\n handle,\n args: {\n category: 'weight' | 'length' | 'temperature' | 'glucose';\n },\n ) => {\n handle.setCategory(args.category);\n },\n },\n get_result: {\n safety: 'read',\n returns: 'number | null',\n returnsSchema: { type: ['number', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.getResult',\n description:\n 'Return the converted value in the to-unit, or null when no source value is set.',\n invoke: (handle) => handle.getResult(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'unit-converter',\n description: 'Marks the UnitConverter wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific converter instance.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Generic unit conversion — pure, framework-free, unit-testable. */\n/* */\n/* Every unit is described by an affine map to its category's base */\n/* unit: base = value * factor + offset. Conversion is base-in then */\n/* base-out, so the same code handles linear scales (weight, length, */\n/* glucose) and offset scales (temperature) uniformly. */\n/* ------------------------------------------------------------------ */\n\nexport type UnitCategory = 'weight' | 'length' | 'temperature' | 'glucose';\n\nexport interface UnitDef {\n id: string;\n category: UnitCategory;\n /** Multiplier to the category base unit. */\n factor: number;\n /** Additive offset to the base unit (non-zero only for temperature). */\n offset: number;\n}\n\n/* Base units: kg, cm, °C, mmol/L. */\nexport const UNITS: Record<string, UnitDef> = {\n // weight → base kg\n kg: { id: 'kg', category: 'weight', factor: 1, offset: 0 },\n g: { id: 'g', category: 'weight', factor: 0.001, offset: 0 },\n lb: { id: 'lb', category: 'weight', factor: 0.45359237, offset: 0 },\n oz: { id: 'oz', category: 'weight', factor: 0.028349523125, offset: 0 },\n // length → base cm\n cm: { id: 'cm', category: 'length', factor: 1, offset: 0 },\n m: { id: 'm', category: 'length', factor: 100, offset: 0 },\n in: { id: 'in', category: 'length', factor: 2.54, offset: 0 },\n ft: { id: 'ft', category: 'length', factor: 30.48, offset: 0 },\n // temperature → base °C (affine: °C = °F·5/9 − 32·5/9)\n c: { id: 'c', category: 'temperature', factor: 1, offset: 0 },\n f: { id: 'f', category: 'temperature', factor: 5 / 9, offset: (-32 * 5) / 9 },\n // glucose → base mmol/L (1 mg/dL = 1/18.0156 mmol/L)\n mmol_l: { id: 'mmol_l', category: 'glucose', factor: 1, offset: 0 },\n mg_dl: { id: 'mg_dl', category: 'glucose', factor: 1 / 18.0156, offset: 0 },\n};\n\nexport const UNITS_BY_CATEGORY: Record<UnitCategory, string[]> = {\n weight: ['kg', 'g', 'lb', 'oz'],\n length: ['cm', 'm', 'in', 'ft'],\n temperature: ['c', 'f'],\n glucose: ['mmol_l', 'mg_dl'],\n};\n\nexport const CATEGORIES: UnitCategory[] = [\n 'weight',\n 'length',\n 'temperature',\n 'glucose',\n];\n\n/**\n * Convert `value` from one unit to another. Both ids must belong to the same\n * category; mismatched categories throw (a programming error, not user input).\n */\nexport function convertUnits(\n value: number,\n fromId: string,\n toId: string,\n): number {\n const from = UNITS[fromId];\n const to = UNITS[toId];\n if (!from || !to) throw new Error(`Unknown unit: ${fromId} → ${toId}`);\n if (from.category !== to.category) {\n throw new Error(\n `Cannot convert across categories: ${from.category} → ${to.category}`,\n );\n }\n const base = value * from.factor + from.offset;\n return (base - to.offset) / to.factor;\n}\n","/* ------------------------------------------------------------------ */\n/* UnitConverter — generic clinical/everyday unit conversion across */\n/* weight, length, temperature and glucose. */\n/* */\n/* Maths lives in `./units` (pure, separately tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { unitConverterAgent } from './unit-converter.agent';\nimport { FormField } from '../form-field';\nimport { NumberInput } from '../number-input';\nimport { Select } from '../select';\nimport {\n InsertButton,\n type InsertPayload,\n type InsertVariant,\n type InsertMode,\n} from '../_shared/insert-result';\nimport {\n type UnitCategory,\n CATEGORIES,\n UNITS_BY_CATEGORY,\n convertUnits,\n} from './units';\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\n/**\n * DS token NAME backing the result-card category chip, one per measurement\n * family. The converter shows no on-screen badge, but the inserted card carries\n * a category chip so the reader can tell at a glance which family the figure\n * belongs to; each token is a closed-palette semantic alias resolved to a\n * concrete colour at raster time by `InsertButton`.\n */\nconst CATEGORY_HIGHLIGHT_TOKEN: Record<UnitCategory, string> = {\n weight: '--info',\n length: '--success',\n temperature: '--warning-readable',\n glucose: '--accent',\n};\n\n/**\n * Category chip token. The `temperature` family resolves to `--warning-readable`,\n * which the result card's colour probe resolves in the live themed DOM: orange-600\n * in light, non-accessible mode (where bare `--warning` yellow only reaches\n * ~3.2:1 on the white card) and `--warning` elsewhere, whose deepened ramp already\n * clears contrast. Resolving the token NAME at the card means the choice tracks\n * the live theme regardless of where the theme class lives. Other families are\n * unchanged.\n */\nfunction categoryHighlightToken(category: UnitCategory): string {\n return CATEGORY_HIGHLIGHT_TOKEN[category];\n}\n\nexport interface UnitConverterProps extends VariantProps<typeof rootVariants> {\n /** Initial category. Defaults to `'weight'`. */\n defaultCategory?: UnitCategory;\n /** Fires with the converted value (and `null` when input is empty). */\n onResultChange?: (value: number | null) => void;\n /** When provided, shows an \"Insert\" button that emits the result for an editor. */\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 → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\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\n/**\n * Curated imperative handle for agent / external automation. Reads/writes the\n * structural inputs (category, value, from/to units) and the converted result.\n * No patient identity. Consumed by the `unit-converter.agent.ts` adapter; the\n * public `ref` stays the DOM element.\n */\nexport interface UnitConverterHandle {\n /** Active measurement family. */\n getCategory: () => UnitCategory;\n /** Switch the measurement family (resets from/to units to that category). */\n setCategory: (next: UnitCategory) => void;\n /** Source value + from/to unit ids. */\n getInputs: () => { value: number | null; fromId: string; toId: string };\n /** Set the source value to convert. */\n setValue: (value: number | null) => void;\n /** Set from-unit and/or to-unit (ids outside the active category are ignored). */\n setUnits: (next: { fromId?: string; toId?: string }) => void;\n /** Converted value in the to-unit, or null when no source value is set. */\n getResult: () => number | null;\n}\n\nexport const UnitConverter = forwardRef<HTMLDivElement, UnitConverterProps>(\n (\n {\n defaultCategory = 'weight',\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 [category, setCategory] = useState<UnitCategory>(defaultCategory);\n const [value, setValue] = useState<number | null>(null);\n const [fromId, setFromId] = useState<string>(\n UNITS_BY_CATEGORY[defaultCategory][0],\n );\n const [toId, setToId] = useState<string>(\n UNITS_BY_CATEGORY[defaultCategory][1],\n );\n\n const handleCategoryChange = (next: string): void => {\n const cat = next as UnitCategory;\n const units = UNITS_BY_CATEGORY[cat];\n setCategory(cat);\n setFromId(units[0]);\n setToId(units[1] ?? units[0]);\n };\n\n const converted = useMemo(\n () => (value === null ? null : convertUnits(value, fromId, toId)),\n [value, fromId, toId],\n );\n\n const numberFmt = useMemo(\n () => new Intl.NumberFormat(i18n.language, { maximumFractionDigits: 3 }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(converted);\n }, [converted, onResultChange]);\n\n // Live refs so the once-built agent handle reads/writes current state\n // without re-creating on every keystroke. Public `ref` stays the DOM node.\n const liveRef = useRef({ category, value, fromId, toId, converted });\n liveRef.current = { category, value, fromId, toId, converted };\n const agentHandle = useMemo<UnitConverterHandle>(\n () => ({\n getCategory: () => liveRef.current.category,\n setCategory: (next) => handleCategoryChange(next),\n getInputs: () => ({\n value: liveRef.current.value,\n fromId: liveRef.current.fromId,\n toId: liveRef.current.toId,\n }),\n setValue: (next) => setValue(next),\n setUnits: (next) => {\n const units = UNITS_BY_CATEGORY[liveRef.current.category];\n if (next.fromId !== undefined && units.includes(next.fromId)) {\n setFromId(next.fromId);\n }\n if (next.toId !== undefined && units.includes(next.toId)) {\n setToId(next.toId);\n }\n },\n getResult: () => liveRef.current.converted,\n }),\n [],\n );\n useAgentRegistration(unitConverterAgent, agentHandle, id);\n\n const categoryOptions = CATEGORIES.map((c) => ({\n value: c,\n label: t(`unitConverter.category.${c}`),\n }));\n const unitOptions = UNITS_BY_CATEGORY[category].map((u) => ({\n value: u,\n label: t(`unitConverter.units.${u}`),\n }));\n\n return (\n <div\n ref={ref}\n data-component=\"unit-converter\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <FormField label={t('unitConverter.categoryLabel')}>\n <Select\n options={categoryOptions}\n value={category}\n onValueChange={handleCategoryChange}\n />\n </FormField>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3\">\n <FormField label={t('unitConverter.value')}>\n <NumberInput mode=\"decimal\" value={value} onChange={setValue} />\n </FormField>\n <FormField label={t('unitConverter.from')}>\n <Select\n options={unitOptions}\n value={fromId}\n onValueChange={setFromId}\n />\n </FormField>\n <FormField label={t('unitConverter.to')}>\n <Select\n options={unitOptions}\n value={toId}\n onValueChange={setToId}\n />\n </FormField>\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {converted !== null\n ? `${numberFmt.format(value ?? 0)} ${t(\n `unitConverter.units.${fromId}`,\n )} = ${numberFmt.format(converted)} ${t(\n `unitConverter.units.${toId}`,\n )}`\n : ''}\n </p>\n\n {converted !== null ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('unitConverter.result')}\n </span>\n <span className=\"type-metric ds:text-foreground\">\n {numberFmt.format(converted)} {t(`unitConverter.units.${toId}`)}\n </span>\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.unitConverter'),\n icon: 'ruler',\n highlight: t(`unitConverter.category.${category}`),\n // Chip tints by measurement family so the inserted card\n // signals the category at a glance — with the contrast-safe\n // orange override for the `--warning` temperature family.\n highlightToken: categoryHighlightToken(category),\n brand: insertBrand,\n fields: [\n {\n // Source measurement → ruler glyph (matches the header).\n icon: 'ruler',\n label: t('unitConverter.from'),\n value: `${numberFmt.format(value ?? 0)} ${t(\n `unitConverter.units.${fromId}`,\n )}`,\n },\n {\n // Converted result → trending-up (arrow) glyph signals the\n // conversion direction to the output value.\n icon: 'trending-up',\n label: t('unitConverter.to'),\n value: `${numberFmt.format(converted)} ${t(\n `unitConverter.units.${toId}`,\n )}`,\n },\n ],\n }}\n />\n ) : null}\n </div>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('unitConverter.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nUnitConverter.displayName = 'UnitConverter';\n"],"names":["CATEGORIES","unitConverterAgent","handle","args","UNITS","UNITS_BY_CATEGORY","convertUnits","value","fromId","toId","from","to","rootVariants","cva","CATEGORY_HIGHLIGHT_TOKEN","categoryHighlightToken","category","UnitConverter","forwardRef","defaultCategory","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","setCategory","useState","setValue","setFromId","setToId","handleCategoryChange","next","cat","units","converted","useMemo","numberFmt","useEffect","liveRef","useRef","agentHandle","useAgentRegistration","categoryOptions","c","unitOptions","u","jsxs","jsx","FormField","Select","NumberInput","InsertButton"],"mappings":";;;;;;;;;AAoBA,MAAMA,IAAa;AAAA,EACjB;AAAA,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,EAAE,oBAAoB;AAAA,sBAC7B,OAAO,GAAGc,EAAU,OAAOrC,KAAS,CAAC,CAAC,IAAIuB;AAAA,wBACxC,uBAAuBtB,CAAM;AAAA,sBAAA,CAC9B;AAAA,oBAAA;AAAA,oBAEH;AAAA;AAAA;AAAA,sBAGE,MAAM;AAAA,sBACN,OAAOsB,EAAE,kBAAkB;AAAA,sBAC3B,OAAO,GAAGc,EAAU,OAAOF,CAAS,CAAC,IAAIZ;AAAA,wBACvC,uBAAuBrB,CAAI;AAAA,sBAAA,CAC5B;AAAA,oBAAA;AAAA,kBACH;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,GACN,IAEA,gBAAA8C,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAzB,EAAE,qBAAqB,EAAA,CAC1B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAb,GAAc,cAAc;"}
|
|
1
|
+
{"version":3,"file":"unit-converter-Dsk__pjA.js","sources":["../../src/components/unit-converter/unit-converter.agent.ts","../../src/components/unit-converter/units.ts","../../src/components/unit-converter/unit-converter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — UnitConverter. */\n/* */\n/* Generic clinical/everyday unit conversion. The agent-relevant surface */\n/* is the read-only converted result plus the structural inputs (category, */\n/* source value, from-unit, to-unit) and `set_value` actions to drive */\n/* them. Values are plain measurements — no patient identity. The handle */\n/* is the curated `UnitConverterHandle`. See `src/docs/26-agent-readiness`.*/\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { UnitConverterHandle } from './unit-converter';\nimport type { UnitCategory } from './units';\n\n/**\n * Measurement families, mirrored from `./units`'s `CATEGORIES`. Inlined as a\n * literal (rather than runtime-imported) so the ESM catalog build can load this\n * pure module without TS path resolution; `satisfies` keeps it in lockstep with\n * the `UnitCategory` union at compile time.\n */\nconst CATEGORIES = [\n 'weight',\n 'length',\n 'temperature',\n 'glucose',\n] as const satisfies readonly UnitCategory[];\n\nexport const unitConverterAgent: AgentAdapter<UnitConverterHandle> = {\n id: 'unit-converter',\n capabilities: ['set_value', 'view_change'],\n state: {\n category: {\n type: \"'weight' | 'length' | 'temperature' | 'glucose'\",\n descriptionKey: 'ui.agent.unitConverter.state.category',\n description:\n 'Active measurement family. Determines which from/to units are selectable.',\n read: (handle) => handle.getCategory(),\n },\n inputs: {\n type: '{ value: number | null, fromId: string, toId: string }',\n descriptionKey: 'ui.agent.unitConverter.state.inputs',\n description:\n 'Source value plus the from-unit and to-unit ids within the active category.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: 'number | null',\n descriptionKey: 'ui.agent.unitConverter.state.result',\n description:\n 'Converted value in the to-unit, or null when the source value is empty.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: ['number', 'null'],\n description: 'Source value to convert, or null to clear.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.setValue',\n description: 'Set the source value to convert.',\n examples: [{ args: { value: 70 }, note: 'Convert 70 of the from-unit.' }],\n invoke: (handle, args: { value: number | null }) => {\n handle.setValue(args.value);\n },\n },\n set_units: {\n safety: 'read',\n argsType: '{ fromId?: string, toId?: string }',\n argsSchema: {\n type: 'object',\n properties: {\n fromId: {\n type: 'string',\n description: 'Source unit id within the active category.',\n },\n toId: {\n type: 'string',\n description: 'Target unit id within the active category.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.setUnits',\n description:\n 'Set the from-unit and/or to-unit. Ids outside the active category are ignored.',\n examples: [\n { args: { fromId: 'kg', toId: 'lb' }, note: 'Convert kg → lb.' },\n ],\n invoke: (handle, args: { fromId?: string; toId?: string }) => {\n handle.setUnits(args);\n },\n },\n set_category: {\n safety: 'read',\n argsType: \"{ category: 'weight' | 'length' | 'temperature' | 'glucose' }\",\n argsSchema: {\n type: 'object',\n properties: {\n category: {\n enum: [...CATEGORIES],\n description: 'Measurement family to switch to.',\n },\n },\n required: ['category'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.setCategory',\n description:\n 'Switch the measurement family. Resets the from/to units to that category defaults.',\n invoke: (\n handle,\n args: {\n category: 'weight' | 'length' | 'temperature' | 'glucose';\n },\n ) => {\n handle.setCategory(args.category);\n },\n },\n get_result: {\n safety: 'read',\n returns: 'number | null',\n returnsSchema: { type: ['number', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.unitConverter.actions.getResult',\n description:\n 'Return the converted value in the to-unit, or null when no source value is set.',\n invoke: (handle) => handle.getResult(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'unit-converter',\n description: 'Marks the UnitConverter wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific converter instance.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Generic unit conversion — pure, framework-free, unit-testable. */\n/* */\n/* Every unit is described by an affine map to its category's base */\n/* unit: base = value * factor + offset. Conversion is base-in then */\n/* base-out, so the same code handles linear scales (weight, length, */\n/* glucose) and offset scales (temperature) uniformly. */\n/* ------------------------------------------------------------------ */\n\nexport type UnitCategory = 'weight' | 'length' | 'temperature' | 'glucose';\n\nexport interface UnitDef {\n id: string;\n category: UnitCategory;\n /** Multiplier to the category base unit. */\n factor: number;\n /** Additive offset to the base unit (non-zero only for temperature). */\n offset: number;\n}\n\n/* Base units: kg, cm, °C, mmol/L. */\nexport const UNITS: Record<string, UnitDef> = {\n // weight → base kg\n kg: { id: 'kg', category: 'weight', factor: 1, offset: 0 },\n g: { id: 'g', category: 'weight', factor: 0.001, offset: 0 },\n lb: { id: 'lb', category: 'weight', factor: 0.45359237, offset: 0 },\n oz: { id: 'oz', category: 'weight', factor: 0.028349523125, offset: 0 },\n // length → base cm\n cm: { id: 'cm', category: 'length', factor: 1, offset: 0 },\n m: { id: 'm', category: 'length', factor: 100, offset: 0 },\n in: { id: 'in', category: 'length', factor: 2.54, offset: 0 },\n ft: { id: 'ft', category: 'length', factor: 30.48, offset: 0 },\n // temperature → base °C (affine: °C = °F·5/9 − 32·5/9)\n c: { id: 'c', category: 'temperature', factor: 1, offset: 0 },\n f: { id: 'f', category: 'temperature', factor: 5 / 9, offset: (-32 * 5) / 9 },\n // glucose → base mmol/L (1 mg/dL = 1/18.0156 mmol/L)\n mmol_l: { id: 'mmol_l', category: 'glucose', factor: 1, offset: 0 },\n mg_dl: { id: 'mg_dl', category: 'glucose', factor: 1 / 18.0156, offset: 0 },\n};\n\nexport const UNITS_BY_CATEGORY: Record<UnitCategory, string[]> = {\n weight: ['kg', 'g', 'lb', 'oz'],\n length: ['cm', 'm', 'in', 'ft'],\n temperature: ['c', 'f'],\n glucose: ['mmol_l', 'mg_dl'],\n};\n\nexport const CATEGORIES: UnitCategory[] = [\n 'weight',\n 'length',\n 'temperature',\n 'glucose',\n];\n\n/**\n * Convert `value` from one unit to another. Both ids must belong to the same\n * category; mismatched categories throw (a programming error, not user input).\n */\nexport function convertUnits(\n value: number,\n fromId: string,\n toId: string,\n): number {\n const from = UNITS[fromId];\n const to = UNITS[toId];\n if (!from || !to) throw new Error(`Unknown unit: ${fromId} → ${toId}`);\n if (from.category !== to.category) {\n throw new Error(\n `Cannot convert across categories: ${from.category} → ${to.category}`,\n );\n }\n const base = value * from.factor + from.offset;\n return (base - to.offset) / to.factor;\n}\n","/* ------------------------------------------------------------------ */\n/* UnitConverter — generic clinical/everyday unit conversion across */\n/* weight, length, temperature and glucose. */\n/* */\n/* Maths lives in `./units` (pure, separately tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { unitConverterAgent } from './unit-converter.agent';\nimport { FormField } from '../form-field';\nimport { NumberInput } from '../number-input';\nimport { Select } from '../select';\nimport {\n InsertButton,\n type InsertPayload,\n type InsertVariant,\n type InsertMode,\n} from '../_shared/insert-result';\nimport {\n type UnitCategory,\n CATEGORIES,\n UNITS_BY_CATEGORY,\n convertUnits,\n} from './units';\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\n/**\n * DS token NAME backing the result-card category chip, one per measurement\n * family. The converter shows no on-screen badge, but the inserted card carries\n * a category chip so the reader can tell at a glance which family the figure\n * belongs to; each token is a closed-palette semantic alias resolved to a\n * concrete colour at raster time by `InsertButton`.\n */\nconst CATEGORY_HIGHLIGHT_TOKEN: Record<UnitCategory, string> = {\n weight: '--info',\n length: '--success',\n temperature: '--warning-readable',\n glucose: '--accent',\n};\n\n/**\n * Category chip token. The `temperature` family resolves to `--warning-readable`,\n * which the result card's colour probe resolves in the live themed DOM: orange-600\n * in light, non-accessible mode (where bare `--warning` yellow only reaches\n * ~3.2:1 on the white card) and `--warning` elsewhere, whose deepened ramp already\n * clears contrast. Resolving the token NAME at the card means the choice tracks\n * the live theme regardless of where the theme class lives. Other families are\n * unchanged.\n */\nfunction categoryHighlightToken(category: UnitCategory): string {\n return CATEGORY_HIGHLIGHT_TOKEN[category];\n}\n\nexport interface UnitConverterProps extends VariantProps<typeof rootVariants> {\n /** Initial category. Defaults to `'weight'`. */\n defaultCategory?: UnitCategory;\n /** Fires with the converted value (and `null` when input is empty). */\n onResultChange?: (value: number | null) => void;\n /** When provided, shows an \"Insert\" button that emits the result for an editor. */\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 → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\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\n/**\n * Curated imperative handle for agent / external automation. Reads/writes the\n * structural inputs (category, value, from/to units) and the converted result.\n * No patient identity. Consumed by the `unit-converter.agent.ts` adapter; the\n * public `ref` stays the DOM element.\n */\nexport interface UnitConverterHandle {\n /** Active measurement family. */\n getCategory: () => UnitCategory;\n /** Switch the measurement family (resets from/to units to that category). */\n setCategory: (next: UnitCategory) => void;\n /** Source value + from/to unit ids. */\n getInputs: () => { value: number | null; fromId: string; toId: string };\n /** Set the source value to convert. */\n setValue: (value: number | null) => void;\n /** Set from-unit and/or to-unit (ids outside the active category are ignored). */\n setUnits: (next: { fromId?: string; toId?: string }) => void;\n /** Converted value in the to-unit, or null when no source value is set. */\n getResult: () => number | null;\n}\n\nexport const UnitConverter = forwardRef<HTMLDivElement, UnitConverterProps>(\n (\n {\n defaultCategory = 'weight',\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 [category, setCategory] = useState<UnitCategory>(defaultCategory);\n const [value, setValue] = useState<number | null>(null);\n const [fromId, setFromId] = useState<string>(\n UNITS_BY_CATEGORY[defaultCategory][0],\n );\n const [toId, setToId] = useState<string>(\n UNITS_BY_CATEGORY[defaultCategory][1],\n );\n\n const handleCategoryChange = (next: string): void => {\n const cat = next as UnitCategory;\n const units = UNITS_BY_CATEGORY[cat];\n setCategory(cat);\n setFromId(units[0]);\n setToId(units[1] ?? units[0]);\n };\n\n const converted = useMemo(\n () => (value === null ? null : convertUnits(value, fromId, toId)),\n [value, fromId, toId],\n );\n\n const numberFmt = useMemo(\n () => new Intl.NumberFormat(i18n.language, { maximumFractionDigits: 3 }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(converted);\n }, [converted, onResultChange]);\n\n // Live refs so the once-built agent handle reads/writes current state\n // without re-creating on every keystroke. Public `ref` stays the DOM node.\n const liveRef = useRef({ category, value, fromId, toId, converted });\n liveRef.current = { category, value, fromId, toId, converted };\n const agentHandle = useMemo<UnitConverterHandle>(\n () => ({\n getCategory: () => liveRef.current.category,\n setCategory: (next) => handleCategoryChange(next),\n getInputs: () => ({\n value: liveRef.current.value,\n fromId: liveRef.current.fromId,\n toId: liveRef.current.toId,\n }),\n setValue: (next) => setValue(next),\n setUnits: (next) => {\n const units = UNITS_BY_CATEGORY[liveRef.current.category];\n if (next.fromId !== undefined && units.includes(next.fromId)) {\n setFromId(next.fromId);\n }\n if (next.toId !== undefined && units.includes(next.toId)) {\n setToId(next.toId);\n }\n },\n getResult: () => liveRef.current.converted,\n }),\n [],\n );\n useAgentRegistration(unitConverterAgent, agentHandle, id);\n\n const categoryOptions = CATEGORIES.map((c) => ({\n value: c,\n label: t(`unitConverter.category.${c}`),\n }));\n const unitOptions = UNITS_BY_CATEGORY[category].map((u) => ({\n value: u,\n label: t(`unitConverter.units.${u}`),\n }));\n\n return (\n <div\n ref={ref}\n data-component=\"unit-converter\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <FormField label={t('unitConverter.categoryLabel')}>\n <Select\n options={categoryOptions}\n value={category}\n onValueChange={handleCategoryChange}\n />\n </FormField>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3\">\n <FormField label={t('unitConverter.value')}>\n <NumberInput mode=\"decimal\" value={value} onChange={setValue} />\n </FormField>\n <FormField label={t('unitConverter.from')}>\n <Select\n options={unitOptions}\n value={fromId}\n onValueChange={setFromId}\n />\n </FormField>\n <FormField label={t('unitConverter.to')}>\n <Select\n options={unitOptions}\n value={toId}\n onValueChange={setToId}\n />\n </FormField>\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {converted !== null\n ? `${numberFmt.format(value ?? 0)} ${t(\n `unitConverter.units.${fromId}`,\n )} = ${numberFmt.format(converted)} ${t(\n `unitConverter.units.${toId}`,\n )}`\n : ''}\n </p>\n\n {converted !== null ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('unitConverter.result')}\n </span>\n <span className=\"type-metric ds:text-foreground\">\n {numberFmt.format(converted)} {t(`unitConverter.units.${toId}`)}\n </span>\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.unitConverter'),\n icon: 'ruler',\n highlight: t(`unitConverter.category.${category}`),\n // Chip tints by measurement family so the inserted card\n // signals the category at a glance — with the contrast-safe\n // orange override for the `--warning` temperature family.\n highlightToken: categoryHighlightToken(category),\n brand: insertBrand,\n fields: [\n {\n // Source measurement → ruler glyph (matches the header).\n icon: 'ruler',\n label: t('unitConverter.from'),\n value: `${numberFmt.format(value ?? 0)} ${t(\n `unitConverter.units.${fromId}`,\n )}`,\n },\n {\n // Converted result → trending-up (arrow) glyph signals the\n // conversion direction to the output value.\n icon: 'trending-up',\n label: t('unitConverter.to'),\n value: `${numberFmt.format(converted)} ${t(\n `unitConverter.units.${toId}`,\n )}`,\n },\n ],\n }}\n />\n ) : null}\n </div>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('unitConverter.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nUnitConverter.displayName = 'UnitConverter';\n"],"names":["CATEGORIES","unitConverterAgent","handle","args","UNITS","UNITS_BY_CATEGORY","convertUnits","value","fromId","toId","from","to","rootVariants","cva","CATEGORY_HIGHLIGHT_TOKEN","categoryHighlightToken","category","UnitConverter","forwardRef","defaultCategory","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","setCategory","useState","setValue","setFromId","setToId","handleCategoryChange","next","cat","units","converted","useMemo","numberFmt","useEffect","liveRef","useRef","agentHandle","useAgentRegistration","categoryOptions","c","unitOptions","u","jsxs","jsx","FormField","Select","NumberInput","InsertButton"],"mappings":";;;;;;;;;AAoBA,MAAMA,IAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAwD;AAAA,EACnE,IAAI;AAAA,EACJ,cAAc,CAAC,aAAa,aAAa;AAAA,EACzC,OAAO;AAAA,IACL,UAAU;AAAA,MACR,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,YAAA;AAAA,IAAY;AAAA,IAEvC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,EACrC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO;AAAA,YACL,MAAM,CAAC,UAAU,MAAM;AAAA,YACvB,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAEF,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,MAAM,MAAM,gCAAgC;AAAA,MACxE,QAAQ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gBACT,UAAAD;AAAA,gBACA,QAAAE;AAAA,gBACA,SAAAC;AAAA,gBACA,MAAM;AAAA,kBACJ,OAAOM,EAAE,4BAA4B;AAAA,kBACrC,MAAM;AAAA,kBACN,WAAWA,EAAE,0BAA0Bd,CAAQ,EAAE;AAAA;AAAA;AAAA;AAAA,kBAIjD,gBAAgBD,EAAuBC,CAAQ;AAAA,kBAC/C,OAAOS;AAAA,kBACP,QAAQ;AAAA,oBACN;AAAA;AAAA,sBAEE,MAAM;AAAA,sBACN,OAAOK,EAAE,oBAAoB;AAAA,sBAC7B,OAAO,GAAGc,EAAU,OAAOrC,KAAS,CAAC,CAAC,IAAIuB;AAAA,wBACxC,uBAAuBtB,CAAM;AAAA,sBAAA,CAC9B;AAAA,oBAAA;AAAA,oBAEH;AAAA;AAAA;AAAA,sBAGE,MAAM;AAAA,sBACN,OAAOsB,EAAE,kBAAkB;AAAA,sBAC3B,OAAO,GAAGc,EAAU,OAAOF,CAAS,CAAC,IAAIZ;AAAA,wBACvC,uBAAuBrB,CAAI;AAAA,sBAAA,CAC5B;AAAA,oBAAA;AAAA,kBACH;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,GACN,IAEA,gBAAA8C,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAzB,EAAE,qBAAqB,EAAA,CAC1B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAb,GAAc,cAAc;"}
|
package/dist/agent-catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "1.4.
|
|
3
|
+
"packageVersion": "1.4.13",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "component",
|
|
@@ -3209,6 +3209,12 @@
|
|
|
3209
3209
|
"type": "number",
|
|
3210
3210
|
"description": "Zero-indexed page number.",
|
|
3211
3211
|
"descriptionKey": "ui.agent.dataTable.state.currentPage"
|
|
3212
|
+
},
|
|
3213
|
+
{
|
|
3214
|
+
"name": "expandedRowId",
|
|
3215
|
+
"type": "string | null",
|
|
3216
|
+
"description": "Id of the row whose inline detail is open (expandable row), or null.",
|
|
3217
|
+
"descriptionKey": "ui.agent.dataTable.state.expandedRowId"
|
|
3212
3218
|
}
|
|
3213
3219
|
],
|
|
3214
3220
|
"actions": [
|
|
@@ -3401,7 +3407,7 @@
|
|
|
3401
3407
|
},
|
|
3402
3408
|
"item": {
|
|
3403
3409
|
"attr": "row-id",
|
|
3404
|
-
"description": "Native ag-grid row-id attribute on each rendered row. Selection is performed via the curated handle, not by DOM mutation."
|
|
3410
|
+
"description": "Native ag-grid row-id attribute on each rendered record row. When an expandable row is open, one extra full-width row with row-id `<parentId>::detail` is the accordion detail, not a record — its cell carries data-component=\"data-table-expanded-row\" and data-expanded-row-of=\"<parentId>\"; skip it when enumerating rows (isExpandedRowDetailId). Selection is performed via the curated handle, not by DOM mutation."
|
|
3405
3411
|
}
|
|
3406
3412
|
}
|
|
3407
3413
|
},
|
|
@@ -15132,7 +15138,7 @@
|
|
|
15132
15138
|
"entity": "parameter"
|
|
15133
15139
|
},
|
|
15134
15140
|
{
|
|
15135
|
-
"component": "
|
|
15141
|
+
"component": "dropdown-menu",
|
|
15136
15142
|
"as": "shownVisits",
|
|
15137
15143
|
"entity": "visit"
|
|
15138
15144
|
},
|
|
@@ -15338,13 +15344,14 @@
|
|
|
15338
15344
|
{
|
|
15339
15345
|
"name": "window_visits",
|
|
15340
15346
|
"safety": "read",
|
|
15341
|
-
"description": "Choose which visits the evolution grid shows as columns, by ticking them in the
|
|
15347
|
+
"description": "Choose which visits the evolution grid shows as columns, by ticking them in the Visits menu — one button that opens a list of checkbox items, with a Select all row first. Every visit is ticked on arrival; un-ticking one removes its column, the menu stays open while ticking, and the last remaining visit cannot be un-ticked. The change between two adjacent shown columns is always drawn. The button itself reads how many visits are shown out of how many exist. Clinician-only; view state only.",
|
|
15342
15348
|
"descriptionKey": "ui.agent.anamnesis.workflows.windowVisits",
|
|
15343
15349
|
"uiActions": [
|
|
15344
|
-
"
|
|
15350
|
+
"dropdown-menu.open",
|
|
15351
|
+
"dropdown-menu.close"
|
|
15345
15352
|
],
|
|
15346
15353
|
"stateReads": [
|
|
15347
|
-
"
|
|
15354
|
+
"dropdown-menu.isOpen"
|
|
15348
15355
|
],
|
|
15349
15356
|
"apiActions": []
|
|
15350
15357
|
},
|
|
@@ -15380,8 +15387,7 @@
|
|
|
15380
15387
|
"dropdown-menu.close"
|
|
15381
15388
|
],
|
|
15382
15389
|
"stateReads": [
|
|
15383
|
-
"dropdown-menu.isOpen"
|
|
15384
|
-
"multi-select.selection"
|
|
15390
|
+
"dropdown-menu.isOpen"
|
|
15385
15391
|
],
|
|
15386
15392
|
"apiActions": [
|
|
15387
15393
|
"anamnesis.exportTab"
|