@alfadocs/ui-kit-debug 1.6.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js → anamnesis-summary-rows-d44s_whc.js} +2 -2
- package/dist/_chunks/{anamnesis-summary-rows-F-cCmFAn.js.map → anamnesis-summary-rows-d44s_whc.js.map} +1 -1
- package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js → antenatal-schedule-timeline-B1k8QkA6.js} +3 -3
- package/dist/_chunks/{antenatal-schedule-timeline-BjlF2rTz.js.map → antenatal-schedule-timeline-B1k8QkA6.js.map} +1 -1
- package/dist/_chunks/{appointment-card-BhcPJpXh.js → appointment-card-Dzr3GeVz.js} +73 -90
- package/dist/_chunks/appointment-card-Dzr3GeVz.js.map +1 -0
- package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js → appointment-timeline-0mwtpErq.js} +3 -3
- package/dist/_chunks/{appointment-timeline-CMPvzlGZ.js.map → appointment-timeline-0mwtpErq.js.map} +1 -1
- package/dist/_chunks/{appointment-tray-3c_FLxXJ.js → appointment-tray-4FUu_5NX.js} +2 -2
- package/dist/_chunks/{appointment-tray-3c_FLxXJ.js.map → appointment-tray-4FUu_5NX.js.map} +1 -1
- package/dist/_chunks/armchair-BaLDW6Hz.js +23 -0
- package/dist/_chunks/armchair-BaLDW6Hz.js.map +1 -0
- package/dist/_chunks/{booking-CQMJUFG-.js → booking-DHkKcUIl.js} +4 -4
- package/dist/_chunks/{booking-CQMJUFG-.js.map → booking-DHkKcUIl.js.map} +1 -1
- package/dist/_chunks/{calendar-4dXTvsCz.js → calendar-B4Gnyu1C.js} +553 -437
- package/dist/_chunks/calendar-B4Gnyu1C.js.map +1 -0
- package/dist/_chunks/calendar-event-card-Bjdbik8G.js +425 -0
- package/dist/_chunks/calendar-event-card-Bjdbik8G.js.map +1 -0
- package/dist/_chunks/{care-plan-card-DQjVRDxO.js → care-plan-card-aDN4oem9.js} +3 -3
- package/dist/_chunks/{care-plan-card-DQjVRDxO.js.map → care-plan-card-aDN4oem9.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js → care-plan-entry-card-BEhANdBE.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-CMpoeNkb.js.map → care-plan-entry-card-BEhANdBE.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-CxYoq23f.js → care-plan-header-CkpPyQqG.js} +2 -2
- package/dist/_chunks/{care-plan-header-CxYoq23f.js.map → care-plan-header-CkpPyQqG.js.map} +1 -1
- package/dist/_chunks/{color-picker-D-tUwxxT.js → color-picker-oZ6zYks8.js} +164 -151
- package/dist/_chunks/color-picker-oZ6zYks8.js.map +1 -0
- package/dist/_chunks/control-room-rail-Cj2iX9h_.js +337 -0
- package/dist/_chunks/control-room-rail-Cj2iX9h_.js.map +1 -0
- package/dist/_chunks/{cycle-calculator-DzgO1vzP.js → cycle-calculator-DmtYGhqq.js} +3 -3
- package/dist/_chunks/{cycle-calculator-DzgO1vzP.js.map → cycle-calculator-DmtYGhqq.js.map} +1 -1
- package/dist/_chunks/{date-picker-Bp64zk2p.js → date-picker-CepI_oI2.js} +77 -74
- package/dist/_chunks/date-picker-CepI_oI2.js.map +1 -0
- package/dist/_chunks/{date-picker-variants-pKAJfnWr.js → date-picker-variants-DfuooXEK.js} +7 -2
- package/dist/_chunks/{date-picker-variants-pKAJfnWr.js.map → date-picker-variants-DfuooXEK.js.map} +1 -1
- package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js → date-range-picker-BD8P_rJq.js} +46 -45
- package/dist/_chunks/{date-range-picker-CDrZ8Zh0.js.map → date-range-picker-BD8P_rJq.js.map} +1 -1
- package/dist/_chunks/{date-time-picker-DVETwpzc.js → date-time-picker-3I2vVKGV.js} +2 -2
- package/dist/_chunks/{date-time-picker-DVETwpzc.js.map → date-time-picker-3I2vVKGV.js.map} +1 -1
- package/dist/_chunks/{due-date-calculator-wK8Tajzz.js → due-date-calculator-BF_Ikofx.js} +4 -4
- package/dist/_chunks/{due-date-calculator-wK8Tajzz.js.map → due-date-calculator-BF_Ikofx.js.map} +1 -1
- package/dist/_chunks/{entity-card-9_62gY7l.js → entity-card-DmrgYSEX.js} +4 -4
- package/dist/_chunks/{entity-card-9_62gY7l.js.map → entity-card-DmrgYSEX.js.map} +1 -1
- package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js → gestational-age-calculator-CxZelpu2.js} +5 -5
- package/dist/_chunks/{gestational-age-calculator-C_uDAeP_.js.map → gestational-age-calculator-CxZelpu2.js.map} +1 -1
- package/dist/_chunks/{hcg-doubling-BaXkJhT-.js → hcg-doubling-CpU7H5rQ.js} +3 -3
- package/dist/_chunks/{hcg-doubling-BaXkJhT-.js.map → hcg-doubling-CpU7H5rQ.js.map} +1 -1
- package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js → link-cell-renderer-BZQtsuFz.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-DH4JYpKU.js.map → link-cell-renderer-BZQtsuFz.js.map} +1 -1
- package/dist/_chunks/{notes-panel-DlnENphf.js → notes-panel-e9cJWVRg.js} +2 -2
- package/dist/_chunks/{notes-panel-DlnENphf.js.map → notes-panel-e9cJWVRg.js.map} +1 -1
- package/dist/_chunks/{operator-hero-CCDnIa1S.js → operator-hero-BnFv-Uef.js} +2 -2
- package/dist/_chunks/{operator-hero-CCDnIa1S.js.map → operator-hero-BnFv-Uef.js.map} +1 -1
- package/dist/_chunks/{parse-JqixfsU0.js → parse-MN9bGkrY.js} +2 -2
- package/dist/_chunks/{parse-JqixfsU0.js.map → parse-MN9bGkrY.js.map} +1 -1
- package/dist/_chunks/{patient-details-qnsqYBGQ.js → patient-details-xrqe13az.js} +160 -159
- package/dist/_chunks/patient-details-xrqe13az.js.map +1 -0
- package/dist/_chunks/{patient-table-DwshfVsQ.js → patient-table-BqYomX50.js} +2 -2
- package/dist/_chunks/{patient-table-DwshfVsQ.js.map → patient-table-BqYomX50.js.map} +1 -1
- package/dist/_chunks/{payment-automation-upsell-BBIG7NFL.js → payment-automation-upsell-DwQW2fRp.js} +52 -63
- package/dist/_chunks/payment-automation-upsell-DwQW2fRp.js.map +1 -0
- package/dist/_chunks/{payment-request-card-BjjBMdsp.js → payment-request-card-YVCcCZ25.js} +2 -2
- package/dist/_chunks/{payment-request-card-BjjBMdsp.js.map → payment-request-card-YVCcCZ25.js.map} +1 -1
- package/dist/_chunks/{practice-results-F_Rf7c4H.js → practice-results-BEsAdW-B.js} +719 -633
- package/dist/_chunks/practice-results-BEsAdW-B.js.map +1 -0
- package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js → pregnancy-dating-DtToyMyc.js} +5 -5
- package/dist/_chunks/{pregnancy-dating-BVS_9YU2.js.map → pregnancy-dating-DtToyMyc.js.map} +1 -1
- package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js → radiograph-panel.agent-C3trfWqB.js} +3 -3
- package/dist/_chunks/{radiograph-panel.agent-CiHwgISa.js.map → radiograph-panel.agent-C3trfWqB.js.map} +1 -1
- package/dist/_chunks/repeat-CvQa5rZt.js +17 -0
- package/dist/_chunks/repeat-CvQa5rZt.js.map +1 -0
- package/dist/_chunks/resource-chip-DYTG0IQQ.js +83 -0
- package/dist/_chunks/resource-chip-DYTG0IQQ.js.map +1 -0
- package/dist/_chunks/{rich-text-editor-DARnq_6N.js → rich-text-editor-BDfFtK4H.js} +2 -2
- package/dist/_chunks/{rich-text-editor-DARnq_6N.js.map → rich-text-editor-BDfFtK4H.js.map} +1 -1
- package/dist/_chunks/subDays-BLl3y3pd.js +8 -0
- package/dist/_chunks/{subDays-CAUv47M1.js.map → subDays-BLl3y3pd.js.map} +1 -1
- package/dist/agent-catalog.json +3 -3
- package/dist/components/_shared/date-picker-variants.d.ts.map +1 -1
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/calendar/calendar.agent.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +138 -12
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/calendar-event-card/calendar-event-card.d.ts +48 -11
- package/dist/components/calendar-event-card/calendar-event-card.d.ts.map +1 -1
- package/dist/components/calendar-event-card/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/color-picker/index.d.ts +1 -1
- package/dist/components/color-picker/index.d.ts.map +1 -1
- package/dist/components/color-picker/index.js +4 -3
- package/dist/components/color-picker/palettes.d.ts +10 -0
- package/dist/components/color-picker/palettes.d.ts.map +1 -1
- package/dist/components/control-room-rail/control-room-rail.d.ts +9 -0
- package/dist/components/control-room-rail/control-room-rail.d.ts.map +1 -1
- package/dist/components/control-room-rail/index.js +1 -1
- package/dist/components/cycle-calculator/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/date-picker.d.ts +11 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/due-date-calculator/index.js +2 -2
- package/dist/components/gestational-age-calculator/index.js +1 -1
- package/dist/components/hcg-doubling/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-details/patient-details.d.ts +8 -0
- package/dist/components/patient-details/patient-details.d.ts.map +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/practice-results/practice-results.d.ts +47 -7
- package/dist/components/practice-results/practice-results.d.ts.map +1 -1
- package/dist/components/pregnancy-dating/index.js +1 -1
- package/dist/components/radiograph-panel/index.js +1 -1
- package/dist/components/resource-chip/index.d.ts +3 -0
- package/dist/components/resource-chip/index.d.ts.map +1 -0
- package/dist/components/resource-chip/index.js +5 -0
- package/dist/components/resource-chip/index.js.map +1 -0
- package/dist/components/resource-chip/resource-chip.d.ts +26 -0
- package/dist/components/resource-chip/resource-chip.d.ts.map +1 -0
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/i18n/locales/ar.d.ts +5 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +6 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +6 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +5 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +6 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +5 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +6 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +5 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +6 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +5 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +6 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +5 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +6 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +5 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +6 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +5 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +6 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +5 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +6 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +5 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +6 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +5 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +6 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +5 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +6 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +5 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +6 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +5 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +6 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +5 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +6 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +5 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +6 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +5 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +6 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +961 -958
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +6 -1
- package/dist/locales/de.json +6 -1
- package/dist/locales/el.json +6 -1
- package/dist/locales/en.json +6 -1
- package/dist/locales/es.json +6 -1
- package/dist/locales/fr.json +6 -1
- package/dist/locales/hi.json +6 -1
- package/dist/locales/it.json +6 -1
- package/dist/locales/ja.json +6 -1
- package/dist/locales/nl.json +6 -1
- package/dist/locales/pl.json +6 -1
- package/dist/locales/pt.json +6 -1
- package/dist/locales/ro.json +6 -1
- package/dist/locales/ru.json +6 -1
- package/dist/locales/sq.json +6 -1
- package/dist/locales/sv.json +6 -1
- package/dist/locales/tr.json +6 -1
- package/dist/locales/zh.json +6 -1
- package/dist/patterns/anamnesis/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +1 -1
- package/dist/tokens.css +40 -24
- package/package.json +5 -1
- package/dist/_chunks/appointment-card-BhcPJpXh.js.map +0 -1
- package/dist/_chunks/calendar-4dXTvsCz.js.map +0 -1
- package/dist/_chunks/calendar-event-card-C6qGtywL.js +0 -257
- package/dist/_chunks/calendar-event-card-C6qGtywL.js.map +0 -1
- package/dist/_chunks/color-picker-D-tUwxxT.js.map +0 -1
- package/dist/_chunks/control-room-rail-IH1eBjrK.js +0 -333
- package/dist/_chunks/control-room-rail-IH1eBjrK.js.map +0 -1
- package/dist/_chunks/date-picker-Bp64zk2p.js.map +0 -1
- package/dist/_chunks/patient-details-qnsqYBGQ.js.map +0 -1
- package/dist/_chunks/payment-automation-upsell-BBIG7NFL.js.map +0 -1
- package/dist/_chunks/practice-results-F_Rf7c4H.js.map +0 -1
- package/dist/_chunks/subDays-CAUv47M1.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cycle-calculator-DzgO1vzP.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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AAOqB;AAAA,kBACP,QAAQ;AAAA,oBACN;AAAA;AAAA;AAAA;AAAA,sBAIE,MAAM;AAAA,sBACN,OAAOK,EAAE,2BAA2B;AAAA,sBACpC,OAAOsB,EAAIZ,EAAO,SAAS;AAAA,oBAAA;AAAA,oBAE7B;AAAA;AAAA;AAAA,sBAGE,MAAM;AAAA,sBACN,OAAOV,EAAE,+BAA+B;AAAA,sBACxC,OAAO,GAAGsB,EAAIZ,EAAO,cAAc,KAAK,CAAC,MAAMY;AAAA,wBAC7CZ,EAAO,cAAc;AAAA,sBAAA,CACtB;AAAA,oBAAA;AAAA,oBAEH;AAAA;AAAA;AAAA,sBAGE,MAAM;AAAA,sBACN,OAAOV,EAAE,4BAA4B;AAAA,sBACrC,OAAOsB,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-DmtYGhqq.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,M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AAA,oBAEH;AAAA;AAAA;AAAA,sBAGE,MAAM;AAAA,sBACN,OAAOV,EAAE,4BAA4B;AAAA,sBACrC,OAAOsB,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,16 +1,16 @@
|
|
|
1
1
|
import { jsx as r, jsxs as v } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import * as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as
|
|
8
|
-
import { u as
|
|
9
|
-
import { f as T, i as
|
|
10
|
-
import { C as
|
|
11
|
-
import { C as
|
|
12
|
-
import { p as
|
|
13
|
-
const
|
|
2
|
+
import { forwardRef as ie, useContext as oe, useState as y, useRef as K, useEffect as de, useCallback as R, useMemo as le, useImperativeHandle as ce } from "react";
|
|
3
|
+
import { useTranslation as pe } from "react-i18next";
|
|
4
|
+
import * as k from "@radix-ui/react-popover";
|
|
5
|
+
import { u as ue } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { u as fe, F as me } from "./form-field-context-B3APVHKx.js";
|
|
7
|
+
import { u as he } from "./registry-DvAUVLHh.js";
|
|
8
|
+
import { u as ge, g as ve, b as ye, i as ke, c as be, t as Ce, d as De, p as Pe, D as Se, C as xe, e as we, f as Ie } from "./date-picker-variants-DfuooXEK.js";
|
|
9
|
+
import { f as T, i as Oe, b as Ne } from "./format-4HNwNGrN.js";
|
|
10
|
+
import { C as Ve } from "./calendar-days-BGWklvE-.js";
|
|
11
|
+
import { C as Fe } from "./check-DrFSN__t.js";
|
|
12
|
+
import { p as Ae } from "./parse-MN9bGkrY.js";
|
|
13
|
+
const Ke = {
|
|
14
14
|
id: "date-picker",
|
|
15
15
|
// Persisted single date (value state + set_date) → select_single + set_value,
|
|
16
16
|
// plus open/close of the calendar popover.
|
|
@@ -21,8 +21,8 @@ const Ae = {
|
|
|
21
21
|
descriptionKey: "ui.agent.datePicker.state.value",
|
|
22
22
|
description: "Currently-selected ISO date, or null.",
|
|
23
23
|
read: (a) => {
|
|
24
|
-
var
|
|
25
|
-
return ((
|
|
24
|
+
var l;
|
|
25
|
+
return ((l = a.getValue()) == null ? void 0 : l.toISOString()) ?? null;
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
isOpen: {
|
|
@@ -51,8 +51,8 @@ const Ae = {
|
|
|
51
51
|
descriptionKey: "ui.agent.datePicker.actions.setDate",
|
|
52
52
|
description: "Select a specific date (ISO yyyy-mm-dd).",
|
|
53
53
|
examples: [{ args: { date: "2026-06-23" }, note: "Select 23 Jun 2026." }],
|
|
54
|
-
invoke: (a,
|
|
55
|
-
a.setValue(new Date(
|
|
54
|
+
invoke: (a, l) => {
|
|
55
|
+
a.setValue(new Date(l.date));
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
clear: {
|
|
@@ -96,40 +96,41 @@ const Ae = {
|
|
|
96
96
|
description: "Sourced from the id prop."
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
},
|
|
99
|
+
}, Re = ie(
|
|
100
100
|
({
|
|
101
101
|
value: a,
|
|
102
|
-
defaultValue:
|
|
102
|
+
defaultValue: l,
|
|
103
103
|
onChange: M,
|
|
104
104
|
minDate: m,
|
|
105
105
|
maxDate: h,
|
|
106
106
|
disabledDates: c,
|
|
107
107
|
weekStartsOn: j,
|
|
108
|
-
presets:
|
|
108
|
+
presets: b,
|
|
109
109
|
size: x = "md",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"aria-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
chrome: q = "input",
|
|
111
|
+
disabled: B,
|
|
112
|
+
placeholder: E,
|
|
113
|
+
className: L,
|
|
114
|
+
id: _,
|
|
115
|
+
"aria-label": H,
|
|
116
|
+
"aria-labelledby": W
|
|
117
|
+
}, J) => {
|
|
118
|
+
const { t: w, i18n: I } = pe(), p = fe(), O = oe(me) !== null, C = _ ?? p.id, N = p.disabled || B, z = p.invalid ? "error" : "default", u = ge(I.language), f = ve(I.language), G = E ?? w("inputs.datePicker.placeholder", "Select date"), [Q, V] = ue({
|
|
118
119
|
value: a,
|
|
119
|
-
defaultValue:
|
|
120
|
+
defaultValue: l,
|
|
120
121
|
onChange: M
|
|
121
|
-
}), n =
|
|
122
|
+
}), n = Q, [i, s] = y(!1), [U, D] = y(
|
|
122
123
|
n ? T(n, f, { locale: u }) : ""
|
|
123
|
-
), [F, g] = y(!1), [
|
|
124
|
-
|
|
124
|
+
), [F, g] = y(!1), [X, P] = y(n ?? /* @__PURE__ */ new Date()), S = K(null);
|
|
125
|
+
de(() => {
|
|
125
126
|
n ? (D(T(n, f, { locale: u })), g(!1)) : D("");
|
|
126
127
|
}, [n, f, u]);
|
|
127
|
-
const
|
|
128
|
+
const Y = ye(
|
|
128
129
|
m,
|
|
129
130
|
h,
|
|
130
131
|
c
|
|
131
|
-
),
|
|
132
|
-
(e) => m &&
|
|
132
|
+
), Z = R(
|
|
133
|
+
(e) => m && ke(e, m) || h && be(e, h) ? !0 : Array.isArray(c) ? c.some(
|
|
133
134
|
(t) => t.toDateString() === e.toDateString()
|
|
134
135
|
) : typeof c == "function" ? c(e) : !1,
|
|
135
136
|
[m, h, c]
|
|
@@ -138,24 +139,24 @@ const Ae = {
|
|
|
138
139
|
V(e);
|
|
139
140
|
},
|
|
140
141
|
[V]
|
|
141
|
-
),
|
|
142
|
+
), $ = (e) => {
|
|
142
143
|
const t = e.target.value;
|
|
143
144
|
if (D(t), t.length === 0) {
|
|
144
145
|
g(!1), o(void 0);
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
}, $ = (e) => {
|
|
150
|
-
e.key === "Enter" && i && (e.preventDefault(), s(!1)), e.key === "Escape" && i && (e.preventDefault(), s(!1)), e.key === "ArrowDown" && !i && (e.preventDefault(), s(!0));
|
|
148
|
+
const d = Ae(t, f, /* @__PURE__ */ new Date(), { locale: u });
|
|
149
|
+
Oe(d) && !Z(d) ? (g(!1), o(d), P(d)) : t.length === f.length && g(!0);
|
|
151
150
|
}, ee = (e) => {
|
|
151
|
+
e.key === "Enter" && i && (e.preventDefault(), s(!1)), e.key === "Escape" && i && (e.preventDefault(), s(!1)), e.key === "ArrowDown" && !i && (e.preventDefault(), s(!0));
|
|
152
|
+
}, te = (e) => {
|
|
152
153
|
var t;
|
|
153
154
|
e && (o(e), s(!1), (t = S.current) == null || t.focus());
|
|
154
|
-
},
|
|
155
|
-
var
|
|
155
|
+
}, ae = (e) => {
|
|
156
|
+
var d;
|
|
156
157
|
const t = e.date();
|
|
157
|
-
o(t), P(t), s(!1), (
|
|
158
|
-
},
|
|
158
|
+
o(t), P(t), s(!1), (d = S.current) == null || d.focus();
|
|
159
|
+
}, re = (e) => n ? Ne(e.date(), n) : !1, ne = w("inputs.datePicker.gridLabel", "Calendar"), se = le(
|
|
159
160
|
() => ({
|
|
160
161
|
getValue: () => n,
|
|
161
162
|
setValue: (e) => o(e),
|
|
@@ -166,66 +167,68 @@ const Ae = {
|
|
|
166
167
|
}),
|
|
167
168
|
[n, o, i]
|
|
168
169
|
), A = K(null);
|
|
169
|
-
return
|
|
170
|
+
return ce(J, () => A.current, []), he(Ke, se, C), /* @__PURE__ */ r(k.Root, { open: i, onOpenChange: s, children: /* @__PURE__ */ v(
|
|
170
171
|
"div",
|
|
171
172
|
{
|
|
172
173
|
ref: A,
|
|
173
|
-
className:
|
|
174
|
+
className: L,
|
|
174
175
|
"data-component": "date-picker",
|
|
175
176
|
"data-component-id": C,
|
|
176
177
|
children: [
|
|
177
178
|
/* @__PURE__ */ v("div", { className: "ds:relative", children: [
|
|
178
|
-
/* @__PURE__ */ r(
|
|
179
|
+
/* @__PURE__ */ r(k.Trigger, { asChild: !0, disabled: N, children: /* @__PURE__ */ r(
|
|
179
180
|
"input",
|
|
180
181
|
{
|
|
181
182
|
ref: S,
|
|
182
183
|
id: C,
|
|
183
184
|
type: "text",
|
|
184
185
|
role: "combobox",
|
|
185
|
-
value:
|
|
186
|
-
placeholder:
|
|
186
|
+
value: U,
|
|
187
|
+
placeholder: G,
|
|
187
188
|
disabled: N,
|
|
188
|
-
"aria-label": O ? void 0 :
|
|
189
|
-
"aria-labelledby": O ? void 0 :
|
|
189
|
+
"aria-label": O ? void 0 : H,
|
|
190
|
+
"aria-labelledby": O ? void 0 : W,
|
|
190
191
|
"aria-describedby": p.describedBy || void 0,
|
|
191
192
|
"aria-invalid": p.invalid || F || void 0,
|
|
192
193
|
"aria-required": p.required || void 0,
|
|
193
194
|
"aria-haspopup": "dialog",
|
|
194
195
|
"aria-expanded": i,
|
|
195
|
-
onChange:
|
|
196
|
-
onKeyDown:
|
|
196
|
+
onChange: $,
|
|
197
|
+
onKeyDown: ee,
|
|
197
198
|
onClick: () => !i && s(!0),
|
|
198
|
-
className:
|
|
199
|
+
className: Ce({
|
|
199
200
|
size: x,
|
|
200
|
-
tone: F ? "error" :
|
|
201
|
+
tone: F ? "error" : z,
|
|
202
|
+
chrome: q
|
|
201
203
|
})
|
|
202
204
|
}
|
|
203
205
|
) }),
|
|
204
|
-
/* @__PURE__ */ r("span", { "aria-hidden": "true", className:
|
|
206
|
+
/* @__PURE__ */ r("span", { "aria-hidden": "true", className: De({ size: x }), children: /* @__PURE__ */ r(Ve, {}) })
|
|
205
207
|
] }),
|
|
206
|
-
/* @__PURE__ */ r(
|
|
207
|
-
|
|
208
|
+
/* @__PURE__ */ r(k.Portal, { children: /* @__PURE__ */ r(
|
|
209
|
+
k.Content,
|
|
208
210
|
{
|
|
209
211
|
sideOffset: 4,
|
|
210
212
|
align: "start",
|
|
211
|
-
|
|
213
|
+
"data-component": "date-picker-content",
|
|
214
|
+
className: Ie(),
|
|
212
215
|
onOpenAutoFocus: (e) => {
|
|
213
216
|
e.preventDefault();
|
|
214
217
|
},
|
|
215
218
|
children: /* @__PURE__ */ v("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
|
|
216
|
-
|
|
217
|
-
const t =
|
|
219
|
+
b && b.length > 0 ? /* @__PURE__ */ r("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]", children: b.map((e) => {
|
|
220
|
+
const t = re(e);
|
|
218
221
|
return /* @__PURE__ */ v(
|
|
219
222
|
"button",
|
|
220
223
|
{
|
|
221
224
|
type: "button",
|
|
222
225
|
"aria-pressed": t,
|
|
223
|
-
onClick: () =>
|
|
224
|
-
className:
|
|
226
|
+
onClick: () => ae(e),
|
|
227
|
+
className: Pe({ active: t }),
|
|
225
228
|
children: [
|
|
226
229
|
/* @__PURE__ */ r("span", { className: "ds:min-w-0 ds:truncate", children: e.label }),
|
|
227
230
|
t ? /* @__PURE__ */ r(
|
|
228
|
-
|
|
231
|
+
Fe,
|
|
229
232
|
{
|
|
230
233
|
"aria-hidden": "true",
|
|
231
234
|
className: "ds:size-4 ds:shrink-0 ds:text-primary"
|
|
@@ -236,21 +239,21 @@ const Ae = {
|
|
|
236
239
|
e.label
|
|
237
240
|
);
|
|
238
241
|
}) }) : null,
|
|
239
|
-
/* @__PURE__ */ r("div", { role: "region", "aria-label":
|
|
240
|
-
|
|
242
|
+
/* @__PURE__ */ r("div", { role: "region", "aria-label": ne, children: /* @__PURE__ */ r(
|
|
243
|
+
Se,
|
|
241
244
|
{
|
|
242
245
|
mode: "single",
|
|
243
246
|
selected: n,
|
|
244
|
-
onSelect:
|
|
245
|
-
month:
|
|
247
|
+
onSelect: te,
|
|
248
|
+
month: X,
|
|
246
249
|
onMonthChange: P,
|
|
247
|
-
disabled:
|
|
250
|
+
disabled: Y,
|
|
248
251
|
weekStartsOn: j,
|
|
249
252
|
locale: u,
|
|
250
253
|
showOutsideDays: !0,
|
|
251
254
|
fixedWeeks: !0,
|
|
252
|
-
classNames:
|
|
253
|
-
components: { Chevron:
|
|
255
|
+
classNames: we,
|
|
256
|
+
components: { Chevron: xe }
|
|
254
257
|
}
|
|
255
258
|
) })
|
|
256
259
|
] })
|
|
@@ -261,9 +264,9 @@ const Ae = {
|
|
|
261
264
|
) });
|
|
262
265
|
}
|
|
263
266
|
);
|
|
264
|
-
|
|
267
|
+
Re.displayName = "DatePicker";
|
|
265
268
|
export {
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
Re as D,
|
|
270
|
+
Ke as d
|
|
268
271
|
};
|
|
269
|
-
//# sourceMappingURL=date-picker-
|
|
272
|
+
//# sourceMappingURL=date-picker-CepI_oI2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-CepI_oI2.js","sources":["../../src/components/date-picker/date-picker.agent.ts","../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — DatePicker. */\n/* */\n/* DatePicker wraps react-day-picker inside a Radix Popover. The agent */\n/* surface curates the input + popover into a small set of date-shaped */\n/* operations — set / clear / open / close. The handle is the curated */\n/* surface; raw rdp internals are deliberately not exposed. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` §15. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { DatePickerHandle } from './date-picker';\n\nexport const datePickerAgent: AgentAdapter<DatePickerHandle> = {\n id: 'date-picker',\n // Persisted single date (value state + set_date) → select_single + set_value,\n // plus open/close of the calendar popover.\n capabilities: ['select_single', 'set_value', 'open', 'close'],\n state: {\n value: {\n type: 'iso-date',\n descriptionKey: 'ui.agent.datePicker.state.value',\n description: 'Currently-selected ISO date, or null.',\n read: (handle) => handle.getValue()?.toISOString() ?? null,\n },\n isOpen: {\n type: 'boolean',\n descriptionKey: 'ui.agent.datePicker.state.isOpen',\n description: 'Whether the calendar popover is open.',\n read: (handle) => handle.isOpen(),\n },\n },\n actions: {\n set_date: {\n safety: 'write',\n argsType: '{ date: string }',\n argsSchema: {\n type: 'object',\n properties: {\n date: {\n type: 'string',\n format: 'date',\n description: 'ISO date, e.g. \"2026-06-23\".',\n },\n },\n required: ['date'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.setDate',\n description: 'Select a specific date (ISO yyyy-mm-dd).',\n examples: [{ args: { date: '2026-06-23' }, note: 'Select 23 Jun 2026.' }],\n invoke: (handle, args: { date: string }) => {\n handle.setValue(new Date(args.date));\n },\n },\n clear: {\n // Discards the selected date — loses the user's input.\n safety: 'destructive',\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.clear',\n description: 'Clear the selected date.',\n invoke: (handle) => {\n handle.clear();\n },\n },\n open: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.open',\n description: 'Open the calendar popover.',\n invoke: (handle) => {\n handle.open();\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.agent.datePicker.actions.close',\n description: 'Close the calendar popover.',\n invoke: (handle) => {\n handle.close();\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'date-picker',\n description: 'Marks the DatePicker wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type KeyboardEvent,\n} from 'react';\nimport { type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport * as Popover from '@radix-ui/react-popover';\nimport { DayPicker } from 'react-day-picker';\nimport {\n format as fnsFormat,\n parse as fnsParse,\n isValid,\n isSameDay,\n isBefore,\n isAfter,\n} from 'date-fns';\nimport { CalendarDays, Check } from 'lucide-react';\nimport { useControllableState } from '../../hooks/use-controllable-state';\nimport {\n FormFieldContext,\n useFormField,\n} from '../form-field/form-field-context';\nimport {\n useDateFnsLocale,\n getShortDateFormat,\n buildDisabledMatcher,\n CalendarChevron,\n calendarClassNames,\n triggerVariants,\n calendarIconVariants,\n popoverContentVariants,\n presetButtonVariants,\n} from '../_shared';\nimport { useAgentRegistration } from '../../agent';\nimport { datePickerAgent } from './date-picker.agent';\n\n/* -------------------------------------------------------------------------- */\n/* Imperative handle */\n/* -------------------------------------------------------------------------- */\n\n/** Curated imperative handle exposed via `ref` — also consumed by the agent adapter. */\nexport interface DatePickerHandle {\n /** Get the current selected date, or undefined. */\n getValue: () => Date | undefined;\n /** Set the selected date. */\n setValue: (date: Date | undefined) => void;\n /** Clear the selected date. */\n clear: () => void;\n /** Whether the popover is open. */\n isOpen: () => boolean;\n /** Open the calendar popover. */\n open: () => void;\n /** Close the calendar popover. */\n close: () => void;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Props */\n/* -------------------------------------------------------------------------- */\n\nexport interface DatePickerPreset {\n label: string;\n date: () => Date;\n}\n\nexport interface DatePickerProps extends Pick<\n VariantProps<typeof triggerVariants>,\n 'size'\n> {\n /** Current selected date — controlled. */\n value?: Date;\n /** Default selected date — uncontrolled. */\n defaultValue?: Date;\n /** Called when the selected date changes. */\n onChange?: (date: Date | undefined) => void;\n /** Minimum selectable date. */\n minDate?: Date;\n /** Maximum selectable date. */\n maxDate?: Date;\n /** Disabled dates — array or predicate. */\n disabledDates?: Date[] | ((date: Date) => boolean);\n /** Week starts on (0=Sunday). Derived from locale if not specified. */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n /** Quick-pick presets shown inline-start of the calendar. */\n presets?: DatePickerPreset[];\n /** Component size. */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Trigger chrome. `'input'` (default) is the soft input look — fill + the\n * `--shadow-input` halo — that matches other form fields. `'button'` renders\n * the trigger as an outline Button (flat, `--radius-md`, no halo, `md` = 40px)\n * so the picker sits flush among Buttons in a toolbar. Use `'button'` only in\n * toolbars, not in forms: the input halo is a11y-load-bearing (it lifts the\n * field border to the WCAG 1.4.11 3:1 composite), whereas a button-chrome\n * trigger relies on its value/label like a Button does. Mirrors\n * `DateRangePicker`'s prop of the same name.\n */\n chrome?: 'input' | 'button';\n /** Disabled state. */\n disabled?: boolean;\n /** Placeholder text. */\n placeholder?: string;\n /** Additional class names. */\n className?: string;\n /** id override. */\n id?: string;\n /** Accessible name for the date input, when the picker is NOT wrapped in a\n * `FormField`. Without one — and without a FormField's `<label htmlFor>` —\n * the input has no accessible name at all, so a picker placed inline beside\n * chips or in a toolbar was unnamed to a screen reader. Ignored in favour of\n * the FormField label when both are present. */\n 'aria-label'?: string;\n /** Accessible name by reference, same conditions as `aria-label`. */\n 'aria-labelledby'?: string;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------------- */\n\nexport const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(\n (\n {\n value,\n defaultValue,\n onChange,\n minDate,\n maxDate,\n disabledDates,\n weekStartsOn,\n presets,\n size = 'md',\n chrome = 'input',\n disabled,\n placeholder,\n className,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const ctx = useFormField();\n // A FormField labels the input through `<label htmlFor>`; outside one the\n // caller's aria-label is the only name available.\n const inFormField = useContext(FormFieldContext) !== null;\n const effectiveId = id ?? ctx.id;\n const effectiveDisabled = ctx.disabled || disabled;\n const effectiveTone = ctx.invalid ? 'error' : 'default';\n\n const locale = useDateFnsLocale(i18n.language);\n const dateFormat = getShortDateFormat(i18n.language);\n const placeholderText =\n placeholder ?? t('inputs.datePicker.placeholder', 'Select date');\n\n const [currentValueRaw, setDateValue] = useControllableState<\n Date | undefined\n >({\n value,\n defaultValue,\n onChange,\n });\n const currentValue = currentValueRaw;\n\n const [open, setOpen] = useState(false);\n const [inputText, setInputText] = useState(\n currentValue ? fnsFormat(currentValue, dateFormat, { locale }) : '',\n );\n const [inputInvalid, setInputInvalid] = useState(false);\n const [month, setMonth] = useState<Date>(currentValue ?? new Date());\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Sync input text when value changes externally\n useEffect(() => {\n if (currentValue) {\n setInputText(fnsFormat(currentValue, dateFormat, { locale }));\n setInputInvalid(false);\n } else {\n setInputText('');\n }\n }, [currentValue, dateFormat, locale]);\n\n const disabledMatcher = buildDisabledMatcher(\n minDate,\n maxDate,\n disabledDates,\n );\n\n /** Check if a date is disabled. */\n const isDateDisabled = useCallback(\n (date: Date): boolean => {\n if (minDate && isBefore(date, minDate)) return true;\n if (maxDate && isAfter(date, maxDate)) return true;\n if (Array.isArray(disabledDates)) {\n return disabledDates.some(\n (d) => d.toDateString() === date.toDateString(),\n );\n }\n if (typeof disabledDates === 'function') {\n return disabledDates(date);\n }\n return false;\n },\n [minDate, maxDate, disabledDates],\n );\n\n const emit = useCallback(\n (date: Date | undefined) => {\n setDateValue(date);\n },\n [setDateValue],\n );\n\n const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const text = e.target.value;\n setInputText(text);\n\n if (text.length === 0) {\n setInputInvalid(false);\n emit(undefined);\n return;\n }\n\n const parsed = fnsParse(text, dateFormat, new Date(), { locale });\n if (isValid(parsed) && !isDateDisabled(parsed)) {\n setInputInvalid(false);\n emit(parsed);\n setMonth(parsed);\n } else if (text.length === dateFormat.length) {\n setInputInvalid(true);\n }\n };\n\n const handleInputKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter' && open) {\n e.preventDefault();\n setOpen(false);\n }\n if (e.key === 'Escape' && open) {\n e.preventDefault();\n setOpen(false);\n }\n if (e.key === 'ArrowDown' && !open) {\n e.preventDefault();\n setOpen(true);\n }\n };\n\n const handleDaySelect = (date: Date | undefined) => {\n if (date) {\n emit(date);\n setOpen(false);\n inputRef.current?.focus();\n }\n };\n\n const handlePresetClick = (preset: DatePickerPreset) => {\n const date = preset.date();\n emit(date);\n setMonth(date);\n setOpen(false);\n inputRef.current?.focus();\n };\n\n // A preset is \"active\" when the selected date matches the one it produces,\n // so the shortcut and the highlighted day visibly agree.\n const isPresetActive = (preset: DatePickerPreset): boolean =>\n currentValue ? isSameDay(preset.date(), currentValue) : false;\n\n const gridLabel = t('inputs.datePicker.gridLabel', 'Calendar');\n\n const handle = useMemo<DatePickerHandle>(\n () => ({\n getValue: () => currentValue,\n setValue: (date) => emit(date),\n clear: () => emit(undefined),\n isOpen: () => open,\n open: () => setOpen(true),\n close: () => setOpen(false),\n }),\n [currentValue, emit, open],\n );\n\n const rootRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLDivElement, []);\n useAgentRegistration(datePickerAgent, handle, effectiveId);\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <div\n ref={rootRef}\n className={className}\n data-component=\"date-picker\"\n data-component-id={effectiveId}\n >\n <div className=\"ds:relative\">\n {/* `Popover.Trigger asChild` slots Radix's trigger props\n (including `type=\"button\"`, `aria-haspopup`,\n `aria-expanded`) onto the child element. We want those on\n the input, not the surrounding `<div>`, so the input is\n the direct asChild target and the icon sits as a sibling. */}\n <Popover.Trigger asChild disabled={effectiveDisabled}>\n <input\n ref={inputRef}\n id={effectiveId}\n type=\"text\"\n // ARIA 1.2 permits `role=\"combobox\"` on `<input>`. That's\n // what makes `aria-expanded` / `aria-controls` valid\n // here — the input acts as a combobox-style trigger\n // whose popup is the calendar dialog. `aria-haspopup=\"dialog\"`\n // replaces `aria-controls` for the dialog-popup pattern.\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"combobox\"\n value={inputText}\n placeholder={placeholderText}\n disabled={effectiveDisabled}\n // A FormField labels the input through `<label htmlFor>`, so\n // its label wins and these stay off. Outside one they are the\n // only name the input can have.\n aria-label={inFormField ? undefined : ariaLabel}\n aria-labelledby={inFormField ? undefined : ariaLabelledBy}\n aria-describedby={ctx.describedBy || undefined}\n aria-invalid={ctx.invalid || inputInvalid || undefined}\n aria-required={ctx.required || undefined}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onChange={handleInputChange}\n onKeyDown={handleInputKeyDown}\n onClick={() => !open && setOpen(true)}\n className={triggerVariants({\n size,\n tone: inputInvalid ? 'error' : effectiveTone,\n chrome,\n })}\n />\n </Popover.Trigger>\n <span aria-hidden=\"true\" className={calendarIconVariants({ size })}>\n <CalendarDays />\n </span>\n </div>\n\n <Popover.Portal>\n <Popover.Content\n sideOffset={4}\n align=\"start\"\n /* Portaled to <body>, i.e. OUTSIDE the trigger's\n [data-component] scope — without its own marker the panel\n misses the kit's `[data-component]` baselines (brand\n font-family, thin scrollbar, cascade protections) and\n renders in the host page's font. Same idiom as\n `select-content`. */\n data-component=\"date-picker-content\"\n className={popoverContentVariants()}\n onOpenAutoFocus={(e) => {\n // Keep focus on input, don't auto-focus the calendar\n e.preventDefault();\n }}\n >\n <div className=\"ds:flex ds:gap-[var(--spacing-md)]\">\n {/* Presets column */}\n {presets && presets.length > 0 ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:min-w-[8rem] ds:border-e ds:border-border ds:pe-[var(--spacing-md)]\">\n {presets.map((preset) => {\n const active = isPresetActive(preset);\n return (\n <button\n key={preset.label}\n type=\"button\"\n aria-pressed={active}\n onClick={() => handlePresetClick(preset)}\n className={presetButtonVariants({ active })}\n >\n <span className=\"ds:min-w-0 ds:truncate\">\n {preset.label}\n </span>\n {active ? (\n <Check\n aria-hidden=\"true\"\n className=\"ds:size-4 ds:shrink-0 ds:text-primary\"\n />\n ) : null}\n </button>\n );\n })}\n </div>\n ) : null}\n\n {/* Calendar */}\n <div role=\"region\" aria-label={gridLabel}>\n <DayPicker\n mode=\"single\"\n selected={currentValue}\n onSelect={handleDaySelect}\n month={month}\n onMonthChange={setMonth}\n disabled={disabledMatcher}\n weekStartsOn={weekStartsOn}\n locale={locale}\n showOutsideDays\n fixedWeeks\n classNames={calendarClassNames}\n components={{ Chevron: CalendarChevron }}\n />\n </div>\n </div>\n </Popover.Content>\n </Popover.Portal>\n </div>\n </Popover.Root>\n );\n },\n);\n\nDatePicker.displayName = 'DatePicker';\n"],"names":["datePickerAgent","handle","_a","args","DatePicker","forwardRef","value","defaultValue","onChange","minDate","maxDate","disabledDates","weekStartsOn","presets","size","chrome","disabled","placeholder","className","id","ariaLabel","ariaLabelledBy","ref","t","i18n","useTranslation","ctx","useFormField","inFormField","useContext","FormFieldContext","effectiveId","effectiveDisabled","effectiveTone","locale","useDateFnsLocale","dateFormat","getShortDateFormat","placeholderText","currentValueRaw","setDateValue","useControllableState","currentValue","open","setOpen","useState","inputText","setInputText","fnsFormat","inputInvalid","setInputInvalid","month","setMonth","inputRef","useRef","useEffect","disabledMatcher","buildDisabledMatcher","isDateDisabled","useCallback","date","isBefore","isAfter","d","emit","handleInputChange","text","parsed","fnsParse","isValid","handleInputKeyDown","handleDaySelect","handlePresetClick","preset","isPresetActive","isSameDay","gridLabel","useMemo","rootRef","useImperativeHandle","useAgentRegistration","Popover","jsxs","jsx","triggerVariants","calendarIconVariants","CalendarDays","popoverContentVariants","active","presetButtonVariants","Check","DayPicker","calendarClassNames","CalendarChevron"],"mappings":";;;;;;;;;;;;AAcO,MAAMA,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,iBAAiB,aAAa,QAAQ,OAAO;AAAA,EAC5D,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAA;;AAAW,iBAAAC,IAAAD,EAAO,SAAA,MAAP,gBAAAC,EAAmB,kBAAiB;AAAA;AAAA,IAAA;AAAA,IAExD,QAAQ;AAAA,MACN,MAAM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ar-range-fill)]", gs = "ds:size-[var(--min-target
|
|
|
1940
1940
|
// on the input chrome (tokens `--shadow-input`), so `input` stays default.
|
|
1941
1941
|
chrome: {
|
|
1942
1942
|
input: "ds:rounded-[var(--radius-sm)] ds:bg-input ds:shadow-[var(--shadow-input)]",
|
|
1943
|
-
button:
|
|
1943
|
+
button: (
|
|
1944
|
+
// font-medium matches the kit Button's base weight — a
|
|
1945
|
+
// button-chrome trigger sits among Buttons, and the regular-400
|
|
1946
|
+
// value read as a different face beside their medium labels.
|
|
1947
|
+
"ds:rounded-[var(--radius-md)] ds:bg-transparent ds:shadow-none ds:font-medium ds:hover:bg-muted/10 ds:active:bg-muted/20"
|
|
1948
|
+
)
|
|
1944
1949
|
}
|
|
1945
1950
|
},
|
|
1946
1951
|
compoundVariants: [
|
|
@@ -2086,4 +2091,4 @@ export {
|
|
|
2086
2091
|
mt as w,
|
|
2087
2092
|
Hn as x
|
|
2088
2093
|
};
|
|
2089
|
-
//# sourceMappingURL=date-picker-variants-
|
|
2094
|
+
//# sourceMappingURL=date-picker-variants-DfuooXEK.js.map
|