@alfadocs/ui-kit-debug 1.4.13 → 1.4.14
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/{address-fields-D-8akw2m.js → address-fields-CZP4Wncx.js} +2 -2
- package/dist/_chunks/{address-fields-D-8akw2m.js.map → address-fields-CZP4Wncx.js.map} +1 -1
- package/dist/_chunks/{agenda-card-BQDs2ZMp.js → agenda-card-pdN49pMu.js} +2 -2
- package/dist/_chunks/{agenda-card-BQDs2ZMp.js.map → agenda-card-pdN49pMu.js.map} +1 -1
- package/dist/_chunks/{agenda-tray-BTyWsVwT.js → agenda-tray-CYR-znfE.js} +2 -2
- package/dist/_chunks/{agenda-tray-BTyWsVwT.js.map → agenda-tray-CYR-znfE.js.map} +1 -1
- package/dist/_chunks/{ai-consent-banner-gVcoiXxv.js → ai-consent-banner-DLF6FNXv.js} +2 -2
- package/dist/_chunks/{ai-consent-banner-gVcoiXxv.js.map → ai-consent-banner-DLF6FNXv.js.map} +1 -1
- package/dist/_chunks/{anamnesis-card-Bt0twrML.js → anamnesis-card-BylMLHYj.js} +2 -2
- package/dist/_chunks/{anamnesis-card-Bt0twrML.js.map → anamnesis-card-BylMLHYj.js.map} +1 -1
- package/dist/_chunks/{anamnesis-summary-card-BKGVcwny.js → anamnesis-summary-card-DGVKBQoq.js} +134 -116
- package/dist/_chunks/anamnesis-summary-card-DGVKBQoq.js.map +1 -0
- package/dist/_chunks/{anamnesis-summary-rows-B5MAYkJ-.js → anamnesis-summary-rows-C73SWVy3.js} +3034 -2954
- package/dist/_chunks/anamnesis-summary-rows-C73SWVy3.js.map +1 -0
- package/dist/_chunks/{antenatal-schedule-timeline-BSLrOQ3S.js → antenatal-schedule-timeline-BjlF2rTz.js} +2 -2
- package/dist/_chunks/{antenatal-schedule-timeline-BSLrOQ3S.js.map → antenatal-schedule-timeline-BjlF2rTz.js.map} +1 -1
- package/dist/_chunks/{appointment-card-kcUC7vWR.js → appointment-card-BhcPJpXh.js} +2 -2
- package/dist/_chunks/{appointment-card-kcUC7vWR.js.map → appointment-card-BhcPJpXh.js.map} +1 -1
- package/dist/_chunks/{appointment-timeline-BC3dlZu5.js → appointment-timeline-DT1uFp8z.js} +2 -2
- package/dist/_chunks/{appointment-timeline-BC3dlZu5.js.map → appointment-timeline-DT1uFp8z.js.map} +1 -1
- package/dist/_chunks/{appointment-tray-BPY5rATW.js → appointment-tray-DvyVK7um.js} +2 -2
- package/dist/_chunks/{appointment-tray-BPY5rATW.js.map → appointment-tray-DvyVK7um.js.map} +1 -1
- package/dist/_chunks/{badge-CIt-UFEx.js → badge-sTusUqZD.js} +23 -18
- package/dist/_chunks/{badge-CIt-UFEx.js.map → badge-sTusUqZD.js.map} +1 -1
- package/dist/_chunks/{bishop-score-B6iYYO0c.js → bishop-score-BV1JAEMV.js} +3 -3
- package/dist/_chunks/{bishop-score-B6iYYO0c.js.map → bishop-score-BV1JAEMV.js.map} +1 -1
- package/dist/_chunks/{bmi-calculator-DC5SaqXT.js → bmi-calculator-CdR-RLFj.js} +5 -5
- package/dist/_chunks/{bmi-calculator-DC5SaqXT.js.map → bmi-calculator-CdR-RLFj.js.map} +1 -1
- package/dist/_chunks/{booking-CmHX15dh.js → booking-CGKof8QU.js} +2 -2
- package/dist/_chunks/{booking-CmHX15dh.js.map → booking-CGKof8QU.js.map} +1 -1
- package/dist/_chunks/{care-plan-card-9tLgsDYY.js → care-plan-card-C83Hb9EE.js} +3 -3
- package/dist/_chunks/{care-plan-card-9tLgsDYY.js.map → care-plan-card-C83Hb9EE.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-CSan4h7A.js → care-plan-entry-card-CHMPSTCz.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-CSan4h7A.js.map → care-plan-entry-card-CHMPSTCz.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-D_BTi77b.js → care-plan-header-_B0TTWT1.js} +2 -2
- package/dist/_chunks/{care-plan-header-D_BTi77b.js.map → care-plan-header-_B0TTWT1.js.map} +1 -1
- package/dist/_chunks/{clinical-note-card-ByzQ86uz.js → clinical-note-card-BBgFd2nB.js} +2 -2
- package/dist/_chunks/{clinical-note-card-ByzQ86uz.js.map → clinical-note-card-BBgFd2nB.js.map} +1 -1
- package/dist/_chunks/{connection-status-D8mZ4klk.js → connection-status-NT8hUtYl.js} +2 -2
- package/dist/_chunks/{connection-status-D8mZ4klk.js.map → connection-status-NT8hUtYl.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-DuW6VpzY.js → contact-profile-card-BxHiG8e6.js} +2 -2
- package/dist/_chunks/{contact-profile-card-DuW6VpzY.js.map → contact-profile-card-BxHiG8e6.js.map} +1 -1
- package/dist/_chunks/{cycle-calculator-B_NlctlQ.js → cycle-calculator-DJZYvNhw.js} +4 -4
- package/dist/_chunks/{cycle-calculator-B_NlctlQ.js.map → cycle-calculator-DJZYvNhw.js.map} +1 -1
- package/dist/_chunks/{dependent-selector-BUvrZRi0.js → dependent-selector-cJlJFAKD.js} +2 -2
- package/dist/_chunks/{dependent-selector-BUvrZRi0.js.map → dependent-selector-cJlJFAKD.js.map} +1 -1
- package/dist/_chunks/{document-preview-Di15VrpQ.js → document-preview-Aae2yKvY.js} +2 -2
- package/dist/_chunks/{document-preview-Di15VrpQ.js.map → document-preview-Aae2yKvY.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-le1z3KpW.js → due-date-calculator-ajaQ4ya5.js} +6 -6
- package/dist/_chunks/{due-date-calculator-le1z3KpW.js.map → due-date-calculator-ajaQ4ya5.js.map} +1 -1
- package/dist/_chunks/{fetal-weight-DXA6ZpMq.js → fetal-weight-jon6GIfQ.js} +4 -4
- package/dist/_chunks/{fetal-weight-DXA6ZpMq.js.map → fetal-weight-jon6GIfQ.js.map} +1 -1
- package/dist/_chunks/{field-value-BCFLVBmu.js → field-value-BbiDRyNh.js} +2 -2
- package/dist/_chunks/{field-value-BCFLVBmu.js.map → field-value-BbiDRyNh.js.map} +1 -1
- package/dist/_chunks/{file-manager-BjCM2fZB.js → file-manager-CML_C6_h.js} +2 -2
- package/dist/_chunks/{file-manager-BjCM2fZB.js.map → file-manager-CML_C6_h.js.map} +1 -1
- package/dist/_chunks/form-field-CahJzTxp.js +131 -0
- package/dist/_chunks/form-field-CahJzTxp.js.map +1 -0
- package/dist/_chunks/{gestational-age-calculator-Ch8vmJAl.js → gestational-age-calculator-dEpQDWcb.js} +5 -5
- package/dist/_chunks/{gestational-age-calculator-Ch8vmJAl.js.map → gestational-age-calculator-dEpQDWcb.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-BT6lki_i.js → hcg-doubling-CC6TLtHd.js} +4 -4
- package/dist/_chunks/{hcg-doubling-BT6lki_i.js.map → hcg-doubling-CC6TLtHd.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-C7GvyK66.js → link-cell-renderer-D3IsW_2R.js} +3 -3
- package/dist/_chunks/{link-cell-renderer-C7GvyK66.js.map → link-cell-renderer-D3IsW_2R.js.map} +1 -1
- package/dist/_chunks/{marketplace-app-shell-BhRH7Zi4.js → marketplace-app-shell-b5hN-Q0m.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-BhRH7Zi4.js.map → marketplace-app-shell-b5hN-Q0m.js.map} +1 -1
- package/dist/_chunks/{notes-panel-Bz83SO4-.js → notes-panel-D6HKLLS-.js} +2 -2
- package/dist/_chunks/{notes-panel-Bz83SO4-.js.map → notes-panel-D6HKLLS-.js.map} +1 -1
- package/dist/_chunks/{number-input-CM1q9zvH.js → number-input-Cgu2TtA8.js} +30 -21
- package/dist/_chunks/number-input-Cgu2TtA8.js.map +1 -0
- package/dist/_chunks/{operator-hero-CpJkDNAM.js → operator-hero-CCDnIa1S.js} +2 -2
- package/dist/_chunks/{operator-hero-CpJkDNAM.js.map → operator-hero-CCDnIa1S.js.map} +1 -1
- package/dist/_chunks/{optical-prescription-CQR_WJiS.js → optical-prescription-DtzEqFQm.js} +2 -2
- package/dist/_chunks/{optical-prescription-CQR_WJiS.js.map → optical-prescription-DtzEqFQm.js.map} +1 -1
- package/dist/_chunks/{patient-details-CnFgF3MU.js → patient-details-rENrE_qY.js} +3 -3
- package/dist/_chunks/{patient-details-CnFgF3MU.js.map → patient-details-rENrE_qY.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-DfbOtOV6.js → patient-summary-card-DQJgOOrA.js} +3 -3
- package/dist/_chunks/{patient-summary-card-DfbOtOV6.js.map → patient-summary-card-DQJgOOrA.js.map} +1 -1
- package/dist/_chunks/{patient-table-BXzcrC79.js → patient-table-BubxfOWL.js} +3 -3
- package/dist/_chunks/{patient-table-BXzcrC79.js.map → patient-table-BubxfOWL.js.map} +1 -1
- package/dist/_chunks/{payment-automation-upsell-Ckh3b7Xx.js → payment-automation-upsell-CnaBPt5e.js} +2 -2
- package/dist/_chunks/{payment-automation-upsell-Ckh3b7Xx.js.map → payment-automation-upsell-CnaBPt5e.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-Dn6-tH-D.js → payment-request-card-CvhDzDNk.js} +2 -2
- package/dist/_chunks/{payment-request-card-Dn6-tH-D.js.map → payment-request-card-CvhDzDNk.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-B0yko9Xm.js → periodontal-chart-brakjj0s.js} +2 -2
- package/dist/_chunks/{periodontal-chart-B0yko9Xm.js.map → periodontal-chart-brakjj0s.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-card-HbYTmWlo.js → periodontal-chart-card-Bz-ebteE.js} +2 -2
- package/dist/_chunks/{periodontal-chart-card-HbYTmWlo.js.map → periodontal-chart-card-Bz-ebteE.js.map} +1 -1
- package/dist/_chunks/{periodontal-diagnosis-Qk4F3Wc_.js → periodontal-diagnosis-HrFsVi-C.js} +3 -3
- package/dist/_chunks/{periodontal-diagnosis-Qk4F3Wc_.js.map → periodontal-diagnosis-HrFsVi-C.js.map} +1 -1
- package/dist/_chunks/{periodontal-risk-chart-ByKuM4cF.js → periodontal-risk-chart-0x7KVZjL.js} +2 -2
- package/dist/_chunks/{periodontal-risk-chart-ByKuM4cF.js.map → periodontal-risk-chart-0x7KVZjL.js.map} +1 -1
- package/dist/_chunks/{practice-results-C5exrEn0.js → practice-results-DWUZRm2x.js} +2 -2
- package/dist/_chunks/{practice-results-C5exrEn0.js.map → practice-results-DWUZRm2x.js.map} +1 -1
- package/dist/_chunks/{pregnancy-dating-4tPV_Yko.js → pregnancy-dating-DQVpFs_f.js} +6 -6
- package/dist/_chunks/{pregnancy-dating-4tPV_Yko.js.map → pregnancy-dating-DQVpFs_f.js.map} +1 -1
- package/dist/_chunks/{pregnancy-weight-gain-BBgbWBGe.js → pregnancy-weight-gain-hm3QJALe.js} +5 -5
- package/dist/_chunks/{pregnancy-weight-gain-BBgbWBGe.js.map → pregnancy-weight-gain-hm3QJALe.js.map} +1 -1
- package/dist/_chunks/radio-group-rXDJADzW.js +175 -0
- package/dist/_chunks/radio-group-rXDJADzW.js.map +1 -0
- package/dist/_chunks/{radiograph-panel.agent-Drj0hYVV.js → radiograph-panel.agent-CAXFgCyn.js} +3 -3
- package/dist/_chunks/{radiograph-panel.agent-Drj0hYVV.js.map → radiograph-panel.agent-CAXFgCyn.js.map} +1 -1
- package/dist/_chunks/{signature-status-chip-DlLJk1VA.js → signature-status-chip-DqrPIJtH.js} +2 -2
- package/dist/_chunks/{signature-status-chip-DlLJk1VA.js.map → signature-status-chip-DqrPIJtH.js.map} +1 -1
- package/dist/_chunks/{tab-bar-Ddp_ZbnL.js → tab-bar-DvFJIQfL.js} +2 -2
- package/dist/_chunks/{tab-bar-Ddp_ZbnL.js.map → tab-bar-DvFJIQfL.js.map} +1 -1
- package/dist/_chunks/{tasks-panel-T7vaKJcA.js → tasks-panel-BBkZuejF.js} +2 -2
- package/dist/_chunks/{tasks-panel-T7vaKJcA.js.map → tasks-panel-BBkZuejF.js.map} +1 -1
- package/dist/_chunks/{unit-converter-Dsk__pjA.js → unit-converter-iDxlxKmm.js} +3 -3
- package/dist/_chunks/{unit-converter-Dsk__pjA.js.map → unit-converter-iDxlxKmm.js.map} +1 -1
- package/dist/_chunks/{widget-picker-DqMbjQy_.js → widget-picker-em4xGgv0.js} +2 -2
- package/dist/_chunks/{widget-picker-DqMbjQy_.js.map → widget-picker-em4xGgv0.js.map} +1 -1
- package/dist/_chunks/{workflow-map-BNBeG2zn.js → workflow-map-BVofnDYh.js} +2 -2
- package/dist/_chunks/{workflow-map-BNBeG2zn.js.map → workflow-map-BVofnDYh.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/agenda-card/index.js +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/anamnesis-card/index.js +1 -1
- package/dist/components/anamnesis-summary-card/anamnesis-summary-card.d.ts +2 -2
- package/dist/components/anamnesis-summary-card/anamnesis-summary-card.d.ts.map +1 -1
- package/dist/components/anamnesis-summary-card/index.js +1 -1
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/bishop-score/index.js +1 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/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/clinical-note-card/index.js +1 -1
- package/dist/components/connection-status/index.js +1 -1
- package/dist/components/contact-profile-card/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/dependent-selector/index.js +1 -1
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/fetal-weight/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/form-field/form-field.d.ts +8 -0
- package/dist/components/form-field/form-field.d.ts.map +1 -1
- package/dist/components/form-field/index.js +1 -1
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/number-input/number-input.d.ts +5 -2
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/optical-prescription/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/periodontal-chart/index.js +1 -1
- package/dist/components/periodontal-chart-card/index.js +1 -1
- package/dist/components/periodontal-diagnosis/index.js +1 -1
- package/dist/components/periodontal-risk-chart/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/pregnancy-weight-gain/index.js +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/radio-group/radio-group.d.ts +5 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/signature-status-chip/index.js +1 -1
- package/dist/components/tab-bar/index.js +1 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/components/unit-converter/index.js +1 -1
- package/dist/components/widget-picker/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/host-compat.css +4 -1
- package/dist/index.js +56 -56
- package/dist/patterns/anamnesis/anamnesis-evolution.d.ts +7 -1
- package/dist/patterns/anamnesis/anamnesis-evolution.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-field.d.ts +15 -1
- package/dist/patterns/anamnesis/anamnesis-field.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-i18n.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-indicators.d.ts +3 -1
- package/dist/patterns/anamnesis/anamnesis-indicators.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts +3 -2
- package/dist/patterns/anamnesis/anamnesis-intake.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts.map +1 -1
- package/dist/patterns/anamnesis/anamnesis-types.d.ts +3 -0
- package/dist/patterns/anamnesis/anamnesis-types.d.ts.map +1 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +1 -1
- package/dist/tokens.css +3 -3
- package/package.json +1 -1
- package/dist/_chunks/anamnesis-summary-card-BKGVcwny.js.map +0 -1
- package/dist/_chunks/anamnesis-summary-rows-B5MAYkJ-.js.map +0 -1
- package/dist/_chunks/form-field-D1oqYisL.js +0 -127
- package/dist/_chunks/form-field-D1oqYisL.js.map +0 -1
- package/dist/_chunks/number-input-CM1q9zvH.js.map +0 -1
- package/dist/_chunks/radio-group-BmIqhIT2.js +0 -171
- package/dist/_chunks/radio-group-BmIqhIT2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycle-calculator-B_NlctlQ.js","sources":["../../node_modules/lucide-react/dist/esm/icons/droplet.mjs","../../src/components/cycle-calculator/cycle-calculator.agent.ts","../../src/components/cycle-calculator/cycle.ts","../../src/components/cycle-calculator/cycle-calculator.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z\",\n key: \"c7niix\"\n }\n ]\n];\nconst Droplet = createLucideIcon(\"droplet\", __iconNode);\n\nexport { __iconNode, Droplet as default };\n//# sourceMappingURL=droplet.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — CycleCalculator. */\n/* */\n/* Menstrual-cycle predictor: takes a last-period date (+ optional cycle */\n/* and period lengths) and computes ovulation, fertile window and the */\n/* next few periods. The agent surface is the three inputs plus the */\n/* computed prediction; the handle is the curated `CycleCalculatorHandle` */\n/* (the public `ref` stays the root <div>, exactly as `slider.tsx` and */\n/* `bmi-calculator.tsx` 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/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural inputs (a date, two day counts) and the */\n/* dates derived from them, the same \"filter model\" precedent §7 sets. */\n/* See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { CycleCalculatorHandle } from './cycle-calculator';\n\n/** Shared JSON Schema fragment for a local-time calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const cycleCalculatorAgent: AgentAdapter<CycleCalculatorHandle> = {\n id: 'cycle-calculator',\n // set_value → the three `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ lastPeriodStart: string | null, cycleLength: number | null, periodLength: number | null }',\n descriptionKey: 'ui.agent.cycleCalculator.state.inputs',\n description:\n 'The three cycle inputs as entered — last-period start date (`yyyy-MM-dd`), average cycle length in days, and period (bleed) length in days. Null where unset.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ ovulation: string, fertileWindow: { start: string, end: string }, nextPeriod: string, periodRange: { start: string, end: string } | null, upcomingPeriods: string[] } | null',\n descriptionKey: 'ui.agent.cycleCalculator.state.result',\n description:\n 'Computed prediction — ovulation date, fertile window, next period, current bleed range and the next few period starts, all `yyyy-MM-dd`. Null until a last-period date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_last_period: {\n // Drives the same local input state a user types into; nothing is\n // persisted to a record, and the value is reversible in the same UI.\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 'Start date of the last period, or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\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 { args: { date: '2026-08-01' }, note: 'Last period started 1 August.' },\n ],\n descriptionKey: 'ui.agent.cycleCalculator.actions.setLastPeriod',\n description:\n 'Set the start date of the last period. This is the only required input — the prediction stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setLastPeriod(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 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 ],\n descriptionKey: 'ui.agent.cycleCalculator.actions.setCycleLength',\n description:\n 'Set the average cycle length in days. Shifts ovulation, the fertile window and every upcoming period.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_period_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 1, maximum: 14 },\n { type: 'null' },\n ],\n description:\n 'Period (bleed) length in days (1–14), or null to omit the bleed range.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 1–14 days — the same bounds the on-screen NumberInput enforces.',\n ],\n descriptionKey: 'ui.agent.cycleCalculator.actions.setPeriodLength',\n description:\n 'Set the period (bleed) length in days. Optional — it only adds the current bleed range to the result.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setPeriodLength(args.days),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'cycle-calculator',\n description: 'Marks the CycleCalculator 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 only the DOM channel works.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Menstrual-cycle prediction — pure, framework-free, unit-testable. */\n/* */\n/* Uses the standard fixed-luteal-phase model: ovulation falls ~14 days */\n/* before the next period, so on a cycle of length L ovulation is day */\n/* (L − 14). The fertile window spans the 5 days before ovulation */\n/* (sperm survival) through 1 day after (oocyte viability). */\n/* ------------------------------------------------------------------ */\n\nimport { addDays } from 'date-fns';\n\n/** Standard menstrual-cycle length. */\nexport const DEFAULT_CYCLE_LENGTH = 28;\n/** Luteal phase is biologically near-constant at ~14 days. */\nexport const LUTEAL_PHASE_DAYS = 14;\n/** Sperm survive up to ~5 days before ovulation. */\nexport const FERTILE_DAYS_BEFORE = 5;\n/** The oocyte is viable ~1 day after ovulation. */\nexport const FERTILE_DAYS_AFTER = 1;\n\nexport interface CycleInput {\n /** First day of the most recent period. */\n lastPeriodStart: Date;\n /** Average cycle length in days. Defaults to 28. */\n cycleLength?: number;\n /** Period (bleed) length in days. Optional — used for the period range. */\n periodLength?: number;\n}\n\nexport interface DateRange {\n start: Date;\n end: Date;\n}\n\nexport interface CyclePrediction {\n /** Start date of the next period. */\n nextPeriod: Date;\n /** Estimated ovulation date. */\n ovulation: Date;\n /** Fertile window (5 days before ovulation → 1 day after). */\n fertileWindow: DateRange;\n /** Start dates of the next few periods (length = `occurrences`). */\n upcomingPeriods: Date[];\n /**\n * The current period's bleed range (first day → last day), or `null` when no\n * `periodLength` was given.\n */\n periodRange: DateRange | null;\n}\n\n/**\n * Predict ovulation, the fertile window and upcoming periods from the last\n * period's start date. `occurrences` controls how many future periods to\n * list (default 3).\n */\nexport function predictCycle(\n input: CycleInput,\n occurrences = 3,\n): CyclePrediction {\n const cycle = input.cycleLength ?? DEFAULT_CYCLE_LENGTH;\n const { lastPeriodStart } = input;\n\n const ovulation = addDays(lastPeriodStart, cycle - LUTEAL_PHASE_DAYS);\n const fertileWindow: DateRange = {\n start: addDays(ovulation, -FERTILE_DAYS_BEFORE),\n end: addDays(ovulation, FERTILE_DAYS_AFTER),\n };\n const nextPeriod = addDays(lastPeriodStart, cycle);\n const upcomingPeriods = Array.from({ length: occurrences }, (_, i) =>\n addDays(lastPeriodStart, cycle * (i + 1)),\n );\n const periodRange: DateRange | null =\n input.periodLength && input.periodLength > 0\n ? {\n start: lastPeriodStart,\n end: addDays(lastPeriodStart, input.periodLength - 1),\n }\n : null;\n\n return { nextPeriod, ovulation, fertileWindow, upcomingPeriods, periodRange };\n}\n","/* ------------------------------------------------------------------ */\n/* CycleCalculator — predict ovulation, fertile window and upcoming */\n/* periods from the last period's start date. */\n/* */\n/* Maths lives in `./cycle` (pure, separately tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { Heart, Check, Droplet } from 'lucide-react';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { cycleCalculatorAgent } from './cycle-calculator.agent';\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 CyclePrediction,\n predictCycle,\n DEFAULT_CYCLE_LENGTH,\n} from './cycle';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\n/**\n * DS token NAME backing the result-card chip — the fertile window is the\n * headline fertility datum, shown on screen with the `accent` Badge variant\n * (which fills `--accent`). The card chip reuses that token so the inserted\n * PNG chip matches the on-screen fertile-window badge.\n */\nconst HIGHLIGHT_TOKEN = '--accent';\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;\nconst PERIOD_LENGTH_RANGE = { min: 1, max: 14 } as const;\n\nconst inRange = (\n n: number | null,\n { min, max }: { min: number; max: number },\n): boolean => n === null || (Number.isFinite(n) && n >= min && n <= max);\n\n/** `CyclePrediction` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface CyclePredictionSnapshot {\n /** Estimated ovulation date, `yyyy-MM-dd`. */\n ovulation: string;\n /** Fertile window, `yyyy-MM-dd` endpoints. */\n fertileWindow: { start: string; end: string };\n /** Start of the next period, `yyyy-MM-dd`. */\n nextPeriod: string;\n /** Current period's bleed range, or null when no period length was given. */\n periodRange: { start: string; end: string } | null;\n /** Start dates of the next few periods, `yyyy-MM-dd`. */\n upcomingPeriods: string[];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the three\n * cycle inputs and the computed prediction, and drives the inputs the way a\n * user would. Never exposes patient identity — only structural dates and day\n * counts. Consumed by `cycle-calculator.agent.ts`; the public `ref` stays the\n * root DOM element.\n */\nexport interface CycleCalculatorHandle {\n /** Current inputs — ISO date + day counts, or null when unset. */\n getInputs: () => {\n lastPeriodStart: string | null;\n cycleLength: number | null;\n periodLength: number | null;\n };\n /** Computed prediction, or null until a last-period date is set. */\n getResult: () => CyclePredictionSnapshot | null;\n /** Set the last period's start date (`yyyy-MM-dd`, not in the future). */\n setLastPeriod: (isoDate: string | null) => boolean;\n /** Set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** Set the period (bleed) length in days (1–14). */\n setPeriodLength: (days: number | null) => boolean;\n}\n\nexport interface CycleCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial cycle length in days. Defaults to 28. */\n defaultCycleLength?: number;\n /** Fires whenever a prediction can be computed (and `null` when it can't). */\n onResultChange?: (result: CyclePrediction | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Which verb the result button performs. Defaults to `'insert'`.\n * Use `'copy'` in an app-shell surface (no editor to insert into) — the\n * button writes the result to the clipboard as a multi-format `ClipboardItem`.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\n */\n insertBrand?: string | false;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport const CycleCalculator = forwardRef<HTMLDivElement, CycleCalculatorProps>(\n (\n {\n defaultCycleLength = DEFAULT_CYCLE_LENGTH,\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [lastPeriod, setLastPeriod] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n defaultCycleLength,\n );\n const [periodLength, setPeriodLength] = useState<number | null>(null);\n\n const result = useMemo<CyclePrediction | null>(() => {\n if (!lastPeriod) return null;\n return predictCycle({\n lastPeriodStart: lastPeriod,\n cycleLength: cycleLength ?? DEFAULT_CYCLE_LENGTH,\n periodLength: periodLength ?? undefined,\n });\n }, [lastPeriod, cycleLength, periodLength]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n const today = useMemo(() => new Date(), []);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({ lastPeriod, cycleLength, periodLength, result });\n liveRef.current = { lastPeriod, cycleLength, periodLength, result };\n\n const agentHandle = useMemo<CycleCalculatorHandle>(\n () => ({\n getInputs: () => ({\n lastPeriodStart: liveRef.current.lastPeriod\n ? toIsoDate(liveRef.current.lastPeriod)\n : null,\n cycleLength: liveRef.current.cycleLength,\n periodLength: liveRef.current.periodLength,\n }),\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n ovulation: toIsoDate(r.ovulation),\n fertileWindow: {\n start: toIsoDate(r.fertileWindow.start),\n end: toIsoDate(r.fertileWindow.end),\n },\n nextPeriod: toIsoDate(r.nextPeriod),\n periodRange: r.periodRange\n ? {\n start: toIsoDate(r.periodRange.start),\n end: toIsoDate(r.periodRange.end),\n }\n : null,\n upcomingPeriods: r.upcomingPeriods.map(toIsoDate),\n };\n },\n setLastPeriod: (isoDate) => {\n if (isoDate === null) {\n setLastPeriod(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 setLastPeriod(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (!inRange(days, CYCLE_LENGTH_RANGE)) return false;\n setCycleLength(days);\n return true;\n },\n setPeriodLength: (days) => {\n if (!inRange(days, PERIOD_LENGTH_RANGE)) return false;\n setPeriodLength(days);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(cycleCalculatorAgent, agentHandle, id);\n\n const fmt = (d: Date): string => dateFormatter.format(d);\n\n return (\n <div\n ref={ref}\n data-component=\"cycle-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t('cycleCalculator.lastPeriod')}>\n <DatePicker\n value={lastPeriod}\n onChange={setLastPeriod}\n maxDate={today}\n />\n </FormField>\n <FormField\n label={t('cycleCalculator.cycleLength')}\n description={t('cycleCalculator.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 <FormField\n label={t('cycleCalculator.periodLength')}\n description={t('cycleCalculator.periodLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={PERIOD_LENGTH_RANGE.min}\n max={PERIOD_LENGTH_RANGE.max}\n value={periodLength}\n onChange={setPeriodLength}\n />\n </FormField>\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('cycleCalculator.ovulation')}: ${fmt(result.ovulation)}. ${t(\n 'cycleCalculator.nextPeriod',\n )}: ${fmt(result.nextPeriod)}.`\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-center ds:gap-[var(--spacing-xs)] ds:text-center\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.ovulation')}\n </dt>\n <dd>\n <Badge\n variant=\"success\"\n size=\"lg\"\n leading={<Check aria-hidden />}\n >\n {fmt(result.ovulation)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.fertileWindow')}\n </dt>\n <dd>\n <Badge\n variant=\"accent\"\n size=\"lg\"\n leading={<Heart aria-hidden />}\n >\n {fmt(result.fertileWindow.start)} –{' '}\n {fmt(result.fertileWindow.end)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.nextPeriod')}\n </dt>\n <dd>\n <Badge\n variant=\"error\"\n size=\"lg\"\n leading={<Droplet aria-hidden />}\n >\n {fmt(result.nextPeriod)}\n </Badge>\n </dd>\n </div>\n </dl>\n\n {result.periodRange ? (\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.periodRange')}\n </span>\n <span className=\"type-body ds:text-foreground\">\n {fmt(result.periodRange.start)} –{' '}\n {fmt(result.periodRange.end)}\n </span>\n </div>\n ) : null}\n\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.upcomingPeriods')}\n </span>\n <ul className=\"ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-2xs)]\">\n {result.upcomingPeriods.map((d) => (\n <li\n key={d.getTime()}\n className=\"type-body ds:text-foreground\"\n >\n {fmt(d)}\n </li>\n ))}\n </ul>\n </div>\n\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n onInsert={onInsert}\n variant={insertVariant}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.cycle'),\n icon: 'heart',\n highlight: `${fmt(result.fertileWindow.start)} – ${fmt(\n result.fertileWindow.end,\n )}`,\n // Chip reuses the on-screen fertile-window badge's accent\n // token so the inserted PNG chip matches the screen.\n highlightToken: HIGHLIGHT_TOKEN,\n brand: insertBrand,\n fields: [\n {\n // Ovulation is a predicted date → calendar glyph (the\n // on-screen badge uses a Check tick, which ICON_GEOMETRY\n // does not carry, so the calendar reads the date meaning).\n icon: 'calendar',\n label: t('cycleCalculator.ovulation'),\n value: fmt(result.ovulation),\n },\n {\n // Fertile window → heart glyph, matching the on-screen\n // fertile-window badge's Heart icon.\n icon: 'heart',\n label: t('cycleCalculator.fertileWindow'),\n value: `${fmt(result.fertileWindow.start)} – ${fmt(\n result.fertileWindow.end,\n )}`,\n },\n {\n // Next period → droplets glyph, matching the on-screen\n // next-period badge's Droplet icon.\n icon: 'droplets',\n label: t('cycleCalculator.nextPeriod'),\n value: fmt(result.nextPeriod),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('cycleCalculator.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nCycleCalculator.displayName = 'CycleCalculator';\n"],"names":["__iconNode","Droplet","createLucideIcon","isoDate","cycleCalculatorAgent","handle","args","DEFAULT_CYCLE_LENGTH","LUTEAL_PHASE_DAYS","FERTILE_DAYS_AFTER","predictCycle","input","occurrences","cycle","lastPeriodStart","ovulation","addDays","fertileWindow","nextPeriod","upcomingPeriods","_","i","periodRange","rootVariants","cva","HIGHLIGHT_TOKEN","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","PERIOD_LENGTH_RANGE","inRange","n","min","max","CycleCalculator","forwardRef","defaultCycleLength","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","lastPeriod","setLastPeriod","useState","cycleLength","setCycleLength","periodLength","setPeriodLength","result","useMemo","dateFormatter","useEffect","today","liveRef","useRef","agentHandle","parsed","isAfter","days","useAgentRegistration","fmt","jsxs","jsx","FormField","DatePicker","NumberInput","Card","Badge","Check","Heart","InsertButton"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAUC,EAAiB,WAAWF,EAAU,GCKhDG,KAAU;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AACX,GAEaC,KAA4D;AAAA,EACvE,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,iBAAiB;AAAA;AAAA;AAAA,MAGf,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,MAAM;AAAA,YACJ,OAAO;AAAA,cACL,EAAE,GAAGF,IAAS,aAAa,qCAAA;AAAA,cAC3B,EAAE,MAAM,OAAA;AAAA,YAAO;AAAA,YAEjB,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,MAA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AOsB,EAAIZ,EAAO,UAAU;AAAA,oBAAA;AAAA,kBAC9B;AAAA,gBACF;AAAA,cACF;AAAA,YAAA,IAEA;AAAA,UAAA,EAAA,CACN,EAAA,CACF,IAEA,gBAAAc,EAAC,KAAA,EAAE,WAAU,sCACV,UAAAxB,EAAE,uBAAuB,EAAA,CAC5B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAb,GAAgB,cAAc;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"cycle-calculator-DJZYvNhw.js","sources":["../../node_modules/lucide-react/dist/esm/icons/droplet.mjs","../../src/components/cycle-calculator/cycle-calculator.agent.ts","../../src/components/cycle-calculator/cycle.ts","../../src/components/cycle-calculator/cycle-calculator.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z\",\n key: \"c7niix\"\n }\n ]\n];\nconst Droplet = createLucideIcon(\"droplet\", __iconNode);\n\nexport { __iconNode, Droplet as default };\n//# sourceMappingURL=droplet.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — CycleCalculator. */\n/* */\n/* Menstrual-cycle predictor: takes a last-period date (+ optional cycle */\n/* and period lengths) and computes ovulation, fertile window and the */\n/* next few periods. The agent surface is the three inputs plus the */\n/* computed prediction; the handle is the curated `CycleCalculatorHandle` */\n/* (the public `ref` stays the root <div>, exactly as `slider.tsx` and */\n/* `bmi-calculator.tsx` 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/* PHI (§7): never exposes patient identity — the slots return the */\n/* operator's own structural inputs (a date, two day counts) and the */\n/* dates derived from them, the same \"filter model\" precedent §7 sets. */\n/* See `src/docs/26-agent-readiness.mdx`. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { CycleCalculatorHandle } from './cycle-calculator';\n\n/** Shared JSON Schema fragment for a local-time calendar date. */\nconst isoDate = {\n type: 'string',\n pattern: '^\\\\d{4}-\\\\d{2}-\\\\d{2}$',\n} as const;\n\nexport const cycleCalculatorAgent: AgentAdapter<CycleCalculatorHandle> = {\n id: 'cycle-calculator',\n // set_value → the three `set_*` actions + the `inputs` state slot.\n capabilities: ['set_value'],\n state: {\n inputs: {\n type: '{ lastPeriodStart: string | null, cycleLength: number | null, periodLength: number | null }',\n descriptionKey: 'ui.agent.cycleCalculator.state.inputs',\n description:\n 'The three cycle inputs as entered — last-period start date (`yyyy-MM-dd`), average cycle length in days, and period (bleed) length in days. Null where unset.',\n read: (handle) => handle.getInputs(),\n },\n result: {\n type: '{ ovulation: string, fertileWindow: { start: string, end: string }, nextPeriod: string, periodRange: { start: string, end: string } | null, upcomingPeriods: string[] } | null',\n descriptionKey: 'ui.agent.cycleCalculator.state.result',\n description:\n 'Computed prediction — ovulation date, fertile window, next period, current bleed range and the next few period starts, all `yyyy-MM-dd`. Null until a last-period date is set.',\n read: (handle) => handle.getResult(),\n },\n },\n actions: {\n set_last_period: {\n // Drives the same local input state a user types into; nothing is\n // persisted to a record, and the value is reversible in the same UI.\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 'Start date of the last period, or null to clear it. Must not be in the future.',\n },\n },\n required: ['date'],\n additionalProperties: false,\n },\n idempotent: true,\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 { args: { date: '2026-08-01' }, note: 'Last period started 1 August.' },\n ],\n descriptionKey: 'ui.agent.cycleCalculator.actions.setLastPeriod',\n description:\n 'Set the start date of the last period. This is the only required input — the prediction stays null without it.',\n invoke: (handle, args: { date: string | null }) =>\n handle.setLastPeriod(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 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 ],\n descriptionKey: 'ui.agent.cycleCalculator.actions.setCycleLength',\n description:\n 'Set the average cycle length in days. Shifts ovulation, the fertile window and every upcoming period.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setCycleLength(args.days),\n },\n set_period_length: {\n safety: 'write',\n argsType: '{ days: number | null }',\n argsSchema: {\n type: 'object',\n properties: {\n days: {\n oneOf: [\n { type: 'integer', minimum: 1, maximum: 14 },\n { type: 'null' },\n ],\n description:\n 'Period (bleed) length in days (1–14), or null to omit the bleed range.',\n },\n },\n required: ['days'],\n additionalProperties: false,\n },\n idempotent: true,\n returns: 'boolean',\n returnsSchema: {\n type: 'boolean',\n description: 'True when the value was applied.',\n },\n errors: [\n 'Returns false outside 1–14 days — the same bounds the on-screen NumberInput enforces.',\n ],\n descriptionKey: 'ui.agent.cycleCalculator.actions.setPeriodLength',\n description:\n 'Set the period (bleed) length in days. Optional — it only adds the current bleed range to the result.',\n invoke: (handle, args: { days: number | null }) =>\n handle.setPeriodLength(args.days),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'cycle-calculator',\n description: 'Marks the CycleCalculator 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 only the DOM channel works.',\n },\n },\n};\n","/* ------------------------------------------------------------------ */\n/* Menstrual-cycle prediction — pure, framework-free, unit-testable. */\n/* */\n/* Uses the standard fixed-luteal-phase model: ovulation falls ~14 days */\n/* before the next period, so on a cycle of length L ovulation is day */\n/* (L − 14). The fertile window spans the 5 days before ovulation */\n/* (sperm survival) through 1 day after (oocyte viability). */\n/* ------------------------------------------------------------------ */\n\nimport { addDays } from 'date-fns';\n\n/** Standard menstrual-cycle length. */\nexport const DEFAULT_CYCLE_LENGTH = 28;\n/** Luteal phase is biologically near-constant at ~14 days. */\nexport const LUTEAL_PHASE_DAYS = 14;\n/** Sperm survive up to ~5 days before ovulation. */\nexport const FERTILE_DAYS_BEFORE = 5;\n/** The oocyte is viable ~1 day after ovulation. */\nexport const FERTILE_DAYS_AFTER = 1;\n\nexport interface CycleInput {\n /** First day of the most recent period. */\n lastPeriodStart: Date;\n /** Average cycle length in days. Defaults to 28. */\n cycleLength?: number;\n /** Period (bleed) length in days. Optional — used for the period range. */\n periodLength?: number;\n}\n\nexport interface DateRange {\n start: Date;\n end: Date;\n}\n\nexport interface CyclePrediction {\n /** Start date of the next period. */\n nextPeriod: Date;\n /** Estimated ovulation date. */\n ovulation: Date;\n /** Fertile window (5 days before ovulation → 1 day after). */\n fertileWindow: DateRange;\n /** Start dates of the next few periods (length = `occurrences`). */\n upcomingPeriods: Date[];\n /**\n * The current period's bleed range (first day → last day), or `null` when no\n * `periodLength` was given.\n */\n periodRange: DateRange | null;\n}\n\n/**\n * Predict ovulation, the fertile window and upcoming periods from the last\n * period's start date. `occurrences` controls how many future periods to\n * list (default 3).\n */\nexport function predictCycle(\n input: CycleInput,\n occurrences = 3,\n): CyclePrediction {\n const cycle = input.cycleLength ?? DEFAULT_CYCLE_LENGTH;\n const { lastPeriodStart } = input;\n\n const ovulation = addDays(lastPeriodStart, cycle - LUTEAL_PHASE_DAYS);\n const fertileWindow: DateRange = {\n start: addDays(ovulation, -FERTILE_DAYS_BEFORE),\n end: addDays(ovulation, FERTILE_DAYS_AFTER),\n };\n const nextPeriod = addDays(lastPeriodStart, cycle);\n const upcomingPeriods = Array.from({ length: occurrences }, (_, i) =>\n addDays(lastPeriodStart, cycle * (i + 1)),\n );\n const periodRange: DateRange | null =\n input.periodLength && input.periodLength > 0\n ? {\n start: lastPeriodStart,\n end: addDays(lastPeriodStart, input.periodLength - 1),\n }\n : null;\n\n return { nextPeriod, ovulation, fertileWindow, upcomingPeriods, periodRange };\n}\n","/* ------------------------------------------------------------------ */\n/* CycleCalculator — predict ovulation, fertile window and upcoming */\n/* periods from the last period's start date. */\n/* */\n/* Maths lives in `./cycle` (pure, separately tested). */\n/* ------------------------------------------------------------------ */\n\nimport { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { format, isAfter, parseISO } from 'date-fns';\nimport { Heart, Check, Droplet } from 'lucide-react';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { cycleCalculatorAgent } from './cycle-calculator.agent';\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 CyclePrediction,\n predictCycle,\n DEFAULT_CYCLE_LENGTH,\n} from './cycle';\n\nconst rootVariants = cva('ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]', {\n variants: {\n width: { full: 'ds:w-full', auto: 'ds:inline-flex' },\n },\n defaultVariants: { width: 'full' },\n});\n\n/**\n * DS token NAME backing the result-card chip — the fertile window is the\n * headline fertility datum, shown on screen with the `accent` Badge variant\n * (which fills `--accent`). The card chip reuses that token so the inserted\n * PNG chip matches the on-screen fertile-window badge.\n */\nconst HIGHLIGHT_TOKEN = '--accent';\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;\nconst PERIOD_LENGTH_RANGE = { min: 1, max: 14 } as const;\n\nconst inRange = (\n n: number | null,\n { min, max }: { min: number; max: number },\n): boolean => n === null || (Number.isFinite(n) && n >= min && n <= max);\n\n/** `CyclePrediction` projected onto the agent boundary — ISO dates, no Dates. */\nexport interface CyclePredictionSnapshot {\n /** Estimated ovulation date, `yyyy-MM-dd`. */\n ovulation: string;\n /** Fertile window, `yyyy-MM-dd` endpoints. */\n fertileWindow: { start: string; end: string };\n /** Start of the next period, `yyyy-MM-dd`. */\n nextPeriod: string;\n /** Current period's bleed range, or null when no period length was given. */\n periodRange: { start: string; end: string } | null;\n /** Start dates of the next few periods, `yyyy-MM-dd`. */\n upcomingPeriods: string[];\n}\n\n/**\n * Curated imperative handle for agent / external automation. Reads the three\n * cycle inputs and the computed prediction, and drives the inputs the way a\n * user would. Never exposes patient identity — only structural dates and day\n * counts. Consumed by `cycle-calculator.agent.ts`; the public `ref` stays the\n * root DOM element.\n */\nexport interface CycleCalculatorHandle {\n /** Current inputs — ISO date + day counts, or null when unset. */\n getInputs: () => {\n lastPeriodStart: string | null;\n cycleLength: number | null;\n periodLength: number | null;\n };\n /** Computed prediction, or null until a last-period date is set. */\n getResult: () => CyclePredictionSnapshot | null;\n /** Set the last period's start date (`yyyy-MM-dd`, not in the future). */\n setLastPeriod: (isoDate: string | null) => boolean;\n /** Set the average cycle length in days (20–45). */\n setCycleLength: (days: number | null) => boolean;\n /** Set the period (bleed) length in days (1–14). */\n setPeriodLength: (days: number | null) => boolean;\n}\n\nexport interface CycleCalculatorProps extends VariantProps<\n typeof rootVariants\n> {\n /** Initial cycle length in days. Defaults to 28. */\n defaultCycleLength?: number;\n /** Fires whenever a prediction can be computed (and `null` when it can't). */\n onResultChange?: (result: CyclePrediction | null) => void;\n /** When provided, shows the result-action buttons that emit / copy the result. */\n onInsert?: (payload: InsertPayload) => void;\n /**\n * Which verb the result button performs. Defaults to `'insert'`.\n * Use `'copy'` in an app-shell surface (no editor to insert into) — the\n * button writes the result to the clipboard as a multi-format `ClipboardItem`.\n */\n insertVariant?: InsertVariant;\n /** `copy` variant only — fired after a successful clipboard write. */\n onCopy?: (mode: InsertMode) => void;\n /** `copy` variant only — fired if the clipboard write can't proceed. */\n onError?: (error: unknown) => void;\n /**\n * Brand wordmark printed in the inserted/copied result-card footer.\n * Omitted → no brand line (and no footer hairline); a string → that custom\n * brand; `false` → no brand line. Brand is opt-in.\n */\n insertBrand?: string | false;\n /** Opaque instance id, emitted as `data-component-id`. */\n id?: string;\n /** Extra class names on the wrapper. */\n className?: string;\n}\n\nexport const CycleCalculator = forwardRef<HTMLDivElement, CycleCalculatorProps>(\n (\n {\n defaultCycleLength = DEFAULT_CYCLE_LENGTH,\n onResultChange,\n onInsert,\n insertVariant = 'insert',\n onCopy,\n onError,\n insertBrand,\n id,\n width,\n className,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n\n const [lastPeriod, setLastPeriod] = useState<Date | undefined>(undefined);\n const [cycleLength, setCycleLength] = useState<number | null>(\n defaultCycleLength,\n );\n const [periodLength, setPeriodLength] = useState<number | null>(null);\n\n const result = useMemo<CyclePrediction | null>(() => {\n if (!lastPeriod) return null;\n return predictCycle({\n lastPeriodStart: lastPeriod,\n cycleLength: cycleLength ?? DEFAULT_CYCLE_LENGTH,\n periodLength: periodLength ?? undefined,\n });\n }, [lastPeriod, cycleLength, periodLength]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }),\n [i18n.language],\n );\n\n useEffect(() => {\n onResultChange?.(result);\n }, [result, onResultChange]);\n\n const today = useMemo(() => new Date(), []);\n\n /* ── Agent handle ────────────────────────────────────────────────── */\n const liveRef = useRef({ lastPeriod, cycleLength, periodLength, result });\n liveRef.current = { lastPeriod, cycleLength, periodLength, result };\n\n const agentHandle = useMemo<CycleCalculatorHandle>(\n () => ({\n getInputs: () => ({\n lastPeriodStart: liveRef.current.lastPeriod\n ? toIsoDate(liveRef.current.lastPeriod)\n : null,\n cycleLength: liveRef.current.cycleLength,\n periodLength: liveRef.current.periodLength,\n }),\n getResult: () => {\n const r = liveRef.current.result;\n if (!r) return null;\n return {\n ovulation: toIsoDate(r.ovulation),\n fertileWindow: {\n start: toIsoDate(r.fertileWindow.start),\n end: toIsoDate(r.fertileWindow.end),\n },\n nextPeriod: toIsoDate(r.nextPeriod),\n periodRange: r.periodRange\n ? {\n start: toIsoDate(r.periodRange.start),\n end: toIsoDate(r.periodRange.end),\n }\n : null,\n upcomingPeriods: r.upcomingPeriods.map(toIsoDate),\n };\n },\n setLastPeriod: (isoDate) => {\n if (isoDate === null) {\n setLastPeriod(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 setLastPeriod(parsed);\n return true;\n },\n setCycleLength: (days) => {\n if (!inRange(days, CYCLE_LENGTH_RANGE)) return false;\n setCycleLength(days);\n return true;\n },\n setPeriodLength: (days) => {\n if (!inRange(days, PERIOD_LENGTH_RANGE)) return false;\n setPeriodLength(days);\n return true;\n },\n }),\n [],\n );\n useAgentRegistration(cycleCalculatorAgent, agentHandle, id);\n\n const fmt = (d: Date): string => dateFormatter.format(d);\n\n return (\n <div\n ref={ref}\n data-component=\"cycle-calculator\"\n data-component-id={id}\n className={rootVariants({ width, className })}\n >\n <div className=\"ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2\">\n <FormField label={t('cycleCalculator.lastPeriod')}>\n <DatePicker\n value={lastPeriod}\n onChange={setLastPeriod}\n maxDate={today}\n />\n </FormField>\n <FormField\n label={t('cycleCalculator.cycleLength')}\n description={t('cycleCalculator.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 <FormField\n label={t('cycleCalculator.periodLength')}\n description={t('cycleCalculator.periodLengthHint')}\n >\n <NumberInput\n mode=\"integer\"\n min={PERIOD_LENGTH_RANGE.min}\n max={PERIOD_LENGTH_RANGE.max}\n value={periodLength}\n onChange={setPeriodLength}\n />\n </FormField>\n </div>\n\n <p className=\"ds:sr-only\" role=\"status\" aria-live=\"polite\">\n {result\n ? `${t('cycleCalculator.ovulation')}: ${fmt(result.ovulation)}. ${t(\n 'cycleCalculator.nextPeriod',\n )}: ${fmt(result.nextPeriod)}.`\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-center ds:gap-[var(--spacing-xs)] ds:text-center\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.ovulation')}\n </dt>\n <dd>\n <Badge\n variant=\"success\"\n size=\"lg\"\n leading={<Check aria-hidden />}\n >\n {fmt(result.ovulation)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.fertileWindow')}\n </dt>\n <dd>\n <Badge\n variant=\"accent\"\n size=\"lg\"\n leading={<Heart aria-hidden />}\n >\n {fmt(result.fertileWindow.start)} –{' '}\n {fmt(result.fertileWindow.end)}\n </Badge>\n </dd>\n </div>\n <div className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center\">\n <dt className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.nextPeriod')}\n </dt>\n <dd>\n <Badge\n variant=\"error\"\n size=\"lg\"\n leading={<Droplet aria-hidden />}\n >\n {fmt(result.nextPeriod)}\n </Badge>\n </dd>\n </div>\n </dl>\n\n {result.periodRange ? (\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.periodRange')}\n </span>\n <span className=\"type-body ds:text-foreground\">\n {fmt(result.periodRange.start)} –{' '}\n {fmt(result.periodRange.end)}\n </span>\n </div>\n ) : null}\n\n <div className=\"ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]\">\n <span className=\"type-label ds:text-muted-foreground\">\n {t('cycleCalculator.upcomingPeriods')}\n </span>\n <ul className=\"ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-2xs)]\">\n {result.upcomingPeriods.map((d) => (\n <li\n key={d.getTime()}\n className=\"type-body ds:text-foreground\"\n >\n {fmt(d)}\n </li>\n ))}\n </ul>\n </div>\n\n {insertVariant === 'copy' || onInsert ? (\n <InsertButton\n onInsert={onInsert}\n variant={insertVariant}\n onCopy={onCopy}\n onError={onError}\n card={{\n title: t('insert.title.cycle'),\n icon: 'heart',\n highlight: `${fmt(result.fertileWindow.start)} – ${fmt(\n result.fertileWindow.end,\n )}`,\n // Chip reuses the on-screen fertile-window badge's accent\n // token so the inserted PNG chip matches the screen.\n highlightToken: HIGHLIGHT_TOKEN,\n brand: insertBrand,\n fields: [\n {\n // Ovulation is a predicted date → calendar glyph (the\n // on-screen badge uses a Check tick, which ICON_GEOMETRY\n // does not carry, so the calendar reads the date meaning).\n icon: 'calendar',\n label: t('cycleCalculator.ovulation'),\n value: fmt(result.ovulation),\n },\n {\n // Fertile window → heart glyph, matching the on-screen\n // fertile-window badge's Heart icon.\n icon: 'heart',\n label: t('cycleCalculator.fertileWindow'),\n value: `${fmt(result.fertileWindow.start)} – ${fmt(\n result.fertileWindow.end,\n )}`,\n },\n {\n // Next period → droplets glyph, matching the on-screen\n // next-period badge's Droplet icon.\n icon: 'droplets',\n label: t('cycleCalculator.nextPeriod'),\n value: fmt(result.nextPeriod),\n },\n ],\n }}\n />\n ) : null}\n </Card.Body>\n </Card>\n ) : (\n <p className=\"type-body ds:text-muted-foreground\">\n {t('cycleCalculator.empty')}\n </p>\n )}\n </div>\n );\n },\n);\n\nCycleCalculator.displayName = 'CycleCalculator';\n"],"names":["__iconNode","Droplet","createLucideIcon","isoDate","cycleCalculatorAgent","handle","args","DEFAULT_CYCLE_LENGTH","LUTEAL_PHASE_DAYS","FERTILE_DAYS_AFTER","predictCycle","input","occurrences","cycle","lastPeriodStart","ovulation","addDays","fertileWindow","nextPeriod","upcomingPeriods","_","i","periodRange","rootVariants","cva","HIGHLIGHT_TOKEN","toIsoDate","d","format","fromIsoDate","iso","parseISO","CYCLE_LENGTH_RANGE","PERIOD_LENGTH_RANGE","inRange","n","min","max","CycleCalculator","forwardRef","defaultCycleLength","onResultChange","onInsert","insertVariant","onCopy","onError","insertBrand","id","width","className","ref","t","i18n","useTranslation","lastPeriod","setLastPeriod","useState","cycleLength","setCycleLength","periodLength","setPeriodLength","result","useMemo","dateFormatter","useEffect","today","liveRef","useRef","agentHandle","parsed","isAfter","days","useAgentRegistration","fmt","jsxs","jsx","FormField","DatePicker","NumberInput","Card","Badge","Check","Heart","InsertButton"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AA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"./index-D2ZczOXr.js";
|
|
5
5
|
import { useTranslation as pe } from "react-i18next";
|
|
6
6
|
import { A as ue } from "./avatar-BNQNhoyL.js";
|
|
7
|
-
import { B as fe } from "./badge-
|
|
7
|
+
import { B as fe } from "./badge-sTusUqZD.js";
|
|
8
8
|
import { T as ge } from "./tooltip-DvmfrNvB.js";
|
|
9
9
|
import { c as ve } from "./compose-refs-C0k0tdqF.js";
|
|
10
10
|
import { u as be } from "./registry-DvAUVLHh.js";
|
|
@@ -335,4 +335,4 @@ export {
|
|
|
335
335
|
ke as D,
|
|
336
336
|
xe as d
|
|
337
337
|
};
|
|
338
|
-
//# sourceMappingURL=dependent-selector-
|
|
338
|
+
//# sourceMappingURL=dependent-selector-cJlJFAKD.js.map
|
package/dist/_chunks/{dependent-selector-BUvrZRi0.js.map → dependent-selector-cJlJFAKD.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependent-selector-BUvrZRi0.js","sources":["../../src/components/dependent-selector/dependent-selector.agent.ts","../../src/components/dependent-selector/dependent-selector.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DependentSelector. */\n/* */\n/* Mirrors radio-group.agent.ts: a single-select domain control. The */\n/* selected person id is the externally-observable state; `select_single` */\n/* is the capability. Per-row `data-option-id` lets an agent address each */\n/* person by their stable opaque id. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DependentSelectorHandle } from './dependent-selector';\n\nexport const dependentSelectorAgent: AgentAdapter<DependentSelectorHandle> = {\n id: 'dependent-selector',\n capabilities: ['select_single'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.dependentSelector.state.value',\n description:\n 'Id of the currently selected person, or empty string when none.',\n read: (handle) => handle.getValue(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: 'string',\n description: 'Stable opaque id of the person row to select.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dependentSelector.actions.setValue',\n description: 'Select the person row with the given id.',\n examples: [\n { args: { value: 'person-2' }, note: 'Select the second dependent.' },\n ],\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'dependent-selector',\n description: 'Marks the DependentSelector root (role=radiogroup).',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-option-id',\n description: 'Stable person id emitted on each rendered person row.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport * as RadixRadioGroup from '@radix-ui/react-radio-group';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { CircleAlert } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport { Avatar } from '../avatar';\nimport { Badge } from '../badge';\nimport { Tooltip } from '../tooltip';\nimport { useDirection } from '../_shared/use-direction';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useAgentRegistration } from '../../agent';\nimport { dependentSelectorAgent } from './dependent-selector.agent';\n\n/* -------------------------------------------------------------------- */\n/* DependentSelector */\n/* */\n/* Single-select roster of people — the verified guardian (\"You\") plus */\n/* their registered dependents/minors — that a check-in kiosk uses to */\n/* answer \"Who are you checking in?\". Built on Radix RadioGroup semantics */\n/* (role=radiogroup, single tab stop, roving arrow-key focus, one */\n/* selected value), mirroring the proven src/components/radio-group/ */\n/* pattern. Each option is a person row (Avatar + name + relationship + */\n/* optional age/Minor badge) wrapped in a <label> so the whole card is */\n/* the click target. */\n/* */\n/* The kit owns the localised relationship + age strings via the closed */\n/* `relationshipKey` enum — consumers pass data, never free-text labels, */\n/* or i18n/RTL breaks. `age` is display-only (pre-computed whole years); */\n/* `isMinor` is an explicit per-person flag, NOT age<18 inference. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/**\n * Closed relationship vocabulary. The kit owns the localised label for\n * each key (`dependentSelector.relationship.<key>`). `'other'` is the\n * escape hatch for relationships the enum doesn't model.\n */\nexport type DependentRelationship =\n | 'self'\n | 'son'\n | 'daughter'\n | 'child'\n | 'spouse'\n | 'parent'\n | 'sibling'\n | 'ward'\n | 'other';\n\nexport interface DependentSelectorPerson {\n /** Stable id — becomes the radio value + `data-option-id`. */\n id: string;\n /** Display-formatted name (already formatted by the consumer). */\n name: string;\n /** Closed relationship key — the kit owns the localised label. */\n relationshipKey: DependentRelationship;\n /**\n * Explicit \"minor\" flag — drives the localised \"Minor\" badge.\n * Consumer-supplied, NOT derived from `age < 18` (legal age of\n * majority varies by market).\n */\n isMinor?: boolean;\n /** Avatar image source — falls back to initials, then icon. */\n avatarSrc?: string;\n /** Whole years, pre-computed by the consumer. Display-only. */\n age?: number;\n /**\n * ISO 8601 date of birth. Used ONLY for the row title/tooltip — never\n * parsed for display math (timezone/locale birthday math is the\n * consumer's job).\n */\n dob?: string;\n /** Disables this row; skipped by arrow navigation. */\n disabled?: boolean;\n /** Shown in a Tooltip on the disabled row (like Radio.disabledReason). */\n disabledReason?: string;\n}\n\n/** Agent-readiness curated handle for DependentSelector. */\nexport interface DependentSelectorHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* CVA */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0',\n {\n variants: {\n size: { sm: '', md: '', lg: '' },\n tone: { default: '', checkin: '' },\n },\n defaultVariants: { size: 'md', tone: 'checkin' },\n },\n);\n\nconst rowVariants = cva(\n [\n // The row IS the Radix Item (`<button role=\"radio\">`). Reset the\n // button chrome, lay out avatar + text on the inline axis. Logical\n // properties only.\n 'ds:group ds:flex ds:items-center ds:gap-[var(--spacing-md)] ds:w-full ds:text-start ds:appearance-none',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-card',\n // Touch-target floor: even sm clears AA/AAA (44 → 48px in accessible).\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n // Selected state: low-alpha accent tint BEHIND tokenised text +\n // a ring-coloured border (never accent as a foreground meeting text).\n 'ds:data-[state=checked]:border-ring',\n // Roving focus ring on the item itself — single tab stop, arrow keys\n // move focus+selection.\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 // Forced-colours: repaint a ButtonBorder edge + a Highlight checked\n // edge + a CanvasText focus ring so the row + its checked state\n // survive Windows High Contrast Mode.\n 'ds:forced-colors:border-[ButtonBorder]',\n 'ds:forced-colors:data-[state=checked]:border-[Highlight]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-md)] ds:py-[var(--spacing-xs)]',\n md: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:py-[var(--spacing-sm)]',\n lg: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-lg)] ds:py-[var(--spacing-md)]',\n },\n tone: {\n // Neutral RadioGroup-card tint for plain forms.\n default:\n 'ds:data-[state=checked]:bg-[color-mix(in_srgb,var(--accent)_5%,transparent)]',\n // Accent-tinted selected surface tuned for the check-in kiosk —\n // slightly stronger low-alpha mix BEHIND the tokenised foreground.\n checkin:\n 'ds:data-[state=checked]:bg-[color-mix(in_srgb,var(--accent)_8%,transparent)]',\n },\n disabled: {\n true: 'ds:cursor-not-allowed ds:opacity-50',\n false:\n 'ds:cursor-pointer ds:hover:bg-[color-mix(in_srgb,var(--accent)_4%,transparent)]',\n },\n },\n defaultVariants: { size: 'md', tone: 'checkin', disabled: false },\n },\n);\n\nconst avatarSizeBySize = { sm: 'sm', md: 'md', lg: 'lg' } as const;\n\n// Keep the loading skeleton's avatar footprint in lock-step with the real\n// Avatar scale (sm=size-8 / md=size-10 / lg=size-12) so the roster\n// resolving in doesn't shift the row height.\nconst skeletonAvatarSizeBySize = {\n sm: 'ds:size-8',\n md: 'ds:size-10',\n lg: 'ds:size-12',\n} as const;\n\nconst nameTypeBySize = {\n sm: 'type-body-sm',\n md: 'type-label',\n lg: 'type-body',\n} as const;\n\n/* -------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------- */\n\ntype RadixRootProps = ComponentPropsWithoutRef<typeof RadixRadioGroup.Root>;\n\nexport interface DependentSelectorProps\n extends\n Omit<\n RadixRootProps,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onValueChange'\n >,\n VariantProps<typeof rootVariants> {\n /** Ordered roster to render as options. */\n people: DependentSelectorPerson[];\n /** Controlled selected person id. */\n value?: string;\n /** Uncontrolled initial selection. Ignored when `value` is set. */\n defaultValue?: string;\n /** Fires with the newly selected person id on user selection. */\n onValueChange?: (personId: string) => void;\n /** Accessible group name, rendered as the `<legend>`. */\n label?: string;\n /** Optional helper paragraph under the legend (wired via aria-describedby). */\n description?: string;\n /** Shows N skeleton rows while the roster resolves; sets aria-busy. */\n loading?: boolean;\n /** Validation/empty-confirmation message — role=alert + aria-invalid. */\n error?: string;\n /** Slot shown when no selectable dependents exist (only self / empty). */\n emptyState?: ReactNode;\n /** Forwarded to the radiogroup root as id + data-component-id. */\n id?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const DependentSelector = forwardRef<\n HTMLDivElement,\n DependentSelectorProps\n>(\n (\n {\n people,\n value,\n defaultValue,\n onValueChange,\n label,\n description,\n size: sizeProp = 'md',\n tone: toneProp = 'checkin',\n loading = false,\n error,\n emptyState,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n ) => {\n // CVA's VariantProps types each axis as `T | null | undefined`; the\n // destructure default only covers `undefined`, so coalesce `null`\n // too before the values index the size→class lookup maps.\n const size = sizeProp ?? 'md';\n const tone = toneProp ?? 'checkin';\n const { t } = useTranslation();\n const baseId = useId();\n const legendId = `${baseId}-legend`;\n const descriptionId = `${baseId}-description`;\n const errorId = `${baseId}-error`;\n\n /* ---- Dev-mode accessible-name enforcement ---- */\n const warnedRef = useRef(false);\n useEffect(() => {\n if (\n import.meta.env.DEV &&\n !warnedRef.current &&\n !label &&\n !ariaLabel &&\n !ariaLabelledBy\n ) {\n warnedRef.current = true;\n console.warn(\n '<DependentSelector> rendered without an accessible name. Pass `label`, or `aria-label` / `aria-labelledby`, so the radiogroup is never unnamed.',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n /* ---- Selectable roster + single-selectable auto-select ---- */\n const selectablePeople = useMemo(\n () => people.filter((person) => !person.disabled),\n [people],\n );\n // The dependents region (everything that isn't the verified self row)\n // drives the empty-state slot.\n const hasDependents = people.some(\n (person) => person.relationshipKey !== 'self',\n );\n const autoSelectId =\n selectablePeople.length === 1 ? selectablePeople[0].id : undefined;\n\n /* ---- Controlled / uncontrolled value handling (mirrors RadioGroup) ---- */\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n defaultValue ?? autoSelectId ?? '',\n );\n const currentValue = isControlled ? (value ?? '') : internalValue;\n const currentValueRef = useRef<string>(currentValue);\n currentValueRef.current = currentValue;\n\n const handleValueChange = (next: string) => {\n if (loading) return;\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n };\n\n /* ---- Auto-select change notification ---- */\n /* When exactly one selectable person exists we seed the uncontrolled */\n /* selection (Radix `defaultValue` + internal state) so the row */\n /* paints checked — but Radix never fires onValueChange for a */\n /* defaultValue. In the kiosk consent flow the consumer wires the */\n /* consent audit trail off onValueChange, so we fire it once on mount */\n /* for that auto-selection. Only when uncontrolled, not loading, and */\n /* the consumer didn't pass an explicit defaultValue. */\n const onValueChangeRef = useRef(onValueChange);\n onValueChangeRef.current = onValueChange;\n const autoSelectNotifiedRef = useRef(false);\n useEffect(() => {\n if (\n !autoSelectNotifiedRef.current &&\n !isControlled &&\n !loading &&\n defaultValue === undefined &&\n autoSelectId !== undefined\n ) {\n autoSelectNotifiedRef.current = true;\n onValueChangeRef.current?.(autoSelectId);\n }\n }, [isControlled, loading, defaultValue, autoSelectId]);\n\n /* ---- Agent registration ---- */\n const agentHandle = useMemo<DependentSelectorHandle>(\n () => ({\n getValue: () => currentValueRef.current,\n setValue: (next) => handleValueChange(next),\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isControlled, loading, onValueChange],\n );\n useAgentRegistration(dependentSelectorAgent, agentHandle, id);\n\n /* ---- Direction (Radix auto-flips Left/Right for rtl) ---- */\n const rootRef = useRef<HTMLDivElement>(null);\n const composedRef = composeRefs(ref, rootRef);\n const dir = useDirection(rootRef);\n\n /* ---- Resolved a11y wiring ---- */\n /* ONE grouping mechanism: when `label` is set we render a plain */\n /* heading <div id={legendId}> (NOT a native <fieldset>/<legend>) and */\n /* name the single role=radiogroup via aria-labelledby. A fieldset */\n /* would add a second, redundant named group nested around the */\n /* radiogroup — so we deliberately avoid it. */\n const resolvedAriaLabelledBy =\n ariaLabelledBy ?? (label ? legendId : undefined);\n const describedBy =\n [description ? descriptionId : null, error ? errorId : null]\n .filter(Boolean)\n .join(' ') || undefined;\n\n /* ---- Helpers ---- */\n const relationshipLabel = (key: DependentRelationship): string =>\n t(`dependentSelector.relationship.${key}`);\n\n const ageLabel = (age: number): string =>\n t('dependentSelector.age', { count: age });\n\n /** Compose the full accessible name a screen reader announces. */\n const personAccessibleName = (person: DependentSelectorPerson): string => {\n const base = t('dependentSelector.optionLabel', {\n name: person.name,\n relationship: relationshipLabel(person.relationshipKey),\n });\n const parts = [base];\n if (typeof person.age === 'number') parts.push(ageLabel(person.age));\n if (person.isMinor) parts.push(t('dependentSelector.minorBadge'));\n return parts.join(', ');\n };\n\n /* ---- Description + error nodes ---- */\n const descriptionNode = description ? (\n <p id={descriptionId} className=\"type-body-sm ds:text-muted-foreground\">\n {description}\n </p>\n ) : null;\n\n const errorNode = error ? (\n <p\n id={errorId}\n role=\"alert\"\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-destructive\"\n >\n <CircleAlert aria-hidden=\"true\" className=\"ds:size-4 ds:shrink-0\" />\n <span>{error}</span>\n </p>\n ) : null;\n\n /* ---- Skeleton rows (loading) ---- */\n const skeletonRows = (\n <div\n aria-hidden=\"true\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\"\n >\n {Array.from({ length: 3 }).map((_, index) => (\n <div\n key={index}\n className={rowVariants({ size, tone, disabled: false })}\n >\n <span\n className={`ds:inline-flex ds:shrink-0 ds:rounded-[var(--radius-full)] ds:bg-muted ds:animate-pulse ${skeletonAvatarSizeBySize[size]}`}\n />\n <span className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:min-w-0 ds:flex-1\">\n <span className=\"ds:h-4 ds:w-1/2 ds:rounded-[var(--radius-sm)] ds:bg-muted ds:animate-pulse\" />\n <span className=\"ds:h-3 ds:w-1/3 ds:rounded-[var(--radius-sm)] ds:bg-muted ds:animate-pulse\" />\n </span>\n </div>\n ))}\n </div>\n );\n\n /* ---- Person row ---- */\n /* The Radix Item IS the card: it renders the `<button role=\"radio\">` */\n /* that owns the roving tabindex + arrow navigation, so the whole row */\n /* is the focus + click target. The composed name lives on */\n /* `aria-label`; the visible content is aria-hidden so a screen reader */\n /* hears the clean composed name once (no duplication). */\n const renderPerson = (person: DependentSelectorPerson) => {\n const rowId = `${baseId}-row-${person.id}`;\n const accessibleName = personAccessibleName(person);\n\n const row = (\n <RadixRadioGroup.Item\n key={person.id}\n id={rowId}\n value={person.id}\n // Native `disabled` is the single disabled model: Radix renders\n // a <button disabled> that is skipped by roving arrow nav and is\n // non-selectable. `aria-disabled` is intentionally NOT also set —\n // on a natively-disabled button it is redundant (it is meant for\n // elements that REMAIN focusable). The disabledReason tooltip is\n // reached via a focusable wrapper span below, not this button.\n disabled={person.disabled}\n aria-label={accessibleName}\n title={person.dob ?? undefined}\n data-option-id={person.id}\n className={rowVariants({\n size,\n tone,\n disabled: Boolean(person.disabled),\n })}\n >\n {/* The Avatar is intentionally aria-hidden: its name only feeds\n initials/colour, and the radio's own aria-label is the sole\n accessible name. Keep aria-hidden so a future refactor doesn't\n reintroduce a duplicate \"image, <name>\" announcement (the kit\n Avatar always renders role=\"img\" + aria-label={name}). */}\n <Avatar\n src={person.avatarSrc}\n name={person.name}\n size={avatarSizeBySize[size]}\n aria-hidden=\"true\"\n />\n <span\n aria-hidden=\"true\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:min-w-0 ds:flex-1\"\n >\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:min-w-0\">\n <span\n className={`${nameTypeBySize[size]} ds:text-foreground ds:truncate ds:min-w-0`}\n >\n {person.name}\n </span>\n {person.isMinor ? (\n // Neutral chip (validated AA ~6:1) — the \"Minor\" flag is\n // informational, not a warning STATE. The tonal `warning`\n // variant fails AA at the small chip font size.\n <Badge variant=\"neutral\" size=\"sm\">\n {t('dependentSelector.minorBadge')}\n </Badge>\n ) : null}\n </span>\n <span className=\"type-body-sm ds:text-muted-foreground ds:truncate ds:min-w-0\">\n {relationshipLabel(person.relationshipKey)}\n {typeof person.age === 'number'\n ? ` · ${ageLabel(person.age)}`\n : null}\n </span>\n </span>\n </RadixRadioGroup.Item>\n );\n\n if (person.disabled && person.disabledReason) {\n // The Radix Item renders a <button disabled>, which is removed\n // from the tab order and does not fire hover/pointer events — so a\n // Tooltip wrapped directly around it would never open. Wrap the row\n // in a focusable, hoverable <span tabIndex={0}> and make THAT the\n // tooltip trigger, so the disabledReason is reachable by both mouse\n // hover and keyboard focus (mirrors radio.tsx putting the Tooltip\n // on the non-disabled wrapper, not the disabled control).\n return (\n <Tooltip key={person.id} label={person.disabledReason}>\n <span\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- intentional focusable tooltip trigger so keyboard users can reach the disabled reason\n tabIndex={0}\n data-disabled-row={person.id}\n aria-label={accessibleName}\n className=\"ds:flex ds:min-w-0 ds:rounded-[var(--radius-md)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]\"\n >\n {row}\n </span>\n </Tooltip>\n );\n }\n return row;\n };\n\n /* ---- Empty-state slot ---- */\n const resolvedEmptyState = emptyState ?? (\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t('dependentSelector.empty')}\n </p>\n );\n\n /* ---- Radiogroup body ---- */\n /* While loading we still render a role=radiogroup container (carrying */\n /* the data-component marker + aria-busy) holding aria-hidden skeleton */\n /* rows — selection is inert. Otherwise the Radix root renders the */\n /* real person rows. */\n const body = loading ? (\n <div\n ref={composedRef}\n id={id}\n role=\"radiogroup\"\n aria-label={!resolvedAriaLabelledBy ? ariaLabel : undefined}\n aria-labelledby={resolvedAriaLabelledBy}\n aria-describedby={describedBy}\n aria-invalid={Boolean(error) || undefined}\n aria-busy=\"true\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0\"\n data-component=\"dependent-selector\"\n data-component-id={id}\n >\n <span className=\"ds:sr-only\">\n {t('dependentSelector.loadingLabel')}\n </span>\n {skeletonRows}\n </div>\n ) : (\n <RadixRadioGroup.Root\n ref={composedRef}\n id={id}\n dir={dir}\n value={isControlled ? (value ?? '') : undefined}\n defaultValue={\n !isControlled ? (defaultValue ?? autoSelectId) : undefined\n }\n onValueChange={handleValueChange}\n aria-label={!resolvedAriaLabelledBy ? ariaLabel : undefined}\n aria-labelledby={resolvedAriaLabelledBy}\n aria-describedby={describedBy}\n aria-invalid={Boolean(error) || undefined}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0\"\n data-component=\"dependent-selector\"\n data-component-id={id}\n {...props}\n >\n {people.map(renderPerson)}\n </RadixRadioGroup.Root>\n );\n\n /* ---- Outer wrapper ---- */\n /* When `label` is set we render a plain heading <div id={legendId}> */\n /* styled like a legend, and the single role=radiogroup is named via */\n /* aria-labelledby={legendId}. We do NOT wrap in <fieldset>/<legend>: */\n /* that would create a second named grouping container nested around */\n /* the radiogroup (the legend announced twice). One grouping */\n /* mechanism only. */\n const outerClasses = rootVariants({ size, tone, className });\n\n return (\n <div className={outerClasses}>\n {label ? (\n <div id={legendId} className=\"type-label ds:text-foreground\">\n {label}\n </div>\n ) : null}\n {descriptionNode}\n {body}\n {!loading && !hasDependents ? resolvedEmptyState : null}\n {errorNode}\n </div>\n );\n },\n);\n\nDependentSelector.displayName = 'DependentSelector';\n"],"names":["dependentSelectorAgent","handle","args","rootVariants","cva","rowVariants","avatarSizeBySize","skeletonAvatarSizeBySize","nameTypeBySize","DependentSelector","forwardRef","people","value","defaultValue","onValueChange","label","description","sizeProp","toneProp","loading","error","emptyState","id","className","ariaLabel","ariaLabelledBy","props","ref","size","tone","t","useTranslation","baseId","useId","legendId","descriptionId","errorId","useRef","useEffect","selectablePeople","useMemo","person","hasDependents","autoSelectId","isControlled","internalValue","setInternalValue","useState","currentValue","currentValueRef","handleValueChange","next","onValueChangeRef","autoSelectNotifiedRef","_a","agentHandle","useAgentRegistration","rootRef","composedRef","composeRefs","dir","useDirection","resolvedAriaLabelledBy","describedBy","relationshipLabel","key","ageLabel","age","personAccessibleName","parts","descriptionNode","jsx","errorNode","jsxs","CircleAlert","skeletonRows","_","index","renderPerson","rowId","accessibleName","row","RadixRadioGroup","Avatar","Badge","Tooltip","resolvedEmptyState","body","outerClasses"],"mappings":";;;;;;;;;;;;AAcO,MAAMA,KAAgE;AA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
+
{"version":3,"file":"dependent-selector-cJlJFAKD.js","sources":["../../src/components/dependent-selector/dependent-selector.agent.ts","../../src/components/dependent-selector/dependent-selector.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DependentSelector. */\n/* */\n/* Mirrors radio-group.agent.ts: a single-select domain control. The */\n/* selected person id is the externally-observable state; `select_single` */\n/* is the capability. Per-row `data-option-id` lets an agent address each */\n/* person by their stable opaque id. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DependentSelectorHandle } from './dependent-selector';\n\nexport const dependentSelectorAgent: AgentAdapter<DependentSelectorHandle> = {\n id: 'dependent-selector',\n capabilities: ['select_single'],\n state: {\n value: {\n type: 'string',\n descriptionKey: 'ui.agent.dependentSelector.state.value',\n description:\n 'Id of the currently selected person, or empty string when none.',\n read: (handle) => handle.getValue(),\n },\n },\n actions: {\n set_value: {\n safety: 'write',\n argsType: '{ value: string }',\n argsSchema: {\n type: 'object',\n properties: {\n value: {\n type: 'string',\n description: 'Stable opaque id of the person row to select.',\n },\n },\n required: ['value'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.dependentSelector.actions.setValue',\n description: 'Select the person row with the given id.',\n examples: [\n { args: { value: 'person-2' }, note: 'Select the second dependent.' },\n ],\n invoke: (handle, args: { value: string }) => {\n handle.setValue(args.value);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'dependent-selector',\n description: 'Marks the DependentSelector root (role=radiogroup).',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-option-id',\n description: 'Stable person id emitted on each rendered person row.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport * as RadixRadioGroup from '@radix-ui/react-radio-group';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { CircleAlert } from 'lucide-react';\nimport { useTranslation } from 'react-i18next';\nimport { Avatar } from '../avatar';\nimport { Badge } from '../badge';\nimport { Tooltip } from '../tooltip';\nimport { useDirection } from '../_shared/use-direction';\nimport { composeRefs } from '../_shared/compose-refs';\nimport { useAgentRegistration } from '../../agent';\nimport { dependentSelectorAgent } from './dependent-selector.agent';\n\n/* -------------------------------------------------------------------- */\n/* DependentSelector */\n/* */\n/* Single-select roster of people — the verified guardian (\"You\") plus */\n/* their registered dependents/minors — that a check-in kiosk uses to */\n/* answer \"Who are you checking in?\". Built on Radix RadioGroup semantics */\n/* (role=radiogroup, single tab stop, roving arrow-key focus, one */\n/* selected value), mirroring the proven src/components/radio-group/ */\n/* pattern. Each option is a person row (Avatar + name + relationship + */\n/* optional age/Minor badge) wrapped in a <label> so the whole card is */\n/* the click target. */\n/* */\n/* The kit owns the localised relationship + age strings via the closed */\n/* `relationshipKey` enum — consumers pass data, never free-text labels, */\n/* or i18n/RTL breaks. `age` is display-only (pre-computed whole years); */\n/* `isMinor` is an explicit per-person flag, NOT age<18 inference. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/**\n * Closed relationship vocabulary. The kit owns the localised label for\n * each key (`dependentSelector.relationship.<key>`). `'other'` is the\n * escape hatch for relationships the enum doesn't model.\n */\nexport type DependentRelationship =\n | 'self'\n | 'son'\n | 'daughter'\n | 'child'\n | 'spouse'\n | 'parent'\n | 'sibling'\n | 'ward'\n | 'other';\n\nexport interface DependentSelectorPerson {\n /** Stable id — becomes the radio value + `data-option-id`. */\n id: string;\n /** Display-formatted name (already formatted by the consumer). */\n name: string;\n /** Closed relationship key — the kit owns the localised label. */\n relationshipKey: DependentRelationship;\n /**\n * Explicit \"minor\" flag — drives the localised \"Minor\" badge.\n * Consumer-supplied, NOT derived from `age < 18` (legal age of\n * majority varies by market).\n */\n isMinor?: boolean;\n /** Avatar image source — falls back to initials, then icon. */\n avatarSrc?: string;\n /** Whole years, pre-computed by the consumer. Display-only. */\n age?: number;\n /**\n * ISO 8601 date of birth. Used ONLY for the row title/tooltip — never\n * parsed for display math (timezone/locale birthday math is the\n * consumer's job).\n */\n dob?: string;\n /** Disables this row; skipped by arrow navigation. */\n disabled?: boolean;\n /** Shown in a Tooltip on the disabled row (like Radio.disabledReason). */\n disabledReason?: string;\n}\n\n/** Agent-readiness curated handle for DependentSelector. */\nexport interface DependentSelectorHandle {\n getValue: () => string;\n setValue: (value: string) => void;\n}\n\n/* -------------------------------------------------------------------- */\n/* CVA */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva(\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0',\n {\n variants: {\n size: { sm: '', md: '', lg: '' },\n tone: { default: '', checkin: '' },\n },\n defaultVariants: { size: 'md', tone: 'checkin' },\n },\n);\n\nconst rowVariants = cva(\n [\n // The row IS the Radix Item (`<button role=\"radio\">`). Reset the\n // button chrome, lay out avatar + text on the inline axis. Logical\n // properties only.\n 'ds:group ds:flex ds:items-center ds:gap-[var(--spacing-md)] ds:w-full ds:text-start ds:appearance-none',\n 'ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-card',\n // Touch-target floor: even sm clears AA/AAA (44 → 48px in accessible).\n 'ds:min-h-[var(--min-target-size)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n // Selected state: low-alpha accent tint BEHIND tokenised text +\n // a ring-coloured border (never accent as a foreground meeting text).\n 'ds:data-[state=checked]:border-ring',\n // Roving focus ring on the item itself — single tab stop, arrow keys\n // move focus+selection.\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 // Forced-colours: repaint a ButtonBorder edge + a Highlight checked\n // edge + a CanvasText focus ring so the row + its checked state\n // survive Windows High Contrast Mode.\n 'ds:forced-colors:border-[ButtonBorder]',\n 'ds:forced-colors:data-[state=checked]:border-[Highlight]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n ].join(' '),\n {\n variants: {\n size: {\n sm: 'ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-md)] ds:py-[var(--spacing-xs)]',\n md: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:py-[var(--spacing-sm)]',\n lg: 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-lg)] ds:py-[var(--spacing-md)]',\n },\n tone: {\n // Neutral RadioGroup-card tint for plain forms.\n default:\n 'ds:data-[state=checked]:bg-[color-mix(in_srgb,var(--accent)_5%,transparent)]',\n // Accent-tinted selected surface tuned for the check-in kiosk —\n // slightly stronger low-alpha mix BEHIND the tokenised foreground.\n checkin:\n 'ds:data-[state=checked]:bg-[color-mix(in_srgb,var(--accent)_8%,transparent)]',\n },\n disabled: {\n true: 'ds:cursor-not-allowed ds:opacity-50',\n false:\n 'ds:cursor-pointer ds:hover:bg-[color-mix(in_srgb,var(--accent)_4%,transparent)]',\n },\n },\n defaultVariants: { size: 'md', tone: 'checkin', disabled: false },\n },\n);\n\nconst avatarSizeBySize = { sm: 'sm', md: 'md', lg: 'lg' } as const;\n\n// Keep the loading skeleton's avatar footprint in lock-step with the real\n// Avatar scale (sm=size-8 / md=size-10 / lg=size-12) so the roster\n// resolving in doesn't shift the row height.\nconst skeletonAvatarSizeBySize = {\n sm: 'ds:size-8',\n md: 'ds:size-10',\n lg: 'ds:size-12',\n} as const;\n\nconst nameTypeBySize = {\n sm: 'type-body-sm',\n md: 'type-label',\n lg: 'type-body',\n} as const;\n\n/* -------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------- */\n\ntype RadixRootProps = ComponentPropsWithoutRef<typeof RadixRadioGroup.Root>;\n\nexport interface DependentSelectorProps\n extends\n Omit<\n RadixRootProps,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onValueChange'\n >,\n VariantProps<typeof rootVariants> {\n /** Ordered roster to render as options. */\n people: DependentSelectorPerson[];\n /** Controlled selected person id. */\n value?: string;\n /** Uncontrolled initial selection. Ignored when `value` is set. */\n defaultValue?: string;\n /** Fires with the newly selected person id on user selection. */\n onValueChange?: (personId: string) => void;\n /** Accessible group name, rendered as the `<legend>`. */\n label?: string;\n /** Optional helper paragraph under the legend (wired via aria-describedby). */\n description?: string;\n /** Shows N skeleton rows while the roster resolves; sets aria-busy. */\n loading?: boolean;\n /** Validation/empty-confirmation message — role=alert + aria-invalid. */\n error?: string;\n /** Slot shown when no selectable dependents exist (only self / empty). */\n emptyState?: ReactNode;\n /** Forwarded to the radiogroup root as id + data-component-id. */\n id?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const DependentSelector = forwardRef<\n HTMLDivElement,\n DependentSelectorProps\n>(\n (\n {\n people,\n value,\n defaultValue,\n onValueChange,\n label,\n description,\n size: sizeProp = 'md',\n tone: toneProp = 'checkin',\n loading = false,\n error,\n emptyState,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n ) => {\n // CVA's VariantProps types each axis as `T | null | undefined`; the\n // destructure default only covers `undefined`, so coalesce `null`\n // too before the values index the size→class lookup maps.\n const size = sizeProp ?? 'md';\n const tone = toneProp ?? 'checkin';\n const { t } = useTranslation();\n const baseId = useId();\n const legendId = `${baseId}-legend`;\n const descriptionId = `${baseId}-description`;\n const errorId = `${baseId}-error`;\n\n /* ---- Dev-mode accessible-name enforcement ---- */\n const warnedRef = useRef(false);\n useEffect(() => {\n if (\n import.meta.env.DEV &&\n !warnedRef.current &&\n !label &&\n !ariaLabel &&\n !ariaLabelledBy\n ) {\n warnedRef.current = true;\n console.warn(\n '<DependentSelector> rendered without an accessible name. Pass `label`, or `aria-label` / `aria-labelledby`, so the radiogroup is never unnamed.',\n );\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n /* ---- Selectable roster + single-selectable auto-select ---- */\n const selectablePeople = useMemo(\n () => people.filter((person) => !person.disabled),\n [people],\n );\n // The dependents region (everything that isn't the verified self row)\n // drives the empty-state slot.\n const hasDependents = people.some(\n (person) => person.relationshipKey !== 'self',\n );\n const autoSelectId =\n selectablePeople.length === 1 ? selectablePeople[0].id : undefined;\n\n /* ---- Controlled / uncontrolled value handling (mirrors RadioGroup) ---- */\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n defaultValue ?? autoSelectId ?? '',\n );\n const currentValue = isControlled ? (value ?? '') : internalValue;\n const currentValueRef = useRef<string>(currentValue);\n currentValueRef.current = currentValue;\n\n const handleValueChange = (next: string) => {\n if (loading) return;\n if (!isControlled) setInternalValue(next);\n onValueChange?.(next);\n };\n\n /* ---- Auto-select change notification ---- */\n /* When exactly one selectable person exists we seed the uncontrolled */\n /* selection (Radix `defaultValue` + internal state) so the row */\n /* paints checked — but Radix never fires onValueChange for a */\n /* defaultValue. In the kiosk consent flow the consumer wires the */\n /* consent audit trail off onValueChange, so we fire it once on mount */\n /* for that auto-selection. Only when uncontrolled, not loading, and */\n /* the consumer didn't pass an explicit defaultValue. */\n const onValueChangeRef = useRef(onValueChange);\n onValueChangeRef.current = onValueChange;\n const autoSelectNotifiedRef = useRef(false);\n useEffect(() => {\n if (\n !autoSelectNotifiedRef.current &&\n !isControlled &&\n !loading &&\n defaultValue === undefined &&\n autoSelectId !== undefined\n ) {\n autoSelectNotifiedRef.current = true;\n onValueChangeRef.current?.(autoSelectId);\n }\n }, [isControlled, loading, defaultValue, autoSelectId]);\n\n /* ---- Agent registration ---- */\n const agentHandle = useMemo<DependentSelectorHandle>(\n () => ({\n getValue: () => currentValueRef.current,\n setValue: (next) => handleValueChange(next),\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isControlled, loading, onValueChange],\n );\n useAgentRegistration(dependentSelectorAgent, agentHandle, id);\n\n /* ---- Direction (Radix auto-flips Left/Right for rtl) ---- */\n const rootRef = useRef<HTMLDivElement>(null);\n const composedRef = composeRefs(ref, rootRef);\n const dir = useDirection(rootRef);\n\n /* ---- Resolved a11y wiring ---- */\n /* ONE grouping mechanism: when `label` is set we render a plain */\n /* heading <div id={legendId}> (NOT a native <fieldset>/<legend>) and */\n /* name the single role=radiogroup via aria-labelledby. A fieldset */\n /* would add a second, redundant named group nested around the */\n /* radiogroup — so we deliberately avoid it. */\n const resolvedAriaLabelledBy =\n ariaLabelledBy ?? (label ? legendId : undefined);\n const describedBy =\n [description ? descriptionId : null, error ? errorId : null]\n .filter(Boolean)\n .join(' ') || undefined;\n\n /* ---- Helpers ---- */\n const relationshipLabel = (key: DependentRelationship): string =>\n t(`dependentSelector.relationship.${key}`);\n\n const ageLabel = (age: number): string =>\n t('dependentSelector.age', { count: age });\n\n /** Compose the full accessible name a screen reader announces. */\n const personAccessibleName = (person: DependentSelectorPerson): string => {\n const base = t('dependentSelector.optionLabel', {\n name: person.name,\n relationship: relationshipLabel(person.relationshipKey),\n });\n const parts = [base];\n if (typeof person.age === 'number') parts.push(ageLabel(person.age));\n if (person.isMinor) parts.push(t('dependentSelector.minorBadge'));\n return parts.join(', ');\n };\n\n /* ---- Description + error nodes ---- */\n const descriptionNode = description ? (\n <p id={descriptionId} className=\"type-body-sm ds:text-muted-foreground\">\n {description}\n </p>\n ) : null;\n\n const errorNode = error ? (\n <p\n id={errorId}\n role=\"alert\"\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-destructive\"\n >\n <CircleAlert aria-hidden=\"true\" className=\"ds:size-4 ds:shrink-0\" />\n <span>{error}</span>\n </p>\n ) : null;\n\n /* ---- Skeleton rows (loading) ---- */\n const skeletonRows = (\n <div\n aria-hidden=\"true\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\"\n >\n {Array.from({ length: 3 }).map((_, index) => (\n <div\n key={index}\n className={rowVariants({ size, tone, disabled: false })}\n >\n <span\n className={`ds:inline-flex ds:shrink-0 ds:rounded-[var(--radius-full)] ds:bg-muted ds:animate-pulse ${skeletonAvatarSizeBySize[size]}`}\n />\n <span className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:min-w-0 ds:flex-1\">\n <span className=\"ds:h-4 ds:w-1/2 ds:rounded-[var(--radius-sm)] ds:bg-muted ds:animate-pulse\" />\n <span className=\"ds:h-3 ds:w-1/3 ds:rounded-[var(--radius-sm)] ds:bg-muted ds:animate-pulse\" />\n </span>\n </div>\n ))}\n </div>\n );\n\n /* ---- Person row ---- */\n /* The Radix Item IS the card: it renders the `<button role=\"radio\">` */\n /* that owns the roving tabindex + arrow navigation, so the whole row */\n /* is the focus + click target. The composed name lives on */\n /* `aria-label`; the visible content is aria-hidden so a screen reader */\n /* hears the clean composed name once (no duplication). */\n const renderPerson = (person: DependentSelectorPerson) => {\n const rowId = `${baseId}-row-${person.id}`;\n const accessibleName = personAccessibleName(person);\n\n const row = (\n <RadixRadioGroup.Item\n key={person.id}\n id={rowId}\n value={person.id}\n // Native `disabled` is the single disabled model: Radix renders\n // a <button disabled> that is skipped by roving arrow nav and is\n // non-selectable. `aria-disabled` is intentionally NOT also set —\n // on a natively-disabled button it is redundant (it is meant for\n // elements that REMAIN focusable). The disabledReason tooltip is\n // reached via a focusable wrapper span below, not this button.\n disabled={person.disabled}\n aria-label={accessibleName}\n title={person.dob ?? undefined}\n data-option-id={person.id}\n className={rowVariants({\n size,\n tone,\n disabled: Boolean(person.disabled),\n })}\n >\n {/* The Avatar is intentionally aria-hidden: its name only feeds\n initials/colour, and the radio's own aria-label is the sole\n accessible name. Keep aria-hidden so a future refactor doesn't\n reintroduce a duplicate \"image, <name>\" announcement (the kit\n Avatar always renders role=\"img\" + aria-label={name}). */}\n <Avatar\n src={person.avatarSrc}\n name={person.name}\n size={avatarSizeBySize[size]}\n aria-hidden=\"true\"\n />\n <span\n aria-hidden=\"true\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:min-w-0 ds:flex-1\"\n >\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:min-w-0\">\n <span\n className={`${nameTypeBySize[size]} ds:text-foreground ds:truncate ds:min-w-0`}\n >\n {person.name}\n </span>\n {person.isMinor ? (\n // Neutral chip (validated AA ~6:1) — the \"Minor\" flag is\n // informational, not a warning STATE. The tonal `warning`\n // variant fails AA at the small chip font size.\n <Badge variant=\"neutral\" size=\"sm\">\n {t('dependentSelector.minorBadge')}\n </Badge>\n ) : null}\n </span>\n <span className=\"type-body-sm ds:text-muted-foreground ds:truncate ds:min-w-0\">\n {relationshipLabel(person.relationshipKey)}\n {typeof person.age === 'number'\n ? ` · ${ageLabel(person.age)}`\n : null}\n </span>\n </span>\n </RadixRadioGroup.Item>\n );\n\n if (person.disabled && person.disabledReason) {\n // The Radix Item renders a <button disabled>, which is removed\n // from the tab order and does not fire hover/pointer events — so a\n // Tooltip wrapped directly around it would never open. Wrap the row\n // in a focusable, hoverable <span tabIndex={0}> and make THAT the\n // tooltip trigger, so the disabledReason is reachable by both mouse\n // hover and keyboard focus (mirrors radio.tsx putting the Tooltip\n // on the non-disabled wrapper, not the disabled control).\n return (\n <Tooltip key={person.id} label={person.disabledReason}>\n <span\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- intentional focusable tooltip trigger so keyboard users can reach the disabled reason\n tabIndex={0}\n data-disabled-row={person.id}\n aria-label={accessibleName}\n className=\"ds:flex ds:min-w-0 ds:rounded-[var(--radius-md)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]\"\n >\n {row}\n </span>\n </Tooltip>\n );\n }\n return row;\n };\n\n /* ---- Empty-state slot ---- */\n const resolvedEmptyState = emptyState ?? (\n <p className=\"type-body-sm ds:text-muted-foreground\">\n {t('dependentSelector.empty')}\n </p>\n );\n\n /* ---- Radiogroup body ---- */\n /* While loading we still render a role=radiogroup container (carrying */\n /* the data-component marker + aria-busy) holding aria-hidden skeleton */\n /* rows — selection is inert. Otherwise the Radix root renders the */\n /* real person rows. */\n const body = loading ? (\n <div\n ref={composedRef}\n id={id}\n role=\"radiogroup\"\n aria-label={!resolvedAriaLabelledBy ? ariaLabel : undefined}\n aria-labelledby={resolvedAriaLabelledBy}\n aria-describedby={describedBy}\n aria-invalid={Boolean(error) || undefined}\n aria-busy=\"true\"\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0\"\n data-component=\"dependent-selector\"\n data-component-id={id}\n >\n <span className=\"ds:sr-only\">\n {t('dependentSelector.loadingLabel')}\n </span>\n {skeletonRows}\n </div>\n ) : (\n <RadixRadioGroup.Root\n ref={composedRef}\n id={id}\n dir={dir}\n value={isControlled ? (value ?? '') : undefined}\n defaultValue={\n !isControlled ? (defaultValue ?? autoSelectId) : undefined\n }\n onValueChange={handleValueChange}\n aria-label={!resolvedAriaLabelledBy ? ariaLabel : undefined}\n aria-labelledby={resolvedAriaLabelledBy}\n aria-describedby={describedBy}\n aria-invalid={Boolean(error) || undefined}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0\"\n data-component=\"dependent-selector\"\n data-component-id={id}\n {...props}\n >\n {people.map(renderPerson)}\n </RadixRadioGroup.Root>\n );\n\n /* ---- Outer wrapper ---- */\n /* When `label` is set we render a plain heading <div id={legendId}> */\n /* styled like a legend, and the single role=radiogroup is named via */\n /* aria-labelledby={legendId}. We do NOT wrap in <fieldset>/<legend>: */\n /* that would create a second named grouping container nested around */\n /* the radiogroup (the legend announced twice). One grouping */\n /* mechanism only. */\n const outerClasses = rootVariants({ size, tone, className });\n\n return (\n <div className={outerClasses}>\n {label ? (\n <div id={legendId} className=\"type-label ds:text-foreground\">\n {label}\n </div>\n ) : null}\n {descriptionNode}\n {body}\n {!loading && !hasDependents ? resolvedEmptyState : null}\n {errorNode}\n </div>\n );\n },\n);\n\nDependentSelector.displayName = 'DependentSelector';\n"],"names":["dependentSelectorAgent","handle","args","rootVariants","cva","rowVariants","avatarSizeBySize","skeletonAvatarSizeBySize","nameTypeBySize","DependentSelector","forwardRef","people","value","defaultValue","onValueChange","label","description","sizeProp","toneProp","loading","error","emptyState","id","className","ariaLabel","ariaLabelledBy","props","ref","size","tone","t","useTranslation","baseId","useId","legendId","descriptionId","errorId","useRef","useEffect","selectablePeople","useMemo","person","hasDependents","autoSelectId","isControlled","internalValue","setInternalValue","useState","currentValue","currentValueRef","handleValueChange","next","onValueChangeRef","autoSelectNotifiedRef","_a","agentHandle","useAgentRegistration","rootRef","composedRef","composeRefs","dir","useDirection","resolvedAriaLabelledBy","describedBy","relationshipLabel","key","ageLabel","age","personAccessibleName","parts","descriptionNode","jsx","errorNode","jsxs","CircleAlert","skeletonRows","_","index","renderPerson","rowId","accessibleName","row","RadixRadioGroup","Avatar","Badge","Tooltip","resolvedEmptyState","body","outerClasses"],"mappings":";;;;;;;;;;;;AAcO,MAAMA,KAAgE;AAAA,EAC3E,IAAI;AAAA,EACJ,cAAc,CAAC,eAAe;AAAA,EAC9B,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,EACpC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,OAAO;AAAA,YACL,MAAM;AAAA,YACN,aAAa;AAAA,UAAA;AAAA,QACf;AAAA,QAEF,UAAU,CAAC,OAAO;AAAA,MAAA;AAAA,MAEpB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACR,EAAE,MAAM,EAAE,OAAO,WAAA,GAAc,MAAM,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A,QACtC,cACGgC,IAAgD,SAAhC/B,KAAgB8B;AAAA,QAEnC,eAAeO;AAAA,QACf,cAAaY,IAAqC,SAAZtC;AAAA,QACtC,mBAAiBsC;AAAA,QACjB,oBAAkBC;AAAA,QAClB,gBAAc,EAAQ3C,KAAU;AAAA,QAChC,WAAU;AAAA,QACV,kBAAe;AAAA,QACf,qBAAmBE;AAAA,QAClB,GAAGI;AAAA,QAEH,UAAAf,EAAO,IAAImE,EAAY;AAAA,MAAA;AAAA,IAAA,GAWtBU,KAAerF,GAAa,EAAE,MAAAyB,GAAM,MAAAC,GAAM,WAAAN,GAAW;AAE3D,WACE,gBAAAkD,EAAC,OAAA,EAAI,WAAWe,IACb,UAAA;AAAA,MAAAzE,sBACE,OAAA,EAAI,IAAImB,GAAU,WAAU,iCAC1B,aACH,IACE;AAAA,MACHoC;AAAA,MACAiB;AAAA,MACA,CAACpE,KAAW,CAACuB,IAAgB4C,KAAqB;AAAA,MAClDd;AAAA,IAAA,GACH;AAAA,EAEJ;AACF;AAEA/D,GAAkB,cAAc;"}
|
|
@@ -2,7 +2,7 @@ import { jsxs as m, Fragment as W, jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as j, useMemo as I, useState as q, useImperativeHandle as E, Fragment as H } from "react";
|
|
3
3
|
import { c as $ } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as U } from "react-i18next";
|
|
5
|
-
import { B as b } from "./badge-
|
|
5
|
+
import { B as b } from "./badge-sTusUqZD.js";
|
|
6
6
|
import { C as B } from "./card-DPmk26CL.js";
|
|
7
7
|
import { E as G } from "./empty-state-Df0tM6Kn.js";
|
|
8
8
|
import { P as Y } from "./panel-header-D313n_9-.js";
|
|
@@ -287,4 +287,4 @@ export {
|
|
|
287
287
|
ue as D,
|
|
288
288
|
de as d
|
|
289
289
|
};
|
|
290
|
-
//# sourceMappingURL=document-preview-
|
|
290
|
+
//# sourceMappingURL=document-preview-Aae2yKvY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-preview-Di15VrpQ.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation();\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,2DAA2D,KAAK,SAAQ,CAAE;AAC1F,GACMC,KAAQC,GAAiB,SAASF,EAAU,GCFrCG,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF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AA,gBAAA;AAAA,gBAdKR,EAAI;AAAA,cAAA;AAAA,YAiBf,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAEFP,EAAK,IAAI,CAACO,MACT,gBAAAQ;AAAA,UAACsB;AAAA,UAAA;AAAA,YAEC,OAAO9B,EAAI;AAAA,YACX,WAAU;AAAA,YAET,YAAWA,CAAG;AAAA,UAAA;AAAA,UAJVA,EAAI;AAAA,QAAA,CAMZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAILwB,IAAUrB,EAAWJ,CAAS,GAI9B,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,kBAAe;AAAA,MACf,qBAAmBxB;AAAA,MAMnB,UAAU;AAAA,MACV,cAAYL,EAAE,+BAA+B,kBAAkB;AAAA,MAC/D,WAAWjB,GAAwB,EAAE,WAAAyB,GAAW;AAAA,MAE/C,UAAA;AAAA,QAAAI,EAAK,SAAS,KACb,gBAAAe,EAACuB,GAAA,EAAY,QAAM,IAAC,MAAMT,GAAY,OAAOC,EAAA,CAAa;AAAA,QAE3DC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDxC,GAAgB,cAAc;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"document-preview-Aae2yKvY.js","sources":["../../node_modules/lucide-react/dist/esm/icons/files.mjs","../../src/components/document-preview/document-preview.agent.ts","../../src/components/document-preview/document-preview.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8\", key: \"14sh0y\" }],\n [\n \"path\",\n {\n d: \"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z\",\n key: \"1970lx\"\n }\n ],\n [\"path\", { d: \"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1\", key: \"l4dndm\" }]\n];\nconst Files = createLucideIcon(\"files\", __iconNode);\n\nexport { __iconNode, Files as default };\n//# sourceMappingURL=files.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — DocumentPreview. */\n/* */\n/* A passive, read-only viewer, so it declares no interactive */\n/* capabilities. The always-on state slot carries only the structural */\n/* render `kind` (pdf / image / metadata / empty) — never the document */\n/* name. */\n/* */\n/* PHI rule (PRS §26 §7): the document display name can identify a */\n/* patient (e.g. \"Rossi Maria — referto 2026.pdf\"). It renders as text */\n/* (fine) but the only name-returning read is the deliberate get_name */\n/* action with `safety: 'phi'`, so the host gates it behind confirm + */\n/* audit. No name is ever emitted in a data-* hook. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DocumentPreviewHandle } from './document-preview';\n\nexport const documentPreviewAgent: AgentAdapter<DocumentPreviewHandle> = {\n id: 'document-preview',\n capabilities: [],\n state: {\n kind: {\n type: \"'pdf' | 'image' | 'metadata' | 'empty'\",\n descriptionKey: 'ui.agent.documentPreview.state.kind',\n description:\n 'Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.',\n read: (handle) => handle.getKind(),\n },\n },\n actions: {\n get_name: {\n // phi (not read): resolves the document display name, which can identify\n // patients. PRS §26 — phi outranks read so the host gates it behind\n // stricter confirm + audit. The always-on kind slot stays name-free.\n safety: 'phi',\n returns: 'string | undefined',\n returnsSchema: { type: ['string', 'null'] },\n idempotent: true,\n descriptionKey: 'ui.agent.documentPreview.actions.getName',\n description:\n 'Read the display name of the previewed document. May identify a patient (PHI).',\n invoke: (handle) => handle.getName(),\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'document-preview',\n description: 'Marks the DocumentPreview region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","/* -------------------------------------------------------------------- */\n/* DocumentPreview — a standalone, reusable document viewer. */\n/* */\n/* Decoupled from FileManager: it takes primitive props (name, mimeType, */\n/* src, metadata) rather than a FileManagerItem, so signing, the patient */\n/* portal, and the Control Room rail can all reuse it. The body is an */\n/* elevated Card: a bounded preview viewport (PDF → kit PDFViewer; */\n/* image/* → <img>; otherwise a MIME-icon placeholder) above an always-on */\n/* Details block (badges + every structural field the host supplies), so */\n/* the metadata is never dropped when a real preview renders. No name → */\n/* EmptyState. */\n/* */\n/* Title lives in the canonical PanelHeader (the same header every rail */\n/* panel adopts) so the Control Room rail can inject its pin / close */\n/* controls into it. Pass `documents` (≥ 2) to preview a SELECTION as */\n/* tabs — one tab per document, the active one shown below; a single */\n/* entry (or the single-document props) renders without a tab strip. */\n/* */\n/* The root is a `<section>` (region landmark) so the PanelHeader's */\n/* <header> is scoped and never exposed as a page banner — the same */\n/* shape RadiographPanel uses. It is also a keyboard-focusable scroll */\n/* region (tabIndex 0 + labelled focus ring). */\n/* */\n/* PHI: the visible name renders as text (fine), but the only */\n/* name-returning handle read is surfaced by document-preview.agent.ts */\n/* as a `safety: 'phi'` action — never in always-on state, never in a */\n/* data-* hook. In tabbed mode the handle reflects the ACTIVE tab. */\n/* -------------------------------------------------------------------- */\n\nimport {\n forwardRef,\n Fragment,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n File as FileIcon,\n FileImage,\n FileText,\n Files,\n type LucideIcon,\n} from 'lucide-react';\nimport { Badge } from '../badge';\nimport { Card } from '../card';\nimport { EmptyState } from '../empty-state';\nimport { PanelHeader } from '../panel-header';\nimport { PDFViewer } from '../pdf-viewer';\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../tabs';\nimport { useAgentRegistration } from '../../agent';\nimport { documentPreviewAgent } from './document-preview.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport type DocumentPreviewSignatureStatus = 'none' | 'pending' | 'signed';\n\n/** Which render branch DocumentPreview is showing — structural, never PHI. */\nexport type DocumentPreviewKind = 'pdf' | 'image' | 'metadata' | 'empty';\n\nexport interface DocumentPreviewMetadata {\n /** Size in bytes. */\n size?: number;\n /** Display name of whoever created the document (host-supplied). */\n createdBy?: string;\n /** ISO 8601 timestamp the document was created. */\n createdAt?: string;\n /** ISO 8601 timestamp of the last modification. */\n updatedAt?: string;\n /** ISO 8601 timestamp a signature was requested from the patient. */\n signatureRequestedAt?: string;\n /** ISO 8601 timestamp the document was signed. */\n signedAt?: string;\n /** ISO 8601 timestamp the document was shared with the patient. */\n sharedAt?: string;\n /** Open document-type category (non-identifying), e.g. `'xray'`. */\n documentType?: string;\n /** Signature workflow state. */\n signatureStatus?: DocumentPreviewSignatureStatus;\n /** Clinical-document flag (host-defined semantics). */\n clinical?: boolean;\n /** ISO 8601 expiry (e.g. identification documents). */\n expiresAt?: string;\n}\n\n/**\n * A single previewable document. In multi-document mode each becomes a tab;\n * `id` is the tab value (never a patient name) and `name` is the tab label.\n */\nexport interface DocumentPreviewDocument {\n /** Stable, non-identifying id. Emitted as the tab value — never PHI. */\n id: string;\n /** Display name (PHI). Also the tab label in multi-document mode. */\n name: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n}\n\nexport interface DocumentPreviewProps extends VariantProps<\n typeof documentPreviewVariants\n> {\n /** Opaque instance id — emitted as `data-component-id` for the agent registry. */\n id?: string;\n /** Display name. Absent (and no `documents`) → empty state. PHI. */\n name?: string;\n /** MIME type — drives the render branch and the fallback icon. */\n mimeType?: string;\n /** Resolved URL / data URI for the PDF or image viewer. The host owns auth. */\n src?: string;\n /** Structural metadata rendered by the metadata-card branch. */\n metadata?: DocumentPreviewMetadata;\n /**\n * Multiple documents to preview as tabs — e.g. a multi-row selection. Two\n * or more render a tab per document (label = name) with the active one\n * shown below; a single entry renders without a tab strip. When non-empty\n * this takes precedence over the single-document props. Names are PHI.\n */\n documents?: DocumentPreviewDocument[];\n className?: string;\n}\n\nexport interface DocumentPreviewHandle {\n /** Which render branch is active — structural, safe for always-on reads. */\n getKind: () => DocumentPreviewKind;\n /** The active document's display name (PHI). Surfaced by the adapter as a `phi` action. */\n getName: () => string | undefined;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst documentPreviewVariants = cva(\n [\n 'ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)]',\n 'ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring',\n ].join(' '),\n);\n\nconst SIGNATURE_VARIANT: Record<\n Exclude<DocumentPreviewSignatureStatus, 'none'>,\n 'success' | 'warning'\n> = {\n signed: 'success',\n pending: 'warning',\n};\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nfunction resolveKind(\n name: string | undefined,\n mimeType: string | undefined,\n src: string | undefined,\n): DocumentPreviewKind {\n if (!name) return 'empty';\n const mime = mimeType ?? '';\n if (mime === 'application/pdf' && src) return 'pdf';\n if (mime.startsWith('image/') && src) return 'image';\n return 'metadata';\n}\n\n/** Fallback icon for the header / metadata card — a small MIME-family lookup. */\nfunction iconForMime(mimeType: string | undefined): LucideIcon {\n const mime = mimeType ?? '';\n if (mime.startsWith('image/')) return FileImage;\n if (\n mime === 'application/pdf' ||\n mime.startsWith('text/') ||\n mime.includes('word')\n ) {\n return FileText;\n }\n return FileIcon;\n}\n\nconst UNIT_KEYS = [\n 'documentPreview.units.bytes',\n 'documentPreview.units.kilobytes',\n 'documentPreview.units.megabytes',\n 'documentPreview.units.gigabytes',\n] as const;\n\nconst UNIT_FALLBACKS = ['B', 'KB', 'MB', 'GB'] as const;\n\nfunction formatBytes(\n bytes: number,\n locale: string,\n t: (key: string, fallback: string) => string,\n): string {\n let value = bytes;\n let unitIndex = 0;\n while (value >= 1024 && unitIndex < UNIT_FALLBACKS.length - 1) {\n value /= 1024;\n unitIndex++;\n }\n const formatted = new Intl.NumberFormat(locale, {\n maximumFractionDigits: unitIndex === 0 ? 0 : 1,\n }).format(value);\n return `${formatted} ${t(UNIT_KEYS[unitIndex], UNIT_FALLBACKS[unitIndex])}`;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const DocumentPreview = forwardRef<\n DocumentPreviewHandle,\n DocumentPreviewProps\n>(({ id, name, mimeType, src, metadata, documents, className }, ref) => {\n const { t, i18n } = useTranslation();\n\n // Resolve the document list: an explicit `documents` list wins; otherwise\n // the single-document props form a one-item list; nothing → empty. The\n // synthetic single-doc id is never emitted as a tab value (a lone doc\n // renders without a tab strip), so falling back to the name is PHI-safe.\n const docs = useMemo<DocumentPreviewDocument[]>(() => {\n if (documents && documents.length > 0) return documents;\n if (name) return [{ id: id ?? name, name, mimeType, src, metadata }];\n return [];\n }, [documents, id, name, mimeType, src, metadata]);\n\n const isTabbed = docs.length > 1;\n\n // Active tab (multi mode). When the current id is stale after the selection\n // changes we fall back to the first document — no reconciling effect needed.\n const [activeId, setActiveId] = useState<string | undefined>(undefined);\n const activeDoc = docs.find((doc) => doc.id === activeId) ?? docs[0];\n\n const handle = useMemo<DocumentPreviewHandle>(\n () => ({\n getKind: () =>\n activeDoc\n ? resolveKind(activeDoc.name, activeDoc.mimeType, activeDoc.src)\n : 'empty',\n getName: () => activeDoc?.name,\n }),\n [activeDoc],\n );\n useImperativeHandle(ref, () => handle, [handle]);\n useAgentRegistration(documentPreviewAgent, handle, id);\n\n /* The per-document body — an elevated Card with a bounded preview viewport\n (pdf / image / placeholder) above an always-on Details block. The title is\n NOT rendered here (the PanelHeader owns it, or the tab label in multi mode). */\n const renderBody = (doc: DocumentPreviewDocument): ReactNode => {\n const kind = resolveKind(doc.name, doc.mimeType, doc.src);\n const meta = doc.metadata;\n const PlaceholderIcon = iconForMime(doc.mimeType);\n\n // Preview viewport — the rendered document, or a MIME-icon placeholder when\n // no source resolves. Bounded to a consistent aspect so the Details below\n // stay reachable in the rail.\n let viewport: ReactNode;\n if (kind === 'pdf' && doc.src) {\n viewport = (\n <PDFViewer\n src={doc.src}\n toolbarVariant=\"minimal\"\n // Name the embedded viewer after the document so it stays distinct\n // from the surrounding \"Document preview\" region (nested landmarks\n // must not share an accessible name). Mirrors visible header text.\n ariaLabel={doc.name}\n className=\"ds:h-full ds:w-full\"\n />\n );\n } else if (kind === 'image' && doc.src) {\n viewport = (\n <img\n src={doc.src}\n alt={t('documentPreview.imageAlt', 'Preview of {{name}}', {\n name: doc.name,\n })}\n className=\"ds:max-h-full ds:max-w-full ds:object-contain\"\n />\n );\n } else {\n viewport = (\n <span className=\"ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-muted-foreground\">\n <PlaceholderIcon aria-hidden=\"true\" className=\"ds:size-10\" />\n <span className=\"type-body-sm\">\n {t('documentPreview.noPreview', 'No preview available.')}\n </span>\n </span>\n );\n }\n\n // Badges: type / clinical / signature status.\n const status = meta?.signatureStatus;\n const hasBadges =\n Boolean(meta?.documentType) ||\n Boolean(meta?.clinical) ||\n (status !== undefined && status !== 'none');\n\n // Detail rows — every structural field the host supplies, so nothing is\n // dropped when a real preview renders. Only present fields render a row.\n const fmtDate = (iso: string): string =>\n new Intl.DateTimeFormat(i18n.language, { dateStyle: 'medium' }).format(\n new Date(iso),\n );\n const rows: Array<{ key: string; label: string; value: string }> = [];\n if (meta?.createdBy)\n rows.push({\n key: 'createdBy',\n label: t('documentPreview.fields.createdBy', 'Created by'),\n value: meta.createdBy,\n });\n if (meta?.createdAt)\n rows.push({\n key: 'created',\n label: t('documentPreview.fields.created', 'Created'),\n value: fmtDate(meta.createdAt),\n });\n if (meta?.updatedAt)\n rows.push({\n key: 'modified',\n label: t('documentPreview.fields.modified', 'Modified'),\n value: fmtDate(meta.updatedAt),\n });\n if (meta?.signatureRequestedAt)\n rows.push({\n key: 'signatureRequested',\n label: t(\n 'documentPreview.fields.signatureRequested',\n 'Signature requested',\n ),\n value: fmtDate(meta.signatureRequestedAt),\n });\n if (meta?.signedAt)\n rows.push({\n key: 'signed',\n label: t('documentPreview.fields.signed', 'Signed'),\n value: fmtDate(meta.signedAt),\n });\n if (meta?.sharedAt)\n rows.push({\n key: 'sharedWithPatient',\n label: t(\n 'documentPreview.fields.sharedWithPatient',\n 'Shared with patient',\n ),\n value: fmtDate(meta.sharedAt),\n });\n if (meta?.size !== undefined)\n rows.push({\n key: 'size',\n label: t('documentPreview.fields.size', 'Size'),\n value: formatBytes(meta.size, i18n.language, t),\n });\n if (meta?.expiresAt)\n rows.push({\n key: 'expires',\n label: t('documentPreview.fields.expires', 'Expires'),\n value: fmtDate(meta.expiresAt),\n });\n\n const hasDetails = hasBadges || rows.length > 0;\n\n return (\n <div className=\"ds:p-[var(--spacing-md)]\">\n <Card\n variant=\"elevated\"\n className=\"ds:flex ds:flex-col ds:overflow-hidden\"\n >\n <div className=\"ds:flex ds:aspect-[4/3] ds:min-h-0 ds:items-center ds:justify-center ds:overflow-hidden ds:border-b ds:border-[color:var(--card-border)] ds:bg-muted\">\n {viewport}\n </div>\n {hasDetails && (\n <Card.Body className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n <h3 className=\"type-eyebrow ds:m-0 ds:text-muted-foreground\">\n {t('documentPreview.detailsTitle', 'Details')}\n </h3>\n {hasBadges && (\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]\">\n {meta?.documentType && (\n <Badge variant=\"neutral\" size=\"sm\">\n {meta.documentType}\n </Badge>\n )}\n {meta?.clinical && (\n <Badge variant=\"info\" size=\"sm\">\n {t('documentPreview.clinical', 'Clinical')}\n </Badge>\n )}\n {status && status !== 'none' && (\n <Badge\n variant={SIGNATURE_VARIANT[status]}\n size=\"sm\"\n withDot\n >\n {t(`documentPreview.signature.${status}`, status)}\n </Badge>\n )}\n </span>\n )}\n {rows.length > 0 && (\n <dl className=\"ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm\">\n {rows.map((row) => (\n <Fragment key={row.key}>\n <dt className=\"ds:text-muted-foreground\">{row.label}</dt>\n <dd className=\"ds:m-0\">{row.value}</dd>\n </Fragment>\n ))}\n </dl>\n )}\n </Card.Body>\n )}\n </Card>\n </div>\n );\n };\n\n // Header: a MIME icon + the document name for a single doc; a Files glyph +\n // a count badge (RadiographPanel's title-plus-badge shape) when tabbed.\n const HeaderMimeIcon = iconForMime(activeDoc?.mimeType);\n const headerIcon = isTabbed ? (\n <Files aria-hidden=\"true\" />\n ) : (\n <HeaderMimeIcon aria-hidden=\"true\" />\n );\n const headerTitle: ReactNode = isTabbed ? (\n <>\n {t('documentPreview.multiTitle', 'Documents')}\n <Badge variant=\"neutral\" size=\"sm\">\n {docs.length}\n </Badge>\n </>\n ) : (\n activeDoc?.name\n );\n\n let content: ReactNode;\n if (docs.length === 0) {\n content = (\n <EmptyState\n variant=\"first-use\"\n size=\"sm\"\n title={t('documentPreview.emptyTitle', 'No document selected')}\n description={t(\n 'documentPreview.emptyDescription',\n 'Select a document to preview it here.',\n )}\n />\n );\n } else if (isTabbed) {\n content = (\n <Tabs\n value={activeDoc?.id ?? ''}\n onValueChange={setActiveId}\n variant=\"underlined\"\n size=\"sm\"\n // Each tab shows its full file name when there's room and shrinks with\n // an ellipsis only when the tabs would otherwise overflow the width\n // (`min-inline-size:0` lets a tab shrink below its content; the label\n // truncates). The full name stays the accessible name and shows in the\n // body, so nothing is lost.\n className=\"ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]\"\n >\n <TabsList\n aria-label={t('documentPreview.tabsLabel', 'Selected documents')}\n className=\"ds:gap-[var(--spacing-sm)]\"\n >\n {docs.map((doc) => {\n const TabIcon = iconForMime(doc.mimeType);\n return (\n <TabsTrigger\n key={doc.id}\n value={doc.id}\n // Match the header glyph: same 16px size (never larger) and the\n // accent tint that marks a file across the grid and the rail.\n icon={\n <TabIcon\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:text-[color:var(--accent)]\"\n />\n }\n className=\"ds:[min-inline-size:0]\"\n >\n <span className=\"ds:block ds:truncate ds:[min-inline-size:0]\">\n {doc.name}\n </span>\n </TabsTrigger>\n );\n })}\n </TabsList>\n {docs.map((doc) => (\n <TabsContent\n key={doc.id}\n value={doc.id}\n className=\"ds:min-h-0 ds:flex-1\"\n >\n {renderBody(doc)}\n </TabsContent>\n ))}\n </Tabs>\n );\n } else {\n content = renderBody(activeDoc);\n }\n\n return (\n <section\n data-component=\"document-preview\"\n data-component-id={id}\n // The preview body scrolls (PDF pages, tall images, long metadata), so\n // the region needs a keyboard tab stop (axe scrollable-region-focusable).\n // A labelled <section> is a region landmark, which also scopes the\n // PanelHeader's <header> so it is never exposed as a page banner.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- keyboard-focusable scroll region (see comment above)\n tabIndex={0}\n aria-label={t('documentPreview.regionLabel', 'Document preview')}\n className={documentPreviewVariants({ className })}\n >\n {docs.length > 0 && (\n <PanelHeader sticky icon={headerIcon} title={headerTitle} />\n )}\n {content}\n </section>\n );\n});\n\nDocumentPreview.displayName = 'DocumentPreview';\n"],"names":["__iconNode","Files","createLucideIcon","documentPreviewAgent","handle","documentPreviewVariants","cva","SIGNATURE_VARIANT","resolveKind","name","mimeType","src","mime","iconForMime","FileImage","FileText","FileIcon","UNIT_KEYS","UNIT_FALLBACKS","formatBytes","bytes","locale","t","value","unitIndex","DocumentPreview","forwardRef","id","metadata","documents","className","ref","i18n","useTranslation","docs","useMemo","isTabbed","activeId","setActiveId","useState","activeDoc","doc","useImperativeHandle","useAgentRegistration","renderBody","kind","meta","PlaceholderIcon","viewport","jsx","PDFViewer","jsxs","status","hasBadges","fmtDate","iso","rows","hasDetails","Card","Badge","row","Fragment","HeaderMimeIcon","headerIcon","headerTitle","content","EmptyState","Tabs","TabsList","TabIcon","TabsTrigger","TabsContent","PanelHeader"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,6DAA6D,KAAK,SAAQ,CAAE;AAAA,EAC1F;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AAAA,EACE,CAAC,QAAQ,EAAE,GAAG,2DAA2D,KAAK,SAAQ,CAAE;AAC1F,GACMC,KAAQC,GAAiB,SAASF,EAAU,GCFrCG,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACnC;AAAA,EAEF,SAAS;AAAA,IACP,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,eAAe,EAAE,MAAM,CAAC,UAAU,MAAM,EAAA;AAAA,MACxC,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,QAAQ,CAACA,MAAWA,EAAO,QAAA;AAAA,IAAQ;AAAA,EACrC;AAAA,EAEF,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IAAA;AAAA,IAEf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ,GCmFMC,KAA0BC;AAAA,EAC9B;AAA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