@alfadocs/ui-kit 1.3.13 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/_chunks/agenda-card.agent-Cb5tuEh3.js +28 -0
  2. package/dist/_chunks/{alia-sidebar-DzNz1gDf.js → alia-sidebar-DSBZMick.js} +3 -3
  3. package/dist/_chunks/{anamnesis-i18n-CfC0qYzy.js → anamnesis-i18n-BA631X4t.js} +2209 -2144
  4. package/dist/_chunks/{antenatal-schedule-timeline-BMMpi2lb.js → antenatal-schedule-timeline-u8TsS2QJ.js} +27 -26
  5. package/dist/_chunks/{appointment-timeline-B630OT_J.js → appointment-timeline-Bqf1sTU5.js} +2 -2
  6. package/dist/_chunks/{ar-THMLfSoN.js → ar-BR1FGFP2.js} +14 -14
  7. package/dist/_chunks/{bmi-calculator-CM0-G2mg.js → bmi-calculator-CpyY13MV.js} +2 -2
  8. package/dist/_chunks/{booking-DjNbd7C1.js → booking-BjsA7j1-.js} +699 -688
  9. package/dist/_chunks/calculator-dialog-12d3Sxaz.js +48 -0
  10. package/dist/_chunks/{care-plan-card-1G_f4I5s.js → care-plan-card-BvQy366X.js} +3 -3
  11. package/dist/_chunks/{care-plan-entry-card-DmBsffHS.js → care-plan-entry-card-apk_5B3O.js} +2 -2
  12. package/dist/_chunks/{chat-container-HlFnoEIl.js → chat-container-CYYego1W.js} +105 -81
  13. package/dist/_chunks/cycle-calculator-B7fyH-h4.js +425 -0
  14. package/dist/_chunks/{date-picker-ZHejTVAJ.js → date-picker-Bp64zk2p.js} +19 -19
  15. package/dist/_chunks/date-picker-variants-pKAJfnWr.js +2089 -0
  16. package/dist/_chunks/{date-range-picker-pEG3Ln3i.js → date-range-picker-CDrZ8Zh0.js} +27 -27
  17. package/dist/_chunks/{date-time-picker-695QvBGj.js → date-time-picker-DafkGDGO.js} +10 -10
  18. package/dist/_chunks/{de-DmZ-8rTN.js → de-3iM4rGqo.js} +7 -7
  19. package/dist/_chunks/{document-preview-D3gg4MXB.js → document-preview-DOrsqiN1.js} +2 -2
  20. package/dist/_chunks/due-date-calculator-CnkbbAej.js +571 -0
  21. package/dist/_chunks/{editor-overlay-DE3esyio.js → editor-overlay-B1tr2i7B.js} +22 -21
  22. package/dist/_chunks/{el-Bela9mxs.js → el-C96rGJvU.js} +2 -2
  23. package/dist/_chunks/{es-BNncHKex.js → es-Cxiqjx8r.js} +12 -12
  24. package/dist/_chunks/fetal-weight-avlj-l-S.js +223 -0
  25. package/dist/_chunks/format-4HNwNGrN.js +1315 -0
  26. package/dist/_chunks/{fr-CH8ADfhN.js → fr-Bhr6SYKj.js} +21 -21
  27. package/dist/_chunks/{freemium-paywall-C_Ue6wxU.js → freemium-paywall-DRDdWuOg.js} +3 -3
  28. package/dist/_chunks/gestational-age-calculator-BljY_DVJ.js +488 -0
  29. package/dist/_chunks/hcg-doubling-Cv_vH61p.js +312 -0
  30. package/dist/_chunks/header-settings-Cn5fPXCE.js +335 -0
  31. package/dist/_chunks/{hi-Bppfxp8l.js → hi-BxXX26d_.js} +12 -12
  32. package/dist/_chunks/isSameWeek-B73MagWB.js +13 -0
  33. package/dist/_chunks/{it-B4ySaRyK.js → it-Xmjomvyj.js} +24 -24
  34. package/dist/_chunks/{ja-CGF6Io9P.js → ja-mfZvt1ZV.js} +16 -16
  35. package/dist/_chunks/{link-cell-renderer-C5XLwVXQ.js → link-cell-renderer-CJ_gk7gl.js} +3 -3
  36. package/dist/_chunks/{locale-picker-BfBUdT1m.js → locale-picker-D9Kv2zrK.js} +153 -132
  37. package/dist/_chunks/map-view-2yZCQW2l.js +445 -0
  38. package/dist/_chunks/{marketplace-app-shell-DwcFMxzp.js → marketplace-app-shell-BLRvg-M0.js} +49 -40
  39. package/dist/_chunks/{nl-DuShqwuV.js → nl-DDs-KEnD.js} +15 -15
  40. package/dist/_chunks/{notes-panel-DPsgB4Mv.js → notes-panel-CiFN3sLW.js} +2 -2
  41. package/dist/_chunks/{number-input-DrozbZAU.js → number-input-DOe5VYei.js} +64 -64
  42. package/dist/_chunks/{optical-prescription-BDHJr8Zz.js → optical-prescription-CRemE8fL.js} +2 -2
  43. package/dist/_chunks/{parse-DvA97ro9.js → parse-JqixfsU0.js} +43 -43
  44. package/dist/_chunks/parseISO-fOGpHKXm.js +120 -0
  45. package/dist/_chunks/{patient-details-DqjjwPmt.js → patient-details-CpunD0qx.js} +3 -3
  46. package/dist/_chunks/{patient-table-BmIDrLIS.js → patient-table-2eWx-Rrk.js} +2 -2
  47. package/dist/_chunks/{payment-form-h-BZ8onk.js → payment-form-Ds1I9KqB.js} +308 -231
  48. package/dist/_chunks/{pdf-viewer-Ddx-T053.js → pdf-viewer-DUIsV9s5.js} +429 -369
  49. package/dist/_chunks/{pl-CKQwX9Fk.js → pl-BYYMnEWP.js} +18 -18
  50. package/dist/_chunks/{practice-results-B-HPc13W.js → practice-results-SjCniMd2.js} +2 -2
  51. package/dist/_chunks/pregnancy-dating-BmpHScZ0.js +770 -0
  52. package/dist/_chunks/pregnancy-weight-gain-B5KSJzdc.js +553 -0
  53. package/dist/_chunks/progress-CK8otcQ-.js +343 -0
  54. package/dist/_chunks/{pt-_njpXyOZ.js → pt-BSPnVrQ7.js} +20 -20
  55. package/dist/_chunks/{radiograph-panel.agent-BQZ64Riy.js → radiograph-panel.agent-CtFtNMzk.js} +3 -3
  56. package/dist/_chunks/{rich-text-editor-CfeXPPWs.js → rich-text-editor-BedTpWzL.js} +2 -2
  57. package/dist/_chunks/{ro-3X6_4FcN.js → ro-BbiylGmG.js} +14 -14
  58. package/dist/_chunks/{ru-bAcgmnS-.js → ru-BX_qsV67.js} +14 -14
  59. package/dist/_chunks/{session-countdown-Bc70VXN1.js → session-countdown-BL-Psg8u.js} +2 -2
  60. package/dist/_chunks/{sign-document-CW_ByDUh.js → sign-document-jF4fZDJ5.js} +2 -2
  61. package/dist/_chunks/slot-grid-DNiUcXy2.js +640 -0
  62. package/dist/_chunks/{sparkline-BTY4B5tv.js → sparkline-BmGcEyZO.js} +209 -164
  63. package/dist/_chunks/{sq-jYFqr4Ga.js → sq-i9UOk4P7.js} +10 -10
  64. package/dist/_chunks/subDays-CAUv47M1.js +8 -0
  65. package/dist/_chunks/{sv-BSGEJ-8B.js → sv-CpTdtmDQ.js} +8 -8
  66. package/dist/_chunks/{tab-bar-Axhk6xzx.js → tab-bar-BYESZINM.js} +83 -77
  67. package/dist/_chunks/task-card.agent-CF2N_uu4.js +29 -0
  68. package/dist/_chunks/{tr-CTpgUtw6.js → tr-DXG2QN1K.js} +17 -17
  69. package/dist/_chunks/{unit-converter-COgkN7YP.js → unit-converter-CHPDuV7W.js} +2 -2
  70. package/dist/_chunks/{warning-stack-BtjmJChC.js → warning-stack-B7t_8jRE.js} +42 -37
  71. package/dist/_chunks/{zh-CN-BgM0Io2O.js → zh-CN-vPkPEK6H.js} +18 -18
  72. package/dist/agent-catalog.json +6426 -3382
  73. package/dist/agent-i18n/en.json +234 -15
  74. package/dist/components/agenda-card/index.js +1 -1
  75. package/dist/components/appointment-timeline/index.js +1 -1
  76. package/dist/components/bmi-calculator/index.js +1 -1
  77. package/dist/components/booking/index.js +1 -1
  78. package/dist/components/calculator-dialog/index.js +1 -1
  79. package/dist/components/care-plan-card/index.js +1 -1
  80. package/dist/components/care-plan-entry-card/index.js +1 -1
  81. package/dist/components/chat-container/chat-container.d.ts +14 -0
  82. package/dist/components/chat-container/index.js +1 -1
  83. package/dist/components/cycle-calculator/cycle-calculator.agent.d.ts +4 -0
  84. package/dist/components/cycle-calculator/cycle-calculator.d.ts +42 -0
  85. package/dist/components/cycle-calculator/index.d.ts +1 -1
  86. package/dist/components/cycle-calculator/index.js +1 -1
  87. package/dist/components/data-table/index.js +1 -1
  88. package/dist/components/date-picker/index.js +1 -1
  89. package/dist/components/date-range-picker/index.js +1 -1
  90. package/dist/components/date-time-picker/index.js +1 -1
  91. package/dist/components/document-preview/index.js +1 -1
  92. package/dist/components/due-date-calculator/due-date-calculator.agent.d.ts +4 -0
  93. package/dist/components/due-date-calculator/due-date-calculator.d.ts +61 -1
  94. package/dist/components/due-date-calculator/index.d.ts +1 -1
  95. package/dist/components/due-date-calculator/index.js +2 -2
  96. package/dist/components/editor-overlay/editor-overlay.d.ts +7 -1
  97. package/dist/components/editor-overlay/index.js +1 -1
  98. package/dist/components/fetal-weight/fetal-weight.agent.d.ts +4 -0
  99. package/dist/components/fetal-weight/fetal-weight.d.ts +26 -0
  100. package/dist/components/fetal-weight/index.d.ts +1 -1
  101. package/dist/components/fetal-weight/index.js +1 -1
  102. package/dist/components/freemium-paywall/index.js +1 -1
  103. package/dist/components/gestational-age-calculator/gestational-age-calculator.agent.d.ts +4 -0
  104. package/dist/components/gestational-age-calculator/gestational-age-calculator.d.ts +44 -2
  105. package/dist/components/gestational-age-calculator/index.d.ts +1 -1
  106. package/dist/components/gestational-age-calculator/index.js +1 -1
  107. package/dist/components/hcg-doubling/hcg-doubling.agent.d.ts +4 -0
  108. package/dist/components/hcg-doubling/hcg-doubling.d.ts +30 -0
  109. package/dist/components/hcg-doubling/index.d.ts +1 -1
  110. package/dist/components/hcg-doubling/index.js +1 -1
  111. package/dist/components/header-settings/header-settings.d.ts +13 -1
  112. package/dist/components/header-settings/index.js +1 -1
  113. package/dist/components/locale-picker/index.js +1 -1
  114. package/dist/components/locale-picker/locale-picker.d.ts +9 -0
  115. package/dist/components/map-view/index.js +1 -1
  116. package/dist/components/map-view/map-view.d.ts +22 -0
  117. package/dist/components/notes-panel/index.js +1 -1
  118. package/dist/components/number-input/index.js +1 -1
  119. package/dist/components/number-input/number-input.d.ts +2 -1
  120. package/dist/components/optical-prescription/index.js +1 -1
  121. package/dist/components/patient-details/index.js +1 -1
  122. package/dist/components/patient-table/index.js +1 -1
  123. package/dist/components/payment-form/index.d.ts +1 -1
  124. package/dist/components/payment-form/index.js +1 -1
  125. package/dist/components/payment-form/payment-form.d.ts +32 -1
  126. package/dist/components/pdf-viewer/index.js +1 -1
  127. package/dist/components/pdf-viewer/pdf-viewer.d.ts +13 -0
  128. package/dist/components/practice-results/index.js +1 -1
  129. package/dist/components/pregnancy-dating/index.d.ts +1 -1
  130. package/dist/components/pregnancy-dating/index.js +1 -1
  131. package/dist/components/pregnancy-dating/pregnancy-dating.agent.d.ts +4 -0
  132. package/dist/components/pregnancy-dating/pregnancy-dating.d.ts +65 -1
  133. package/dist/components/pregnancy-weight-gain/index.d.ts +2 -1
  134. package/dist/components/pregnancy-weight-gain/index.js +6 -5
  135. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.agent.d.ts +4 -0
  136. package/dist/components/pregnancy-weight-gain/pregnancy-weight-gain.d.ts +35 -0
  137. package/dist/components/progress/index.js +1 -1
  138. package/dist/components/progress/progress.d.ts +13 -0
  139. package/dist/components/radiograph-panel/index.js +1 -1
  140. package/dist/components/rich-text-editor/index.js +1 -1
  141. package/dist/components/session-countdown/index.js +1 -1
  142. package/dist/components/sign-document/index.js +1 -1
  143. package/dist/components/slot-grid/index.d.ts +2 -1
  144. package/dist/components/slot-grid/index.js +5 -4
  145. package/dist/components/slot-grid/slot-grid.agent.d.ts +4 -0
  146. package/dist/components/slot-grid/slot-grid.d.ts +34 -0
  147. package/dist/components/sparkline/index.js +1 -1
  148. package/dist/components/sparkline/sparkline.d.ts +10 -0
  149. package/dist/components/tab-bar/index.js +1 -1
  150. package/dist/components/tab-bar/tab-bar.d.ts +13 -0
  151. package/dist/components/task-card/index.js +1 -1
  152. package/dist/components/unit-converter/index.js +1 -1
  153. package/dist/components/warning-stack/index.js +1 -1
  154. package/dist/index.js +630 -627
  155. package/dist/patterns/alia-assistant/index.js +1 -1
  156. package/dist/patterns/anamnesis/anamnesis-derive.d.ts +27 -8
  157. package/dist/patterns/anamnesis/anamnesis-format.d.ts +11 -3
  158. package/dist/patterns/anamnesis/anamnesis-highlight.d.ts +6 -0
  159. package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts +23 -9
  160. package/dist/patterns/anamnesis/anamnesis-types.d.ts +7 -0
  161. package/dist/patterns/anamnesis/anamnesis.d.ts +16 -7
  162. package/dist/patterns/anamnesis/index.d.ts +3 -2
  163. package/dist/patterns/anamnesis/index.js +7 -6
  164. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  165. package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +6 -0
  166. package/dist/tokens.css +1 -1
  167. package/package.json +1 -1
  168. package/dist/_chunks/agenda-card.agent-mTCrkKSZ.js +0 -27
  169. package/dist/_chunks/calculator-dialog-DuXMQSdm.js +0 -40
  170. package/dist/_chunks/cycle-calculator-BwqYVPB4.js +0 -252
  171. package/dist/_chunks/date-picker-variants-eL6HjWvw.js +0 -3363
  172. package/dist/_chunks/due-date-calculator-CwfsFd3T.js +0 -256
  173. package/dist/_chunks/fetal-weight-ePlLjJPc.js +0 -122
  174. package/dist/_chunks/gestational-age-calculator-DdgbH69Z.js +0 -311
  175. package/dist/_chunks/hcg-doubling-BBqD2wI2.js +0 -170
  176. package/dist/_chunks/header-settings--pjYOe6g.js +0 -284
  177. package/dist/_chunks/isSameDay-DUEiAT0G.js +0 -39
  178. package/dist/_chunks/isSameWeek-CK4HS9lH.js +0 -14
  179. package/dist/_chunks/map-view-CsaHfoo6.js +0 -378
  180. package/dist/_chunks/pregnancy-dating-DzYTlBkT.js +0 -421
  181. package/dist/_chunks/pregnancy-weight-gain-O6J0sUIi.js +0 -322
  182. package/dist/_chunks/progress-DA413-zn.js +0 -299
  183. package/dist/_chunks/slot-grid-CQSULZjd.js +0 -502
  184. package/dist/_chunks/subDays-BcNi04uf.js +0 -8
  185. package/dist/_chunks/task-card.agent-Bt14CzUd.js +0 -25
@@ -0,0 +1,425 @@
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as G, useState as N, useMemo as x, useEffect as K, useRef as j } from "react";
3
+ import { c as q } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as z } from "react-i18next";
5
+ import { u as B } from "./registry-DvAUVLHh.js";
6
+ import { F as S } from "./form-field-M5UpX65Z.js";
7
+ import { D as Y } from "./date-picker-Bp64zk2p.js";
8
+ import { N as H } from "./number-input-DOe5VYei.js";
9
+ import { C as M } from "./card-DPmk26CL.js";
10
+ import { B as T } from "./badge-DCOqV9mI.js";
11
+ import { I as U } from "./insert-result-D074GtHX.js";
12
+ import { a as m, c as V } from "./date-picker-variants-pKAJfnWr.js";
13
+ import { C as J } from "./check-DrFSN__t.js";
14
+ import { H as Q } from "./heart--qCA4ffe.js";
15
+ import { c as X } from "./createLucideIcon-DhHxpK9K.js";
16
+ import { p as Z } from "./parseISO-fOGpHKXm.js";
17
+ import { f as ee } from "./format-4HNwNGrN.js";
18
+ /**
19
+ * @license lucide-react v1.22.0 - ISC
20
+ *
21
+ * This source code is licensed under the ISC license.
22
+ * See the LICENSE file in the root directory of this source tree.
23
+ */
24
+ const te = [
25
+ [
26
+ "path",
27
+ {
28
+ 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",
29
+ key: "c7niix"
30
+ }
31
+ ]
32
+ ], re = X("droplet", te), ae = {
33
+ type: "string",
34
+ pattern: "^\\d{4}-\\d{2}-\\d{2}$"
35
+ }, ne = {
36
+ id: "cycle-calculator",
37
+ // set_value → the three `set_*` actions + the `inputs` state slot.
38
+ capabilities: ["set_value"],
39
+ state: {
40
+ inputs: {
41
+ type: "{ lastPeriodStart: string | null, cycleLength: number | null, periodLength: number | null }",
42
+ descriptionKey: "ui.agent.cycleCalculator.state.inputs",
43
+ description: "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.",
44
+ read: (e) => e.getInputs()
45
+ },
46
+ result: {
47
+ type: "{ ovulation: string, fertileWindow: { start: string, end: string }, nextPeriod: string, periodRange: { start: string, end: string } | null, upcomingPeriods: string[] } | null",
48
+ descriptionKey: "ui.agent.cycleCalculator.state.result",
49
+ description: "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.",
50
+ read: (e) => e.getResult()
51
+ }
52
+ },
53
+ actions: {
54
+ set_last_period: {
55
+ // Drives the same local input state a user types into; nothing is
56
+ // persisted to a record, and the value is reversible in the same UI.
57
+ safety: "write",
58
+ argsType: "{ date: string | null }",
59
+ argsSchema: {
60
+ type: "object",
61
+ properties: {
62
+ date: {
63
+ oneOf: [
64
+ { ...ae, description: "Local calendar date, `yyyy-MM-dd`." },
65
+ { type: "null" }
66
+ ],
67
+ description: "Start date of the last period, or null to clear it. Must not be in the future."
68
+ }
69
+ },
70
+ required: ["date"],
71
+ additionalProperties: !1
72
+ },
73
+ idempotent: !0,
74
+ returns: "boolean",
75
+ returnsSchema: {
76
+ type: "boolean",
77
+ description: "True when the date was applied."
78
+ },
79
+ errors: [
80
+ "Returns false for an unparseable date or a date in the future — the on-screen DatePicker caps at today."
81
+ ],
82
+ examples: [
83
+ { args: { date: "2026-08-01" }, note: "Last period started 1 August." }
84
+ ],
85
+ descriptionKey: "ui.agent.cycleCalculator.actions.setLastPeriod",
86
+ description: "Set the start date of the last period. This is the only required input — the prediction stays null without it.",
87
+ invoke: (e, n) => e.setLastPeriod(n.date)
88
+ },
89
+ set_cycle_length: {
90
+ safety: "write",
91
+ argsType: "{ days: number | null }",
92
+ argsSchema: {
93
+ type: "object",
94
+ properties: {
95
+ days: {
96
+ oneOf: [
97
+ { type: "integer", minimum: 20, maximum: 45 },
98
+ { type: "null" }
99
+ ],
100
+ description: "Average cycle length in days (20–45), or null to fall back to the 28-day default."
101
+ }
102
+ },
103
+ required: ["days"],
104
+ additionalProperties: !1
105
+ },
106
+ idempotent: !0,
107
+ returns: "boolean",
108
+ returnsSchema: {
109
+ type: "boolean",
110
+ description: "True when the value was applied."
111
+ },
112
+ errors: [
113
+ "Returns false outside 20–45 days — the same bounds the on-screen NumberInput enforces."
114
+ ],
115
+ descriptionKey: "ui.agent.cycleCalculator.actions.setCycleLength",
116
+ description: "Set the average cycle length in days. Shifts ovulation, the fertile window and every upcoming period.",
117
+ invoke: (e, n) => e.setCycleLength(n.days)
118
+ },
119
+ set_period_length: {
120
+ safety: "write",
121
+ argsType: "{ days: number | null }",
122
+ argsSchema: {
123
+ type: "object",
124
+ properties: {
125
+ days: {
126
+ oneOf: [
127
+ { type: "integer", minimum: 1, maximum: 14 },
128
+ { type: "null" }
129
+ ],
130
+ description: "Period (bleed) length in days (1–14), or null to omit the bleed range."
131
+ }
132
+ },
133
+ required: ["days"],
134
+ additionalProperties: !1
135
+ },
136
+ idempotent: !0,
137
+ returns: "boolean",
138
+ returnsSchema: {
139
+ type: "boolean",
140
+ description: "True when the value was applied."
141
+ },
142
+ errors: [
143
+ "Returns false outside 1–14 days — the same bounds the on-screen NumberInput enforces."
144
+ ],
145
+ descriptionKey: "ui.agent.cycleCalculator.actions.setPeriodLength",
146
+ description: "Set the period (bleed) length in days. Optional — it only adds the current bleed range to the result.",
147
+ invoke: (e, n) => e.setPeriodLength(n.days)
148
+ }
149
+ },
150
+ domHooks: {
151
+ root: {
152
+ attr: "data-component",
153
+ value: "cycle-calculator",
154
+ description: "Marks the CycleCalculator wrapper."
155
+ },
156
+ instanceId: {
157
+ attr: "data-component-id",
158
+ sourceProp: "id",
159
+ description: "Sourced from the id prop. Also the registry key — without an `id` the instance does not register and only the DOM channel works."
160
+ }
161
+ }
162
+ }, D = 28, ie = 14, le = 1;
163
+ function se(e, n = 3) {
164
+ const o = e.cycleLength ?? D, { lastPeriodStart: d } = e, g = m(d, o - ie), v = {
165
+ start: m(g, -5),
166
+ end: m(g, le)
167
+ }, b = m(d, o), f = Array.from(
168
+ { length: n },
169
+ (E, C) => m(d, o * (C + 1))
170
+ ), L = e.periodLength && e.periodLength > 0 ? {
171
+ start: d,
172
+ end: m(d, e.periodLength - 1)
173
+ } : null;
174
+ return { nextPeriod: b, ovulation: g, fertileWindow: v, upcomingPeriods: f, periodRange: L };
175
+ }
176
+ const oe = q("ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", {
177
+ variants: {
178
+ width: { full: "ds:w-full", auto: "ds:inline-flex" }
179
+ },
180
+ defaultVariants: { width: "full" }
181
+ }), de = "--accent", c = (e) => ee(e, "yyyy-MM-dd"), ce = (e) => {
182
+ const n = Z(e);
183
+ return Number.isNaN(n.getTime()) ? null : n;
184
+ }, _ = { min: 20, max: 45 }, R = { min: 1, max: 14 }, W = (e, { min: n, max: o }) => e === null || Number.isFinite(e) && e >= n && e <= o, ue = G(
185
+ ({
186
+ defaultCycleLength: e = D,
187
+ onResultChange: n,
188
+ onInsert: o,
189
+ insertVariant: d = "insert",
190
+ onCopy: g,
191
+ onError: v,
192
+ insertBrand: b,
193
+ id: f,
194
+ width: L,
195
+ className: E
196
+ }, C) => {
197
+ const { t: i, i18n: I } = z(), [u, P] = N(void 0), [y, A] = N(
198
+ e
199
+ ), [h, k] = N(null), a = x(() => u ? se({
200
+ lastPeriodStart: u,
201
+ cycleLength: y ?? D,
202
+ periodLength: h ?? void 0
203
+ }) : null, [u, y, h]), F = x(
204
+ () => new Intl.DateTimeFormat(I.language, { dateStyle: "medium" }),
205
+ [I.language]
206
+ );
207
+ K(() => {
208
+ n == null || n(a);
209
+ }, [a, n]);
210
+ const $ = x(() => /* @__PURE__ */ new Date(), []), p = j({ lastPeriod: u, cycleLength: y, periodLength: h, result: a });
211
+ p.current = { lastPeriod: u, cycleLength: y, periodLength: h, result: a };
212
+ const O = x(
213
+ () => ({
214
+ getInputs: () => ({
215
+ lastPeriodStart: p.current.lastPeriod ? c(p.current.lastPeriod) : null,
216
+ cycleLength: p.current.cycleLength,
217
+ periodLength: p.current.periodLength
218
+ }),
219
+ getResult: () => {
220
+ const r = p.current.result;
221
+ return r ? {
222
+ ovulation: c(r.ovulation),
223
+ fertileWindow: {
224
+ start: c(r.fertileWindow.start),
225
+ end: c(r.fertileWindow.end)
226
+ },
227
+ nextPeriod: c(r.nextPeriod),
228
+ periodRange: r.periodRange ? {
229
+ start: c(r.periodRange.start),
230
+ end: c(r.periodRange.end)
231
+ } : null,
232
+ upcomingPeriods: r.upcomingPeriods.map(c)
233
+ } : null;
234
+ },
235
+ setLastPeriod: (r) => {
236
+ if (r === null)
237
+ return P(void 0), !0;
238
+ const w = ce(r);
239
+ return !w || V(w, /* @__PURE__ */ new Date()) ? !1 : (P(w), !0);
240
+ },
241
+ setCycleLength: (r) => W(r, _) ? (A(r), !0) : !1,
242
+ setPeriodLength: (r) => W(r, R) ? (k(r), !0) : !1
243
+ }),
244
+ []
245
+ );
246
+ B(ne, O, f);
247
+ const l = (r) => F.format(r);
248
+ return /* @__PURE__ */ s(
249
+ "div",
250
+ {
251
+ ref: C,
252
+ "data-component": "cycle-calculator",
253
+ "data-component-id": f,
254
+ className: oe({ width: L, className: E }),
255
+ children: [
256
+ /* @__PURE__ */ s("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-2", children: [
257
+ /* @__PURE__ */ t(S, { label: i("cycleCalculator.lastPeriod"), children: /* @__PURE__ */ t(
258
+ Y,
259
+ {
260
+ value: u,
261
+ onChange: P,
262
+ maxDate: $
263
+ }
264
+ ) }),
265
+ /* @__PURE__ */ t(
266
+ S,
267
+ {
268
+ label: i("cycleCalculator.cycleLength"),
269
+ description: i("cycleCalculator.cycleLengthHint"),
270
+ children: /* @__PURE__ */ t(
271
+ H,
272
+ {
273
+ mode: "integer",
274
+ min: _.min,
275
+ max: _.max,
276
+ value: y,
277
+ onChange: A
278
+ }
279
+ )
280
+ }
281
+ ),
282
+ /* @__PURE__ */ t(
283
+ S,
284
+ {
285
+ label: i("cycleCalculator.periodLength"),
286
+ description: i("cycleCalculator.periodLengthHint"),
287
+ children: /* @__PURE__ */ t(
288
+ H,
289
+ {
290
+ mode: "integer",
291
+ min: R.min,
292
+ max: R.max,
293
+ value: h,
294
+ onChange: k
295
+ }
296
+ )
297
+ }
298
+ )
299
+ ] }),
300
+ /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: a ? `${i("cycleCalculator.ovulation")}: ${l(a.ovulation)}. ${i(
301
+ "cycleCalculator.nextPeriod"
302
+ )}: ${l(a.nextPeriod)}.` : "" }),
303
+ a ? /* @__PURE__ */ t(M, { variant: "elevated", children: /* @__PURE__ */ s(M.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
304
+ /* @__PURE__ */ s("dl", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:sm:grid-cols-3", children: [
305
+ /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center", children: [
306
+ /* @__PURE__ */ t("dt", { className: "type-label ds:text-muted-foreground", children: i("cycleCalculator.ovulation") }),
307
+ /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t(
308
+ T,
309
+ {
310
+ variant: "success",
311
+ size: "lg",
312
+ leading: /* @__PURE__ */ t(J, { "aria-hidden": !0 }),
313
+ children: l(a.ovulation)
314
+ }
315
+ ) })
316
+ ] }),
317
+ /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center", children: [
318
+ /* @__PURE__ */ t("dt", { className: "type-label ds:text-muted-foreground", children: i("cycleCalculator.fertileWindow") }),
319
+ /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ s(
320
+ T,
321
+ {
322
+ variant: "accent",
323
+ size: "lg",
324
+ leading: /* @__PURE__ */ t(Q, { "aria-hidden": !0 }),
325
+ children: [
326
+ l(a.fertileWindow.start),
327
+ " –",
328
+ " ",
329
+ l(a.fertileWindow.end)
330
+ ]
331
+ }
332
+ ) })
333
+ ] }),
334
+ /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:text-center", children: [
335
+ /* @__PURE__ */ t("dt", { className: "type-label ds:text-muted-foreground", children: i("cycleCalculator.nextPeriod") }),
336
+ /* @__PURE__ */ t("dd", { children: /* @__PURE__ */ t(
337
+ T,
338
+ {
339
+ variant: "error",
340
+ size: "lg",
341
+ leading: /* @__PURE__ */ t(re, { "aria-hidden": !0 }),
342
+ children: l(a.nextPeriod)
343
+ }
344
+ ) })
345
+ ] })
346
+ ] }),
347
+ a.periodRange ? /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]", children: [
348
+ /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: i("cycleCalculator.periodRange") }),
349
+ /* @__PURE__ */ s("span", { className: "type-body ds:text-foreground", children: [
350
+ l(a.periodRange.start),
351
+ " –",
352
+ " ",
353
+ l(a.periodRange.end)
354
+ ] })
355
+ ] }) : null,
356
+ /* @__PURE__ */ s("div", { className: "ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-2xs)]", children: [
357
+ /* @__PURE__ */ t("span", { className: "type-label ds:text-muted-foreground", children: i("cycleCalculator.upcomingPeriods") }),
358
+ /* @__PURE__ */ t("ul", { className: "ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-2xs)]", children: a.upcomingPeriods.map((r) => /* @__PURE__ */ t(
359
+ "li",
360
+ {
361
+ className: "type-body ds:text-foreground",
362
+ children: l(r)
363
+ },
364
+ r.getTime()
365
+ )) })
366
+ ] }),
367
+ d === "copy" || o ? /* @__PURE__ */ t(
368
+ U,
369
+ {
370
+ onInsert: o,
371
+ variant: d,
372
+ onCopy: g,
373
+ onError: v,
374
+ card: {
375
+ title: i("insert.title.cycle"),
376
+ icon: "heart",
377
+ highlight: `${l(a.fertileWindow.start)} – ${l(
378
+ a.fertileWindow.end
379
+ )}`,
380
+ // Chip reuses the on-screen fertile-window badge's accent
381
+ // token so the inserted PNG chip matches the screen.
382
+ highlightToken: de,
383
+ brand: b,
384
+ fields: [
385
+ {
386
+ // Ovulation is a predicted date → calendar glyph (the
387
+ // on-screen badge uses a Check tick, which ICON_GEOMETRY
388
+ // does not carry, so the calendar reads the date meaning).
389
+ icon: "calendar",
390
+ label: i("cycleCalculator.ovulation"),
391
+ value: l(a.ovulation)
392
+ },
393
+ {
394
+ // Fertile window → heart glyph, matching the on-screen
395
+ // fertile-window badge's Heart icon.
396
+ icon: "heart",
397
+ label: i("cycleCalculator.fertileWindow"),
398
+ value: `${l(a.fertileWindow.start)} – ${l(
399
+ a.fertileWindow.end
400
+ )}`
401
+ },
402
+ {
403
+ // Next period → droplets glyph, matching the on-screen
404
+ // next-period badge's Droplet icon.
405
+ icon: "droplets",
406
+ label: i("cycleCalculator.nextPeriod"),
407
+ value: l(a.nextPeriod)
408
+ }
409
+ ]
410
+ }
411
+ }
412
+ ) : null
413
+ ] }) }) : /* @__PURE__ */ t("p", { className: "type-body ds:text-muted-foreground", children: i("cycleCalculator.empty") })
414
+ ]
415
+ }
416
+ );
417
+ }
418
+ );
419
+ ue.displayName = "CycleCalculator";
420
+ export {
421
+ ue as C,
422
+ ie as L,
423
+ se as p
424
+ };
425
+ //# sourceMappingURL=cycle-calculator-B7fyH-h4.js.map
@@ -1,15 +1,15 @@
1
1
  import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
2
  import { forwardRef as se, useContext as ie, useState as y, useRef as K, useEffect as oe, useCallback as R, useMemo as le, useImperativeHandle as de } from "react";
3
3
  import { useTranslation as ce } from "react-i18next";
4
- import * as k from "@radix-ui/react-popover";
4
+ import * as b from "@radix-ui/react-popover";
5
5
  import { u as pe } from "./use-controllable-state-BiY4xTzM.js";
6
6
  import { u as ue, F as fe } from "./form-field-context-B3APVHKx.js";
7
7
  import { u as me } from "./registry-DvAUVLHh.js";
8
- import { u as he, g as ge, f as T, b as ve, c as ye, i as ke, t as be, d as Ce, p as De, D as Pe, C as Se, e as xe, h as we, j as Ie } from "./date-picker-variants-eL6HjWvw.js";
9
- import { C as Oe } from "./calendar-days-BGWklvE-.js";
10
- import { C as Ne } from "./check-DrFSN__t.js";
11
- import { p as Ve } from "./parse-DvA97ro9.js";
12
- import { i as Fe } from "./isSameDay-DUEiAT0G.js";
8
+ import { u as he, g as ge, b as ve, i as ye, c as be, t as ke, d as Ce, p as De, D as Pe, C as Se, e as xe, f as we } from "./date-picker-variants-pKAJfnWr.js";
9
+ import { f as T, i as Ie, b as Oe } from "./format-4HNwNGrN.js";
10
+ import { C as Ne } from "./calendar-days-BGWklvE-.js";
11
+ import { C as Ve } from "./check-DrFSN__t.js";
12
+ import { p as Fe } from "./parse-JqixfsU0.js";
13
13
  const Ae = {
14
14
  id: "date-picker",
15
15
  // Persisted single date (value state + set_date) → select_single + set_value,
@@ -105,7 +105,7 @@ const Ae = {
105
105
  maxDate: h,
106
106
  disabledDates: c,
107
107
  weekStartsOn: j,
108
- presets: b,
108
+ presets: k,
109
109
  size: x = "md",
110
110
  disabled: q,
111
111
  placeholder: B,
@@ -129,7 +129,7 @@ const Ae = {
129
129
  h,
130
130
  c
131
131
  ), Y = R(
132
- (e) => m && ye(e, m) || h && ke(e, h) ? !0 : Array.isArray(c) ? c.some(
132
+ (e) => m && ye(e, m) || h && be(e, h) ? !0 : Array.isArray(c) ? c.some(
133
133
  (t) => t.toDateString() === e.toDateString()
134
134
  ) : typeof c == "function" ? c(e) : !1,
135
135
  [m, h, c]
@@ -144,7 +144,7 @@ const Ae = {
144
144
  g(!1), o(void 0);
145
145
  return;
146
146
  }
147
- const l = Ve(t, f, /* @__PURE__ */ new Date(), { locale: u });
147
+ const l = Fe(t, f, /* @__PURE__ */ new Date(), { locale: u });
148
148
  Ie(l) && !Y(l) ? (g(!1), o(l), P(l)) : t.length === f.length && g(!0);
149
149
  }, $ = (e) => {
150
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));
@@ -155,7 +155,7 @@ const Ae = {
155
155
  var l;
156
156
  const t = e.date();
157
157
  o(t), P(t), s(!1), (l = S.current) == null || l.focus();
158
- }, ae = (e) => n ? Fe(e.date(), n) : !1, re = w("inputs.datePicker.gridLabel", "Calendar"), ne = le(
158
+ }, ae = (e) => n ? Oe(e.date(), n) : !1, re = w("inputs.datePicker.gridLabel", "Calendar"), ne = le(
159
159
  () => ({
160
160
  getValue: () => n,
161
161
  setValue: (e) => o(e),
@@ -166,7 +166,7 @@ const Ae = {
166
166
  }),
167
167
  [n, o, i]
168
168
  ), A = K(null);
169
- return de(W, () => A.current, []), me(Ae, ne, C), /* @__PURE__ */ r(k.Root, { open: i, onOpenChange: s, children: /* @__PURE__ */ v(
169
+ return de(W, () => A.current, []), me(Ae, ne, C), /* @__PURE__ */ r(b.Root, { open: i, onOpenChange: s, children: /* @__PURE__ */ v(
170
170
  "div",
171
171
  {
172
172
  ref: A,
@@ -175,7 +175,7 @@ const Ae = {
175
175
  "data-component-id": C,
176
176
  children: [
177
177
  /* @__PURE__ */ v("div", { className: "ds:relative", children: [
178
- /* @__PURE__ */ r(k.Trigger, { asChild: !0, disabled: N, children: /* @__PURE__ */ r(
178
+ /* @__PURE__ */ r(b.Trigger, { asChild: !0, disabled: N, children: /* @__PURE__ */ r(
179
179
  "input",
180
180
  {
181
181
  ref: S,
@@ -195,16 +195,16 @@ const Ae = {
195
195
  onChange: Z,
196
196
  onKeyDown: $,
197
197
  onClick: () => !i && s(!0),
198
- className: be({
198
+ className: ke({
199
199
  size: x,
200
200
  tone: F ? "error" : J
201
201
  })
202
202
  }
203
203
  ) }),
204
- /* @__PURE__ */ r("span", { "aria-hidden": "true", className: Ce({ size: x }), children: /* @__PURE__ */ r(Oe, {}) })
204
+ /* @__PURE__ */ r("span", { "aria-hidden": "true", className: Ce({ size: x }), children: /* @__PURE__ */ r(Ne, {}) })
205
205
  ] }),
206
- /* @__PURE__ */ r(k.Portal, { children: /* @__PURE__ */ r(
207
- k.Content,
206
+ /* @__PURE__ */ r(b.Portal, { children: /* @__PURE__ */ r(
207
+ b.Content,
208
208
  {
209
209
  sideOffset: 4,
210
210
  align: "start",
@@ -213,7 +213,7 @@ const Ae = {
213
213
  e.preventDefault();
214
214
  },
215
215
  children: /* @__PURE__ */ v("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
216
- 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) => {
216
+ k && k.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: k.map((e) => {
217
217
  const t = ae(e);
218
218
  return /* @__PURE__ */ v(
219
219
  "button",
@@ -225,7 +225,7 @@ const Ae = {
225
225
  children: [
226
226
  /* @__PURE__ */ r("span", { className: "ds:min-w-0 ds:truncate", children: e.label }),
227
227
  t ? /* @__PURE__ */ r(
228
- Ne,
228
+ Ve,
229
229
  {
230
230
  "aria-hidden": "true",
231
231
  className: "ds:size-4 ds:shrink-0 ds:text-primary"
@@ -266,4 +266,4 @@ export {
266
266
  Ke as D,
267
267
  Ae as d
268
268
  };
269
- //# sourceMappingURL=date-picker-ZHejTVAJ.js.map
269
+ //# sourceMappingURL=date-picker-Bp64zk2p.js.map