impact-nova 2.1.0-alpha.9 → 2.2.0

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 (72) hide show
  1. package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-editor.js +73 -94
  2. package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-focus.d.ts +53 -0
  3. package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-focus.js +98 -0
  4. package/dist/components/data/ag-grid-react/headers/column-menu/column-settings-menu.js +15 -13
  5. package/dist/components/data/ag-grid-react/headers/custom-header.js +56 -58
  6. package/dist/components/data/ag-grid-react/headers/custom-inner-header-group.d.ts +12 -0
  7. package/dist/components/data/ag-grid-react/headers/custom-inner-header-group.js +31 -0
  8. package/dist/components/data/ag-grid-react/headers/header-search-active-state.d.ts +10 -0
  9. package/dist/components/data/ag-grid-react/headers/header-search-active-state.js +38 -0
  10. package/dist/components/data/ag-grid-react/index.js +166 -163
  11. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +3 -4
  12. package/dist/components/data/ag-grid-react/theme.js +0 -2
  13. package/dist/components/data/data-table/data-table-column-list.js +1 -1
  14. package/dist/components/data/data-table/data-table-saved-views.js +1 -1
  15. package/dist/components/data/nested-list/components/SortableItem.d.ts +3 -1
  16. package/dist/components/data/nested-list/components/SortableItem.js +111 -109
  17. package/dist/components/data-display/calendar/calendar-footer-emphasis.d.ts +28 -0
  18. package/dist/components/data-display/calendar/calendar-footer-emphasis.js +8 -0
  19. package/dist/components/data-display/calendar/calendar-footer.d.ts +4 -1
  20. package/dist/components/data-display/calendar/calendar-footer.js +60 -38
  21. package/dist/components/data-display/calendar/calendar.js +86 -82
  22. package/dist/components/data-display/calendar/calendar.types.d.ts +2 -0
  23. package/dist/components/data-display/calendar/use-calendar-state.d.ts +3 -0
  24. package/dist/components/flows/filter-strip/filter-strip.js +36 -29
  25. package/dist/components/flows/filter-strip/filter-summary.js +2 -2
  26. package/dist/components/forms/date-picker/date-input-behavior.d.ts +118 -0
  27. package/dist/components/forms/date-picker/date-input-behavior.js +164 -0
  28. package/dist/components/forms/date-picker/date-picker.js +202 -138
  29. package/dist/components/forms/date-picker/date-range-picker.js +302 -215
  30. package/dist/components/forms/date-picker/month-picker.js +160 -119
  31. package/dist/components/forms/date-picker/month-range-picker.js +302 -245
  32. package/dist/components/forms/date-picker/multi-date-picker.js +94 -80
  33. package/dist/components/forms/date-picker/multi-month-picker.js +97 -83
  34. package/dist/components/forms/date-picker/multi-week-picker.js +107 -93
  35. package/dist/components/forms/date-picker/week-picker.js +230 -140
  36. package/dist/components/forms/date-picker/week-range-picker.js +332 -226
  37. package/dist/components/forms/file-upload/file-upload.js +312 -174
  38. package/dist/components/forms/file-upload/file-upload.types.d.ts +17 -2
  39. package/dist/components/layout/dynamic-layout/dynamic-layout.variants.d.ts +1 -1
  40. package/dist/components/layout/header/header.js +45 -38
  41. package/dist/components/layout/horizontal-scroller/index.d.ts +1 -0
  42. package/dist/components/layout/horizontal-scroller/index.js +3 -2
  43. package/dist/components/ui/local-raster-icons/assets/excel-error-icon.webp.js +4 -0
  44. package/dist/components/ui/local-raster-icons/assets/file-upload-error.webp.js +4 -0
  45. package/dist/components/ui/local-raster-icons/rasterIcons.d.ts +2 -0
  46. package/dist/components/ui/local-raster-icons/rasterIcons.js +32 -22
  47. package/dist/components/ui/show.d.ts +10 -0
  48. package/dist/components/ui/show.js +7 -0
  49. package/dist/components/ui/show.types.d.ts +5 -0
  50. package/dist/i18n/defaultMessages.d.ts +17 -0
  51. package/dist/i18n/defaultMessages.js +29 -17
  52. package/dist/i18n/index.d.ts +1 -1
  53. package/dist/i18n/locales/de.js +12 -0
  54. package/dist/i18n/locales/es.js +12 -0
  55. package/dist/i18n/locales/hi.js +12 -0
  56. package/dist/i18n/locales/kn.js +12 -0
  57. package/dist/impact-nova-base.scss +6 -2
  58. package/dist/impact-nova-components.css +141 -16
  59. package/dist/impact-nova-tokens.scss +12 -0
  60. package/dist/impact-nova.css +1 -1
  61. package/dist/index.d.ts +2 -0
  62. package/dist/index.js +273 -271
  63. package/dist/lib/utils.js +40 -24
  64. package/dist/llms/rules/ag-grid.js +1 -1
  65. package/dist/llms/rules/installation.js +1 -1
  66. package/dist/llms/rules/requirements.js +1 -1
  67. package/dist/tailwind.config.js +36 -4
  68. package/dist/theme/tailwind-colors.js +3 -1
  69. package/package.json +11 -3
  70. package/tailwind.config.d.ts +3 -0
  71. package/dist/components/data/ag-grid-react/headers/custom-header-group.d.ts +0 -10
  72. package/dist/components/data/ag-grid-react/headers/custom-header-group.js +0 -58
@@ -1,248 +1,354 @@
1
- import { jsx as a, jsxs as S } from "react/jsx-runtime";
2
- import * as f from "react";
3
- import { Cross as Pe, CalendarMonth as We } from "impact-nova-icons";
4
- import { format as l, isValid as E, parse as P } from "date-fns";
5
- import { cn as A, padValidDateString as U, maskDate as X } from "../../../lib/utils.js";
6
- import { useFieldChrome as Ie } from "../../../lib/primitives/use-field-chrome.js";
7
- import { Popover as ve, PopoverAnchor as Ne, PopoverContent as Ve } from "../../feedback/popover/popover.js";
8
- import { Calendar as Ae } from "../../data-display/calendar/calendar.js";
9
- import { buildDateBoundsMatcher as Te } from "../../../lib/date-bounds-matcher.js";
10
- import { Tooltip as Z, TooltipTrigger as _, TooltipContent as $ } from "../../feedback/tooltip/tooltip.js";
11
- import { resolveWeekSelection as je } from "../../../lib/fiscal-calendar.js";
12
- import { useImpactNovaI18n as Le } from "../../../i18n/use-impact-nova-i18n.js";
13
- import { getDateFnsLocale as Me } from "../../../i18n/getDateFnsLocale.js";
14
- import { coerceWeekRangeApply as Be, isWeekRangeSelection as Ke } from "./calendar-selection-adapters.js";
15
- const i = (e) => e?.from ? e.to ? e.to.endDate : e.from.endDate : void 0, I = (e) => e?.from ? { from: e.from, to: e.to } : void 0, ze = f.forwardRef(
1
+ import { jsx as u, jsxs as T } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { Cross as Me, CalendarMonth as Ge } from "impact-nova-icons";
4
+ import { format as k } from "date-fns";
5
+ import { cn as G } from "../../../lib/utils.js";
6
+ import { usePickerDismissActionsRef as Je, usePickerFooterDismissNudge as Qe, createRangePickerOpenChangeHandler as Ue, parseDateInput as J, normalizeOrderedRange as Xe, compareDates as Ze, flashRangeReorder as _e, isDateInputInvalid as ne, resolveRangeFieldBlur as V, resolveRangePickerDismissFlash as $e, deferRangeInputBlur as Ye, maskDateInput as se, resolveDateInputOnBlur as O } from "./date-input-behavior.js";
7
+ import { useFieldChrome as Fe } from "../../../lib/primitives/use-field-chrome.js";
8
+ import { Popover as et, PopoverAnchor as tt, PopoverContent as rt } from "../../feedback/popover/popover.js";
9
+ import { Calendar as ot } from "../../data-display/calendar/calendar.js";
10
+ import { buildDateBoundsMatcher as nt } from "../../../lib/date-bounds-matcher.js";
11
+ import { Tooltip as ie, TooltipTrigger as le, TooltipContent as ae } from "../../feedback/tooltip/tooltip.js";
12
+ import { resolveWeekSelection as st } from "../../../lib/fiscal-calendar.js";
13
+ import { useImpactNovaI18n as it } from "../../../i18n/use-impact-nova-i18n.js";
14
+ import { getDateFnsLocale as lt } from "../../../i18n/getDateFnsLocale.js";
15
+ import { coerceWeekRangeApply as at, isWeekRangeSelection as ct } from "./calendar-selection-adapters.js";
16
+ const x = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, B = (t) => t?.from ? { from: t.from, to: t.to } : void 0;
17
+ function ce(t, a) {
18
+ return !t && !a ? !0 : !t || !a ? !1 : t.startDate.getTime() === a.startDate.getTime();
19
+ }
20
+ function ft(t, a) {
21
+ return !t && !a ? !0 : !t || !a ? !1 : ce(t.from, a.from) && ce(t.to, a.to);
22
+ }
23
+ const dt = l.forwardRef(
16
24
  ({
17
- value: e,
18
- onChange: D,
25
+ value: t,
26
+ onChange: a,
19
27
  format: n = "MM/dd/yyyy",
20
- placeholder: Y,
21
- minDate: F,
22
- maxDate: ee,
23
- startMonth: te,
24
- endMonth: ne,
25
- showFooter: b = !0,
26
- calendarType: T = "calendar",
28
+ placeholder: fe,
29
+ minDate: de,
30
+ maxDate: pe,
31
+ startMonth: me,
32
+ endMonth: ue,
33
+ showFooter: g = !0,
34
+ calendarType: L = "calendar",
27
35
  fiscalMode: j = "basic",
28
- selectionMode: L = "week",
29
- fiscalMonthPattern: M,
30
- fiscalYearStartMonth: B = 1,
31
- weekStartsOn: K = 1,
32
- disabled: c,
33
- className: oe,
34
- error: re,
35
- isError: le,
36
- size: z,
37
- label: se,
38
- helperText: ce,
39
- helperTextPosition: ae = "absolute",
40
- required: ie,
41
- prefix: Oe,
42
- prefixClick: He,
43
- ...de
44
- }, fe) => {
45
- const O = re ?? le, pe = Ie({
46
- label: se,
47
- helperText: ce,
48
- helperTextPosition: ae,
49
- error: O,
50
- required: ie,
51
- disabled: c ?? void 0,
36
+ selectionMode: K = "week",
37
+ fiscalMonthPattern: q,
38
+ fiscalYearStartMonth: z = 1,
39
+ weekStartsOn: H = 1,
40
+ disabled: d,
41
+ className: ke,
42
+ error: ge,
43
+ isError: Re,
44
+ size: Q,
45
+ label: De,
46
+ helperText: he,
47
+ helperTextPosition: ye = "absolute",
48
+ required: ve,
49
+ prefix: pt,
50
+ prefixClick: mt,
51
+ ...xe
52
+ }, be) => {
53
+ const U = ge ?? Re, Ce = Fe({
54
+ label: De,
55
+ helperText: he,
56
+ helperTextPosition: ye,
57
+ error: U,
58
+ required: ve,
59
+ disabled: d ?? void 0,
52
60
  rootClassName: "w-full min-w-[240px]"
53
- }), { locale: H, t: x } = Le(), o = f.useMemo(() => Me(H), [H]), q = Y ?? x("datePicker.selectWeekRange"), G = f.useRef(null), me = f.useRef(null);
54
- f.useImperativeHandle(fe, () => G.current);
55
- const [s, p] = f.useState(!1), W = f.useRef(!1), [w, m] = f.useState(e), [R, u] = f.useState(e?.from ? l(e.from.startDate, n, { locale: o }) : ""), [C, h] = f.useState(i(e) ? l(i(e), n, { locale: o }) : ""), [ue, N] = f.useState(e?.from?.startDate || /* @__PURE__ */ new Date());
56
- f.useEffect(() => {
57
- s || (u(e?.from ? l(e.from.startDate, n, { locale: o }) : ""), h(i(e) ? l(i(e), n, { locale: o }) : ""), m(e));
58
- }, [e, n, s, o]), f.useEffect(() => {
59
- s && (m(e), u(e?.from ? l(e.from.startDate, n, { locale: o }) : ""), h(i(e) ? l(i(e), n, { locale: o }) : ""), N(e?.from?.startDate || /* @__PURE__ */ new Date()));
60
- }, [s, e, n, o]);
61
- const he = (t) => {
62
- const r = Ke(t) ? t : void 0;
63
- m(r), r?.from ? (u(l(r.from.startDate, n, { locale: o })), h(l(i(r), n, { locale: o }))) : (u(""), h("")), !b && r?.from && r?.to && r.from.startDate.getTime() !== r.to.startDate.getTime() && (D?.(r), p(!1));
64
- }, ge = (t) => {
65
- const r = Be(t, I(w));
66
- D?.(r), p(!1);
67
- }, V = () => {
68
- m(e), u(e?.from ? l(e.from.startDate, n, { locale: o }) : ""), h(i(e) ? l(i(e), n, { locale: o }) : ""), p(!1);
69
- }, J = () => {
70
- m(void 0), u(""), h(""), D?.(void 0), b || p(!1);
71
- }, v = (t) => je(t, {
72
- calendarType: T,
73
- fiscalMode: j,
74
- selectionMode: L,
75
- fiscalMonthPattern: M,
76
- fiscalYearStartMonth: B,
77
- weekStartsOn: K
78
- }), ke = (t) => {
79
- const r = t.target.value, d = X(r, n, R);
80
- if (u(d), d === "") {
81
- const k = { to: w?.to };
82
- m(k), b || D?.(void 0);
61
+ }), { locale: X, t: E } = it(), s = l.useMemo(() => lt(X), [X]), Z = fe ?? E("datePicker.selectWeekRange"), _ = l.useRef(null), Ie = l.useRef(null), $ = l.useRef(null), N = l.useRef(null), M = l.useRef(null);
62
+ l.useImperativeHandle(be, () => _.current);
63
+ const [p, R] = l.useState(!1), Y = Je(), { footerFlashKey: we, footerFlashTarget: Ee, popoverHandlers: We } = Qe(g, p, Y, $), W = l.useRef(!1), [c, D] = l.useState(t), [m, h] = l.useState(t?.from ? k(t.from.startDate, n, { locale: s }) : ""), [y, v] = l.useState(x(t) ? k(x(t), n, { locale: s }) : ""), [Pe, P] = l.useState(t?.from?.startDate || /* @__PURE__ */ new Date());
64
+ l.useEffect(() => {
65
+ h(t?.from ? k(t.from.startDate, n, { locale: s }) : ""), v(x(t) ? k(x(t), n, { locale: s }) : ""), D(t);
66
+ }, [t, n, s]);
67
+ const Te = l.useCallback(
68
+ (e) => Ue({
69
+ disabled: d ?? void 0,
70
+ showFooter: g,
71
+ containerRef: N,
72
+ popoverContentRef: M,
73
+ setOpen: R
74
+ })(e),
75
+ [d, g]
76
+ ), F = l.useRef(!1);
77
+ l.useEffect(() => {
78
+ if (p && !F.current) {
79
+ const e = J(m, n, s);
80
+ e.parsed ? P(e.parsed) : c?.from ? P(c.from.startDate) : t?.from && P(t.from.startDate);
81
+ }
82
+ F.current = p;
83
+ }, [p, m, n, s, c?.from, t?.from]);
84
+ const Se = (e) => {
85
+ const r = ct(e) ? e : void 0;
86
+ D(r), r?.from ? (h(k(r.from.startDate, n, { locale: s })), v(k(x(r), n, { locale: s }))) : (h(""), v("")), !g && r?.from && r?.to && r.from.startDate.getTime() !== r.to.startDate.getTime() && (a?.(r), R(!1));
87
+ }, b = l.useCallback(
88
+ (e) => st(e, {
89
+ calendarType: L,
90
+ fiscalMode: j,
91
+ selectionMode: K,
92
+ fiscalMonthPattern: q,
93
+ fiscalYearStartMonth: z,
94
+ weekStartsOn: H
95
+ }),
96
+ [
97
+ L,
98
+ j,
99
+ K,
100
+ q,
101
+ z,
102
+ H
103
+ ]
104
+ ), S = l.useCallback((e, r) => {
105
+ const o = Xe(
106
+ e,
107
+ r,
108
+ (i, f) => Ze(i.startDate, f.startDate)
109
+ );
110
+ return o.swapped && (o.from && h(k(o.from.startDate, n, { locale: s })), o.to && v(k(x({ from: o.from, to: o.to }), n, { locale: s })), _e(N.current)), { from: o.from, to: o.to };
111
+ }, [n, s]), ee = (e) => {
112
+ const r = at(e, B(c)), o = S(r?.from, r?.to), i = o.from ? { from: o.from, to: o.to } : void 0;
113
+ D(i), a?.(i), R(!1);
114
+ }, A = () => {
115
+ D(t), h(t?.from ? k(t.from.startDate, n, { locale: s }) : ""), v(x(t) ? k(x(t), n, { locale: s }) : ""), R(!1);
116
+ }, te = () => {
117
+ D(void 0), h(""), v(""), a?.(void 0), g || R(!1);
118
+ }, Be = (e) => {
119
+ const r = se(e.target.value, n, m);
120
+ if (h(r), r === "") {
121
+ const f = { to: c?.to };
122
+ D(f), g || a?.(void 0);
83
123
  return;
84
124
  }
85
- const g = P(d, n, /* @__PURE__ */ new Date(), { locale: o });
86
- if (E(g) && d.length === n.length) {
87
- const y = { from: v(g), to: w?.to };
88
- m(y), h(l(i(y), n, { locale: o })), b || D?.(I(y));
125
+ const { parsed: o, isValid: i } = J(r, n, s);
126
+ if (i && o) {
127
+ const w = { from: b(o), to: c?.to };
128
+ D(w), c?.to && v(k(x(w), n, { locale: s })), P(o), g || a?.(B(w));
89
129
  }
90
- }, De = (t) => {
91
- const r = t.target.value, d = X(r, n, C);
92
- if (h(d), d === "") {
93
- const k = { from: w?.from };
94
- m(k), b || D?.(I(k));
130
+ }, Ne = (e) => {
131
+ const r = se(e.target.value, n, y);
132
+ if (v(r), r === "") {
133
+ const f = { from: c?.from };
134
+ D(f), g || a?.(B(f));
95
135
  return;
96
136
  }
97
- const g = P(d, n, /* @__PURE__ */ new Date(), { locale: o });
98
- if (E(g) && d.length === n.length) {
99
- const k = v(g), y = { from: w?.from, to: k };
100
- m(y), w?.from && u(l(w.from.startDate, n, { locale: o })), g && N(g), b || D?.(I(y));
137
+ const { parsed: o, isValid: i } = J(r, n, s);
138
+ if (i && o) {
139
+ const f = b(o), w = { from: c?.from, to: f };
140
+ D(w), c?.from && h(k(c.from.startDate, n, { locale: s })), P(o), g || a?.(B(w));
101
141
  }
102
- }, Q = () => {
103
- if (s) return;
104
- const t = U(R, n), r = U(C, n), d = P(t, n, /* @__PURE__ */ new Date(), { locale: o }), g = P(r, n, /* @__PURE__ */ new Date(), { locale: o }), k = E(d) && t.length === n.length, y = E(g) && r.length === n.length;
105
- if (!k || !y)
106
- u(e?.from ? l(e.from.startDate, n, { locale: o }) : ""), h(i(e) ? l(i(e), n, { locale: o }) : ""), m(e);
107
- else if (u(t), h(r), !b) {
108
- const Se = v(d), Ee = v(g);
109
- D?.({ from: Se, to: Ee });
142
+ }, Ae = () => {
143
+ const e = O(m, n, C, s), r = O(y, n, I, s);
144
+ e.resetToCommitted ? h(C) : e.parsed && h(e.display), r.resetToCommitted ? v(I) : r.parsed && v(r.display);
145
+ let o = e.parsed ? b(e.parsed) : c?.from, i = r.parsed ? b(r.parsed) : c?.to;
146
+ o && i && ({ from: o, to: i } = S(o, i));
147
+ const f = o ? { from: o, to: i } : void 0;
148
+ f ? (D(f), a?.(f)) : !m && !y && (D(void 0), a?.(void 0));
149
+ }, re = () => {
150
+ Ye(
151
+ N,
152
+ M,
153
+ () => {
154
+ const e = V(m, n, C, s), r = V(y, n, I, s);
155
+ e.resetToCommitted ? h(C) : e.parsed && h(e.display), r.resetToCommitted ? v(I) : r.parsed && v(r.display);
156
+ let o = e.parsed ? b(e.parsed) : e.resetToCommitted ? t?.from : c?.from, i = r.parsed ? b(r.parsed) : r.resetToCommitted ? t?.to : c?.to;
157
+ o && i && ({ from: o, to: i } = S(o, i));
158
+ const f = o || i ? { from: o, to: i } : void 0;
159
+ D(f), g || (f ? a?.(f) : !m && !y && a?.(void 0));
160
+ }
161
+ );
162
+ }, oe = () => {
163
+ if (p && g) {
164
+ ee();
165
+ return;
110
166
  }
111
- }, be = e?.from ? l(e.from.startDate, n, { locale: o }) : "", we = i(e) ? l(i(e), n, { locale: o }) : "", ye = be !== R, xe = we !== C, Re = R.length === n.length && !E(P(R, n, /* @__PURE__ */ new Date(), { locale: o })), Ce = C.length === n.length && !E(P(C, n, /* @__PURE__ */ new Date(), { locale: o }));
112
- return /* @__PURE__ */ a("div", { "data-component": "week-range-picker", "data-disabled": c || void 0, children: pe.wrapControl(
113
- /* @__PURE__ */ S(ve, { open: c ? !1 : s, onOpenChange: (t) => {
114
- c || p(t);
115
- }, children: [
116
- /* @__PURE__ */ a(Ne, { asChild: !0, children: /* @__PURE__ */ S(
117
- "div",
118
- {
119
- "data-state": s ? "open" : "closed",
120
- className: A(
121
- "flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
122
- O ? "border-destructive hover:border-destructive" : "border-field",
123
- z === "sm" ? "h-6" : z === "md" ? "h-[28px]" : "h-8",
124
- c && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
125
- "cursor-pointer",
126
- oe
127
- ),
128
- children: [
129
- /* @__PURE__ */ S("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
130
- /* @__PURE__ */ a(
131
- "input",
132
- {
133
- ref: G,
134
- type: "text",
135
- value: R,
136
- onChange: ke,
137
- onBlur: Q,
138
- onClick: () => !c && p(!0),
139
- onKeyDown: (t) => {
140
- (t.key === "Enter" || t.key === "ArrowDown") && !s && !c && (t.preventDefault(), W.current = !0, p(!0)), t.key === "Escape" && s && (t.preventDefault(), V());
141
- },
142
- placeholder: s ? n : q,
143
- disabled: !!c,
144
- "aria-label": "Start Date",
145
- "data-field": "start",
146
- className: A(
147
- "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
148
- Re ? "text-destructive" : ye ? "text-content-placeholder" : ""
149
- ),
150
- ...de
151
- }
167
+ if (!p) {
168
+ if (g) {
169
+ Ae();
170
+ return;
171
+ }
172
+ const e = O(m, n, C, s), r = O(y, n, I, s);
173
+ if (e.parsed || r.parsed) return;
174
+ W.current = !0, R(!0);
175
+ }
176
+ }, C = t?.from ? k(t.from.startDate, n, { locale: s }) : "", I = x(t) ? k(x(t), n, { locale: s }) : "", Ve = C !== m, Oe = I !== y, Le = ne(m, n, s), je = ne(y, n, s), Ke = "Start Date", qe = "End Date", ze = l.useCallback(() => {
177
+ const e = V(m, n, C, s), r = V(y, n, I, s);
178
+ let o = e.parsed ? b(e.parsed) : e.resetToCommitted ? t?.from : c?.from, i = r.parsed ? b(r.parsed) : r.resetToCommitted ? t?.to : c?.to;
179
+ o && i && ({ from: o, to: i } = S(o, i));
180
+ const f = o || i ? { from: o, to: i } : void 0;
181
+ return $e({
182
+ startInput: m,
183
+ endInput: y,
184
+ committedStart: C,
185
+ committedEnd: I,
186
+ committedRange: t,
187
+ computeEffectiveRange: () => f,
188
+ rangesEqual: (w, He) => ft(w, He)
189
+ });
190
+ }, [
191
+ m,
192
+ y,
193
+ C,
194
+ I,
195
+ t,
196
+ c,
197
+ n,
198
+ s,
199
+ S,
200
+ b
201
+ ]);
202
+ return l.useLayoutEffect(() => {
203
+ Y.current = {
204
+ onDismiss: A,
205
+ resolveFlash: ze
206
+ };
207
+ }), /* @__PURE__ */ u(
208
+ "div",
209
+ {
210
+ ref: $,
211
+ "data-component": "week-range-picker",
212
+ "data-disabled": d || void 0,
213
+ children: Ce.wrapControl(
214
+ /* @__PURE__ */ T(et, { open: d ? !1 : p, onOpenChange: Te, children: [
215
+ /* @__PURE__ */ u(tt, { asChild: !0, children: /* @__PURE__ */ T(
216
+ "div",
217
+ {
218
+ ref: N,
219
+ "data-state": p ? "open" : "closed",
220
+ className: G(
221
+ "flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
222
+ U ? "border-destructive hover:border-destructive" : "border-field",
223
+ Q === "sm" ? "h-6" : Q === "md" ? "h-[28px]" : "h-8",
224
+ d && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
225
+ "cursor-pointer",
226
+ ke
152
227
  ),
153
- /* @__PURE__ */ a(
154
- "input",
155
- {
156
- ref: me,
157
- type: "text",
158
- value: C,
159
- onChange: De,
160
- onBlur: Q,
161
- onClick: () => !c && p(!0),
162
- onKeyDown: (t) => {
163
- (t.key === "Enter" || t.key === "ArrowDown") && !s && !c && (t.preventDefault(), W.current = !0, p(!0)), t.key === "Escape" && s && (t.preventDefault(), V());
164
- },
165
- placeholder: s ? n : q,
166
- disabled: !!c,
167
- "aria-label": "End Date",
168
- "data-field": "end",
169
- className: A(
170
- "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
171
- Ce ? "text-destructive" : xe ? "text-content-placeholder" : ""
228
+ children: [
229
+ /* @__PURE__ */ T("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
230
+ /* @__PURE__ */ u(
231
+ "input",
232
+ {
233
+ ref: _,
234
+ type: "text",
235
+ value: m,
236
+ onChange: Be,
237
+ onBlur: re,
238
+ onClick: () => !d && R(!0),
239
+ onKeyDown: (e) => {
240
+ e.key === "Enter" && !d && (e.preventDefault(), oe()), e.key === "ArrowDown" && !p && !d && (e.preventDefault(), W.current = !0, R(!0)), e.key === "Escape" && p && (e.preventDefault(), A());
241
+ },
242
+ placeholder: p ? n : Z,
243
+ disabled: !!d,
244
+ "aria-label": Ke,
245
+ "data-field": "start",
246
+ className: G(
247
+ "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
248
+ Le ? "text-destructive" : Ve ? "text-content-placeholder" : ""
249
+ ),
250
+ ...xe
251
+ }
252
+ ),
253
+ /* @__PURE__ */ u(
254
+ "input",
255
+ {
256
+ ref: Ie,
257
+ type: "text",
258
+ value: y,
259
+ onChange: Ne,
260
+ onBlur: re,
261
+ onClick: () => !d && R(!0),
262
+ onKeyDown: (e) => {
263
+ e.key === "Enter" && !d && (e.preventDefault(), oe()), e.key === "ArrowDown" && !p && !d && (e.preventDefault(), W.current = !0, R(!0)), e.key === "Escape" && p && (e.preventDefault(), A());
264
+ },
265
+ placeholder: p ? n : Z,
266
+ disabled: !!d,
267
+ "aria-label": qe,
268
+ "data-field": "end",
269
+ className: G(
270
+ "flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
271
+ je ? "text-destructive" : Oe ? "text-content-placeholder" : ""
272
+ )
273
+ }
172
274
  )
275
+ ] }),
276
+ /* @__PURE__ */ T("div", { className: "flex items-center gap-1 shrink-0", children: [
277
+ t?.from && !d && /* @__PURE__ */ T(ie, { children: [
278
+ /* @__PURE__ */ u(le, { asChild: !0, children: /* @__PURE__ */ u(
279
+ "button",
280
+ {
281
+ type: "button",
282
+ tabIndex: 0,
283
+ "aria-label": E("calendar.clear"),
284
+ onClick: (e) => {
285
+ e.stopPropagation(), te();
286
+ },
287
+ className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
288
+ children: /* @__PURE__ */ u(Me, { className: "size-3 hover:text-content text-content-icon" })
289
+ }
290
+ ) }),
291
+ /* @__PURE__ */ u(ae, { variant: "tertiary", side: "top", children: E("calendar.clear") })
292
+ ] }),
293
+ /* @__PURE__ */ T(ie, { children: [
294
+ /* @__PURE__ */ u(le, { asChild: !0, children: /* @__PURE__ */ u("button", { type: "button", tabIndex: 0, "aria-label": E("datePicker.selectWeekRange"), onClick: (e) => {
295
+ e.stopPropagation(), d || R(!p);
296
+ }, onKeyDown: (e) => {
297
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), d || (W.current = !0, R(!p)));
298
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(Ge, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
299
+ /* @__PURE__ */ u(ae, { variant: "tertiary", side: "top", children: E("datePicker.selectWeekRange") })
300
+ ] })
301
+ ] })
302
+ ]
303
+ }
304
+ ) }),
305
+ /* @__PURE__ */ u(
306
+ rt,
307
+ {
308
+ ref: M,
309
+ className: "w-auto p-0",
310
+ align: "start",
311
+ "aria-label": E("datePicker.selectWeekRange"),
312
+ onOpenAutoFocus: (e) => {
313
+ W.current || e.preventDefault(), W.current = !1;
314
+ },
315
+ ...We,
316
+ children: /* @__PURE__ */ u(
317
+ ot,
318
+ {
319
+ pickerType: "week",
320
+ weekMode: "range",
321
+ selectedWeeks: B(c),
322
+ footerFlashKey: we,
323
+ footerFlashTarget: Ee,
324
+ onWeekSelect: Se,
325
+ month: Pe,
326
+ onMonthChange: P,
327
+ disabled: nt(de, pe),
328
+ startMonth: me,
329
+ endMonth: ue,
330
+ showFooter: g,
331
+ calendarType: L,
332
+ fiscalMode: j,
333
+ selectionMode: K,
334
+ fiscalMonthPattern: q,
335
+ fiscalYearStartMonth: z,
336
+ weekStartsOn: H,
337
+ onApply: ee,
338
+ onCancel: A,
339
+ onClear: te,
340
+ captionLayout: "dropdown"
173
341
  }
174
342
  )
175
- ] }),
176
- /* @__PURE__ */ S("div", { className: "flex items-center gap-1 shrink-0", children: [
177
- e?.from && !c && /* @__PURE__ */ S(Z, { children: [
178
- /* @__PURE__ */ a(_, { asChild: !0, children: /* @__PURE__ */ a(
179
- "button",
180
- {
181
- type: "button",
182
- tabIndex: 0,
183
- "aria-label": x("calendar.clear"),
184
- onClick: (t) => {
185
- t.stopPropagation(), J();
186
- },
187
- className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
188
- children: /* @__PURE__ */ a(Pe, { className: "size-3 hover:text-content text-content-icon" })
189
- }
190
- ) }),
191
- /* @__PURE__ */ a($, { variant: "tertiary", side: "top", children: x("calendar.clear") })
192
- ] }),
193
- /* @__PURE__ */ S(Z, { children: [
194
- /* @__PURE__ */ a(_, { asChild: !0, children: /* @__PURE__ */ a("button", { type: "button", tabIndex: 0, "aria-label": x("datePicker.selectWeekRange"), onClick: (t) => {
195
- t.stopPropagation(), c || p(!s);
196
- }, onKeyDown: (t) => {
197
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), c || (W.current = !0, p(!s)));
198
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ a(We, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
199
- /* @__PURE__ */ a($, { variant: "tertiary", side: "top", children: x("datePicker.selectWeekRange") })
200
- ] })
201
- ] })
202
- ]
203
- }
204
- ) }),
205
- /* @__PURE__ */ a(
206
- Ve,
207
- {
208
- className: "w-auto p-0",
209
- align: "start",
210
- "aria-label": x("datePicker.selectWeekRange"),
211
- onOpenAutoFocus: (t) => {
212
- W.current || t.preventDefault(), W.current = !1;
213
- },
214
- children: /* @__PURE__ */ a(
215
- Ae,
216
- {
217
- pickerType: "week",
218
- weekMode: "range",
219
- selectedWeeks: I(w),
220
- onWeekSelect: he,
221
- month: ue,
222
- onMonthChange: N,
223
- disabled: Te(F, ee),
224
- startMonth: te,
225
- endMonth: ne,
226
- showFooter: b,
227
- calendarType: T,
228
- fiscalMode: j,
229
- selectionMode: L,
230
- fiscalMonthPattern: M,
231
- fiscalYearStartMonth: B,
232
- weekStartsOn: K,
233
- onApply: ge,
234
- onCancel: V,
235
- onClear: J,
236
- captionLayout: "dropdown"
237
343
  }
238
344
  )
239
- }
345
+ ] })
240
346
  )
241
- ] })
242
- ) });
347
+ }
348
+ );
243
349
  }
244
350
  );
245
- ze.displayName = "WeekRangePicker";
351
+ dt.displayName = "WeekRangePicker";
246
352
  export {
247
- ze as WeekRangePicker
353
+ dt as WeekRangePicker
248
354
  };