impact-nova 2.5.7 → 2.5.9

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 (159) 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 +196 -102
  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-fiscal-period-nav.d.ts +16 -0
  21. package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +41 -0
  22. package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
  23. package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
  24. package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
  25. package/dist/components/data-display/calendar/calendar-footer.js +88 -66
  26. package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
  27. package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
  28. package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
  29. package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
  30. package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
  31. package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
  32. package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
  33. package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
  34. package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
  35. package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
  36. package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
  37. package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
  38. package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
  39. package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
  40. package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
  41. package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
  42. package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
  43. package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
  44. package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
  45. package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
  46. package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
  47. package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
  48. package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
  49. package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
  50. package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
  51. package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
  52. package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
  53. package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
  54. package/dist/components/data-display/calendar/calendar-selection.js +31 -0
  55. package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
  56. package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
  57. package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
  58. package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
  59. package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
  60. package/dist/components/data-display/calendar/calendar-week-utils.js +49 -42
  61. package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
  62. package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
  63. package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
  64. package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
  65. package/dist/components/data-display/calendar/calendar.d.ts +1 -1
  66. package/dist/components/data-display/calendar/calendar.js +303 -181
  67. package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
  68. package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
  69. package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
  70. package/dist/components/data-display/calendar/index.d.ts +1 -1
  71. package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
  72. package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
  73. package/dist/components/data-display/calendar/use-calendar-state.d.ts +31 -11
  74. package/dist/components/data-display/calendar/use-calendar-state.js +370 -163
  75. package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
  76. package/dist/components/data-display/calendar/use-fiscal-calendar.js +25 -0
  77. package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
  78. package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
  79. package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
  80. package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
  81. package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
  82. package/dist/components/forms/date-picker/date-picker.js +187 -167
  83. package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
  84. package/dist/components/forms/date-picker/date-range-picker.js +273 -224
  85. package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
  86. package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
  87. package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
  88. package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
  89. package/dist/components/forms/date-picker/index.d.ts +12 -0
  90. package/dist/components/forms/date-picker/index.js +19 -7
  91. package/dist/components/forms/date-picker/month-picker.js +225 -182
  92. package/dist/components/forms/date-picker/month-range-picker.js +134 -110
  93. package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
  94. package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
  95. package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
  96. package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
  97. package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
  98. package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
  99. package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
  100. package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
  101. package/dist/components/forms/date-picker/quarter-picker.js +176 -0
  102. package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
  103. package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
  104. package/dist/components/forms/date-picker/week-picker.js +148 -137
  105. package/dist/components/forms/date-picker/week-range-picker.js +216 -205
  106. package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
  107. package/dist/components/forms/date-picker/year-picker.js +176 -0
  108. package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
  109. package/dist/components/forms/date-picker/year-range-picker.js +179 -0
  110. package/dist/components/forms/smart-input/smart-input.js +106 -85
  111. package/dist/components/forms/smart-input/smart-input.types.d.ts +5 -0
  112. package/dist/components/forms/textarea/textarea.js +29 -28
  113. package/dist/components/forms/textarea/textarea.types.d.ts +1 -0
  114. package/dist/form-react/Fields/DateInputField.js +63 -58
  115. package/dist/form-react/Fields/DateRangeField.js +42 -37
  116. package/dist/form-react/Fields/MonthRangeField.js +50 -45
  117. package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
  118. package/dist/form-react/Fields/TextField.js +25 -24
  119. package/dist/form-react/Fields/WeekRangePicker.js +44 -45
  120. package/dist/form-react/components/FieldRenderer.js +21 -23
  121. package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
  122. package/dist/form-react/registry/defaultFieldRegistrations.js +27 -36
  123. package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
  124. package/dist/form-react/registry/resolveFieldComponent.js +9 -133
  125. package/dist/form-react/types/fields.types.d.ts +25 -4
  126. package/dist/form-react/utils/date.utils.d.ts +1 -1
  127. package/dist/form-react/utils/date.utils.js +38 -38
  128. package/dist/i18n/defaultMessages.d.ts +19 -1
  129. package/dist/i18n/defaultMessages.js +37 -20
  130. package/dist/i18n/locales/de.js +18 -1
  131. package/dist/i18n/locales/es.js +18 -1
  132. package/dist/i18n/locales/hi.js +18 -1
  133. package/dist/i18n/locales/kn.js +18 -1
  134. package/dist/impact-nova-components.css +379 -3
  135. package/dist/impact-nova.css +1 -1
  136. package/dist/index.js +528 -516
  137. package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
  138. package/dist/lib/fiscal-calendar/build-year.js +173 -0
  139. package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
  140. package/dist/lib/fiscal-calendar/civil-date.js +94 -0
  141. package/dist/lib/fiscal-calendar/index.d.ts +10 -0
  142. package/dist/lib/fiscal-calendar/index.js +40 -0
  143. package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
  144. package/dist/lib/fiscal-calendar/lookup.js +70 -0
  145. package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
  146. package/dist/lib/fiscal-calendar/presets.js +99 -0
  147. package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
  148. package/dist/lib/fiscal-calendar/selection.js +32 -0
  149. package/dist/lib/fiscal-calendar/types.d.ts +145 -0
  150. package/dist/lib/fiscal-calendar/types.js +10 -0
  151. package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
  152. package/dist/lib/fiscal-calendar/week-selection.js +107 -0
  153. package/dist/llms/rules/best-practices.js +1 -1
  154. package/dist/llms/rules/installation.js +1 -1
  155. package/dist/llms/rules/real-world-patterns.js +1 -1
  156. package/dist/llms/rules/requirements.js +1 -1
  157. package/package.json +5 -1
  158. package/dist/lib/fiscal-calendar.d.ts +0 -62
  159. package/dist/lib/fiscal-calendar.js +0 -99
@@ -1,109 +1,153 @@
1
- import { jsx as Q } from "react/jsx-runtime";
2
- import "react";
3
- import { DayPicker as R } from "react-day-picker";
4
- import { cn as U } from "../../../lib/utils.js";
5
- import { useCalendarDayPickerConfig as W } from "./use-calendar-day-picker-config.js";
6
- function T({
7
- className: p,
8
- pickerType: t,
9
- mode: o,
10
- weekMode: a,
11
- calendarType: e,
12
- showOutsideDays: n,
13
- fixedWeeks: s,
14
- captionLayout: g,
15
- buttonVariant: f,
16
- weekStartsOn: i,
17
- formatters: w,
18
- classNames: b,
19
- components: D,
20
- selected: P,
1
+ import { jsx as C } from "react/jsx-runtime";
2
+ import * as S from "react";
3
+ import { DayPicker as lr } from "react-day-picker";
4
+ import { cn as mr } from "../../../lib/utils.js";
5
+ import { formatPeriodOption as pr } from "./calendar-fiscal-labels.js";
6
+ import { CalendarDayHoverProvider as dr } from "./calendar-day-hover.js";
7
+ import { previewModifierClassNames as ur } from "./calendar-day-picker-classnames.js";
8
+ import { isPreviewCap as p, dayKey as m, isPreviewMiddle as br } from "./calendar-selection.js";
9
+ import { useCalendarDayPickerConfig as gr } from "./use-calendar-day-picker-config.js";
10
+ function Sr({
11
+ className: j,
12
+ pickerType: s,
13
+ mode: n,
14
+ weekMode: c,
15
+ calendarKind: l,
16
+ granularity: k,
17
+ showOutsideDays: d,
18
+ fixedWeeks: u,
19
+ captionLayout: B,
20
+ buttonVariant: H,
21
+ weekStartsOn: b,
22
+ formatters: E,
23
+ classNames: F,
24
+ components: L,
25
+ selected: g,
21
26
  showFooter: v,
22
- pendingSelection: y,
23
- selectedDaysFromWeeks: h,
24
- currentMonth: m,
25
- monthsFull: k,
26
- resolvedStartMonth: c,
27
- resolvedEndMonth: l,
28
- availableYears: C,
29
- dateFnsLocale: N,
30
- intlLocale: S,
31
- weekRangeModifiers: _,
32
- onSelect: x,
33
- onMonthChange: u,
34
- onWeekSelect: L,
35
- previousMonthLabel: O,
36
- nextMonthLabel: j,
37
- monthPlaceholder: V,
38
- yearPlaceholder: q,
39
- weekNumberLabel: z,
40
- weekLabel: A,
41
- formatWeekNumber: B,
42
- disabled: F,
43
- ...G
27
+ pendingSelection: _,
28
+ selectedDaysFromWeeks: O,
29
+ currentMonth: P,
30
+ monthsFull: V,
31
+ monthsShort: Y,
32
+ weekNumberHeader: R,
33
+ resolvedStartMonth: w,
34
+ resolvedEndMonth: y,
35
+ availableYears: W,
36
+ fiscalPeriods: D,
37
+ fiscalConfig: $,
38
+ dateFnsLocale: q,
39
+ intlLocale: z,
40
+ weekRangeModifiers: A,
41
+ onSelect: G,
42
+ onMonthChange: h,
43
+ onWeekSelect: I,
44
+ previousMonthLabel: J,
45
+ nextMonthLabel: M,
46
+ monthPlaceholder: Q,
47
+ yearPlaceholder: U,
48
+ weekNumberLabel: x,
49
+ weekLabel: X,
50
+ fiscalWeekAriaLabel: Z,
51
+ getCellMeta: i,
52
+ formatWeekNumber: K,
53
+ disabled: T,
54
+ ...rr
44
55
  }) {
45
- const { dayPickerClassNames: H, dayPickerComponents: I } = W({
46
- buttonVariant: f,
47
- pickerType: t,
48
- calendarType: e,
49
- showOutsideDays: n,
50
- classNames: b,
51
- currentMonth: m,
52
- monthsFull: k,
53
- resolvedStartMonth: c,
54
- resolvedEndMonth: l,
55
- availableYears: C,
56
- weekStartsOn: i,
57
- previousMonthLabel: O,
58
- nextMonthLabel: j,
59
- monthPlaceholder: V,
60
- yearPlaceholder: q,
61
- weekNumberLabel: z,
62
- weekLabel: A,
63
- onMonthChange: u,
64
- onWeekSelect: L,
65
- components: D
66
- }), J = o === "range" || o === "multiple" || a === "range" || a === "multiple" ? 2 : 1;
67
- return /* @__PURE__ */ Q(
68
- R,
56
+ const { dayPickerClassNames: er, dayPickerComponents: tr } = gr({
57
+ buttonVariant: H,
58
+ pickerType: s,
59
+ calendarKind: l,
60
+ granularity: k,
61
+ showOutsideDays: d,
62
+ classNames: F,
63
+ currentMonth: P,
64
+ monthsFull: V,
65
+ monthsShort: Y,
66
+ weekNumberHeader: R,
67
+ resolvedStartMonth: w,
68
+ resolvedEndMonth: y,
69
+ availableYears: W,
70
+ fiscalPeriods: D,
71
+ fiscalConfig: $,
72
+ weekStartsOn: b,
73
+ previousMonthLabel: J,
74
+ nextMonthLabel: M,
75
+ monthPlaceholder: Q,
76
+ yearPlaceholder: U,
77
+ weekNumberLabel: x,
78
+ weekLabel: X,
79
+ fiscalWeekNumberLabel: x,
80
+ fiscalWeekAriaLabel: Z,
81
+ getCellMeta: i,
82
+ onMonthChange: h,
83
+ onWeekSelect: I,
84
+ weekMode: c,
85
+ components: L
86
+ }), or = n === "range" || n === "multiple" || n === "multi-range" || c === "range" || c === "multiple" || c === "multi-range" ? 2 : 1, ar = s === "week" || n === "multi-range" ? "multiple" : n, nr = u || l === "fiscal" || d, N = i ? {
87
+ fiscal_period_start: (r) => !!i(r)?.isPeriodStart,
88
+ fiscal_period_end: (r) => !!i(r)?.isPeriodEnd
89
+ } : void 0, [t, ir] = S.useState(), sr = S.useCallback((r) => {
90
+ ir((e) => !e && !r || e && r && e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate() ? e : r);
91
+ }, []), o = v ? _ : g, a = n === "range" && o && typeof o == "object" && "from" in o ? o.from : void 0, fr = n === "range" && o && typeof o == "object" && "to" in o ? o.to : void 0;
92
+ return /* @__PURE__ */ C(dr, { onDayHover: sr, children: /* @__PURE__ */ C(
93
+ lr,
69
94
  {
70
- mode: t === "week" ? "multiple" : o,
71
- selected: t === "week" ? h : v ? y : P,
95
+ mode: ar,
96
+ selected: s === "week" ? O : v ? _ : g,
72
97
  onSelect: (...r) => {
73
- const [K, d] = r;
74
- x(K, d instanceof Date ? d : void 0);
98
+ const [e, f] = r;
99
+ G(e, f instanceof Date ? f : void 0);
75
100
  },
76
- month: m,
77
- onMonthChange: u,
78
- fixedWeeks: s,
79
- showOutsideDays: s || e === "fiscal" || n,
80
- weekStartsOn: i,
81
- modifiers: t === "week" ? _ : void 0,
82
- locale: N,
83
- className: U(
101
+ month: P,
102
+ onMonthChange: h,
103
+ fixedWeeks: u,
104
+ showOutsideDays: nr,
105
+ weekStartsOn: b,
106
+ modifiers: s === "week" ? { ...A, ...N } : { ...N, ...s === "date" && !!(a && !fr && t) && a && t ? {
107
+ preview: (r) => br(r, a, t),
108
+ preview_cap: (r) => p(r, a, t),
109
+ preview_cap_start: (r) => p(r, a, t) && m(t) < m(a),
110
+ preview_cap_end: (r) => p(r, a, t) && m(t) > m(a)
111
+ } : void 0 },
112
+ modifiersClassNames: {
113
+ ...l === "fiscal" ? {
114
+ fiscal_period_start: "before:pointer-events-none before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:content-['('] before:text-sm before:font-normal before:text-brand",
115
+ fiscal_period_end: "after:pointer-events-none after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:content-[')'] after:text-sm after:font-normal after:text-brand"
116
+ } : void 0,
117
+ ...ur
118
+ },
119
+ locale: q,
120
+ className: mr(
84
121
  "bg-canvas group/calendar p-2 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
85
122
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
86
123
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
87
- p
124
+ j
88
125
  ),
89
- captionLayout: g,
126
+ captionLayout: B,
90
127
  navLayout: "around",
91
- startMonth: c,
92
- endMonth: l,
93
- disabled: F,
94
- numberOfMonths: J,
128
+ startMonth: w,
129
+ endMonth: y,
130
+ disabled: T,
131
+ numberOfMonths: or,
95
132
  showWeekNumber: !0,
96
133
  formatters: {
97
- formatMonthDropdown: (r) => r.toLocaleString(S, { month: "short" }),
98
- formatWeekNumber: B,
99
- ...w
134
+ formatMonthDropdown: (r) => {
135
+ if (l === "fiscal" && i) {
136
+ const e = i(r), f = D?.find((cr) => cr.period === e?.fiscalPeriod);
137
+ if (f) return pr(f);
138
+ if (e?.fiscalPeriod != null) return `P${e.fiscalPeriod}`;
139
+ }
140
+ return r.toLocaleString(z, { month: "short" });
141
+ },
142
+ formatWeekNumber: K,
143
+ ...E
100
144
  },
101
- classNames: H,
102
- components: I,
103
- ...G
145
+ classNames: er,
146
+ components: tr,
147
+ ...rr
104
148
  }
105
- );
149
+ ) });
106
150
  }
107
151
  export {
108
- T as CalendarDayPickerView
152
+ Sr as CalendarDayPickerView
109
153
  };
@@ -0,0 +1,38 @@
1
+ import { CivilDate, FiscalCalendarConfig, FyLabelStyle } from '../../../lib/fiscal-calendar';
2
+ import { QuarterSelection, YearSelection } from './calendar.types';
3
+ export declare function formatFiscalYearLabel(fy: number, style?: FyLabelStyle): string;
4
+ export declare function formatYearIntervalCaption(year: number, fiscalConfig?: FiscalCalendarConfig): string;
5
+ export declare function formatPeriodTooltip(period: {
6
+ period: number;
7
+ start: CivilDate;
8
+ end: CivilDate;
9
+ }): string;
10
+ export declare function formatPeriodCell(period: {
11
+ period: number;
12
+ start: CivilDate;
13
+ end: CivilDate;
14
+ }): {
15
+ label: string;
16
+ caption: string;
17
+ };
18
+ export declare function formatPeriodOption(period: {
19
+ period: number;
20
+ start: CivilDate;
21
+ end: CivilDate;
22
+ }): string;
23
+ export declare function formatQuarterCell(quarter: {
24
+ quarter: number;
25
+ start: CivilDate;
26
+ end: CivilDate;
27
+ }): {
28
+ label: string;
29
+ caption: string;
30
+ };
31
+ export declare function formatFiscalPeriodInput(period: number, fy: number): string;
32
+ export declare function formatFiscalQuarterInput(quarter: number, fy: number): string;
33
+ export declare function formatQuarterInput(quarter: Pick<QuarterSelection, "year" | "quarter" | "fy">): string;
34
+ export declare function formatYearInput(year: Pick<YearSelection, "year" | "fy">, fyLabel?: FyLabelStyle): string;
35
+ export declare function formatQuarterLabelsForYear(year: number, fiscalConfig?: FiscalCalendarConfig): Array<{
36
+ label: string;
37
+ caption?: string;
38
+ }>;
@@ -0,0 +1,90 @@
1
+ import { formatCivilRange as o, parseCivilDate as l } from "../../../lib/fiscal-calendar/civil-date.js";
2
+ import { formatFyLabel as c, buildFiscalYear as f } from "../../../lib/fiscal-calendar/build-year.js";
3
+ const a = [
4
+ "January",
5
+ "February",
6
+ "March",
7
+ "April",
8
+ "May",
9
+ "June",
10
+ "July",
11
+ "August",
12
+ "September",
13
+ "October",
14
+ "November",
15
+ "December"
16
+ ];
17
+ function u(r, t = "fy-short") {
18
+ return c(r, t);
19
+ }
20
+ function d(r, t) {
21
+ if (t)
22
+ try {
23
+ const n = f(t, r);
24
+ return `(${o(n.start, n.end)})`;
25
+ } catch {
26
+ }
27
+ return `(${o(`${r}-01-01`, `${r}-12-31`)})`;
28
+ }
29
+ function $(r, t) {
30
+ const n = l(r), e = l(t);
31
+ return n.y === e.y ? `${a[n.m - 1]} ${n.d} – ${a[e.m - 1]} ${e.d}` : `${a[n.m - 1]} ${n.d} ${n.y} – ${a[e.m - 1]} ${e.d} ${e.y}`;
32
+ }
33
+ function Q(r) {
34
+ return `Period ${r.period} (${$(r.start, r.end)})`;
35
+ }
36
+ function m(r) {
37
+ return {
38
+ label: `P${r.period}`,
39
+ caption: `(${o(r.start, r.end)})`
40
+ };
41
+ }
42
+ function F(r) {
43
+ const t = m(r);
44
+ return `${t.label} ${t.caption}`;
45
+ }
46
+ function s(r) {
47
+ return {
48
+ label: `Q${r.quarter}`,
49
+ caption: `(${o(r.start, r.end)})`
50
+ };
51
+ }
52
+ function L(r, t) {
53
+ return `P${r} ${u(t)}`;
54
+ }
55
+ function b(r, t) {
56
+ return `Q${r} ${u(t)}`;
57
+ }
58
+ function P(r) {
59
+ return r.fy != null ? b(r.quarter, r.fy) : `Q${r.quarter} ${r.year}`;
60
+ }
61
+ function I(r, t = "fy-long") {
62
+ return r.fy != null ? u(r.fy, t) : String(r.year);
63
+ }
64
+ const i = [
65
+ { label: "Q1" },
66
+ { label: "Q2" },
67
+ { label: "Q3" },
68
+ { label: "Q4" }
69
+ ];
70
+ function R(r, t) {
71
+ if (!t) return i;
72
+ try {
73
+ return f(t, r).quarters.map(s);
74
+ } catch {
75
+ return i;
76
+ }
77
+ }
78
+ export {
79
+ L as formatFiscalPeriodInput,
80
+ b as formatFiscalQuarterInput,
81
+ u as formatFiscalYearLabel,
82
+ m as formatPeriodCell,
83
+ F as formatPeriodOption,
84
+ Q as formatPeriodTooltip,
85
+ s as formatQuarterCell,
86
+ P as formatQuarterInput,
87
+ R as formatQuarterLabelsForYear,
88
+ I as formatYearInput,
89
+ d as formatYearIntervalCaption
90
+ };
@@ -0,0 +1,16 @@
1
+ import { FiscalPeriod } from '../../../lib/fiscal-calendar';
2
+ /** Local midnight on the 15th. FY can change on the 1st of a civil month. */
3
+ export declare function midMonthDate(month: Date): Date;
4
+ export declare function civilMonthAtOffset(month: Date, offset: number): Date;
5
+ /** Civil month (0-indexed) where `period` has the most days. */
6
+ export declare function dominantCivilMonthForPeriod(period: FiscalPeriod): {
7
+ year: number;
8
+ monthIndex: number;
9
+ };
10
+ /**
11
+ * Month the week/date grid should show after picking a fiscal period.
12
+ * Dual-month range pickers pass `isRightPanel` so the period lands on the right pane.
13
+ */
14
+ export declare function visibleMonthForPeriod(period: FiscalPeriod, isRightPanel: boolean): Date;
15
+ /** Period that occupies the most days of a civil month (caption selected value). */
16
+ export declare function periodForCivilMonth(periods: readonly FiscalPeriod[], year: number, monthIndex: number): FiscalPeriod | undefined;
@@ -0,0 +1,41 @@
1
+ import { setDate as m, startOfMonth as s, addMonths as h } from "date-fns";
2
+ import { parseCivilDate as d, toCivilDate as l, lastDayOfMonth as y, compareCivil as u, diffDays as v, minCivil as M, maxCivil as p } from "../../../lib/fiscal-calendar/civil-date.js";
3
+ function x(t) {
4
+ return m(s(t), 15);
5
+ }
6
+ function b(t, n) {
7
+ return s(h(t, n));
8
+ }
9
+ function c(t, n, o, e) {
10
+ const r = l(o, e + 1, 1), a = y(o, e + 1), i = p(t, r), f = M(n, a);
11
+ return u(i, f) > 0 ? 0 : v(f, i) + 1;
12
+ }
13
+ function C(t) {
14
+ const n = d(t.start);
15
+ let o = { year: n.y, monthIndex: n.m - 1, days: 0 };
16
+ const e = t.gregorianMonthSpan.length > 0 ? t.gregorianMonthSpan : [{ year: n.y, month: n.m - 1 }];
17
+ for (const { year: r, month: a } of e) {
18
+ const i = c(t.start, t.end, r, a);
19
+ i > o.days && (o = { year: r, monthIndex: a, days: i });
20
+ }
21
+ return { year: o.year, monthIndex: o.monthIndex };
22
+ }
23
+ function I(t, n) {
24
+ const { year: o, monthIndex: e } = C(t), r = s(new Date(o, e, 1));
25
+ return n ? h(r, -1) : r;
26
+ }
27
+ function O(t, n, o) {
28
+ let e, r = 0;
29
+ for (const a of t) {
30
+ const i = c(a.start, a.end, n, o);
31
+ i > r && (e = a, r = i);
32
+ }
33
+ return e;
34
+ }
35
+ export {
36
+ b as civilMonthAtOffset,
37
+ C as dominantCivilMonthForPeriod,
38
+ x as midMonthDate,
39
+ O as periodForCivilMonth,
40
+ I as visibleMonthForPeriod
41
+ };
@@ -1,14 +1,23 @@
1
1
  import { DateRange } from 'react-day-picker';
2
- import { FiscalMonthPattern } from '../../../lib/fiscal-calendar';
3
- import { MonthRange, MonthSelection, WeekRange, WeekSelection } from './calendar.types';
2
+ import { FiscalCalendarConfig, FiscalMonthPattern, CalendarKind, Granularity } from '../../../lib/fiscal-calendar';
3
+ import { MonthRange, MonthSelection, QuarterRange, QuarterSelection, WeekRange, WeekSelection, YearRange, YearSelection } from './calendar.types';
4
4
  export declare function formatDateRangeFooterSummary(selection: DateRange | undefined): string;
5
5
  export declare function formatWeekFooterSummary(params: {
6
6
  selection: WeekSelection | WeekSelection[] | WeekRange | undefined;
7
- calendarType: "calendar" | "fiscal";
8
- selectionMode: "week" | "fiscalMonth";
7
+ calendarKind: CalendarKind;
8
+ granularity?: Granularity;
9
9
  resolvedFiscalPattern?: FiscalMonthPattern;
10
+ fiscalConfig?: FiscalCalendarConfig;
10
11
  }): string;
11
12
  export declare function formatMonthFooterSummary(selection: MonthSelection | MonthSelection[] | MonthRange | undefined, labels: {
12
13
  single: string;
13
14
  plural: (count: number) => string;
14
15
  }): string;
16
+ export declare function formatQuarterFooterSummary(selection: QuarterSelection | QuarterSelection[] | QuarterRange | undefined, labels: {
17
+ single: string;
18
+ plural: (count: number) => string;
19
+ }): string;
20
+ export declare function formatYearFooterSummary(selection: YearSelection | YearSelection[] | YearRange | undefined, labels: {
21
+ single: string;
22
+ plural: (count: number) => string;
23
+ }): string;
@@ -1,69 +1,120 @@
1
- function F(n) {
2
- if (n?.from && n?.to) {
3
- const t = Math.abs(n.to.getTime() - n.from.getTime()), r = Math.ceil(t / (1e3 * 60 * 60 * 24)) + 1;
4
- return `${r} day${r !== 1 ? "s" : ""}`;
1
+ import { civilFromLocalDate as D } from "../../../lib/fiscal-calendar/civil-date.js";
2
+ import { buildFiscalYear as S } from "../../../lib/fiscal-calendar/build-year.js";
3
+ import { getCellMeta as $ } from "../../../lib/fiscal-calendar/lookup.js";
4
+ import { quarterRank as k } from "./calendar-quarter-utils.js";
5
+ import { yearKey as w } from "./calendar-year-utils.js";
6
+ function O(r) {
7
+ if (r?.from && r?.to) {
8
+ const n = Math.abs(r.to.getTime() - r.from.getTime()), t = Math.ceil(n / (1e3 * 60 * 60 * 24)) + 1;
9
+ return `${t} day${t !== 1 ? "s" : ""}`;
5
10
  }
6
11
  return "0 days";
7
12
  }
8
- function o(n) {
9
- return Date.UTC(n.getFullYear(), n.getMonth(), n.getDate());
13
+ function c(r) {
14
+ return Date.UTC(r.getFullYear(), r.getMonth(), r.getDate());
10
15
  }
11
- function y(n) {
12
- const t = Math.floor(n / 7), r = n % 7, a = [];
13
- return t > 0 && a.push(`${t} week${t !== 1 ? "s" : ""}`), (r > 0 || t === 0) && a.push(`${r} day${r !== 1 ? "s" : ""}`), a.join(" ");
16
+ function g(r) {
17
+ const n = Math.floor(r / 7), t = r % 7, o = [];
18
+ return n > 0 && o.push(`${n} week${n !== 1 ? "s" : ""}`), (t > 0 || n === 0) && o.push(`${t} day${t !== 1 ? "s" : ""}`), o.join(" ");
14
19
  }
15
- function C(n) {
16
- const { selection: t, calendarType: r, selectionMode: a, resolvedFiscalPattern: u } = n;
17
- if (!t) return "0 weeks";
18
- const c = r === "fiscal" && a === "fiscalMonth", d = r === "fiscal", f = c ? "fiscal month" : d ? "fiscal week" : "week", D = c ? "fiscal months" : d ? "fiscal weeks" : "weeks";
19
- if (Array.isArray(t)) {
20
- if (d || c) {
21
- const e = t.length;
22
- return `${e} ${e !== 1 ? D : f}`;
20
+ function A(r, n, t) {
21
+ if (!t)
22
+ return Math.max(1, Math.abs(n.weekOfMonth - r.weekOfMonth) + 1);
23
+ const o = $(t, D(r.startDate)), e = $(t, D(n.endDate));
24
+ if (o?.fy == null || e?.fy == null || o.fiscalPeriod == null || e.fiscalPeriod == null)
25
+ return Math.max(1, Math.abs(n.weekOfMonth - r.weekOfMonth) + 1);
26
+ let a = 0;
27
+ for (let i = o.fy; i <= e.fy; i++) {
28
+ const u = S(t, i);
29
+ for (const m of u.periods)
30
+ i === o.fy && m.period < o.fiscalPeriod || i === e.fy && m.period > e.fiscalPeriod || (a += 1);
31
+ }
32
+ return Math.max(1, a);
33
+ }
34
+ function j(r) {
35
+ const { selection: n, calendarKind: t, granularity: o, fiscalConfig: e } = r;
36
+ if (!n) return "0 weeks";
37
+ const a = t === "fiscal" && o === "period", i = t === "fiscal", u = a ? "fiscal month" : i ? "fiscal week" : "week", m = a ? "fiscal months" : i ? "fiscal weeks" : "weeks";
38
+ if (Array.isArray(n)) {
39
+ if (i || a) {
40
+ const f = n.length;
41
+ return `${f} ${f !== 1 ? m : u}`;
23
42
  }
24
43
  let s = 0;
25
- return t.forEach((e) => {
26
- const M = o(e.startDate), g = o(e.endDate);
27
- s += Math.round((g - M) / (1e3 * 60 * 60 * 24)) + 1;
28
- }), y(s);
44
+ return n.forEach((f) => {
45
+ const y = c(f.startDate), l = c(f.endDate);
46
+ s += Math.round((l - y) / (1e3 * 60 * 60 * 24)) + 1;
47
+ }), g(s);
29
48
  }
30
- if ("from" in t) {
31
- const { from: s, to: e } = t;
32
- if (c) {
33
- if (!e) return `1 ${f}`;
34
- const h = o(s.startDate), m = o(e.endDate), i = Math.round(Math.abs(m - h) / (1e3 * 60 * 60 * 24)) + 1, l = u ? u.reduce((k, w) => k + w, 0) / 12 : 4.33, $ = Math.max(1, Math.round(i / (l * 7)));
35
- return `${$} ${$ !== 1 ? D : f}`;
49
+ if ("from" in n) {
50
+ const { from: s, to: f } = n;
51
+ if (a) {
52
+ if (!f) return `1 ${u}`;
53
+ const h = A(s, f, e);
54
+ return `${h} ${h !== 1 ? m : u}`;
36
55
  }
37
- if (d) {
38
- if (!e) return `1 ${f}`;
39
- const h = o(s.startDate), m = o(e.endDate), i = Math.round((m - h) / (10080 * 60 * 1e3)), l = i > 0 ? i : 1;
40
- return `${l} ${l !== 1 ? D : f}`;
56
+ if (i) {
57
+ if (!f) return `1 ${u}`;
58
+ const h = c(s.startDate), M = c(f.endDate), d = Math.round((M - h) / (10080 * 60 * 1e3)), p = d > 0 ? d : 1;
59
+ return `${p} ${p !== 1 ? m : u}`;
41
60
  }
42
- if (!e) {
43
- const h = o(s.startDate), m = o(s.endDate), i = Math.round((m - h) / (1e3 * 60 * 60 * 24)) + 1;
44
- return y(i);
61
+ if (!f) {
62
+ const h = c(s.startDate), M = c(s.endDate), d = Math.round((M - h) / (1e3 * 60 * 60 * 24)) + 1;
63
+ return g(d);
45
64
  }
46
- const M = o(s.startDate), g = o(e.endDate), T = Math.round(Math.abs(g - M) / (1e3 * 60 * 60 * 24)) + 1;
47
- return y(T);
65
+ const y = c(s.startDate), l = c(f.endDate), T = Math.round(Math.abs(l - y) / (1e3 * 60 * 60 * 24)) + 1;
66
+ return g(T);
48
67
  }
49
- return `1 ${f}`;
68
+ return `1 ${u}`;
50
69
  }
51
- function U(n, t) {
52
- if (!n) return "0 months";
53
- if (Array.isArray(n)) {
54
- const r = n.length;
55
- return r === 1 ? t.single : t.plural(r);
70
+ function K(r, n) {
71
+ if (!r) return "0 months";
72
+ if (Array.isArray(r)) {
73
+ const t = r.length;
74
+ return t === 1 ? n.single : n.plural(t);
56
75
  }
57
- if ("from" in n) {
58
- const r = n;
59
- if (!r.from || !r.to) return t.single;
60
- const a = new Date(r.from.year, r.from.month, 1), u = new Date(r.to.year, r.to.month, 1), c = (u.getFullYear() - a.getFullYear()) * 12 + (u.getMonth() - a.getMonth()) + 1;
61
- return c === 1 ? t.single : t.plural(c);
76
+ if ("from" in r) {
77
+ const t = r;
78
+ if (!t.from || !t.to) return n.single;
79
+ const o = new Date(t.from.year, t.from.month, 1), e = new Date(t.to.year, t.to.month, 1), a = (e.getFullYear() - o.getFullYear()) * 12 + (e.getMonth() - o.getMonth()) + 1;
80
+ return a === 1 ? n.single : n.plural(a);
81
+ }
82
+ return n.single;
83
+ }
84
+ function F(r, n, t, o) {
85
+ if (!r) return o;
86
+ if (Array.isArray(r)) {
87
+ const e = r.length;
88
+ return e === 1 ? t.single : t.plural(e);
89
+ }
90
+ if (typeof r == "object" && "from" in r) {
91
+ const e = r;
92
+ if (!e.from || !e.to) return t.single;
93
+ const a = n(e.from, e.to);
94
+ return a === 1 ? t.single : t.plural(a);
62
95
  }
63
96
  return t.single;
64
97
  }
98
+ function R(r, n) {
99
+ return F(
100
+ r,
101
+ (t, o) => Math.abs(k(o) - k(t)) + 1,
102
+ n,
103
+ n.plural(0)
104
+ );
105
+ }
106
+ function q(r, n) {
107
+ return F(
108
+ r,
109
+ (t, o) => Math.abs(w(o) - w(t)) + 1,
110
+ n,
111
+ n.plural(0)
112
+ );
113
+ }
65
114
  export {
66
- F as formatDateRangeFooterSummary,
67
- U as formatMonthFooterSummary,
68
- C as formatWeekFooterSummary
115
+ O as formatDateRangeFooterSummary,
116
+ K as formatMonthFooterSummary,
117
+ R as formatQuarterFooterSummary,
118
+ j as formatWeekFooterSummary,
119
+ q as formatYearFooterSummary
69
120
  };