impact-nova 2.5.7 → 2.5.8

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 (148) hide show
  1. package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +2 -2
  2. package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
  3. package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
  4. package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
  5. package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
  6. package/dist/components/data-display/calendar/calendar-apply-validation.js +80 -61
  7. package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
  8. package/dist/components/data-display/calendar/calendar-config.js +31 -20
  9. package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
  10. package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
  11. package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
  12. package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
  13. package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
  14. package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
  15. package/dist/components/data-display/calendar/calendar-day-picker-components.js +201 -108
  16. package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +11 -3
  17. package/dist/components/data-display/calendar/calendar-day-picker-view.js +136 -92
  18. package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
  19. package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
  20. package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
  21. package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
  22. package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
  23. package/dist/components/data-display/calendar/calendar-footer.js +88 -66
  24. package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
  25. package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
  26. package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
  27. package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
  28. package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
  29. package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
  30. package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
  31. package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
  32. package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
  33. package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
  34. package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
  35. package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
  36. package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
  37. package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
  38. package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
  39. package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
  40. package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
  41. package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
  42. package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
  43. package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
  44. package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
  45. package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
  46. package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
  47. package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
  48. package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
  49. package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
  50. package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
  51. package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
  52. package/dist/components/data-display/calendar/calendar-selection.js +31 -0
  53. package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
  54. package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
  55. package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
  56. package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
  57. package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
  58. package/dist/components/data-display/calendar/calendar-week-utils.js +49 -42
  59. package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
  60. package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
  61. package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
  62. package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
  63. package/dist/components/data-display/calendar/calendar.d.ts +1 -1
  64. package/dist/components/data-display/calendar/calendar.js +303 -181
  65. package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
  66. package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
  67. package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
  68. package/dist/components/data-display/calendar/index.d.ts +1 -1
  69. package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
  70. package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
  71. package/dist/components/data-display/calendar/use-calendar-state.d.ts +31 -11
  72. package/dist/components/data-display/calendar/use-calendar-state.js +370 -163
  73. package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
  74. package/dist/components/data-display/calendar/use-fiscal-calendar.js +24 -0
  75. package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
  76. package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
  77. package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
  78. package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
  79. package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
  80. package/dist/components/forms/date-picker/date-picker.js +187 -167
  81. package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
  82. package/dist/components/forms/date-picker/date-range-picker.js +273 -224
  83. package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
  84. package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
  85. package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
  86. package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
  87. package/dist/components/forms/date-picker/index.d.ts +12 -0
  88. package/dist/components/forms/date-picker/index.js +19 -7
  89. package/dist/components/forms/date-picker/month-picker.js +225 -182
  90. package/dist/components/forms/date-picker/month-range-picker.js +134 -110
  91. package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
  92. package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
  93. package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
  94. package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
  95. package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
  96. package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
  97. package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
  98. package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
  99. package/dist/components/forms/date-picker/quarter-picker.js +176 -0
  100. package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
  101. package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
  102. package/dist/components/forms/date-picker/week-picker.js +148 -137
  103. package/dist/components/forms/date-picker/week-range-picker.js +216 -205
  104. package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
  105. package/dist/components/forms/date-picker/year-picker.js +176 -0
  106. package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
  107. package/dist/components/forms/date-picker/year-range-picker.js +179 -0
  108. package/dist/form-react/Fields/DateInputField.js +63 -58
  109. package/dist/form-react/Fields/DateRangeField.js +42 -37
  110. package/dist/form-react/Fields/MonthRangeField.js +50 -45
  111. package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
  112. package/dist/form-react/Fields/WeekRangePicker.js +44 -45
  113. package/dist/form-react/components/FieldRenderer.js +21 -23
  114. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
  115. package/dist/form-react/registry/defaultFieldRegistrations.js +27 -36
  116. package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
  117. package/dist/form-react/registry/resolveFieldComponent.js +9 -133
  118. package/dist/form-react/types/fields.types.d.ts +19 -4
  119. package/dist/form-react/utils/date.utils.d.ts +1 -1
  120. package/dist/form-react/utils/date.utils.js +38 -38
  121. package/dist/i18n/defaultMessages.d.ts +19 -1
  122. package/dist/i18n/defaultMessages.js +37 -20
  123. package/dist/i18n/locales/de.js +18 -1
  124. package/dist/i18n/locales/es.js +18 -1
  125. package/dist/i18n/locales/hi.js +18 -1
  126. package/dist/i18n/locales/kn.js +18 -1
  127. package/dist/impact-nova-components.css +379 -3
  128. package/dist/impact-nova.css +1 -1
  129. package/dist/index.js +528 -516
  130. package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
  131. package/dist/lib/fiscal-calendar/build-year.js +173 -0
  132. package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
  133. package/dist/lib/fiscal-calendar/civil-date.js +94 -0
  134. package/dist/lib/fiscal-calendar/index.d.ts +10 -0
  135. package/dist/lib/fiscal-calendar/index.js +40 -0
  136. package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
  137. package/dist/lib/fiscal-calendar/lookup.js +70 -0
  138. package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
  139. package/dist/lib/fiscal-calendar/presets.js +99 -0
  140. package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
  141. package/dist/lib/fiscal-calendar/selection.js +32 -0
  142. package/dist/lib/fiscal-calendar/types.d.ts +145 -0
  143. package/dist/lib/fiscal-calendar/types.js +10 -0
  144. package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
  145. package/dist/lib/fiscal-calendar/week-selection.js +107 -0
  146. package/package.json +5 -1
  147. package/dist/lib/fiscal-calendar.d.ts +0 -62
  148. package/dist/lib/fiscal-calendar.js +0 -99
@@ -0,0 +1,177 @@
1
+ import { jsx as r, jsxs as g } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { Cross as Y, CalendarMonth as Z } from "impact-nova-icons";
4
+ import { cn as _ } from "../../../lib/utils.js";
5
+ import { Input as q } from "../input/input.js";
6
+ import { Calendar as ee } from "../../data-display/calendar/calendar.js";
7
+ import { Tooltip as C, TooltipTrigger as x, TooltipContent as b } from "../../feedback/tooltip/tooltip.js";
8
+ import { useImpactNovaI18n as re } from "../../../i18n/use-impact-nova-i18n.js";
9
+ import { buildDateBoundsMatcher as te } from "../../../lib/date-bounds-matcher.js";
10
+ import { fiscalCalendarPassThrough as ne } from "./fiscal-pass-through.js";
11
+ import { DatePickerShell as oe } from "./date-picker-shell.js";
12
+ import { usePickerDismissActionsRef as ae, usePickerFooterDismissNudge as ie, handleReadonlyPickerKeyDown as ce, handlePickerSurfacePointerDown as se } from "./date-input-behavior.js";
13
+ import { formatQuarterInput as D } from "../../data-display/calendar/calendar-fiscal-labels.js";
14
+ import { viewMonthFromQuarter as le } from "../../data-display/calendar/calendar-quarter-utils.js";
15
+ const fe = t.forwardRef(
16
+ ({
17
+ value: n,
18
+ onChange: d,
19
+ placeholder: Q,
20
+ minDate: N,
21
+ maxDate: S,
22
+ startMonth: v,
23
+ endMonth: A,
24
+ showFooter: l = !0,
25
+ disabled: o,
26
+ className: I,
27
+ calendarKind: M,
28
+ fiscalMode: O,
29
+ granularity: T,
30
+ fiscalMonthPattern: w,
31
+ fiscalYearStartMonth: K,
32
+ fiscalConfig: j,
33
+ showPresets: F,
34
+ ...$
35
+ }, z) => {
36
+ const { t: a } = re(), E = Q ?? a("datePicker.selectQuarterRange"), m = t.useRef(null), y = t.useRef(null);
37
+ t.useImperativeHandle(z, () => m.current);
38
+ const [i, c] = t.useState(!1), u = t.useRef(!1), k = ae(), { footerFlashKey: H, footerFlashTarget: L, popoverHandlers: V } = ie(l, i, k, y), [P, f] = t.useState(n), [B, G] = t.useState(le(n?.from));
39
+ t.useEffect(() => {
40
+ i || f(n);
41
+ }, [i, n]);
42
+ const p = t.useCallback(() => c(!1), []), J = ne({
43
+ calendarKind: M,
44
+ fiscalMode: O,
45
+ granularity: T,
46
+ fiscalMonthPattern: w,
47
+ fiscalYearStartMonth: K,
48
+ fiscalConfig: j,
49
+ showPresets: F
50
+ }), U = (e) => {
51
+ const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
52
+ f(s), l || (d?.(s), s?.to && p());
53
+ }, W = () => {
54
+ d?.(P), p();
55
+ }, h = () => {
56
+ f(n), p();
57
+ }, R = () => {
58
+ f(void 0), d?.(void 0), l || p();
59
+ };
60
+ t.useLayoutEffect(() => {
61
+ k.current = { onDismiss: h, resolveFlash: () => "cancel" };
62
+ });
63
+ const X = n?.from ? `${D(n.from)}${n.to ? ` – ${D(n.to)}` : ""}` : "";
64
+ return /* @__PURE__ */ r(
65
+ oe,
66
+ {
67
+ open: i,
68
+ disabled: o,
69
+ ariaLabel: a("datePicker.selectQuarterRange"),
70
+ onOpenChange: (e) => {
71
+ o || c(e);
72
+ },
73
+ onOpenAutoFocus: (e) => {
74
+ u.current || e.preventDefault(), u.current = !1;
75
+ },
76
+ popoverHandlers: V,
77
+ trigger: /* @__PURE__ */ r(
78
+ "div",
79
+ {
80
+ ref: y,
81
+ "data-component": "quarter-range-picker",
82
+ "data-state": i ? "open" : "closed",
83
+ onPointerDown: (e) => se({
84
+ disabled: o,
85
+ event: e,
86
+ onOpen: () => c(!0),
87
+ focusField: () => m.current?.focus()
88
+ }),
89
+ children: /* @__PURE__ */ r(
90
+ q,
91
+ {
92
+ ref: m,
93
+ value: X,
94
+ readOnly: !0,
95
+ onKeyDown: (e) => ce(e, {
96
+ disabled: o,
97
+ open: i,
98
+ onOpen: () => c(!0),
99
+ onCancel: h,
100
+ onKeyboardOpen: () => {
101
+ u.current = !0;
102
+ }
103
+ }),
104
+ onClick: () => !o && c(!0),
105
+ placeholder: E,
106
+ disabled: o,
107
+ "data-form-control": "input",
108
+ className: _("cursor-pointer", I),
109
+ suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
110
+ n?.from && !o ? /* @__PURE__ */ g(C, { children: [
111
+ /* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
112
+ "button",
113
+ {
114
+ type: "button",
115
+ tabIndex: 0,
116
+ "aria-label": a("calendar.clear"),
117
+ onClick: (e) => {
118
+ e.stopPropagation(), R();
119
+ },
120
+ className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
121
+ children: /* @__PURE__ */ r(Y, { className: "size-3 hover:text-content" })
122
+ }
123
+ ) }),
124
+ /* @__PURE__ */ r(b, { variant: "tertiary", side: "top", children: a("calendar.clear") })
125
+ ] }) : null,
126
+ /* @__PURE__ */ g(C, { children: [
127
+ /* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
128
+ "button",
129
+ {
130
+ type: "button",
131
+ tabIndex: 0,
132
+ "data-component": "calendar-trigger",
133
+ "aria-label": a("datePicker.selectQuarterRange"),
134
+ onClick: (e) => {
135
+ e.stopPropagation(), o || c((s) => !s);
136
+ },
137
+ className: "inline-flex items-center justify-center border-none bg-transparent p-0",
138
+ children: /* @__PURE__ */ r(Z, { className: "h-4 w-4 text-secondary-foreground" })
139
+ }
140
+ ) }),
141
+ /* @__PURE__ */ r(b, { variant: "tertiary", side: "top", children: a("datePicker.selectQuarterRange") })
142
+ ] })
143
+ ] }),
144
+ ...$
145
+ }
146
+ )
147
+ }
148
+ ),
149
+ children: /* @__PURE__ */ r(
150
+ ee,
151
+ {
152
+ pickerType: "quarter",
153
+ monthMode: "range",
154
+ selectedQuarters: P,
155
+ footerFlashKey: H,
156
+ footerFlashTarget: L,
157
+ onQuarterSelect: U,
158
+ month: B,
159
+ onMonthChange: G,
160
+ disabled: te(N, S),
161
+ startMonth: v,
162
+ endMonth: A,
163
+ showFooter: l,
164
+ onApply: W,
165
+ onCancel: h,
166
+ onClear: R,
167
+ ...J
168
+ }
169
+ )
170
+ }
171
+ );
172
+ }
173
+ );
174
+ fe.displayName = "QuarterRangePicker";
175
+ export {
176
+ fe as QuarterRangePicker
177
+ };
@@ -1,138 +1,143 @@
1
- import { jsxs as C, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as W, jsx as a } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
- import { Cross as Ie, CalendarMonth as Ce } from "impact-nova-icons";
3
+ import { Cross as be, CalendarMonth as xe } from "impact-nova-icons";
4
4
  import { format as j } from "date-fns";
5
- import { cn as Pe } from "../../../lib/utils.js";
6
- import { usePickerDismissActionsRef as We, usePickerFooterDismissNudge as Re, isDateInputInvalid as be, resolveSingleValueDismissFlash as xe, handlePickerSurfacePointerDown as Se, resolveDateInputOnBlur as Ee, maskDateInput as Ae, parseDateInput as Ne, resolveDateInputOnEnter as Te } from "./date-input-behavior.js";
7
- import { Input as we } from "../input/input.js";
8
- import { Popover as Ve, PopoverAnchor as Le, PopoverContent as Oe } from "../../feedback/popover/popover.js";
9
- import { Calendar as je } from "../../data-display/calendar/calendar.js";
10
- import { Tooltip as X, TooltipTrigger as Z, TooltipContent as _ } from "../../feedback/tooltip/tooltip.js";
11
- import { resolveWeekSelection as Be } from "../../../lib/fiscal-calendar.js";
12
- import { useImpactNovaI18n as Ke } from "../../../i18n/use-impact-nova-i18n.js";
13
- import { getDateFnsLocale as Me } from "../../../i18n/getDateFnsLocale.js";
14
- import { coerceSingleWeekApply as ze, coerceSingleWeek as He } from "./calendar-selection-adapters.js";
15
- import { buildDateBoundsMatcher as $e } from "../../../lib/date-bounds-matcher.js";
16
- const Y = (n, c = "MM/dd/yyyy", t) => {
17
- const P = j(n.startDate, c, t ? { locale: t } : {}), W = j(n.endDate, c, t ? { locale: t } : {});
18
- return `${P} - ${W}`;
19
- }, h = (n, c, t) => n ? j(n.startDate, c, t ? { locale: t } : {}) : "", qe = s.forwardRef(
5
+ import { cn as Te } from "../../../lib/utils.js";
6
+ import { usePickerDismissActionsRef as Se, usePickerFooterDismissNudge as Ee, isDateInputInvalid as Ae, resolveSingleValueDismissFlash as Ne, handlePickerSurfacePointerDown as we, resolveDateInputOnBlur as Ve, maskDateInput as Le, parseDateInput as Oe, resolveDateInputOnEnter as Me } from "./date-input-behavior.js";
7
+ import { Input as je } from "../input/input.js";
8
+ import { Popover as Be, PopoverAnchor as ze, PopoverContent as He } from "../../feedback/popover/popover.js";
9
+ import { Calendar as $e } from "../../data-display/calendar/calendar.js";
10
+ import { Tooltip as Z, TooltipTrigger as _, TooltipContent as Y } from "../../feedback/tooltip/tooltip.js";
11
+ import { resolveWeekSelection as Ke } from "../../../lib/fiscal-calendar/week-selection.js";
12
+ import { useImpactNovaI18n as qe } from "../../../i18n/use-impact-nova-i18n.js";
13
+ import { getDateFnsLocale as Ge } from "../../../i18n/getDateFnsLocale.js";
14
+ import { coerceSingleWeekApply as Je, coerceSingleWeek as Qe } from "./calendar-selection-adapters.js";
15
+ import { buildDateBoundsMatcher as Ue } from "../../../lib/date-bounds-matcher.js";
16
+ import { fiscalCalendarPassThrough as Xe } from "./fiscal-pass-through.js";
17
+ const F = (n, c = "MM/dd/yyyy", t) => {
18
+ const R = j(n.startDate, c, t ? { locale: t } : {}), b = j(n.endDate, c, t ? { locale: t } : {});
19
+ return `${R} - ${b}`;
20
+ }, g = (n, c, t) => n ? j(n.startDate, c, t ? { locale: t } : {}) : "", Ze = s.forwardRef(
20
21
  ({
21
22
  value: n,
22
23
  onChange: c,
23
24
  format: t = "MM/dd/yyyy",
24
- placeholder: P,
25
- minDate: W,
26
- maxDate: F,
27
- startMonth: ee,
28
- endMonth: te,
25
+ placeholder: R,
26
+ minDate: b,
27
+ maxDate: ee,
28
+ startMonth: te,
29
+ endMonth: ne,
29
30
  showFooter: l = !0,
30
- calendarType: R = "calendar",
31
- fiscalMode: b = "basic",
32
- selectionMode: x = "week",
31
+ calendarKind: I,
32
+ fiscalMode: x = "basic",
33
+ granularity: T,
33
34
  fiscalMonthPattern: S,
34
35
  fiscalYearStartMonth: E = 1,
36
+ fiscalConfig: re,
35
37
  weekStartsOn: A = 1,
38
+ showPresets: se,
39
+ comparison: oe,
40
+ onComparisonChange: ie,
36
41
  disabled: p,
37
- className: ne,
38
- ...re
39
- }, se) => {
40
- const { locale: B, t: D } = Ke(), o = s.useMemo(() => Me(B), [B]), ie = P ?? D("datePicker.selectWeek"), N = s.useRef(null), K = s.useRef(null), v = s.useRef(!1);
41
- s.useImperativeHandle(se, () => N.current);
42
- const [i, M] = s.useState(!1), z = We(), { footerFlashKey: oe, footerFlashTarget: ce, popoverHandlers: ae } = Re(l, i, z, K), [le, T] = s.useState(!1), [u, f] = s.useState(n), [y, m] = s.useState(""), [pe, g] = s.useState(n?.startDate || /* @__PURE__ */ new Date()), ue = n ? Y(n, t, o) : "", H = u ? Y(u, t, o) : "", w = i || le, fe = w ? y : H, $ = s.useCallback(() => {
43
- f(n), m(h(n, t, o)), g(n?.startDate || /* @__PURE__ */ new Date());
44
- }, [n, t, o]), I = s.useCallback(() => {
45
- m(h(u ?? n, t, o)), g((u ?? n)?.startDate || /* @__PURE__ */ new Date());
46
- }, [u, n, t, o]);
42
+ className: ce,
43
+ ...ae
44
+ }, le) => {
45
+ const { locale: B, t: D } = qe(), i = s.useMemo(() => Ge(B), [B]), pe = R ?? D("datePicker.selectWeek"), v = I === "fiscal", N = s.useRef(null), z = s.useRef(null), C = s.useRef(!1);
46
+ s.useImperativeHandle(le, () => N.current);
47
+ const [o, H] = s.useState(!1), $ = Se(), { footerFlashKey: ue, footerFlashTarget: fe, popoverHandlers: de } = Ee(l, o, $, z), [me, w] = s.useState(!1), [u, f] = s.useState(n), [y, m] = s.useState(""), [ke, h] = s.useState(n?.startDate || /* @__PURE__ */ new Date()), De = n ? F(n, t, i) : "", K = u ? F(u, t, i) : "", V = o || me, ye = V ? y : K, q = s.useCallback(() => {
48
+ f(n), m(g(n, t, i)), v || h(n?.startDate || /* @__PURE__ */ new Date());
49
+ }, [n, t, i, v]), P = s.useCallback(() => {
50
+ m(g(u ?? n, t, i)), v || h((u ?? n)?.startDate || /* @__PURE__ */ new Date());
51
+ }, [u, n, t, i, v]);
47
52
  s.useEffect(() => {
48
- i || f(n);
49
- }, [i, n]);
50
- const q = s.useRef(!1);
53
+ o || f(n);
54
+ }, [o, n]);
55
+ const G = s.useRef(!1);
51
56
  s.useEffect(() => {
52
- i && !q.current && I(), q.current = i;
53
- }, [i, I]);
57
+ o && !G.current && P(), G.current = o;
58
+ }, [o, P]);
54
59
  const d = () => {
55
- T(!1), M(!1);
60
+ w(!1), H(!1);
56
61
  }, k = (e) => {
57
62
  if (!p) {
58
63
  if (e) {
59
- I(), M(!0);
64
+ P(), H(!0);
60
65
  return;
61
66
  }
62
67
  l || d();
63
68
  }
64
- }, V = s.useCallback(
65
- (e) => Be(e, {
66
- calendarType: R,
67
- fiscalMode: b,
68
- selectionMode: x,
69
+ }, L = s.useCallback(
70
+ (e) => Ke(e, {
71
+ calendarKind: I,
72
+ fiscalMode: x,
73
+ granularity: T,
69
74
  fiscalMonthPattern: S,
70
75
  fiscalYearStartMonth: E,
71
76
  weekStartsOn: A
72
77
  }),
73
78
  [
74
- R,
75
- b,
79
+ I,
76
80
  x,
81
+ T,
77
82
  S,
78
83
  E,
79
84
  A
80
85
  ]
81
- ), de = (e) => {
82
- const r = He(e);
83
- f(r), r && (m(h(r, t, o)), g(r.startDate)), l || (c?.(r), d());
84
- }, G = (e) => {
85
- const r = ze(e, u);
86
+ ), he = (e) => {
87
+ const r = Qe(e);
88
+ f(r), r && (m(g(r, t, i)), v || h(r.startDate)), l || (c?.(r), d());
89
+ }, J = (e) => {
90
+ const r = Je(e, u);
86
91
  c?.(r), d();
87
- }, L = () => {
88
- $(), d();
89
- }, J = () => {
92
+ }, O = () => {
93
+ q(), d();
94
+ }, Q = () => {
90
95
  f(void 0), m(""), c?.(void 0), l || d();
91
- }, me = (e) => {
92
- const r = V(e);
93
- f(r), m(h(r, t, o)), g(e), c?.(r), d();
94
- }, ke = (e) => {
95
- const r = Ae(e.target.value, t, y);
96
+ }, ge = (e) => {
97
+ const r = L(e);
98
+ f(r), m(g(r, t, i)), h(e), c?.(r), d();
99
+ }, ve = (e) => {
100
+ const r = Le(e.target.value, t, y);
96
101
  if (m(r), r === "") {
97
102
  f(void 0), l || c?.(void 0);
98
103
  return;
99
104
  }
100
- const { parsed: O, isValid: ve } = Ne(r, t, o);
101
- if (ve && O) {
102
- const U = V(O);
103
- f(U), g(O), l || c?.(U);
105
+ const { parsed: M, isValid: Re } = Oe(r, t, i);
106
+ if (Re && M) {
107
+ const X = L(M);
108
+ f(X), h(M), l || c?.(X);
104
109
  }
105
- }, De = () => {
106
- if (T(!1), i) return;
107
- const e = Ee(
110
+ }, Ce = () => {
111
+ if (w(!1), o) return;
112
+ const e = Ve(
108
113
  y,
109
114
  t,
110
- h(u ?? n, t, o),
111
- o
115
+ g(u ?? n, t, i),
116
+ i
112
117
  );
113
118
  if (e.resetToCommitted) {
114
- $();
119
+ q();
115
120
  return;
116
121
  }
117
122
  if (e.parsed) {
118
- const r = V(e.parsed);
119
- f(r), m(h(r, t, o)), l || c?.(r);
123
+ const r = L(e.parsed);
124
+ f(r), m(g(r, t, i)), l || c?.(r);
120
125
  return;
121
126
  }
122
127
  y || (f(void 0), l || c?.(void 0));
123
- }, ye = () => {
124
- if (i && l) {
125
- G();
128
+ }, Ie = () => {
129
+ if (o && l) {
130
+ J();
126
131
  return;
127
132
  }
128
- const e = Te(y, t, o);
133
+ const e = Me(y, t, i);
129
134
  if (e.parsed) {
130
- l && me(e.parsed);
135
+ l && ge(e.parsed);
131
136
  return;
132
137
  }
133
- i || (v.current = !0, k(!0));
134
- }, Q = ue !== H, ge = w && be(y, t, o), he = s.useCallback(
135
- () => xe(
138
+ o || (C.current = !0, k(!0));
139
+ }, U = De !== K, Pe = V && Ae(y, t, i), We = s.useCallback(
140
+ () => Ne(
136
141
  u,
137
142
  n,
138
143
  (e, r) => e.startDate.getTime() === r.startDate.getTime()
@@ -140,122 +145,128 @@ const Y = (n, c = "MM/dd/yyyy", t) => {
140
145
  [u, n]
141
146
  );
142
147
  return s.useLayoutEffect(() => {
143
- z.current = {
144
- onDismiss: L,
145
- resolveFlash: he
148
+ $.current = {
149
+ onDismiss: O,
150
+ resolveFlash: We
146
151
  };
147
- }), /* @__PURE__ */ C(Ve, { open: p ? !1 : i, onOpenChange: k, children: [
148
- /* @__PURE__ */ a(Le, { asChild: !0, children: /* @__PURE__ */ a(
152
+ }), /* @__PURE__ */ W(Be, { open: p ? !1 : o, onOpenChange: k, children: [
153
+ /* @__PURE__ */ a(ze, { asChild: !0, children: /* @__PURE__ */ a(
149
154
  "div",
150
155
  {
151
- ref: K,
156
+ ref: z,
152
157
  "data-component": "week-picker",
153
- "data-state": i ? "open" : "closed",
154
- "data-pending": Q || void 0,
155
- onPointerDown: (e) => Se({
158
+ "data-state": o ? "open" : "closed",
159
+ "data-pending": U || void 0,
160
+ onPointerDown: (e) => we({
156
161
  disabled: p,
157
162
  event: e,
158
163
  onOpen: () => k(!0),
159
164
  focusField: () => N.current?.focus()
160
165
  }),
161
166
  children: /* @__PURE__ */ a(
162
- we,
167
+ je,
163
168
  {
164
169
  ref: N,
165
- value: fe,
166
- onChange: ke,
170
+ value: ye,
171
+ onChange: ve,
167
172
  onFocus: () => {
168
- p || (T(!0), I());
173
+ p || (w(!0), P());
169
174
  },
170
- onBlur: De,
175
+ onBlur: Ce,
171
176
  onClick: () => !p && k(!0),
172
177
  onKeyDown: (e) => {
173
- e.key === "Enter" && !p && (e.preventDefault(), ye()), e.key === "ArrowDown" && !i && !p && (e.preventDefault(), v.current = !0, k(!0)), e.key === "Escape" && i && (e.preventDefault(), L());
178
+ e.key === "Enter" && !p && (e.preventDefault(), Ie()), e.key === "ArrowDown" && !o && !p && (e.preventDefault(), C.current = !0, k(!0)), e.key === "Escape" && o && (e.preventDefault(), O());
174
179
  },
175
- placeholder: w ? t : ie,
180
+ placeholder: V ? t : pe,
176
181
  disabled: p,
177
182
  "data-form-control": "input",
178
- className: Pe(
183
+ className: Te(
179
184
  "cursor-pointer",
180
- ge ? "text-destructive" : Q ? "text-content-placeholder" : "",
181
- ne
185
+ Pe ? "text-destructive" : U ? "text-content-placeholder" : "",
186
+ ce
182
187
  ),
183
- suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
184
- n && !p && /* @__PURE__ */ C(X, { children: [
185
- /* @__PURE__ */ a(Z, { asChild: !0, children: /* @__PURE__ */ a(
188
+ suffix: /* @__PURE__ */ W("div", { className: "flex items-center gap-1", children: [
189
+ n && !p && /* @__PURE__ */ W(Z, { children: [
190
+ /* @__PURE__ */ a(_, { asChild: !0, children: /* @__PURE__ */ a(
186
191
  "button",
187
192
  {
188
193
  type: "button",
189
194
  tabIndex: 0,
190
195
  "aria-label": D("calendar.clear"),
191
196
  onClick: (e) => {
192
- e.stopPropagation(), J();
197
+ e.stopPropagation(), Q();
193
198
  },
194
199
  className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
195
- children: /* @__PURE__ */ a(Ie, { className: "size-3 hover:text-content" })
200
+ children: /* @__PURE__ */ a(be, { className: "size-3 hover:text-content" })
196
201
  }
197
202
  ) }),
198
- /* @__PURE__ */ a(_, { variant: "tertiary", side: "top", children: D("calendar.clear") })
203
+ /* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: D("calendar.clear") })
199
204
  ] }),
200
- /* @__PURE__ */ C(X, { children: [
201
- /* @__PURE__ */ a(Z, { asChild: !0, children: /* @__PURE__ */ a(
205
+ /* @__PURE__ */ W(Z, { children: [
206
+ /* @__PURE__ */ a(_, { asChild: !0, children: /* @__PURE__ */ a(
202
207
  "button",
203
208
  {
204
209
  type: "button",
205
210
  tabIndex: 0,
206
211
  "aria-label": D("datePicker.selectWeek"),
207
212
  onClick: (e) => {
208
- e.stopPropagation(), p || (i ? d() : k(!0));
213
+ e.stopPropagation(), p || (o ? d() : k(!0));
209
214
  },
210
215
  onKeyDown: (e) => {
211
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (v.current = !0, i ? d() : k(!0)));
216
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (C.current = !0, o ? d() : k(!0)));
212
217
  },
213
218
  className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
214
- children: /* @__PURE__ */ a(Ce, { className: "h-4 w-4 text-secondary-foreground" })
219
+ children: /* @__PURE__ */ a(xe, { className: "h-4 w-4 text-secondary-foreground" })
215
220
  }
216
221
  ) }),
217
- /* @__PURE__ */ a(_, { variant: "tertiary", side: "top", children: D("datePicker.selectWeek") })
222
+ /* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: D("datePicker.selectWeek") })
218
223
  ] })
219
224
  ] }),
220
- ...re
225
+ ...ae
221
226
  }
222
227
  )
223
228
  }
224
229
  ) }),
225
230
  /* @__PURE__ */ a(
226
- Oe,
231
+ He,
227
232
  {
228
233
  className: "w-auto p-0",
229
234
  align: "start",
230
235
  "aria-label": D("datePicker.selectWeek"),
231
236
  onOpenAutoFocus: (e) => {
232
- v.current || e.preventDefault(), v.current = !1;
237
+ C.current || e.preventDefault(), C.current = !1;
233
238
  },
234
- ...ae,
239
+ ...de,
235
240
  children: /* @__PURE__ */ a(
236
- je,
241
+ $e,
237
242
  {
238
243
  pickerType: "week",
239
244
  weekMode: "single",
240
245
  selectedWeeks: u,
241
- footerFlashKey: oe,
242
- footerFlashTarget: ce,
243
- onWeekSelect: de,
244
- month: pe,
245
- onMonthChange: g,
246
- disabled: $e(W, F),
247
- startMonth: ee,
248
- endMonth: te,
246
+ footerFlashKey: ue,
247
+ footerFlashTarget: fe,
248
+ onWeekSelect: he,
249
+ month: ke,
250
+ onMonthChange: h,
251
+ disabled: Ue(b, ee),
252
+ startMonth: te,
253
+ endMonth: ne,
249
254
  showFooter: l,
250
- calendarType: R,
251
- fiscalMode: b,
252
- selectionMode: x,
253
- fiscalMonthPattern: S,
254
- fiscalYearStartMonth: E,
255
- weekStartsOn: A,
256
- onApply: G,
257
- onCancel: L,
258
- onClear: J,
255
+ ...Xe({
256
+ calendarKind: I,
257
+ fiscalMode: x,
258
+ granularity: T,
259
+ fiscalMonthPattern: S,
260
+ fiscalYearStartMonth: E,
261
+ fiscalConfig: re,
262
+ weekStartsOn: A,
263
+ showPresets: se,
264
+ comparison: oe,
265
+ onComparisonChange: ie
266
+ }),
267
+ onApply: J,
268
+ onCancel: O,
269
+ onClear: Q,
259
270
  captionLayout: "dropdown"
260
271
  }
261
272
  )
@@ -264,7 +275,7 @@ const Y = (n, c = "MM/dd/yyyy", t) => {
264
275
  ] });
265
276
  }
266
277
  );
267
- qe.displayName = "WeekPicker";
278
+ Ze.displayName = "WeekPicker";
268
279
  export {
269
- qe as WeekPicker
280
+ Ze as WeekPicker
270
281
  };