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
@@ -1,323 +1,372 @@
1
- import { jsx as m, jsxs as E } from "react/jsx-runtime";
1
+ import { jsx as h, jsxs as T } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { Cross as Ve, CalendarMonth as Oe } from "impact-nova-icons";
4
- import { format as D } from "date-fns";
5
- import { cn as K } from "../../../lib/utils.js";
6
- import { usePickerDismissActionsRef as Ke, usePickerFooterDismissNudge as je, createRangePickerOpenChangeHandler as Le, parseDateInput as j, normalizeOrderedRange as qe, flashRangeReorder as ze, isDateInputInvalid as F, resolveRangeFieldBlur as N, resolveRangePickerDismissFlash as He, handlePickerSurfacePointerDown as Ge, compareDates as L, deferRangeInputBlur as Je, maskDateInput as ee, resolveDateInputOnBlur as S } from "./date-input-behavior.js";
7
- import { useFieldChrome as Qe } from "../../../lib/primitives/use-field-chrome.js";
8
- import { Popover as Ue, PopoverAnchor as We, PopoverContent as Xe } from "../../feedback/popover/popover.js";
9
- import { Calendar as Ye } from "../../data-display/calendar/calendar.js";
10
- import { Tooltip as te, TooltipTrigger as re, TooltipContent as oe } from "../../feedback/tooltip/tooltip.js";
11
- import { useImpactNovaI18n as Ze } from "../../../i18n/use-impact-nova-i18n.js";
12
- import { getDateFnsLocale as _e } from "../../../i18n/getDateFnsLocale.js";
13
- import { coerceDateRangeApply as $e, coerceDateRange as Fe } from "./calendar-selection-adapters.js";
14
- import { buildDateBoundsMatcher as et } from "../../../lib/date-bounds-matcher.js";
15
- function tt(r, a) {
16
- if (!r && !a) return !0;
17
- if (!r || !a) return !1;
18
- const n = !r.from && !a.from || r.from && a.from && L(r.from, a.from) === 0, A = !r.to && !a.to || r.to && a.to && L(r.to, a.to) === 0;
19
- return !!(n && A);
3
+ import { Cross as Fe, CalendarMonth as et } from "impact-nova-icons";
4
+ import { format as R } from "date-fns";
5
+ import { cn as G } from "../../../lib/utils.js";
6
+ import { usePickerDismissActionsRef as tt, usePickerFooterDismissNudge as ot, createRangePickerOpenChangeHandler as rt, parseDateInput as J, normalizeOrderedRange as nt, flashRangeReorder as st, isDateInputInvalid as ie, resolveRangeFieldBlur as V, resolveRangePickerDismissFlash as it, handlePickerSurfacePointerDown as lt, compareDates as Q, deferRangeInputBlur as at, maskDateInput as le, resolveDateInputOnBlur as O } from "./date-input-behavior.js";
7
+ import { useFieldChrome as ct } from "../../../lib/primitives/use-field-chrome.js";
8
+ import { Popover as ft, PopoverAnchor as dt, PopoverContent as pt } from "../../feedback/popover/popover.js";
9
+ import { Calendar as ut } from "../../data-display/calendar/calendar.js";
10
+ import { Tooltip as ae, TooltipTrigger as ce, TooltipContent as fe } from "../../feedback/tooltip/tooltip.js";
11
+ import { useImpactNovaI18n as mt } from "../../../i18n/use-impact-nova-i18n.js";
12
+ import { getDateFnsLocale as gt } from "../../../i18n/getDateFnsLocale.js";
13
+ import { coerceDateRangeApply as vt, coerceDateRange as ht } from "./calendar-selection-adapters.js";
14
+ import { buildDateBoundsMatcher as Rt } from "../../../lib/date-bounds-matcher.js";
15
+ import { fiscalCalendarPassThrough as yt } from "./fiscal-pass-through.js";
16
+ import { isDateRangeArray as I } from "../../data-display/calendar/calendar-interval-utils.js";
17
+ function de(i) {
18
+ if (i)
19
+ return I(i) ? i[i.length - 1] : i;
20
20
  }
21
- const rt = c.forwardRef(
21
+ function Dt(i, f) {
22
+ if (!i && !f) return !0;
23
+ if (!i || !f) return !1;
24
+ const r = !i.from && !f.from || i.from && f.from && Q(i.from, f.from) === 0, M = !i.to && !f.to || i.to && f.to && Q(i.to, f.to) === 0;
25
+ return !!(r && M);
26
+ }
27
+ const xt = c.forwardRef(
22
28
  ({
23
- value: r,
24
- onChange: a,
25
- format: n = "MM/dd/yyyy",
26
- startPlaceholder: A,
27
- endPlaceholder: ne,
28
- minDate: se,
29
- maxDate: ie,
30
- startMonth: le,
31
- endMonth: ce,
29
+ value: i,
30
+ onChange: f,
31
+ format: r = "MM/dd/yyyy",
32
+ startPlaceholder: M,
33
+ endPlaceholder: pe,
34
+ minDate: ue,
35
+ maxDate: me,
36
+ startMonth: ge,
37
+ endMonth: ve,
32
38
  showFooter: g = !0,
33
- weekStartsOn: q,
34
- disabled: f,
35
- label: ae,
36
- helperText: fe,
37
- helperTextPosition: de = "absolute",
38
- prefix: ot,
39
- prefixClick: nt,
40
- isError: pe,
41
- error: ue,
42
- size: z,
43
- required: me,
44
- className: ge,
45
- ...he
46
- }, ye) => {
47
- const { locale: H, t: b } = Ze(), s = c.useMemo(() => _e(H), [H]), G = A ?? b("datePicker.startDate"), J = ne ?? b("datePicker.endDate"), Q = ue ?? pe, Re = Qe({
48
- label: ae,
49
- helperText: fe,
50
- helperTextPosition: de,
51
- error: Q,
52
- required: me,
53
- disabled: f ?? void 0,
39
+ weekStartsOn: U,
40
+ disabled: d,
41
+ label: he,
42
+ helperText: Re,
43
+ helperTextPosition: ye = "absolute",
44
+ prefix: kt,
45
+ prefixClick: Ct,
46
+ isError: De,
47
+ error: xe,
48
+ size: W,
49
+ required: ke,
50
+ className: Ce,
51
+ calendarKind: Pe,
52
+ fiscalMode: be,
53
+ granularity: Ie,
54
+ fiscalMonthPattern: Ee,
55
+ fiscalYearStartMonth: we,
56
+ fiscalConfig: Te,
57
+ showPresets: Be,
58
+ comparison: Se,
59
+ onComparisonChange: Ne,
60
+ mode: K = "range",
61
+ onRangesChange: j,
62
+ ...Ae
63
+ }, Ve) => {
64
+ const { locale: X, t: b } = mt(), n = c.useMemo(() => gt(X), [X]), Y = M ?? b("datePicker.startDate"), Z = pe ?? b("datePicker.endDate"), _ = xe ?? De, Oe = ct({
65
+ label: he,
66
+ helperText: Re,
67
+ helperTextPosition: ye,
68
+ error: _,
69
+ required: ke,
70
+ disabled: d ?? void 0,
54
71
  rootClassName: "w-full min-w-[240px]"
55
- }), M = c.useRef(null), U = c.useRef(null), W = c.useRef(null), T = c.useRef(null), V = c.useRef(null);
56
- c.useImperativeHandle(ye, () => M.current);
57
- const [p, h] = c.useState(!1), X = Ke(), { footerFlashKey: De, footerFlashTarget: ke, popoverHandlers: xe } = je(g, p, X, W), P = c.useRef(!1), [d, y] = c.useState(r), [u, k] = c.useState(r?.from ? D(r.from, n, { locale: s }) : ""), [R, x] = c.useState(r?.to ? D(r.to, n, { locale: s }) : ""), [ve, I] = c.useState(r?.from || /* @__PURE__ */ new Date()), v = r?.from ? D(r.from, n, { locale: s }) : "", C = r?.to ? D(r.to, n, { locale: s }) : "";
72
+ }), L = c.useRef(null), $ = c.useRef(null), F = c.useRef(null), N = c.useRef(null), q = c.useRef(null);
73
+ c.useImperativeHandle(Ve, () => L.current);
74
+ const l = de(i), [u, m] = c.useState(!1), ee = tt(), { footerFlashKey: Me, footerFlashTarget: Ke, popoverHandlers: je } = ot(g, u, ee, F), E = c.useRef(!1), [p, y] = c.useState(l), [te, B] = c.useState(
75
+ I(i) ? i : void 0
76
+ ), [Le, z] = c.useState(
77
+ I(i) ? i : void 0
78
+ ), [v, x] = c.useState(l?.from ? R(l.from, r, { locale: n }) : ""), [D, k] = c.useState(l?.to ? R(l.to, r, { locale: n }) : ""), [qe, w] = c.useState(l?.from || /* @__PURE__ */ new Date()), C = l?.from ? R(l.from, r, { locale: n }) : "", P = l?.to ? R(l.to, r, { locale: n }) : "";
58
79
  c.useEffect(() => {
59
- k(r?.from ? D(r.from, n, { locale: s }) : ""), x(r?.to ? D(r.to, n, { locale: s }) : ""), y(r);
60
- }, [r, n, s]);
61
- const Ce = c.useCallback(
62
- (e) => Le({
63
- disabled: f ?? void 0,
80
+ const e = de(i);
81
+ x(e?.from ? R(e.from, r, { locale: n }) : ""), k(e?.to ? R(e.to, r, { locale: n }) : ""), y(e), B(I(i) ? i : void 0), z(I(i) ? i : void 0);
82
+ }, [i, r, n]);
83
+ const ze = c.useCallback(
84
+ (e) => rt({
85
+ disabled: d ?? void 0,
64
86
  showFooter: g,
65
- containerRef: T,
66
- popoverContentRef: V,
67
- setOpen: h
87
+ containerRef: N,
88
+ popoverContentRef: q,
89
+ setOpen: m
68
90
  })(e),
69
- [f, g]
70
- ), Y = c.useRef(!1);
91
+ [d, g]
92
+ ), oe = c.useRef(!1);
71
93
  c.useEffect(() => {
72
- if (p && !Y.current) {
73
- const e = j(u, n, s);
74
- e.parsed ? I(e.parsed) : d?.from ? I(d.from) : r?.from && I(r.from);
94
+ if (u && !oe.current) {
95
+ const e = J(v, r, n);
96
+ e.parsed ? w(e.parsed) : p?.from ? w(p.from) : l?.from && w(l.from);
75
97
  }
76
- Y.current = p;
77
- }, [p, u, n, s, d?.from, r?.from]);
78
- const be = (e) => {
79
- const t = Fe(e);
80
- y(t), t?.from && k(D(t.from, n, { locale: s })), t?.to && x(D(t.to, n, { locale: s })), g || t?.from && t?.to && t.from.getTime() !== t.to.getTime() && (a?.(t), h(!1));
81
- }, w = c.useCallback((e, t) => {
82
- const o = qe(e, t, L);
83
- return o.swapped && (o.from && k(D(o.from, n, { locale: s })), o.to && x(D(o.to, n, { locale: s })), ze(T.current)), { from: o.from, to: o.to };
84
- }, [n, s]), Z = (e) => {
85
- let t = $e(e, d);
86
- t?.from && !t.to && (t = { from: t.from, to: t.from });
87
- const o = w(t?.from, t?.to);
88
- y({ from: o.from, to: o.to }), a?.({ from: o.from, to: o.to }), h(!1);
89
- }, B = () => {
90
- y(r), k(r?.from ? D(r.from, n, { locale: s }) : ""), x(r?.to ? D(r.to, n, { locale: s }) : ""), h(!1);
91
- }, O = () => {
92
- y(void 0), k(""), x(""), a?.(void 0), g || h(!1);
93
- }, Pe = (e) => {
94
- const t = ee(e.target.value, n, u);
95
- if (k(t), t === "") {
96
- const l = { from: void 0, to: d?.to };
97
- y(l), g || a?.(l);
98
+ oe.current = u;
99
+ }, [u, v, r, n, p?.from, l?.from]);
100
+ const He = (e) => {
101
+ if (I(e)) {
102
+ B(e);
103
+ const o = e[e.length - 1];
104
+ y(o), o?.from && x(R(o.from, r, { locale: n })), o?.to && k(R(o.to, r, { locale: n })), !g && e.every((s) => s.from && s.to) && (j?.(e), f?.(o), m(!1));
98
105
  return;
99
106
  }
100
- const { parsed: o, isValid: i } = j(t, n, s);
101
- if (i && o) {
102
- const l = { from: o, to: d?.to };
103
- y(l), I(o), g || a?.(l);
107
+ const t = ht(e);
108
+ y(t), t?.from && x(R(t.from, r, { locale: n })), t?.to && k(R(t.to, r, { locale: n })), g || t?.from && t?.to && t.from.getTime() !== t.to.getTime() && (f?.(t), m(!1));
109
+ }, S = c.useCallback((e, t) => {
110
+ const o = nt(e, t, Q);
111
+ return o.swapped && (o.from && x(R(o.from, r, { locale: n })), o.to && k(R(o.to, r, { locale: n })), st(N.current)), { from: o.from, to: o.to };
112
+ }, [r, n]), re = (e) => {
113
+ if (K === "multi-range") {
114
+ const s = I(e) ? e : te;
115
+ j?.(s);
116
+ const a = s?.[s.length - 1];
117
+ f?.(a), z(s), m(!1);
118
+ return;
104
119
  }
105
- }, Ie = (e) => {
106
- const t = ee(e.target.value, n, R);
120
+ let t = vt(e, p);
121
+ t?.from && !t.to && (t = { from: t.from, to: t.from });
122
+ const o = S(t?.from, t?.to);
123
+ y({ from: o.from, to: o.to }), f?.({ from: o.from, to: o.to }), m(!1);
124
+ }, A = () => {
125
+ y(l), B(Le), x(l?.from ? R(l.from, r, { locale: n }) : ""), k(l?.to ? R(l.to, r, { locale: n }) : ""), m(!1);
126
+ }, H = () => {
127
+ y(void 0), B(void 0), z(void 0), x(""), k(""), f?.(void 0), j?.(void 0), g || m(!1);
128
+ }, Ge = (e) => {
129
+ const t = le(e.target.value, r, v);
107
130
  if (x(t), t === "") {
108
- const l = { from: d?.from, to: void 0 };
109
- y(l), g || a?.(l);
131
+ const a = { from: void 0, to: p?.to };
132
+ y(a), g || f?.(a);
133
+ return;
134
+ }
135
+ const { parsed: o, isValid: s } = J(t, r, n);
136
+ if (s && o) {
137
+ const a = { from: o, to: p?.to };
138
+ y(a), w(o), g || f?.(a);
139
+ }
140
+ }, Je = (e) => {
141
+ const t = le(e.target.value, r, D);
142
+ if (k(t), t === "") {
143
+ const a = { from: p?.from, to: void 0 };
144
+ y(a), g || f?.(a);
110
145
  return;
111
146
  }
112
- const { parsed: o, isValid: i } = j(t, n, s);
113
- if (i && o) {
114
- const l = { from: d?.from, to: o };
115
- y(l), I(o), g || a?.(l);
147
+ const { parsed: o, isValid: s } = J(t, r, n);
148
+ if (s && o) {
149
+ const a = { from: p?.from, to: o };
150
+ y(a), w(o), g || f?.(a);
116
151
  }
117
- }, _ = () => {
118
- Je(
119
- T,
120
- V,
152
+ }, ne = () => {
153
+ at(
154
+ N,
155
+ q,
121
156
  () => {
122
- const e = N(u, n, v, s), t = N(R, n, C, s);
123
- e.resetToCommitted ? k(v) : e.parsed && k(e.display), t.resetToCommitted ? x(C) : t.parsed && x(t.display);
124
- let o = e.parsed ? e.parsed : e.resetToCommitted ? r?.from : d?.from, i = t.parsed ? t.parsed : t.resetToCommitted ? r?.to : d?.to;
125
- o && i && ({ from: o, to: i } = w(o, i));
126
- const l = o || i ? { from: o, to: i } : void 0;
127
- y(l), g || (l ? a?.(l) : !u && !R && a?.(void 0));
157
+ const e = V(v, r, C, n), t = V(D, r, P, n);
158
+ e.resetToCommitted ? x(C) : e.parsed && x(e.display), t.resetToCommitted ? k(P) : t.parsed && k(t.display);
159
+ let o = e.parsed ? e.parsed : e.resetToCommitted ? l?.from : p?.from, s = t.parsed ? t.parsed : t.resetToCommitted ? l?.to : p?.to;
160
+ o && s && ({ from: o, to: s } = S(o, s));
161
+ const a = o || s ? { from: o, to: s } : void 0;
162
+ y(a), g || (a ? f?.(a) : !v && !D && f?.(void 0));
128
163
  }
129
164
  );
130
- }, Ee = () => {
131
- const e = S(u, n, v, s), t = S(R, n, C, s);
132
- e.resetToCommitted ? k(v) : e.parsed && k(e.display), t.resetToCommitted ? x(C) : t.parsed && x(t.display);
133
- let o = e.parsed ?? d?.from ?? r?.from, i = t.parsed ?? d?.to ?? r?.to;
134
- o && i && ({ from: o, to: i } = w(o, i));
135
- const l = o || i ? { from: o, to: i } : void 0;
136
- l ? (y(l), a?.(l)) : !u && !R && (y(void 0), a?.(void 0));
137
- }, $ = () => {
138
- if (p && g) {
139
- Z();
165
+ }, Qe = () => {
166
+ const e = O(v, r, C, n), t = O(D, r, P, n);
167
+ e.resetToCommitted ? x(C) : e.parsed && x(e.display), t.resetToCommitted ? k(P) : t.parsed && k(t.display);
168
+ let o = e.parsed ?? p?.from ?? l?.from, s = t.parsed ?? p?.to ?? l?.to;
169
+ o && s && ({ from: o, to: s } = S(o, s));
170
+ const a = o || s ? { from: o, to: s } : void 0;
171
+ a ? (y(a), f?.(a)) : !v && !D && (y(void 0), f?.(void 0));
172
+ }, se = () => {
173
+ if (u && g) {
174
+ re();
140
175
  return;
141
176
  }
142
- if (!p) {
177
+ if (!u) {
143
178
  if (g) {
144
- Ee();
179
+ Qe();
145
180
  return;
146
181
  }
147
- const e = S(u, n, v, s), t = S(R, n, C, s);
182
+ const e = O(v, r, C, n), t = O(D, r, P, n);
148
183
  if (e.parsed || t.parsed) return;
149
- P.current = !0, h(!0);
184
+ E.current = !0, m(!0);
150
185
  }
151
- }, we = u !== v, Te = R !== C, Be = F(u, n, s), Ne = F(R, n, s), Se = c.useCallback(() => {
152
- const e = N(u, n, v, s), t = N(R, n, C, s);
153
- let o = e.parsed ? e.parsed : e.resetToCommitted ? r?.from : d?.from, i = t.parsed ? t.parsed : t.resetToCommitted ? r?.to : d?.to;
154
- o && i && ({ from: o, to: i } = w(o, i));
155
- const l = o || i ? { from: o, to: i } : void 0;
156
- return He({
157
- startInput: u,
158
- endInput: R,
159
- committedStart: v,
160
- committedEnd: C,
161
- committedRange: r,
162
- pendingRange: d,
163
- computeEffectiveRange: () => l,
164
- rangesEqual: (Ae, Me) => tt(Ae, Me)
186
+ }, Ue = v !== C, We = D !== P, Xe = ie(v, r, n), Ye = ie(D, r, n), Ze = c.useCallback(() => {
187
+ const e = V(v, r, C, n), t = V(D, r, P, n);
188
+ let o = e.parsed ? e.parsed : e.resetToCommitted ? l?.from : p?.from, s = t.parsed ? t.parsed : t.resetToCommitted ? l?.to : p?.to;
189
+ o && s && ({ from: o, to: s } = S(o, s));
190
+ const a = o || s ? { from: o, to: s } : void 0;
191
+ return it({
192
+ startInput: v,
193
+ endInput: D,
194
+ committedStart: C,
195
+ committedEnd: P,
196
+ committedRange: i,
197
+ pendingRange: p,
198
+ computeEffectiveRange: () => a,
199
+ rangesEqual: (_e, $e) => Dt(_e, $e)
165
200
  });
166
201
  }, [
167
- u,
168
- R,
169
202
  v,
203
+ D,
170
204
  C,
205
+ P,
206
+ l?.from,
207
+ l?.to,
208
+ i,
209
+ p,
171
210
  r,
172
- d,
173
211
  n,
174
- s,
175
- w
212
+ S
176
213
  ]);
177
214
  return c.useLayoutEffect(() => {
178
- X.current = {
179
- onDismiss: B,
180
- resolveFlash: Se
215
+ ee.current = {
216
+ onDismiss: A,
217
+ resolveFlash: Ze
181
218
  };
182
- }), /* @__PURE__ */ m(
219
+ }), /* @__PURE__ */ h(
183
220
  "div",
184
221
  {
185
- ref: W,
222
+ ref: F,
186
223
  "data-component": "date-range-picker",
187
- "data-disabled": f || void 0,
188
- children: Re.wrapControl(
189
- /* @__PURE__ */ E(Ue, { open: f ? !1 : p, onOpenChange: Ce, children: [
190
- /* @__PURE__ */ m(We, { asChild: !0, children: /* @__PURE__ */ E(
224
+ "data-disabled": d || void 0,
225
+ children: Oe.wrapControl(
226
+ /* @__PURE__ */ T(ft, { open: d ? !1 : u, onOpenChange: ze, children: [
227
+ /* @__PURE__ */ h(dt, { asChild: !0, children: /* @__PURE__ */ T(
191
228
  "div",
192
229
  {
193
- ref: T,
194
- "data-state": p ? "open" : "closed",
195
- onPointerDown: (e) => Ge({
196
- disabled: f,
230
+ ref: N,
231
+ "data-state": u ? "open" : "closed",
232
+ onPointerDown: (e) => lt({
233
+ disabled: d,
197
234
  event: e,
198
- onOpen: () => h(!0),
235
+ onOpen: () => m(!0),
199
236
  focusField: (t) => {
200
- t === "end" ? U.current?.focus() : M.current?.focus();
237
+ t === "end" ? $.current?.focus() : L.current?.focus();
201
238
  }
202
239
  }),
203
- className: K(
240
+ className: G(
204
241
  "flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
205
- Q ? "border-destructive hover:border-destructive" : "border-field",
206
- z === "sm" ? "h-6" : z === "md" ? "h-[28px]" : "h-8",
207
- f && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
242
+ _ ? "border-destructive hover:border-destructive" : "border-field",
243
+ W === "sm" ? "h-6" : W === "md" ? "h-[28px]" : "h-8",
244
+ d && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
208
245
  "cursor-pointer",
209
- ge
246
+ Ce
210
247
  ),
211
248
  children: [
212
- /* @__PURE__ */ E("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
213
- /* @__PURE__ */ m(
249
+ /* @__PURE__ */ T("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
250
+ /* @__PURE__ */ h(
214
251
  "input",
215
252
  {
216
- ref: M,
253
+ ref: L,
217
254
  type: "text",
218
- value: u,
219
- onChange: Pe,
220
- onBlur: _,
221
- onClick: () => !f && h(!0),
255
+ value: v,
256
+ onChange: Ge,
257
+ onBlur: ne,
258
+ onClick: () => !d && m(!0),
222
259
  onKeyDown: (e) => {
223
- e.key === "Enter" && !f && (e.preventDefault(), $()), e.key === "ArrowDown" && !p && !f && (e.preventDefault(), P.current = !0, h(!0)), e.key === "Escape" && p && (e.preventDefault(), B());
260
+ e.key === "Enter" && !d && (e.preventDefault(), se()), e.key === "ArrowDown" && !u && !d && (e.preventDefault(), E.current = !0, m(!0)), e.key === "Escape" && u && (e.preventDefault(), A());
224
261
  },
225
- placeholder: p ? n : G,
226
- disabled: !!f,
227
- "aria-label": G,
262
+ placeholder: u ? r : Y,
263
+ disabled: !!d,
264
+ "aria-label": Y,
228
265
  "data-field": "start",
229
- className: K(
266
+ className: G(
230
267
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
231
- Be ? "text-destructive" : we ? "text-content-placeholder" : ""
268
+ Xe ? "text-destructive" : Ue ? "text-content-placeholder" : ""
232
269
  ),
233
- ...he
270
+ ...Ae
234
271
  }
235
272
  ),
236
- /* @__PURE__ */ m(
273
+ /* @__PURE__ */ h(
237
274
  "input",
238
275
  {
239
- ref: U,
276
+ ref: $,
240
277
  type: "text",
241
- value: R,
242
- onChange: Ie,
243
- onBlur: _,
244
- onClick: () => !f && h(!0),
278
+ value: D,
279
+ onChange: Je,
280
+ onBlur: ne,
281
+ onClick: () => !d && m(!0),
245
282
  onKeyDown: (e) => {
246
- e.key === "Enter" && !f && (e.preventDefault(), $()), e.key === "ArrowDown" && !p && !f && (e.preventDefault(), P.current = !0, h(!0)), e.key === "Escape" && p && (e.preventDefault(), B());
283
+ e.key === "Enter" && !d && (e.preventDefault(), se()), e.key === "ArrowDown" && !u && !d && (e.preventDefault(), E.current = !0, m(!0)), e.key === "Escape" && u && (e.preventDefault(), A());
247
284
  },
248
- placeholder: p ? n : J,
249
- disabled: !!f,
250
- "aria-label": J,
285
+ placeholder: u ? r : Z,
286
+ disabled: !!d,
287
+ "aria-label": Z,
251
288
  "data-field": "end",
252
- className: K(
289
+ className: G(
253
290
  "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
254
- Ne ? "text-destructive" : Te ? "text-content-placeholder" : ""
291
+ Ye ? "text-destructive" : We ? "text-content-placeholder" : ""
255
292
  )
256
293
  }
257
294
  )
258
295
  ] }),
259
- /* @__PURE__ */ E("div", { className: "flex items-center gap-1 shrink-0", children: [
260
- r?.from && !f && /* @__PURE__ */ E(te, { children: [
261
- /* @__PURE__ */ m(re, { asChild: !0, children: /* @__PURE__ */ m(
296
+ /* @__PURE__ */ T("div", { className: "flex items-center gap-1 shrink-0", children: [
297
+ l?.from && !d && /* @__PURE__ */ T(ae, { children: [
298
+ /* @__PURE__ */ h(ce, { asChild: !0, children: /* @__PURE__ */ h(
262
299
  "button",
263
300
  {
264
301
  type: "button",
265
302
  tabIndex: 0,
266
303
  "aria-label": b("calendar.clear"),
267
304
  onClick: (e) => {
268
- e.stopPropagation(), O();
305
+ e.stopPropagation(), H();
269
306
  },
270
307
  onKeyDown: (e) => {
271
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), O());
308
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), H());
272
309
  },
273
310
  className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
274
- children: /* @__PURE__ */ m(Ve, { className: "size-3 hover:text-content text-content-icon" })
311
+ children: /* @__PURE__ */ h(Fe, { className: "size-3 hover:text-content text-content-icon" })
275
312
  }
276
313
  ) }),
277
- /* @__PURE__ */ m(oe, { variant: "tertiary", side: "top", children: b("calendar.clear") })
314
+ /* @__PURE__ */ h(fe, { variant: "tertiary", side: "top", children: b("calendar.clear") })
278
315
  ] }),
279
- /* @__PURE__ */ E(te, { children: [
280
- /* @__PURE__ */ m(re, { asChild: !0, children: /* @__PURE__ */ m("button", { type: "button", tabIndex: 0, "aria-label": b("datePicker.selectMonthRange"), onClick: (e) => {
281
- e.stopPropagation(), f || h(!p);
316
+ /* @__PURE__ */ T(ae, { children: [
317
+ /* @__PURE__ */ h(ce, { asChild: !0, children: /* @__PURE__ */ h("button", { type: "button", tabIndex: 0, "aria-label": b("datePicker.selectMonthRange"), onClick: (e) => {
318
+ e.stopPropagation(), d || m(!u);
282
319
  }, onKeyDown: (e) => {
283
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), f || (P.current = !0, h(!p)));
284
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ m(Oe, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
285
- /* @__PURE__ */ m(oe, { variant: "tertiary", side: "top", children: b("datePicker.selectMonthRange") })
320
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), d || (E.current = !0, m(!u)));
321
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ h(et, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
322
+ /* @__PURE__ */ h(fe, { variant: "tertiary", side: "top", children: b("datePicker.selectMonthRange") })
286
323
  ] })
287
324
  ] })
288
325
  ]
289
326
  }
290
327
  ) }),
291
- /* @__PURE__ */ m(
292
- Xe,
328
+ /* @__PURE__ */ h(
329
+ pt,
293
330
  {
294
- ref: V,
331
+ ref: q,
295
332
  className: "w-auto p-0",
296
333
  align: "start",
297
334
  "aria-label": b("datePicker.selectDateRange"),
298
335
  onOpenAutoFocus: (e) => {
299
- P.current || e.preventDefault(), P.current = !1;
336
+ E.current || e.preventDefault(), E.current = !1;
300
337
  },
301
- ...xe,
302
- children: /* @__PURE__ */ m(
303
- Ye,
338
+ ...je,
339
+ children: /* @__PURE__ */ h(
340
+ ut,
304
341
  {
305
- mode: "range",
306
- selected: d,
307
- footerFlashKey: De,
308
- footerFlashTarget: ke,
309
- onSelect: be,
310
- month: ve,
311
- onMonthChange: I,
312
- disabled: et(se, ie),
313
- startMonth: le,
314
- endMonth: ce,
342
+ mode: K,
343
+ selected: K === "multi-range" ? te : p,
344
+ footerFlashKey: Me,
345
+ footerFlashTarget: Ke,
346
+ onSelect: He,
347
+ month: qe,
348
+ onMonthChange: w,
349
+ disabled: Rt(ue, me),
350
+ startMonth: ge,
351
+ endMonth: ve,
315
352
  showFooter: g,
316
- onApply: Z,
317
- onCancel: B,
318
- onClear: O,
353
+ onApply: re,
354
+ onCancel: A,
355
+ onClear: H,
356
+ onRangesChange: B,
319
357
  captionLayout: "dropdown",
320
- ...q !== void 0 ? { weekStartsOn: q } : {}
358
+ ...U !== void 0 ? { weekStartsOn: U } : {},
359
+ ...yt({
360
+ calendarKind: Pe,
361
+ fiscalMode: be,
362
+ granularity: Ie,
363
+ fiscalMonthPattern: Ee,
364
+ fiscalYearStartMonth: we,
365
+ fiscalConfig: Te,
366
+ showPresets: Be,
367
+ comparison: Se,
368
+ onComparisonChange: Ne
369
+ })
321
370
  }
322
371
  )
323
372
  }
@@ -328,7 +377,7 @@ const rt = c.forwardRef(
328
377
  );
329
378
  }
330
379
  );
331
- rt.displayName = "DateRangePicker";
380
+ xt.displayName = "DateRangePicker";
332
381
  export {
333
- rt as DateRangePicker
382
+ xt as DateRangePicker
334
383
  };
@@ -0,0 +1,13 @@
1
+ import { FiscalPickerProps } from './date-picker.types';
2
+ export declare function fiscalCalendarPassThrough(props: FiscalPickerProps): {
3
+ showPresets: boolean | undefined;
4
+ comparison: "prior-fy" | undefined;
5
+ onComparisonChange: ((value: import('../../..').YoYComparison | undefined) => void) | undefined;
6
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
7
+ calendarKind: "gregorian" | "fiscal" | undefined;
8
+ fiscalMode: "basic" | "advanced" | "custom" | undefined;
9
+ granularity: import('../../../lib/fiscal-calendar').Granularity | undefined;
10
+ fiscalMonthPattern: number[] | undefined;
11
+ fiscalYearStartMonth: number | undefined;
12
+ fiscalConfig: import('../../../lib/fiscal-calendar').FiscalCalendarConfig | undefined;
13
+ };