impact-nova 2.5.10 → 2.5.12

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 (73) hide show
  1. package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +2 -0
  2. package/dist/components/data-display/calendar/calendar-apply-validation.js +64 -67
  3. package/dist/components/data-display/calendar/calendar-available-view.d.ts +27 -0
  4. package/dist/components/data-display/calendar/calendar-available-view.js +85 -0
  5. package/dist/components/data-display/calendar/calendar-config.js +1 -1
  6. package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +4 -2
  7. package/dist/components/data-display/calendar/calendar-day-picker-components.js +234 -164
  8. package/dist/components/data-display/calendar/calendar-day-picker-view.js +77 -76
  9. package/dist/components/data-display/calendar/calendar-fiscal-day-cell.d.ts +9 -0
  10. package/dist/components/data-display/calendar/calendar-fiscal-day-cell.js +45 -0
  11. package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +6 -0
  12. package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +34 -18
  13. package/dist/components/data-display/calendar/calendar-footer.js +21 -21
  14. package/dist/components/data-display/calendar/calendar-injected-week-row.d.ts +5 -0
  15. package/dist/components/data-display/calendar/calendar-injected-week-row.js +92 -0
  16. package/dist/components/data-display/calendar/calendar-leading-week.utils.d.ts +16 -0
  17. package/dist/components/data-display/calendar/calendar-leading-week.utils.js +51 -0
  18. package/dist/components/data-display/calendar/calendar-month-picker-panel.js +50 -49
  19. package/dist/components/data-display/calendar/calendar-month-utils.d.ts +5 -0
  20. package/dist/components/data-display/calendar/calendar-month-utils.js +85 -64
  21. package/dist/components/data-display/calendar/calendar-orphan-week.d.ts +23 -0
  22. package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +3 -1
  23. package/dist/components/data-display/calendar/calendar-padding-week.utils.js +7 -5
  24. package/dist/components/data-display/calendar/calendar-period-cell.js +45 -46
  25. package/dist/components/data-display/calendar/calendar-quarter-panes.js +33 -31
  26. package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +10 -0
  27. package/dist/components/data-display/calendar/calendar-selection-appearance.js +53 -39
  28. package/dist/components/data-display/calendar/calendar-selection.d.ts +25 -0
  29. package/dist/components/data-display/calendar/calendar-selection.js +52 -23
  30. package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +2 -1
  31. package/dist/components/data-display/calendar/calendar-week-number-cell.js +59 -45
  32. package/dist/components/data-display/calendar/calendar-week-utils.d.ts +13 -3
  33. package/dist/components/data-display/calendar/calendar-week-utils.js +59 -50
  34. package/dist/components/data-display/calendar/calendar-year-panes.d.ts +3 -0
  35. package/dist/components/data-display/calendar/calendar-year-panes.js +53 -49
  36. package/dist/components/data-display/calendar/calendar.js +146 -143
  37. package/dist/components/data-display/calendar/calendar.types.d.ts +5 -0
  38. package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +2 -1
  39. package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +79 -74
  40. package/dist/components/data-display/calendar/use-calendar-state.d.ts +3 -1
  41. package/dist/components/data-display/calendar/use-calendar-state.js +403 -325
  42. package/dist/components/forms/date-picker/date-picker.js +60 -58
  43. package/dist/components/forms/date-picker/date-picker.types.d.ts +5 -0
  44. package/dist/components/forms/date-picker/date-range-picker.js +66 -64
  45. package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +1 -0
  46. package/dist/components/forms/date-picker/fiscal-pass-through.js +3 -2
  47. package/dist/components/forms/date-picker/fiscal-picker-fixtures.d.ts +17 -0
  48. package/dist/components/forms/date-picker/month-picker.js +61 -59
  49. package/dist/components/forms/date-picker/month-range-picker.js +63 -61
  50. package/dist/components/forms/date-picker/multi-date-picker.js +51 -49
  51. package/dist/components/forms/date-picker/multi-month-picker.js +49 -47
  52. package/dist/components/forms/date-picker/multi-quarter-picker.js +51 -47
  53. package/dist/components/forms/date-picker/multi-week-picker.js +53 -51
  54. package/dist/components/forms/date-picker/multi-year-picker.js +53 -49
  55. package/dist/components/forms/date-picker/quarter-picker.js +51 -47
  56. package/dist/components/forms/date-picker/quarter-range-picker.js +50 -46
  57. package/dist/components/forms/date-picker/week-picker.js +68 -66
  58. package/dist/components/forms/date-picker/week-range-picker.js +82 -80
  59. package/dist/components/forms/date-picker/year-picker.js +52 -48
  60. package/dist/components/forms/date-picker/year-range-picker.js +52 -48
  61. package/dist/form-react/Fields/DateInputField.js +51 -50
  62. package/dist/form-react/Fields/DateRangeField.js +14 -13
  63. package/dist/form-react/Fields/MonthRangeField.js +29 -28
  64. package/dist/form-react/Fields/MultiMonthPickerField.js +13 -12
  65. package/dist/form-react/Fields/MultiWeekPickerField.js +35 -27
  66. package/dist/form-react/Fields/WeekRangePicker.js +33 -32
  67. package/dist/form-react/types/fields.types.d.ts +14 -0
  68. package/dist/impact-nova-components.css +13 -6
  69. package/dist/impact-nova.css +1 -1
  70. package/dist/lib/fiscal-calendar/week-selection.js +2 -2
  71. package/dist/llms/rules/installation.js +1 -1
  72. package/dist/llms/rules/requirements.js +1 -1
  73. package/package.json +1 -1
@@ -1,8 +1,10 @@
1
1
  import { DateRange } from 'react-day-picker';
2
+ import { Granularity } from '../../../lib/fiscal-calendar';
2
3
  import { MonthRange, MonthSelection, QuarterRange, QuarterSelection, WeekRange, WeekSelection, YearRange, YearSelection } from './calendar.types';
3
4
  export declare function isCalendarApplyDisabled(params: {
4
5
  showFooter: boolean;
5
6
  pickerType: "date" | "week" | "month" | "quarter" | "year";
7
+ granularity?: Granularity;
6
8
  disabled?: unknown;
7
9
  pendingSelection?: Date | Date[] | DateRange;
8
10
  pendingWeekSelection?: WeekSelection | WeekSelection[] | WeekRange;
@@ -1,96 +1,93 @@
1
- import { isMonthDisabled as S, isDateIntervalDisabled as b } from "./calendar-month-utils.js";
2
- function u(e) {
3
- return new Date(e.getFullYear(), e.getMonth(), e.getDate());
1
+ import { isMonthDisabled as S, isWeekSelectableInBounds as O, isDateIntervalDisabled as A } from "./calendar-month-utils.js";
2
+ function d(r) {
3
+ return new Date(r.getFullYear(), r.getMonth(), r.getDate());
4
4
  }
5
- function c(e, i, t) {
6
- const f = u(e);
5
+ function l(r, i, n) {
6
+ const a = d(r);
7
7
  if (i) {
8
- const o = u(i);
9
- if (f < o) return !0;
8
+ const f = d(i);
9
+ if (a < f) return !0;
10
10
  }
11
- if (t) {
12
- const o = u(t);
13
- if (f > o) return !0;
11
+ if (n) {
12
+ const f = d(n);
13
+ if (a > f) return !0;
14
14
  }
15
15
  return !1;
16
16
  }
17
- function O(e, i, t, f) {
18
- const o = u(e), g = u(i);
19
- return !!(t && g < u(t) || f && o > u(f));
17
+ function D(r, i, n) {
18
+ return !r || !i ? !1 : A(r, i, n);
20
19
  }
21
- function p(e, i, t) {
22
- return !e || !i ? !1 : b(e, i, t);
23
- }
24
- function d(e, i) {
25
- if (Array.isArray(e)) return e.some(i);
26
- if (typeof e == "object" && e !== null && "from" in e) {
27
- const t = e;
28
- return !!(t.from && i(t.from) || t.to && i(t.to));
20
+ function c(r, i) {
21
+ if (Array.isArray(r)) return r.some(i);
22
+ if (typeof r == "object" && r !== null && "from" in r) {
23
+ const n = r;
24
+ return !!(n.from && i(n.from) || n.to && i(n.to));
29
25
  }
30
- return i(e);
26
+ return i(r);
31
27
  }
32
- function v(e) {
28
+ function I(r) {
33
29
  const {
34
30
  showFooter: i,
35
- pickerType: t,
31
+ pickerType: n,
32
+ granularity: a,
36
33
  disabled: f,
37
- pendingSelection: o,
38
- pendingWeekSelection: g,
34
+ pendingSelection: g,
35
+ pendingWeekSelection: m,
39
36
  pendingMonthSelection: y,
40
- pendingQuarterSelection: D,
41
- pendingYearSelection: m
42
- } = e;
37
+ pendingQuarterSelection: p,
38
+ pendingYearSelection: b
39
+ } = r;
43
40
  if (!i) return !1;
44
- const a = f;
45
- if (!a || typeof a != "object" || !("before" in a) && !("after" in a)) return !1;
46
- const s = a.before, l = a.after;
47
- if (t === "month") {
48
- const r = y;
49
- return r ? d(
50
- r,
51
- (n) => S(n.year, n.month, f)
41
+ const o = f;
42
+ if (!o || typeof o != "object" || !("before" in o) && !("after" in o)) return !1;
43
+ const u = o.before, s = o.after;
44
+ if (n === "month") {
45
+ const e = y;
46
+ return e ? c(
47
+ e,
48
+ (t) => S(t.year, t.month, f)
52
49
  ) : !1;
53
50
  }
54
- if (t === "quarter") {
55
- const r = D;
56
- return r ? d(
57
- r,
58
- (n) => p(n.start, n.end, f)
51
+ if (n === "quarter") {
52
+ const e = p;
53
+ return e ? c(
54
+ e,
55
+ (t) => D(t.start, t.end, f)
59
56
  ) : !1;
60
57
  }
61
- if (t === "year") {
62
- const r = m;
63
- return r ? d(
64
- r,
65
- (n) => p(n.start, n.end, f)
58
+ if (n === "year") {
59
+ const e = b;
60
+ return e ? c(
61
+ e,
62
+ (t) => D(t.start, t.end, f)
66
63
  ) : !1;
67
64
  }
68
- if (t === "week") {
69
- const r = g;
70
- return r ? d(
71
- r,
72
- (n) => O(
73
- n.startDate,
74
- n.endDate,
75
- s,
76
- l
65
+ if (n === "week") {
66
+ const e = m;
67
+ return e ? c(
68
+ e,
69
+ (t) => !O(
70
+ t.startDate,
71
+ t.endDate,
72
+ f,
73
+ a
77
74
  )
78
75
  ) : !1;
79
76
  }
80
- if (t === "date") {
81
- const r = o;
82
- if (!r) return !1;
83
- if (Array.isArray(r))
84
- return r.some((n) => c(n, s, l));
85
- if (r instanceof Date)
86
- return c(r, s, l);
87
- if ("from" in r) {
88
- const n = r;
89
- if (n.from && c(n.from, s, l) || n.to && c(n.to, s, l)) return !0;
77
+ if (n === "date") {
78
+ const e = g;
79
+ if (!e) return !1;
80
+ if (Array.isArray(e))
81
+ return e.some((t) => l(t, u, s));
82
+ if (e instanceof Date)
83
+ return l(e, u, s);
84
+ if ("from" in e) {
85
+ const t = e;
86
+ if (t.from && l(t.from, u, s) || t.to && l(t.to, u, s)) return !0;
90
87
  }
91
88
  }
92
89
  return !1;
93
90
  }
94
91
  export {
95
- v as isCalendarApplyDisabled
92
+ I as isCalendarApplyDisabled
96
93
  };
@@ -0,0 +1,27 @@
1
+ export type AvailableViewPickerType = "date" | "week" | "month" | "quarter" | "year";
2
+ export declare const DEFAULT_YEAR_PAGE_SIZE = 12;
3
+ export interface ResolveAvailableViewMonthOptions {
4
+ seed: Date;
5
+ pickerType: AvailableViewPickerType;
6
+ minDate?: Date;
7
+ maxDate?: Date;
8
+ numberOfMonths?: number;
9
+ hasSelection?: boolean;
10
+ autoNavigateToAvailable?: boolean;
11
+ yearPageSize?: number;
12
+ }
13
+ export declare function startOfDayDate(date: Date): Date;
14
+ export declare function startOfMonthDate(date: Date): Date;
15
+ export declare function isSameCalendarMonth(left: Date, right: Date): boolean;
16
+ export declare function boundsFromDisabled(disabled?: unknown): {
17
+ minDate?: Date;
18
+ maxDate?: Date;
19
+ };
20
+ export declare function hasCalendarValue(value: unknown): boolean;
21
+ /** Clamp `from` into `[minDate, maxDate]`. O(1). */
22
+ export declare function firstAvailableDate(minDate?: Date, maxDate?: Date, from?: Date): Date;
23
+ /**
24
+ * When auto-navigate is on and there is no selection, land the visible pane on the
25
+ * first enabled period. Does not write a selected value.
26
+ */
27
+ export declare function resolveAvailableViewMonth(options: ResolveAvailableViewMonthOptions): Date;
@@ -0,0 +1,85 @@
1
+ const F = 12;
2
+ function u(t) {
3
+ return new Date(t.getFullYear(), t.getMonth(), t.getDate());
4
+ }
5
+ function f(t) {
6
+ return new Date(t.getFullYear(), t.getMonth(), 1);
7
+ }
8
+ function h(t, e) {
9
+ return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
10
+ }
11
+ function A(t) {
12
+ if (!t || typeof t != "object" || Array.isArray(t))
13
+ return {};
14
+ const e = t;
15
+ return {
16
+ ...e.before instanceof Date ? { minDate: e.before } : {},
17
+ ...e.after instanceof Date ? { maxDate: e.after } : {}
18
+ };
19
+ }
20
+ function Y(t) {
21
+ if (t == null) return !1;
22
+ if (Array.isArray(t)) return t.length > 0;
23
+ if (t instanceof Date) return !0;
24
+ if (typeof t == "object") {
25
+ if ("from" in t || "to" in t) {
26
+ const e = t;
27
+ return e.from != null || e.to != null;
28
+ }
29
+ return !0;
30
+ }
31
+ return !1;
32
+ }
33
+ function g(t, e, n = /* @__PURE__ */ new Date()) {
34
+ const r = u(n);
35
+ if (t) {
36
+ const a = u(t);
37
+ if (r < a) return a;
38
+ }
39
+ if (e) {
40
+ const a = u(e);
41
+ if (r > a) return a;
42
+ }
43
+ return r;
44
+ }
45
+ function D(t, e, n) {
46
+ const r = f(t), a = new Date(
47
+ t.getFullYear(),
48
+ t.getMonth() + e,
49
+ 0,
50
+ 23,
51
+ 59,
52
+ 59,
53
+ 999
54
+ ), i = u(n).getTime();
55
+ return i >= r.getTime() && i <= a.getTime();
56
+ }
57
+ function m(t, e, n) {
58
+ const r = Math.floor(t / n) * n;
59
+ return e >= r && e <= r + n - 1;
60
+ }
61
+ function w(t) {
62
+ const {
63
+ seed: e,
64
+ pickerType: n,
65
+ minDate: r,
66
+ maxDate: a,
67
+ numberOfMonths: i = 1,
68
+ hasSelection: l = !1,
69
+ autoNavigateToAvailable: c = !1,
70
+ yearPageSize: s = 12
71
+ } = t;
72
+ if (!c || l) return e;
73
+ const o = g(r, a, e);
74
+ return n === "date" || n === "week" ? D(e, i, o) ? e : f(o) : n === "month" || n === "quarter" ? e.getFullYear() === o.getFullYear() ? e : new Date(o.getFullYear(), 0, 1) : m(e.getFullYear(), o.getFullYear(), s) ? e : new Date(o.getFullYear(), 0, 1);
75
+ }
76
+ export {
77
+ F as DEFAULT_YEAR_PAGE_SIZE,
78
+ A as boundsFromDisabled,
79
+ g as firstAvailableDate,
80
+ Y as hasCalendarValue,
81
+ h as isSameCalendarMonth,
82
+ w as resolveAvailableViewMonth,
83
+ u as startOfDayDate,
84
+ f as startOfMonthDate
85
+ };
@@ -14,7 +14,7 @@ function g(t) {
14
14
  const { calendarKind: n, fiscalMode: r, fiscalMonthPattern: e } = t;
15
15
  if (n === "fiscal") {
16
16
  if (e) return e;
17
- if (r === "advanced") return a["4-4-5"];
17
+ if (r === "advanced") return a["4-5-4"];
18
18
  }
19
19
  }
20
20
  function s(t) {
@@ -1,13 +1,14 @@
1
1
  import { DayPicker } from 'react-day-picker';
2
2
  import { Button } from '../../primitives/button/button';
3
3
  import { Option } from '../../forms/select';
4
- import { FiscalCalendarConfig, FiscalPeriod, CalendarKind } from '../../../lib/fiscal-calendar';
4
+ import { FiscalCalendarConfig, FiscalPeriod, CalendarKind, Granularity } from '../../../lib/fiscal-calendar';
5
5
  import { WeekPickerInput } from './calendar-week-utils';
6
6
  import * as React from "react";
7
7
  export interface BuildCalendarDayPickerComponentsParams {
8
8
  buttonVariant: React.ComponentProps<typeof Button>["variant"];
9
9
  pickerType: "date" | "week" | "month";
10
10
  calendarKind: CalendarKind;
11
+ granularity?: Granularity;
11
12
  currentMonth: Date;
12
13
  monthsFull: string[];
13
14
  monthsShort: string[];
@@ -32,6 +33,7 @@ export interface BuildCalendarDayPickerComponentsParams {
32
33
  periodRowHover?: boolean;
33
34
  weekMode?: "single" | "multiple" | "range" | "multi-range";
34
35
  showPeriodBoundaries?: boolean;
36
+ disabled?: unknown;
35
37
  components?: React.ComponentProps<typeof DayPicker>["components"];
36
38
  }
37
- export declare function buildCalendarDayPickerComponents({ buttonVariant, pickerType, calendarKind, currentMonth, monthsFull, monthsShort, resolvedStartMonth, resolvedEndMonth, availableYears, fiscalPeriods, fiscalConfig, weekStartsOn, previousMonthLabel, nextMonthLabel, monthPlaceholder, yearPlaceholder, weekNumberLabel, weekNumberHeader, weekLabel, fiscalWeekNumberLabel, fiscalWeekAriaLabel, getCellMeta, onMonthChange, onWeekSelect, periodRowHover, weekMode, showPeriodBoundaries, components, }: BuildCalendarDayPickerComponentsParams): React.ComponentProps<typeof DayPicker>["components"];
39
+ export declare function buildCalendarDayPickerComponents({ buttonVariant, pickerType, calendarKind, granularity, currentMonth, monthsFull, monthsShort, resolvedStartMonth, resolvedEndMonth, availableYears, fiscalPeriods, fiscalConfig, weekStartsOn, previousMonthLabel, nextMonthLabel, monthPlaceholder, yearPlaceholder, weekNumberLabel, weekNumberHeader, weekLabel, fiscalWeekNumberLabel, fiscalWeekAriaLabel, getCellMeta, onMonthChange, onWeekSelect, periodRowHover, weekMode, showPeriodBoundaries, disabled, components, }: BuildCalendarDayPickerComponentsParams): React.ComponentProps<typeof DayPicker>["components"];