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,69 +1,79 @@
1
- import { jsxs as x, jsx as o } from "react/jsx-runtime";
1
+ import { jsx as s, jsxs as S } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
- import { Cross as se, CalendarMonth as le } from "impact-nova-icons";
4
- import { format as w } from "date-fns";
5
- import { cn as ce } from "../../../lib/utils.js";
6
- import { usePickerDismissActionsRef as ae, usePickerFooterDismissNudge as pe, isDateInputInvalid as ue, resolveSingleValueDismissFlash as fe, handlePickerSurfacePointerDown as de, maskDateInput as me, parseDateInput as he, resolveDateInputOnBlur as De, resolveDateInputOnEnter as ge } from "./date-input-behavior.js";
7
- import { Input as ye } from "../input/input.js";
8
- import { Popover as ke, PopoverAnchor as ve, PopoverContent as Ce } from "../../feedback/popover/popover.js";
9
- import { Calendar as Ie } from "../../data-display/calendar/calendar.js";
3
+ import { Cross as he, CalendarMonth as De } from "impact-nova-icons";
4
+ import { format as b } from "date-fns";
5
+ import { cn as ge } from "../../../lib/utils.js";
6
+ import { usePickerDismissActionsRef as ye, usePickerFooterDismissNudge as ke, isDateInputInvalid as ve, resolveSingleValueDismissFlash as Ie, handlePickerSurfacePointerDown as Ce, maskDateInput as Pe, parseDateInput as Me, resolveDateInputOnBlur as xe, resolveDateInputOnEnter as Re } from "./date-input-behavior.js";
7
+ import { Input as Se } from "../input/input.js";
8
+ import { Calendar as be } from "../../data-display/calendar/calendar.js";
10
9
  import { Tooltip as j, TooltipTrigger as B, TooltipContent as K } from "../../feedback/tooltip/tooltip.js";
11
- import { useImpactNovaI18n as Pe } from "../../../i18n/use-impact-nova-i18n.js";
12
- import { getDateFnsLocale as Me } from "../../../i18n/getDateFnsLocale.js";
13
- import { createComponent as xe } from "../../../lib/primitives/create-component.js";
14
- import { coerceSingleDateApply as Re, coerceSingleDate as be } from "./calendar-selection-adapters.js";
15
- import { buildDateBoundsMatcher as we } from "../../../lib/date-bounds-matcher.js";
16
- const Ge = xe(
10
+ import { useImpactNovaI18n as we } from "../../../i18n/use-impact-nova-i18n.js";
11
+ import { getDateFnsLocale as Te } from "../../../i18n/getDateFnsLocale.js";
12
+ import { createComponent as Ee } from "../../../lib/primitives/create-component.js";
13
+ import { coerceSingleDateApply as Ae, coerceSingleDate as Ne } from "./calendar-selection-adapters.js";
14
+ import { buildDateBoundsMatcher as Le } from "../../../lib/date-bounds-matcher.js";
15
+ import { fiscalCalendarPassThrough as Oe } from "./fiscal-pass-through.js";
16
+ import { DatePickerShell as Ve } from "./date-picker-shell.js";
17
+ const $e = Ee(
17
18
  "DatePicker",
18
19
  ({
19
20
  value: n,
20
- onChange: u,
21
- format: c = "MM/dd/yyyy",
21
+ onChange: p,
22
+ format: l = "MM/dd/yyyy",
22
23
  placeholder: z,
23
24
  minDate: H,
24
25
  maxDate: q,
25
26
  startMonth: G,
26
27
  endMonth: J,
27
28
  showFooter: a = !0,
28
- weekStartsOn: S,
29
- disabled: l,
29
+ weekStartsOn: w,
30
+ disabled: c,
30
31
  className: Q,
31
- ...U
32
- }, W) => {
33
- const { locale: T, t: h } = Pe(), f = r.useMemo(() => Me(T), [T]), X = z ?? h("datePicker.selectDate"), g = r.useRef(null), A = r.useRef(null), I = r.useRef(null);
34
- r.useImperativeHandle(W, () => g.current);
35
- const [i, E] = r.useState(!1), N = ae(), { footerFlashKey: Y, footerFlashTarget: Z, popoverHandlers: _ } = pe(a, i, N, A), y = r.useRef(!1), [R, s] = r.useState(null), k = n ? w(n, c, { locale: f }) : "", d = R?.input ?? k, P = i ? R?.pending ?? n : n, $ = R?.viewMonth ?? n ?? /* @__PURE__ */ new Date(), p = r.useCallback(() => {
36
- s(null), E(!1);
32
+ calendarKind: U,
33
+ fiscalMode: W,
34
+ granularity: X,
35
+ fiscalMonthPattern: Y,
36
+ fiscalYearStartMonth: Z,
37
+ fiscalConfig: _,
38
+ showPresets: $,
39
+ comparison: F,
40
+ onComparisonChange: ee,
41
+ ...te
42
+ }, ne) => {
43
+ const { locale: T, t: h } = we(), f = r.useMemo(() => Te(T), [T]), re = z ?? h("datePicker.selectDate"), g = r.useRef(null), E = r.useRef(null), C = r.useRef(null);
44
+ r.useImperativeHandle(ne, () => g.current);
45
+ const [i, A] = r.useState(!1), N = ye(), { footerFlashKey: ie, footerFlashTarget: oe, popoverHandlers: se } = ke(a, i, N, E), y = r.useRef(!1), [x, o] = r.useState(null), k = n ? b(n, l, { locale: f }) : "", d = x?.input ?? k, P = i ? x?.pending ?? n : n, ce = x?.viewMonth ?? n ?? /* @__PURE__ */ new Date(), u = r.useCallback(() => {
46
+ o(null), A(!1);
37
47
  }, []), m = (e) => {
38
- if (!l) {
48
+ if (!c) {
39
49
  if (e) {
40
- s({
50
+ o({
41
51
  input: k,
42
52
  pending: n,
43
53
  viewMonth: n ?? /* @__PURE__ */ new Date()
44
- }), E(!0);
54
+ }), A(!0);
45
55
  return;
46
56
  }
47
- p();
57
+ u();
48
58
  }
49
59
  };
50
60
  r.useEffect(() => {
51
- g.current && I.current !== null && (g.current.setSelectionRange(I.current, I.current), I.current = null);
61
+ g.current && C.current !== null && (g.current.setSelectionRange(C.current, C.current), C.current = null);
52
62
  }, [d]);
53
- const F = (e) => {
54
- const t = be(e), D = t ? w(t, c, { locale: f }) : "";
55
- s(
63
+ const le = (e) => {
64
+ const t = Ne(e), D = t ? b(t, l, { locale: f }) : "";
65
+ o(
56
66
  (v) => v ? { ...v, pending: t, input: D, viewMonth: t ?? v.viewMonth } : null
57
- ), t && !a && (u?.(t), p());
58
- }, O = (e) => {
59
- const t = Re(e, P);
60
- u?.(t), p();
61
- }, b = () => {
62
- p();
63
- }, V = () => {
64
- u?.(void 0), a ? s(
67
+ ), t && !a && (p?.(t), u());
68
+ }, L = (e) => {
69
+ const t = Ae(e, P);
70
+ p?.(t), u();
71
+ }, R = () => {
72
+ u();
73
+ }, O = () => {
74
+ p?.(void 0), a ? o(
65
75
  (e) => e ? { ...e, pending: void 0, input: "" } : null
66
- ) : p();
76
+ ) : u();
67
77
  }, M = r.useCallback(
68
78
  () => ({
69
79
  input: k,
@@ -71,59 +81,59 @@ const Ge = xe(
71
81
  viewMonth: n ?? /* @__PURE__ */ new Date()
72
82
  }),
73
83
  [k, n]
74
- ), ee = (e) => {
75
- const t = me(e.target.value, c, d);
76
- if (s((C) => ({ ...C ?? M(), input: t })), t === "") {
77
- s((C) => ({ ...C ?? M(), input: "", pending: void 0 })), a || u?.(void 0);
84
+ ), ae = (e) => {
85
+ const t = Pe(e.target.value, l, d);
86
+ if (o((I) => ({ ...I ?? M(), input: t })), t === "") {
87
+ o((I) => ({ ...I ?? M(), input: "", pending: void 0 })), a || p?.(void 0);
78
88
  return;
79
89
  }
80
- const { parsed: D, isValid: v } = he(t, c, f);
81
- v && D && (s((C) => ({
82
- ...C ?? M(),
90
+ const { parsed: D, isValid: v } = Me(t, l, f);
91
+ v && D && (o((I) => ({
92
+ ...I ?? M(),
83
93
  input: t,
84
94
  pending: D,
85
95
  viewMonth: D
86
- })), a || u?.(D));
87
- }, te = r.useCallback(
96
+ })), a || p?.(D));
97
+ }, ue = r.useCallback(
88
98
  (e) => {
89
- u?.(e), p();
99
+ p?.(e), u();
90
100
  },
91
- [u, p]
92
- ), ne = () => {
101
+ [p, u]
102
+ ), pe = () => {
93
103
  if (i) return;
94
- const e = De(
104
+ const e = xe(
95
105
  d,
96
- c,
106
+ l,
97
107
  k,
98
108
  f
99
109
  );
100
110
  if (e.resetToCommitted) {
101
- s(null);
111
+ o(null);
102
112
  return;
103
113
  }
104
114
  if (e.parsed) {
105
- s((t) => ({
115
+ o((t) => ({
106
116
  ...t ?? M(),
107
117
  input: e.display,
108
118
  pending: e.parsed,
109
119
  viewMonth: e.parsed
110
- })), a || (u?.(e.parsed), s(null));
120
+ })), a || (p?.(e.parsed), o(null));
111
121
  return;
112
122
  }
113
- s(null);
114
- }, re = () => {
123
+ o(null);
124
+ }, fe = () => {
115
125
  if (i && a) {
116
- O();
126
+ L();
117
127
  return;
118
128
  }
119
- const e = ge(d, c, f);
129
+ const e = Re(d, l, f);
120
130
  if (e.parsed) {
121
- a && te(e.parsed);
131
+ a && ue(e.parsed);
122
132
  return;
123
133
  }
124
134
  i || (y.current = !0, m(!0));
125
- }, L = (n ? w(n, c, { locale: f }) : "") !== d, oe = ue(d, c, f), ie = r.useCallback(
126
- () => fe(
135
+ }, V = (n ? b(n, l, { locale: f }) : "") !== d, de = ve(d, l, f), me = r.useCallback(
136
+ () => Ie(
127
137
  P,
128
138
  n,
129
139
  (e, t) => e.getTime() === t.getTime()
@@ -132,111 +142,121 @@ const Ge = xe(
132
142
  );
133
143
  return r.useLayoutEffect(() => {
134
144
  N.current = {
135
- onDismiss: b,
136
- resolveFlash: ie
145
+ onDismiss: R,
146
+ resolveFlash: me
137
147
  };
138
- }), /* @__PURE__ */ x(ke, { open: l ? !1 : i, onOpenChange: m, children: [
139
- /* @__PURE__ */ o(ve, { asChild: !0, children: /* @__PURE__ */ o(
140
- "div",
141
- {
142
- ref: A,
143
- "data-component": "date-picker",
144
- "data-state": i ? "open" : "closed",
145
- "data-pending": L || void 0,
146
- onPointerDown: (e) => de({
147
- disabled: l,
148
- event: e,
149
- onOpen: () => m(!0),
150
- focusField: () => g.current?.focus()
151
- }),
152
- children: /* @__PURE__ */ o(
153
- ye,
154
- {
155
- ref: g,
156
- value: d,
157
- onChange: ee,
158
- onBlur: ne,
159
- onClick: () => !l && m(!0),
160
- onKeyDown: (e) => {
161
- e.key === "Enter" && !l && (e.preventDefault(), re()), e.key === "ArrowDown" && !i && !l && (e.preventDefault(), y.current = !0, m(!0)), e.key === "Escape" && i && (e.preventDefault(), b());
162
- },
163
- placeholder: i ? c : X,
164
- disabled: l,
165
- "data-form-control": "input",
166
- className: ce(
167
- "cursor-pointer",
168
- oe ? "text-destructive" : L ? "text-content-placeholder" : "",
169
- Q
170
- ),
171
- suffix: /* @__PURE__ */ x("div", { className: "flex items-center gap-1", children: [
172
- n && !l && /* @__PURE__ */ x(j, { children: [
173
- /* @__PURE__ */ o(B, { asChild: !0, children: /* @__PURE__ */ o(
174
- "button",
175
- {
176
- type: "button",
177
- tabIndex: 0,
178
- "aria-label": h("calendar.clear"),
179
- onClick: (e) => {
180
- e.stopPropagation(), V();
181
- },
182
- className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
183
- children: /* @__PURE__ */ o(se, { className: "size-3 hover:text-content" })
184
- }
185
- ) }),
186
- /* @__PURE__ */ o(K, { variant: "tertiary", side: "top", children: h("calendar.clear") })
148
+ }), /* @__PURE__ */ s(
149
+ Ve,
150
+ {
151
+ open: i,
152
+ disabled: c,
153
+ ariaLabel: h("datePicker.selectDate"),
154
+ onOpenChange: m,
155
+ onOpenAutoFocus: (e) => {
156
+ y.current || e.preventDefault(), y.current = !1;
157
+ },
158
+ popoverHandlers: se,
159
+ trigger: /* @__PURE__ */ s(
160
+ "div",
161
+ {
162
+ ref: E,
163
+ "data-component": "date-picker",
164
+ "data-state": i ? "open" : "closed",
165
+ "data-pending": V || void 0,
166
+ onPointerDown: (e) => Ce({
167
+ disabled: c,
168
+ event: e,
169
+ onOpen: () => m(!0),
170
+ focusField: () => g.current?.focus()
171
+ }),
172
+ children: /* @__PURE__ */ s(
173
+ Se,
174
+ {
175
+ ref: g,
176
+ value: d,
177
+ onChange: ae,
178
+ onBlur: pe,
179
+ onClick: () => !c && m(!0),
180
+ onKeyDown: (e) => {
181
+ e.key === "Enter" && !c && (e.preventDefault(), fe()), e.key === "ArrowDown" && !i && !c && (e.preventDefault(), y.current = !0, m(!0)), e.key === "Escape" && i && (e.preventDefault(), R());
182
+ },
183
+ placeholder: i ? l : re,
184
+ disabled: c,
185
+ "data-form-control": "input",
186
+ className: ge(
187
+ "cursor-pointer",
188
+ de ? "text-destructive" : V ? "text-content-placeholder" : "",
189
+ Q
190
+ ),
191
+ suffix: /* @__PURE__ */ S("div", { className: "flex items-center gap-1", children: [
192
+ n && !c && /* @__PURE__ */ S(j, { children: [
193
+ /* @__PURE__ */ s(B, { asChild: !0, children: /* @__PURE__ */ s(
194
+ "button",
195
+ {
196
+ type: "button",
197
+ tabIndex: 0,
198
+ "aria-label": h("calendar.clear"),
199
+ onClick: (e) => {
200
+ e.stopPropagation(), O();
201
+ },
202
+ className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
203
+ children: /* @__PURE__ */ s(he, { className: "size-3 hover:text-content" })
204
+ }
205
+ ) }),
206
+ /* @__PURE__ */ s(K, { variant: "tertiary", side: "top", children: h("calendar.clear") })
207
+ ] }),
208
+ /* @__PURE__ */ S(j, { children: [
209
+ /* @__PURE__ */ s(B, { asChild: !0, children: /* @__PURE__ */ s("button", { type: "button", tabIndex: 0, "aria-label": h("datePicker.selectDate"), onClick: (e) => {
210
+ e.stopPropagation(), c || (i ? u() : m(!0));
211
+ }, onKeyDown: (e) => {
212
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (y.current = !0, i ? u() : m(!0)));
213
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ s(De, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
214
+ /* @__PURE__ */ s(K, { variant: "tertiary", side: "top", children: h("datePicker.selectDate") })
215
+ ] })
187
216
  ] }),
188
- /* @__PURE__ */ x(j, { children: [
189
- /* @__PURE__ */ o(B, { asChild: !0, children: /* @__PURE__ */ o("button", { type: "button", tabIndex: 0, "aria-label": h("datePicker.selectDate"), onClick: (e) => {
190
- e.stopPropagation(), l || (i ? p() : m(!0));
191
- }, onKeyDown: (e) => {
192
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), l || (y.current = !0, i ? p() : m(!0)));
193
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ o(le, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
194
- /* @__PURE__ */ o(K, { variant: "tertiary", side: "top", children: h("datePicker.selectDate") })
195
- ] })
196
- ] }),
197
- ...U
198
- }
199
- )
200
- }
201
- ) }),
202
- /* @__PURE__ */ o(
203
- Ce,
204
- {
205
- className: "w-auto p-0",
206
- align: "start",
207
- "aria-label": h("datePicker.selectDate"),
208
- onOpenAutoFocus: (e) => {
209
- y.current || e.preventDefault(), y.current = !1;
210
- },
211
- ..._,
212
- children: /* @__PURE__ */ o(
213
- Ie,
214
- {
215
- mode: "single",
216
- selected: P,
217
- footerFlashKey: Y,
218
- footerFlashTarget: Z,
219
- onSelect: F,
220
- month: $,
221
- onMonthChange: (e) => s(
222
- (t) => t ? { ...t, viewMonth: e } : null
223
- ),
224
- disabled: we(H, q),
225
- startMonth: G,
226
- endMonth: J,
227
- showFooter: a,
228
- onApply: O,
229
- onCancel: b,
230
- onClear: V,
231
- captionLayout: "dropdown",
232
- ...S !== void 0 ? { weekStartsOn: S } : {}
233
- }
234
- )
235
- }
236
- )
237
- ] });
217
+ ...te
218
+ }
219
+ )
220
+ }
221
+ ),
222
+ children: /* @__PURE__ */ s(
223
+ be,
224
+ {
225
+ mode: "single",
226
+ selected: P,
227
+ footerFlashKey: ie,
228
+ footerFlashTarget: oe,
229
+ onSelect: le,
230
+ month: ce,
231
+ onMonthChange: (e) => o(
232
+ (t) => t ? { ...t, viewMonth: e } : null
233
+ ),
234
+ disabled: Le(H, q),
235
+ startMonth: G,
236
+ endMonth: J,
237
+ showFooter: a,
238
+ onApply: L,
239
+ onCancel: R,
240
+ onClear: O,
241
+ captionLayout: "dropdown",
242
+ ...w !== void 0 ? { weekStartsOn: w } : {},
243
+ ...Oe({
244
+ calendarKind: U,
245
+ fiscalMode: W,
246
+ granularity: X,
247
+ fiscalMonthPattern: Y,
248
+ fiscalYearStartMonth: Z,
249
+ fiscalConfig: _,
250
+ showPresets: $,
251
+ comparison: F,
252
+ onComparisonChange: ee
253
+ })
254
+ }
255
+ )
256
+ }
257
+ );
238
258
  }
239
259
  );
240
260
  export {
241
- Ge as DatePicker
261
+ $e as DatePicker
242
262
  };
@@ -1,7 +1,20 @@
1
1
  import { InputProps } from '../input/input.types';
2
- import { MonthSelection, MonthRange, WeekSelection, WeekRange } from '../../data-display/calendar';
2
+ import { MonthRange, MonthSelection, QuarterRange, QuarterSelection, WeekRange, WeekSelection, YearRange, YearSelection, YoYComparison } from '../../data-display/calendar';
3
3
  import { DateRange } from 'react-day-picker';
4
- export interface DatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
4
+ import { FiscalCalendarConfig, Granularity } from '../../../lib/fiscal-calendar';
5
+ export interface FiscalPickerProps {
6
+ calendarKind?: "gregorian" | "fiscal";
7
+ fiscalMode?: "basic" | "advanced" | "custom";
8
+ granularity?: Granularity;
9
+ fiscalMonthPattern?: number[];
10
+ fiscalYearStartMonth?: number;
11
+ fiscalConfig?: FiscalCalendarConfig;
12
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
13
+ showPresets?: boolean;
14
+ comparison?: "prior-fy";
15
+ onComparisonChange?: (value: YoYComparison | undefined) => void;
16
+ }
17
+ export interface DatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
5
18
  value?: Date;
6
19
  onChange?: (date: Date | undefined) => void;
7
20
  format?: string;
@@ -14,7 +27,7 @@ export interface DatePickerProps extends Omit<InputProps, 'value' | 'onChange' |
14
27
  /** Which day the week starts on. 0 = Sunday, 1 = Monday, etc. */
15
28
  weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
16
29
  }
17
- export interface DateRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
30
+ export interface DateRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
18
31
  value?: DateRange;
19
32
  onChange?: (range: DateRange | undefined) => void;
20
33
  format?: string;
@@ -25,10 +38,13 @@ export interface DateRangePickerProps extends Omit<InputProps, 'value' | 'onChan
25
38
  startMonth?: Date;
26
39
  endMonth?: Date;
27
40
  showFooter?: boolean;
41
+ /** Date selection mode. Default: "range". */
42
+ mode?: "range" | "multi-range";
43
+ onRangesChange?: (ranges: DateRange[] | undefined) => void;
28
44
  /** Which day the week starts on. 0 = Sunday, 1 = Monday, etc. */
29
45
  weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
30
46
  }
31
- export interface MonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
47
+ export interface MonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
32
48
  value?: MonthSelection;
33
49
  onChange?: (month: MonthSelection | undefined) => void;
34
50
  placeholder?: string;
@@ -38,7 +54,7 @@ export interface MonthPickerProps extends Omit<InputProps, 'value' | 'onChange'
38
54
  endMonth?: Date;
39
55
  showFooter?: boolean;
40
56
  }
41
- export interface MonthRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
57
+ export interface MonthRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
42
58
  value?: MonthRange;
43
59
  onChange?: (range: MonthRange | undefined) => void;
44
60
  placeholder?: string;
@@ -49,7 +65,7 @@ export interface MonthRangePickerProps extends Omit<InputProps, 'value' | 'onCha
49
65
  showFooter?: boolean;
50
66
  displayFormat?: "MM/YYYY" | "YYYY/MM";
51
67
  }
52
- export interface WeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
68
+ export interface WeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
53
69
  value?: WeekSelection;
54
70
  onChange?: (week: WeekSelection | undefined) => void;
55
71
  format?: string;
@@ -59,19 +75,8 @@ export interface WeekPickerProps extends Omit<InputProps, 'value' | 'onChange' |
59
75
  startMonth?: Date;
60
76
  endMonth?: Date;
61
77
  showFooter?: boolean;
62
- /** Whether to use standard calendar weeks or fiscal weeks. Default: "calendar" */
63
- calendarType?: "calendar" | "fiscal";
64
- /** Only relevant when calendarType="fiscal". Default: "basic" */
65
- fiscalMode?: "basic" | "advanced" | "custom";
66
- /** What a click selects. "fiscalMonth" only applies with fiscalMode="advanced"|"custom". Default: "week" */
67
- selectionMode?: "week" | "fiscalMonth";
68
- /** Array of 12 week-counts per fiscal month, e.g. [4,4,5,4,4,5,4,4,5,4,4,5]. Required for fiscalMode="custom", optional for "advanced" (defaults to 4-4-5). */
69
- fiscalMonthPattern?: number[];
70
- /** 1-based month where the fiscal year starts. Default: 1 (January) */
71
- fiscalYearStartMonth?: number;
72
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
73
78
  }
74
- export interface WeekRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
79
+ export interface WeekRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
75
80
  value?: WeekRange;
76
81
  onChange?: (range: WeekRange | undefined) => void;
77
82
  format?: string;
@@ -81,19 +86,8 @@ export interface WeekRangePickerProps extends Omit<InputProps, 'value' | 'onChan
81
86
  startMonth?: Date;
82
87
  endMonth?: Date;
83
88
  showFooter?: boolean;
84
- /** Whether to use standard calendar weeks or fiscal weeks. Default: "calendar" */
85
- calendarType?: "calendar" | "fiscal";
86
- /** Only relevant when calendarType="fiscal". Default: "basic" */
87
- fiscalMode?: "basic" | "advanced" | "custom";
88
- /** What a click selects. "fiscalMonth" only applies with fiscalMode="advanced"|"custom". Default: "week" */
89
- selectionMode?: "week" | "fiscalMonth";
90
- /** Array of 12 week-counts per fiscal month, e.g. [4,4,5,4,4,5,4,4,5,4,4,5]. Required for fiscalMode="custom", optional for "advanced" (defaults to 4-4-5). */
91
- fiscalMonthPattern?: number[];
92
- /** 1-based month where the fiscal year starts. Default: 1 (January) */
93
- fiscalYearStartMonth?: number;
94
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
95
89
  }
96
- export interface MultiDatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
90
+ export interface MultiDatePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
97
91
  value?: Date[];
98
92
  onChange?: (dates: Date[] | undefined) => void;
99
93
  format?: string;
@@ -104,7 +98,7 @@ export interface MultiDatePickerProps extends Omit<InputProps, 'value' | 'onChan
104
98
  endMonth?: Date;
105
99
  showFooter?: boolean;
106
100
  }
107
- export interface MultiMonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
101
+ export interface MultiMonthPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
108
102
  value?: MonthSelection[];
109
103
  onChange?: (months: MonthSelection[] | undefined) => void;
110
104
  placeholder?: string;
@@ -114,7 +108,7 @@ export interface MultiMonthPickerProps extends Omit<InputProps, 'value' | 'onCha
114
108
  endMonth?: Date;
115
109
  showFooter?: boolean;
116
110
  }
117
- export interface MultiWeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'> {
111
+ export interface MultiWeekPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
118
112
  value?: WeekSelection[];
119
113
  onChange?: (weeks: WeekSelection[] | undefined) => void;
120
114
  format?: string;
@@ -124,15 +118,68 @@ export interface MultiWeekPickerProps extends Omit<InputProps, 'value' | 'onChan
124
118
  startMonth?: Date;
125
119
  endMonth?: Date;
126
120
  showFooter?: boolean;
127
- /** Whether to use standard calendar weeks or fiscal weeks. Default: "calendar" */
128
- calendarType?: "calendar" | "fiscal";
129
- /** Only relevant when calendarType="fiscal". Default: "basic" */
130
- fiscalMode?: "basic" | "advanced" | "custom";
131
- /** What a click selects. "fiscalMonth" selects an entire fiscal month block. Default: "week" */
132
- selectionMode?: "week" | "fiscalMonth";
133
- /** Array of 12 week-counts per fiscal month. Required for fiscalMode="custom", optional for "advanced". */
134
- fiscalMonthPattern?: number[];
135
- /** 1-based month where the fiscal year starts. Default: 1 (January) */
136
- fiscalYearStartMonth?: number;
137
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
121
+ }
122
+ export interface QuarterPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
123
+ value?: QuarterSelection;
124
+ onChange?: (quarter: QuarterSelection | undefined) => void;
125
+ placeholder?: string;
126
+ minDate?: Date;
127
+ maxDate?: Date;
128
+ startMonth?: Date;
129
+ endMonth?: Date;
130
+ showFooter?: boolean;
131
+ }
132
+ export interface QuarterRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
133
+ value?: QuarterRange;
134
+ onChange?: (range: QuarterRange | undefined) => void;
135
+ placeholder?: string;
136
+ minDate?: Date;
137
+ maxDate?: Date;
138
+ startMonth?: Date;
139
+ endMonth?: Date;
140
+ showFooter?: boolean;
141
+ }
142
+ export interface YearPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
143
+ value?: YearSelection;
144
+ onChange?: (year: YearSelection | undefined) => void;
145
+ placeholder?: string;
146
+ minDate?: Date;
147
+ maxDate?: Date;
148
+ startMonth?: Date;
149
+ endMonth?: Date;
150
+ showFooter?: boolean;
151
+ /** Show civil/FY start–end under year cells. Default false. */
152
+ showIntervalCaption?: boolean;
153
+ }
154
+ export interface YearRangePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
155
+ value?: YearRange;
156
+ onChange?: (range: YearRange | undefined) => void;
157
+ placeholder?: string;
158
+ minDate?: Date;
159
+ maxDate?: Date;
160
+ startMonth?: Date;
161
+ endMonth?: Date;
162
+ showFooter?: boolean;
163
+ showIntervalCaption?: boolean;
164
+ }
165
+ export interface MultiQuarterPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
166
+ value?: QuarterSelection[];
167
+ onChange?: (quarters: QuarterSelection[] | undefined) => void;
168
+ placeholder?: string;
169
+ minDate?: Date;
170
+ maxDate?: Date;
171
+ startMonth?: Date;
172
+ endMonth?: Date;
173
+ showFooter?: boolean;
174
+ }
175
+ export interface MultiYearPickerProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'suffix' | 'suffixClick'>, FiscalPickerProps {
176
+ value?: YearSelection[];
177
+ onChange?: (years: YearSelection[] | undefined) => void;
178
+ placeholder?: string;
179
+ minDate?: Date;
180
+ maxDate?: Date;
181
+ startMonth?: Date;
182
+ endMonth?: Date;
183
+ showFooter?: boolean;
184
+ showIntervalCaption?: boolean;
138
185
  }