@alfadocs/ui-kit 0.88.1 → 0.93.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 (118) hide show
  1. package/dist/_chunks/{antenatal-schedule-timeline-BzJZqS-8.js → antenatal-schedule-timeline-BMMpi2lb.js} +17 -17
  2. package/dist/_chunks/{appointment-timeline-DQTG0btW.js → appointment-timeline-BB-c1LeR.js} +2 -2
  3. package/dist/_chunks/{ar-B1GhtlBP.js → ar-THMLfSoN.js} +22 -22
  4. package/dist/_chunks/{booking-BvCu2XWY.js → booking-BSpSMmJ2.js} +4 -4
  5. package/dist/_chunks/{cycle-calculator-OQp8Ik5U.js → cycle-calculator-DNvvr0bP.js} +3 -3
  6. package/dist/_chunks/date-picker-BP_W6VtE.js +265 -0
  7. package/dist/_chunks/{date-picker-variants-CYQAm1Gk.js → date-picker-variants-eL6HjWvw.js} +985 -847
  8. package/dist/_chunks/date-range-picker-Cc4DLAL2.js +824 -0
  9. package/dist/_chunks/{date-time-picker-B5IpU-nd.js → date-time-picker-695QvBGj.js} +2 -2
  10. package/dist/_chunks/{de-DETDHQ0o.js → de-DmZ-8rTN.js} +4 -4
  11. package/dist/_chunks/{due-date-calculator-DASNRgnH.js → due-date-calculator-BEcdoy_E.js} +3 -3
  12. package/dist/_chunks/{el-HV3jOI0z.js → el-Bela9mxs.js} +6 -6
  13. package/dist/_chunks/{es-Dpo7Olwo.js → es-BNncHKex.js} +10 -10
  14. package/dist/_chunks/{fr-CgD4Jvtq.js → fr-CH8ADfhN.js} +12 -12
  15. package/dist/_chunks/{gestational-age-calculator-BpYw-WF-.js → gestational-age-calculator-CuGkVqKp.js} +5 -5
  16. package/dist/_chunks/{hcg-doubling-Dqj-EqMT.js → hcg-doubling-fZ6qQN08.js} +2 -2
  17. package/dist/_chunks/{hi-Bf8CAP6b.js → hi-Bppfxp8l.js} +16 -16
  18. package/dist/_chunks/{isSameWeek-BYl5poz_.js → isSameWeek-CK4HS9lH.js} +2 -2
  19. package/dist/_chunks/{it-mt1V2DFS.js → it-B4ySaRyK.js} +24 -24
  20. package/dist/_chunks/{ja-CbOHn2TO.js → ja-CGF6Io9P.js} +12 -12
  21. package/dist/_chunks/{link-cell-renderer-BQGUs45d.js → link-cell-renderer-DQjZeoAr.js} +214 -197
  22. package/dist/_chunks/{nl-C6Y0QXnm.js → nl-DuShqwuV.js} +12 -12
  23. package/dist/_chunks/parse-DvA97ro9.js +1601 -0
  24. package/dist/_chunks/{patient-details-B9LCdyWW.js → patient-details-DrhlTrLf.js} +2 -2
  25. package/dist/_chunks/{patient-table-B6AKMTm3.js → patient-table-DU_zFZoq.js} +2 -2
  26. package/dist/_chunks/{pl-BdazJAOp.js → pl-CKQwX9Fk.js} +22 -22
  27. package/dist/_chunks/{pregnancy-dating-msMl_6wz.js → pregnancy-dating-BdFl-rB1.js} +5 -5
  28. package/dist/_chunks/{pt-B3UKvhHp.js → pt-_njpXyOZ.js} +16 -16
  29. package/dist/_chunks/{radiograph-panel.agent-M9XD4ze4.js → radiograph-panel.agent-rnrQZtK3.js} +3 -3
  30. package/dist/_chunks/{ro-DVTEQpPK.js → ro-3X6_4FcN.js} +14 -14
  31. package/dist/_chunks/{ru-C-Mp40SC.js → ru-bAcgmnS-.js} +20 -20
  32. package/dist/_chunks/{sq-DierVlw-.js → sq-jYFqr4Ga.js} +6 -6
  33. package/dist/_chunks/subDays-BcNi04uf.js +8 -0
  34. package/dist/_chunks/{sv-gQWo_19z.js → sv-BSGEJ-8B.js} +10 -10
  35. package/dist/_chunks/{tr-Btm6M3Km.js → tr-CTpgUtw6.js} +14 -14
  36. package/dist/_chunks/{zh-CN-DkVN4vsB.js → zh-CN-BgM0Io2O.js} +22 -22
  37. package/dist/agent-catalog.json +93 -2
  38. package/dist/agent-i18n/en.json +8 -2
  39. package/dist/components/_shared/calendar-class-names.d.ts +5 -0
  40. package/dist/components/_shared/date-picker-variants.d.ts +24 -1
  41. package/dist/components/_shared/index.d.ts +2 -2
  42. package/dist/components/appointment-timeline/index.js +1 -1
  43. package/dist/components/booking/index.js +1 -1
  44. package/dist/components/cycle-calculator/index.js +1 -1
  45. package/dist/components/data-table/filters/date-range-filter.d.ts +13 -0
  46. package/dist/components/data-table/index.js +1 -1
  47. package/dist/components/date-picker/index.js +1 -1
  48. package/dist/components/date-range-picker/date-range-picker.d.ts +89 -1
  49. package/dist/components/date-range-picker/index.d.ts +1 -1
  50. package/dist/components/date-range-picker/index.js +1 -1
  51. package/dist/components/date-time-picker/index.js +1 -1
  52. package/dist/components/due-date-calculator/index.js +2 -2
  53. package/dist/components/gestational-age-calculator/index.js +1 -1
  54. package/dist/components/hcg-doubling/index.js +1 -1
  55. package/dist/components/patient-details/index.js +1 -1
  56. package/dist/components/patient-table/index.js +1 -1
  57. package/dist/components/pregnancy-dating/index.js +1 -1
  58. package/dist/components/radiograph-panel/index.js +1 -1
  59. package/dist/i18n/locales/ar.d.ts +24 -0
  60. package/dist/i18n/locales/ar.js +24 -0
  61. package/dist/i18n/locales/de.d.ts +24 -0
  62. package/dist/i18n/locales/de.js +24 -0
  63. package/dist/i18n/locales/el.d.ts +24 -0
  64. package/dist/i18n/locales/el.js +24 -0
  65. package/dist/i18n/locales/en.d.ts +24 -0
  66. package/dist/i18n/locales/en.js +24 -0
  67. package/dist/i18n/locales/es.d.ts +24 -0
  68. package/dist/i18n/locales/es.js +24 -0
  69. package/dist/i18n/locales/fr.d.ts +24 -0
  70. package/dist/i18n/locales/fr.js +24 -0
  71. package/dist/i18n/locales/hi.d.ts +24 -0
  72. package/dist/i18n/locales/hi.js +24 -0
  73. package/dist/i18n/locales/it.d.ts +24 -0
  74. package/dist/i18n/locales/it.js +24 -0
  75. package/dist/i18n/locales/ja.d.ts +24 -0
  76. package/dist/i18n/locales/ja.js +24 -0
  77. package/dist/i18n/locales/nl.d.ts +24 -0
  78. package/dist/i18n/locales/nl.js +24 -0
  79. package/dist/i18n/locales/pl.d.ts +24 -0
  80. package/dist/i18n/locales/pl.js +24 -0
  81. package/dist/i18n/locales/pt.d.ts +24 -0
  82. package/dist/i18n/locales/pt.js +24 -0
  83. package/dist/i18n/locales/ro.d.ts +24 -0
  84. package/dist/i18n/locales/ro.js +24 -0
  85. package/dist/i18n/locales/ru.d.ts +24 -0
  86. package/dist/i18n/locales/ru.js +24 -0
  87. package/dist/i18n/locales/sq.d.ts +24 -0
  88. package/dist/i18n/locales/sq.js +24 -0
  89. package/dist/i18n/locales/sv.d.ts +24 -0
  90. package/dist/i18n/locales/sv.js +24 -0
  91. package/dist/i18n/locales/tr.d.ts +24 -0
  92. package/dist/i18n/locales/tr.js +24 -0
  93. package/dist/i18n/locales/zh.d.ts +24 -0
  94. package/dist/i18n/locales/zh.js +24 -0
  95. package/dist/index.js +15 -15
  96. package/dist/locales/ar.json +24 -0
  97. package/dist/locales/de.json +24 -0
  98. package/dist/locales/el.json +24 -0
  99. package/dist/locales/en.json +24 -0
  100. package/dist/locales/es.json +24 -0
  101. package/dist/locales/fr.json +24 -0
  102. package/dist/locales/hi.json +24 -0
  103. package/dist/locales/it.json +24 -0
  104. package/dist/locales/ja.json +24 -0
  105. package/dist/locales/nl.json +24 -0
  106. package/dist/locales/pl.json +24 -0
  107. package/dist/locales/pt.json +24 -0
  108. package/dist/locales/ro.json +24 -0
  109. package/dist/locales/ru.json +24 -0
  110. package/dist/locales/sq.json +24 -0
  111. package/dist/locales/sv.json +24 -0
  112. package/dist/locales/tr.json +24 -0
  113. package/dist/locales/zh.json +24 -0
  114. package/dist/tokens.css +1 -1
  115. package/package.json +1 -1
  116. package/dist/_chunks/date-picker-DzQS8mvt.js +0 -1845
  117. package/dist/_chunks/date-range-picker-Cbz1SKhm.js +0 -324
  118. package/dist/_chunks/subDays-DIKRViZm.js +0 -8
@@ -1,11 +1,11 @@
1
- import { a as y, j as N } from "./date-picker-variants-CYQAm1Gk.js";
2
- import { s as p } from "./subDays-DIKRViZm.js";
1
+ import { a as y, k as N } from "./date-picker-variants-eL6HjWvw.js";
2
+ import { s as p } from "./subDays-BcNi04uf.js";
3
3
  import { jsx as u, jsxs as f } from "react/jsx-runtime";
4
4
  import { useMemo as M } from "react";
5
5
  import { useTranslation as T } from "react-i18next";
6
6
  import { C as I } from "./card-DPmk26CL.js";
7
7
  import { B as x } from "./badge-DCOqV9mI.js";
8
- const _ = 280, S = 14, b = 266, C = 28;
8
+ const _ = 280, S = 14, b = 266, k = 28;
9
9
  function w(t) {
10
10
  if (t < 0) return "preconception";
11
11
  const a = Math.floor(t / 7);
@@ -15,8 +15,8 @@ function mt(t, a) {
15
15
  const { method: s, date: r } = t;
16
16
  let o, c;
17
17
  if (s === "lmp") {
18
- const m = t.cycleLength ?? C;
19
- o = r, c = y(r, _ + (m - C));
18
+ const m = t.cycleLength ?? k;
19
+ o = r, c = y(r, _ + (m - k));
20
20
  } else if (s === "conception")
21
21
  o = p(r, S), c = y(r, b);
22
22
  else {
@@ -113,7 +113,7 @@ function ht(t) {
113
113
  crlInRange: t.crlMm >= L && t.crlMm <= B
114
114
  };
115
115
  }
116
- const n = (t, a = 0) => t * 7 + a, j = (t) => t === "uk" ? {
116
+ const n = (t, a = 0) => t * 7 + a, P = (t) => t === "uk" ? {
117
117
  key: "dating-nt",
118
118
  category: "screening",
119
119
  startDay: n(11, 2),
@@ -125,21 +125,21 @@ const n = (t, a = 0) => t * 7 + a, j = (t) => t === "uk" ? {
125
125
  startDay: n(11, 0),
126
126
  endDay: n(13, 6),
127
127
  source: "SIEOG-2021"
128
- }, P = {
128
+ }, W = {
129
129
  key: "nipt",
130
130
  category: "screening",
131
131
  startDay: n(10, 0),
132
132
  endDay: n(13, 6),
133
133
  condition: "on-indication",
134
134
  source: "ACOG-CO700"
135
- }, W = {
135
+ }, Y = {
136
136
  key: "cvs",
137
137
  category: "diagnostic",
138
138
  startDay: n(11, 0),
139
139
  endDay: n(13, 6),
140
140
  condition: "on-indication",
141
141
  source: "ISS"
142
- }, Y = {
142
+ }, j = {
143
143
  key: "amnio",
144
144
  category: "diagnostic",
145
145
  startDay: n(15, 0),
@@ -229,11 +229,11 @@ const n = (t, a = 0) => t * 7 + a, j = (t) => t === "uk" ? {
229
229
  };
230
230
  function tt(t) {
231
231
  return [
232
- j(t),
233
- P,
232
+ P(t),
234
233
  W,
235
- Z,
236
234
  Y,
235
+ Z,
236
+ j,
237
237
  K(t),
238
238
  q,
239
239
  V,
@@ -326,7 +326,7 @@ function pt(t, a = {}) {
326
326
  function rt(t, a) {
327
327
  return t === "past" ? "neutral" : t === "current" || a ? "warning" : "info";
328
328
  }
329
- function k(t) {
329
+ function C(t) {
330
330
  return `${Math.floor(t / 7)}+${t % 7}`;
331
331
  }
332
332
  const st = {
@@ -370,8 +370,8 @@ function It({
370
370
  a(`antenatalSchedule.category.${e.category}`),
371
371
  " ·",
372
372
  " ",
373
- k(e.startDay),
374
- e.single ? "" : ` – ${k(e.endDay)}`,
373
+ C(e.startDay),
374
+ e.single ? "" : ` – ${C(e.endDay)}`,
375
375
  " ·",
376
376
  " ",
377
377
  a(`antenatalSchedule.source.${e.source}`),
@@ -392,7 +392,7 @@ function It({
392
392
  export {
393
393
  It as A,
394
394
  B as C,
395
- C as D,
395
+ k as D,
396
396
  _ as G,
397
397
  R as M,
398
398
  b as T,
@@ -410,4 +410,4 @@ export {
410
410
  ht as r,
411
411
  w as t
412
412
  };
413
- //# sourceMappingURL=antenatal-schedule-timeline-BzJZqS-8.js.map
413
+ //# sourceMappingURL=antenatal-schedule-timeline-BMMpi2lb.js.map
@@ -5,7 +5,7 @@ import { useTranslation as De } from "react-i18next";
5
5
  import { A as we } from "./appointment-card-DgKI5QKD.js";
6
6
  import { B as K } from "./button-CPGiR_bH.js";
7
7
  import { B as Re } from "./button-group-DzV5wgnx.js";
8
- import { D as Ie } from "./date-picker-DzQS8mvt.js";
8
+ import { D as Ie } from "./date-picker-BP_W6VtE.js";
9
9
  import { P as Se } from "./panel-header-D313n_9-.js";
10
10
  import { S as je } from "./skeleton-CZbwyJAA.js";
11
11
  import { E as Ce } from "./empty-state-CrLsi0XI.js";
@@ -385,4 +385,4 @@ export {
385
385
  Ke as A,
386
386
  Ne as a
387
387
  };
388
- //# sourceMappingURL=appointment-timeline-DQTG0btW.js.map
388
+ //# sourceMappingURL=appointment-timeline-BB-c1LeR.js.map
@@ -1,4 +1,4 @@
1
- import { o as s, q as r, r as i, v as d } from "./date-picker-variants-CYQAm1Gk.js";
1
+ import { A as s, B as r, E as i, F as d } from "./date-picker-variants-eL6HjWvw.js";
2
2
  const h = {
3
3
  lessThanXSeconds: {
4
4
  one: "أقل من ثانية",
@@ -181,7 +181,7 @@ const h = {
181
181
  "الجمعة",
182
182
  "السبت"
183
183
  ]
184
- }, v = {
184
+ }, p = {
185
185
  narrow: {
186
186
  am: "ص",
187
187
  pm: "م",
@@ -212,7 +212,7 @@ const h = {
212
212
  night: "الليل",
213
213
  midnight: "منتصف الليل"
214
214
  }
215
- }, p = {
215
+ }, v = {
216
216
  narrow: {
217
217
  am: "ص",
218
218
  pm: "م",
@@ -263,28 +263,28 @@ const h = {
263
263
  defaultWidth: "wide"
264
264
  }),
265
265
  dayPeriod: r({
266
- values: v,
266
+ values: p,
267
267
  defaultWidth: "wide",
268
- formattingValues: p,
268
+ formattingValues: v,
269
269
  defaultFormattingWidth: "wide"
270
270
  })
271
- }, x = /^(\d+)(th|st|nd|rd)?/i, D = /\d+/i, H = {
271
+ }, x = /^(\d+)(th|st|nd|rd)?/i, D = /\d+/i, F = {
272
272
  narrow: /[قب]/,
273
273
  abbreviated: /[قب]\.م\./,
274
274
  wide: /(قبل|بعد) الميلاد/
275
- }, k = {
275
+ }, H = {
276
276
  any: [/قبل/, /بعد/]
277
- }, F = {
277
+ }, k = {
278
278
  narrow: /^[1234]/i,
279
279
  abbreviated: /ر[1234]/,
280
280
  wide: /الربع (الأول|الثاني|الثالث|الرابع)/
281
281
  }, X = {
282
282
  any: [/1/i, /2/i, /3/i, /4/i]
283
- }, S = {
283
+ }, E = {
284
284
  narrow: /^[أيفمسند]/,
285
285
  abbreviated: /^(يناير|فبراير|مارس|أبريل|مايو|يونيو|يوليو|أغسطس|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/,
286
286
  wide: /^(يناير|فبراير|مارس|أبريل|مايو|يونيو|يوليو|أغسطس|سبتمبر|أكتوبر|نوفمبر|ديسمبر)/
287
- }, V = {
287
+ }, S = {
288
288
  narrow: [
289
289
  /^ي/i,
290
290
  /^ف/i,
@@ -313,7 +313,7 @@ const h = {
313
313
  /^نوفمبر/i,
314
314
  /^ديسمبر/i
315
315
  ]
316
- }, E = {
316
+ }, V = {
317
317
  narrow: /^[حنثرخجس]/i,
318
318
  short: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
319
319
  abbreviated: /^(أحد|اثنين|ثلاثاء|أربعاء|خميس|جمعة|سبت)/i,
@@ -333,7 +333,7 @@ const h = {
333
333
  }, N = {
334
334
  narrow: /^(ص|م|منتصف الليل|الظهر|بعد الظهر|في الصباح|في المساء|في الليل)/,
335
335
  any: /^(ص|م|منتصف الليل|الظهر|بعد الظهر|في الصباح|في المساء|في الليل)/
336
- }, q = {
336
+ }, C = {
337
337
  any: {
338
338
  am: /^ص/,
339
339
  pm: /^م/,
@@ -344,33 +344,33 @@ const h = {
344
344
  evening: /في المساء/,
345
345
  night: /في الليل/
346
346
  }
347
- }, C = {
347
+ }, Y = {
348
348
  ordinalNumber: d({
349
349
  matchPattern: x,
350
350
  parsePattern: D,
351
351
  valueCallback: (t) => parseInt(t, 10)
352
352
  }),
353
353
  era: i({
354
- matchPatterns: H,
354
+ matchPatterns: F,
355
355
  defaultMatchWidth: "wide",
356
- parsePatterns: k,
356
+ parsePatterns: H,
357
357
  defaultParseWidth: "any"
358
358
  }),
359
359
  quarter: i({
360
- matchPatterns: F,
360
+ matchPatterns: k,
361
361
  defaultMatchWidth: "wide",
362
362
  parsePatterns: X,
363
363
  defaultParseWidth: "any",
364
364
  valueCallback: (t) => t + 1
365
365
  }),
366
366
  month: i({
367
- matchPatterns: S,
367
+ matchPatterns: E,
368
368
  defaultMatchWidth: "wide",
369
- parsePatterns: V,
369
+ parsePatterns: S,
370
370
  defaultParseWidth: "any"
371
371
  }),
372
372
  day: i({
373
- matchPatterns: E,
373
+ matchPatterns: V,
374
374
  defaultMatchWidth: "wide",
375
375
  parsePatterns: L,
376
376
  defaultParseWidth: "any"
@@ -378,7 +378,7 @@ const h = {
378
378
  dayPeriod: i({
379
379
  matchPatterns: N,
380
380
  defaultMatchWidth: "any",
381
- parsePatterns: q,
381
+ parsePatterns: C,
382
382
  defaultParseWidth: "any"
383
383
  })
384
384
  }, z = {
@@ -387,7 +387,7 @@ const h = {
387
387
  formatLong: f,
388
388
  formatRelative: g,
389
389
  localize: W,
390
- match: C,
390
+ match: Y,
391
391
  options: {
392
392
  weekStartsOn: 6,
393
393
  firstWeekContainsDate: 1
@@ -396,4 +396,4 @@ const h = {
396
396
  export {
397
397
  z as ar
398
398
  };
399
- //# sourceMappingURL=ar-B1GhtlBP.js.map
399
+ //# sourceMappingURL=ar-THMLfSoN.js.map
@@ -7,7 +7,7 @@ import { A as z } from "./alert-Cxaqd-QO.js";
7
7
  import { B as ie } from "./button-CPGiR_bH.js";
8
8
  import { C as Ke } from "./checkbox-BuZ1u__2.js";
9
9
  import { C as Bt } from "./checkbox-group-CfqMv57d.js";
10
- import { D as Et } from "./date-picker-DzQS8mvt.js";
10
+ import { D as Et } from "./date-picker-BP_W6VtE.js";
11
11
  import { E as Rt } from "./email-input-Dpe63k0K.js";
12
12
  import { F as Z } from "./form-field-M5UpX65Z.js";
13
13
  import { P as Vt } from "./phone-input-D00ZBAm-.js";
@@ -24,8 +24,8 @@ import { S as $t } from "./stepper-accordion-BeVMZPuG.js";
24
24
  import { S as zt } from "./stepper-progress-Bv0njx4g.js";
25
25
  import { p as L, S as Kt } from "./slot-grid-CQSULZjd.js";
26
26
  import { s as le, i as st } from "./isSameDay-DUEiAT0G.js";
27
- import { w as lt, i as ce, a as je, n as jt, f as ye, d as qt, h as Te, x as De } from "./date-picker-variants-CYQAm1Gk.js";
28
- import { s as Ht } from "./subDays-DIKRViZm.js";
27
+ import { G as lt, i as ce, a as je, c as jt, q as ye, o as qt, f as Te, H as De } from "./date-picker-variants-eL6HjWvw.js";
28
+ import { s as Ht } from "./subDays-BcNi04uf.js";
29
29
  import { C as Gt } from "./chevron-left-B8cOyH-V.js";
30
30
  import { C as Ut } from "./chevron-right-I9AeSxH2.js";
31
31
  import { c as F } from "./createLucideIcon-DhHxpK9K.js";
@@ -2692,4 +2692,4 @@ export {
2692
2692
  X as O,
2693
2693
  Cs as b
2694
2694
  };
2695
- //# sourceMappingURL=booking-BvCu2XWY.js.map
2695
+ //# sourceMappingURL=booking-BSpSMmJ2.js.map
@@ -3,12 +3,12 @@ import { forwardRef as A, useState as C, useMemo as N, useEffect as I } from "re
3
3
  import { c as S } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as k } from "react-i18next";
5
5
  import { F as L } from "./form-field-M5UpX65Z.js";
6
- import { D as z } from "./date-picker-DzQS8mvt.js";
6
+ import { D as z } from "./date-picker-BP_W6VtE.js";
7
7
  import { N as D } from "./number-input-DjWzmlEY.js";
8
8
  import { C as E } from "./card-DPmk26CL.js";
9
9
  import { B as P } from "./badge-DCOqV9mI.js";
10
10
  import { I as B } from "./insert-result-D074GtHX.js";
11
- import { a as i } from "./date-picker-variants-CYQAm1Gk.js";
11
+ import { a as i } from "./date-picker-variants-eL6HjWvw.js";
12
12
  import { C as G } from "./check-DrFSN__t.js";
13
13
  import { H as R } from "./heart--qCA4ffe.js";
14
14
  import { c as Y } from "./createLucideIcon-DhHxpK9K.js";
@@ -249,4 +249,4 @@ export {
249
249
  U as L,
250
250
  O as p
251
251
  };
252
- //# sourceMappingURL=cycle-calculator-OQp8Ik5U.js.map
252
+ //# sourceMappingURL=cycle-calculator-DNvvr0bP.js.map
@@ -0,0 +1,265 @@
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import { forwardRef as ae, useState as y, useRef as K, useEffect as re, useCallback as R, useMemo as ne, useImperativeHandle as se } from "react";
3
+ import { useTranslation as ie } from "react-i18next";
4
+ import * as k from "@radix-ui/react-popover";
5
+ import { u as oe } from "./use-controllable-state-BiY4xTzM.js";
6
+ import { u as de } from "./form-field-context-B3APVHKx.js";
7
+ import { u as ce } from "./registry-DvAUVLHh.js";
8
+ import { u as le, g as pe, f as T, b as ue, c as fe, i as me, t as he, d as ge, p as ve, D as ye, C as ke, e as be, h as Ce, j as De } from "./date-picker-variants-eL6HjWvw.js";
9
+ import { C as Pe } from "./calendar-days-BGWklvE-.js";
10
+ import { C as Se } from "./check-DrFSN__t.js";
11
+ import { p as xe } from "./parse-DvA97ro9.js";
12
+ import { i as we } from "./isSameDay-DUEiAT0G.js";
13
+ const Ie = {
14
+ id: "date-picker",
15
+ // Persisted single date (value state + set_date) → select_single + set_value,
16
+ // plus open/close of the calendar popover.
17
+ capabilities: ["select_single", "set_value", "open", "close"],
18
+ state: {
19
+ value: {
20
+ type: "iso-date",
21
+ descriptionKey: "ui.agent.datePicker.state.value",
22
+ description: "Currently-selected ISO date, or null.",
23
+ read: (a) => {
24
+ var c;
25
+ return ((c = a.getValue()) == null ? void 0 : c.toISOString()) ?? null;
26
+ }
27
+ },
28
+ isOpen: {
29
+ type: "boolean",
30
+ descriptionKey: "ui.agent.datePicker.state.isOpen",
31
+ description: "Whether the calendar popover is open.",
32
+ read: (a) => a.isOpen()
33
+ }
34
+ },
35
+ actions: {
36
+ set_date: {
37
+ safety: "write",
38
+ argsType: "{ date: string }",
39
+ argsSchema: {
40
+ type: "object",
41
+ properties: {
42
+ date: {
43
+ type: "string",
44
+ format: "date",
45
+ description: 'ISO date, e.g. "2026-06-23".'
46
+ }
47
+ },
48
+ required: ["date"]
49
+ },
50
+ idempotent: !0,
51
+ descriptionKey: "ui.agent.datePicker.actions.setDate",
52
+ description: "Select a specific date (ISO yyyy-mm-dd).",
53
+ examples: [{ args: { date: "2026-06-23" }, note: "Select 23 Jun 2026." }],
54
+ invoke: (a, c) => {
55
+ a.setValue(new Date(c.date));
56
+ }
57
+ },
58
+ clear: {
59
+ // Discards the selected date — loses the user's input.
60
+ safety: "destructive",
61
+ idempotent: !0,
62
+ descriptionKey: "ui.agent.datePicker.actions.clear",
63
+ description: "Clear the selected date.",
64
+ invoke: (a) => {
65
+ a.clear();
66
+ }
67
+ },
68
+ open: {
69
+ safety: "read",
70
+ idempotent: !0,
71
+ descriptionKey: "ui.agent.datePicker.actions.open",
72
+ description: "Open the calendar popover.",
73
+ invoke: (a) => {
74
+ a.open();
75
+ }
76
+ },
77
+ close: {
78
+ safety: "read",
79
+ idempotent: !0,
80
+ descriptionKey: "ui.agent.datePicker.actions.close",
81
+ description: "Close the calendar popover.",
82
+ invoke: (a) => {
83
+ a.close();
84
+ }
85
+ }
86
+ },
87
+ domHooks: {
88
+ root: {
89
+ attr: "data-component",
90
+ value: "date-picker",
91
+ description: "Marks the DatePicker wrapper."
92
+ },
93
+ instanceId: {
94
+ attr: "data-component-id",
95
+ sourceProp: "id",
96
+ description: "Sourced from the id prop."
97
+ }
98
+ }
99
+ }, Oe = ae(
100
+ ({
101
+ value: a,
102
+ defaultValue: c,
103
+ onChange: F,
104
+ minDate: m,
105
+ maxDate: h,
106
+ disabledDates: l,
107
+ weekStartsOn: M,
108
+ presets: b,
109
+ size: x = "md",
110
+ disabled: j,
111
+ placeholder: q,
112
+ className: B,
113
+ id: E
114
+ }, L) => {
115
+ const { t: w, i18n: I } = ie(), p = de(), C = E ?? p.id, O = p.disabled || j, _ = p.invalid ? "error" : "default", u = le(I.language), f = pe(I.language), H = q ?? w("inputs.datePicker.placeholder", "Select date"), [W, N] = oe({
116
+ value: a,
117
+ defaultValue: c,
118
+ onChange: F
119
+ }), n = W, [i, s] = y(!1), [J, D] = y(
120
+ n ? T(n, f, { locale: u }) : ""
121
+ ), [V, g] = y(!1), [z, P] = y(n ?? /* @__PURE__ */ new Date()), S = K(null);
122
+ re(() => {
123
+ n ? (D(T(n, f, { locale: u })), g(!1)) : D("");
124
+ }, [n, f, u]);
125
+ const G = ue(
126
+ m,
127
+ h,
128
+ l
129
+ ), Q = R(
130
+ (e) => m && fe(e, m) || h && me(e, h) ? !0 : Array.isArray(l) ? l.some(
131
+ (t) => t.toDateString() === e.toDateString()
132
+ ) : typeof l == "function" ? l(e) : !1,
133
+ [m, h, l]
134
+ ), o = R(
135
+ (e) => {
136
+ N(e);
137
+ },
138
+ [N]
139
+ ), U = (e) => {
140
+ const t = e.target.value;
141
+ if (D(t), t.length === 0) {
142
+ g(!1), o(void 0);
143
+ return;
144
+ }
145
+ const d = xe(t, f, /* @__PURE__ */ new Date(), { locale: u });
146
+ De(d) && !Q(d) ? (g(!1), o(d), P(d)) : t.length === f.length && g(!0);
147
+ }, X = (e) => {
148
+ e.key === "Enter" && i && (e.preventDefault(), s(!1)), e.key === "Escape" && i && (e.preventDefault(), s(!1)), e.key === "ArrowDown" && !i && (e.preventDefault(), s(!0));
149
+ }, Y = (e) => {
150
+ var t;
151
+ e && (o(e), s(!1), (t = S.current) == null || t.focus());
152
+ }, Z = (e) => {
153
+ var d;
154
+ const t = e.date();
155
+ o(t), P(t), s(!1), (d = S.current) == null || d.focus();
156
+ }, $ = (e) => n ? we(e.date(), n) : !1, ee = w("inputs.datePicker.gridLabel", "Calendar"), te = ne(
157
+ () => ({
158
+ getValue: () => n,
159
+ setValue: (e) => o(e),
160
+ clear: () => o(void 0),
161
+ isOpen: () => i,
162
+ open: () => s(!0),
163
+ close: () => s(!1)
164
+ }),
165
+ [n, o, i]
166
+ ), A = K(null);
167
+ return se(L, () => A.current, []), ce(Ie, te, C), /* @__PURE__ */ r(k.Root, { open: i, onOpenChange: s, children: /* @__PURE__ */ v(
168
+ "div",
169
+ {
170
+ ref: A,
171
+ className: B,
172
+ "data-component": "date-picker",
173
+ "data-component-id": C,
174
+ children: [
175
+ /* @__PURE__ */ v("div", { className: "ds:relative", children: [
176
+ /* @__PURE__ */ r(k.Trigger, { asChild: !0, disabled: O, children: /* @__PURE__ */ r(
177
+ "input",
178
+ {
179
+ ref: S,
180
+ id: C,
181
+ type: "text",
182
+ role: "combobox",
183
+ value: J,
184
+ placeholder: H,
185
+ disabled: O,
186
+ "aria-describedby": p.describedBy || void 0,
187
+ "aria-invalid": p.invalid || V || void 0,
188
+ "aria-required": p.required || void 0,
189
+ "aria-haspopup": "dialog",
190
+ "aria-expanded": i,
191
+ onChange: U,
192
+ onKeyDown: X,
193
+ onClick: () => !i && s(!0),
194
+ className: he({
195
+ size: x,
196
+ tone: V ? "error" : _
197
+ })
198
+ }
199
+ ) }),
200
+ /* @__PURE__ */ r("span", { "aria-hidden": "true", className: ge({ size: x }), children: /* @__PURE__ */ r(Pe, {}) })
201
+ ] }),
202
+ /* @__PURE__ */ r(k.Portal, { children: /* @__PURE__ */ r(
203
+ k.Content,
204
+ {
205
+ sideOffset: 4,
206
+ align: "start",
207
+ className: Ce(),
208
+ onOpenAutoFocus: (e) => {
209
+ e.preventDefault();
210
+ },
211
+ children: /* @__PURE__ */ v("div", { className: "ds:flex ds:gap-[var(--spacing-md)]", children: [
212
+ 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) => {
213
+ const t = $(e);
214
+ return /* @__PURE__ */ v(
215
+ "button",
216
+ {
217
+ type: "button",
218
+ "aria-pressed": t,
219
+ onClick: () => Z(e),
220
+ className: ve({ active: t }),
221
+ children: [
222
+ /* @__PURE__ */ r("span", { className: "ds:min-w-0 ds:truncate", children: e.label }),
223
+ t ? /* @__PURE__ */ r(
224
+ Se,
225
+ {
226
+ "aria-hidden": "true",
227
+ className: "ds:size-4 ds:shrink-0 ds:text-primary"
228
+ }
229
+ ) : null
230
+ ]
231
+ },
232
+ e.label
233
+ );
234
+ }) }) : null,
235
+ /* @__PURE__ */ r("div", { role: "region", "aria-label": ee, children: /* @__PURE__ */ r(
236
+ ye,
237
+ {
238
+ mode: "single",
239
+ selected: n,
240
+ onSelect: Y,
241
+ month: z,
242
+ onMonthChange: P,
243
+ disabled: G,
244
+ weekStartsOn: M,
245
+ locale: u,
246
+ showOutsideDays: !0,
247
+ fixedWeeks: !0,
248
+ classNames: be,
249
+ components: { Chevron: ke }
250
+ }
251
+ ) })
252
+ ] })
253
+ }
254
+ ) })
255
+ ]
256
+ }
257
+ ) });
258
+ }
259
+ );
260
+ Oe.displayName = "DatePicker";
261
+ export {
262
+ Oe as D,
263
+ Ie as d
264
+ };
265
+ //# sourceMappingURL=date-picker-BP_W6VtE.js.map