@alfadocs/ui-kit-debug 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js → anamnesis-summary-rows-d44s_whc.js} +2 -2
- package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js.map → anamnesis-summary-rows-d44s_whc.js.map} +1 -1
- package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js → antenatal-schedule-timeline-B1k8QkA6.js} +3 -3
- package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js.map → antenatal-schedule-timeline-B1k8QkA6.js.map} +1 -1
- package/dist/_chunks/{appointment-card-BhcPJpXh.js → appointment-card-Dzr3GeVz.js} +73 -90
- package/dist/_chunks/appointment-card-Dzr3GeVz.js.map +1 -0
- package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js → appointment-timeline-0mwtpErq.js} +3 -3
- package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js.map → appointment-timeline-0mwtpErq.js.map} +1 -1
- package/dist/_chunks/{appointment-tray-3c_FLxXJ.js → appointment-tray-4FUu_5NX.js} +2 -2
- package/dist/_chunks/{appointment-tray-3c_FLxXJ.js.map → appointment-tray-4FUu_5NX.js.map} +1 -1
- package/dist/_chunks/armchair-BaLDW6Hz.js +23 -0
- package/dist/_chunks/armchair-BaLDW6Hz.js.map +1 -0
- package/dist/_chunks/{booking-CQMJUFG-.js → booking-DHkKcUIl.js} +4 -4
- package/dist/_chunks/{booking-CQMJUFG-.js.map → booking-DHkKcUIl.js.map} +1 -1
- package/dist/_chunks/{calendar-4dXTvsCz.js → calendar-B4Gnyu1C.js} +553 -437
- package/dist/_chunks/calendar-B4Gnyu1C.js.map +1 -0
- package/dist/_chunks/calendar-event-card-Bjdbik8G.js +425 -0
- package/dist/_chunks/calendar-event-card-Bjdbik8G.js.map +1 -0
- package/dist/_chunks/{care-plan-card-DQjVRDxO.js → care-plan-card-aDN4oem9.js} +3 -3
- package/dist/_chunks/{care-plan-card-DQjVRDxO.js.map → care-plan-card-aDN4oem9.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js → care-plan-entry-card-BEhANdBE.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js.map → care-plan-entry-card-BEhANdBE.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-CxYoq23f.js → care-plan-header-CkpPyQqG.js} +2 -2
- package/dist/_chunks/{care-plan-header-CxYoq23f.js.map → care-plan-header-CkpPyQqG.js.map} +1 -1
- package/dist/_chunks/{color-picker-D-tUwxxT.js → color-picker-oZ6zYks8.js} +164 -151
- package/dist/_chunks/color-picker-oZ6zYks8.js.map +1 -0
- package/dist/_chunks/control-room-rail-Cj2iX9h_.js +337 -0
- package/dist/_chunks/control-room-rail-Cj2iX9h_.js.map +1 -0
- package/dist/_chunks/{cycle-calculator-DzgO1vzP.js → cycle-calculator-DmtYGhqq.js} +3 -3
- package/dist/_chunks/{cycle-calculator-DzgO1vzP.js.map → cycle-calculator-DmtYGhqq.js.map} +1 -1
- package/dist/_chunks/{date-picker-Bp64zk2p.js → date-picker-CepI_oI2.js} +77 -74
- package/dist/_chunks/date-picker-CepI_oI2.js.map +1 -0
- package/dist/_chunks/{date-picker-variants-pKAJfnWr.js → date-picker-variants-DfuooXEK.js} +7 -2
- package/dist/_chunks/{date-picker-variants-pKAJfnWr.js.map → date-picker-variants-DfuooXEK.js.map} +1 -1
- package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js → date-range-picker-BD8P_rJq.js} +46 -45
- package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js.map → date-range-picker-BD8P_rJq.js.map} +1 -1
- package/dist/_chunks/{date-time-picker-DVETwpzc.js → date-time-picker-3I2vVKGV.js} +2 -2
- package/dist/_chunks/{date-time-picker-DVETwpzc.js.map → date-time-picker-3I2vVKGV.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-wK8Tajzz.js → due-date-calculator-BF_Ikofx.js} +4 -4
- package/dist/_chunks/{due-date-calculator-wK8Tajzz.js.map → due-date-calculator-BF_Ikofx.js.map} +1 -1
- package/dist/_chunks/{entity-card-9_62gY7l.js → entity-card-DmrgYSEX.js} +4 -4
- package/dist/_chunks/{entity-card-9_62gY7l.js.map → entity-card-DmrgYSEX.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js → gestational-age-calculator-CxZelpu2.js} +5 -5
- package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js.map → gestational-age-calculator-CxZelpu2.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-BaXkJhT-.js → hcg-doubling-CpU7H5rQ.js} +3 -3
- package/dist/_chunks/{hcg-doubling-BaXkJhT-.js.map → hcg-doubling-CpU7H5rQ.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js → link-cell-renderer-BZQtsuFz.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js.map → link-cell-renderer-BZQtsuFz.js.map} +1 -1
- package/dist/_chunks/{notes-panel-DlnENphf.js → notes-panel-e9cJWVRg.js} +2 -2
- package/dist/_chunks/{notes-panel-DlnENphf.js.map → notes-panel-e9cJWVRg.js.map} +1 -1
- package/dist/_chunks/{operator-hero-CCDnIa1S.js → operator-hero-BnFv-Uef.js} +2 -2
- package/dist/_chunks/{operator-hero-CCDnIa1S.js.map → operator-hero-BnFv-Uef.js.map} +1 -1
- package/dist/_chunks/{parse-JqixfsU0.js → parse-MN9bGkrY.js} +2 -2
- package/dist/_chunks/{parse-JqixfsU0.js.map → parse-MN9bGkrY.js.map} +1 -1
- package/dist/_chunks/{patient-details-qnsqYBGQ.js → patient-details-xrqe13az.js} +160 -159
- package/dist/_chunks/patient-details-xrqe13az.js.map +1 -0
- package/dist/_chunks/{patient-table-DwshfVsQ.js → patient-table-BqYomX50.js} +2 -2
- package/dist/_chunks/{patient-table-DwshfVsQ.js.map → patient-table-BqYomX50.js.map} +1 -1
- package/dist/_chunks/{payment-automation-upsell-BBIG7NFL.js → payment-automation-upsell-DwQW2fRp.js} +52 -63
- package/dist/_chunks/payment-automation-upsell-DwQW2fRp.js.map +1 -0
- package/dist/_chunks/{payment-request-card-BjjBMdsp.js → payment-request-card-YVCcCZ25.js} +2 -2
- package/dist/_chunks/{payment-request-card-BjjBMdsp.js.map → payment-request-card-YVCcCZ25.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js → pregnancy-dating-DtToyMyc.js} +5 -5
- package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js.map → pregnancy-dating-DtToyMyc.js.map} +1 -1
- package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js → radiograph-panel.agent-C3trfWqB.js} +3 -3
- package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js.map → radiograph-panel.agent-C3trfWqB.js.map} +1 -1
- package/dist/_chunks/repeat-CvQa5rZt.js +17 -0
- package/dist/_chunks/repeat-CvQa5rZt.js.map +1 -0
- package/dist/_chunks/resource-chip-DYTG0IQQ.js +83 -0
- package/dist/_chunks/resource-chip-DYTG0IQQ.js.map +1 -0
- package/dist/_chunks/{rich-text-editor-DARnq_6N.js → rich-text-editor-BDfFtK4H.js} +2 -2
- package/dist/_chunks/{rich-text-editor-DARnq_6N.js.map → rich-text-editor-BDfFtK4H.js.map} +1 -1
- package/dist/_chunks/subDays-BLl3y3pd.js +8 -0
- package/dist/_chunks/{subDays-CAUv47M1.js.map → subDays-BLl3y3pd.js.map} +1 -1
- package/dist/agent-catalog.json +2 -2
- package/dist/components/_shared/date-picker-variants.d.ts.map +1 -1
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calendar/calendar.agent.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +138 -12
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/calendar-event-card/calendar-event-card.d.ts +48 -11
- package/dist/components/calendar-event-card/calendar-event-card.d.ts.map +1 -1
- package/dist/components/calendar-event-card/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/color-picker/index.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts.map +1 -1
- package/dist/components/color-picker/index.js +4 -3
- package/dist/components/color-picker/palettes.d.ts +10 -0
- package/dist/components/color-picker/palettes.d.ts.map +1 -1
- package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
- package/dist/components/control-room-rail/control-room-rail.d.ts.map +1 -1
- package/dist/components/control-room-rail/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/date-picker.d.ts +11 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-details/patient-details.d.ts +8 -0
- package/dist/components/patient-details/patient-details.d.ts.map +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/resource-chip/index.d.ts +3 -0
- package/dist/components/resource-chip/index.d.ts.map +1 -0
- package/dist/components/resource-chip/index.js +5 -0
- package/dist/components/resource-chip/index.js.map +1 -0
- package/dist/components/resource-chip/resource-chip.d.ts +26 -0
- package/dist/components/resource-chip/resource-chip.d.ts.map +1 -0
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/i18n/locales/ar.d.ts +4 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +4 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +4 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +4 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +4 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +4 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +4 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +4 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +4 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +4 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +4 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +4 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +4 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +4 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +4 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +4 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +4 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +4 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +4 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +4 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +4 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +4 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +4 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +4 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +4 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +4 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +4 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +4 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +4 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +4 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +4 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +4 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +4 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +4 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +4 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +4 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +961 -958
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +4 -0
- package/dist/locales/de.json +4 -0
- package/dist/locales/el.json +4 -0
- package/dist/locales/en.json +4 -0
- package/dist/locales/es.json +4 -0
- package/dist/locales/fr.json +4 -0
- package/dist/locales/hi.json +4 -0
- package/dist/locales/it.json +4 -0
- package/dist/locales/ja.json +4 -0
- package/dist/locales/nl.json +4 -0
- package/dist/locales/pl.json +4 -0
- package/dist/locales/pt.json +4 -0
- package/dist/locales/ro.json +4 -0
- package/dist/locales/ru.json +4 -0
- package/dist/locales/sq.json +4 -0
- package/dist/locales/sv.json +4 -0
- package/dist/locales/tr.json +4 -0
- package/dist/locales/zh.json +4 -0
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +1 -1
- package/dist/tokens.css +40 -24
- package/package.json +5 -1
- package/dist/_chunks/appointment-card-BhcPJpXh.js.map +0 -1
- package/dist/_chunks/calendar-4dXTvsCz.js.map +0 -1
- package/dist/_chunks/calendar-event-card-C6qGtywL.js +0 -257
- package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +0 -1
- package/dist/_chunks/color-picker-D-tUwxxT.js.map +0 -1
- package/dist/_chunks/control-room-rail-IH1eBjrK.js +0 -333
- package/dist/_chunks/control-room-rail-IH1eBjrK.js.map +0 -1
- package/dist/_chunks/date-picker-Bp64zk2p.js.map +0 -1
- package/dist/_chunks/patient-details-qnsqYBGQ.js.map +0 -1
- package/dist/_chunks/payment-automation-upsell-BBIG7NFL.js.map +0 -1
- package/dist/_chunks/subDays-CAUv47M1.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-time-picker-DVETwpzc.js","sources":["../../node_modules/date-fns/setHours.js","../../node_modules/date-fns/setMinutes.js","../../src/components/date-time-picker/date-time-picker.agent.ts","../../src/components/date-time-picker/date-time-picker.tsx"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link setHours} function options.\n */\n\n/**\n * @name setHours\n * @category Hour Helpers\n * @summary Set the hours to the given date.\n *\n * @description\n * Set the hours to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param hours - The hours of the new date\n * @param options - An object with options\n *\n * @returns The new date with the hours set\n *\n * @example\n * // Set 4 hours to 1 September 2014 11:30:00:\n * const result = setHours(new Date(2014, 8, 1, 11, 30), 4)\n * //=> Mon Sep 01 2014 04:30:00\n */\nexport function setHours(date, hours, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(hours);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default setHours;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link setMinutes} function options.\n */\n\n/**\n * @name setMinutes\n * @category Minute Helpers\n * @summary Set the minutes to the given date.\n *\n * @description\n * Set the minutes to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows using extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, returned from the context function, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param minutes - The minutes of the new date\n * @param options - An object with options\n *\n * @returns The new date with the minutes set\n *\n * @example\n * // Set 45 minutes to 1 September 2014 11:30:40:\n * const result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)\n * //=> Mon Sep 01 2014 11:45:40\n */\nexport function setMinutes(date, minutes, options) {\n const date_ = toDate(date, options?.in);\n date_.setMinutes(minutes);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default setMinutes;\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DateTimePicker. */\n/* */\n/* DateTimePicker composes a react-day-picker calendar grid with the */\n/* TimePicker segments inside a single Radix Popover. The agent surface */\n/* exposes a combined datetime — set / clear / open / close. The handle */\n/* is the curated surface; consumers don't address the inner sub-widgets.*/\n/* */\n/* See `src/docs/26-agent-readiness.mdx` §15. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DateTimePickerHandle } from './date-time-picker';\n\nexport const dateTimePickerAgent: AgentAdapter<DateTimePickerHandle> = {\n id: 'date-time-picker',\n // Persisted single datetime (value state + set_datetime) → select_single +\n // set_value, plus open/close of the combined popover.\n capabilities: ['select_single', 'set_value', 'open', 'close'],\n state: {\n value: {\n type: 'iso-datetime',\n descriptionKey: 'ui.agent.dateTimePicker.state.value',\n description: 'Currently-selected ISO datetime, or null.',\n read: (handle) => handle.getValue()?.toISOString() ?? null,\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.dateTimePicker.state.isOpen',\n description: 'Whether the datetime popover is open.',\n read: (handle) => handle.isOpen(),\n },\n },\n actions: {\n set_datetime: {\n safety: 'write',\n argsType: '{ datetime: string }',\n argsSchema: {\n type: 'object',\n properties: {\n datetime: {\n type: 'string',\n format: 'date-time',\n description: 'ISO datetime, e.g. \"2026-06-23T14:30:00Z\".',\n },\n },\n required: ['datetime'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.setDatetime',\n description: 'Select a specific datetime (ISO string).',\n examples: [\n {\n args: { datetime: '2026-06-23T14:30:00Z' },\n note: 'Select 23 Jun 2026, 14:30 UTC.',\n },\n ],\n invoke: (handle, args: { datetime: string }) => {\n handle.setValue(new Date(args.datetime));\n },\n },\n clear: {\n // Discards the selected datetime — loses the user's input.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.clear',\n description: 'Clear the selected datetime.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.open',\n description: 'Open the datetime popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.close',\n description: 'Close the datetime popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'date-time-picker',\n description: 'Marks the DateTimePicker wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport * as Popover from '@radix-ui/react-popover';\nimport { DayPicker } from 'react-day-picker';\nimport {\n format as fnsFormat,\n isBefore,\n isAfter,\n setHours,\n setMinutes,\n} from 'date-fns';\nimport { CalendarDays } from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useFormField } from '../form-field/form-field-context';\nimport {\n useDateFnsLocale,\n buildDisabledMatcher,\n CalendarChevron,\n calendarClassNames,\n triggerVariants,\n calendarIconVariants,\n popoverContentVariants,\n} from '../_shared';\nimport { TimePicker } from '../time-picker/time-picker';\nimport type { TimeValue } from '../_shared/time';\nimport { useAgentRegistration } from '../../agent';\nimport { dateTimePickerAgent } from './date-time-picker.agent';\n\n/* -------------------------------------------------------------------------- */\n/* Imperative handle */\n/* -------------------------------------------------------------------------- */\n\n/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */\nexport interface DateTimePickerHandle {\n /** Get the current selected datetime, or undefined. */\n getValue: () => Date | undefined;\n /** Set the selected datetime. */\n setValue: (date: Date | undefined) => void;\n /** Clear the selected datetime. */\n clear: () => void;\n /** Whether the popover is open. */\n isOpen: () => boolean;\n /** Open the popover. */\n open: () => void;\n /** Close the popover. */\n close: () => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------------- */\n\n/** Get timezone short name. */\nfunction getTimezoneLabel(locale: string, timezone?: string): string {\n try {\n const opts: Intl.DateTimeFormatOptions = { timeZoneName: 'short' };\n if (timezone && timezone !== 'local') {\n opts.timeZone = timezone === 'utc' ? 'UTC' : timezone;\n }\n const parts = new Intl.DateTimeFormat(locale, opts).formatToParts(\n new Date(),\n );\n return parts.find((p) => p.type === 'timeZoneName')?.value ?? '';\n } catch {\n return '';\n }\n}\n\n/** Check if a timezone differs from the browser's. */\nfunction tzDiffersFromBrowser(timezone?: string): boolean {\n if (!timezone || timezone === 'local') return false;\n try {\n const browserTz = Intl.DateTimeFormat().resolvedOptions().timeZone;\n if (timezone === 'utc') return browserTz !== 'UTC';\n return browserTz !== timezone;\n } catch {\n return false;\n }\n}\n\n/* -------------------------------------------------------------------------- */\n/* CVA variants */\n/* -------------------------------------------------------------------------- */\n\nconst applyButtonVariants = cva(\n [\n 'ds:w-full ds:rounded-[var(--radius-sm)]',\n 'ds:bg-primary ds:text-primary-foreground',\n 'ds:hover:bg-primary-hover ds:cursor-pointer',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:h-8 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]',\n lg: 'ds:h-12 ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n/* -------------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------------- */\n\nexport interface DateTimePickerProps extends Pick<\n VariantProps<typeof triggerVariants>,\n 'size'\n> {\n /** Current datetime — controlled. */\n value?: Date;\n /** Default datetime — uncontrolled. */\n defaultValue?: Date;\n /** Called when the datetime changes. */\n onChange?: (date: Date | undefined) => void;\n /** Timezone — IANA string, 'local', or 'utc'. */\n timezone?: string;\n /** Show timezone annotation. Defaults to true when tz differs from browser. */\n showTimezone?: boolean;\n /** Minimum datetime. */\n minDate?: Date;\n /** Maximum datetime. */\n maxDate?: Date;\n /** Force 12h/24h mode. */\n hour12?: boolean;\n /** Minute step for TimePicker. */\n minuteStep?: 1 | 5 | 10 | 15 | 30;\n /** Component size. */\n size?: 'sm' | 'md' | 'lg';\n /** Disabled state. */\n disabled?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /** Additional class names. */\n className?: string;\n /** id override. */\n id?: string;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------------- */\n\nexport const DateTimePicker = forwardRef<\n DateTimePickerHandle,\n DateTimePickerProps\n>(\n (\n {\n value,\n defaultValue,\n onChange,\n timezone,\n showTimezone: showTimezoneProp,\n minDate,\n maxDate,\n hour12,\n minuteStep = 1,\n size = 'md',\n disabled,\n placeholder,\n className,\n id,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n const effectiveId = id ?? ctx.id;\n const effectiveDisabled = ctx.disabled || disabled;\n const effectiveTone = ctx.invalid ? 'error' : 'default';\n\n const locale = useDateFnsLocale(i18n.language);\n const placeholderText =\n placeholder ??\n t('inputs.dateTimePicker.placeholder', 'Select date and time');\n const applyLabel = t('inputs.dateTimePicker.apply', 'Apply');\n const outOfRangeLabel = t(\n 'inputs.dateTimePicker.outOfRange',\n 'Date/time is out of allowed range',\n );\n\n const showTimezone =\n showTimezoneProp !== undefined\n ? showTimezoneProp\n : tzDiffersFromBrowser(timezone);\n const timezoneLabel = showTimezone\n ? getTimezoneLabel(i18n.language, timezone)\n : '';\n\n const [currentValueRaw, setDateTimeValue] = useControllableState<\n Date | undefined\n >({\n value,\n defaultValue,\n onChange,\n });\n const currentValue = currentValueRaw;\n\n // Draft state while popover is open\n const [draftDate, setDraftDate] = useState<Date | undefined>(currentValue);\n const [open, setOpen] = useState(false);\n const [month, setMonth] = useState<Date>(currentValue ?? new Date());\n const [rangeError, setRangeError] = useState(false);\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const emit = useCallback(\n (date: Date | undefined) => {\n setDateTimeValue(date);\n },\n [setDateTimeValue],\n );\n\n const disabledMatcher = buildDisabledMatcher(minDate, maxDate);\n\n /** Check if a full datetime is within range. */\n const isInRange = useCallback(\n (date: Date): boolean => {\n if (minDate && isBefore(date, minDate)) return false;\n if (maxDate && isAfter(date, maxDate)) return false;\n return true;\n },\n [minDate, maxDate],\n );\n\n // Sync draft when popover opens\n const handleOpenChange = (nextOpen: boolean) => {\n if (nextOpen) {\n setDraftDate(currentValue ?? new Date());\n setMonth(currentValue ?? new Date());\n setRangeError(false);\n }\n setOpen(nextOpen);\n };\n\n const handleDaySelect = (date: Date | undefined) => {\n if (!date) return;\n const prev = draftDate ?? new Date();\n const merged = setMinutes(\n setHours(date, prev.getHours()),\n prev.getMinutes(),\n );\n setDraftDate(merged);\n setRangeError(!isInRange(merged));\n };\n\n const handleTimeChange = (time: TimeValue) => {\n const prev = draftDate ?? new Date();\n const merged = setMinutes(setHours(prev, time.hours), time.minutes);\n setDraftDate(merged);\n setRangeError(!isInRange(merged));\n };\n\n const handleApply = () => {\n if (!draftDate) return;\n if (!isInRange(draftDate)) {\n setRangeError(true);\n return;\n }\n emit(draftDate);\n setOpen(false);\n triggerRef.current?.focus();\n };\n\n // Format display text\n const displayText = currentValue\n ? fnsFormat(currentValue, 'MMM d, yyyy HH:mm', { locale })\n : '';\n\n const calendarLabel = t('inputs.datePicker.gridLabel', 'Calendar');\n const timeLabel = t('inputs.timePicker.groupLabel', 'Time');\n\n const handle = useMemo<DateTimePickerHandle>(\n () => ({\n getValue: () => currentValue,\n setValue: (date) => emit(date),\n clear: () => emit(undefined),\n isOpen: () => open,\n // Mirror the trigger's open behaviour so draft state seeds correctly.\n open: () => {\n setDraftDate(currentValue ?? new Date());\n setMonth(currentValue ?? new Date());\n setRangeError(false);\n setOpen(true);\n },\n close: () => setOpen(false),\n }),\n [currentValue, emit, open],\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(dateTimePickerAgent, handle, effectiveId);\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange}>\n <div\n className={className}\n data-component=\"date-time-picker\"\n data-component-id={effectiveId}\n >\n <Popover.Trigger asChild disabled={effectiveDisabled}>\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- FormField propagates invalid state to its trigger; users rely on this for validation announcements */}\n <button\n ref={triggerRef}\n id={effectiveId}\n type=\"button\"\n disabled={effectiveDisabled}\n aria-describedby={ctx.describedBy || undefined}\n aria-invalid={ctx.invalid || undefined}\n // `aria-required` is not valid on `<button>` per ARIA 1.2 — the\n // FormField label's visible asterisk + `aria-describedby` link\n // communicate the required state instead.\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={triggerVariants({ size, tone: effectiveTone })}\n >\n <span\n className={\n displayText\n ? 'ds:text-foreground'\n : 'ds:text-muted-foreground'\n }\n >\n {displayText || placeholderText}\n </span>\n <span\n aria-hidden=\"true\"\n className={calendarIconVariants({ size })}\n >\n <CalendarDays />\n </span>\n </button>\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n align=\"start\"\n className={popoverContentVariants()}\n >\n <div className=\"ds:flex ds:flex-col ds:sm:flex-row ds:gap-[var(--spacing-md)]\">\n {/* Calendar region */}\n <div role=\"region\" aria-label={calendarLabel}>\n <DayPicker\n mode=\"single\"\n selected={draftDate}\n onSelect={handleDaySelect}\n month={month}\n onMonthChange={setMonth}\n disabled={disabledMatcher}\n locale={locale}\n showOutsideDays\n fixedWeeks\n classNames={calendarClassNames}\n components={{ Chevron: CalendarChevron }}\n />\n </div>\n\n {/* Time + Apply region */}\n <div\n role=\"region\"\n aria-label={timeLabel}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:sm:border-s ds:sm:border-border ds:sm:ps-[var(--spacing-md)] ds:min-w-[10rem]\"\n >\n <TimePicker\n value={\n draftDate\n ? {\n hours: draftDate.getHours(),\n minutes: draftDate.getMinutes(),\n }\n : { hours: 0, minutes: 0 }\n }\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n size={size}\n />\n\n {/* Timezone annotation */}\n {timezoneLabel ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {timezoneLabel}\n </span>\n ) : null}\n\n {/* Range error */}\n {rangeError ? (\n <span\n role=\"alert\"\n className=\"type-meta ds:text-destructive\"\n >\n {outOfRangeLabel}\n </span>\n ) : null}\n\n {/* Apply button */}\n <button\n type=\"button\"\n onClick={handleApply}\n disabled={!draftDate || rangeError}\n className={applyButtonVariants({ size })}\n >\n {applyLabel}\n </button>\n </div>\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n },\n);\n\nDateTimePicker.displayName = 'DateTimePicker';\n"],"names":["setHours","date","hours","options","_date","toDate","setMinutes","minutes","date_","dateTimePickerAgent","handle","_a","args","getTimezoneLabel","locale","timezone","opts","p","tzDiffersFromBrowser","browserTz","applyButtonVariants","cva","DateTimePicker","forwardRef","value","defaultValue","onChange","showTimezoneProp","minDate","maxDate","hour12","minuteStep","size","disabled","placeholder","className","id","ref","t","i18n","useTranslation","ctx","useFormField","effectiveId","effectiveDisabled","effectiveTone","useDateFnsLocale","placeholderText","applyLabel","outOfRangeLabel","timezoneLabel","currentValueRaw","setDateTimeValue","useControllableState","currentValue","draftDate","setDraftDate","useState","open","setOpen","month","setMonth","rangeError","setRangeError","triggerRef","useRef","emit","useCallback","disabledMatcher","buildDisabledMatcher","isInRange","isBefore","isAfter","handleOpenChange","nextOpen","handleDaySelect","prev","merged","handleTimeChange","time","handleApply","displayText","fnsFormat","calendarLabel","timeLabel","useMemo","useImperativeHandle","useAgentRegistration","Popover","jsxs","jsx","triggerVariants","calendarIconVariants","CalendarDays","popoverContentVariants","DayPicker","calendarClassNames","CalendarChevron","TimePicker"],"mappings":";;;;;;;;;;;;AA4BO,SAASA,EAASC,GAAMC,GAAOC,GAAS;AAC7C,QAAMC,IAAQC,EAAOJ,GAAME,KAAA,gBAAAA,EAAS,EAAE;AACtC,SAAAC,EAAM,SAASF,C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A,gBAAAM;AAAA,wBAACQ;AAAA,wBAAA;AAAA,0BACC,OACE3C,IACI;AAAA,4BACE,OAAOA,EAAU,SAAA;AAAA,4BACjB,SAASA,EAAU,WAAA;AAAA,0BAAW,IAEhC,EAAE,OAAO,GAAG,SAAS,EAAA;AAAA,0BAE3B,UAAUuB;AAAA,0BACV,QAAAhD;AAAA,0BACA,YAAAC;AAAA,0BACA,MAAAC;AAAA,wBAAA;AAAA,sBAAA;AAAA,sBAIDkB,IACC,gBAAAwC,EAAC,QAAA,EAAK,WAAU,sCACb,aACH,IACE;AAAA,sBAGH5B,IACC,gBAAA4B;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACC,MAAK;AAAA,0BACL,WAAU;AAAA,0BAET,UAAAzC;AAAA,wBAAA;AAAA,sBAAA,IAED;AAAA,sBAGJ,gBAAAyC;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACC,MAAK;AAAA,0BACL,SAASV;AAAA,0BACT,UAAU,CAACzB,KAAaO;AAAA,0BACxB,WAAW1C,GAAoB,EAAE,MAAAY,GAAM;AAAA,0BAEtC,UAAAgB;AAAA,wBAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACF,EAAA,CACF;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AAEA1B,GAAe,cAAc;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"date-time-picker-3I2vVKGV.js","sources":["../../node_modules/date-fns/setHours.js","../../node_modules/date-fns/setMinutes.js","../../src/components/date-time-picker/date-time-picker.agent.ts","../../src/components/date-time-picker/date-time-picker.tsx"],"sourcesContent":["import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link setHours} function options.\n */\n\n/**\n * @name setHours\n * @category Hour Helpers\n * @summary Set the hours to the given date.\n *\n * @description\n * Set the hours to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param hours - The hours of the new date\n * @param options - An object with options\n *\n * @returns The new date with the hours set\n *\n * @example\n * // Set 4 hours to 1 September 2014 11:30:00:\n * const result = setHours(new Date(2014, 8, 1, 11, 30), 4)\n * //=> Mon Sep 01 2014 04:30:00\n */\nexport function setHours(date, hours, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(hours);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default setHours;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link setMinutes} function options.\n */\n\n/**\n * @name setMinutes\n * @category Minute Helpers\n * @summary Set the minutes to the given date.\n *\n * @description\n * Set the minutes to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows using extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, returned from the context function, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param minutes - The minutes of the new date\n * @param options - An object with options\n *\n * @returns The new date with the minutes set\n *\n * @example\n * // Set 45 minutes to 1 September 2014 11:30:40:\n * const result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)\n * //=> Mon Sep 01 2014 11:45:40\n */\nexport function setMinutes(date, minutes, options) {\n const date_ = toDate(date, options?.in);\n date_.setMinutes(minutes);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default setMinutes;\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DateTimePicker. */\n/* */\n/* DateTimePicker composes a react-day-picker calendar grid with the */\n/* TimePicker segments inside a single Radix Popover. The agent surface */\n/* exposes a combined datetime — set / clear / open / close. The handle */\n/* is the curated surface; consumers don't address the inner sub-widgets.*/\n/* */\n/* See `src/docs/26-agent-readiness.mdx` §15. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DateTimePickerHandle } from './date-time-picker';\n\nexport const dateTimePickerAgent: AgentAdapter<DateTimePickerHandle> = {\n id: 'date-time-picker',\n // Persisted single datetime (value state + set_datetime) → select_single +\n // set_value, plus open/close of the combined popover.\n capabilities: ['select_single', 'set_value', 'open', 'close'],\n state: {\n value: {\n type: 'iso-datetime',\n descriptionKey: 'ui.agent.dateTimePicker.state.value',\n description: 'Currently-selected ISO datetime, or null.',\n read: (handle) => handle.getValue()?.toISOString() ?? null,\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.dateTimePicker.state.isOpen',\n description: 'Whether the datetime popover is open.',\n read: (handle) => handle.isOpen(),\n },\n },\n actions: {\n set_datetime: {\n safety: 'write',\n argsType: '{ datetime: string }',\n argsSchema: {\n type: 'object',\n properties: {\n datetime: {\n type: 'string',\n format: 'date-time',\n description: 'ISO datetime, e.g. \"2026-06-23T14:30:00Z\".',\n },\n },\n required: ['datetime'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.setDatetime',\n description: 'Select a specific datetime (ISO string).',\n examples: [\n {\n args: { datetime: '2026-06-23T14:30:00Z' },\n note: 'Select 23 Jun 2026, 14:30 UTC.',\n },\n ],\n invoke: (handle, args: { datetime: string }) => {\n handle.setValue(new Date(args.datetime));\n },\n },\n clear: {\n // Discards the selected datetime — loses the user's input.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.clear',\n description: 'Clear the selected datetime.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.open',\n description: 'Open the datetime popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.dateTimePicker.actions.close',\n description: 'Close the datetime popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'date-time-picker',\n description: 'Marks the DateTimePicker wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport * as Popover from '@radix-ui/react-popover';\nimport { DayPicker } from 'react-day-picker';\nimport {\n format as fnsFormat,\n isBefore,\n isAfter,\n setHours,\n setMinutes,\n} from 'date-fns';\nimport { CalendarDays } from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport { useFormField } from '../form-field/form-field-context';\nimport {\n useDateFnsLocale,\n buildDisabledMatcher,\n CalendarChevron,\n calendarClassNames,\n triggerVariants,\n calendarIconVariants,\n popoverContentVariants,\n} from '../_shared';\nimport { TimePicker } from '../time-picker/time-picker';\nimport type { TimeValue } from '../_shared/time';\nimport { useAgentRegistration } from '../../agent';\nimport { dateTimePickerAgent } from './date-time-picker.agent';\n\n/* -------------------------------------------------------------------------- */\n/* Imperative handle */\n/* -------------------------------------------------------------------------- */\n\n/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */\nexport interface DateTimePickerHandle {\n /** Get the current selected datetime, or undefined. */\n getValue: () => Date | undefined;\n /** Set the selected datetime. */\n setValue: (date: Date | undefined) => void;\n /** Clear the selected datetime. */\n clear: () => void;\n /** Whether the popover is open. */\n isOpen: () => boolean;\n /** Open the popover. */\n open: () => void;\n /** Close the popover. */\n close: () => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------------- */\n\n/** Get timezone short name. */\nfunction getTimezoneLabel(locale: string, timezone?: string): string {\n try {\n const opts: Intl.DateTimeFormatOptions = { timeZoneName: 'short' };\n if (timezone && timezone !== 'local') {\n opts.timeZone = timezone === 'utc' ? 'UTC' : timezone;\n }\n const parts = new Intl.DateTimeFormat(locale, opts).formatToParts(\n new Date(),\n );\n return parts.find((p) => p.type === 'timeZoneName')?.value ?? '';\n } catch {\n return '';\n }\n}\n\n/** Check if a timezone differs from the browser's. */\nfunction tzDiffersFromBrowser(timezone?: string): boolean {\n if (!timezone || timezone === 'local') return false;\n try {\n const browserTz = Intl.DateTimeFormat().resolvedOptions().timeZone;\n if (timezone === 'utc') return browserTz !== 'UTC';\n return browserTz !== timezone;\n } catch {\n return false;\n }\n}\n\n/* -------------------------------------------------------------------------- */\n/* CVA variants */\n/* -------------------------------------------------------------------------- */\n\nconst applyButtonVariants = cva(\n [\n 'ds:w-full ds:rounded-[var(--radius-sm)]',\n 'ds:bg-primary ds:text-primary-foreground',\n 'ds:hover:bg-primary-hover ds:cursor-pointer',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:disabled:cursor-not-allowed ds:disabled:opacity-50',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:h-8 ds:text-[length:var(--font-size-sm)]',\n md: 'ds:h-[var(--min-target-size)] ds:text-[length:var(--font-size-base)]',\n lg: 'ds:h-12 ds:text-[length:var(--font-size-lg)]',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n/* -------------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------------- */\n\nexport interface DateTimePickerProps extends Pick<\n VariantProps<typeof triggerVariants>,\n 'size'\n> {\n /** Current datetime — controlled. */\n value?: Date;\n /** Default datetime — uncontrolled. */\n defaultValue?: Date;\n /** Called when the datetime changes. */\n onChange?: (date: Date | undefined) => void;\n /** Timezone — IANA string, 'local', or 'utc'. */\n timezone?: string;\n /** Show timezone annotation. Defaults to true when tz differs from browser. */\n showTimezone?: boolean;\n /** Minimum datetime. */\n minDate?: Date;\n /** Maximum datetime. */\n maxDate?: Date;\n /** Force 12h/24h mode. */\n hour12?: boolean;\n /** Minute step for TimePicker. */\n minuteStep?: 1 | 5 | 10 | 15 | 30;\n /** Component size. */\n size?: 'sm' | 'md' | 'lg';\n /** Disabled state. */\n disabled?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /** Additional class names. */\n className?: string;\n /** id override. */\n id?: string;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------------- */\n\nexport const DateTimePicker = forwardRef<\n DateTimePickerHandle,\n DateTimePickerProps\n>(\n (\n {\n value,\n defaultValue,\n onChange,\n timezone,\n showTimezone: showTimezoneProp,\n minDate,\n maxDate,\n hour12,\n minuteStep = 1,\n size = 'md',\n disabled,\n placeholder,\n className,\n id,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n const effectiveId = id ?? ctx.id;\n const effectiveDisabled = ctx.disabled || disabled;\n const effectiveTone = ctx.invalid ? 'error' : 'default';\n\n const locale = useDateFnsLocale(i18n.language);\n const placeholderText =\n placeholder ??\n t('inputs.dateTimePicker.placeholder', 'Select date and time');\n const applyLabel = t('inputs.dateTimePicker.apply', 'Apply');\n const outOfRangeLabel = t(\n 'inputs.dateTimePicker.outOfRange',\n 'Date/time is out of allowed range',\n );\n\n const showTimezone =\n showTimezoneProp !== undefined\n ? showTimezoneProp\n : tzDiffersFromBrowser(timezone);\n const timezoneLabel = showTimezone\n ? getTimezoneLabel(i18n.language, timezone)\n : '';\n\n const [currentValueRaw, setDateTimeValue] = useControllableState<\n Date | undefined\n >({\n value,\n defaultValue,\n onChange,\n });\n const currentValue = currentValueRaw;\n\n // Draft state while popover is open\n const [draftDate, setDraftDate] = useState<Date | undefined>(currentValue);\n const [open, setOpen] = useState(false);\n const [month, setMonth] = useState<Date>(currentValue ?? new Date());\n const [rangeError, setRangeError] = useState(false);\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const emit = useCallback(\n (date: Date | undefined) => {\n setDateTimeValue(date);\n },\n [setDateTimeValue],\n );\n\n const disabledMatcher = buildDisabledMatcher(minDate, maxDate);\n\n /** Check if a full datetime is within range. */\n const isInRange = useCallback(\n (date: Date): boolean => {\n if (minDate && isBefore(date, minDate)) return false;\n if (maxDate && isAfter(date, maxDate)) return false;\n return true;\n },\n [minDate, maxDate],\n );\n\n // Sync draft when popover opens\n const handleOpenChange = (nextOpen: boolean) => {\n if (nextOpen) {\n setDraftDate(currentValue ?? new Date());\n setMonth(currentValue ?? new Date());\n setRangeError(false);\n }\n setOpen(nextOpen);\n };\n\n const handleDaySelect = (date: Date | undefined) => {\n if (!date) return;\n const prev = draftDate ?? new Date();\n const merged = setMinutes(\n setHours(date, prev.getHours()),\n prev.getMinutes(),\n );\n setDraftDate(merged);\n setRangeError(!isInRange(merged));\n };\n\n const handleTimeChange = (time: TimeValue) => {\n const prev = draftDate ?? new Date();\n const merged = setMinutes(setHours(prev, time.hours), time.minutes);\n setDraftDate(merged);\n setRangeError(!isInRange(merged));\n };\n\n const handleApply = () => {\n if (!draftDate) return;\n if (!isInRange(draftDate)) {\n setRangeError(true);\n return;\n }\n emit(draftDate);\n setOpen(false);\n triggerRef.current?.focus();\n };\n\n // Format display text\n const displayText = currentValue\n ? fnsFormat(currentValue, 'MMM d, yyyy HH:mm', { locale })\n : '';\n\n const calendarLabel = t('inputs.datePicker.gridLabel', 'Calendar');\n const timeLabel = t('inputs.timePicker.groupLabel', 'Time');\n\n const handle = useMemo<DateTimePickerHandle>(\n () => ({\n getValue: () => currentValue,\n setValue: (date) => emit(date),\n clear: () => emit(undefined),\n isOpen: () => open,\n // Mirror the trigger's open behaviour so draft state seeds correctly.\n open: () => {\n setDraftDate(currentValue ?? new Date());\n setMonth(currentValue ?? new Date());\n setRangeError(false);\n setOpen(true);\n },\n close: () => setOpen(false),\n }),\n [currentValue, emit, open],\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(dateTimePickerAgent, handle, effectiveId);\n\n return (\n <Popover.Root open={open} onOpenChange={handleOpenChange}>\n <div\n className={className}\n data-component=\"date-time-picker\"\n data-component-id={effectiveId}\n >\n <Popover.Trigger asChild disabled={effectiveDisabled}>\n {/* eslint-disable-next-line jsx-a11y/role-supports-aria-props -- FormField propagates invalid state to its trigger; users rely on this for validation announcements */}\n <button\n ref={triggerRef}\n id={effectiveId}\n type=\"button\"\n disabled={effectiveDisabled}\n aria-describedby={ctx.describedBy || undefined}\n aria-invalid={ctx.invalid || undefined}\n // `aria-required` is not valid on `<button>` per ARIA 1.2 — the\n // FormField label's visible asterisk + `aria-describedby` link\n // communicate the required state instead.\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={triggerVariants({ size, tone: effectiveTone })}\n >\n <span\n className={\n displayText\n ? 'ds:text-foreground'\n : 'ds:text-muted-foreground'\n }\n >\n {displayText || placeholderText}\n </span>\n <span\n aria-hidden=\"true\"\n className={calendarIconVariants({ size })}\n >\n <CalendarDays />\n </span>\n </button>\n </Popover.Trigger>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n align=\"start\"\n className={popoverContentVariants()}\n >\n <div className=\"ds:flex ds:flex-col ds:sm:flex-row ds:gap-[var(--spacing-md)]\">\n {/* Calendar region */}\n <div role=\"region\" aria-label={calendarLabel}>\n <DayPicker\n mode=\"single\"\n selected={draftDate}\n onSelect={handleDaySelect}\n month={month}\n onMonthChange={setMonth}\n disabled={disabledMatcher}\n locale={locale}\n showOutsideDays\n fixedWeeks\n classNames={calendarClassNames}\n components={{ Chevron: CalendarChevron }}\n />\n </div>\n\n {/* Time + Apply region */}\n <div\n role=\"region\"\n aria-label={timeLabel}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:sm:border-s ds:sm:border-border ds:sm:ps-[var(--spacing-md)] ds:min-w-[10rem]\"\n >\n <TimePicker\n value={\n draftDate\n ? {\n hours: draftDate.getHours(),\n minutes: draftDate.getMinutes(),\n }\n : { hours: 0, minutes: 0 }\n }\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n size={size}\n />\n\n {/* Timezone annotation */}\n {timezoneLabel ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {timezoneLabel}\n </span>\n ) : null}\n\n {/* Range error */}\n {rangeError ? (\n <span\n role=\"alert\"\n className=\"type-meta ds:text-destructive\"\n >\n {outOfRangeLabel}\n </span>\n ) : null}\n\n {/* Apply button */}\n <button\n type=\"button\"\n onClick={handleApply}\n disabled={!draftDate || rangeError}\n className={applyButtonVariants({ size })}\n >\n {applyLabel}\n </button>\n </div>\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n },\n);\n\nDateTimePicker.displayName = 'DateTimePicker';\n"],"names":["setHours","date","hours","options","_date","toDate","setMinutes","minutes","date_","dateTimePickerAgent","handle","_a","args","getTimezoneLabel","locale","timezone","opts","p","tzDiffersFromBrowser","browserTz","applyButtonVariants","cva","DateTimePicker","forwardRef","value","defaultValue","onChange","showTimezoneProp","minDate","maxDate","hour12","minuteStep","size","disabled","placeholder","className","id","ref","t","i18n","useTranslation","ctx","useFormField","effectiveId","effectiveDisabled","effectiveTone","useDateFnsLocale","placeholderText","applyLabel","outOfRangeLabel","timezoneLabel","currentValueRaw","setDateTimeValue","useControllableState","currentValue","draftDate","setDraftDate","useState","open","setOpen","month","setMonth","rangeError","setRangeError","triggerRef","useRef","emit","useCallback","disabledMatcher","buildDisabledMatcher","isInRange","isBefore","isAfter","handleOpenChange","nextOpen","handleDaySelect","prev","merged","handleTimeChange","time","handleApply","displayText","fnsFormat","calendarLabel","timeLabel","useMemo","useImperativeHandle","useAgentRegistration","Popover","jsxs","jsx","triggerVariants","calendarIconVariants","CalendarDays","popoverContentVariants","DayPicker","calendarClassNames","CalendarChevron","TimePicker"],"mappings":";;;;;;;;;;;;AA4BO,SAASA,EAASC,GAAMC,GAAOC,GAAS;AAC7C,QAAMC,IAAQC,EAAOJ,GAAME,KAAA,gBAAAA,EAAS,EAAE;AACtC,SAAAC,EA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AAAA,sBAAA,gBAAAM;AAAA,wBAACQ;AAAA,wBAAA;AAAA,0BACC,OACE3C,IACI;AAAA,4BACE,OAAOA,EAAU,SAAA;AAAA,4BACjB,SAASA,EAAU,WAAA;AAAA,0BAAW,IAEhC,EAAE,OAAO,GAAG,SAAS,EAAA;AAAA,0BAE3B,UAAUuB;AAAA,0BACV,QAAAhD;AAAA,0BACA,YAAAC;AAAA,0BACA,MAAAC;AAAA,wBAAA;AAAA,sBAAA;AAAA,sBAIDkB,IACC,gBAAAwC,EAAC,QAAA,EAAK,WAAU,sCACb,aACH,IACE;AAAA,sBAGH5B,IACC,gBAAA4B;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACC,MAAK;AAAA,0BACL,WAAU;AAAA,0BAET,UAAAzC;AAAA,wBAAA;AAAA,sBAAA,IAED;AAAA,sBAGJ,gBAAAyC;AAAA,wBAAC;AAAA,wBAAA;AAAA,0BACC,MAAK;AAAA,0BACL,SAASV;AAAA,0BACT,UAAU,CAACzB,KAAaO;AAAA,0BACxB,WAAW1C,GAAoB,EAAE,MAAAY,GAAM;AAAA,0BAEtC,UAAAgB;AAAA,wBAAA;AAAA,sBAAA;AAAA,oBACH;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACF,EAAA,CACF;AAAA,YAAA;AAAA,UAAA,EACF,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AAEA1B,GAAe,cAAc;","x_google_ignoreList":[0,1]}
|
|
@@ -6,13 +6,13 @@ import { u as de } from "./registry-DvAUVLHh.js";
|
|
|
6
6
|
import { R as C } from "./radio-TWf9Q-mp.js";
|
|
7
7
|
import { R as z } from "./radio-group-rXDJADzW.js";
|
|
8
8
|
import { F as w } from "./form-field-CahJzTxp.js";
|
|
9
|
-
import { D as T } from "./date-picker-
|
|
9
|
+
import { D as T } from "./date-picker-CepI_oI2.js";
|
|
10
10
|
import { N as Y } from "./number-input-Cgu2TtA8.js";
|
|
11
11
|
import { C as U } from "./card-DPmk26CL.js";
|
|
12
12
|
import { B as W } from "./badge-sTusUqZD.js";
|
|
13
13
|
import { I as ce } from "./insert-result-LCNTskNJ.js";
|
|
14
|
-
import { D as x, r as ue, c as me, e as pe, f as he, A as ge, h as fe, i as ye } from "./antenatal-schedule-timeline-
|
|
15
|
-
import { c as J } from "./date-picker-variants-
|
|
14
|
+
import { D as x, r as ue, c as me, e as pe, f as he, A as ge, h as fe, i as ye } from "./antenatal-schedule-timeline-B1k8QkA6.js";
|
|
15
|
+
import { c as J } from "./date-picker-variants-DfuooXEK.js";
|
|
16
16
|
import { p as De } from "./parseISO-fOGpHKXm.js";
|
|
17
17
|
import { f as be } from "./format-4HNwNGrN.js";
|
|
18
18
|
const y = "Superseded by the `pregnancy-dating` adapter.", R = {
|
|
@@ -568,4 +568,4 @@ Ae.displayName = "DueDateCalculator";
|
|
|
568
568
|
export {
|
|
569
569
|
Ae as D
|
|
570
570
|
};
|
|
571
|
-
//# sourceMappingURL=due-date-calculator-
|
|
571
|
+
//# sourceMappingURL=due-date-calculator-BF_Ikofx.js.map
|
package/dist/_chunks/{due-date-calculator-wK8Tajzz.js.map → due-date-calculator-BF_Ikofx.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"due-date-calculator-wK8Tajzz.js","sources":["../../src/components/due-date-calculator/due-date-calculator.agent.ts","../../src/components/due-date-calculator/due-date-calculator.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DueDateCalculator. */\n/* */\n/* Estimates the date of delivery from one of three dating methods (LMP / */\n/* conception / IVF transfer) plus current gestational age + trimester. */\n/* The agent surface is the dating inputs plus the computed EDD / GA; the */\n/* handle is the curated `DueDateCalculatorHandle` (the public `ref` */\n/* stays the root <div>, exactly as `slider.tsx` and `bmi-calculator.tsx` */\n/* keep theirs). */\n/* */\n/* Dates cross the boundary as local-time `yyyy-MM-dd` strings, never */\n/* `Date` objects, so nothing shifts a day under JSON/UTC serialisation. */\n/* */\n/* DEPRECATED surface: this component is superseded by PregnancyDating, */\n/* which unifies dating + gestational age. Prefer the `pregnancy-dating` */\n/* adapter for new work — every action here is marked deprecated. */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural dating inputs and the dates derived from */\n/* them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DueDateCalculatorHandle } from './due-date-calculator';\n\nconst DEPRECATED = 'Superseded by the `pregnancy-dating` adapter.';\n\n/** Shared JSON Schema fragment for a local calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const dueDateCalculatorAgent: AgentAdapter<DueDateCalculatorHandle> = {\n id: 'due-date-calculator',\n // set_value → the six `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ method: string, referenceDate: string | null, cycleLength: number | null, embryoAge: 3 | 5, crlMm: number | null, scanDate: string | null, asOfDate: string }',\n descriptionKey: 'ui.agent.dueDateCalculator.state.inputs',\n description:\n 'The dating inputs as entered — method, its reference date, cycle length (LMP), embryo age (IVF), the optional CRL + scan date, and the evaluation date. Dates are `yyyy-MM-dd`. Read this to see which method a reference date will be interpreted under.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ dueDate: string, gestationalStart: string, gestationalAge: { weeks: number, days: number, totalDays: number } | null, trimester: string } | null',\n descriptionKey: 'ui.agent.dueDateCalculator.state.result',\n description:\n 'Computed estimated delivery date, the GA day-0 anchor after any CRL re-dating, the gestational age as of the evaluation date, and the trimester band. Null until a reference date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_method: {\n // Drives the same local input state a user picks; nothing is persisted\n // to a record, and the choice is reversible in the same UI.\n safety: 'write',\n argsType: \"{ method: 'lmp' | 'conception' | 'ivf' }\",\n argsSchema: {\n type: 'object',\n properties: {\n method: {\n enum: ['lmp', 'conception', 'ivf'],\n description:\n 'Which anchor to date from — last menstrual period, conception, or IVF transfer.',\n },\n },\n required: ['method'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the method was applied.',\n },\n errors: [\n 'Returns false for a method outside the three supported anchors.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setMethod',\n description:\n 'Choose which anchor the pregnancy is dated from. The reference date is kept and re-interpreted under the new method, so set the method first.',\n invoke: (handle, args: { method: 'lmp' | 'conception' | 'ivf' }) =>\n handle.setMethod(args.method),\n },\n set_reference_date: {\n safety: 'write',\n argsType: '{ date: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n oneOf: [\n { ...isoDate, description: 'Local calendar date, `yyyy-MM-dd`.' },\n { type: 'null' },\n ],\n description:\n 'The date the active method anchors on — LMP, conception, or transfer — or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: [\n 'Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today.',\n ],\n examples: [\n {\n args: { date: '2026-01-12' },\n note: 'Under the default LMP method, a last period starting 12 January.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setReferenceDate',\n description:\n 'Set the reference date for the active method. This is the only required input — the result stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setReferenceDate(args.date),\n },\n set_cycle_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 20, maximum: 45 },\n { type: 'null' },\n ],\n description:\n 'Average cycle length in days (20–45), or null to fall back to the 28-day default.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces.',\n 'Applies but changes nothing unless the method is `lmp`, and is ignored once a CRL re-dating is confirmed.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCycleLength',\n description:\n 'LMP method only — set the average cycle length, which shifts Naegele dating off the 28-day assumption.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_embryo_age: {\n safety: 'write',\n argsType: '{ days: 3 | 5 }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n enum: [3, 5],\n description:\n 'Embryo age at transfer in days — 3 (cleavage) or 5 (blastocyst).',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false for any value other than 3 or 5.',\n 'Applies but changes nothing unless the method is `ivf`.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setEmbryoAge',\n description:\n 'IVF method only — set the embryo age at transfer, which offsets the transfer date back to a notional LMP.',\n invoke: (handle, args: { days: 3 | 5 }) => handle.setEmbryoAge(args.days),\n },\n set_crl: {\n safety: 'write',\n argsType: '{ crlMm?: number | null, scanDate?: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n crlMm: {\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description:\n 'Crown-rump length in millimetres, or null to clear it.',\n },\n scanDate: {\n oneOf: [{ ...isoDate }, { type: 'null' }],\n description:\n 'Date of the CRL scan (`yyyy-MM-dd`, not in the future), or null to clear it.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurement was applied.',\n },\n errors: [\n 'Returns false and writes nothing when the length is not positive or the scan date is unparseable or in the future — the payload applies all-or-nothing.',\n 'Re-dating only happens under the `lmp` method, and only when both the length and the scan date are set.',\n ],\n examples: [\n {\n args: { crlMm: 42, scanDate: '2026-02-20' },\n note: 'A first-trimester CRL that may re-date the pregnancy per ACOG CO 700.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCrl',\n description:\n 'LMP method only — set the first-trimester crown-rump length and its scan date. When the two disagree with the LMP beyond the ACOG threshold, the scan re-dates the pregnancy and overrides cycle length.',\n invoke: (\n handle,\n args: { crlMm?: number | null; scanDate?: string | null },\n ) => handle.setCrl(args),\n },\n set_as_of_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n ...isoDate,\n description:\n 'Date to evaluate gestational age and trimester against, `yyyy-MM-dd`. May be in the future to project forward.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: ['Returns false for an unparseable date.'],\n examples: [\n {\n args: { date: '2026-09-15' },\n note: 'Project gestational age forward to an upcoming appointment.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setAsOfDate',\n description:\n 'Set the date gestational age, trimester and the antenatal schedule are evaluated against. Defaults to today; the estimated delivery date itself does not depend on it.',\n invoke: (handle, args: { date: string }) => handle.setAsOfDate(args.date),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'due-date-calculator',\n description: 'Marks the DueDateCalculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven actions/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DueDateCalculator — estimate the date of delivery from one of three */\n/* dating methods, with current gestational age + trimester. */\n/* */\n/* - Maths lives in `./gestation` (pure, separately tested). */\n/* - Three methods: LMP (Naegele, cycle-length adjustable), conception, */\n/* and IVF transfer (Day-3 vs Day-5 embryo). */\n/* - The reference date can't be in the future, so the DatePicker caps */\n/* at today. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { dueDateCalculatorAgent } from './due-date-calculator.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\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 {\n type DueDateMethod,\n type EmbryoAge,\n type DueDateResult,\n computeDueDate,\n redateByCrl,\n DEFAULT_CYCLE_LENGTH,\n TRIMESTER_BADGE_VARIANT,\n trimesterHighlightToken,\n} from '../_shared/obstetrics';\nimport {\n computeAntenatalSchedule,\n type AntenatalScheduleOptions,\n} from '../_shared/antenatal-schedule';\nimport {\n AntenatalScheduleTimeline,\n buildScheduleInsertFields,\n} from '../_shared/antenatal-schedule-timeline';\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/** Reference-date i18n key per method. */\nconst DATE_LABEL_KEY: Record<DueDateMethod, string> = {\n lmp: 'dueDateCalculator.lmpDate',\n conception: 'dueDateCalculator.conceptionDate',\n ivf: 'dueDateCalculator.transferDate',\n};\n\n/* ------------------------------------------------------------------ */\n/* Agent boundary */\n/* */\n/* Dates cross the agent boundary as local-time `yyyy-MM-dd` strings, */\n/* never `Date` objects — a Date JSON-serialises to UTC and silently */\n/* shifts the day for anyone east or west of Greenwich. */\n/* ------------------------------------------------------------------ */\n\nconst toIsoDate = (d: Date): string => format(d, 'yyyy-MM-dd');\n\nconst fromIsoDate = (iso: string): Date | null => {\n const d = parseISO(iso);\n return Number.isNaN(d.getTime()) ? null : d;\n};\n\n/** UI input bounds, mirrored by the agent handle so it can't out-type a user. */\nconst CYCLE_LENGTH_RANGE = { min: 20, max: 45 } as const;\n\n/** The dating inputs as entered. */\nexport interface DueDateInputsSnapshot {\n /** Which anchor the pregnancy is dated from. */\n method: DueDateMethod;\n /** The method's reference date (`yyyy-MM-dd`), or null when unset. */\n referenceDate: string | null;\n /** LMP only — average cycle length in days, or null for the 28-day default. */\n cycleLength: number | null;\n /** IVF only — embryo age at transfer, in days. */\n embryoAge: EmbryoAge;\n /** LMP only — crown-rump length in millimetres, or null. */\n crlMm: number | null;\n /** LMP only — date of the CRL scan (`yyyy-MM-dd`), or null. */\n scanDate: string | null;\n /** The date gestational age and trimester are evaluated against. */\n asOfDate: string;\n}\n\n/** `DueDateResult` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface DueDateSnapshot {\n /** Estimated date of delivery, `yyyy-MM-dd`. */\n dueDate: string;\n /** GA day-0 anchor (effective LMP) after any CRL re-dating, `yyyy-MM-dd`. */\n gestationalStart: string;\n /** Gestational age as of the evaluation date; null before conception. */\n gestationalAge: { weeks: number; days: number; totalDays: number } | null;\n /** Trimester band as of the evaluation date. */\n trimester: DueDateResult['trimester'];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the dating\n * inputs and the computed due date, and drives the inputs the way a user\n * would. Never exposes patient identity — only structural dates and numbers.\n * Consumed by `due-date-calculator.agent.ts`; the public `ref` stays the root\n * DOM element.\n */\nexport interface DueDateCalculatorHandle {\n /** The dating inputs as entered. */\n getInputs: () => DueDateInputsSnapshot;\n /** Computed due date, gestational age and trimester, or null until a reference date is set. */\n getResult: () => DueDateSnapshot | null;\n /** Switch the dating method. Keeps the reference date, which is re-interpreted. */\n setMethod: (method: DueDateMethod) => boolean;\n /** Set the method's reference date (`yyyy-MM-dd`, not in the future). */\n setReferenceDate: (isoDate: string | null) => boolean;\n /** LMP only — set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** IVF only — set the embryo age at transfer (3 or 5 days). */\n setEmbryoAge: (days: EmbryoAge) => boolean;\n /** LMP only — set the CRL measurement and/or its scan date for ACOG re-dating. */\n setCrl: (next: {\n crlMm?: number | null;\n scanDate?: string | null;\n }) => boolean;\n /** Set the date gestational age and trimester are evaluated against. */\n setAsOfDate: (isoDate: string) => boolean;\n}\n\nexport interface DueDateCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial dating method. Defaults to `'lmp'`. */\n defaultMethod?: DueDateMethod;\n /** Fires whenever a due date can be computed (and with `null` when it can't). */\n onResultChange?: (result: DueDateResult | 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 /**\n * Append the antenatal exam schedule (the time-sensitive screening windows)\n * below the result, dated from the computed gestational start.\n */\n showSchedule?: boolean;\n /**\n * Passthrough options for the appended schedule (national `schedule`,\n * `plurality`, `chorionicity`, `rhNegative`, `gdmRisk`, …). `today` is\n * supplied by the component. Ignored unless `showSchedule` is set.\n */\n scheduleOptions?: Omit<AntenatalScheduleOptions, 'today'>;\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 * @deprecated Superseded by `PregnancyDating`, which unifies the due-date and\n * gestational-age calculators (any anchor → both EDD and current GA) and adds a\n * manual ±days dating adjustment. This component will be removed in a future\n * release; migrate to `PregnancyDating` (`defaultMethod=\"lmp\"`).\n */\nexport const DueDateCalculator = forwardRef<\n HTMLDivElement,\n DueDateCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n showSchedule = false,\n scheduleOptions,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DueDateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n DEFAULT_CYCLE_LENGTH,\n );\n const [embryoAge, setEmbryoAge] = useState<EmbryoAge>(5);\n // Optional first-trimester ultrasound (LMP method only) for ACOG CO700 redating.\n const [crlMm, setCrlMm] = useState<number | null>(null);\n const [scanDate, setScanDate] = useState<Date | undefined>(undefined);\n\n // Real today — caps the date inputs (LMP / ultrasound can't be in the future).\n const today = useMemo(() => new Date(), []);\n // The date GA, trimester and schedule status are evaluated against; defaults\n // to today but can be a future appointment date to project forward. (The EDD\n // itself is dating-anchored and does not depend on this.)\n const [asOfDate, setAsOfDate] = useState<Date>(() => new Date());\n\n // ACOG CO700 CRL redating — only when an LMP, a CRL and a scan date are set.\n const redating = useMemo(() => {\n if (method !== 'lmp' || !refDate || crlMm === null || !scanDate) {\n return null;\n }\n return redateByCrl({ lmp: refDate, scanDate, crlMm });\n }, [method, refDate, crlMm, scanDate]);\n\n const result = useMemo<DueDateResult | null>(() => {\n if (!refDate) return null;\n // A confirmed redating moves the effective LMP to the ultrasound's; the\n // CRL already reflects true gestation, so cycle adjustment no longer applies.\n const effectiveDate =\n method === 'lmp' && redating?.redated\n ? redating.gestationalStart\n : refDate;\n const effectiveCycle =\n method === 'lmp' && redating?.redated\n ? DEFAULT_CYCLE_LENGTH\n : (cycleLength ?? DEFAULT_CYCLE_LENGTH);\n return computeDueDate(\n {\n method,\n date: effectiveDate,\n cycleLength: effectiveCycle,\n embryoAge,\n },\n asOfDate,\n );\n }, [method, refDate, cycleLength, embryoAge, redating, asOfDate]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n });\n liveRef.current = {\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n };\n\n const agentHandle = useMemo<DueDateCalculatorHandle>(\n () => ({\n getInputs: () => {\n const live = liveRef.current;\n return {\n method: live.method,\n referenceDate: live.refDate ? toIsoDate(live.refDate) : null,\n cycleLength: live.cycleLength,\n embryoAge: live.embryoAge,\n crlMm: live.crlMm,\n scanDate: live.scanDate ? toIsoDate(live.scanDate) : null,\n asOfDate: toIsoDate(live.asOfDate),\n };\n },\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n dueDate: toIsoDate(r.dueDate),\n gestationalStart: toIsoDate(r.gestationalStart),\n gestationalAge: r.gestationalAge ? { ...r.gestationalAge } : null,\n trimester: r.trimester,\n };\n },\n setMethod: (next) => {\n if (next !== 'lmp' && next !== 'conception' && next !== 'ivf') {\n return false;\n }\n setMethod(next);\n return true;\n },\n setReferenceDate: (isoDate) => {\n if (isoDate === null) {\n setRefDate(undefined);\n return true;\n }\n const parsed = fromIsoDate(isoDate);\n // The DatePicker caps at today; the handle honours the same bound.\n if (!parsed || isAfter(parsed, new Date())) return false;\n setRefDate(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (\n days !== null &&\n !(\n Number.isFinite(days) &&\n days >= CYCLE_LENGTH_RANGE.min &&\n days <= CYCLE_LENGTH_RANGE.max\n )\n ) {\n return false;\n }\n setCycleLength(days);\n return true;\n },\n setEmbryoAge: (days) => {\n if (days !== 3 && days !== 5) return false;\n setEmbryoAge(days);\n return true;\n },\n setCrl: (next) => {\n const now = new Date();\n let parsedScan: Date | undefined;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n if ('crlMm' in next) {\n const mm = next.crlMm;\n if (\n mm !== null &&\n mm !== undefined &&\n !(Number.isFinite(mm) && mm > 0)\n ) {\n return false;\n }\n }\n if ('scanDate' in next && next.scanDate != null) {\n const d = fromIsoDate(next.scanDate);\n if (!d || isAfter(d, now)) return false;\n parsedScan = d;\n }\n if ('crlMm' in next) setCrlMm(next.crlMm ?? null);\n if ('scanDate' in next) setScanDate(parsedScan);\n return true;\n },\n setAsOfDate: (isoDate) => {\n const parsed = fromIsoDate(isoDate);\n if (!parsed) return false;\n setAsOfDate(parsed);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(dueDateCalculatorAgent, agentHandle, id);\n\n const schedule = useMemo(() => {\n if (!showSchedule || !result) return null;\n return computeAntenatalSchedule(result.gestationalStart, {\n ...scheduleOptions,\n today: asOfDate,\n });\n }, [showSchedule, result, asOfDate, scheduleOptions]);\n\n return (\n <div\n ref={ref}\n data-component=\"due-date-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('dueDateCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DueDateMethod)}\n >\n <Radio label={t('dueDateCalculator.method.lmp')} value=\"lmp\" />\n <Radio\n label={t('dueDateCalculator.method.conception')}\n value=\"conception\"\n />\n <Radio label={t('dueDateCalculator.method.ivf')} value=\"ivf\" />\n </RadioGroup>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t(DATE_LABEL_KEY[method])}>\n <DatePicker value={refDate} onChange={setRefDate} maxDate={today} />\n </FormField>\n\n {method === 'lmp' && (\n <FormField\n label={t('dueDateCalculator.cycleLength')}\n description={t('dueDateCalculator.cycleLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={CYCLE_LENGTH_RANGE.min}\n max={CYCLE_LENGTH_RANGE.max}\n value={cycleLength}\n onChange={setCycleLength}\n />\n </FormField>\n )}\n\n {method === 'ivf' && (\n <RadioGroup\n label={t('dueDateCalculator.embryoAge')}\n variant=\"horizontal\"\n value={String(embryoAge)}\n onValueChange={(next) => setEmbryoAge(Number(next) as EmbryoAge)}\n >\n <Radio label={t('dueDateCalculator.day3')} value=\"3\" />\n <Radio label={t('dueDateCalculator.day5')} value=\"5\" />\n </RadioGroup>\n )}\n </div>\n\n <FormField\n label={t('dueDateCalculator.asOfDate')}\n description={t('dueDateCalculator.asOfDateHint')}\n >\n <DatePicker value={asOfDate} onChange={(d) => d && setAsOfDate(d)} />\n </FormField>\n\n {method === 'lmp' ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={t('dueDateCalculator.crl')}\n description={t('dueDateCalculator.crlHint')}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={crlMm}\n onChange={setCrlMm}\n />\n </FormField>\n <FormField label={t('dueDateCalculator.scanDate')}>\n <DatePicker\n value={scanDate}\n onChange={setScanDate}\n maxDate={today}\n />\n </FormField>\n </div>\n {redating ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant={redating.redated ? 'warning' : 'success'}>\n {redating.redated\n ? t('dueDateCalculator.redated', {\n days: redating.discrepancyDays,\n })\n : t('dueDateCalculator.datesAgree')}\n </Badge>\n {!redating.crlInRange ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {t('dueDateCalculator.crlOutOfRange')}\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {/* Concise polite announcement when a due date resolves. */}\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('dueDateCalculator.result.dueDateLabel')}: ${dateFormatter.format(\n result.dueDate,\n )}. ${t('dueDateCalculator.result.trimesterLabel')}: ${t(\n `dueDateCalculator.trimester.${result.trimester}`,\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-3\">\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('dueDateCalculator.result.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE_VARIANT[result.trimester]}\n size=\"lg\"\n >\n {t(`dueDateCalculator.trimester.${result.trimester}`)}\n </Badge>\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('dueDateCalculator.result.gestationLabel')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—'}\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('dueDateCalculator.result.dueDateLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {dateFormatter.format(result.dueDate)}\n </dd>\n </div>\n </dl>\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('dueDateCalculator.empty')}\n </p>\n )}\n\n {schedule ? <AntenatalScheduleTimeline events={schedule} /> : null}\n\n {/* One result-action group for the whole result — sits after both the\n due-date card and the schedule, and its payload carries the schedule\n rows when shown (no per-card buttons). */}\n {result && (insertVariant === 'copy' || onInsert) ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.dueDate'),\n icon: 'calendar-heart',\n highlight: dateFormatter.format(result.dueDate),\n // Chip tinted with the trimester's semantic token so the inserted\n // PNG carries the same clinical-stage colour as the on-screen\n // trimester badge — with the contrast-safe orange override for the\n // `--warning` third trimester.\n highlightToken: trimesterHighlightToken(result.trimester),\n brand: insertBrand,\n fields: [\n {\n // The estimated date of delivery → calendar glyph.\n icon: 'calendar',\n label: t('dueDateCalculator.result.dueDateLabel'),\n value: dateFormatter.format(result.dueDate),\n },\n {\n // Gestational age is an elapsed duration → clock glyph.\n icon: 'clock',\n label: t('dueDateCalculator.result.gestationLabel'),\n value: result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—',\n },\n {\n // Trimester is a clinical-stage classification → tag.\n icon: 'tag',\n label: t('dueDateCalculator.result.trimesterLabel'),\n value: t(`dueDateCalculator.trimester.${result.trimester}`),\n },\n // When the schedule is shown, the single Insert button carries\n // the exam windows too (no second button).\n ...(schedule\n ? buildScheduleInsertFields(schedule, t, (d) =>\n dateFormatter.format(d),\n )\n : []),\n ],\n }}\n />\n ) : null}\n </div>\n );\n },\n);\n\nDueDateCalculator.displayName = 'DueDateCalculator';\n"],"names":["DEPRECATED","isoDate","dueDateCalculatorAgent","handle","args","rootVariants","cva","DATE_LABEL_KEY","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","DueDateCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","showSchedule","scheduleOptions","id","width","className","ref","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","cycleLength","setCycleLength","DEFAULT_CYCLE_LENGTH","embryoAge","setEmbryoAge","crlMm","setCrlMm","scanDate","setScanDate","today","useMemo","asOfDate","setAsOfDate","redating","redateByCrl","result","effectiveDate","effectiveCycle","computeDueDate","dateFormatter","useEffect","liveRef","useRef","agentHandle","live","r","next","parsed","isAfter","days","now","parsedScan","mm","useAgentRegistration","schedule","computeAntenatalSchedule","jsxs","RadioGroup","jsx","Radio","FormField","DatePicker","NumberInput","Badge","Card","TRIMESTER_BADGE_VARIANT","AntenatalScheduleTimeline","InsertButton","trimesterHighlightToken","buildScheduleInsertFields"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAa,iDAGbC,IAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAAgE;AAAA,EAC3E,IAAI;AAAA;AAAA,EAEJ,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,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,YAAY;AAAA;AAAA;AAAA,MAGV,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,QAAQ;AAAA,YACN,MAAM,CAAC,OAAO,cAAc,KAAK;AAAA,YACjC,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,QAAQ;AAAA,QACnB,sBAAsB;AAAA,MAAA;AAAA,MAExB,YAAY;AAAA,MACZ,YAAYH;AAAA,MACZ,SAAS;AAAA,MACT,eAAe;AAAA,QACb,MAAM;AAAA,QACN,aAAa;AAAA,MAAA;AAAA,MAEf,QAAQ;AAAA,QACN;AAAA,MAAA;AAAA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A,kBAI5D,GAAImB,IACAe;AAAA,oBAA0Bf;AAAA,oBAAU;AAAA,oBAAG,CAAC9D,MACtC+C,EAAc,OAAO/C,CAAC;AAAA,kBAAA,IAExB,CAAA;AAAA,gBAAC;AAAA,cACP;AAAA,YACF;AAAA,UAAA,IAEA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAM,GAAkB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"due-date-calculator-BF_Ikofx.js","sources":["../../src/components/due-date-calculator/due-date-calculator.agent.ts","../../src/components/due-date-calculator/due-date-calculator.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DueDateCalculator. */\n/* */\n/* Estimates the date of delivery from one of three dating methods (LMP / */\n/* conception / IVF transfer) plus current gestational age + trimester. */\n/* The agent surface is the dating inputs plus the computed EDD / GA; the */\n/* handle is the curated `DueDateCalculatorHandle` (the public `ref` */\n/* stays the root <div>, exactly as `slider.tsx` and `bmi-calculator.tsx` */\n/* keep theirs). */\n/* */\n/* Dates cross the boundary as local-time `yyyy-MM-dd` strings, never */\n/* `Date` objects, so nothing shifts a day under JSON/UTC serialisation. */\n/* */\n/* DEPRECATED surface: this component is superseded by PregnancyDating, */\n/* which unifies dating + gestational age. Prefer the `pregnancy-dating` */\n/* adapter for new work — every action here is marked deprecated. */\n/* */\n/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural dating inputs and the dates derived from */\n/* them. See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DueDateCalculatorHandle } from './due-date-calculator';\n\nconst DEPRECATED = 'Superseded by the `pregnancy-dating` adapter.';\n\n/** Shared JSON Schema fragment for a local calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const dueDateCalculatorAgent: AgentAdapter<DueDateCalculatorHandle> = {\n id: 'due-date-calculator',\n // set_value → the six `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ method: string, referenceDate: string | null, cycleLength: number | null, embryoAge: 3 | 5, crlMm: number | null, scanDate: string | null, asOfDate: string }',\n descriptionKey: 'ui.agent.dueDateCalculator.state.inputs',\n description:\n 'The dating inputs as entered — method, its reference date, cycle length (LMP), embryo age (IVF), the optional CRL + scan date, and the evaluation date. Dates are `yyyy-MM-dd`. Read this to see which method a reference date will be interpreted under.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ dueDate: string, gestationalStart: string, gestationalAge: { weeks: number, days: number, totalDays: number } | null, trimester: string } | null',\n descriptionKey: 'ui.agent.dueDateCalculator.state.result',\n description:\n 'Computed estimated delivery date, the GA day-0 anchor after any CRL re-dating, the gestational age as of the evaluation date, and the trimester band. Null until a reference date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_method: {\n // Drives the same local input state a user picks; nothing is persisted\n // to a record, and the choice is reversible in the same UI.\n safety: 'write',\n argsType: \"{ method: 'lmp' | 'conception' | 'ivf' }\",\n argsSchema: {\n type: 'object',\n properties: {\n method: {\n enum: ['lmp', 'conception', 'ivf'],\n description:\n 'Which anchor to date from — last menstrual period, conception, or IVF transfer.',\n },\n },\n required: ['method'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the method was applied.',\n },\n errors: [\n 'Returns false for a method outside the three supported anchors.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setMethod',\n description:\n 'Choose which anchor the pregnancy is dated from. The reference date is kept and re-interpreted under the new method, so set the method first.',\n invoke: (handle, args: { method: 'lmp' | 'conception' | 'ivf' }) =>\n handle.setMethod(args.method),\n },\n set_reference_date: {\n safety: 'write',\n argsType: '{ date: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n oneOf: [\n { ...isoDate, description: 'Local calendar date, `yyyy-MM-dd`.' },\n { type: 'null' },\n ],\n description:\n 'The date the active method anchors on — LMP, conception, or transfer — or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: [\n 'Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today.',\n ],\n examples: [\n {\n args: { date: '2026-01-12' },\n note: 'Under the default LMP method, a last period starting 12 January.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setReferenceDate',\n description:\n 'Set the reference date for the active method. This is the only required input — the result stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setReferenceDate(args.date),\n },\n set_cycle_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 20, maximum: 45 },\n { type: 'null' },\n ],\n description:\n 'Average cycle length in days (20–45), or null to fall back to the 28-day default.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces.',\n 'Applies but changes nothing unless the method is `lmp`, and is ignored once a CRL re-dating is confirmed.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCycleLength',\n description:\n 'LMP method only — set the average cycle length, which shifts Naegele dating off the 28-day assumption.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_embryo_age: {\n safety: 'write',\n argsType: '{ days: 3 | 5 }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n enum: [3, 5],\n description:\n 'Embryo age at transfer in days — 3 (cleavage) or 5 (blastocyst).',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false for any value other than 3 or 5.',\n 'Applies but changes nothing unless the method is `ivf`.',\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setEmbryoAge',\n description:\n 'IVF method only — set the embryo age at transfer, which offsets the transfer date back to a notional LMP.',\n invoke: (handle, args: { days: 3 | 5 }) => handle.setEmbryoAge(args.days),\n },\n set_crl: {\n safety: 'write',\n argsType: '{ crlMm?: number | null, scanDate?: string | null }',\n argsSchema: {\n type: 'object',\n properties: {\n crlMm: {\n oneOf: [{ type: 'number', exclusiveMinimum: 0 }, { type: 'null' }],\n description:\n 'Crown-rump length in millimetres, or null to clear it.',\n },\n scanDate: {\n oneOf: [{ ...isoDate }, { type: 'null' }],\n description:\n 'Date of the CRL scan (`yyyy-MM-dd`, not in the future), or null to clear it.',\n },\n },\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the measurement was applied.',\n },\n errors: [\n 'Returns false and writes nothing when the length is not positive or the scan date is unparseable or in the future — the payload applies all-or-nothing.',\n 'Re-dating only happens under the `lmp` method, and only when both the length and the scan date are set.',\n ],\n examples: [\n {\n args: { crlMm: 42, scanDate: '2026-02-20' },\n note: 'A first-trimester CRL that may re-date the pregnancy per ACOG CO 700.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setCrl',\n description:\n 'LMP method only — set the first-trimester crown-rump length and its scan date. When the two disagree with the LMP beyond the ACOG threshold, the scan re-dates the pregnancy and overrides cycle length.',\n invoke: (\n handle,\n args: { crlMm?: number | null; scanDate?: string | null },\n ) => handle.setCrl(args),\n },\n set_as_of_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n ...isoDate,\n description:\n 'Date to evaluate gestational age and trimester against, `yyyy-MM-dd`. May be in the future to project forward.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\n deprecated: DEPRECATED,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the date was applied.',\n },\n errors: ['Returns false for an unparseable date.'],\n examples: [\n {\n args: { date: '2026-09-15' },\n note: 'Project gestational age forward to an upcoming appointment.',\n },\n ],\n descriptionKey: 'ui.agent.dueDateCalculator.actions.setAsOfDate',\n description:\n 'Set the date gestational age, trimester and the antenatal schedule are evaluated against. Defaults to today; the estimated delivery date itself does not depend on it.',\n invoke: (handle, args: { date: string }) => handle.setAsOfDate(args.date),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'due-date-calculator',\n description: 'Marks the DueDateCalculator wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Also the registry key — without an `id` the instance does not register and the handle-driven actions/state are unreachable.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* DueDateCalculator — estimate the date of delivery from one of three */\n/* dating methods, with current gestational age + trimester. */\n/* */\n/* - Maths lives in `./gestation` (pure, separately tested). */\n/* - Three methods: LMP (Naegele, cycle-length adjustable), conception, */\n/* and IVF transfer (Day-3 vs Day-5 embryo). */\n/* - The reference date can't be in the future, so the DatePicker caps */\n/* at today. */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { dueDateCalculatorAgent } from './due-date-calculator.agent';\nimport { RadioGroup, Radio } from '../radio-group';\nimport { FormField } from '../form-field';\nimport { DatePicker } from '../date-picker';\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 {\n type DueDateMethod,\n type EmbryoAge,\n type DueDateResult,\n computeDueDate,\n redateByCrl,\n DEFAULT_CYCLE_LENGTH,\n TRIMESTER_BADGE_VARIANT,\n trimesterHighlightToken,\n} from '../_shared/obstetrics';\nimport {\n computeAntenatalSchedule,\n type AntenatalScheduleOptions,\n} from '../_shared/antenatal-schedule';\nimport {\n AntenatalScheduleTimeline,\n buildScheduleInsertFields,\n} from '../_shared/antenatal-schedule-timeline';\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/** Reference-date i18n key per method. */\nconst DATE_LABEL_KEY: Record<DueDateMethod, string> = {\n lmp: 'dueDateCalculator.lmpDate',\n conception: 'dueDateCalculator.conceptionDate',\n ivf: 'dueDateCalculator.transferDate',\n};\n\n/* ------------------------------------------------------------------ */\n/* Agent boundary */\n/* */\n/* Dates cross the agent boundary as local-time `yyyy-MM-dd` strings, */\n/* never `Date` objects — a Date JSON-serialises to UTC and silently */\n/* shifts the day for anyone east or west of Greenwich. */\n/* ------------------------------------------------------------------ */\n\nconst toIsoDate = (d: Date): string => format(d, 'yyyy-MM-dd');\n\nconst fromIsoDate = (iso: string): Date | null => {\n const d = parseISO(iso);\n return Number.isNaN(d.getTime()) ? null : d;\n};\n\n/** UI input bounds, mirrored by the agent handle so it can't out-type a user. */\nconst CYCLE_LENGTH_RANGE = { min: 20, max: 45 } as const;\n\n/** The dating inputs as entered. */\nexport interface DueDateInputsSnapshot {\n /** Which anchor the pregnancy is dated from. */\n method: DueDateMethod;\n /** The method's reference date (`yyyy-MM-dd`), or null when unset. */\n referenceDate: string | null;\n /** LMP only — average cycle length in days, or null for the 28-day default. */\n cycleLength: number | null;\n /** IVF only — embryo age at transfer, in days. */\n embryoAge: EmbryoAge;\n /** LMP only — crown-rump length in millimetres, or null. */\n crlMm: number | null;\n /** LMP only — date of the CRL scan (`yyyy-MM-dd`), or null. */\n scanDate: string | null;\n /** The date gestational age and trimester are evaluated against. */\n asOfDate: string;\n}\n\n/** `DueDateResult` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface DueDateSnapshot {\n /** Estimated date of delivery, `yyyy-MM-dd`. */\n dueDate: string;\n /** GA day-0 anchor (effective LMP) after any CRL re-dating, `yyyy-MM-dd`. */\n gestationalStart: string;\n /** Gestational age as of the evaluation date; null before conception. */\n gestationalAge: { weeks: number; days: number; totalDays: number } | null;\n /** Trimester band as of the evaluation date. */\n trimester: DueDateResult['trimester'];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the dating\n * inputs and the computed due date, and drives the inputs the way a user\n * would. Never exposes patient identity — only structural dates and numbers.\n * Consumed by `due-date-calculator.agent.ts`; the public `ref` stays the root\n * DOM element.\n */\nexport interface DueDateCalculatorHandle {\n /** The dating inputs as entered. */\n getInputs: () => DueDateInputsSnapshot;\n /** Computed due date, gestational age and trimester, or null until a reference date is set. */\n getResult: () => DueDateSnapshot | null;\n /** Switch the dating method. Keeps the reference date, which is re-interpreted. */\n setMethod: (method: DueDateMethod) => boolean;\n /** Set the method's reference date (`yyyy-MM-dd`, not in the future). */\n setReferenceDate: (isoDate: string | null) => boolean;\n /** LMP only — set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** IVF only — set the embryo age at transfer (3 or 5 days). */\n setEmbryoAge: (days: EmbryoAge) => boolean;\n /** LMP only — set the CRL measurement and/or its scan date for ACOG re-dating. */\n setCrl: (next: {\n crlMm?: number | null;\n scanDate?: string | null;\n }) => boolean;\n /** Set the date gestational age and trimester are evaluated against. */\n setAsOfDate: (isoDate: string) => boolean;\n}\n\nexport interface DueDateCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial dating method. Defaults to `'lmp'`. */\n defaultMethod?: DueDateMethod;\n /** Fires whenever a due date can be computed (and with `null` when it can't). */\n onResultChange?: (result: DueDateResult | 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 /**\n * Append the antenatal exam schedule (the time-sensitive screening windows)\n * below the result, dated from the computed gestational start.\n */\n showSchedule?: boolean;\n /**\n * Passthrough options for the appended schedule (national `schedule`,\n * `plurality`, `chorionicity`, `rhNegative`, `gdmRisk`, …). `today` is\n * supplied by the component. Ignored unless `showSchedule` is set.\n */\n scheduleOptions?: Omit<AntenatalScheduleOptions, 'today'>;\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 * @deprecated Superseded by `PregnancyDating`, which unifies the due-date and\n * gestational-age calculators (any anchor → both EDD and current GA) and adds a\n * manual ±days dating adjustment. This component will be removed in a future\n * release; migrate to `PregnancyDating` (`defaultMethod=\"lmp\"`).\n */\nexport const DueDateCalculator = forwardRef<\n HTMLDivElement,\n DueDateCalculatorProps\n>(\n (\n {\n defaultMethod = 'lmp',\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n showSchedule = false,\n scheduleOptions,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [method, setMethod] = useState<DueDateMethod>(defaultMethod);\n const [refDate, setRefDate] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n DEFAULT_CYCLE_LENGTH,\n );\n const [embryoAge, setEmbryoAge] = useState<EmbryoAge>(5);\n // Optional first-trimester ultrasound (LMP method only) for ACOG CO700 redating.\n const [crlMm, setCrlMm] = useState<number | null>(null);\n const [scanDate, setScanDate] = useState<Date | undefined>(undefined);\n\n // Real today — caps the date inputs (LMP / ultrasound can't be in the future).\n const today = useMemo(() => new Date(), []);\n // The date GA, trimester and schedule status are evaluated against; defaults\n // to today but can be a future appointment date to project forward. (The EDD\n // itself is dating-anchored and does not depend on this.)\n const [asOfDate, setAsOfDate] = useState<Date>(() => new Date());\n\n // ACOG CO700 CRL redating — only when an LMP, a CRL and a scan date are set.\n const redating = useMemo(() => {\n if (method !== 'lmp' || !refDate || crlMm === null || !scanDate) {\n return null;\n }\n return redateByCrl({ lmp: refDate, scanDate, crlMm });\n }, [method, refDate, crlMm, scanDate]);\n\n const result = useMemo<DueDateResult | null>(() => {\n if (!refDate) return null;\n // A confirmed redating moves the effective LMP to the ultrasound's; the\n // CRL already reflects true gestation, so cycle adjustment no longer applies.\n const effectiveDate =\n method === 'lmp' && redating?.redated\n ? redating.gestationalStart\n : refDate;\n const effectiveCycle =\n method === 'lmp' && redating?.redated\n ? DEFAULT_CYCLE_LENGTH\n : (cycleLength ?? DEFAULT_CYCLE_LENGTH);\n return computeDueDate(\n {\n method,\n date: effectiveDate,\n cycleLength: effectiveCycle,\n embryoAge,\n },\n asOfDate,\n );\n }, [method, refDate, cycleLength, embryoAge, redating, asOfDate]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n });\n liveRef.current = {\n method,\n refDate,\n cycleLength,\n embryoAge,\n crlMm,\n scanDate,\n asOfDate,\n result,\n };\n\n const agentHandle = useMemo<DueDateCalculatorHandle>(\n () => ({\n getInputs: () => {\n const live = liveRef.current;\n return {\n method: live.method,\n referenceDate: live.refDate ? toIsoDate(live.refDate) : null,\n cycleLength: live.cycleLength,\n embryoAge: live.embryoAge,\n crlMm: live.crlMm,\n scanDate: live.scanDate ? toIsoDate(live.scanDate) : null,\n asOfDate: toIsoDate(live.asOfDate),\n };\n },\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n dueDate: toIsoDate(r.dueDate),\n gestationalStart: toIsoDate(r.gestationalStart),\n gestationalAge: r.gestationalAge ? { ...r.gestationalAge } : null,\n trimester: r.trimester,\n };\n },\n setMethod: (next) => {\n if (next !== 'lmp' && next !== 'conception' && next !== 'ivf') {\n return false;\n }\n setMethod(next);\n return true;\n },\n setReferenceDate: (isoDate) => {\n if (isoDate === null) {\n setRefDate(undefined);\n return true;\n }\n const parsed = fromIsoDate(isoDate);\n // The DatePicker caps at today; the handle honours the same bound.\n if (!parsed || isAfter(parsed, new Date())) return false;\n setRefDate(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (\n days !== null &&\n !(\n Number.isFinite(days) &&\n days >= CYCLE_LENGTH_RANGE.min &&\n days <= CYCLE_LENGTH_RANGE.max\n )\n ) {\n return false;\n }\n setCycleLength(days);\n return true;\n },\n setEmbryoAge: (days) => {\n if (days !== 3 && days !== 5) return false;\n setEmbryoAge(days);\n return true;\n },\n setCrl: (next) => {\n const now = new Date();\n let parsedScan: Date | undefined;\n // Validate the whole payload before writing any of it, so a bad\n // value can't leave the form half-updated.\n if ('crlMm' in next) {\n const mm = next.crlMm;\n if (\n mm !== null &&\n mm !== undefined &&\n !(Number.isFinite(mm) && mm > 0)\n ) {\n return false;\n }\n }\n if ('scanDate' in next && next.scanDate != null) {\n const d = fromIsoDate(next.scanDate);\n if (!d || isAfter(d, now)) return false;\n parsedScan = d;\n }\n if ('crlMm' in next) setCrlMm(next.crlMm ?? null);\n if ('scanDate' in next) setScanDate(parsedScan);\n return true;\n },\n setAsOfDate: (isoDate) => {\n const parsed = fromIsoDate(isoDate);\n if (!parsed) return false;\n setAsOfDate(parsed);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(dueDateCalculatorAgent, agentHandle, id);\n\n const schedule = useMemo(() => {\n if (!showSchedule || !result) return null;\n return computeAntenatalSchedule(result.gestationalStart, {\n ...scheduleOptions,\n today: asOfDate,\n });\n }, [showSchedule, result, asOfDate, scheduleOptions]);\n\n return (\n <div\n ref={ref}\n data-component=\"due-date-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <RadioGroup\n label={t('dueDateCalculator.method.label')}\n variant=\"horizontal\"\n value={method}\n onValueChange={(next) => setMethod(next as DueDateMethod)}\n >\n <Radio label={t('dueDateCalculator.method.lmp')} value=\"lmp\" />\n <Radio\n label={t('dueDateCalculator.method.conception')}\n value=\"conception\"\n />\n <Radio label={t('dueDateCalculator.method.ivf')} value=\"ivf\" />\n </RadioGroup>\n\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t(DATE_LABEL_KEY[method])}>\n <DatePicker value={refDate} onChange={setRefDate} maxDate={today} />\n </FormField>\n\n {method === 'lmp' && (\n <FormField\n label={t('dueDateCalculator.cycleLength')}\n description={t('dueDateCalculator.cycleLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={CYCLE_LENGTH_RANGE.min}\n max={CYCLE_LENGTH_RANGE.max}\n value={cycleLength}\n onChange={setCycleLength}\n />\n </FormField>\n )}\n\n {method === 'ivf' && (\n <RadioGroup\n label={t('dueDateCalculator.embryoAge')}\n variant=\"horizontal\"\n value={String(embryoAge)}\n onValueChange={(next) => setEmbryoAge(Number(next) as EmbryoAge)}\n >\n <Radio label={t('dueDateCalculator.day3')} value=\"3\" />\n <Radio label={t('dueDateCalculator.day5')} value=\"5\" />\n </RadioGroup>\n )}\n </div>\n\n <FormField\n label={t('dueDateCalculator.asOfDate')}\n description={t('dueDateCalculator.asOfDateHint')}\n >\n <DatePicker value={asOfDate} onChange={(d) => d && setAsOfDate(d)} />\n </FormField>\n\n {method === 'lmp' ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField\n label={t('dueDateCalculator.crl')}\n description={t('dueDateCalculator.crlHint')}\n >\n <NumberInput\n mode=\"decimal\"\n min={0}\n step={0.1}\n value={crlMm}\n onChange={setCrlMm}\n />\n </FormField>\n <FormField label={t('dueDateCalculator.scanDate')}>\n <DatePicker\n value={scanDate}\n onChange={setScanDate}\n maxDate={today}\n />\n </FormField>\n </div>\n {redating ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n <Badge variant={redating.redated ? 'warning' : 'success'}>\n {redating.redated\n ? t('dueDateCalculator.redated', {\n days: redating.discrepancyDays,\n })\n : t('dueDateCalculator.datesAgree')}\n </Badge>\n {!redating.crlInRange ? (\n <span className=\"type-meta ds:text-muted-foreground\">\n {t('dueDateCalculator.crlOutOfRange')}\n </span>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {/* Concise polite announcement when a due date resolves. */}\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('dueDateCalculator.result.dueDateLabel')}: ${dateFormatter.format(\n result.dueDate,\n )}. ${t('dueDateCalculator.result.trimesterLabel')}: ${t(\n `dueDateCalculator.trimester.${result.trimester}`,\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-3\">\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('dueDateCalculator.result.trimesterLabel')}\n </dt>\n <dd>\n <Badge\n variant={TRIMESTER_BADGE_VARIANT[result.trimester]}\n size=\"lg\"\n >\n {t(`dueDateCalculator.trimester.${result.trimester}`)}\n </Badge>\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('dueDateCalculator.result.gestationLabel')}\n </dt>\n <dd className=\"type-body ds:text-foreground\">\n {result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—'}\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('dueDateCalculator.result.dueDateLabel')}\n </dt>\n <dd className=\"type-metric ds:text-foreground\">\n {dateFormatter.format(result.dueDate)}\n </dd>\n </div>\n </dl>\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('dueDateCalculator.empty')}\n </p>\n )}\n\n {schedule ? <AntenatalScheduleTimeline events={schedule} /> : null}\n\n {/* One result-action group for the whole result — sits after both the\n due-date card and the schedule, and its payload carries the schedule\n rows when shown (no per-card buttons). */}\n {result && (insertVariant === 'copy' || onInsert) ? (\n <InsertButton\n variant={insertVariant}\n onInsert={onInsert}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.dueDate'),\n icon: 'calendar-heart',\n highlight: dateFormatter.format(result.dueDate),\n // Chip tinted with the trimester's semantic token so the inserted\n // PNG carries the same clinical-stage colour as the on-screen\n // trimester badge — with the contrast-safe orange override for the\n // `--warning` third trimester.\n highlightToken: trimesterHighlightToken(result.trimester),\n brand: insertBrand,\n fields: [\n {\n // The estimated date of delivery → calendar glyph.\n icon: 'calendar',\n label: t('dueDateCalculator.result.dueDateLabel'),\n value: dateFormatter.format(result.dueDate),\n },\n {\n // Gestational age is an elapsed duration → clock glyph.\n icon: 'clock',\n label: t('dueDateCalculator.result.gestationLabel'),\n value: result.gestationalAge\n ? t('dueDateCalculator.result.gestation', {\n weeks: result.gestationalAge.weeks,\n days: result.gestationalAge.days,\n })\n : '—',\n },\n {\n // Trimester is a clinical-stage classification → tag.\n icon: 'tag',\n label: t('dueDateCalculator.result.trimesterLabel'),\n value: t(`dueDateCalculator.trimester.${result.trimester}`),\n },\n // When the schedule is shown, the single Insert button carries\n // the exam windows too (no second button).\n ...(schedule\n ? buildScheduleInsertFields(schedule, t, (d) =>\n dateFormatter.format(d),\n )\n : []),\n ],\n }}\n />\n ) : null}\n </div>\n );\n },\n);\n\nDueDateCalculator.displayName = 'DueDateCalculator';\n"],"names":["DEPRECATED","isoDate","dueDateCalculatorAgent","handle","args","rootVariants","cva","DATE_LABEL_KEY","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","DueDateCalculator","forwardRef","defaultMethod","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","showSchedule","scheduleOptions","id","width","className","ref","i18n","useTranslation","method","setMethod","useState","refDate","setRefDate","cycleLength","setCycleLength","DEFAULT_CYCLE_LENGTH","embryoAge","setEmbryoAge","crlMm","setCrlMm","scanDate","setScanDate","today","useMemo","asOfDate","setAsOfDate","redating","redateByCrl","result","effectiveDate","effectiveCycle","computeDueDate","dateFormatter","useEffect","liveRef","useRef","agentHandle","live","r","next","parsed","isAfter","days","now","parsedScan","mm","useAgentRegistration","schedule","computeAntenatalSchedule","jsxs","RadioGroup","jsx","Radio","FormField","DatePicker","NumberInput","Badge","Card","TRIMESTER_BADGE_VARIANT","AntenatalScheduleTimeline","InsertButton","trimesterHighlightToken","buildScheduleInsertFields"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAa,iDAGbC,IAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAAgE;AAAA,EAC3E,IAAI;AAAA;AAAA,EAEJ,cAAc,CAAC,WAAW;AAAA,EAC1B,OAAO;AAAA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AAAA,gBACJ,OAAO,EAAE,sBAAsB;AAAA,gBAC/B,MAAM;AAAA,gBACN,WAAWkC,EAAc,OAAOJ,EAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,gBAK9C,gBAAgBiC,GAAwBjC,EAAO,SAAS;AAAA,gBACxD,OAAO7B;AAAA,gBACP,QAAQ;AAAA,kBACN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,uCAAuC;AAAA,oBAChD,OAAOiC,EAAc,OAAOJ,EAAO,OAAO;AAAA,kBAAA;AAAA,kBAE5C;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAOA,EAAO,iBACV,EAAE,sCAAsC;AAAA,sBACtC,OAAOA,EAAO,eAAe;AAAA,sBAC7B,MAAMA,EAAO,eAAe;AAAA,oBAAA,CAC7B,IACD;AAAA,kBAAA;AAAA,kBAEN;AAAA;AAAA,oBAEE,MAAM;AAAA,oBACN,OAAO,EAAE,yCAAyC;AAAA,oBAClD,OAAO,EAAE,+BAA+BA,EAAO,SAAS,EAAE;AAAA,kBAAA;AAAA;AAAA;AAAA,kBAI5D,GAAImB,IACAe;AAAA,oBAA0Bf;AAAA,oBAAU;AAAA,oBAAG,CAAC9D,MACtC+C,EAAc,OAAO/C,CAAC;AAAA,kBAAA,IAExB,CAAA;AAAA,gBAAC;AAAA,cACP;AAAA,YACF;AAAA,UAAA,IAEA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAM,GAAkB,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-card-
|
|
1
|
+
{"version":3,"file":"entity-card-DmrgYSEX.js","sources":["../../src/components/_shared/entity-card/entity-card.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport type { BadgeProps } from '../../badge/badge';\n\n/* ------------------------------------------------------------------ */\n/* Shared helpers for the entity-card family */\n/* ------------------------------------------------------------------ */\n/*\n * Cross-cutting building blocks every \"entity card\" (AgendaCard,\n * MessageCard, NotificationCard, TaskCard, care-plan / appointment cards,\n * …) composes: the surface CVA, the state→Badge-variant lookups, and a\n * colour-id → palette-token resolver. All visual values reference kit\n * tokens — no hardcoded colour/spacing/radius literals.\n */\n\n/** The closed set of Badge variants the entity cards may use. */\ntype BadgeVariant = NonNullable<BadgeProps['variant']>;\n\n/* ------------------------------------------------------------------ */\n/* Surface CVA */\n/* ------------------------------------------------------------------ */\n/**\n * Shared card surface — `elevated` paints the kit card chrome (fill,\n * hairline border, shadow); `flat` drops it for use inside an existing\n * Card / Sheet. `density` tunes the internal padding.\n */\nexport const entitySurfaceVariants = cva(\n [\n 'ds:relative ds:rounded-[var(--radius-lg)]',\n 'ds:text-[color:var(--card-foreground)]',\n 'ds:transition-shadow ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n ].join(' '),\n {\n variants: {\n surface: {\n flat: '',\n elevated: [\n 'ds:bg-[var(--card)] ds:border ds:border-[color:var(--card-border)]',\n 'ds:shadow-[var(--shadow-card)]',\n 'ds:[.theme-accessible_&]:border-2',\n ].join(' '),\n },\n density: {\n comfortable: 'ds:p-[var(--spacing-md)]',\n compact: 'ds:p-[var(--spacing-sm)]',\n },\n },\n defaultVariants: {\n surface: 'elevated',\n density: 'comfortable',\n },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* State → Badge variant lookups */\n/* ------------------------------------------------------------------ */\n\n/** Care-plan lifecycle state → Badge variant. */\nexport const CARE_PLAN_STATE_BADGE = {\n estimate: 'info',\n accepted: 'success',\n discarded: 'error',\n closed: 'neutral',\n} as const satisfies Record<string, BadgeVariant>;\n\nexport type CarePlanState = keyof typeof CARE_PLAN_STATE_BADGE;\n\n/** Appointment lifecycle state → Badge variant. */\nexport const APPOINTMENT_STATE_BADGE = {\n absent: 'error',\n waiting: 'warning',\n in_care: 'info',\n done: 'success',\n cancelled: 'error',\n confirmed: 'success',\n} as const satisfies Record<string, BadgeVariant>;\n\nexport type AppointmentState = keyof typeof APPOINTMENT_STATE_BADGE;\n\n/** Fallback variant for an unknown / out-of-vocabulary appointment state. */\nexport const APPOINTMENT_STATE_BADGE_DEFAULT: BadgeVariant = 'neutral';\n\n/**\n * Resolve an appointment state to its Badge variant, falling back to a\n * neutral chip for any value outside the known vocabulary.\n */\nexport function appointmentStateBadge(state: string): BadgeVariant {\n return (\n (APPOINTMENT_STATE_BADGE as Record<string, BadgeVariant>)[state] ??\n APPOINTMENT_STATE_BADGE_DEFAULT\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Colour-id → palette token */\n/* ------------------------------------------------------------------ */\n/**\n * AlfaDocs assigns operators / categories a numeric colour id. Map it onto\n * a closed set of EXISTING kit palette tokens — the six brand families plus\n * the semantic ramps. Unknown ids fall back to the neutral grey step. The\n * value is a `var(--…)` token, never a literal, so consumers feed it to a\n * token-driven surface (e.g. via `--avatar-color-override`).\n */\nconst COLOR_ID_TOKENS = [\n 'var(--color-violet-500)',\n 'var(--color-purple-500)',\n 'var(--color-magenta-500)',\n 'var(--color-blue-500)',\n 'var(--color-green-500)',\n 'var(--color-red-500)',\n 'var(--color-yellow-500)',\n 'var(--color-indigo-500)',\n 'var(--color-orange-500)',\n 'var(--color-fuchsia-500)',\n] as const;\n\nconst COLOR_ID_FALLBACK = 'var(--color-grey-700)';\n\n/**\n * Darker, AA-safe counterparts of {@link COLOR_ID_TOKENS}, keyed by the same\n * index. The bright -500 steps are fine for a decorative dot but fail WCAG AA\n * under the Avatar's light initials; these clear ≥4.5:1 against the avatar's\n * cream text (yellow needs -800; the rest -700). Use for any swatch that bears\n * text — keep {@link colorIdToToken} for decorative fills (dots, accents).\n */\nconst COLOR_ID_AVATAR_TOKENS = [\n 'var(--color-violet-700)',\n 'var(--color-purple-700)',\n 'var(--color-magenta-700)',\n 'var(--color-blue-700)',\n 'var(--color-green-700)',\n 'var(--color-red-700)',\n 'var(--color-yellow-800)',\n 'var(--color-indigo-700)',\n 'var(--color-orange-700)',\n 'var(--color-fuchsia-700)',\n] as const;\n\nconst COLOR_ID_AVATAR_FALLBACK = 'var(--color-grey-900)';\n\n/** Resolve a colour id to a 0-based index into the closed token ramps. */\nfunction colorIdIndex(colorId: number | string | null | undefined): number {\n if (colorId === null || colorId === undefined) return -1;\n const n =\n typeof colorId === 'number' ? colorId : Number.parseInt(colorId, 10);\n if (!Number.isFinite(n)) return -1;\n return (\n ((Math.trunc(n) % COLOR_ID_TOKENS.length) + COLOR_ID_TOKENS.length) %\n COLOR_ID_TOKENS.length\n );\n}\n\nexport function colorIdToToken(\n colorId: number | string | null | undefined,\n): string {\n const index = colorIdIndex(colorId);\n return index < 0 ? COLOR_ID_FALLBACK : COLOR_ID_TOKENS[index];\n}\n\n/**\n * Avatar-fill variant of {@link colorIdToToken} — returns the same operator\n * hue at an AA-safe darkness for swatches that carry the Avatar's light\n * initials. Pair it with the bright -500 dot from {@link colorIdToToken}.\n */\nexport function colorIdToAvatarToken(\n colorId: number | string | null | undefined,\n): string {\n const index = colorIdIndex(colorId);\n return index < 0 ? COLOR_ID_AVATAR_FALLBACK : COLOR_ID_AVATAR_TOKENS[index];\n}\n\n/* ------------------------------------------------------------------ */\n/* Re-exports */\n/* ------------------------------------------------------------------ */\n\nexport { isSafeEntityUrl } from '../is-safe-url';\n"],"names":["entitySurfaceVariants","cva","CARE_PLAN_STATE_BADGE","APPOINTMENT_STATE_BADGE","APPOINTMENT_STATE_BADGE_DEFAULT","appointmentStateBadge","state","COLOR_ID_TOKENS","COLOR_ID_FALLBACK","COLOR_ID_AVATAR_TOKENS","COLOR_ID_AVATAR_FALLBACK","colorIdIndex","colorId","n","colorIdToToken","index","colorIdToAvatarToken"],"mappings":";AAyBO,MAAMA,IAAwBC;AAAA,EACnC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAA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,EAAaC,CAAO;AAClC,SAAOG,IAAQ,IAAIL,IAA2BD,EAAuBM,CAAK;AAC5E;"}
|
|
@@ -6,15 +6,15 @@ import { u as ue } from "./registry-DvAUVLHh.js";
|
|
|
6
6
|
import { R as d } from "./radio-TWf9Q-mp.js";
|
|
7
7
|
import { R as S } from "./radio-group-rXDJADzW.js";
|
|
8
8
|
import { F as k } from "./form-field-CahJzTxp.js";
|
|
9
|
-
import { D as _ } from "./date-picker-
|
|
9
|
+
import { D as _ } from "./date-picker-CepI_oI2.js";
|
|
10
10
|
import { S as me } from "./select-BW5ecXlX.js";
|
|
11
11
|
import { S as ge } from "./switch-OILsBLWo.js";
|
|
12
12
|
import { C as E } from "./card-DPmk26CL.js";
|
|
13
13
|
import { B as G } from "./badge-sTusUqZD.js";
|
|
14
14
|
import { I as pe } from "./insert-result-LCNTskNJ.js";
|
|
15
|
-
import { c as he, g as fe, e as ye, f as ve, A as be, h as Ae, i as De, G as Ce } from "./antenatal-schedule-timeline-
|
|
16
|
-
import { s as we } from "./subDays-
|
|
17
|
-
import { c as j } from "./date-picker-variants-
|
|
15
|
+
import { c as he, g as fe, e as ye, f as ve, A as be, h as Ae, i as De, G as Ce } from "./antenatal-schedule-timeline-B1k8QkA6.js";
|
|
16
|
+
import { s as we } from "./subDays-BLl3y3pd.js";
|
|
17
|
+
import { c as j } from "./date-picker-variants-DfuooXEK.js";
|
|
18
18
|
import { p as Se } from "./parseISO-fOGpHKXm.js";
|
|
19
19
|
import { f as ke } from "./format-4HNwNGrN.js";
|
|
20
20
|
const x = "Superseded by the `pregnancy-dating` adapter.", F = {
|
|
@@ -485,4 +485,4 @@ Re.displayName = "GestationalAgeCalculator";
|
|
|
485
485
|
export {
|
|
486
486
|
Re as G
|
|
487
487
|
};
|
|
488
|
-
//# sourceMappingURL=gestational-age-calculator-
|
|
488
|
+
//# sourceMappingURL=gestational-age-calculator-CxZelpu2.js.map
|