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,176 @@
1
+ import { jsx as r, jsxs as y } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { Cross as W, CalendarMonth as X } from "impact-nova-icons";
4
+ import { cn as Z } from "../../../lib/utils.js";
5
+ import { Input as _ } from "../input/input.js";
6
+ import { Calendar as $ } from "../../data-display/calendar/calendar.js";
7
+ import { Tooltip as x, TooltipTrigger as R, TooltipContent as D } from "../../feedback/tooltip/tooltip.js";
8
+ import { useImpactNovaI18n as ee } from "../../../i18n/use-impact-nova-i18n.js";
9
+ import { buildDateBoundsMatcher as re } from "../../../lib/date-bounds-matcher.js";
10
+ import { fiscalCalendarPassThrough as te } from "./fiscal-pass-through.js";
11
+ import { DatePickerShell as ne } from "./date-picker-shell.js";
12
+ import { usePickerDismissActionsRef as oe, usePickerFooterDismissNudge as ae, handleReadonlyPickerKeyDown as ie, handlePickerSurfacePointerDown as ce } from "./date-input-behavior.js";
13
+ import { formatYearInput as se } from "../../data-display/calendar/calendar-fiscal-labels.js";
14
+ import { viewMonthFromYear as le } from "../../data-display/calendar/calendar-year-utils.js";
15
+ const pe = t.forwardRef(
16
+ ({
17
+ value: n,
18
+ onChange: d,
19
+ placeholder: Y,
20
+ minDate: v,
21
+ maxDate: N,
22
+ startMonth: S,
23
+ endMonth: A,
24
+ showFooter: s = !0,
25
+ disabled: o,
26
+ className: I,
27
+ calendarKind: O,
28
+ fiscalMode: T,
29
+ granularity: w,
30
+ fiscalMonthPattern: M,
31
+ fiscalYearStartMonth: K,
32
+ fiscalConfig: k,
33
+ showPresets: j,
34
+ showIntervalCaption: F = !1,
35
+ ...L
36
+ }, z) => {
37
+ const { t: a } = ee(), E = Y ?? a("datePicker.selectYear"), m = t.useRef(null), P = t.useRef(null);
38
+ t.useImperativeHandle(z, () => m.current);
39
+ const [i, c] = t.useState(!1), u = t.useRef(!1), g = oe(), { footerFlashKey: H, footerFlashTarget: V, popoverHandlers: B } = ae(s, i, g, P), [C, l] = t.useState(n), [q, G] = t.useState(le(n));
40
+ t.useEffect(() => {
41
+ i || l(n);
42
+ }, [i, n]);
43
+ const p = t.useCallback(() => c(!1), []), J = te({
44
+ calendarKind: O,
45
+ fiscalMode: T,
46
+ granularity: w,
47
+ fiscalMonthPattern: M,
48
+ fiscalYearStartMonth: K,
49
+ fiscalConfig: k,
50
+ showPresets: j
51
+ }), Q = (e) => {
52
+ const f = e && !Array.isArray(e) && !("from" in e) && !("to" in e) ? e : void 0;
53
+ l(f), s || (d?.(f), p());
54
+ }, U = () => {
55
+ d?.(C), p();
56
+ }, h = () => {
57
+ l(n), p();
58
+ }, b = () => {
59
+ l(void 0), d?.(void 0), s || p();
60
+ };
61
+ return t.useLayoutEffect(() => {
62
+ g.current = { onDismiss: h, resolveFlash: () => "cancel" };
63
+ }), /* @__PURE__ */ r(
64
+ ne,
65
+ {
66
+ open: i,
67
+ disabled: o,
68
+ ariaLabel: a("datePicker.selectYear"),
69
+ onOpenChange: (e) => {
70
+ o || c(e);
71
+ },
72
+ onOpenAutoFocus: (e) => {
73
+ u.current || e.preventDefault(), u.current = !1;
74
+ },
75
+ popoverHandlers: B,
76
+ trigger: /* @__PURE__ */ r(
77
+ "div",
78
+ {
79
+ ref: P,
80
+ "data-component": "year-picker",
81
+ "data-state": i ? "open" : "closed",
82
+ onPointerDown: (e) => ce({
83
+ disabled: o,
84
+ event: e,
85
+ onOpen: () => c(!0),
86
+ focusField: () => m.current?.focus()
87
+ }),
88
+ children: /* @__PURE__ */ r(
89
+ _,
90
+ {
91
+ ref: m,
92
+ value: n ? se(n, k?.fyLabel ?? "fy-long") : "",
93
+ readOnly: !0,
94
+ onKeyDown: (e) => ie(e, {
95
+ disabled: o,
96
+ open: i,
97
+ onOpen: () => c(!0),
98
+ onCancel: h,
99
+ onKeyboardOpen: () => {
100
+ u.current = !0;
101
+ }
102
+ }),
103
+ onClick: () => !o && c(!0),
104
+ placeholder: E,
105
+ disabled: o,
106
+ "data-form-control": "input",
107
+ className: Z("cursor-pointer", I),
108
+ suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
109
+ n && !o ? /* @__PURE__ */ y(x, { children: [
110
+ /* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ r(
111
+ "button",
112
+ {
113
+ type: "button",
114
+ tabIndex: 0,
115
+ "aria-label": a("calendar.clear"),
116
+ onClick: (e) => {
117
+ e.stopPropagation(), b();
118
+ },
119
+ className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
120
+ children: /* @__PURE__ */ r(W, { className: "size-3 hover:text-content" })
121
+ }
122
+ ) }),
123
+ /* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("calendar.clear") })
124
+ ] }) : null,
125
+ /* @__PURE__ */ y(x, { children: [
126
+ /* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ r(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ tabIndex: 0,
131
+ "data-component": "calendar-trigger",
132
+ "aria-label": a("datePicker.selectYear"),
133
+ onClick: (e) => {
134
+ e.stopPropagation(), o || c((f) => !f);
135
+ },
136
+ className: "inline-flex items-center justify-center border-none bg-transparent p-0",
137
+ children: /* @__PURE__ */ r(X, { className: "h-4 w-4 text-secondary-foreground" })
138
+ }
139
+ ) }),
140
+ /* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("datePicker.selectYear") })
141
+ ] })
142
+ ] }),
143
+ ...L
144
+ }
145
+ )
146
+ }
147
+ ),
148
+ children: /* @__PURE__ */ r(
149
+ $,
150
+ {
151
+ pickerType: "year",
152
+ selectedYear: C,
153
+ footerFlashKey: H,
154
+ footerFlashTarget: V,
155
+ onYearSelect: Q,
156
+ month: q,
157
+ onMonthChange: G,
158
+ disabled: re(v, N),
159
+ startMonth: S,
160
+ endMonth: A,
161
+ showFooter: s,
162
+ onApply: U,
163
+ onCancel: h,
164
+ onClear: b,
165
+ showIntervalCaption: F,
166
+ ...J
167
+ }
168
+ )
169
+ }
170
+ );
171
+ }
172
+ );
173
+ pe.displayName = "YearPicker";
174
+ export {
175
+ pe as YearPicker
176
+ };
@@ -0,0 +1,3 @@
1
+ import { YearRangePickerProps } from './date-picker.types';
2
+ import * as React from "react";
3
+ export declare const YearRangePicker: React.ForwardRefExoticComponent<YearRangePickerProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,179 @@
1
+ import { jsx as r, jsxs as g } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { Cross as Z, CalendarMonth as _ } from "impact-nova-icons";
4
+ import { cn as ee } from "../../../lib/utils.js";
5
+ import { Input as re } from "../input/input.js";
6
+ import { Calendar as te } from "../../data-display/calendar/calendar.js";
7
+ import { Tooltip as x, TooltipTrigger as D, TooltipContent as Y } from "../../feedback/tooltip/tooltip.js";
8
+ import { useImpactNovaI18n as ne } from "../../../i18n/use-impact-nova-i18n.js";
9
+ import { buildDateBoundsMatcher as oe } from "../../../lib/date-bounds-matcher.js";
10
+ import { fiscalCalendarPassThrough as ae } from "./fiscal-pass-through.js";
11
+ import { DatePickerShell as ie } from "./date-picker-shell.js";
12
+ import { usePickerDismissActionsRef as ce, usePickerFooterDismissNudge as se, handleReadonlyPickerKeyDown as le, handlePickerSurfacePointerDown as fe } from "./date-input-behavior.js";
13
+ import { formatYearInput as N } from "../../data-display/calendar/calendar-fiscal-labels.js";
14
+ import { viewMonthFromYear as pe } from "../../data-display/calendar/calendar-year-utils.js";
15
+ const de = t.forwardRef(
16
+ ({
17
+ value: n,
18
+ onChange: d,
19
+ placeholder: S,
20
+ minDate: v,
21
+ maxDate: A,
22
+ startMonth: I,
23
+ endMonth: M,
24
+ showFooter: l = !0,
25
+ disabled: o,
26
+ className: O,
27
+ calendarKind: T,
28
+ fiscalMode: w,
29
+ granularity: K,
30
+ fiscalMonthPattern: j,
31
+ fiscalYearStartMonth: F,
32
+ fiscalConfig: y,
33
+ showPresets: L,
34
+ showIntervalCaption: $ = !1,
35
+ ...z
36
+ }, E) => {
37
+ const { t: a } = ne(), H = S ?? a("datePicker.selectYearRange"), k = y?.fyLabel ?? "fy-long", m = t.useRef(null), P = t.useRef(null);
38
+ t.useImperativeHandle(E, () => m.current);
39
+ const [i, c] = t.useState(!1), u = t.useRef(!1), R = ce(), { footerFlashKey: V, footerFlashTarget: B, popoverHandlers: q } = se(l, i, R, P), [C, f] = t.useState(n), [G, J] = t.useState(pe(n?.from));
40
+ t.useEffect(() => {
41
+ i || f(n);
42
+ }, [i, n]);
43
+ const p = t.useCallback(() => c(!1), []), Q = ae({
44
+ calendarKind: T,
45
+ fiscalMode: w,
46
+ granularity: K,
47
+ fiscalMonthPattern: j,
48
+ fiscalYearStartMonth: F,
49
+ fiscalConfig: y,
50
+ showPresets: L
51
+ }), U = (e) => {
52
+ const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
53
+ f(s), l || (d?.(s), s?.to && p());
54
+ }, W = () => {
55
+ d?.(C), p();
56
+ }, h = () => {
57
+ f(n), p();
58
+ }, b = () => {
59
+ f(void 0), d?.(void 0), l || p();
60
+ };
61
+ t.useLayoutEffect(() => {
62
+ R.current = { onDismiss: h, resolveFlash: () => "cancel" };
63
+ });
64
+ const X = n?.from ? `${N(n.from, k)}${n.to ? ` – ${N(n.to, k)}` : ""}` : "";
65
+ return /* @__PURE__ */ r(
66
+ ie,
67
+ {
68
+ open: i,
69
+ disabled: o,
70
+ ariaLabel: a("datePicker.selectYearRange"),
71
+ onOpenChange: (e) => {
72
+ o || c(e);
73
+ },
74
+ onOpenAutoFocus: (e) => {
75
+ u.current || e.preventDefault(), u.current = !1;
76
+ },
77
+ popoverHandlers: q,
78
+ trigger: /* @__PURE__ */ r(
79
+ "div",
80
+ {
81
+ ref: P,
82
+ "data-component": "year-range-picker",
83
+ "data-state": i ? "open" : "closed",
84
+ onPointerDown: (e) => fe({
85
+ disabled: o,
86
+ event: e,
87
+ onOpen: () => c(!0),
88
+ focusField: () => m.current?.focus()
89
+ }),
90
+ children: /* @__PURE__ */ r(
91
+ re,
92
+ {
93
+ ref: m,
94
+ value: X,
95
+ readOnly: !0,
96
+ onKeyDown: (e) => le(e, {
97
+ disabled: o,
98
+ open: i,
99
+ onOpen: () => c(!0),
100
+ onCancel: h,
101
+ onKeyboardOpen: () => {
102
+ u.current = !0;
103
+ }
104
+ }),
105
+ onClick: () => !o && c(!0),
106
+ placeholder: H,
107
+ disabled: o,
108
+ "data-form-control": "input",
109
+ className: ee("cursor-pointer", O),
110
+ suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
111
+ n?.from && !o ? /* @__PURE__ */ g(x, { children: [
112
+ /* @__PURE__ */ r(D, { asChild: !0, children: /* @__PURE__ */ r(
113
+ "button",
114
+ {
115
+ type: "button",
116
+ tabIndex: 0,
117
+ "aria-label": a("calendar.clear"),
118
+ onClick: (e) => {
119
+ e.stopPropagation(), b();
120
+ },
121
+ className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
122
+ children: /* @__PURE__ */ r(Z, { className: "size-3 hover:text-content" })
123
+ }
124
+ ) }),
125
+ /* @__PURE__ */ r(Y, { variant: "tertiary", side: "top", children: a("calendar.clear") })
126
+ ] }) : null,
127
+ /* @__PURE__ */ g(x, { children: [
128
+ /* @__PURE__ */ r(D, { asChild: !0, children: /* @__PURE__ */ r(
129
+ "button",
130
+ {
131
+ type: "button",
132
+ tabIndex: 0,
133
+ "data-component": "calendar-trigger",
134
+ "aria-label": a("datePicker.selectYearRange"),
135
+ onClick: (e) => {
136
+ e.stopPropagation(), o || c((s) => !s);
137
+ },
138
+ className: "inline-flex items-center justify-center border-none bg-transparent p-0",
139
+ children: /* @__PURE__ */ r(_, { className: "h-4 w-4 text-secondary-foreground" })
140
+ }
141
+ ) }),
142
+ /* @__PURE__ */ r(Y, { variant: "tertiary", side: "top", children: a("datePicker.selectYearRange") })
143
+ ] })
144
+ ] }),
145
+ ...z
146
+ }
147
+ )
148
+ }
149
+ ),
150
+ children: /* @__PURE__ */ r(
151
+ te,
152
+ {
153
+ pickerType: "year",
154
+ yearMode: "range",
155
+ selectedYear: C,
156
+ footerFlashKey: V,
157
+ footerFlashTarget: B,
158
+ onYearSelect: U,
159
+ month: G,
160
+ onMonthChange: J,
161
+ disabled: oe(v, A),
162
+ startMonth: I,
163
+ endMonth: M,
164
+ showFooter: l,
165
+ onApply: W,
166
+ onCancel: h,
167
+ onClear: b,
168
+ showIntervalCaption: $,
169
+ ...Q
170
+ }
171
+ )
172
+ }
173
+ );
174
+ }
175
+ );
176
+ de.displayName = "YearRangePicker";
177
+ export {
178
+ de as YearRangePicker
179
+ };
@@ -1,57 +1,57 @@
1
- import { jsx as F, jsxs as N } from "react/jsx-runtime";
2
- import { useMemo as I, useRef as q, useEffect as O } from "react";
3
- import { useWatch as S, Controller as K } from "react-hook-form";
4
- import { DatePicker as M } from "../../components/forms/date-picker/date-picker.js";
5
- import { getEffectiveMinOffsetDaysFromToday as Y } from "../utils/formDate.utils.js";
1
+ import { jsx as F, jsxs as M } from "react/jsx-runtime";
2
+ import { useMemo as I, useRef as K, useEffect as Y } from "react";
3
+ import { useWatch as W, Controller as k } from "react-hook-form";
4
+ import { DatePicker as q } from "../../components/forms/date-picker/date-picker.js";
5
+ import { getEffectiveMinOffsetDaysFromToday as O } from "../utils/formDate.utils.js";
6
6
  import { startOfDayDate as v, addDaysDate as y, handleDateFnsFormat as L } from "../utils/date.utils.js";
7
7
  import { parseYmdString as f, formatYmd as $ } from "../utils/calendar-boundary.js";
8
- const B = "__dateInputPairedSentinel__", H = ({
9
- field: a,
10
- validationRules: E,
8
+ const b = "__dateInputPairedSentinel__", H = ({
9
+ field: n,
10
+ validationRules: N,
11
11
  isDisabled: u,
12
12
  formHelpers: h
13
13
  }) => {
14
- const m = a.fieldType === "date", e = m ? a : null, g = h.form.control, A = h.form.trigger, T = h.getValues, i = I(() => e?.dateAfterFieldId ? Array.isArray(e.dateAfterFieldId) ? e.dateAfterFieldId : [e.dateAfterFieldId] : [], [e]), s = I(() => e?.dateBeforeFieldId ? Array.isArray(e.dateBeforeFieldId) ? e.dateBeforeFieldId : [e.dateBeforeFieldId] : [], [e]), P = i.length > 0 ? i : [B], p = S({
14
+ const m = n.fieldType === "date", e = m ? n : null, g = h.form.control, A = h.form.trigger, P = h.getValues, s = I(() => e?.dateAfterFieldId ? Array.isArray(e.dateAfterFieldId) ? e.dateAfterFieldId : [e.dateAfterFieldId] : [], [e]), i = I(() => e?.dateBeforeFieldId ? Array.isArray(e.dateBeforeFieldId) ? e.dateBeforeFieldId : [e.dateBeforeFieldId] : [], [e]), B = s.length > 0 ? s : [b], p = W({
15
15
  control: g,
16
- name: P,
17
- disabled: !m || i.length === 0
18
- }), _ = s.length > 0 ? s : [B], D = S({
19
- control: g,
20
- name: _,
16
+ name: B,
21
17
  disabled: !m || s.length === 0
22
- }), W = i.length > 0 || s.length > 0, b = q(!0), C = i.length > 0 ? p.join("|") : "", R = s.length > 0 ? D.join("|") : "";
23
- O(() => {
24
- if (!e || !W) return;
25
- if (b.current) {
26
- b.current = !1;
18
+ }), E = i.length > 0 ? i : [b], D = W({
19
+ control: g,
20
+ name: E,
21
+ disabled: !m || i.length === 0
22
+ }), T = s.length > 0 || i.length > 0, w = K(!0), _ = s.length > 0 ? p.join("|") : "", C = i.length > 0 ? D.join("|") : "";
23
+ Y(() => {
24
+ if (!e || !T) return;
25
+ if (w.current) {
26
+ w.current = !1;
27
27
  return;
28
28
  }
29
- const r = T()[e.id];
29
+ const r = P()[e.id];
30
30
  r != null && String(r).trim() !== "" && A(e.id);
31
31
  }, [
32
+ _,
32
33
  C,
33
- R,
34
34
  e,
35
+ P,
35
36
  T,
36
- W,
37
37
  A
38
38
  ]);
39
- const { minDate: V, maxDate: j } = I(() => {
39
+ const { minDate: R, maxDate: V } = I(() => {
40
40
  if (!e)
41
41
  return {
42
42
  minDate: void 0,
43
43
  maxDate: void 0
44
44
  };
45
- const r = [], l = Y(e);
45
+ const r = [], l = O(e);
46
46
  if (l != null && l >= 0 && r.push(v(y(/* @__PURE__ */ new Date(), l))), e.minDate) {
47
47
  const t = f(e.minDate);
48
48
  t && r.push(t);
49
49
  }
50
- if (i.length > 0) {
51
- const t = i.length > 0 ? p : [];
52
- for (const n of t) {
53
- if (!n) continue;
54
- const c = f(String(n));
50
+ if (s.length > 0) {
51
+ const t = s.length > 0 ? p : [];
52
+ for (const a of t) {
53
+ if (!a) continue;
54
+ const c = f(String(a));
55
55
  if (c) {
56
56
  const x = e.dateAfterFieldIdInclusive ? 0 : 1;
57
57
  r.push(v(y(c, x)));
@@ -60,68 +60,73 @@ const B = "__dateInputPairedSentinel__", H = ({
60
60
  }
61
61
  let d;
62
62
  r.length > 0 && (d = r.reduce(
63
- (t, n) => t.getTime() >= n.getTime() ? t : n
63
+ (t, a) => t.getTime() >= a.getTime() ? t : a
64
64
  ));
65
65
  let o;
66
66
  if (e.maxDate) {
67
67
  const t = f(e.maxDate);
68
68
  t && (o = t);
69
69
  }
70
- if (s.length > 0) {
71
- const t = s.length > 0 ? D : [];
72
- for (const n of t) {
73
- if (!n) continue;
74
- const c = f(String(n));
70
+ if (i.length > 0) {
71
+ const t = i.length > 0 ? D : [];
72
+ for (const a of t) {
73
+ if (!a) continue;
74
+ const c = f(String(a));
75
75
  if (c) {
76
- const x = e.dateBeforeFieldIdInclusive ? 0 : -1, w = v(y(c, x));
77
- o = o == null || w.getTime() < o.getTime() ? w : o;
76
+ const x = e.dateBeforeFieldIdInclusive ? 0 : -1, S = v(y(c, x));
77
+ o = o == null || S.getTime() < o.getTime() ? S : o;
78
78
  }
79
79
  }
80
80
  }
81
81
  return { minDate: d, maxDate: o };
82
- }, [e, i, s, p, D]);
82
+ }, [e, s, i, p, D]);
83
83
  if (!m || !e) return null;
84
- const k = L(e.dateFormat);
84
+ const j = L(e.dateFormat);
85
85
  return /* @__PURE__ */ F(
86
- K,
86
+ k,
87
87
  {
88
- name: a.id,
88
+ name: n.id,
89
89
  control: g,
90
90
  disabled: u,
91
- rules: E,
91
+ rules: N,
92
92
  render: ({ field: r, fieldState: l }) => {
93
93
  const d = !!l.error, o = r.value, t = o ? f(String(o)) : void 0;
94
- return /* @__PURE__ */ N("div", { className: "flex w-full min-w-0 flex-col gap-[6px]", children: [
95
- /* @__PURE__ */ N(
94
+ return /* @__PURE__ */ M("div", { className: "flex w-full min-w-0 flex-col gap-[6px]", children: [
95
+ /* @__PURE__ */ M(
96
96
  "label",
97
97
  {
98
- htmlFor: a.id,
98
+ htmlFor: n.id,
99
99
  className: `text-[12px] font-medium leading-[18px] text-[#60697d]${u ? " opacity-70" : ""}`,
100
100
  children: [
101
- a.label,
101
+ n.label,
102
102
  " ",
103
- a.isRequired ? /* @__PURE__ */ F("span", { className: "text-[red]", children: "*" }) : null
103
+ n.isRequired ? /* @__PURE__ */ F("span", { className: "text-[red]", children: "*" }) : null
104
104
  ]
105
105
  }
106
106
  ),
107
107
  /* @__PURE__ */ F(
108
- M,
108
+ q,
109
109
  {
110
- id: a.id,
110
+ id: n.id,
111
111
  label: void 0,
112
- format: k,
113
- minDate: V,
114
- maxDate: j,
112
+ format: j,
113
+ minDate: R,
114
+ maxDate: V,
115
115
  value: t,
116
- onChange: (n) => {
117
- r.onChange(n ? $(n) : "");
116
+ onChange: (a) => {
117
+ r.onChange(a ? $(a) : "");
118
118
  },
119
- placeholder: a.placeholder,
120
- required: a.isRequired,
119
+ placeholder: n.placeholder,
120
+ required: n.isRequired,
121
121
  disabled: u,
122
122
  error: d,
123
- helperText: d ? l.error?.message : a.helpText,
124
- showFooter: e.showFooter
123
+ helperText: d ? l.error?.message : n.helpText,
124
+ showFooter: e.showFooter,
125
+ calendarKind: e.calendarKind,
126
+ fiscalMode: e.fiscalMode,
127
+ fiscalYearStartMonth: e.fiscalYearStartMonth,
128
+ fiscalMonthPattern: e.fiscalMonthPattern,
129
+ showPresets: e.showPresets
125
130
  }
126
131
  )
127
132
  ] });
@@ -1,51 +1,56 @@
1
- import { jsx as a } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import "react";
3
- import { Controller as M } from "react-hook-form";
4
- import { DateRangePicker as S } from "../../components/forms/date-picker/date-range-picker.js";
5
- import { toLocalDate as n } from "../utils/calendar-boundary.js";
6
- import { handleMinMaxProp as v } from "../utils/date.utils.js";
7
- const T = ({
8
- field: t,
9
- validationRules: i,
3
+ import { Controller as S } from "react-hook-form";
4
+ import { DateRangePicker as g } from "../../components/forms/date-picker/date-range-picker.js";
5
+ import { toLocalDate as a } from "../utils/calendar-boundary.js";
6
+ import { handleMinMaxProp as D } from "../utils/date.utils.js";
7
+ const Y = ({
8
+ field: r,
9
+ validationRules: h,
10
10
  isDisabled: l,
11
- formHelpers: d
11
+ formHelpers: s
12
12
  }) => {
13
- const r = t.fieldType === "date_range" ? t : null;
14
- if (!r) return null;
15
- const m = d.form.control, { minDate: c, maxDate: u } = v(r);
16
- return /* @__PURE__ */ a(
17
- M,
13
+ const t = r.fieldType === "date_range" ? r : null;
14
+ if (!t) return null;
15
+ const c = s.form.control, { minDate: m, maxDate: u } = D(t);
16
+ return /* @__PURE__ */ n(
17
+ S,
18
18
  {
19
- name: t.id,
20
- control: m,
19
+ name: r.id,
20
+ control: c,
21
21
  disabled: l,
22
- rules: i,
23
- render: ({ field: p, fieldState: s }) => {
24
- const h = !!s.error, e = p.value;
25
- return /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
26
- S,
22
+ rules: h,
23
+ render: ({ field: p, fieldState: d }) => {
24
+ const i = !!d.error, e = p.value;
25
+ return /* @__PURE__ */ n("div", { children: /* @__PURE__ */ n(
26
+ g,
27
27
  {
28
- label: t.label,
29
- minDate: c,
28
+ label: r.label,
29
+ minDate: m,
30
30
  maxDate: u,
31
- startMonth: r.startMonth ? n(r.startMonth) : void 0,
32
- endMonth: r.endMonth ? n(r.endMonth) : void 0,
31
+ startMonth: t.startMonth ? a(t.startMonth) : void 0,
32
+ endMonth: t.endMonth ? a(t.endMonth) : void 0,
33
33
  value: {
34
- from: e?.start ? n(e.start) : void 0,
35
- to: e?.end ? n(e.end) : void 0
34
+ from: e?.start ? a(e.start) : void 0,
35
+ to: e?.end ? a(e.end) : void 0
36
36
  },
37
37
  onChange: (o) => {
38
- const g = o?.from ? `${o.from.getFullYear()}-${String(o.from.getMonth() + 1).padStart(2, "0")}-${String(o.from.getDate()).padStart(2, "0")}` : null, D = o?.to ? `${o.to.getFullYear()}-${String(o.to.getMonth() + 1).padStart(2, "0")}-${String(o.to.getDate()).padStart(2, "0")}` : null;
39
- d.setValue(t.id, { start: g, end: D });
38
+ const M = o?.from ? `${o.from.getFullYear()}-${String(o.from.getMonth() + 1).padStart(2, "0")}-${String(o.from.getDate()).padStart(2, "0")}` : null, f = o?.to ? `${o.to.getFullYear()}-${String(o.to.getMonth() + 1).padStart(2, "0")}-${String(o.to.getDate()).padStart(2, "0")}` : null;
39
+ s.setValue(r.id, { start: M, end: f });
40
40
  },
41
- startPlaceholder: r.startPlaceholder || "Start Date",
42
- endPlaceholder: r.endPlaceholder || "End Date",
43
- placeholder: t.placeholder,
44
- required: t.isRequired,
41
+ startPlaceholder: t.startPlaceholder || "Start Date",
42
+ endPlaceholder: t.endPlaceholder || "End Date",
43
+ placeholder: r.placeholder,
44
+ required: r.isRequired,
45
45
  disabled: l,
46
- error: h,
47
- helperText: h ? s.error?.message : t.helpText,
48
- showFooter: !0
46
+ error: i,
47
+ helperText: i ? d.error?.message : r.helpText,
48
+ showFooter: !0,
49
+ calendarKind: t.calendarKind,
50
+ fiscalMode: t.fiscalMode,
51
+ fiscalYearStartMonth: t.fiscalYearStartMonth,
52
+ fiscalMonthPattern: t.fiscalMonthPattern,
53
+ showPresets: t.showPresets
49
54
  }
50
55
  ) });
51
56
  }
@@ -53,5 +58,5 @@ const T = ({
53
58
  );
54
59
  };
55
60
  export {
56
- T as DateRangeField
61
+ Y as DateRangeField
57
62
  };