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