impact-nova 2.5.6 → 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.
- package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +2 -2
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +82 -51
- package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
- package/dist/components/data-display/calendar/calendar-config.js +31 -20
- package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
- package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
- package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +199 -98
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +12 -4
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +139 -92
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
- package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
- package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
- package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
- package/dist/components/data-display/calendar/calendar-footer.js +88 -66
- package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
- package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
- package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
- package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
- package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
- package/dist/components/data-display/calendar/calendar-selection.js +31 -0
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
- package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
- package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +50 -42
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
- package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
- package/dist/components/data-display/calendar/calendar.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar.js +303 -181
- package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
- package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
- package/dist/components/data-display/calendar/index.d.ts +1 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +32 -12
- package/dist/components/data-display/calendar/use-calendar-state.js +371 -164
- package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +24 -0
- package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
- package/dist/components/flows/guidance/guidance-error-boundary.js +22 -14
- package/dist/components/flows/guidance/guidance-layer.js +34 -32
- package/dist/components/flows/guidance/help-center/assets/whats-new-guide-icon.svg.js +4 -0
- package/dist/components/flows/guidance/help-center/filter-help-center-guides.js +10 -7
- package/dist/components/flows/guidance/help-center/guide-catalog-section.d.ts +7 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-section.js +24 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-utils.d.ts +3 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-utils.js +19 -0
- package/dist/components/flows/guidance/help-center/guide-catalog.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/guide-catalog.js +89 -79
- package/dist/components/flows/guidance/help-center/help-center-guide-labels.d.ts +6 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-labels.js +33 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-row.d.ts +12 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-row.js +57 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.d.ts +9 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.js +114 -0
- package/dist/components/flows/guidance/help-center/help-center-header.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/help-center-header.js +20 -16
- package/dist/components/flows/guidance/help-center/help-center.constants.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/help-center.constants.js +1 -1
- package/dist/components/flows/guidance/help-center/help-center.d.ts +3 -1
- package/dist/components/flows/guidance/help-center/help-center.js +74 -51
- package/dist/components/flows/guidance/help-center/help-center.types.d.ts +9 -1
- package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.d.ts +4 -0
- package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.js +18 -0
- package/dist/components/flows/guidance/help-center.d.ts +4 -2
- package/dist/components/flows/guidance/help-center.js +23 -14
- package/dist/components/flows/guidance/hooks/useGuidanceOverlayGeometry.js +19 -17
- package/dist/components/flows/guidance/index.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/announcement-renderer.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/announcement-renderer.js +20 -12
- package/dist/components/flows/guidance/renderers/guidance-card-shared.d.ts +9 -11
- package/dist/components/flows/guidance/renderers/guidance-card-shared.js +124 -177
- package/dist/components/flows/guidance/renderers/guidance-renderer-shared.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/guidance-renderer-shared.js +57 -72
- package/dist/components/flows/guidance/renderers/guidance-tour-overlay.js +23 -23
- package/dist/components/flows/wizard/wizard.js +41 -38
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
- package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
- package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
- package/dist/components/forms/date-picker/date-picker.js +187 -167
- package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
- package/dist/components/forms/date-picker/date-range-picker.js +273 -224
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
- package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
- package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
- package/dist/components/forms/date-picker/index.d.ts +12 -0
- package/dist/components/forms/date-picker/index.js +19 -7
- package/dist/components/forms/date-picker/month-picker.js +225 -182
- package/dist/components/forms/date-picker/month-range-picker.js +134 -110
- package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
- package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
- package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
- package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
- package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
- package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-picker.js +176 -0
- package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
- package/dist/components/forms/date-picker/week-picker.js +148 -137
- package/dist/components/forms/date-picker/week-range-picker.js +216 -205
- package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-picker.js +176 -0
- package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-range-picker.js +179 -0
- package/dist/components/layout/horizontal-scroller/horizontal-scroller.js +35 -53
- package/dist/form-react/Fields/DateInputField.js +63 -58
- package/dist/form-react/Fields/DateRangeField.js +42 -37
- package/dist/form-react/Fields/MonthRangeField.js +50 -45
- package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
- package/dist/form-react/Fields/WeekRangePicker.js +44 -45
- package/dist/form-react/components/FieldRenderer.js +21 -23
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +11 -12
- package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
- package/dist/form-react/registry/resolveFieldComponent.js +9 -133
- package/dist/form-react/types/fields.types.d.ts +22 -7
- package/dist/form-react/utils/date.utils.d.ts +3 -1
- package/dist/form-react/utils/date.utils.js +82 -53
- package/dist/i18n/defaultMessages.d.ts +29 -1
- package/dist/i18n/defaultMessages.js +54 -27
- package/dist/i18n/locales/de.js +31 -4
- package/dist/i18n/locales/es.js +31 -4
- package/dist/i18n/locales/hi.js +31 -4
- package/dist/i18n/locales/kn.js +31 -4
- package/dist/impact-nova-components.css +379 -3
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +528 -516
- package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
- package/dist/lib/fiscal-calendar/build-year.js +173 -0
- package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
- package/dist/lib/fiscal-calendar/civil-date.js +94 -0
- package/dist/lib/fiscal-calendar/index.d.ts +10 -0
- package/dist/lib/fiscal-calendar/index.js +40 -0
- package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
- package/dist/lib/fiscal-calendar/lookup.js +70 -0
- package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
- package/dist/lib/fiscal-calendar/presets.js +99 -0
- package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
- package/dist/lib/fiscal-calendar/selection.js +32 -0
- package/dist/lib/fiscal-calendar/types.d.ts +145 -0
- package/dist/lib/fiscal-calendar/types.js +10 -0
- package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
- package/dist/lib/fiscal-calendar/week-selection.js +107 -0
- package/dist/lib/guidance/engine/guidance-engine.d.ts +7 -5
- package/dist/lib/guidance/engine/guidance-engine.js +115 -47
- package/dist/lib/guidance/triggers/trigger-registry.js +6 -6
- package/dist/lib/guidance/types/guidance.types.d.ts +11 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function n(a) {
|
|
2
|
+
return {
|
|
3
|
+
calendarKind: a.calendarKind,
|
|
4
|
+
fiscalMode: a.fiscalMode,
|
|
5
|
+
granularity: a.granularity,
|
|
6
|
+
fiscalMonthPattern: a.fiscalMonthPattern,
|
|
7
|
+
fiscalYearStartMonth: a.fiscalYearStartMonth,
|
|
8
|
+
fiscalConfig: a.fiscalConfig,
|
|
9
|
+
...a.weekStartsOn !== void 0 ? { weekStartsOn: a.weekStartsOn } : {},
|
|
10
|
+
showPresets: a.showPresets,
|
|
11
|
+
comparison: a.comparison,
|
|
12
|
+
onComparisonChange: a.onComparisonChange
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
n as fiscalCalendarPassThrough
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FiscalCalendarConfig } from '../../../lib/fiscal-calendar';
|
|
2
|
+
import { MonthSelection } from '../../data-display/calendar';
|
|
3
|
+
export declare function formatFiscalPeriod(month: MonthSelection): string | undefined;
|
|
4
|
+
export declare function looksLikeFiscalPeriodInput(raw: string): boolean;
|
|
5
|
+
export declare function parseFiscalPeriodInput(raw: string): {
|
|
6
|
+
period: number;
|
|
7
|
+
fy: number;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function monthSelectionFromFiscalInput(raw: string, fiscalConfig?: FiscalCalendarConfig): MonthSelection | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { parseCivilDate as d, localDateFromCivil as l } from "../../../lib/fiscal-calendar/civil-date.js";
|
|
2
|
+
import { buildFiscalYear as a } from "../../../lib/fiscal-calendar/build-year.js";
|
|
3
|
+
import { formatFiscalPeriodInput as f } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
4
|
+
const p = /^P(\d{1,2})\s+FY(\d{2}|\d{4})$/i;
|
|
5
|
+
function F(t) {
|
|
6
|
+
if (!(t.period == null || t.fy == null))
|
|
7
|
+
return f(t.period, t.fy);
|
|
8
|
+
}
|
|
9
|
+
function P(t) {
|
|
10
|
+
return /^P/i.test(t.trim());
|
|
11
|
+
}
|
|
12
|
+
function s(t) {
|
|
13
|
+
const e = t.trim().match(p);
|
|
14
|
+
if (!e) return null;
|
|
15
|
+
const r = Number(e[1]);
|
|
16
|
+
let o = Number(e[2]);
|
|
17
|
+
return o < 100 && (o += 2e3), r < 1 || r > 13 ? null : { period: r, fy: o };
|
|
18
|
+
}
|
|
19
|
+
function I(t, e) {
|
|
20
|
+
const r = s(t);
|
|
21
|
+
if (!r) return null;
|
|
22
|
+
if (!e)
|
|
23
|
+
return {
|
|
24
|
+
year: r.fy,
|
|
25
|
+
month: Math.min(11, r.period - 1),
|
|
26
|
+
fy: r.fy,
|
|
27
|
+
period: r.period
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
const i = a(e, r.fy).periods.find((u) => u.period === r.period);
|
|
31
|
+
if (!i) return null;
|
|
32
|
+
const n = d(i.start);
|
|
33
|
+
return {
|
|
34
|
+
year: n.y,
|
|
35
|
+
month: n.m - 1,
|
|
36
|
+
fy: i.fy,
|
|
37
|
+
period: i.period,
|
|
38
|
+
start: l(i.start),
|
|
39
|
+
end: l(i.end)
|
|
40
|
+
};
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
F as formatFiscalPeriod,
|
|
47
|
+
P as looksLikeFiscalPeriodInput,
|
|
48
|
+
I as monthSelectionFromFiscalInput,
|
|
49
|
+
s as parseFiscalPeriodInput
|
|
50
|
+
};
|
|
@@ -16,3 +16,15 @@ export { MultiMonthPicker } from './multi-month-picker';
|
|
|
16
16
|
export type { MultiMonthPickerProps } from './date-picker.types';
|
|
17
17
|
export { MultiWeekPicker } from './multi-week-picker';
|
|
18
18
|
export type { MultiWeekPickerProps } from './date-picker.types';
|
|
19
|
+
export { QuarterPicker } from './quarter-picker';
|
|
20
|
+
export type { QuarterPickerProps } from './date-picker.types';
|
|
21
|
+
export { QuarterRangePicker } from './quarter-range-picker';
|
|
22
|
+
export type { QuarterRangePickerProps } from './date-picker.types';
|
|
23
|
+
export { MultiQuarterPicker } from './multi-quarter-picker';
|
|
24
|
+
export type { MultiQuarterPickerProps } from './date-picker.types';
|
|
25
|
+
export { YearPicker } from './year-picker';
|
|
26
|
+
export type { YearPickerProps } from './date-picker.types';
|
|
27
|
+
export { YearRangePicker } from './year-range-picker';
|
|
28
|
+
export type { YearRangePickerProps } from './date-picker.types';
|
|
29
|
+
export { MultiYearPicker } from './multi-year-picker';
|
|
30
|
+
export type { MultiYearPickerProps } from './date-picker.types';
|
|
@@ -4,17 +4,29 @@ import { MonthRangePicker as c } from "./month-range-picker.js";
|
|
|
4
4
|
import { DateRangePicker as m } from "./date-range-picker.js";
|
|
5
5
|
import { WeekPicker as x } from "./week-picker.js";
|
|
6
6
|
import { WeekRangePicker as a } from "./week-range-picker.js";
|
|
7
|
-
import { MultiDatePicker as
|
|
8
|
-
import { MultiMonthPicker as
|
|
9
|
-
import { MultiWeekPicker as
|
|
7
|
+
import { MultiDatePicker as u } from "./multi-date-picker.js";
|
|
8
|
+
import { MultiMonthPicker as g } from "./multi-month-picker.js";
|
|
9
|
+
import { MultiWeekPicker as R } from "./multi-week-picker.js";
|
|
10
|
+
import { QuarterPicker as D } from "./quarter-picker.js";
|
|
11
|
+
import { QuarterRangePicker as W } from "./quarter-range-picker.js";
|
|
12
|
+
import { MultiQuarterPicker as b } from "./multi-quarter-picker.js";
|
|
13
|
+
import { YearPicker as j } from "./year-picker.js";
|
|
14
|
+
import { YearRangePicker as s } from "./year-range-picker.js";
|
|
15
|
+
import { MultiYearPicker as w } from "./multi-year-picker.js";
|
|
10
16
|
export {
|
|
11
17
|
o as DatePicker,
|
|
12
18
|
m as DateRangePicker,
|
|
13
19
|
i as MonthPicker,
|
|
14
20
|
c as MonthRangePicker,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
u as MultiDatePicker,
|
|
22
|
+
g as MultiMonthPicker,
|
|
23
|
+
b as MultiQuarterPicker,
|
|
24
|
+
R as MultiWeekPicker,
|
|
25
|
+
w as MultiYearPicker,
|
|
26
|
+
D as QuarterPicker,
|
|
27
|
+
W as QuarterRangePicker,
|
|
18
28
|
x as WeekPicker,
|
|
19
|
-
a as WeekRangePicker
|
|
29
|
+
a as WeekRangePicker,
|
|
30
|
+
j as YearPicker,
|
|
31
|
+
s as YearRangePicker
|
|
20
32
|
};
|
|
@@ -1,224 +1,267 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as w } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { usePickerDismissActionsRef as
|
|
6
|
-
import { Input as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
3
|
+
import { Cross as ye, CalendarMonth as ge } from "impact-nova-icons";
|
|
4
|
+
import { cn as ke } from "../../../lib/utils.js";
|
|
5
|
+
import { usePickerDismissActionsRef as De, usePickerFooterDismissNudge as Me, isDateInputInvalid as K, resolveSingleValueDismissFlash as Pe, compareMonthSelection as Ie, handlePickerSurfacePointerDown as Se, maskDateInput as Ce, parseDateInput as xe, resolveDateInputOnEnter as Re, resolveDateInputOnBlur as be } from "./date-input-behavior.js";
|
|
6
|
+
import { Input as Fe } from "../input/input.js";
|
|
7
|
+
import { Calendar as we } from "../../data-display/calendar/calendar.js";
|
|
8
|
+
import { Tooltip as $, TooltipTrigger as q, TooltipContent as G } from "../../feedback/tooltip/tooltip.js";
|
|
9
|
+
import { useImpactNovaI18n as Ne } from "../../../i18n/use-impact-nova-i18n.js";
|
|
10
|
+
import { coerceSingleMonthApply as Te, coerceSingleMonth as Ae } from "./calendar-selection-adapters.js";
|
|
11
|
+
import { buildDateBoundsMatcher as Ee } from "../../../lib/date-bounds-matcher.js";
|
|
12
|
+
import { fiscalCalendarPassThrough as Oe } from "./fiscal-pass-through.js";
|
|
13
|
+
import { DatePickerShell as Ve } from "./date-picker-shell.js";
|
|
14
|
+
import { looksLikeFiscalPeriodInput as N, monthSelectionFromFiscalInput as T, formatFiscalPeriod as Be } from "./fiscal-period-format.js";
|
|
15
|
+
import { resolveFiscalConfig as je } from "../../data-display/calendar/calendar-config.js";
|
|
16
|
+
const y = (t) => {
|
|
17
|
+
const s = Be(t);
|
|
18
|
+
return s || `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`;
|
|
19
|
+
}, Le = o.forwardRef(
|
|
14
20
|
({
|
|
15
21
|
value: t,
|
|
16
|
-
onChange:
|
|
17
|
-
placeholder:
|
|
18
|
-
minDate:
|
|
19
|
-
maxDate:
|
|
20
|
-
startMonth:
|
|
21
|
-
endMonth:
|
|
22
|
-
showFooter:
|
|
23
|
-
disabled:
|
|
24
|
-
className:
|
|
25
|
-
onBlur:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
onChange: s,
|
|
23
|
+
placeholder: A,
|
|
24
|
+
minDate: J,
|
|
25
|
+
maxDate: Q,
|
|
26
|
+
startMonth: U,
|
|
27
|
+
endMonth: W,
|
|
28
|
+
showFooter: p = !0,
|
|
29
|
+
disabled: f,
|
|
30
|
+
className: X,
|
|
31
|
+
onBlur: Z,
|
|
32
|
+
calendarKind: S,
|
|
33
|
+
fiscalMode: E,
|
|
34
|
+
granularity: _,
|
|
35
|
+
fiscalMonthPattern: O,
|
|
36
|
+
fiscalYearStartMonth: V,
|
|
37
|
+
fiscalConfig: B,
|
|
38
|
+
showPresets: ee,
|
|
39
|
+
...te
|
|
40
|
+
}, ne) => {
|
|
41
|
+
const { t: d } = Ne(), re = A ?? d("datePicker.selectMonth"), C = o.useRef(null), j = o.useRef(null);
|
|
42
|
+
o.useImperativeHandle(ne, () => C.current);
|
|
43
|
+
const [r, L] = o.useState(!1), u = o.useCallback(() => {
|
|
44
|
+
L(!1);
|
|
45
|
+
}, []), h = (e) => {
|
|
46
|
+
if (!f) {
|
|
34
47
|
if (e) {
|
|
35
|
-
|
|
48
|
+
L(!0);
|
|
36
49
|
return;
|
|
37
50
|
}
|
|
38
|
-
|
|
51
|
+
u();
|
|
39
52
|
}
|
|
40
|
-
},
|
|
53
|
+
}, Y = De(), { footerFlashKey: oe, footerFlashTarget: ie, popoverHandlers: se } = Me(p, r, Y, j), [M, i] = o.useState(t), [c, a] = o.useState(t ? y(t) : ""), [ce, P] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
|
|
41
54
|
o.useEffect(() => {
|
|
42
|
-
r || (
|
|
55
|
+
r || (a(t ? y(t) : ""), i(t));
|
|
43
56
|
}, [r, t]), o.useEffect(() => {
|
|
44
|
-
r && (
|
|
57
|
+
r && (i(t), P(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), a(t ? y(t) : ""));
|
|
45
58
|
}, [r, t]);
|
|
46
|
-
const
|
|
47
|
-
const n =
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
const n =
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const ae = (e) => {
|
|
60
|
+
const n = Ae(e);
|
|
61
|
+
i(n), n && a(y(n)), p || (s?.(n), u());
|
|
62
|
+
}, v = (e) => {
|
|
63
|
+
const n = Te(e, M);
|
|
64
|
+
s?.(n), u();
|
|
65
|
+
}, x = () => {
|
|
66
|
+
i(t), a(t ? y(t) : ""), u();
|
|
67
|
+
}, z = () => {
|
|
68
|
+
i(void 0), a(""), s?.(void 0), p || u();
|
|
69
|
+
}, le = Oe({
|
|
70
|
+
calendarKind: S,
|
|
71
|
+
fiscalMode: E,
|
|
72
|
+
granularity: _,
|
|
73
|
+
fiscalMonthPattern: O,
|
|
74
|
+
fiscalYearStartMonth: V,
|
|
75
|
+
fiscalConfig: B,
|
|
76
|
+
showPresets: ee
|
|
77
|
+
}), R = je({
|
|
78
|
+
fiscalConfig: B,
|
|
79
|
+
calendarKind: S,
|
|
80
|
+
fiscalMode: E,
|
|
81
|
+
fiscalMonthPattern: O,
|
|
82
|
+
fiscalYearStartMonth: V
|
|
83
|
+
}), b = S === "fiscal", g = "MM/yyyy", k = t ? y(t) : "", D = o.useRef(!1), pe = (e) => {
|
|
84
|
+
const n = e.target.value;
|
|
85
|
+
if (b && N(n)) {
|
|
86
|
+
a(n);
|
|
87
|
+
const m = T(n, R);
|
|
88
|
+
m && (i(m), P(new Date(m.year, m.month, 1)), p || s?.(m));
|
|
60
89
|
return;
|
|
61
90
|
}
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
91
|
+
const F = Ce(n, g, c);
|
|
92
|
+
if (a(F), F === "") {
|
|
93
|
+
i(void 0), p || s?.(void 0);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const { parsed: I, isValid: he } = xe(F, g);
|
|
97
|
+
if (he && I) {
|
|
98
|
+
const m = { month: I.getMonth(), year: I.getFullYear() };
|
|
99
|
+
i(m), P(I), p || s?.(m);
|
|
66
100
|
}
|
|
67
|
-
},
|
|
101
|
+
}, fe = () => {
|
|
68
102
|
if (r) return;
|
|
69
|
-
|
|
103
|
+
if (b && N(c)) {
|
|
104
|
+
const n = T(c, R);
|
|
105
|
+
if (n) {
|
|
106
|
+
a(y(n)), i(n), p || s?.(n);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
a(k), i(t);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const e = be(c, g, k);
|
|
70
113
|
if (e.resetToCommitted) {
|
|
71
|
-
|
|
114
|
+
a(k), i(t);
|
|
72
115
|
return;
|
|
73
116
|
}
|
|
74
117
|
if (e.parsed) {
|
|
75
118
|
const n = { month: e.parsed.getMonth(), year: e.parsed.getFullYear() };
|
|
76
|
-
|
|
119
|
+
a(e.display), i(n), p || s?.(n);
|
|
77
120
|
return;
|
|
78
121
|
}
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
if (r &&
|
|
82
|
-
|
|
122
|
+
a(k), i(t);
|
|
123
|
+
}, ue = () => {
|
|
124
|
+
if (r && p) {
|
|
125
|
+
v();
|
|
83
126
|
return;
|
|
84
127
|
}
|
|
85
|
-
const e =
|
|
128
|
+
const e = Re(c, g);
|
|
86
129
|
if (e.parsed) {
|
|
87
130
|
const n = {
|
|
88
131
|
month: e.parsed.getMonth(),
|
|
89
132
|
year: e.parsed.getFullYear()
|
|
90
133
|
};
|
|
91
|
-
|
|
134
|
+
p && (s?.(n), u());
|
|
92
135
|
return;
|
|
93
136
|
}
|
|
94
|
-
r || (
|
|
95
|
-
},
|
|
96
|
-
() =>
|
|
137
|
+
r || (D.current = !0, h(!0));
|
|
138
|
+
}, H = k !== c, me = b ? N(c) ? T(c, R) == null && c !== "" : K(c, g) : K(c, g), de = o.useCallback(
|
|
139
|
+
() => Pe(
|
|
97
140
|
M,
|
|
98
141
|
t,
|
|
99
|
-
(e, n) =>
|
|
142
|
+
(e, n) => Ie(e, n) === 0
|
|
100
143
|
),
|
|
101
144
|
[M, t]
|
|
102
145
|
);
|
|
103
146
|
return o.useLayoutEffect(() => {
|
|
104
|
-
|
|
105
|
-
onDismiss:
|
|
106
|
-
resolveFlash:
|
|
147
|
+
Y.current = {
|
|
148
|
+
onDismiss: x,
|
|
149
|
+
resolveFlash: de
|
|
107
150
|
};
|
|
108
|
-
}), /* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
}), /* @__PURE__ */ l(
|
|
152
|
+
Ve,
|
|
153
|
+
{
|
|
154
|
+
open: r,
|
|
155
|
+
disabled: f,
|
|
156
|
+
ariaLabel: d("datePicker.selectMonth"),
|
|
157
|
+
onOpenChange: h,
|
|
158
|
+
onOpenAutoFocus: (e) => {
|
|
159
|
+
D.current || e.preventDefault(), D.current = !1;
|
|
160
|
+
},
|
|
161
|
+
popoverHandlers: se,
|
|
162
|
+
trigger: /* @__PURE__ */ l(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
ref: j,
|
|
166
|
+
"data-component": "month-picker",
|
|
167
|
+
"data-state": r ? "open" : "closed",
|
|
168
|
+
"data-pending": H || void 0,
|
|
169
|
+
onPointerDown: (e) => Se({
|
|
170
|
+
disabled: f,
|
|
171
|
+
event: e,
|
|
172
|
+
onOpen: () => h(!0),
|
|
173
|
+
focusField: () => C.current?.focus()
|
|
174
|
+
}),
|
|
175
|
+
children: /* @__PURE__ */ l(
|
|
176
|
+
Fe,
|
|
177
|
+
{
|
|
178
|
+
ref: C,
|
|
179
|
+
value: c,
|
|
180
|
+
onChange: pe,
|
|
181
|
+
onBlur: (e) => {
|
|
182
|
+
fe(), Z?.(e);
|
|
183
|
+
},
|
|
184
|
+
onClick: () => !f && h(!0),
|
|
185
|
+
onKeyDown: (e) => {
|
|
186
|
+
e.key === "Enter" && !f && (e.preventDefault(), ue()), e.key === "ArrowDown" && !r && !f && (e.preventDefault(), D.current = !0, h(!0)), e.key === "Escape" && r && (e.preventDefault(), x());
|
|
187
|
+
},
|
|
188
|
+
placeholder: r ? d("datePicker.monthYearFormat") : re,
|
|
189
|
+
disabled: f,
|
|
190
|
+
"data-form-control": "input",
|
|
191
|
+
className: ke(
|
|
192
|
+
"cursor-pointer",
|
|
193
|
+
me ? "text-destructive" : H ? "text-content-placeholder" : "",
|
|
194
|
+
X
|
|
195
|
+
),
|
|
196
|
+
suffix: /* @__PURE__ */ w("div", { className: "flex items-center gap-1", children: [
|
|
197
|
+
t && !f && /* @__PURE__ */ w($, { children: [
|
|
198
|
+
/* @__PURE__ */ l(q, { asChild: !0, children: /* @__PURE__ */ l(
|
|
199
|
+
"button",
|
|
200
|
+
{
|
|
201
|
+
type: "button",
|
|
202
|
+
tabIndex: 0,
|
|
203
|
+
"aria-label": d("calendar.clear"),
|
|
204
|
+
onClick: (e) => {
|
|
205
|
+
e.stopPropagation(), z();
|
|
206
|
+
},
|
|
207
|
+
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
208
|
+
children: /* @__PURE__ */ l(ye, { className: "size-3 hover:text-content" })
|
|
209
|
+
}
|
|
210
|
+
) }),
|
|
211
|
+
/* @__PURE__ */ l(G, { variant: "tertiary", side: "top", children: d("calendar.clear") })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ w($, { children: [
|
|
214
|
+
/* @__PURE__ */ l(q, { asChild: !0, children: /* @__PURE__ */ l(
|
|
215
|
+
"button",
|
|
216
|
+
{
|
|
217
|
+
type: "button",
|
|
218
|
+
tabIndex: 0,
|
|
219
|
+
"data-component": "calendar-trigger",
|
|
220
|
+
"aria-label": d("datePicker.selectMonth"),
|
|
221
|
+
onClick: (e) => {
|
|
222
|
+
e.stopPropagation(), f || (r ? u() : h(!0));
|
|
223
|
+
},
|
|
224
|
+
onKeyDown: (e) => {
|
|
225
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), f || (D.current = !0, r ? u() : h(!0)));
|
|
226
|
+
},
|
|
227
|
+
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
228
|
+
children: /* @__PURE__ */ l(ge, { className: "h-4 w-4 text-secondary-foreground" })
|
|
229
|
+
}
|
|
230
|
+
) }),
|
|
231
|
+
/* @__PURE__ */ l(G, { variant: "tertiary", side: "top", children: d("datePicker.selectMonth") })
|
|
232
|
+
] })
|
|
159
233
|
] }),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
className: "w-auto p-0",
|
|
190
|
-
align: "start",
|
|
191
|
-
"aria-label": u("datePicker.selectMonth"),
|
|
192
|
-
onOpenAutoFocus: (e) => {
|
|
193
|
-
g.current || e.preventDefault(), g.current = !1;
|
|
194
|
-
},
|
|
195
|
-
...J,
|
|
196
|
-
children: /* @__PURE__ */ s(
|
|
197
|
-
De,
|
|
198
|
-
{
|
|
199
|
-
pickerType: "month",
|
|
200
|
-
monthMode: "single",
|
|
201
|
-
selectedMonths: M,
|
|
202
|
-
footerFlashKey: q,
|
|
203
|
-
footerFlashTarget: G,
|
|
204
|
-
onMonthSelect: U,
|
|
205
|
-
month: Q,
|
|
206
|
-
onMonthChange: C,
|
|
207
|
-
disabled: Ce(F, j),
|
|
208
|
-
startMonth: v,
|
|
209
|
-
endMonth: K,
|
|
210
|
-
showFooter: c,
|
|
211
|
-
onApply: w,
|
|
212
|
-
onCancel: S,
|
|
213
|
-
onClear: N
|
|
214
|
-
}
|
|
215
|
-
)
|
|
216
|
-
}
|
|
217
|
-
)
|
|
218
|
-
] });
|
|
234
|
+
...te
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
children: /* @__PURE__ */ l(
|
|
240
|
+
we,
|
|
241
|
+
{
|
|
242
|
+
pickerType: "month",
|
|
243
|
+
monthMode: "single",
|
|
244
|
+
selectedMonths: M,
|
|
245
|
+
footerFlashKey: oe,
|
|
246
|
+
footerFlashTarget: ie,
|
|
247
|
+
onMonthSelect: ae,
|
|
248
|
+
month: ce,
|
|
249
|
+
onMonthChange: P,
|
|
250
|
+
disabled: Ee(J, Q),
|
|
251
|
+
startMonth: U,
|
|
252
|
+
endMonth: W,
|
|
253
|
+
showFooter: p,
|
|
254
|
+
onApply: v,
|
|
255
|
+
onCancel: x,
|
|
256
|
+
onClear: z,
|
|
257
|
+
...le
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
);
|
|
219
262
|
}
|
|
220
263
|
);
|
|
221
|
-
|
|
264
|
+
Le.displayName = "MonthPicker";
|
|
222
265
|
export {
|
|
223
|
-
|
|
266
|
+
Le as MonthPicker
|
|
224
267
|
};
|