zaravand-ui 6.0.0 → 7.0.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 (198) hide show
  1. package/dist/components/Accordion/Accordion.cjs +1 -1
  2. package/dist/components/Accordion/Accordion.interface.d.cts +8 -0
  3. package/dist/components/Accordion/Accordion.interface.d.ts +8 -0
  4. package/dist/components/Accordion/Accordion.js +226 -148
  5. package/dist/components/Accordion/Accordion.variant.cjs +1 -1
  6. package/dist/components/Accordion/Accordion.variant.js +2 -2
  7. package/dist/components/Avatar/Avatar.cjs +1 -1
  8. package/dist/components/Avatar/Avatar.js +32 -32
  9. package/dist/components/Button/Button.cjs +1 -1
  10. package/dist/components/Button/Button.interface.d.cts +0 -1
  11. package/dist/components/Button/Button.interface.d.ts +0 -1
  12. package/dist/components/Button/Button.js +41 -42
  13. package/dist/components/Button/Button.variant.cjs +1 -1
  14. package/dist/components/Button/Button.variant.d.cts +0 -1
  15. package/dist/components/Button/Button.variant.d.ts +0 -1
  16. package/dist/components/Button/Button.variant.js +2 -4
  17. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  18. package/dist/components/Checkbox/Checkbox.interface.d.cts +11 -0
  19. package/dist/components/Checkbox/Checkbox.interface.d.ts +11 -0
  20. package/dist/components/Checkbox/Checkbox.js +66 -43
  21. package/dist/components/Checkbox/Checkbox.variant.cjs +1 -1
  22. package/dist/components/Checkbox/Checkbox.variant.d.cts +9 -4
  23. package/dist/components/Checkbox/Checkbox.variant.d.ts +9 -4
  24. package/dist/components/Checkbox/Checkbox.variant.js +20 -16
  25. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  26. package/dist/components/DatePicker/DatePicker.interface.d.cts +0 -1
  27. package/dist/components/DatePicker/DatePicker.interface.d.ts +0 -1
  28. package/dist/components/DatePicker/DatePicker.js +511 -407
  29. package/dist/components/DatePicker/DatePicker.utils.cjs +1 -1
  30. package/dist/components/DatePicker/DatePicker.utils.js +101 -82
  31. package/dist/components/DatePicker/DatePicker.variant.cjs +1 -1
  32. package/dist/components/DatePicker/DatePicker.variant.d.cts +1 -3
  33. package/dist/components/DatePicker/DatePicker.variant.d.ts +1 -3
  34. package/dist/components/DatePicker/DatePicker.variant.js +14 -16
  35. package/dist/components/DatePicker/DatePickerMonthSlider.cjs +1 -0
  36. package/dist/components/DatePicker/DatePickerMonthSlider.d.cts +25 -0
  37. package/dist/components/DatePicker/DatePickerMonthSlider.d.ts +25 -0
  38. package/dist/components/DatePicker/DatePickerMonthSlider.js +98 -0
  39. package/dist/components/DatePicker/DatePickerWheel.cjs +1 -0
  40. package/dist/components/DatePicker/DatePickerWheel.d.cts +30 -0
  41. package/dist/components/DatePicker/DatePickerWheel.d.ts +30 -0
  42. package/dist/components/DatePicker/DatePickerWheel.js +156 -0
  43. package/dist/components/Dialog/Dialog.cjs +1 -1
  44. package/dist/components/Dialog/Dialog.interface.d.cts +5 -0
  45. package/dist/components/Dialog/Dialog.interface.d.ts +5 -0
  46. package/dist/components/Dialog/Dialog.js +57 -49
  47. package/dist/components/Dialog/Dialog.variant.cjs +1 -1
  48. package/dist/components/Dialog/Dialog.variant.js +1 -1
  49. package/dist/components/Dialog/DialogDragHandle.cjs +1 -0
  50. package/dist/components/Dialog/DialogDragHandle.d.cts +11 -0
  51. package/dist/components/Dialog/DialogDragHandle.d.ts +11 -0
  52. package/dist/components/Dialog/DialogDragHandle.js +55 -0
  53. package/dist/components/Input/Input.cjs +1 -1
  54. package/dist/components/Input/Input.js +38 -37
  55. package/dist/components/Input/Input.variant.cjs +1 -1
  56. package/dist/components/Input/Input.variant.d.cts +1 -3
  57. package/dist/components/Input/Input.variant.d.ts +1 -3
  58. package/dist/components/Input/Input.variant.js +9 -8
  59. package/dist/components/Pagination/Pagination.cjs +1 -1
  60. package/dist/components/Pagination/Pagination.js +90 -73
  61. package/dist/components/Pagination/Pagination.variant.cjs +1 -1
  62. package/dist/components/Pagination/Pagination.variant.d.cts +3 -1
  63. package/dist/components/Pagination/Pagination.variant.d.ts +3 -1
  64. package/dist/components/Pagination/Pagination.variant.js +12 -6
  65. package/dist/components/RadioGroup/RadioGroup.cjs +1 -1
  66. package/dist/components/RadioGroup/RadioGroup.js +44 -41
  67. package/dist/components/RadioGroup/RadioGroup.variant.cjs +1 -1
  68. package/dist/components/RadioGroup/RadioGroup.variant.d.cts +3 -2
  69. package/dist/components/RadioGroup/RadioGroup.variant.d.ts +3 -2
  70. package/dist/components/RadioGroup/RadioGroup.variant.js +11 -21
  71. package/dist/components/Select/Select.cjs +1 -1
  72. package/dist/components/Select/Select.d.cts +1 -3
  73. package/dist/components/Select/Select.d.ts +1 -3
  74. package/dist/components/Select/Select.interface.d.cts +0 -1
  75. package/dist/components/Select/Select.interface.d.ts +0 -1
  76. package/dist/components/Select/Select.js +620 -401
  77. package/dist/components/Select/Select.variant.cjs +1 -1
  78. package/dist/components/Select/Select.variant.d.cts +5 -5
  79. package/dist/components/Select/Select.variant.d.ts +5 -5
  80. package/dist/components/Select/Select.variant.js +10 -12
  81. package/dist/components/Sheet/Sheet.variant.cjs +1 -1
  82. package/dist/components/Sheet/Sheet.variant.js +6 -6
  83. package/dist/components/Switch/Switch.cjs +1 -1
  84. package/dist/components/Switch/Switch.interface.d.cts +12 -3
  85. package/dist/components/Switch/Switch.interface.d.ts +12 -3
  86. package/dist/components/Switch/Switch.js +57 -37
  87. package/dist/components/Switch/Switch.variant.cjs +1 -1
  88. package/dist/components/Switch/Switch.variant.d.cts +9 -5
  89. package/dist/components/Switch/Switch.variant.d.ts +9 -5
  90. package/dist/components/Switch/Switch.variant.js +22 -15
  91. package/dist/components/Table/Table.cjs +1 -1
  92. package/dist/components/Table/Table.interface.d.cts +9 -0
  93. package/dist/components/Table/Table.interface.d.ts +9 -0
  94. package/dist/components/Table/Table.js +462 -271
  95. package/dist/components/Table/TableSkeletonRows.cjs +1 -1
  96. package/dist/components/Table/TableSkeletonRows.js +26 -21
  97. package/dist/components/Table/TableSortToggle.cjs +1 -1
  98. package/dist/components/Table/TableSortToggle.d.cts +1 -1
  99. package/dist/components/Table/TableSortToggle.d.ts +1 -1
  100. package/dist/components/Table/TableSortToggle.js +23 -22
  101. package/dist/components/Table/hooks/useTableCardLabels.cjs +1 -0
  102. package/dist/components/Table/hooks/useTableCardLabels.d.cts +9 -0
  103. package/dist/components/Table/hooks/useTableCardLabels.d.ts +9 -0
  104. package/dist/components/Table/hooks/useTableCardLabels.js +34 -0
  105. package/dist/components/Table/hooks/useTableSort.cjs +1 -1
  106. package/dist/components/Table/hooks/useTableSort.d.cts +2 -0
  107. package/dist/components/Table/hooks/useTableSort.d.ts +2 -0
  108. package/dist/components/Table/hooks/useTableSort.js +8 -1
  109. package/dist/components/Tabs/Tabs.cjs +1 -1
  110. package/dist/components/Tabs/Tabs.js +90 -63
  111. package/dist/components/Tabs/Tabs.variant.cjs +1 -1
  112. package/dist/components/Tabs/Tabs.variant.d.cts +2 -2
  113. package/dist/components/Tabs/Tabs.variant.d.ts +2 -2
  114. package/dist/components/Tabs/Tabs.variant.js +52 -29
  115. package/dist/components/Textarea/Textarea.cjs +1 -1
  116. package/dist/components/Textarea/Textarea.js +19 -18
  117. package/dist/components/Textarea/Textarea.variant.cjs +1 -1
  118. package/dist/components/Textarea/Textarea.variant.js +5 -5
  119. package/dist/components/TimePicker/TimePicker.cjs +1 -1
  120. package/dist/components/TimePicker/TimePicker.interface.d.cts +0 -1
  121. package/dist/components/TimePicker/TimePicker.interface.d.ts +0 -1
  122. package/dist/components/TimePicker/TimePicker.js +121 -83
  123. package/dist/components/TimePicker/TimePicker.variant.cjs +1 -1
  124. package/dist/components/TimePicker/TimePicker.variant.d.cts +1 -3
  125. package/dist/components/TimePicker/TimePicker.variant.d.ts +1 -3
  126. package/dist/components/TimePicker/TimePicker.variant.js +9 -11
  127. package/dist/components/TimePicker/TimePickerPanel.cjs +1 -1
  128. package/dist/components/TimePicker/TimePickerPanel.js +3 -4
  129. package/dist/components/TimePicker/TimePickerWheel.cjs +1 -0
  130. package/dist/components/TimePicker/TimePickerWheel.d.cts +27 -0
  131. package/dist/components/TimePicker/TimePickerWheel.d.ts +27 -0
  132. package/dist/components/TimePicker/TimePickerWheel.js +205 -0
  133. package/dist/components/Toast/Toast.cjs +1 -1
  134. package/dist/components/Toast/Toast.d.cts +1 -1
  135. package/dist/components/Toast/Toast.d.ts +1 -1
  136. package/dist/components/Toast/Toast.js +56 -34
  137. package/dist/components/Toast/Toast.variant.cjs +1 -1
  138. package/dist/components/Toast/Toast.variant.d.cts +1 -1
  139. package/dist/components/Toast/Toast.variant.d.ts +1 -1
  140. package/dist/components/Toast/Toast.variant.js +1 -1
  141. package/dist/components/Toast/ToastHost.cjs +1 -1
  142. package/dist/components/Toast/ToastHost.js +42 -41
  143. package/dist/components/Toast/function/toastHaptics.cjs +1 -0
  144. package/dist/components/Toast/function/toastHaptics.d.cts +11 -0
  145. package/dist/components/Toast/function/toastHaptics.d.ts +11 -0
  146. package/dist/components/Toast/function/toastHaptics.js +6 -0
  147. package/dist/components/Uploader/Uploader.cjs +2 -2
  148. package/dist/components/Uploader/Uploader.js +328 -158
  149. package/dist/components/Uploader/Uploader.variant.cjs +1 -1
  150. package/dist/components/Uploader/Uploader.variant.d.cts +1 -3
  151. package/dist/components/Uploader/Uploader.variant.d.ts +1 -3
  152. package/dist/components/Uploader/Uploader.variant.js +2 -5
  153. package/dist/components/shared/ActionSheet.cjs +1 -0
  154. package/dist/components/shared/ActionSheet.d.cts +26 -0
  155. package/dist/components/shared/ActionSheet.d.ts +26 -0
  156. package/dist/components/shared/ActionSheet.js +51 -0
  157. package/dist/components/shared/FieldClearButton.cjs +1 -1
  158. package/dist/components/shared/FieldClearButton.d.cts +2 -1
  159. package/dist/components/shared/FieldClearButton.d.ts +2 -1
  160. package/dist/components/shared/FieldClearButton.js +11 -10
  161. package/dist/components/shared/FieldLabel.cjs +1 -1
  162. package/dist/components/shared/FieldLabel.js +6 -6
  163. package/dist/components/shared/IconActionButton.cjs +1 -1
  164. package/dist/components/shared/IconActionButton.d.cts +6 -1
  165. package/dist/components/shared/IconActionButton.d.ts +6 -1
  166. package/dist/components/shared/IconActionButton.js +9 -11
  167. package/dist/components/shared/WheelColumn.cjs +1 -0
  168. package/dist/components/shared/WheelColumn.d.cts +29 -0
  169. package/dist/components/shared/WheelColumn.d.ts +29 -0
  170. package/dist/components/shared/WheelColumn.js +116 -0
  171. package/dist/components/shared/haptics.cjs +1 -0
  172. package/dist/components/shared/haptics.d.cts +6 -0
  173. package/dist/components/shared/haptics.d.ts +6 -0
  174. package/dist/components/shared/haptics.js +8 -0
  175. package/dist/components/shared/responsiveScale.cjs +1 -1
  176. package/dist/components/shared/responsiveScale.d.cts +7 -1
  177. package/dist/components/shared/responsiveScale.d.ts +7 -1
  178. package/dist/components/shared/responsiveScale.js +2 -6
  179. package/dist/components/shared/useStickyToolbar.cjs +1 -0
  180. package/dist/components/shared/useStickyToolbar.d.cts +17 -0
  181. package/dist/components/shared/useStickyToolbar.d.ts +17 -0
  182. package/dist/components/shared/useStickyToolbar.js +39 -0
  183. package/dist/components/shared/useWheelSize.cjs +1 -0
  184. package/dist/components/shared/useWheelSize.d.cts +10 -0
  185. package/dist/components/shared/useWheelSize.d.ts +10 -0
  186. package/dist/components/shared/useWheelSize.js +14 -0
  187. package/dist/components/shared/viewport.cjs +1 -0
  188. package/dist/components/shared/viewport.d.cts +17 -0
  189. package/dist/components/shared/viewport.d.ts +17 -0
  190. package/dist/components/shared/viewport.js +32 -0
  191. package/dist/config/messages.cjs +1 -1
  192. package/dist/config/messages.d.cts +14 -0
  193. package/dist/config/messages.d.ts +14 -0
  194. package/dist/config/messages.js +26 -8
  195. package/dist/index.cjs +1 -1
  196. package/dist/index.css +1 -1
  197. package/dist/index.js +16 -16
  198. package/package.json +98 -97
@@ -2,459 +2,619 @@
2
2
  import { useZuiConfig as e } from "../../config/useZuiConfig.js";
3
3
  import { cn as t, mergeRefs as n } from "../../lib/utils.js";
4
4
  import { DATEPICKER_MANUAL_SEGMENT_WIDTH as r } from "../shared/responsiveScale.js";
5
- import { FieldLabel as ee } from "../shared/FieldLabel.js";
6
- import { useInvalidState as te } from "../shared/useInvalidState.js";
7
- import i from "../Tooltip/Tooltip.js";
8
- import { useControllableState as a } from "../shared/useControllableState.js";
9
- import { datePickerCalendarSwitchButtonVariants as ne, datePickerDayButtonVariants as re, datePickerHeaderVariants as ie, datePickerNavigationButtonVariants as ae, datePickerPanelGridVariants as oe, datePickerPanelHintVariants as se, datePickerPanelItemButtonVariants as ce, datePickerPopoverContentVariants as le, datePickerSwitchButtonVariants as ue, datePickerSwitchGroupVariants as de, datePickerTriggerVariants as fe, datePickerWeekdayVariants as pe, datePickerYearListVariants as me } from "./DatePicker.variant.js";
10
- import { FieldClearButton as he, FieldClearButtonSlot as ge } from "../shared/FieldClearButton.js";
11
- import _e from "../shared/RequiredValidationInput.js";
12
- import { buildManualInputDigitsFromParts as ve, buildManualInputMaskedValue as ye, clampDisplayMonthInBounds as be, formatCalendarDate as xe, formatCalendarDateRangeLabel as Se, formatDatePickerOnChangeValue as Ce, isDateRangeValue as we, isSameOptionalDay as Te, localizeCalendarText as Ee, parseDatePickerValueKey as De, parseManualInputDigits as Oe, processManualDigitsChange as ke, processManualDigitsKeyDown as Ae, resolveCalendarConfig as je, resolveCalendarDateLib as Me, resolveDisabledMatchers as Ne, resolveFormattedDateParts as Pe, resolveNextCalendarSystem as Fe, resolvePrimarySelectedDate as Ie, toDatePickerValueKey as Le } from "./DatePicker.utils.js";
5
+ import ee from "../Dialog/Dialog.js";
6
+ import te from "../Tooltip/Tooltip.js";
7
+ import { CLEAR_ICON_CLASS as i, FieldClearButton as ne, FieldClearButtonSlot as re } from "../shared/FieldClearButton.js";
8
+ import { FieldLabel as ie } from "../shared/FieldLabel.js";
9
+ import { useInvalidState as ae } from "../shared/useInvalidState.js";
10
+ import { useControllableState as oe } from "../shared/useControllableState.js";
11
+ import { isMobileViewport as se, useIsMobileViewport as ce, useIsShortViewport as le } from "../shared/viewport.js";
12
+ import { useIsomorphicLayoutEffect as ue } from "../shared/useIsomorphicLayoutEffect.js";
13
+ import { datePickerCalendarSwitchButtonVariants as de, datePickerDayButtonVariants as fe, datePickerHeaderVariants as pe, datePickerNavigationButtonVariants as me, datePickerPanelGridVariants as he, datePickerPanelHintVariants as ge, datePickerPanelItemButtonVariants as _e, datePickerPopoverContentVariants as ve, datePickerSwitchButtonVariants as ye, datePickerSwitchGroupVariants as be, datePickerTriggerVariants as xe, datePickerWeekdayVariants as Se, datePickerYearListVariants as Ce } from "./DatePicker.variant.js";
14
+ import { buildManualInputDigitsFromParts as we, buildManualInputMaskedValue as Te, clampDisplayMonthInBounds as Ee, formatCalendarDate as De, formatCalendarDateRangeLabel as Oe, formatDatePickerOnChangeValue as ke, isDateRangeValue as Ae, isSameOptionalDay as je, localizeCalendarText as a, parseDatePickerValueKey as Me, parseManualInputDigits as Ne, processManualDigitsChange as Pe, processManualDigitsKeyDown as Fe, resolveCalendarConfig as Ie, resolveCalendarDateLib as Le, resolveDisabledMatchers as Re, resolveFormattedDateParts as ze, resolveNextCalendarSystem as Be, resolvePrimarySelectedDate as Ve, toDatePickerValueKey as He } from "./DatePicker.utils.js";
15
+ import Ue from "./DatePickerWheel.js";
16
+ import We from "./DatePickerMonthSlider.js";
17
+ import Ge from "../shared/RequiredValidationInput.js";
13
18
  import * as o from "react";
14
19
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
15
- import { ArrowRightLeft as Re, CalendarDays as ze, ChevronLeft as Be, ChevronRight as Ve, X as He } from "lucide-react";
20
+ import { ArrowRightLeft as Ke, CalendarDays as qe, ChevronLeft as Je, ChevronRight as Ye, X as Xe } from "lucide-react";
16
21
  import * as l from "@radix-ui/react-popover";
17
- import { DayPicker as Ue, getDefaultClassNames as We } from "react-day-picker";
18
- import { enUS as Ge } from "react-day-picker/locale";
19
- import { DayPicker as Ke, faIR as qe } from "react-day-picker/persian";
22
+ import { DayPicker as Ze, getDefaultClassNames as Qe } from "react-day-picker";
23
+ import { enUS as $e } from "react-day-picker/locale";
24
+ import { DayPicker as et, faIR as tt } from "react-day-picker/persian";
20
25
  //#region src/components/DatePicker/DatePicker.tsx
21
- function Je(Je, u) {
22
- let { className: Ye, size: Xe = "default", title: Ze, required: Qe = !1, showRequiredMessage: $e = !1, placeholder: et, mode: tt = "single", allowManualInput: nt = !1, value: rt, defaultValue: it, typeDateExport: d, typeDateOutput: at = "object", fromDate: f, toDate: p, disabledDates: ot, numberOfMonths: st = 2, calendarSystem: ct, defaultCalendarSystem: lt = "shamsi", onCalendarSystemChange: ut, open: dt, onOpenChange: ft, onInvalid: pt, disabled: m = !1, id: mt, "aria-label": ht, "aria-labelledby": gt, "aria-describedby": h } = Je, { messages: g, digits: _, dir: v } = e(), y = Je.onChange, _t = o.useId(), vt = mt ?? _t, yt = Qe, b = tt === "range", x = rt !== void 0, [bt, xt] = a({
23
- value: dt,
26
+ var nt = 50;
27
+ function rt(rt, u) {
28
+ let { className: it, title: at, required: ot = !1, showRequiredMessage: st = !1, placeholder: ct, mode: lt = "single", allowManualInput: ut = !1, value: dt, defaultValue: ft, typeDateExport: d, typeDateOutput: pt = "object", fromDate: f, toDate: p, disabledDates: mt, numberOfMonths: ht = 2, calendarSystem: gt, defaultCalendarSystem: _t = "shamsi", onCalendarSystemChange: vt, open: yt, onOpenChange: bt, onInvalid: xt, disabled: m = !1, id: St, "aria-label": Ct, "aria-labelledby": wt, "aria-describedby": Tt } = rt, { messages: h, digits: g, dir: _ } = e(), v = rt.onChange, Et = o.useId(), Dt = St ?? Et, Ot = ot, y = lt === "range", b = dt !== void 0, [kt, At] = oe({
29
+ value: yt,
24
30
  defaultValue: !1,
25
- onChange: ft
26
- }), [St, Ct] = o.useState(() => {
27
- let e = b ? null : Le(it, !1), t = e === null ? void 0 : De(e, !1, d);
31
+ onChange: bt
32
+ }), [jt, Mt] = o.useState(null), [x, Nt] = o.useState(!1), Pt = o.useRef(null), Ft = o.useRef(null), It = o.useRef(null), [Lt, Rt] = o.useState(() => {
33
+ let e = y ? null : He(ft, !1), t = e === null ? void 0 : Me(e, !1, d);
28
34
  return t instanceof Date ? t : void 0;
29
- }), [wt, Tt] = o.useState(() => {
30
- let e = b ? Le(it, !0) : null, t = e === null ? void 0 : De(e, !0, d);
31
- return we(t) ? t : void 0;
32
- }), Et = Le(rt, b), S = o.useMemo(() => Et === null ? void 0 : De(Et, b, d), [
33
- Et,
34
- b,
35
+ }), [zt, Bt] = o.useState(() => {
36
+ let e = y ? He(ft, !0) : null, t = e === null ? void 0 : Me(e, !0, d);
37
+ return Ae(t) ? t : void 0;
38
+ }), Vt = He(dt, y), S = o.useMemo(() => Vt === null ? void 0 : Me(Vt, y, d), [
39
+ Vt,
40
+ y,
35
41
  d
36
- ]), C = b ? void 0 : x ? S instanceof Date ? S : void 0 : St, w = b ? x ? we(S) ? S : void 0 : wt : void 0, [T, E] = o.useState("day"), { isInvalid: Dt, setIsInvalid: D, handleInvalid: Ot } = te(pt), [O, kt] = o.useState(""), [At, k] = o.useState(!1), [A, jt] = o.useState(""), [j, Mt] = o.useState(""), [Nt, Pt] = o.useState(!1), [Ft, M] = o.useState(!1), [N, It] = a({
37
- value: ct,
38
- defaultValue: lt,
39
- onChange: ut
40
- }), P = d ?? N, F = g.calendar.locale, I = je(N, F), L = Me(N, _), R = o.useMemo(() => f ? L.startOfMonth(f) : void 0, [f, L]), z = o.useMemo(() => p ? L.startOfMonth(p) : void 0, [L, p]), B = o.useMemo(() => Ne(f, p, ot), [
41
- ot,
42
+ ]), C = y ? void 0 : b ? S instanceof Date ? S : void 0 : Lt, w = y ? b ? Ae(S) ? S : void 0 : zt : void 0, [T, E] = o.useState("day"), { isInvalid: Ht, setIsInvalid: Ut, handleInvalid: Wt } = ae(xt), [Gt, Kt] = o.useState(""), [qt, D] = o.useState(!1), [O, Jt] = o.useState(""), [k, Yt] = o.useState(""), [Xt, Zt] = o.useState(!1), [Qt, A] = o.useState(!1), [j, $t] = oe({
43
+ value: gt,
44
+ defaultValue: _t,
45
+ onChange: vt
46
+ }), M = d ?? j, N = h.calendar.locale, P = Ie(j, N), F = Le(j, g), I = o.useMemo(() => f ? F.startOfMonth(f) : void 0, [f, F]), L = o.useMemo(() => p ? F.startOfMonth(p) : void 0, [F, p]), R = o.useMemo(() => Re(f, p, mt), [
47
+ mt,
42
48
  f,
43
49
  p
44
- ]), [Lt, Rt] = o.useState(() => be(Ie(b, C, w) ?? /* @__PURE__ */ new Date(), R, z, L)), V = o.useMemo(() => be(Lt, R, z, L), [
45
- Lt,
46
- z,
47
- R,
48
- L
49
- ]), zt = o.useRef(null), Bt = o.useMemo(() => n(zt, u), [u]), Vt = o.useMemo(() => n(u), [u]), Ht = o.useRef(null), Ut = o.useRef(null), Wt = o.useRef(null), Gt = o.useRef(null), Kt = o.useRef(null), H = bt, qt = Ie(b, C, w), Jt = b ? nt ? 1 : Math.max(1, st) : 1, U = L.getYear(V), Yt = L.getMonth(V), W = b ? !!w?.from : C instanceof Date, Xt = b ? Se(w, N, g.datePicker.rangeTo, _, F) : C ? xe(C, N, _, F) : null, Zt = et ?? g.datePicker.placeholder, G = nt, Qt = o.useMemo(() => Ee(I.monthFormatter.format(V), N, _), [
50
- _,
51
- V,
52
- I,
53
- N
54
- ]), $t = o.useMemo(() => Ee(I.yearFormatter.format(V), N, _), [
55
- _,
56
- V,
50
+ ]), [en, tn] = o.useState(() => Ee(Ve(y, C, w) ?? /* @__PURE__ */ new Date(), I, L, F)), z = o.useMemo(() => Ee(en, I, L, F), [
51
+ en,
52
+ L,
57
53
  I,
58
- N
59
- ]), en = o.useMemo(() => Array.from({ length: 12 }, (e, t) => {
60
- let n = L.newDate(U, t, 1);
54
+ F
55
+ ]), nn = o.useRef(null), rn = o.useMemo(() => n(nn, u), [u]), an = o.useMemo(() => n(u), [u]), on = o.useRef(null), sn = o.useRef(null), cn = o.useRef(null), ln = o.useRef(null), un = o.useRef(null), B = kt, V = B && (jt ?? se()), [dn, fn] = o.useState(!1);
56
+ B && dn !== V && fn(V);
57
+ let pn = B ? V : dn;
58
+ o.useEffect(() => {
59
+ if (!V || x) return;
60
+ let e = 0, t = window.requestAnimationFrame(() => {
61
+ e = window.requestAnimationFrame(() => Nt(!0));
62
+ });
63
+ return () => {
64
+ window.cancelAnimationFrame(t), window.cancelAnimationFrame(e);
65
+ };
66
+ }, [V, x]), ue(() => {
67
+ V && x && Pt.current && (Ft.current = Pt.current.offsetHeight), It.current && Ft.current !== null && (It.current.style.height = `${Ft.current}px`);
68
+ });
69
+ let H = ce(), mn = le(), hn = Ve(y, C, w), gn = y ? ut || pn ? 1 : Math.max(1, ht) : 1, U = F.getYear(z), _n = F.getMonth(z), W = y ? !!w?.from : C instanceof Date, vn = y ? Oe(w, j, h.datePicker.rangeTo, g, N) : C ? De(C, j, g, N) : null, yn = ct ?? h.datePicker.placeholder, G = ut, bn = pn && (G || mn), xn = o.useMemo(() => a(P.monthFormatter.format(z), j, g), [
70
+ g,
71
+ z,
72
+ P,
73
+ j
74
+ ]), Sn = o.useMemo(() => a(P.yearFormatter.format(z), j, g), [
75
+ g,
76
+ z,
77
+ P,
78
+ j
79
+ ]), Cn = o.useMemo(() => Array.from({ length: 12 }, (e, t) => {
80
+ let n = F.newDate(U, t, 1);
61
81
  return {
62
82
  value: t,
63
- label: Ee(I.monthFormatter.format(n), N, _),
64
- isActive: t === Yt
83
+ label: a(P.monthFormatter.format(n), j, g),
84
+ isActive: t === _n
65
85
  };
66
86
  }), [
67
- Yt,
87
+ _n,
68
88
  U,
69
- _,
70
- I.monthFormatter,
71
- N,
72
- L
73
- ]), tn = o.useMemo(() => {
74
- let e = L.getYear(/* @__PURE__ */ new Date()), t = R ? L.getYear(R) : Math.min(e - 100, U), n = (z ? L.getYear(z) : Math.max(e + 10, U)) - t + 1;
89
+ g,
90
+ P.monthFormatter,
91
+ j,
92
+ F
93
+ ]), wn = o.useMemo(() => {
94
+ let e = F.getYear(/* @__PURE__ */ new Date()), t = I ? F.getYear(I) : Math.min(e - 100, U), n = (L ? F.getYear(L) : Math.max(e + 10, U)) - t + 1;
75
95
  return Array.from({ length: n }, (e, n) => {
76
96
  let r = t + n;
77
97
  return {
78
98
  value: r,
79
- label: L.formatNumber(r),
99
+ label: F.formatNumber(r),
80
100
  isActive: r === U
81
101
  };
82
102
  });
83
103
  }, [
84
104
  U,
85
- z,
86
- R,
87
- L
88
- ]), nn = o.useMemo(() => L.addMonths(V, -1), [V, L]), rn = o.useMemo(() => L.addMonths(V, 1), [V, L]), an = !!(T === "year" || T === "day" && R && L.isBefore(L.startOfMonth(nn), R)), on = !!(T === "year" || T === "day" && z && L.isAfter(L.startOfMonth(rn), z)), sn = o.useMemo(() => {
89
- let e = We();
105
+ L,
106
+ I,
107
+ F
108
+ ]), Tn = o.useMemo(() => F.addMonths(z, -1), [z, F]), En = o.useMemo(() => F.addMonths(z, 1), [z, F]), Dn = !!(T === "year" || T === "day" && I && F.isBefore(F.startOfMonth(Tn), I)), On = !!(T === "year" || T === "day" && L && F.isAfter(F.startOfMonth(En), L)), kn = o.useMemo(() => {
109
+ let e = Qe();
90
110
  return {
91
111
  ...e,
92
- root: t("zui:w-max", e.root),
93
- months: t("zui:flex zui:flex-col zui:gap-4 zui:sm:flex-row zui:sm:items-start", e.months),
94
- month: t("zui:space-y-3", e.month),
112
+ root: t("zui:w-max zui:mobile:w-full", e.root),
113
+ months: t("zui:flex zui:flex-col zui:gap-4 zui:desktop:flex-row zui:desktop:items-start", e.months),
114
+ month: t("zui:space-y-3 zui:mobile:w-full", e.month),
95
115
  month_caption: t("zui:hidden", e.month_caption),
96
116
  caption_label: t("zui:hidden", e.caption_label),
97
117
  nav: t("zui:hidden", e.nav),
98
118
  month_grid: t("zui:w-full zui:border-collapse", e.month_grid),
99
119
  weekdays: t("zui:mt-2 zui:flex zui:w-full", e.weekdays),
100
- weekday: t(pe(), e.weekday),
120
+ weekday: t(Se(), e.weekday),
101
121
  week: t("zui:mt-1 zui:flex zui:w-full", e.week),
102
122
  day: t("zui:relative zui:flex-1 zui:p-0 zui:text-center", e.day),
103
- day_button: t(re(), e.day_button),
104
- selected: t("zui:rounded-[calc(var(--zui-scale,10px)*1.12)] zui:bg-[var(--zui-theme-action-primary)] zui:text-[var(--zui-color-text)] zui:hover:bg-[var(--zui-theme-action-primary-hover)] zui:focus-visible:bg-[var(--zui-theme-action-primary-hover)]", e.selected),
123
+ day_button: t(fe(), e.day_button),
124
+ selected: t("zui:rounded-[calc(var(--zui-scale,10px)*1.12)] zui:bg-[var(--zui-theme-action-primary)] zui:text-[var(--zui-color-surface)] zui:[&>button]:text-[var(--zui-color-surface)] zui:hover:bg-[var(--zui-theme-action-primary-hover)] zui:focus-visible:bg-[var(--zui-theme-action-primary-hover)]", e.selected),
105
125
  today: t("zui:border zui:border-[var(--zui-theme-action-secondary)] zui:text-[var(--zui-theme-action-secondary)]", e.today),
106
126
  outside: t("zui:text-[var(--zui-color-text)] zui:opacity-55", e.outside),
107
127
  disabled: t("zui:text-[var(--zui-color-text)] zui:opacity-45", e.disabled),
108
128
  hidden: t("zui:invisible", e.hidden),
109
- range_start: t("zui:rounded-s-[var(--zui-radius-xs)] zui:bg-[var(--zui-theme-action-primary)] zui:text-[var(--zui-color-text)]", e.range_start),
110
- range_end: t("zui:rounded-e-[var(--zui-radius-xs)] zui:bg-[var(--zui-theme-action-primary)] zui:text-[var(--zui-color-text)]", e.range_end),
129
+ range_start: t("zui:rounded-s-[var(--zui-radius-xs)] zui:bg-[var(--zui-theme-action-primary)] zui:text-[var(--zui-color-surface)] zui:[&>button]:text-[var(--zui-color-surface)]", e.range_start),
130
+ range_end: t("zui:rounded-e-[var(--zui-radius-xs)] zui:bg-[var(--zui-theme-action-primary)] zui:text-[var(--zui-color-surface)] zui:[&>button]:text-[var(--zui-color-surface)]", e.range_end),
111
131
  range_middle: t("zui:bg-[var(--zui-theme-action-primary)]/15 zui:text-[var(--zui-color-text)]", e.range_middle)
112
132
  };
113
133
  }, []), K = o.useCallback((e) => {
114
- Rt((t) => {
115
- let n = be(e, R, z, L);
116
- return L.isSameMonth(t, n) ? t : n;
134
+ tn((t) => {
135
+ let n = Ee(e, I, L, F);
136
+ return F.isSameMonth(t, n) ? t : n;
117
137
  });
118
138
  }, [
119
- z,
120
- R,
121
- L
122
- ]), q = qt?.getTime(), cn = [
139
+ L,
140
+ I,
141
+ F
142
+ ]), An = hn?.getTime(), jn = [
123
143
  G,
124
- b,
125
- P,
144
+ y,
145
+ M,
126
146
  C?.getTime(),
127
147
  w?.from?.getTime(),
128
148
  w?.to?.getTime()
129
- ].join("|"), [J, ln] = o.useState({
130
- selectedDateKey: q,
131
- calendarSystem: N,
132
- isOpen: H,
149
+ ].join("|"), [q, Mn] = o.useState({
150
+ selectedDateKey: An,
151
+ calendarSystem: j,
152
+ isOpen: B,
133
153
  manualInputSyncKey: ""
134
154
  });
135
- if ((J.selectedDateKey !== q || J.calendarSystem !== N || J.isOpen !== H || J.manualInputSyncKey !== cn) && (ln({
136
- selectedDateKey: q,
137
- calendarSystem: N,
138
- isOpen: H,
139
- manualInputSyncKey: cn
140
- }), J.selectedDateKey !== q && qt && K(qt), (J.calendarSystem !== N || J.isOpen && !H) && E("day"), J.manualInputSyncKey !== cn && G)) {
141
- let e = (e) => e ? ve(Pe(e, P)) : "";
142
- b ? (jt(e(w?.from)), Mt(e(w?.to)), Pt(!1), M(!1)) : (kt(e(C)), k(!1));
155
+ if ((q.selectedDateKey !== An || q.calendarSystem !== j || q.isOpen !== B || q.manualInputSyncKey !== jn) && (Mn({
156
+ selectedDateKey: An,
157
+ calendarSystem: j,
158
+ isOpen: B,
159
+ manualInputSyncKey: jn
160
+ }), q.selectedDateKey !== An && hn && K(hn), (q.calendarSystem !== j || q.isOpen && !B) && E("day"), q.manualInputSyncKey !== jn && G)) {
161
+ let e = (e) => e ? we(ze(e, M)) : "";
162
+ y ? (Jt(e(w?.from)), Yt(e(w?.to)), Zt(!1), A(!1)) : (Kt(e(C)), D(!1));
143
163
  }
144
- let un = Dt && !W;
164
+ let Nn = Ht && !W;
145
165
  o.useEffect(() => {
146
- T === "year" && Kt.current?.scrollIntoView({ block: "center" });
166
+ T === "year" && un.current?.scrollIntoView({ block: "center" });
147
167
  }, [T]);
148
- let Y = xt, dn = o.useCallback(() => {
149
- It(Fe(N));
150
- }, [N, It]), X = o.useCallback((e) => {
151
- D(!1), x || Ct(e), y?.(Ce(e, "single", P, at)), e && Y(!1);
168
+ let J = o.useCallback((e) => {
169
+ Mt(e ? se() : null), e && Nt(!1), At(e);
170
+ }, [At]), Pn = o.useCallback(() => {
171
+ $t(Be(j));
172
+ }, [j, $t]), Y = o.useCallback((e) => {
173
+ Ut(!1), b || Rt(e), v?.(ke(e, "single", M, pt)), e && J(!1);
152
174
  }, [
153
- Y,
154
- x,
155
- D,
156
- y,
157
- P,
158
- at
159
- ]), Z = o.useCallback((e) => {
160
- D(!1), x || Tt(e), y?.(Ce(e, "range", P, at)), e?.from && e.to && Y(!1);
175
+ J,
176
+ b,
177
+ Ut,
178
+ v,
179
+ M,
180
+ pt
181
+ ]), X = o.useCallback((e) => {
182
+ Ut(!1), b || Bt(e), v?.(ke(e, "range", M, pt)), e?.from && e.to && J(!1);
161
183
  }, [
162
- Y,
163
- x,
164
- D,
165
- y,
166
- P,
167
- at
168
- ]), fn = o.useCallback(() => {
169
- m || (b ? Z(void 0) : X(void 0));
184
+ J,
185
+ b,
186
+ Ut,
187
+ v,
188
+ M,
189
+ pt
190
+ ]), Fn = o.useCallback(() => {
191
+ m || (y ? X(void 0) : Y(void 0));
170
192
  }, [
171
193
  m,
172
- Z,
173
194
  X,
174
- b
175
- ]), pn = o.useCallback((e) => {
176
- e.preventDefault(), e.stopPropagation(), fn();
177
- }, [fn]), Q = o.useCallback((e) => {
195
+ Y,
196
+ y
197
+ ]), In = o.useCallback((e) => {
198
+ e.preventDefault(), e.stopPropagation(), Fn();
199
+ }, [Fn]), Z = o.useCallback((e) => {
178
200
  if (e.length === 0) {
179
- k(!1), X(void 0);
201
+ D(!1), Y(void 0);
180
202
  return;
181
203
  }
182
- let t = Oe(e, L, P, B);
204
+ let t = Ne(e, F, M, R);
183
205
  if (!t) {
184
- k(!0);
206
+ D(!0);
185
207
  return;
186
208
  }
187
- k(!1), !(C && L.isSameDay(C, t)) && X(t);
209
+ D(!1), !(C && F.isSameDay(C, t)) && Y(t);
188
210
  }, [
189
- X,
190
- L,
191
- B,
192
- P,
211
+ Y,
212
+ F,
213
+ R,
214
+ M,
193
215
  C
194
- ]), mn = o.useCallback((e) => {
195
- ke(e, kt, k, Q);
196
- }, [Q]), hn = o.useCallback((e) => {
197
- Ae(e, O, kt, k, Q);
198
- }, [Q, O]), $ = o.useCallback((e, t) => {
199
- let n = e.length === 0 ? null : Oe(e, L, P, B), r = t.length === 0 ? null : Oe(t, L, P, B), ee = e.length > 0 && !n, te = t.length > 0 && !r;
200
- if (Pt(ee), M(te), ee || te) return;
201
- if (n && r && L.isAfter(n, r)) {
202
- M(!0);
216
+ ]), Ln = o.useCallback((e) => {
217
+ Pe(e, Kt, D, Z);
218
+ }, [Z]), Rn = o.useCallback((e) => {
219
+ Fe(e, Gt, Kt, D, Z);
220
+ }, [Z, Gt]), Q = o.useCallback((e, t) => {
221
+ let n = e.length === 0 ? null : Ne(e, F, M, R), r = t.length === 0 ? null : Ne(t, F, M, R), ee = e.length > 0 && !n, te = t.length > 0 && !r;
222
+ if (Zt(ee), A(te), ee || te) return;
223
+ if (n && r && F.isAfter(n, r)) {
224
+ A(!0);
203
225
  return;
204
226
  }
205
- let i = n ?? void 0, a = r ?? void 0;
206
- if (!(Te(i, w?.from, L) && Te(a, w?.to, L))) {
207
- if (!i && !a) {
208
- Z(void 0);
227
+ let i = n ?? void 0, ne = r ?? void 0;
228
+ if (!(je(i, w?.from, F) && je(ne, w?.to, F))) {
229
+ if (!i && !ne) {
230
+ X(void 0);
209
231
  return;
210
232
  }
211
- Z({
233
+ X({
212
234
  from: i,
213
- to: a
235
+ to: ne
214
236
  });
215
237
  }
216
238
  }, [
217
- Z,
218
- L,
219
- B,
220
- P,
239
+ X,
240
+ F,
241
+ R,
242
+ M,
221
243
  w
222
- ]), gn = o.useCallback(() => {
223
- Ht.current?.focus();
224
- }, []), _n = o.useCallback((e) => {
225
- e.preventDefault(), Ut.current?.focus();
226
- }, []), vn = o.useCallback((e) => {
244
+ ]), zn = o.useCallback(() => {
245
+ on.current?.focus();
246
+ }, []), Bn = o.useCallback((e) => {
247
+ e.preventDefault(), sn.current?.focus();
248
+ }, []), Vn = o.useCallback((e) => {
227
249
  if (m) return;
228
250
  let t = e.target;
229
- t.tagName === "INPUT" || t.closest("button") || (e.preventDefault(), Y(!0), b ? Ut.current?.focus() : Wt.current?.focus());
251
+ t.tagName === "INPUT" || t.closest("button") || (e.preventDefault(), J(!0), !H && (y ? sn.current?.focus() : cn.current?.focus()));
230
252
  }, [
231
253
  m,
232
- Y,
233
- b
234
- ]), yn = o.useCallback((e) => {
235
- ke(e, jt, Pt, (e) => $(e, j), gn);
254
+ J,
255
+ H,
256
+ y
257
+ ]), Hn = o.useCallback((e) => {
258
+ Pe(e, Jt, Zt, (e) => Q(e, k), zn);
236
259
  }, [
237
- $,
238
- gn,
239
- j
240
- ]), bn = o.useCallback((e) => {
241
- Ae(e, A, jt, Pt, (e) => $(e, j), gn);
260
+ Q,
261
+ zn,
262
+ k
263
+ ]), Un = o.useCallback((e) => {
264
+ Fe(e, O, Jt, Zt, (e) => Q(e, k), zn);
242
265
  }, [
243
- $,
244
- gn,
245
- A,
246
- j
247
- ]), xn = o.useCallback(() => {
248
- $(A, j);
266
+ Q,
267
+ zn,
268
+ O,
269
+ k
270
+ ]), Wn = o.useCallback(() => {
271
+ Q(O, k);
249
272
  }, [
250
- $,
251
- A,
252
- j
253
- ]), Sn = o.useCallback((e) => {
254
- ke(e, Mt, M, (e) => $(A, e));
255
- }, [$, A]), Cn = o.useCallback((e) => {
256
- Ae(e, j, Mt, M, (e) => $(A, e));
273
+ Q,
274
+ O,
275
+ k
276
+ ]), Gn = o.useCallback((e) => {
277
+ Pe(e, Yt, A, (e) => Q(O, e));
278
+ }, [Q, O]), Kn = o.useCallback((e) => {
279
+ Fe(e, k, Yt, A, (e) => Q(O, e));
257
280
  }, [
258
- $,
259
- A,
260
- j
261
- ]), wn = o.useCallback(() => {
262
- $(A, j);
281
+ Q,
282
+ O,
283
+ k
284
+ ]), qn = o.useCallback(() => {
285
+ Q(O, k);
263
286
  }, [
264
- $,
265
- A,
266
- j
267
- ]), Tn = o.useCallback(() => {
268
- Y(!0);
269
- }, [Y]), En = o.useCallback(() => {
287
+ Q,
288
+ O,
289
+ k
290
+ ]), Jn = o.useCallback(() => {
291
+ H && J(!0);
292
+ }, [J, H]), Yn = o.useCallback(() => {
293
+ se() || J(!0);
294
+ }, [J]), Xn = o.useCallback(() => {
270
295
  if (T !== "year") {
271
296
  if (T === "month") {
272
- K(L.addYears(V, -1));
297
+ K(F.addYears(z, -1));
273
298
  return;
274
299
  }
275
- an || K(nn);
300
+ Dn || K(Tn);
276
301
  }
277
302
  }, [
278
303
  T,
279
- V,
280
- an,
281
- nn,
282
- L,
304
+ z,
305
+ Dn,
306
+ Tn,
307
+ F,
283
308
  K
284
- ]), Dn = o.useCallback(() => {
309
+ ]), Zn = o.useCallback(() => {
285
310
  if (T !== "year") {
286
311
  if (T === "month") {
287
- K(L.addYears(V, 1));
312
+ K(F.addYears(z, 1));
288
313
  return;
289
314
  }
290
- on || K(rn);
315
+ On || K(En);
291
316
  }
292
317
  }, [
293
318
  T,
294
- V,
295
- on,
296
- rn,
297
- L,
319
+ z,
320
+ On,
321
+ En,
322
+ F,
298
323
  K
299
- ]), On = o.useCallback(() => {
324
+ ]), Qn = o.useCallback(() => {
300
325
  E("month");
301
- }, []), kn = o.useCallback(() => {
326
+ }, []), $n = o.useCallback(() => {
302
327
  E("year");
303
- }, []), An = o.useCallback((e) => {
304
- K(L.setMonth(V, e)), E("day");
328
+ }, []), er = o.useCallback((e) => {
329
+ K(F.setMonth(z, e)), E("day");
305
330
  }, [
306
- V,
307
- L,
331
+ z,
332
+ F,
308
333
  K
309
- ]), jn = o.useCallback((e) => {
310
- K(L.setYear(V, e)), E("month");
334
+ ]), tr = o.useCallback((e) => {
335
+ K(F.setYear(z, e)), E("month");
311
336
  }, [
312
- V,
313
- L,
337
+ z,
338
+ F,
314
339
  K
315
- ]), Mn = N === "shamsi" ? Ke : Ue, Nn = {
316
- dir: v,
317
- locale: N === "shamsi" && F.startsWith("fa") ? qe : Ge,
318
- numerals: N === "shamsi" && _ === "persian" ? "arabext" : "latn",
340
+ ]), nr = j === "shamsi" ? et : Ze, rr = {
341
+ dir: _,
342
+ locale: j === "shamsi" && N.startsWith("fa") ? tt : $e,
343
+ numerals: j === "shamsi" && g === "persian" ? "arabext" : "latn",
319
344
  showOutsideDays: !0,
320
- month: V,
345
+ month: z,
321
346
  onMonthChange: K,
322
- numberOfMonths: Jt,
323
- startMonth: R,
324
- endMonth: z,
325
- disabled: B,
347
+ numberOfMonths: gn,
348
+ startMonth: I,
349
+ endMonth: L,
350
+ disabled: R,
326
351
  hideNavigation: !0,
327
- classNames: sn
328
- }, Pn = T === "year" ? g.datePicker.selectYear : T === "month" ? g.datePicker.selectMonth : null, Fn = {
352
+ classNames: kn
353
+ }, ir = T === "year" ? h.datePicker.selectYear : T === "month" ? h.datePicker.selectMonth : null, ar = {
329
354
  day: {
330
- previous: g.datePicker.previousMonth,
331
- next: g.datePicker.nextMonth
355
+ previous: h.datePicker.previousMonth,
356
+ next: h.datePicker.nextMonth
332
357
  },
333
358
  month: {
334
- previous: g.datePicker.previousYear,
335
- next: g.datePicker.nextYear
359
+ previous: h.datePicker.previousYear,
360
+ next: h.datePicker.nextYear
336
361
  },
337
362
  year: {
338
- previous: g.datePicker.previous,
339
- next: g.datePicker.next
363
+ previous: h.datePicker.previous,
364
+ next: h.datePicker.next
340
365
  }
341
- }[T], In = v === "rtl" ? Ve : Be, Ln = v === "rtl" ? Be : Ve;
366
+ }[T], or = _ === "rtl" ? Ye : Je, sr = _ === "rtl" ? Je : Ye, cr = o.useRef(null), $ = pn && T === "day", lr = (e) => y ? /* @__PURE__ */ s(nr, {
367
+ ...rr,
368
+ month: e,
369
+ fixedWeeks: $,
370
+ mode: "range",
371
+ selected: w,
372
+ onSelect: X,
373
+ min: 1
374
+ }) : /* @__PURE__ */ s(nr, {
375
+ ...rr,
376
+ month: e,
377
+ fixedWeeks: $,
378
+ mode: "single",
379
+ selected: C,
380
+ onSelect: Y
381
+ }), ur = o.useRef(null), dr = o.useRef(!1), fr = /* @__PURE__ */ c("div", {
382
+ "data-slot": "date-picker-calendar",
383
+ className: "zui:w-fit zui:max-w-full zui:mobile:w-full zui:mobile:touch-pan-y",
384
+ onPointerDown: (e) => {
385
+ dr.current = !1, ur.current = pn && !$ ? {
386
+ x: e.clientX,
387
+ y: e.clientY
388
+ } : null;
389
+ },
390
+ onPointerUp: (e) => {
391
+ let t = ur.current;
392
+ if (ur.current = null, !t) return;
393
+ let n = e.clientX - t.x, r = e.clientY - t.y;
394
+ Math.abs(n) < nt || Math.abs(n) < Math.abs(r) * 1.5 || (dr.current = !0, (_ === "rtl" ? n > 0 : n < 0) ? Zn() : Xn());
395
+ },
396
+ onPointerCancel: () => {
397
+ ur.current = null;
398
+ },
399
+ onClickCapture: (e) => {
400
+ dr.current && (dr.current = !1, e.preventDefault(), e.stopPropagation());
401
+ },
402
+ children: [/* @__PURE__ */ c("div", {
403
+ "data-slot": "date-picker-header",
404
+ className: pe(),
405
+ children: [
406
+ /* @__PURE__ */ s("button", {
407
+ type: "button",
408
+ "data-slot": "date-picker-nav-previous",
409
+ className: me(),
410
+ onClick: $ ? () => cr.current?.slide("previous") : Xn,
411
+ disabled: Dn,
412
+ "aria-label": ar.previous,
413
+ children: /* @__PURE__ */ s(or, { className: "zui:size-4 zui:mobile:size-[max(calc(var(--zui-spacing)*6.3),24px)]" })
414
+ }),
415
+ /* @__PURE__ */ c("div", {
416
+ "data-slot": "date-picker-switch-group",
417
+ className: be(),
418
+ children: [
419
+ /* @__PURE__ */ s("button", {
420
+ type: "button",
421
+ "data-slot": "date-picker-switch-month",
422
+ className: ye({ active: T === "month" }),
423
+ onClick: Qn,
424
+ children: /* @__PURE__ */ s("span", { children: xn })
425
+ }),
426
+ /* @__PURE__ */ s("button", {
427
+ type: "button",
428
+ "data-slot": "date-picker-switch-year",
429
+ className: ye({ active: T === "year" }),
430
+ onClick: $n,
431
+ children: /* @__PURE__ */ s("span", { children: Sn })
432
+ }),
433
+ /* @__PURE__ */ s("button", {
434
+ type: "button",
435
+ "data-slot": "date-picker-switch-calendar",
436
+ className: de(),
437
+ onClick: Pn,
438
+ "aria-label": h.datePicker.switchCalendar,
439
+ children: /* @__PURE__ */ s(Ke, {
440
+ className: "zui:size-3.5 zui:mobile:size-6",
441
+ "aria-hidden": "true"
442
+ })
443
+ })
444
+ ]
445
+ }),
446
+ /* @__PURE__ */ s("button", {
447
+ type: "button",
448
+ "data-slot": "date-picker-nav-next",
449
+ className: me(),
450
+ onClick: $ ? () => cr.current?.slide("next") : Zn,
451
+ disabled: On,
452
+ "aria-label": ar.next,
453
+ children: /* @__PURE__ */ s(sr, { className: "zui:size-4 zui:mobile:size-[max(calc(var(--zui-spacing)*6.3),24px)]" })
454
+ })
455
+ ]
456
+ }), /* @__PURE__ */ c("div", {
457
+ className: "zui:px-2 zui:pb-2 zui:pt-1.5",
458
+ children: [ir ? /* @__PURE__ */ s("p", {
459
+ "data-slot": "date-picker-panel-hint",
460
+ className: ge(),
461
+ children: ir
462
+ }) : null, T === "year" ? /* @__PURE__ */ s("div", {
463
+ ref: ln,
464
+ "data-slot": "date-picker-year-list",
465
+ className: Ce(),
466
+ children: wn.map((e) => /* @__PURE__ */ s("button", {
467
+ ref: e.isActive ? un : void 0,
468
+ type: "button",
469
+ "data-slot": "date-picker-year-item",
470
+ className: _e({ active: e.isActive }),
471
+ onClick: () => tr(e.value),
472
+ children: e.label
473
+ }, e.value))
474
+ }) : T === "month" ? /* @__PURE__ */ s("div", {
475
+ "data-slot": "date-picker-month-grid",
476
+ className: he(),
477
+ children: Cn.map((e) => /* @__PURE__ */ s("button", {
478
+ type: "button",
479
+ "data-slot": "date-picker-month-item",
480
+ className: _e({ active: e.isActive }),
481
+ onClick: () => er(e.value),
482
+ children: e.label
483
+ }, e.value))
484
+ }) : $ ? /* @__PURE__ */ s(We, {
485
+ ref: cr,
486
+ month: z,
487
+ dateLib: F,
488
+ dir: _,
489
+ canGoPrevious: !Dn,
490
+ canGoNext: !On,
491
+ onMonthChange: K,
492
+ renderMonth: lr
493
+ }) : lr(z)]
494
+ })]
495
+ });
342
496
  return /* @__PURE__ */ c("div", {
343
497
  "data-slot": "date-picker-field",
344
- dir: v,
498
+ dir: _,
345
499
  className: "zui:relative zui:w-full zui:space-y-1.5 zui:text-start",
346
500
  children: [
347
- /* @__PURE__ */ s(ee, {
348
- title: Ze,
349
- htmlFor: vt,
350
- required: yt,
351
- showRequiredMessage: $e
501
+ /* @__PURE__ */ s(ie, {
502
+ title: at,
503
+ htmlFor: Dt,
504
+ required: Ot,
505
+ showRequiredMessage: st
352
506
  }),
353
507
  /* @__PURE__ */ c(l.Root, {
354
- open: H,
355
- onOpenChange: Y,
508
+ open: B && !V,
509
+ onOpenChange: J,
356
510
  children: [G ? /* @__PURE__ */ s(l.Anchor, {
357
511
  asChild: !0,
358
512
  children: /* @__PURE__ */ c("div", {
359
- ref: Bt,
360
- role: b ? "group" : void 0,
361
- "aria-label": b ? ht : void 0,
362
- "aria-labelledby": b ? gt : void 0,
513
+ ref: rn,
514
+ role: y ? "group" : void 0,
515
+ "aria-label": y ? Ct : void 0,
516
+ "aria-labelledby": y ? wt : void 0,
363
517
  "data-slot": "date-picker-trigger",
364
518
  "data-has-value": W,
365
- "data-state": H ? "open" : "closed",
366
- "aria-invalid": un || At || Nt || Ft || void 0,
367
- dir: v,
368
- onMouseDown: vn,
369
- className: t(fe({ size: Xe }), m && "zui:pointer-events-none zui:cursor-not-allowed zui:bg-[var(--zui-color-muted-surface)] zui:opacity-50", Ye),
519
+ "data-state": B ? "open" : "closed",
520
+ "aria-invalid": Nn || qt || Xt || Qt || void 0,
521
+ dir: _,
522
+ onMouseDown: Vn,
523
+ className: t(xe(), m && "zui:pointer-events-none zui:cursor-not-allowed zui:bg-[var(--zui-color-muted-surface)] zui:opacity-50", it),
370
524
  children: [
371
- b ? /* @__PURE__ */ c("div", {
525
+ y ? /* @__PURE__ */ c("div", {
372
526
  className: "zui:flex zui:min-w-0 zui:flex-1 zui:items-center zui:justify-start zui:gap-1.5",
373
527
  children: [
374
528
  /* @__PURE__ */ s("span", {
375
529
  className: "zui:shrink-0 zui:text-xs zui:text-[var(--zui-color-text)]",
376
- children: g.datePicker.rangeFrom
530
+ children: h.datePicker.rangeFrom
377
531
  }),
378
532
  /* @__PURE__ */ s("input", {
379
- ref: Ut,
380
- id: vt,
533
+ ref: sn,
534
+ id: Dt,
381
535
  type: "text",
382
- inputMode: "numeric",
536
+ inputMode: H ? "none" : "numeric",
537
+ readOnly: H,
538
+ onClick: Jn,
383
539
  autoComplete: "off",
384
540
  dir: "ltr",
385
541
  disabled: m,
386
- "aria-label": g.datePicker.rangeStartLabel,
387
- "aria-describedby": h,
388
- "aria-invalid": Nt || void 0,
389
- value: ye(A, _),
390
- onChange: yn,
391
- onKeyDown: bn,
392
- onBlur: xn,
393
- onFocus: Tn,
542
+ "aria-label": h.datePicker.rangeStartLabel,
543
+ "aria-describedby": Tt,
544
+ "aria-invalid": Xt || void 0,
545
+ value: Te(O, g),
546
+ onChange: Hn,
547
+ onKeyDown: Un,
548
+ onBlur: Wn,
549
+ onFocus: Yn,
394
550
  className: `${r} zui:shrink-0 zui:truncate zui:bg-transparent zui:text-center zui:text-base zui:text-[var(--zui-color-text)] zui:outline-none zui:md:text-sm`
395
551
  }),
396
552
  /* @__PURE__ */ s("span", {
397
553
  className: "zui:shrink-0 zui:text-xs zui:text-[var(--zui-color-text)]",
398
- children: g.datePicker.rangeTo
554
+ children: h.datePicker.rangeTo
399
555
  }),
400
556
  /* @__PURE__ */ s("input", {
401
- ref: Ht,
557
+ ref: on,
402
558
  type: "text",
403
- inputMode: "numeric",
559
+ inputMode: H ? "none" : "numeric",
560
+ readOnly: H,
561
+ onClick: Jn,
404
562
  autoComplete: "off",
405
563
  dir: "ltr",
406
564
  disabled: m,
407
- "aria-label": g.datePicker.rangeEndLabel,
408
- "aria-describedby": h,
409
- "aria-invalid": Ft || void 0,
410
- value: ye(j, _),
411
- onChange: Sn,
412
- onKeyDown: Cn,
413
- onBlur: wn,
414
- onFocus: Tn,
415
- onMouseDown: _n,
565
+ "aria-label": h.datePicker.rangeEndLabel,
566
+ "aria-describedby": Tt,
567
+ "aria-invalid": Qt || void 0,
568
+ value: Te(k, g),
569
+ onChange: Gn,
570
+ onKeyDown: Kn,
571
+ onBlur: qn,
572
+ onFocus: Yn,
573
+ onMouseDown: Bn,
416
574
  className: `${r} zui:shrink-0 zui:truncate zui:bg-transparent zui:text-center zui:text-base zui:text-[var(--zui-color-text)] zui:outline-none zui:md:text-sm`
417
575
  })
418
576
  ]
419
577
  }) : /* @__PURE__ */ s("input", {
420
- ref: Wt,
421
- id: vt,
578
+ ref: cn,
579
+ id: Dt,
422
580
  type: "text",
423
- inputMode: "numeric",
581
+ inputMode: H ? "none" : "numeric",
582
+ readOnly: H,
583
+ onClick: Jn,
424
584
  autoComplete: "off",
425
585
  dir: "ltr",
426
586
  disabled: m,
427
- "aria-label": ht,
428
- "aria-labelledby": gt,
429
- "aria-describedby": h,
430
- "aria-invalid": un || At || void 0,
431
- value: ye(O, _),
432
- onChange: mn,
433
- onKeyDown: hn,
434
- onBlur: () => Q(O),
435
- onFocus: Tn,
436
- className: "zui:w-full zui:truncate zui:bg-transparent zui:text-start zui:text-base zui:text-[var(--zui-color-text)] zui:outline-none zui:md:text-sm"
587
+ "aria-label": Ct,
588
+ "aria-labelledby": wt,
589
+ "aria-describedby": Tt,
590
+ "aria-invalid": Nn || qt || void 0,
591
+ value: Te(Gt, g),
592
+ onChange: Ln,
593
+ onKeyDown: Rn,
594
+ onBlur: () => Z(Gt),
595
+ onFocus: Yn,
596
+ className: t("zui:w-full zui:truncate zui:bg-transparent zui:text-base zui:text-[var(--zui-color-text)] zui:outline-none zui:md:text-sm", _ === "rtl" ? "zui:text-right" : "zui:text-left")
437
597
  }),
438
- W && !m ? /* @__PURE__ */ s(i, {
439
- text: g.datePicker.clear,
598
+ W && !m ? /* @__PURE__ */ s(te, {
599
+ text: h.datePicker.clear,
440
600
  position: "top",
441
601
  trigger: /* @__PURE__ */ s("button", {
442
602
  type: "button",
443
603
  "data-slot": "date-picker-clear-button",
444
- "aria-label": g.datePicker.clear,
445
- onClick: pn,
604
+ "aria-label": h.datePicker.clear,
605
+ onClick: In,
446
606
  className: "zui:shrink-0 zui:rounded-full zui:p-0.5 zui:text-[var(--zui-color-text)] zui:opacity-70 zui:outline-none zui:hover:cursor-pointer zui:hover:bg-[var(--zui-color-muted-surface)] zui:hover:opacity-100 zui:focus-visible:opacity-100",
447
- children: /* @__PURE__ */ s(He, { className: "zui:size-3.5" })
607
+ children: /* @__PURE__ */ s(Xe, { className: i })
448
608
  })
449
609
  }) : null,
450
610
  /* @__PURE__ */ s("button", {
451
611
  type: "button",
452
612
  "data-slot": "date-picker-trigger-icon",
453
- "aria-label": Zt,
613
+ "aria-label": yn,
454
614
  disabled: m,
455
- onClick: () => Y(!H),
615
+ onClick: () => J(!B),
456
616
  className: "zui:shrink-0 zui:outline-none",
457
- children: /* @__PURE__ */ s(ze, { className: "zui:size-4 zui:text-[var(--zui-color-text)]" })
617
+ children: /* @__PURE__ */ s(qe, { className: "zui:size-4 zui:text-[var(--zui-color-text)]" })
458
618
  })
459
619
  ]
460
620
  })
@@ -463,155 +623,99 @@ function Je(Je, u) {
463
623
  children: [/* @__PURE__ */ s(l.Trigger, {
464
624
  asChild: !0,
465
625
  children: /* @__PURE__ */ c("button", {
466
- ref: Vt,
626
+ ref: an,
467
627
  type: "button",
468
- id: vt,
469
- "aria-label": ht,
470
- "aria-labelledby": gt,
471
- "aria-describedby": h,
628
+ id: Dt,
629
+ "aria-label": Ct,
630
+ "aria-labelledby": wt,
631
+ "aria-describedby": Tt,
472
632
  "data-slot": "date-picker-trigger",
473
633
  "data-has-value": W,
474
- dir: v,
475
- "aria-invalid": un || void 0,
634
+ dir: _,
635
+ "aria-invalid": Nn || void 0,
476
636
  disabled: m,
477
- className: t(fe({ size: Xe }), Ye),
637
+ className: t(xe(), it),
478
638
  children: [
479
639
  /* @__PURE__ */ s("span", {
480
- className: t("zui:min-w-0 zui:flex-1 zui:truncate zui:text-base zui:md:text-sm", W ? "zui:text-[var(--zui-color-text)]" : "zui:text-[var(--zui-theme-text-muted)]"),
481
- children: Xt ?? Zt
640
+ className: t("zui:min-w-0 zui:flex-1 zui:truncate zui:text-base zui:md:text-sm", W ? "zui:text-[var(--zui-color-text)]" : "zui:text-[var(--zui-theme-text-muted)] zui:mobile:text-sm"),
641
+ children: vn ?? yn
482
642
  }),
483
- W && !m ? /* @__PURE__ */ s(ge, {}) : null,
484
- /* @__PURE__ */ s(ze, { className: "zui:size-4 zui:text-[var(--zui-color-text)]" })
643
+ W && !m ? /* @__PURE__ */ s(re, {}) : null,
644
+ /* @__PURE__ */ s(qe, { className: "zui:size-4 zui:text-[var(--zui-color-text)]" })
485
645
  ]
486
646
  })
487
- }), W && !m ? /* @__PURE__ */ s(he, {
647
+ }), W && !m ? /* @__PURE__ */ s(ne, {
488
648
  "data-slot": "date-picker-clear-button",
489
- label: g.datePicker.clear,
490
- onClear: fn
649
+ label: h.datePicker.clear,
650
+ onClear: Fn
491
651
  }) : null]
492
652
  }), /* @__PURE__ */ s(l.Portal, { children: /* @__PURE__ */ s(l.Content, {
493
653
  "data-slot": "date-picker-content",
494
- dir: v,
654
+ dir: _,
495
655
  sideOffset: 8,
496
656
  align: "start",
497
657
  onOpenAutoFocus: (e) => {
498
658
  G && e.preventDefault();
499
659
  },
500
660
  onInteractOutside: (e) => {
501
- zt.current?.contains(e.target) && e.preventDefault();
661
+ nn.current?.contains(e.target) && e.preventDefault();
502
662
  },
503
- className: le(),
504
- children: /* @__PURE__ */ c("div", {
505
- "data-slot": "date-picker-calendar",
506
- className: "zui:w-fit zui:max-w-full",
507
- children: [/* @__PURE__ */ c("div", {
508
- "data-slot": "date-picker-header",
509
- className: ie(),
510
- children: [
511
- /* @__PURE__ */ s("button", {
512
- type: "button",
513
- "data-slot": "date-picker-nav-previous",
514
- className: ae(),
515
- onClick: En,
516
- disabled: an,
517
- "aria-label": Fn.previous,
518
- children: /* @__PURE__ */ s(In, { className: "zui:size-4" })
519
- }),
520
- /* @__PURE__ */ c("div", {
521
- "data-slot": "date-picker-switch-group",
522
- className: de(),
523
- children: [
524
- /* @__PURE__ */ s("button", {
525
- type: "button",
526
- "data-slot": "date-picker-switch-month",
527
- className: ue({ active: T === "month" }),
528
- onClick: On,
529
- children: /* @__PURE__ */ s("span", { children: Qt })
530
- }),
531
- /* @__PURE__ */ s("button", {
532
- type: "button",
533
- "data-slot": "date-picker-switch-year",
534
- className: ue({ active: T === "year" }),
535
- onClick: kn,
536
- children: /* @__PURE__ */ s("span", { children: $t })
537
- }),
538
- /* @__PURE__ */ s("button", {
539
- type: "button",
540
- "data-slot": "date-picker-switch-calendar",
541
- className: ne(),
542
- onClick: dn,
543
- "aria-label": g.datePicker.switchCalendar,
544
- children: /* @__PURE__ */ s(Re, {
545
- className: "zui:size-3.5",
546
- "aria-hidden": "true"
547
- })
548
- })
549
- ]
550
- }),
551
- /* @__PURE__ */ s("button", {
552
- type: "button",
553
- "data-slot": "date-picker-nav-next",
554
- className: ae(),
555
- onClick: Dn,
556
- disabled: on,
557
- "aria-label": Fn.next,
558
- children: /* @__PURE__ */ s(Ln, { className: "zui:size-4" })
559
- })
560
- ]
561
- }), /* @__PURE__ */ c("div", {
562
- className: "zui:px-2 zui:pb-2 zui:pt-1.5",
563
- children: [Pn ? /* @__PURE__ */ s("p", {
564
- "data-slot": "date-picker-panel-hint",
565
- className: se(),
566
- children: Pn
567
- }) : null, T === "year" ? /* @__PURE__ */ s("div", {
568
- ref: Gt,
569
- "data-slot": "date-picker-year-list",
570
- className: me(),
571
- children: tn.map((e) => /* @__PURE__ */ s("button", {
572
- ref: e.isActive ? Kt : void 0,
573
- type: "button",
574
- "data-slot": "date-picker-year-item",
575
- className: ce({ active: e.isActive }),
576
- onClick: () => jn(e.value),
577
- children: e.label
578
- }, e.value))
579
- }) : T === "month" ? /* @__PURE__ */ s("div", {
580
- "data-slot": "date-picker-month-grid",
581
- className: oe(),
582
- children: en.map((e) => /* @__PURE__ */ s("button", {
583
- type: "button",
584
- "data-slot": "date-picker-month-item",
585
- className: ce({ active: e.isActive }),
586
- onClick: () => An(e.value),
587
- children: e.label
588
- }, e.value))
589
- }) : b ? /* @__PURE__ */ s(Mn, {
590
- ...Nn,
591
- mode: "range",
592
- selected: w,
593
- onSelect: Z,
594
- min: 1
595
- }) : /* @__PURE__ */ s(Mn, {
596
- ...Nn,
597
- mode: "single",
598
- selected: C,
599
- onSelect: X
600
- })]
601
- })]
602
- })
663
+ className: ve(),
664
+ children: fr
603
665
  }) })]
604
666
  }),
605
- yt ? /* @__PURE__ */ s(_e, {
667
+ /* @__PURE__ */ s(ee, {
668
+ trigger: null,
669
+ open: V,
670
+ onOpenChange: J,
671
+ dir: _,
672
+ triggerLabel: at ?? yn,
673
+ showCloseButton: !1,
674
+ className: "zui:mobile:px-1",
675
+ content: /* @__PURE__ */ s("div", {
676
+ "data-slot": "date-picker-modal-body",
677
+ ref: Pt,
678
+ children: x ? bn ? /* @__PURE__ */ s("div", {
679
+ className: "zui:px-2",
680
+ children: /* @__PURE__ */ s(Ue, {
681
+ mode: y ? "range" : "single",
682
+ dateLib: F,
683
+ calendarSystem: j,
684
+ selection: y ? {
685
+ from: w?.from,
686
+ to: w?.to
687
+ } : { from: C },
688
+ minDate: f,
689
+ maxDate: p,
690
+ disabledMatchers: R,
691
+ formatMonth: (e) => a(P.monthFormatter.format(e), j, g),
692
+ formatDate: (e) => De(e, j, g, N),
693
+ onSwitchCalendar: Pn,
694
+ onConfirm: (e) => {
695
+ y ? X({
696
+ from: e.from,
697
+ to: e.to
698
+ }) : Y(e.from);
699
+ },
700
+ dir: _
701
+ })
702
+ }) : fr : /* @__PURE__ */ s("div", {
703
+ ref: It,
704
+ "aria-hidden": "true",
705
+ className: "zui:h-[max(calc(var(--zui-scale,10px)*36.8),394px)] zui:short:h-[min(394px,calc(100dvh-80px))]"
706
+ })
707
+ })
708
+ }),
709
+ Ot ? /* @__PURE__ */ s(Ge, {
606
710
  "data-slot": "date-picker-validation",
607
711
  hasValue: W,
608
712
  disabled: m,
609
- onInvalid: Ot
713
+ onInvalid: Wt
610
714
  }) : null
611
715
  ]
612
716
  });
613
717
  }
614
- var u = o.forwardRef(Je);
718
+ var u = o.forwardRef(rt);
615
719
  u.displayName = "DatePicker";
616
720
  //#endregion
617
721
  export { u as default };