impact-nova 1.7.39 → 1.7.40

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 (41) hide show
  1. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +58 -48
  2. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
  3. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
  4. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
  5. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
  6. package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
  7. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
  8. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
  9. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
  10. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
  11. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
  12. package/dist/components/ui/ag-grid-react/index.js +24 -25
  13. package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
  14. package/dist/components/ui/data-table/column-indicator.js +30 -0
  15. package/dist/components/ui/data-table/data-table-column-list.js +210 -154
  16. package/dist/components/ui/data-table/data-table.js +60 -59
  17. package/dist/components/ui/data-table/index.d.ts +3 -0
  18. package/dist/components/ui/data-table/index.js +34 -28
  19. package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
  20. package/dist/components/ui/data-table/indicator-legend.js +20 -0
  21. package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
  22. package/dist/components/ui/data-table/pin-switch.js +75 -0
  23. package/dist/components/ui/date-picker/date-picker.js +65 -63
  24. package/dist/components/ui/date-picker/date-range-picker.js +77 -75
  25. package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
  26. package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
  27. package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
  28. package/dist/components/ui/nested-list/nested-list.js +184 -178
  29. package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
  30. package/dist/components/ui/types/date-picker.types.d.ts +4 -0
  31. package/dist/components/ui/types/nested-list.types.d.ts +12 -0
  32. package/dist/i18n/defaultMessages.d.ts +10 -0
  33. package/dist/i18n/defaultMessages.js +16 -8
  34. package/dist/i18n/locales/de.js +8 -0
  35. package/dist/i18n/locales/es.js +8 -0
  36. package/dist/i18n/locales/hi.js +8 -0
  37. package/dist/i18n/locales/kn.js +8 -0
  38. package/dist/impact-nova.css +1 -1
  39. package/dist/index.js +180 -174
  40. package/package.json +1 -1
  41. package/tailwind.config.js +16 -0
@@ -1,21 +1,21 @@
1
- import { jsx as i, jsxs as D } from "react/jsx-runtime";
2
- import { useState as l, useRef as O, useCallback as H, useMemo as b, useEffect as y, memo as E } from "react";
3
- import { AgGridWrapper as F } from "../ag-grid-react/index.js";
4
- import { cn as _ } from "../../../lib/utils.js";
5
- import { DataTableContext as N, DataTableSheetPortalContext as M, useDataTable as z, useDataTableSheetPortal as I } from "./data-table-context.js";
6
- import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as j } from "./data-table-constants.js";
1
+ import { jsx as i, jsxs as E } from "react/jsx-runtime";
2
+ import { useState as l, useRef as F, useCallback as _, useMemo as S, useEffect as A, memo as N } from "react";
3
+ import { AgGridWrapper as M } from "../ag-grid-react/index.js";
4
+ import { cn as y } from "../../../lib/utils.js";
5
+ import { DataTableContext as z, DataTableSheetPortalContext as I, useDataTable as j, useDataTableSheetPortal as P } from "./data-table-context.js";
6
+ import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as R } from "./data-table-constants.js";
7
7
  import { AG_GRID_VALUE_FORMATTERS as k } from "../ag-grid-react/value-formatters.js";
8
- const w = {
8
+ const C = {
9
9
  default: 46,
10
10
  compact: 30,
11
11
  comfort: 52
12
- }, P = (o) => {
12
+ }, G = (o) => {
13
13
  if (o)
14
14
  return o.map((e) => {
15
15
  if ("children" in e && e.children)
16
16
  return {
17
17
  ...e,
18
- children: P(e.children)
18
+ children: G(e.children)
19
19
  };
20
20
  const t = e;
21
21
  return !t.valueFormatter && (t.type === "numericColumn" || t.type === "number") ? {
@@ -27,65 +27,65 @@ const w = {
27
27
  children: o,
28
28
  className: e
29
29
  }) => {
30
- const [t, r] = l(null), [n, p] = l(null), [s, h] = l("medium"), [c, d] = l("full"), [u, f] = l("default"), [g, S] = l(!1), m = O(0), x = H((v) => {
31
- m.current = Math.max(0, m.current + v), S(m.current > 0);
32
- }, []), T = H((v) => {
33
- r(v);
34
- }, []), a = {
30
+ const [t, r] = l(null), [n, p] = l(null), [c, d] = l("medium"), [h, u] = l("full"), [s, f] = l("default"), [g, b] = l(!1), m = F(0), x = _((H) => {
31
+ m.current = Math.max(0, m.current + H), b(m.current > 0);
32
+ }, []), T = _((H) => {
33
+ r(H);
34
+ }, []), v = {
35
35
  small: "12px",
36
36
  medium: "14px",
37
37
  large: "16px"
38
- }[s], R = `${w[u]}px`, C = b(() => ({
38
+ }[c], a = `${C[s]}px`, O = S(() => ({
39
39
  gridApi: t,
40
40
  registerApi: T,
41
41
  registerScopedSheetDepth: x,
42
- fontSize: s,
43
- setFontSize: h,
44
- numericFormat: c,
45
- setNumericFormat: d,
46
- rowHeight: u,
42
+ fontSize: c,
43
+ setFontSize: d,
44
+ numericFormat: h,
45
+ setNumericFormat: u,
46
+ rowHeight: s,
47
47
  setRowHeight: f
48
48
  }), [
49
49
  t,
50
50
  T,
51
51
  x,
52
- s,
53
- h,
54
52
  c,
55
53
  d,
54
+ h,
56
55
  u,
56
+ s,
57
57
  f
58
- ]), G = b(() => ({
58
+ ]), D = S(() => ({
59
59
  sheetTarget: n,
60
60
  setSheetTarget: p,
61
61
  scopedSheetOpen: g
62
62
  }), [n, p, g]);
63
- return /* @__PURE__ */ i(N.Provider, { value: C, children: /* @__PURE__ */ i(M.Provider, { value: G, children: /* @__PURE__ */ i(
63
+ return /* @__PURE__ */ i(z.Provider, { value: O, children: /* @__PURE__ */ i(I.Provider, { value: D, children: /* @__PURE__ */ i(
64
64
  "div",
65
65
  {
66
66
  "data-component": "data-table",
67
- className: _("flex flex-col w-full min-h-0 rounded-[inherit]", e),
67
+ className: y("flex flex-col w-full min-h-0 rounded-[inherit]", e),
68
68
  style: {
69
- "--ag-font-size": a,
70
- "--ag-row-height": R
69
+ "--ag-font-size": v,
70
+ "--ag-row-height": a
71
71
  },
72
72
  children: o
73
73
  }
74
74
  ) }) });
75
- }, A = {
75
+ }, w = {
76
76
  full: "full_no",
77
77
  k: "thou",
78
78
  m: "mil",
79
79
  b: "bil",
80
80
  full_precision: "full_precision"
81
- }, L = E(function() {
82
- const { setSheetTarget: e, scopedSheetOpen: t } = I();
81
+ }, L = N(function() {
82
+ const { setSheetTarget: e, scopedSheetOpen: t } = P();
83
83
  return /* @__PURE__ */ i(
84
84
  "div",
85
85
  {
86
86
  ref: e,
87
87
  className: "absolute inset-0 pointer-events-none z-[39] flex overflow-x-hidden overflow-y-visible",
88
- style: t ? { minHeight: j } : void 0
88
+ style: t ? { minHeight: R } : void 0
89
89
  }
90
90
  );
91
91
  });
@@ -95,49 +95,50 @@ function J(o) {
95
95
  rowHeight: t,
96
96
  gridApi: r,
97
97
  numericFormat: n
98
- } = z(), {
99
- className: p,
100
- onGridReady: s,
98
+ } = j(), { scopedSheetOpen: p } = P(), {
99
+ className: c,
100
+ onGridReady: d,
101
101
  rowHeight: h,
102
- context: c,
103
- columnDefs: d,
104
- maintainColumnOrder: u = !0,
105
- ...f
106
- } = o, g = w[t], S = h ?? g, m = b(() => P(d), [d]), x = b(() => ({
107
- ...c,
108
- formatType: A[n]
109
- }), [c, n]);
110
- y(() => {
102
+ context: u,
103
+ columnDefs: s,
104
+ maintainColumnOrder: f = !0,
105
+ ...g
106
+ } = o, b = C[t], m = h ?? b, x = S(() => G(s), [s]), T = S(() => ({
107
+ ...u,
108
+ formatType: w[n]
109
+ }), [u, n]);
110
+ A(() => {
111
111
  r?.resetRowHeights();
112
- }, [t, r]), y(() => {
112
+ }, [t, r]), A(() => {
113
113
  if (r) {
114
114
  const a = r.getGridOption("context") || {};
115
115
  r.setGridOption("context", {
116
116
  ...a,
117
- formatType: A[n]
117
+ formatType: w[n]
118
118
  }), r.refreshCells({ force: !0 });
119
119
  }
120
120
  }, [n, r]);
121
- const T = H((a) => {
122
- e(a.api), s?.(a);
123
- }, [e, s]);
124
- return /* @__PURE__ */ D(
121
+ const v = _((a) => {
122
+ e(a.api), d?.(a);
123
+ }, [e, d]);
124
+ return /* @__PURE__ */ E(
125
125
  "div",
126
126
  {
127
- className: _(
127
+ className: y(
128
128
  "relative flex-1 min-h-0 w-full bg-canvas-elevated rounded-b-[inherit] grid-rounded-bottom",
129
- p
129
+ c
130
130
  ),
131
+ style: p ? { minHeight: R } : void 0,
131
132
  children: [
132
133
  /* @__PURE__ */ i(
133
- F,
134
+ M,
134
135
  {
135
- ...f,
136
- columnDefs: m,
137
- rowHeight: S,
138
- onGridReady: T,
139
- context: x,
140
- maintainColumnOrder: u
136
+ ...g,
137
+ columnDefs: x,
138
+ rowHeight: m,
139
+ onGridReady: v,
140
+ context: T,
141
+ maintainColumnOrder: f
141
142
  }
142
143
  ),
143
144
  /* @__PURE__ */ i(L, {})
@@ -148,7 +149,7 @@ function J(o) {
148
149
  const K = ({
149
150
  children: o,
150
151
  className: e
151
- }) => /* @__PURE__ */ i("div", { "data-component": "data-table-toolbar", className: _("flex items-center justify-between px-4 py-3 shrink-0 bg-canvas-elevated rounded-t-[inherit]", e), children: o });
152
+ }) => /* @__PURE__ */ i("div", { "data-component": "data-table-toolbar", className: y("flex items-center justify-between px-4 py-3 shrink-0 bg-canvas-elevated rounded-t-[inherit]", e), children: o });
152
153
  export {
153
154
  q as DataTable,
154
155
  J as DataTableContent,
@@ -6,4 +6,7 @@ export * from './data-table-format-options';
6
6
  export * from './data-table-sheet';
7
7
  export * from './data-table-view-menu';
8
8
  export * from './data-table-saved-views';
9
+ export * from './pin-switch';
10
+ export * from './column-indicator';
11
+ export * from './indicator-legend';
9
12
  export type { SavedTableViewItem, TableViewTypeOption, DataTableSavedViewsProps, DataTableSavedViewsActionContext, DataTableSavedViewsCancelContext, } from '../types/data-table-saved-views.types';
@@ -1,33 +1,39 @@
1
- import { DataTable as t, DataTableContent as T, DataTableToolbar as o } from "./data-table.js";
2
- import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as D, TABLE_VIEWPORT_SHELL_EXPANDED_CLASS as l } from "./data-table-constants.js";
3
- import { DataTableColumnList as n } from "./data-table-column-list.js";
4
- import { DataTableContext as i, DataTableSheetPortalContext as p, useDataTable as m, useDataTableSheetPortal as x } from "./data-table-context.js";
5
- import { DataTableFormatOptions as _ } from "./data-table-format-options.js";
6
- import { DataTableSheet as s, DataTableSheetContent as f, DataTableSheetHeader as h, DataTableSheetTrigger as C, useDataTableSheet as V, useDataTableSheetApi as w } from "./data-table-sheet.js";
7
- import { DataTableViewMenuContent as H, DataTableViewMenuDensity as L, DataTableViewMenuSettingsItem as M, DataTableViewMenuTrigger as P, DataTableViewMenuViewportExpand as g } from "./data-table-view-menu.js";
8
- import { DataTableSavedViews as O } from "./data-table-saved-views.js";
1
+ import { DataTable as t, DataTableContent as o, DataTableToolbar as r } from "./data-table.js";
2
+ import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as l, TABLE_VIEWPORT_SHELL_EXPANDED_CLASS as D } from "./data-table-constants.js";
3
+ import { DataTableColumnList as b } from "./data-table-column-list.js";
4
+ import { DataTableContext as S, DataTableSheetPortalContext as m, useDataTable as p, useDataTableSheetPortal as x } from "./data-table-context.js";
5
+ import { DataTableFormatOptions as u } from "./data-table-format-options.js";
6
+ import { DataTableSheet as _, DataTableSheetContent as h, DataTableSheetHeader as s, DataTableSheetTrigger as C, useDataTableSheet as w, useDataTableSheetApi as V } from "./data-table-sheet.js";
7
+ import { DataTableViewMenuContent as L, DataTableViewMenuDensity as P, DataTableViewMenuSettingsItem as d, DataTableViewMenuTrigger as g, DataTableViewMenuViewportExpand as H } from "./data-table-view-menu.js";
8
+ import { DataTableSavedViews as M } from "./data-table-saved-views.js";
9
+ import { PinSwitch as c } from "./pin-switch.js";
10
+ import { ColumnIndicator as N } from "./column-indicator.js";
11
+ import { IndicatorLegend as v } from "./indicator-legend.js";
9
12
  export {
10
- D as DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX,
13
+ N as ColumnIndicator,
14
+ l as DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX,
11
15
  t as DataTable,
12
- n as DataTableColumnList,
13
- T as DataTableContent,
14
- i as DataTableContext,
15
- _ as DataTableFormatOptions,
16
- O as DataTableSavedViews,
17
- s as DataTableSheet,
18
- f as DataTableSheetContent,
19
- h as DataTableSheetHeader,
20
- p as DataTableSheetPortalContext,
16
+ b as DataTableColumnList,
17
+ o as DataTableContent,
18
+ S as DataTableContext,
19
+ u as DataTableFormatOptions,
20
+ M as DataTableSavedViews,
21
+ _ as DataTableSheet,
22
+ h as DataTableSheetContent,
23
+ s as DataTableSheetHeader,
24
+ m as DataTableSheetPortalContext,
21
25
  C as DataTableSheetTrigger,
22
- o as DataTableToolbar,
23
- H as DataTableViewMenuContent,
24
- L as DataTableViewMenuDensity,
25
- M as DataTableViewMenuSettingsItem,
26
- P as DataTableViewMenuTrigger,
27
- g as DataTableViewMenuViewportExpand,
28
- l as TABLE_VIEWPORT_SHELL_EXPANDED_CLASS,
29
- m as useDataTable,
30
- V as useDataTableSheet,
31
- w as useDataTableSheetApi,
26
+ r as DataTableToolbar,
27
+ L as DataTableViewMenuContent,
28
+ P as DataTableViewMenuDensity,
29
+ d as DataTableViewMenuSettingsItem,
30
+ g as DataTableViewMenuTrigger,
31
+ H as DataTableViewMenuViewportExpand,
32
+ v as IndicatorLegend,
33
+ c as PinSwitch,
34
+ D as TABLE_VIEWPORT_SHELL_EXPANDED_CLASS,
35
+ p as useDataTable,
36
+ w as useDataTableSheet,
37
+ V as useDataTableSheetApi,
32
38
  x as useDataTableSheetPortal
33
39
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Legend showing the meaning of sort/filter indicator colors.
3
+ * Displayed in the Frozen Columns section header.
4
+ *
5
+ * @example
6
+ * <IndicatorLegend />
7
+ */
8
+ export declare const IndicatorLegend: React.FC;
@@ -0,0 +1,20 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { ColumnIndicator as r } from "./column-indicator.js";
3
+ import { useImpactNovaI18n as n } from "../../../i18n/ImpactNovaI18nContext.js";
4
+ const i = () => {
5
+ const { t: a } = n();
6
+ return /* @__PURE__ */ t("div", { className: "flex items-center gap-3 text-[10px] text-content-muted", children: [
7
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
8
+ /* @__PURE__ */ e(r, { type: "sort" }),
9
+ /* @__PURE__ */ e("span", { children: a("dataTable.indicatorSort") })
10
+ ] }),
11
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
12
+ /* @__PURE__ */ e(r, { type: "filter" }),
13
+ /* @__PURE__ */ e("span", { children: a("dataTable.indicatorSearch") })
14
+ ] })
15
+ ] });
16
+ };
17
+ i.displayName = "IndicatorLegend";
18
+ export {
19
+ i as IndicatorLegend
20
+ };
@@ -0,0 +1,30 @@
1
+ export type PinPosition = 'left' | 'right' | null;
2
+ interface PinSwitchProps {
3
+ /** Current pin position */
4
+ value: PinPosition;
5
+ /** Callback when pin position changes */
6
+ onChange: (value: PinPosition) => void;
7
+ /** Whether the switch is disabled */
8
+ disabled?: boolean;
9
+ /** Additional CSS classes */
10
+ className?: string;
11
+ }
12
+ /**
13
+ * Custom pin switch component for column pinning control.
14
+ * Displays L | [toggle switch with pin] | R where the pin slides left/right.
15
+ *
16
+ * Design specs:
17
+ * - Switch: 44px width, 24px height
18
+ * - Switch box (sliding part): 20px x 20px
19
+ * - Icon: 12px x 12px
20
+ * - Border radius: 4px
21
+ * - Uses shadow-elevation-pin-switch token
22
+ *
23
+ * @example
24
+ * <PinSwitch value="left" onChange={(pos) => console.log(pos)} />
25
+ */
26
+ export declare const PinSwitch: {
27
+ ({ value, onChange, disabled, className }: PinSwitchProps): import("react/jsx-runtime").JSX.Element;
28
+ displayName: string;
29
+ };
30
+ export {};
@@ -0,0 +1,75 @@
1
+ import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
+ import { useCallback as s } from "react";
3
+ import { cn as n } from "../../../lib/utils.js";
4
+ import { Pin as w } from "../../../icons/index.js";
5
+ import { useImpactNovaI18n as u } from "../../../i18n/ImpactNovaI18nContext.js";
6
+ const d = ({
7
+ value: e,
8
+ onChange: r,
9
+ disabled: t = !1,
10
+ className: l
11
+ }) => {
12
+ const { t: o } = u(), c = s(() => {
13
+ t || r(e === "left" ? "right" : "left");
14
+ }, [t, e, r]), f = s(
15
+ (a) => {
16
+ t || (a.key === " " || a.key === "Enter") && (a.preventDefault(), c());
17
+ },
18
+ [t, c]
19
+ ), p = () => o(e === "left" ? "dataTable.pinSwitchPinnedLeft" : e === "right" ? "dataTable.pinSwitchPinnedRight" : "dataTable.pinSwitchNotPinned"), h = e === "right";
20
+ return /* @__PURE__ */ m("div", { className: n("inline-flex items-center gap-2", l), children: [
21
+ /* @__PURE__ */ i(
22
+ "span",
23
+ {
24
+ className: n(
25
+ "text-[10px] font-medium leading-[14px] font-[Manrope]",
26
+ e === "left" ? "text-pinSwitch-label-active" : "text-pinSwitch-label-inactive"
27
+ ),
28
+ children: "L"
29
+ }
30
+ ),
31
+ /* @__PURE__ */ i(
32
+ "button",
33
+ {
34
+ type: "button",
35
+ role: "switch",
36
+ "aria-checked": h,
37
+ "aria-label": p(),
38
+ "aria-disabled": t,
39
+ tabIndex: t ? -1 : 0,
40
+ onClick: c,
41
+ onKeyDown: f,
42
+ disabled: t,
43
+ className: n(
44
+ "relative flex w-[44px] h-6 items-center rounded-md border border-pinSwitch-track-border bg-pinSwitch-track-bg p-0.5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-canvas",
45
+ t && "opacity-50 cursor-not-allowed",
46
+ !t && "cursor-pointer hover:bg-pinSwitch-track-hover"
47
+ ),
48
+ children: /* @__PURE__ */ i(
49
+ "div",
50
+ {
51
+ className: n(
52
+ "absolute flex w-5 h-5 p-0.5 justify-center items-center rounded bg-white shadow-elevation-pin-switch transition-all duration-200 ease-in-out",
53
+ e === "right" ? "left-[calc(100%-22px)]" : "left-0.5"
54
+ ),
55
+ children: /* @__PURE__ */ i(w, { className: "w-3 h-3 text-content" })
56
+ }
57
+ )
58
+ }
59
+ ),
60
+ /* @__PURE__ */ i(
61
+ "span",
62
+ {
63
+ className: n(
64
+ "text-[10px] font-medium leading-[14px] font-[Manrope]",
65
+ e === "right" ? "text-pinSwitch-label-active" : "text-pinSwitch-label-inactive"
66
+ ),
67
+ children: "R"
68
+ }
69
+ )
70
+ ] });
71
+ };
72
+ d.displayName = "PinSwitch";
73
+ export {
74
+ d as PinSwitch
75
+ };
@@ -1,33 +1,34 @@
1
1
  import { jsxs as C, jsx as c } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
- import { X as Y } from "lucide-react";
4
- import { CalendarMonth as Z } from "../../../icons/index.js";
3
+ import { X as Z } from "lucide-react";
4
+ import { CalendarMonth as _ } from "../../../icons/index.js";
5
5
  import { format as u, isValid as x, parse as I } from "date-fns";
6
- import { cn as _, padValidDateString as $, maskDate as F } from "../../../lib/utils.js";
7
- import { Input as ee } from "../input.js";
8
- import { Popover as te, PopoverTrigger as ne, PopoverContent as re } from "../popover.js";
9
- import { Calendar as oe } from "../calendar.js";
10
- import { Tooltip as M, TooltipTrigger as T, TooltipContent as A } from "../tooltip.js";
11
- import { getDateFnsLocale as ce } from "../../../i18n/getDateFnsLocale.js";
12
- import { useImpactNovaI18n as ie } from "../../../i18n/ImpactNovaI18nContext.js";
13
- const le = o.forwardRef(
6
+ import { cn as $, padValidDateString as F, maskDate as ee } from "../../../lib/utils.js";
7
+ import { Input as te } from "../input.js";
8
+ import { Popover as ne, PopoverTrigger as re, PopoverContent as oe } from "../popover.js";
9
+ import { Calendar as ce } from "../calendar.js";
10
+ import { Tooltip as T, TooltipTrigger as A, TooltipContent as E } from "../tooltip.js";
11
+ import { getDateFnsLocale as ie } from "../../../i18n/getDateFnsLocale.js";
12
+ import { useImpactNovaI18n as le } from "../../../i18n/ImpactNovaI18nContext.js";
13
+ const ae = o.forwardRef(
14
14
  ({
15
15
  value: t,
16
16
  onChange: f,
17
17
  format: n = "MM/dd/yyyy",
18
- placeholder: E,
19
- minDate: L,
20
- maxDate: j,
21
- startMonth: K,
18
+ placeholder: L,
19
+ minDate: j,
20
+ maxDate: K,
21
+ startMonth: B,
22
22
  endMonth: O,
23
23
  showFooter: d = !0,
24
- disabled: R,
25
- className: B,
26
- ...H
27
- }, X) => {
28
- const { locale: b, t: m } = ie(), i = o.useMemo(() => ce(b), [b]), q = E ?? m("datePicker.selectDate"), g = o.useRef(null), y = o.useRef(null);
29
- o.useImperativeHandle(X, () => g.current);
30
- const [r, l] = o.useState(!1), D = o.useRef(!1), [N, a] = o.useState(t), [s, p] = o.useState(t ? u(t, n, { locale: i }) : ""), [z, w] = o.useState(t || /* @__PURE__ */ new Date());
24
+ weekStartsOn: R,
25
+ disabled: b,
26
+ className: H,
27
+ ...X
28
+ }, q) => {
29
+ const { locale: v, t: m } = le(), i = o.useMemo(() => ie(v), [v]), z = L ?? m("datePicker.selectDate"), g = o.useRef(null), y = o.useRef(null);
30
+ o.useImperativeHandle(q, () => g.current);
31
+ const [r, l] = o.useState(!1), D = o.useRef(!1), [N, a] = o.useState(t), [s, p] = o.useState(t ? u(t, n, { locale: i }) : ""), [G, w] = o.useState(t || /* @__PURE__ */ new Date());
31
32
  o.useEffect(() => {
32
33
  g.current && y.current !== null && (g.current.setSelectionRange(y.current, y.current), y.current = null);
33
34
  }, [s]), o.useEffect(() => {
@@ -35,74 +36,74 @@ const le = o.forwardRef(
35
36
  }, [t, n, r, i]), o.useEffect(() => {
36
37
  r && (a(t), w(t || /* @__PURE__ */ new Date()));
37
38
  }, [r, t]);
38
- const G = (e) => {
39
+ const J = (e) => {
39
40
  a(e), e && p(u(e, n, { locale: i })), d || (f?.(e), l(!1));
40
- }, J = (e) => {
41
+ }, Q = (e) => {
41
42
  f?.(e !== void 0 ? e : N), l(!1);
42
- }, S = () => {
43
- a(t), p(t ? u(t, n, { locale: i }) : ""), l(!1);
44
43
  }, V = () => {
44
+ a(t), p(t ? u(t, n, { locale: i }) : ""), l(!1);
45
+ }, M = () => {
45
46
  a(void 0), p(""), f?.(void 0), d || l(!1);
46
- }, Q = (e) => {
47
- const h = e.target.value, k = F(h, n, s);
47
+ }, U = (e) => {
48
+ const h = e.target.value, k = ee(h, n, s);
48
49
  if (p(k), k === "") {
49
50
  a(void 0), d || f?.(void 0);
50
51
  return;
51
52
  }
52
53
  const P = I(k, n, /* @__PURE__ */ new Date(), { locale: i });
53
54
  x(P) && k.length === n.length && (a(P), w(P), d || f?.(P));
54
- }, U = () => {
55
+ }, W = () => {
55
56
  if (r) return;
56
- const e = $(s, n), h = I(e, n, /* @__PURE__ */ new Date(), { locale: i });
57
+ const e = F(s, n), h = I(e, n, /* @__PURE__ */ new Date(), { locale: i });
57
58
  !x(h) || e.length !== n.length ? (p(t ? u(t, n, { locale: i }) : ""), a(t)) : (p(e), d || f?.(h));
58
- }, v = (t ? u(t, n, { locale: i }) : "") !== s, W = s.length === n.length && !x(I(s, n, /* @__PURE__ */ new Date(), { locale: i }));
59
- return /* @__PURE__ */ C(te, { open: r, onOpenChange: l, children: [
60
- /* @__PURE__ */ c(ne, { asChild: !0, children: /* @__PURE__ */ c("div", { "data-component": "date-picker", "data-state": r ? "open" : "closed", "data-pending": v || void 0, children: /* @__PURE__ */ c(
61
- ee,
59
+ }, S = (t ? u(t, n, { locale: i }) : "") !== s, Y = s.length === n.length && !x(I(s, n, /* @__PURE__ */ new Date(), { locale: i }));
60
+ return /* @__PURE__ */ C(ne, { open: r, onOpenChange: l, children: [
61
+ /* @__PURE__ */ c(re, { asChild: !0, children: /* @__PURE__ */ c("div", { "data-component": "date-picker", "data-state": r ? "open" : "closed", "data-pending": S || void 0, children: /* @__PURE__ */ c(
62
+ te,
62
63
  {
63
64
  ref: g,
64
65
  value: s,
65
- onChange: Q,
66
- onBlur: U,
66
+ onChange: U,
67
+ onBlur: W,
67
68
  onClick: (e) => r && e.stopPropagation(),
68
69
  onKeyDown: (e) => {
69
- (e.key === "Enter" || e.key === "ArrowDown") && !r && (e.preventDefault(), D.current = !0, l(!0)), e.key === "Escape" && r && (e.preventDefault(), S());
70
+ (e.key === "Enter" || e.key === "ArrowDown") && !r && (e.preventDefault(), D.current = !0, l(!0)), e.key === "Escape" && r && (e.preventDefault(), V());
70
71
  },
71
- placeholder: r ? n : q,
72
- disabled: R,
72
+ placeholder: r ? n : z,
73
+ disabled: b,
73
74
  "data-form-control": "input",
74
- className: _(
75
+ className: $(
75
76
  "cursor-pointer",
76
- W ? "text-destructive" : v ? "text-content-muted" : "",
77
- B
77
+ Y ? "text-destructive" : S ? "text-content-muted" : "",
78
+ H
78
79
  ),
79
80
  suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
80
- t && !R && /* @__PURE__ */ C(M, { children: [
81
- /* @__PURE__ */ c(T, { asChild: !0, children: /* @__PURE__ */ c(
82
- Y,
81
+ t && !b && /* @__PURE__ */ C(T, { children: [
82
+ /* @__PURE__ */ c(A, { asChild: !0, children: /* @__PURE__ */ c(
83
+ Z,
83
84
  {
84
85
  className: "h-4 w-4 cursor-pointer hover:text-content",
85
86
  onClick: (e) => {
86
- e.stopPropagation(), V();
87
+ e.stopPropagation(), M();
87
88
  }
88
89
  }
89
90
  ) }),
90
- /* @__PURE__ */ c(A, { variant: "tertiary", side: "top", children: m("calendar.clear") })
91
+ /* @__PURE__ */ c(E, { variant: "tertiary", side: "top", children: m("calendar.clear") })
91
92
  ] }),
92
- /* @__PURE__ */ C(M, { children: [
93
- /* @__PURE__ */ c(T, { asChild: !0, children: /* @__PURE__ */ c("button", { type: "button", tabIndex: 0, "aria-label": m("datePicker.selectDate"), onClick: (e) => {
93
+ /* @__PURE__ */ C(T, { children: [
94
+ /* @__PURE__ */ c(A, { asChild: !0, children: /* @__PURE__ */ c("button", { type: "button", tabIndex: 0, "aria-label": m("datePicker.selectDate"), onClick: (e) => {
94
95
  e.stopPropagation(), l(!r);
95
96
  }, onKeyDown: (e) => {
96
97
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), D.current = !0, l(!r));
97
- }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ c(Z, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
98
- /* @__PURE__ */ c(A, { variant: "tertiary", side: "top", children: m("datePicker.selectDate") })
98
+ }, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ c(_, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
99
+ /* @__PURE__ */ c(E, { variant: "tertiary", side: "top", children: m("datePicker.selectDate") })
99
100
  ] })
100
101
  ] }),
101
- ...H
102
+ ...X
102
103
  }
103
104
  ) }) }),
104
105
  /* @__PURE__ */ c(
105
- re,
106
+ oe,
106
107
  {
107
108
  className: "w-auto p-0",
108
109
  align: "start",
@@ -110,21 +111,22 @@ const le = o.forwardRef(
110
111
  D.current || e.preventDefault(), D.current = !1;
111
112
  },
112
113
  children: /* @__PURE__ */ c(
113
- oe,
114
+ ce,
114
115
  {
115
116
  mode: "single",
116
117
  selected: N,
117
- onSelect: G,
118
- month: z,
118
+ onSelect: J,
119
+ month: G,
119
120
  onMonthChange: w,
120
- disabled: { before: L, after: j },
121
- startMonth: K,
121
+ disabled: { before: j, after: K },
122
+ startMonth: B,
122
123
  endMonth: O,
123
124
  showFooter: d,
124
- onApply: J,
125
- onCancel: S,
126
- onClear: V,
127
- captionLayout: "dropdown"
125
+ onApply: Q,
126
+ onCancel: V,
127
+ onClear: M,
128
+ captionLayout: "dropdown",
129
+ ...R !== void 0 ? { weekStartsOn: R } : {}
128
130
  }
129
131
  )
130
132
  }
@@ -132,7 +134,7 @@ const le = o.forwardRef(
132
134
  ] });
133
135
  }
134
136
  );
135
- le.displayName = "DatePicker";
137
+ ae.displayName = "DatePicker";
136
138
  export {
137
- le as DatePicker
139
+ ae as DatePicker
138
140
  };