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,271 +1,328 @@
1
- import { jsx as p, jsxs as P } from "react/jsx-runtime";
2
- import * as h from "react";
3
- import { Cross as we, CalendarMonth as Ye } from "impact-nova-icons";
4
- import { isValid as w, parse as Y } from "date-fns";
5
- import { cn as v, padValidDateString as R, maskDate as q } from "../../../lib/utils.js";
6
- import { useFieldChrome as be } from "../../../lib/primitives/use-field-chrome.js";
7
- import { Popover as xe, PopoverAnchor as ye, PopoverContent as ke } from "../../feedback/popover/popover.js";
8
- import { Calendar as De } from "../../data-display/calendar/calendar.js";
9
- import { Tooltip as G, TooltipTrigger as J, TooltipContent as L } from "../../feedback/tooltip/tooltip.js";
10
- import { useImpactNovaI18n as Se } from "../../../i18n/use-impact-nova-i18n.js";
11
- import { coerceMonthRangeApply as Ee, isMonthRangeSelection as Pe } from "./calendar-selection-adapters.js";
12
- import { buildDateBoundsMatcher as Re } from "../../../lib/date-bounds-matcher.js";
13
- const m = (e, i = "MM/YYYY") => {
14
- const A = (e.month + 1).toString().padStart(2, "0");
15
- return i === "YYYY/MM" ? `${e.year}/${A}` : `${A}/${e.year}`;
1
+ import { jsx as u, jsxs as D } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { Cross as Ne, CalendarMonth as Ae } from "impact-nova-icons";
4
+ import { cn as $ } from "../../../lib/utils.js";
5
+ import { usePickerDismissActionsRef as Ve, usePickerFooterDismissNudge as Oe, createRangePickerOpenChangeHandler as Ke, parseDateInput as z, normalizeOrderedRange as F, compareMonthSelection as O, flashRangeReorder as ee, isDateInputInvalid as te, resolveRangeFieldBlur as A, resolveRangePickerDismissFlash as je, deferRangeInputBlur as $e, maskDateInput as re, resolveDateInputOnBlur as V } from "./date-input-behavior.js";
6
+ import { useFieldChrome as ze } from "../../../lib/primitives/use-field-chrome.js";
7
+ import { Popover as He, PopoverAnchor as qe, PopoverContent as Le } from "../../feedback/popover/popover.js";
8
+ import { Calendar as Ge } from "../../data-display/calendar/calendar.js";
9
+ import { Tooltip as oe, TooltipTrigger as ne, TooltipContent as se } from "../../feedback/tooltip/tooltip.js";
10
+ import { useImpactNovaI18n as Je } from "../../../i18n/use-impact-nova-i18n.js";
11
+ import { coerceMonthRangeApply as Qe, isMonthRangeSelection as Ue } from "./calendar-selection-adapters.js";
12
+ import { buildDateBoundsMatcher as We } from "../../../lib/date-bounds-matcher.js";
13
+ const h = (t, n = "MM/YYYY") => {
14
+ const E = (t.month + 1).toString().padStart(2, "0");
15
+ return n === "YYYY/MM" ? `${t.year}/${E}` : `${E}/${t.year}`;
16
16
  };
17
- function u(e) {
18
- return { month: e.getMonth(), year: e.getFullYear() };
17
+ function Xe(t, n) {
18
+ if (!t && !n) return !0;
19
+ if (!t || !n) return !1;
20
+ const E = t.from === void 0 && n.from === void 0 || t.from !== void 0 && n.from !== void 0 && O(t.from, n.from) === 0, b = t.to === void 0 && n.to === void 0 || t.to !== void 0 && n.to !== void 0 && O(t.to, n.to) === 0;
21
+ return E && b;
19
22
  }
20
- const Ie = h.forwardRef(
23
+ function I(t) {
24
+ return { month: t.getMonth(), year: t.getFullYear() };
25
+ }
26
+ const Ze = s.forwardRef(
21
27
  ({
22
- value: e,
23
- onChange: i,
24
- placeholder: A,
25
- minDate: I,
26
- maxDate: Q,
27
- startMonth: U,
28
- endMonth: W,
29
- showFooter: M = !0,
30
- disabled: l,
31
- className: X,
32
- error: Z,
33
- isError: _,
34
- size: K,
35
- label: F,
36
- helperText: ee,
37
- helperTextPosition: te = "absolute",
38
- required: ne,
39
- prefix: Ve,
40
- prefixClick: Ce,
41
- displayFormat: a = "MM/YYYY",
42
- ...re
43
- }, oe) => {
44
- const B = Z ?? _, ae = be({
45
- label: F,
46
- helperText: ee,
47
- helperTextPosition: te,
48
- error: B,
49
- required: ne,
50
- disabled: l ?? void 0,
28
+ value: t,
29
+ onChange: n,
30
+ placeholder: E,
31
+ minDate: b,
32
+ maxDate: ie,
33
+ startMonth: ae,
34
+ endMonth: ce,
35
+ showFooter: g = !0,
36
+ disabled: c,
37
+ className: fe,
38
+ error: de,
39
+ isError: le,
40
+ size: H,
41
+ label: me,
42
+ helperText: pe,
43
+ helperTextPosition: ue = "absolute",
44
+ required: he,
45
+ prefix: _e,
46
+ prefixClick: Fe,
47
+ displayFormat: i = "MM/YYYY",
48
+ ...ge
49
+ }, Me) => {
50
+ const q = de ?? le, Re = ze({
51
+ label: me,
52
+ helperText: pe,
53
+ helperTextPosition: ue,
54
+ error: q,
55
+ required: he,
56
+ disabled: c ?? void 0,
51
57
  rootClassName: "w-full min-w-[240px]"
52
- }), { t: b } = Se(), $ = h.useRef(null), se = h.useRef(null), c = h.useMemo(
53
- () => a === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
54
- [a]
58
+ }), { t: x } = Je(), L = s.useRef(null), ye = s.useRef(null), G = s.useRef(null), S = s.useRef(null), K = s.useRef(null), f = s.useMemo(
59
+ () => i === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
60
+ [i]
55
61
  );
56
- h.useImperativeHandle(oe, () => $.current);
57
- const [d, g] = h.useState(!1), V = h.useRef(!1), [E, x] = h.useState(e), [y, D] = h.useState(e?.from ? m(e.from, a) : ""), [k, S] = h.useState(e?.to ? m(e.to, a) : ""), [ie, N] = h.useState(() => e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date());
58
- h.useEffect(() => {
59
- d || (D(e?.from ? m(e.from, a) : ""), S(e?.to ? m(e.to, a) : ""), x(e));
60
- }, [d, e, a]), h.useEffect(() => {
61
- d && (x(e), D(e?.from ? m(e.from, a) : ""), S(e?.to ? m(e.to, a) : ""), N(e?.from ? new Date(e.from.year, e.from.month, 1) : I || /* @__PURE__ */ new Date()));
62
- }, [d, e, a, I]);
63
- const ce = (t) => {
64
- const n = Pe(t) ? t : void 0;
65
- x(n), n?.from && D(m(n.from, a)), n?.to && S(m(n.to, a)), !M && n?.from && n?.to && (n.from.month !== n.to.month || n.from.year !== n.to.year) && (i?.(n), g(!1));
66
- }, de = (t) => {
67
- const n = Ee(t, E);
68
- i?.(n), g(!1);
69
- }, T = () => {
70
- x(e), D(e?.from ? m(e.from, a) : ""), S(e?.to ? m(e.to, a) : ""), g(!1);
62
+ s.useImperativeHandle(Me, () => L.current);
63
+ const [m, M] = s.useState(!1), J = Ve(), { footerFlashKey: ke, footerFlashTarget: ve, popoverHandlers: xe } = Oe(g, m, J, G), w = s.useRef(!1), [d, R] = s.useState(t), [p, k] = s.useState(t?.from ? h(t.from, i) : ""), [y, v] = s.useState(t?.to ? h(t.to, i) : ""), [Ye, P] = s.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : b || /* @__PURE__ */ new Date());
64
+ s.useEffect(() => {
65
+ k(t?.from ? h(t.from, i) : ""), v(t?.to ? h(t.to, i) : ""), R(t);
66
+ }, [t, i]);
67
+ const Ce = s.useCallback(
68
+ (e) => Ke({
69
+ disabled: c ?? void 0,
70
+ showFooter: g,
71
+ containerRef: S,
72
+ popoverContentRef: K,
73
+ setOpen: M
74
+ })(e),
75
+ [c, g]
76
+ ), Q = s.useRef(!1);
77
+ s.useEffect(() => {
78
+ if (m && !Q.current) {
79
+ const e = z(p, f);
80
+ e.parsed ? P(e.parsed) : d?.from ? P(new Date(d.from.year, d.from.month, 1)) : t?.from ? P(new Date(t.from.year, t.from.month, 1)) : b && P(b);
81
+ }
82
+ Q.current = m;
83
+ }, [m, p, f, d?.from, t?.from, b]);
84
+ const be = (e) => {
85
+ const r = Ue(e) ? e : void 0;
86
+ R(r), r?.from && k(h(r.from, i)), r?.to && v(h(r.to, i)), !g && r?.from && r?.to && (r.from.month !== r.to.month || r.from.year !== r.to.year) && (n?.(r), M(!1));
87
+ }, U = (e) => {
88
+ const r = Qe(e, d), o = F(r?.from, r?.to, O);
89
+ o.swapped && (o.from && k(h(o.from, i)), o.to && v(h(o.to, i)), R({ from: o.from, to: o.to }), ee(S.current)), n?.({ from: o.from, to: o.to }), M(!1);
90
+ }, B = () => {
91
+ R(t), k(t?.from ? h(t.from, i) : ""), v(t?.to ? h(t.to, i) : ""), M(!1);
71
92
  }, j = () => {
72
- x(void 0), D(""), S(""), i?.(void 0), M || g(!1);
73
- }, fe = (t) => {
74
- const n = t.target.value, s = q(n, c, y);
75
- if (D(s), s === "") {
76
- const o = { from: void 0, to: E?.to };
77
- x(o), M || i?.(o);
93
+ R(void 0), k(""), v(""), n?.(void 0), g || M(!1);
94
+ }, Ie = (e) => {
95
+ const r = re(e.target.value, f, p);
96
+ if (k(r), r === "") {
97
+ const l = { from: void 0, to: d?.to };
98
+ R(l), g || n?.(l);
99
+ return;
100
+ }
101
+ const { parsed: o, isValid: a } = z(r, f);
102
+ if (a && o) {
103
+ const T = { from: I(o), to: d?.to };
104
+ R(T), P(o), g || n?.(T);
105
+ }
106
+ }, Pe = (e) => {
107
+ const r = re(e.target.value, f, y);
108
+ if (v(r), r === "") {
109
+ const l = { from: d?.from, to: void 0 };
110
+ R(l), g || n?.(l);
78
111
  return;
79
112
  }
80
- const r = Y(s, c, /* @__PURE__ */ new Date());
81
- if (w(r) && s.length === 7) {
82
- const f = { from: { month: r.getMonth(), year: r.getFullYear() }, to: E?.to };
83
- x(f), N(r), M || i?.(f);
113
+ const { parsed: o, isValid: a } = z(r, f);
114
+ if (a && o) {
115
+ const l = I(o), T = { from: d?.from, to: l };
116
+ R(T), P(o), g || n?.(T);
84
117
  }
85
- }, le = (t) => {
86
- const n = t.target.value, s = q(n, c, k);
87
- if (S(s), s === "") {
88
- const o = { from: E?.from, to: void 0 };
89
- x(o), M || i?.(o);
118
+ }, N = s.useCallback((e, r) => {
119
+ const o = F(e, r, O);
120
+ return o.swapped && (o.from && k(h(o.from, i)), o.to && v(h(o.to, i)), ee(S.current)), { from: o.from, to: o.to };
121
+ }, [i]), we = () => {
122
+ const e = V(p, f, Y), r = V(y, f, C);
123
+ e.resetToCommitted ? k(Y) : e.parsed && k(e.display), r.resetToCommitted ? v(C) : r.parsed && v(r.display);
124
+ let o = e.parsed ? I(e.parsed) : d?.from, a = r.parsed ? I(r.parsed) : d?.to;
125
+ if ({ from: o, to: a } = N(o, a), o || a) {
126
+ const l = { from: o, to: a };
127
+ R(l), n?.(l);
128
+ } else !p && !y && (R(void 0), n?.(void 0));
129
+ }, W = () => {
130
+ $e(
131
+ S,
132
+ K,
133
+ () => {
134
+ const e = A(p, f, Y), r = A(y, f, C);
135
+ e.resetToCommitted ? k(Y) : e.parsed && k(e.display), r.resetToCommitted ? v(C) : r.parsed && v(r.display);
136
+ let o = e.parsed ? I(e.parsed) : e.resetToCommitted ? t?.from : d?.from, a = r.parsed ? I(r.parsed) : r.resetToCommitted ? t?.to : d?.to;
137
+ o && a && ({ from: o, to: a } = N(o, a));
138
+ const l = o || a ? { from: o, to: a } : void 0;
139
+ R(l), g || (l ? n?.(l) : !p && !y && n?.(void 0));
140
+ }
141
+ );
142
+ }, X = () => {
143
+ if (m && g) {
144
+ U();
90
145
  return;
91
146
  }
92
- const r = Y(s, c, /* @__PURE__ */ new Date());
93
- if (w(r) && s.length === 7) {
94
- const o = { month: r.getMonth(), year: r.getFullYear() }, f = { from: E?.from, to: o };
95
- x(f), N(r), M || i?.(f);
147
+ if (!m) {
148
+ if (g) {
149
+ we();
150
+ return;
151
+ }
152
+ const e = V(p, f, Y), r = V(y, f, C);
153
+ if (e.parsed || r.parsed) return;
154
+ w.current = !0, M(!0);
96
155
  }
97
- }, O = () => {
98
- if (d) return;
99
- const t = R(y, c), n = R(k, c), s = Y(t, c, /* @__PURE__ */ new Date()), r = Y(n, c, /* @__PURE__ */ new Date()), o = w(s) && t.length === 7, f = w(r) && n.length === 7;
100
- y && !o ? D(e?.from ? m(e.from, a) : "") : o && D(t), k && !f ? S(e?.to ? m(e.to, a) : "") : f && S(n), o && f && !M ? i?.({
101
- from: u(s),
102
- to: u(r)
103
- }) : o && !M ? i?.({
104
- from: u(s),
105
- to: e?.to
106
- }) : f && !M && i?.({
107
- from: e?.from,
108
- to: u(r)
156
+ }, Y = t?.from ? h(t.from, i) : "", C = t?.to ? h(t.to, i) : "", De = p !== Y, Ee = y !== C, Se = te(p, f), Te = te(y, f), Z = x("datePicker.startMonth"), _ = x("datePicker.endMonth"), Be = s.useCallback(() => {
157
+ const e = A(p, f, Y), r = A(y, f, C);
158
+ let o = e.parsed ? I(e.parsed) : e.resetToCommitted ? t?.from : d?.from, a = r.parsed ? I(r.parsed) : r.resetToCommitted ? t?.to : d?.to;
159
+ o && a && ({ from: o, to: a } = N(o, a));
160
+ const l = o || a ? { from: o, to: a } : void 0;
161
+ return je({
162
+ startInput: p,
163
+ endInput: y,
164
+ committedStart: Y,
165
+ committedEnd: C,
166
+ committedRange: t,
167
+ computeEffectiveRange: () => l,
168
+ rangesEqual: Xe
109
169
  });
110
- }, pe = e?.from ? m(e.from, a) : "", me = e?.to ? m(e.to, a) : "", he = y !== pe, ue = k !== me, ge = y.length === 7 && !w(Y(y, c, /* @__PURE__ */ new Date())), Me = k.length === 7 && !w(Y(k, c, /* @__PURE__ */ new Date())), z = b("datePicker.startMonth"), H = b("datePicker.endMonth");
111
- return /* @__PURE__ */ p("div", { "data-component": "month-range-picker", "data-disabled": l || void 0, children: ae.wrapControl(
112
- /* @__PURE__ */ P(xe, { open: l ? !1 : d, onOpenChange: (t) => {
113
- l || g(t);
114
- }, children: [
115
- /* @__PURE__ */ p(ye, { asChild: !0, children: /* @__PURE__ */ P(
116
- "div",
117
- {
118
- "data-state": d ? "open" : "closed",
119
- className: v(
120
- "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",
121
- B ? "border-destructive hover:border-destructive" : "border-field",
122
- K === "sm" ? "h-6" : K === "md" ? "h-[28px]" : "h-8",
123
- l && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
124
- "cursor-pointer",
125
- X
126
- ),
127
- children: [
128
- /* @__PURE__ */ P("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
129
- /* @__PURE__ */ p(
130
- "input",
131
- {
132
- ref: $,
133
- type: "text",
134
- value: y,
135
- onChange: fe,
136
- onBlur: O,
137
- onClick: () => !l && g(!0),
138
- onKeyDown: (t) => {
139
- if (t.key === "Enter" && !d) {
140
- t.preventDefault();
141
- const n = R(y, c), s = R(k, c), r = Y(n, c, /* @__PURE__ */ new Date()), o = Y(s, c, /* @__PURE__ */ new Date()), f = w(r) && n.length === 7, C = w(o) && s.length === 7;
142
- f && C ? i?.({
143
- from: u(r),
144
- to: u(o)
145
- }) : f ? i?.({
146
- from: u(r),
147
- to: e?.to
148
- }) : C && i?.({
149
- from: e?.from,
150
- to: u(o)
151
- });
170
+ }, [
171
+ p,
172
+ y,
173
+ Y,
174
+ C,
175
+ t,
176
+ d,
177
+ f,
178
+ N
179
+ ]);
180
+ return s.useLayoutEffect(() => {
181
+ J.current = {
182
+ onDismiss: B,
183
+ resolveFlash: Be
184
+ };
185
+ }), /* @__PURE__ */ u(
186
+ "div",
187
+ {
188
+ ref: G,
189
+ "data-component": "month-range-picker",
190
+ "data-disabled": c || void 0,
191
+ children: Re.wrapControl(
192
+ /* @__PURE__ */ D(He, { open: c ? !1 : m, onOpenChange: Ce, children: [
193
+ /* @__PURE__ */ u(qe, { asChild: !0, children: /* @__PURE__ */ D(
194
+ "div",
195
+ {
196
+ ref: S,
197
+ "data-state": m ? "open" : "closed",
198
+ className: $(
199
+ "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",
200
+ q ? "border-destructive hover:border-destructive" : "border-field",
201
+ H === "sm" ? "h-6" : H === "md" ? "h-[28px]" : "h-8",
202
+ c && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
203
+ "cursor-pointer",
204
+ fe
205
+ ),
206
+ children: [
207
+ /* @__PURE__ */ D("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
208
+ /* @__PURE__ */ u(
209
+ "input",
210
+ {
211
+ ref: L,
212
+ type: "text",
213
+ value: p,
214
+ onChange: Ie,
215
+ onBlur: W,
216
+ onClick: () => !c && M(!0),
217
+ onKeyDown: (e) => {
218
+ e.key === "Enter" && !c && (e.preventDefault(), X()), e.key === "ArrowDown" && !m && !c && (e.preventDefault(), w.current = !0, M(!0)), e.key === "Escape" && m && (e.preventDefault(), B());
219
+ },
220
+ placeholder: m ? i === "YYYY/MM" ? "YYYY/MM" : x("datePicker.monthYearFormat") : Z,
221
+ disabled: !!c,
222
+ "aria-label": Z,
223
+ "data-field": "start",
224
+ className: $(
225
+ "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",
226
+ Se ? "text-destructive" : De ? "text-content-placeholder" : ""
227
+ ),
228
+ ...ge
152
229
  }
153
- t.key === "ArrowDown" && !d && !l && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && d && (t.preventDefault(), T());
154
- },
155
- placeholder: d ? a === "YYYY/MM" ? "YYYY/MM" : b("datePicker.monthYearFormat") : z,
156
- disabled: !!l,
157
- "aria-label": z,
158
- "data-field": "start",
159
- className: v(
160
- "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",
161
- ge ? "text-destructive" : he ? "text-content-placeholder" : ""
162
230
  ),
163
- ...re
164
- }
165
- ),
166
- /* @__PURE__ */ p(
167
- "input",
168
- {
169
- ref: se,
170
- type: "text",
171
- value: k,
172
- onChange: le,
173
- onBlur: O,
174
- onClick: () => !l && g(!0),
175
- onKeyDown: (t) => {
176
- if (t.key === "Enter" && !d) {
177
- t.preventDefault();
178
- const n = R(y, c), s = R(k, c), r = Y(n, c, /* @__PURE__ */ new Date()), o = Y(s, c, /* @__PURE__ */ new Date()), f = w(r) && n.length === 7, C = w(o) && s.length === 7;
179
- f && C ? i?.({
180
- from: u(r),
181
- to: u(o)
182
- }) : f ? i?.({
183
- from: u(r),
184
- to: e?.to
185
- }) : C && i?.({
186
- from: e?.from,
187
- to: u(o)
188
- });
231
+ /* @__PURE__ */ u(
232
+ "input",
233
+ {
234
+ ref: ye,
235
+ type: "text",
236
+ value: y,
237
+ onChange: Pe,
238
+ onBlur: W,
239
+ onClick: () => !c && M(!0),
240
+ onKeyDown: (e) => {
241
+ e.key === "Enter" && !c && (e.preventDefault(), X()), e.key === "ArrowDown" && !m && !c && (e.preventDefault(), w.current = !0, M(!0)), e.key === "Escape" && m && (e.preventDefault(), B());
242
+ },
243
+ placeholder: m ? i === "YYYY/MM" ? "YYYY/MM" : x("datePicker.monthYearFormat") : _,
244
+ disabled: !!c,
245
+ "aria-label": _,
246
+ "data-field": "end",
247
+ className: $(
248
+ "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",
249
+ Te ? "text-destructive" : Ee ? "text-content-placeholder" : ""
250
+ )
189
251
  }
190
- t.key === "ArrowDown" && !d && !l && (t.preventDefault(), V.current = !0, g(!0)), t.key === "Escape" && d && (t.preventDefault(), T());
191
- },
192
- placeholder: d ? a === "YYYY/MM" ? "YYYY/MM" : b("datePicker.monthYearFormat") : H,
193
- disabled: !!l,
194
- "aria-label": H,
195
- "data-field": "end",
196
- className: v(
197
- "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",
198
- Me ? "text-destructive" : ue ? "text-content-placeholder" : ""
199
252
  )
253
+ ] }),
254
+ /* @__PURE__ */ D("div", { className: "flex items-center gap-1 shrink-0", children: [
255
+ t?.from && !c && /* @__PURE__ */ D(oe, { children: [
256
+ /* @__PURE__ */ u(ne, { asChild: !0, children: /* @__PURE__ */ u(
257
+ "button",
258
+ {
259
+ type: "button",
260
+ tabIndex: 0,
261
+ "aria-label": x("calendar.clear"),
262
+ onClick: (e) => {
263
+ e.stopPropagation(), j();
264
+ },
265
+ onKeyDown: (e) => {
266
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), j());
267
+ },
268
+ className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
269
+ children: /* @__PURE__ */ u(Ne, { className: "size-3 hover:text-content text-content-icon" })
270
+ }
271
+ ) }),
272
+ /* @__PURE__ */ u(se, { variant: "tertiary", side: "top", children: x("calendar.clear") })
273
+ ] }),
274
+ /* @__PURE__ */ D(oe, { children: [
275
+ /* @__PURE__ */ u(ne, { asChild: !0, children: /* @__PURE__ */ u("button", { type: "button", tabIndex: 0, "aria-label": x("datePicker.selectMonthRange"), onClick: (e) => {
276
+ e.stopPropagation(), c || M(!m);
277
+ }, onKeyDown: (e) => {
278
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (w.current = !0, M(!m)));
279
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(Ae, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
280
+ /* @__PURE__ */ u(se, { variant: "tertiary", side: "top", children: x("datePicker.selectMonthRange") })
281
+ ] })
282
+ ] })
283
+ ]
284
+ }
285
+ ) }),
286
+ /* @__PURE__ */ u(
287
+ Le,
288
+ {
289
+ ref: K,
290
+ className: "w-auto p-0",
291
+ align: "start",
292
+ "aria-label": x("datePicker.selectMonthRange"),
293
+ onOpenAutoFocus: (e) => {
294
+ w.current || e.preventDefault(), w.current = !1;
295
+ },
296
+ ...xe,
297
+ children: /* @__PURE__ */ u(
298
+ Ge,
299
+ {
300
+ pickerType: "month",
301
+ monthMode: "range",
302
+ selectedMonths: d,
303
+ footerFlashKey: ke,
304
+ footerFlashTarget: ve,
305
+ onMonthSelect: be,
306
+ month: Ye,
307
+ onMonthChange: P,
308
+ disabled: We(b, ie),
309
+ startMonth: ae,
310
+ endMonth: ce,
311
+ showFooter: g,
312
+ onApply: U,
313
+ onCancel: B,
314
+ onClear: j
200
315
  }
201
316
  )
202
- ] }),
203
- /* @__PURE__ */ P("div", { className: "flex items-center gap-1 shrink-0", children: [
204
- e?.from && !l && /* @__PURE__ */ P(G, { children: [
205
- /* @__PURE__ */ p(J, { asChild: !0, children: /* @__PURE__ */ p(
206
- "button",
207
- {
208
- type: "button",
209
- tabIndex: 0,
210
- "aria-label": b("calendar.clear"),
211
- onClick: (t) => {
212
- t.stopPropagation(), j();
213
- },
214
- onKeyDown: (t) => {
215
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), j());
216
- },
217
- className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
218
- children: /* @__PURE__ */ p(we, { className: "size-3 hover:text-content text-content-icon" })
219
- }
220
- ) }),
221
- /* @__PURE__ */ p(L, { variant: "tertiary", side: "top", children: b("calendar.clear") })
222
- ] }),
223
- /* @__PURE__ */ P(G, { children: [
224
- /* @__PURE__ */ p(J, { asChild: !0, children: /* @__PURE__ */ p("button", { type: "button", tabIndex: 0, "aria-label": b("datePicker.selectMonthRange"), onClick: (t) => {
225
- t.stopPropagation(), l || g(!d);
226
- }, onKeyDown: (t) => {
227
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), l || (V.current = !0, g(!d)));
228
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ p(Ye, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
229
- /* @__PURE__ */ p(L, { variant: "tertiary", side: "top", children: b("datePicker.selectMonthRange") })
230
- ] })
231
- ] })
232
- ]
233
- }
234
- ) }),
235
- /* @__PURE__ */ p(
236
- ke,
237
- {
238
- className: "w-auto p-0",
239
- align: "start",
240
- "aria-label": b("datePicker.selectMonthRange"),
241
- onOpenAutoFocus: (t) => {
242
- V.current || t.preventDefault(), V.current = !1;
243
- },
244
- children: /* @__PURE__ */ p(
245
- De,
246
- {
247
- pickerType: "month",
248
- monthMode: "range",
249
- selectedMonths: E,
250
- onMonthSelect: ce,
251
- month: ie,
252
- onMonthChange: N,
253
- disabled: Re(I, Q),
254
- startMonth: U,
255
- endMonth: W,
256
- showFooter: M,
257
- onApply: de,
258
- onCancel: T,
259
- onClear: j
260
317
  }
261
318
  )
262
- }
319
+ ] })
263
320
  )
264
- ] })
265
- ) });
321
+ }
322
+ );
266
323
  }
267
324
  );
268
- Ie.displayName = "MonthRangePicker";
325
+ Ze.displayName = "MonthRangePicker";
269
326
  export {
270
- Ie as MonthRangePicker
327
+ Ze as MonthRangePicker
271
328
  };