impact-nova 1.7.39 → 1.7.41
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/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +58 -48
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
- package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
- package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
- package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
- package/dist/components/ui/ag-grid-react/index.js +24 -25
- package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
- package/dist/components/ui/data-table/column-indicator.js +30 -0
- package/dist/components/ui/data-table/data-table-column-list.js +210 -154
- package/dist/components/ui/data-table/data-table.js +60 -59
- package/dist/components/ui/data-table/index.d.ts +3 -0
- package/dist/components/ui/data-table/index.js +34 -28
- package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
- package/dist/components/ui/data-table/indicator-legend.js +20 -0
- package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
- package/dist/components/ui/data-table/pin-switch.js +75 -0
- package/dist/components/ui/date-picker/date-picker.js +65 -63
- package/dist/components/ui/date-picker/date-range-picker.js +77 -75
- package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
- package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
- package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
- package/dist/components/ui/nested-list/nested-list.js +184 -178
- package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
- package/dist/components/ui/types/date-picker.types.d.ts +4 -0
- package/dist/components/ui/types/nested-list.types.d.ts +12 -0
- package/dist/i18n/defaultMessages.d.ts +10 -0
- package/dist/i18n/defaultMessages.js +16 -8
- package/dist/i18n/locales/de.js +8 -0
- package/dist/i18n/locales/es.js +8 -0
- package/dist/i18n/locales/hi.js +8 -0
- package/dist/i18n/locales/kn.js +8 -0
- package/dist/icons/assets/archive.svg.js +5 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +280 -278
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +180 -174
- package/package.json +1 -1
- package/tailwind.config.js +16 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useState as l, useRef as
|
|
3
|
-
import { AgGridWrapper as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { DataTableContext as
|
|
6
|
-
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as
|
|
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
|
|
8
|
+
const C = {
|
|
9
9
|
default: 46,
|
|
10
10
|
compact: 30,
|
|
11
11
|
comfort: 52
|
|
12
|
-
},
|
|
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:
|
|
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), [
|
|
31
|
-
m.current = Math.max(0, m.current +
|
|
32
|
-
}, []), T =
|
|
33
|
-
r(
|
|
34
|
-
}, []),
|
|
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
|
-
}[
|
|
38
|
+
}[c], a = `${C[s]}px`, O = S(() => ({
|
|
39
39
|
gridApi: t,
|
|
40
40
|
registerApi: T,
|
|
41
41
|
registerScopedSheetDepth: x,
|
|
42
|
-
fontSize:
|
|
43
|
-
setFontSize:
|
|
44
|
-
numericFormat:
|
|
45
|
-
setNumericFormat:
|
|
46
|
-
rowHeight:
|
|
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
|
-
]),
|
|
58
|
+
]), D = S(() => ({
|
|
59
59
|
sheetTarget: n,
|
|
60
60
|
setSheetTarget: p,
|
|
61
61
|
scopedSheetOpen: g
|
|
62
62
|
}), [n, p, g]);
|
|
63
|
-
return /* @__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:
|
|
67
|
+
className: y("flex flex-col w-full min-h-0 rounded-[inherit]", e),
|
|
68
68
|
style: {
|
|
69
|
-
"--ag-font-size":
|
|
70
|
-
"--ag-row-height":
|
|
69
|
+
"--ag-font-size": v,
|
|
70
|
+
"--ag-row-height": a
|
|
71
71
|
},
|
|
72
72
|
children: o
|
|
73
73
|
}
|
|
74
74
|
) }) });
|
|
75
|
-
},
|
|
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 =
|
|
82
|
-
const { setSheetTarget: e, scopedSheetOpen: t } =
|
|
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:
|
|
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
|
-
} =
|
|
99
|
-
className:
|
|
100
|
-
onGridReady:
|
|
98
|
+
} = j(), { scopedSheetOpen: p } = P(), {
|
|
99
|
+
className: c,
|
|
100
|
+
onGridReady: d,
|
|
101
101
|
rowHeight: h,
|
|
102
|
-
context:
|
|
103
|
-
columnDefs:
|
|
104
|
-
maintainColumnOrder:
|
|
105
|
-
...
|
|
106
|
-
} = o,
|
|
107
|
-
...
|
|
108
|
-
formatType:
|
|
109
|
-
}), [
|
|
110
|
-
|
|
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]),
|
|
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:
|
|
117
|
+
formatType: w[n]
|
|
118
118
|
}), r.refreshCells({ force: !0 });
|
|
119
119
|
}
|
|
120
120
|
}, [n, r]);
|
|
121
|
-
const
|
|
122
|
-
e(a.api),
|
|
123
|
-
}, [e,
|
|
124
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
129
|
+
c
|
|
130
130
|
),
|
|
131
|
+
style: p ? { minHeight: R } : void 0,
|
|
131
132
|
children: [
|
|
132
133
|
/* @__PURE__ */ i(
|
|
133
|
-
|
|
134
|
+
M,
|
|
134
135
|
{
|
|
135
|
-
...
|
|
136
|
-
columnDefs:
|
|
137
|
-
rowHeight:
|
|
138
|
-
onGridReady:
|
|
139
|
-
context:
|
|
140
|
-
maintainColumnOrder:
|
|
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:
|
|
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
|
|
2
|
-
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as
|
|
3
|
-
import { DataTableColumnList as
|
|
4
|
-
import { DataTableContext as
|
|
5
|
-
import { DataTableFormatOptions as
|
|
6
|
-
import { DataTableSheet as
|
|
7
|
-
import { DataTableViewMenuContent as
|
|
8
|
-
import { DataTableSavedViews as
|
|
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
|
-
|
|
13
|
+
N as ColumnIndicator,
|
|
14
|
+
l as DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX,
|
|
11
15
|
t as DataTable,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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,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
|
|
4
|
-
import { CalendarMonth as
|
|
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
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { Tooltip as
|
|
11
|
-
import { getDateFnsLocale as
|
|
12
|
-
import { useImpactNovaI18n as
|
|
13
|
-
const
|
|
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:
|
|
19
|
-
minDate:
|
|
20
|
-
maxDate:
|
|
21
|
-
startMonth:
|
|
18
|
+
placeholder: L,
|
|
19
|
+
minDate: j,
|
|
20
|
+
maxDate: K,
|
|
21
|
+
startMonth: B,
|
|
22
22
|
endMonth: O,
|
|
23
23
|
showFooter: d = !0,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
o.
|
|
30
|
-
|
|
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
|
|
39
|
+
const J = (e) => {
|
|
39
40
|
a(e), e && p(u(e, n, { locale: i })), d || (f?.(e), l(!1));
|
|
40
|
-
},
|
|
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
|
-
},
|
|
47
|
-
const h = e.target.value, k =
|
|
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
|
-
},
|
|
55
|
+
}, W = () => {
|
|
55
56
|
if (r) return;
|
|
56
|
-
const e =
|
|
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
|
-
},
|
|
59
|
-
return /* @__PURE__ */ C(
|
|
60
|
-
/* @__PURE__ */ c(
|
|
61
|
-
|
|
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:
|
|
66
|
-
onBlur:
|
|
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(),
|
|
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 :
|
|
72
|
-
disabled:
|
|
72
|
+
placeholder: r ? n : z,
|
|
73
|
+
disabled: b,
|
|
73
74
|
"data-form-control": "input",
|
|
74
|
-
className:
|
|
75
|
+
className: $(
|
|
75
76
|
"cursor-pointer",
|
|
76
|
-
|
|
77
|
-
|
|
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 && !
|
|
81
|
-
/* @__PURE__ */ c(
|
|
82
|
-
|
|
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(),
|
|
87
|
+
e.stopPropagation(), M();
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
) }),
|
|
90
|
-
/* @__PURE__ */ c(
|
|
91
|
+
/* @__PURE__ */ c(E, { variant: "tertiary", side: "top", children: m("calendar.clear") })
|
|
91
92
|
] }),
|
|
92
|
-
/* @__PURE__ */ C(
|
|
93
|
-
/* @__PURE__ */ c(
|
|
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(
|
|
98
|
-
/* @__PURE__ */ c(
|
|
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
|
-
...
|
|
102
|
+
...X
|
|
102
103
|
}
|
|
103
104
|
) }) }),
|
|
104
105
|
/* @__PURE__ */ c(
|
|
105
|
-
|
|
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
|
-
|
|
114
|
+
ce,
|
|
114
115
|
{
|
|
115
116
|
mode: "single",
|
|
116
117
|
selected: N,
|
|
117
|
-
onSelect:
|
|
118
|
-
month:
|
|
118
|
+
onSelect: J,
|
|
119
|
+
month: G,
|
|
119
120
|
onMonthChange: w,
|
|
120
|
-
disabled: { before:
|
|
121
|
-
startMonth:
|
|
121
|
+
disabled: { before: j, after: K },
|
|
122
|
+
startMonth: B,
|
|
122
123
|
endMonth: O,
|
|
123
124
|
showFooter: d,
|
|
124
|
-
onApply:
|
|
125
|
-
onCancel:
|
|
126
|
-
onClear:
|
|
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
|
-
|
|
137
|
+
ae.displayName = "DatePicker";
|
|
136
138
|
export {
|
|
137
|
-
|
|
139
|
+
ae as DatePicker
|
|
138
140
|
};
|