impact-nova 1.3.0 → 1.5.2
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/README.md +49 -0
- package/dist/components/layout/dashboard-layout.d.ts +15 -1
- package/dist/components/ui/accordion-nested-list/accordion-nested-list.js +65 -64
- package/dist/components/ui/accordion.js +38 -34
- package/dist/components/ui/ag-grid-react/cell-renderers/badge-cell-renderer.js +1 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.d.ts +58 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/cell-renderer-utils.js +104 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/input-cell-editor.js +62 -54
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/editors/split-cell-editor.js +54 -68
- package/dist/components/ui/ag-grid-react/cell-renderers/index.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/cell-renderers/index.js +33 -27
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.d.ts +3 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/input-display-renderer.js +28 -12
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.d.ts +2 -0
- package/dist/components/ui/ag-grid-react/cell-renderers/link-with-batch-cell-renderer.js +45 -44
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.d.ts +4 -6
- package/dist/components/ui/ag-grid-react/cell-renderers/split-cell-renderer.js +23 -37
- package/dist/components/ui/ag-grid-react/cell-renderers/types.d.ts +33 -17
- package/dist/components/ui/ag-grid-react/editable-utils.d.ts +27 -0
- package/dist/components/ui/ag-grid-react/editable-utils.js +62 -0
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +99 -98
- package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +110 -143
- package/dist/components/ui/ag-grid-react/headers/column-menu/column-settings-menu.js +72 -69
- package/dist/components/ui/ag-grid-react/headers/components/header-info.js +36 -35
- package/dist/components/ui/ag-grid-react/headers/components/info-modal.js +14 -12
- package/dist/components/ui/ag-grid-react/headers/custom-header.js +111 -110
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +204 -203
- package/dist/components/ui/alert.js +62 -58
- package/dist/components/ui/breadcrumb.js +81 -74
- package/dist/components/ui/calendar.js +354 -354
- package/dist/components/ui/chart/chart.js +63 -62
- package/dist/components/ui/chips.js +42 -38
- package/dist/components/ui/command-palette/command-palette-context.d.ts +52 -0
- package/dist/components/ui/command-palette/command-palette-context.js +110 -0
- package/dist/components/ui/command-palette/command-palette.d.ts +67 -0
- package/dist/components/ui/command-palette/command-palette.js +402 -0
- package/dist/components/ui/command-palette/index.d.ts +23 -0
- package/dist/components/ui/command-palette/index.js +44 -0
- package/dist/components/ui/command-palette/kbd.d.ts +28 -0
- package/dist/components/ui/command-palette/kbd.js +52 -0
- package/dist/components/ui/command-palette/shortcut-registry.d.ts +68 -0
- package/dist/components/ui/command-palette/shortcut-registry.js +183 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.d.ts +55 -0
- package/dist/components/ui/command-palette/shortcut-scope-provider.js +55 -0
- package/dist/components/ui/command-palette/shortcut-settings.d.ts +27 -0
- package/dist/components/ui/command-palette/shortcut-settings.js +266 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.d.ts +32 -0
- package/dist/components/ui/command-palette/use-browser-shortcuts.js +48 -0
- package/dist/components/ui/command-palette/use-global-shortcut.d.ts +3 -0
- package/dist/components/ui/command-palette/use-global-shortcut.js +7 -0
- package/dist/components/ui/command-palette/use-shortcut.d.ts +47 -0
- package/dist/components/ui/command-palette/use-shortcut.js +49 -0
- package/dist/components/ui/command-palette/utils.d.ts +119 -0
- package/dist/components/ui/command-palette/utils.js +248 -0
- package/dist/components/ui/data-table/data-table-column-list.js +87 -86
- package/dist/components/ui/data-table/data-table-format-options.js +45 -44
- package/dist/components/ui/data-table/data-table-view-options.js +39 -38
- package/dist/components/ui/date-picker/date-picker.js +89 -87
- package/dist/components/ui/date-picker/date-range-picker.js +140 -138
- package/dist/components/ui/date-picker/month-picker.js +82 -81
- package/dist/components/ui/date-picker/month-range-picker.js +108 -105
- package/dist/components/ui/date-picker/multi-date-picker.js +68 -66
- package/dist/components/ui/date-picker/multi-month-picker.js +59 -58
- package/dist/components/ui/date-picker/multi-week-picker.js +80 -78
- package/dist/components/ui/date-picker/week-picker.js +117 -115
- package/dist/components/ui/date-picker/week-range-picker.js +166 -164
- package/dist/components/ui/dialog.js +78 -73
- package/dist/components/ui/drawer.js +71 -66
- package/dist/components/ui/file-upload.js +131 -127
- package/dist/components/ui/filter-panel/filter-panel.js +98 -94
- package/dist/components/ui/filter-strip/filter-strip.js +95 -91
- package/dist/components/ui/filter-strip/filter-summary.js +91 -90
- package/dist/components/ui/header.js +57 -53
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +78 -76
- package/dist/components/ui/loader.js +17 -16
- package/dist/components/ui/nested-list/components/NestedListHeader.d.ts +1 -0
- package/dist/components/ui/nested-list/components/NestedListHeader.js +51 -48
- package/dist/components/ui/nested-list/components/SortableItem.js +60 -59
- package/dist/components/ui/nested-list/nested-list.js +184 -182
- package/dist/components/ui/notification-panel/notification-panel.js +60 -53
- package/dist/components/ui/popover.js +45 -40
- package/dist/components/ui/prompt.js +90 -86
- package/dist/components/ui/select/select.js +206 -209
- package/dist/components/ui/sheet.d.ts +1 -0
- package/dist/components/ui/sheet.js +50 -48
- package/dist/components/ui/sidebar.js +273 -267
- package/dist/components/ui/stepper.js +75 -63
- package/dist/components/ui/tag.js +48 -44
- package/dist/components/ui/toast.js +46 -41
- package/dist/i18n/ImpactNovaI18nContext.d.ts +21 -0
- package/dist/i18n/ImpactNovaI18nContext.js +76 -0
- package/dist/i18n/defaultMessages.d.ts +231 -0
- package/dist/i18n/defaultMessages.js +206 -0
- package/dist/i18n/getDateFnsLocale.d.ts +11 -0
- package/dist/i18n/getDateFnsLocale.js +21 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.js +206 -0
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.js +206 -0
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.js +206 -0
- package/dist/i18n/locales/index.d.ts +4 -0
- package/dist/i18n/locales/kn.d.ts +2 -0
- package/dist/i18n/locales/kn.js +206 -0
- package/dist/icons/assets/boxAdd.svg.js +5 -0
- package/dist/icons/assets/boxed.svg.js +5 -0
- package/dist/icons/assets/trolley.svg.js +5 -0
- package/dist/icons/assets/unlocked.svg.js +5 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +179 -171
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +232 -172
- package/package.json +36 -4
- package/dist/components/ui/ag-grid-react/cell-renderers/types.js +0 -74
|
@@ -1,86 +1,91 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a, jsxs as n } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
|
-
import { Drawer as
|
|
4
|
-
import { X as
|
|
3
|
+
import { Drawer as t } from "vaul";
|
|
4
|
+
import { X as f } from "lucide-react";
|
|
5
5
|
import { cn as s } from "../../lib/utils.js";
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
|
|
6
|
+
import { Tooltip as g, TooltipTrigger as w, TooltipContent as u } from "./tooltip.js";
|
|
7
|
+
import { useImpactNovaI18n as N } from "../../i18n/ImpactNovaI18nContext.js";
|
|
8
|
+
const x = ({
|
|
8
9
|
shouldScaleBackground: e = !0,
|
|
9
10
|
...r
|
|
10
|
-
}) => /* @__PURE__ */
|
|
11
|
-
|
|
11
|
+
}) => /* @__PURE__ */ a(
|
|
12
|
+
t.Root,
|
|
12
13
|
{
|
|
13
14
|
shouldScaleBackground: e,
|
|
14
15
|
...r
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
x.displayName = "Drawer";
|
|
19
|
+
const F = t.Trigger, D = t.Portal, H = t.Close, c = i.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ a(
|
|
20
|
+
t.Overlay,
|
|
20
21
|
{
|
|
21
22
|
ref: o,
|
|
22
23
|
className: s("fixed inset-0 z-50 bg-black/80", e),
|
|
23
24
|
...r
|
|
24
25
|
}
|
|
25
26
|
));
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
/* @__PURE__ */ n(
|
|
30
|
-
a
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
]
|
|
59
|
-
|
|
60
|
-
|
|
27
|
+
c.displayName = t.Overlay.displayName;
|
|
28
|
+
const y = i.forwardRef(({ className: e, children: r, hideClose: o, ...d }, m) => {
|
|
29
|
+
const { t: p } = N(), l = p("aria.close");
|
|
30
|
+
return /* @__PURE__ */ n(D, { children: [
|
|
31
|
+
/* @__PURE__ */ a(c, {}),
|
|
32
|
+
/* @__PURE__ */ n(
|
|
33
|
+
t.Content,
|
|
34
|
+
{
|
|
35
|
+
ref: m,
|
|
36
|
+
"data-component": "drawer-content",
|
|
37
|
+
className: s(
|
|
38
|
+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
|
|
39
|
+
e
|
|
40
|
+
),
|
|
41
|
+
...d,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ a("div", { className: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" }),
|
|
44
|
+
r,
|
|
45
|
+
!o && /* @__PURE__ */ n(g, { children: [
|
|
46
|
+
/* @__PURE__ */ a(w, { asChild: !0, children: /* @__PURE__ */ n(
|
|
47
|
+
t.Close,
|
|
48
|
+
{
|
|
49
|
+
className: "absolute right-4 top-4 rounded-sm opacity-50 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
50
|
+
"aria-label": l,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ a(f, { className: "h-4 w-4" }),
|
|
53
|
+
/* @__PURE__ */ a("span", { className: "sr-only", children: l })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
) }),
|
|
57
|
+
/* @__PURE__ */ a(u, { variant: "tertiary", side: "top", children: l })
|
|
58
|
+
] })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
] });
|
|
63
|
+
});
|
|
64
|
+
y.displayName = "DrawerContent";
|
|
65
|
+
const b = ({
|
|
61
66
|
className: e,
|
|
62
67
|
...r
|
|
63
|
-
}) => /* @__PURE__ */
|
|
68
|
+
}) => /* @__PURE__ */ a(
|
|
64
69
|
"div",
|
|
65
70
|
{
|
|
66
71
|
className: s("grid gap-1.5 p-4 text-center sm:text-left", e),
|
|
67
72
|
...r
|
|
68
73
|
}
|
|
69
74
|
);
|
|
70
|
-
|
|
71
|
-
const
|
|
75
|
+
b.displayName = "DrawerHeader";
|
|
76
|
+
const h = ({
|
|
72
77
|
className: e,
|
|
73
78
|
...r
|
|
74
|
-
}) => /* @__PURE__ */
|
|
79
|
+
}) => /* @__PURE__ */ a(
|
|
75
80
|
"div",
|
|
76
81
|
{
|
|
77
82
|
className: s("mt-auto flex flex-col gap-2 p-4", e),
|
|
78
83
|
...r
|
|
79
84
|
}
|
|
80
85
|
);
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
86
|
+
h.displayName = "DrawerFooter";
|
|
87
|
+
const v = i.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ a(
|
|
88
|
+
t.Title,
|
|
84
89
|
{
|
|
85
90
|
ref: o,
|
|
86
91
|
"data-component": "drawer-title",
|
|
@@ -91,9 +96,9 @@ const y = i.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ t(
|
|
|
91
96
|
...r
|
|
92
97
|
}
|
|
93
98
|
));
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
99
|
+
v.displayName = t.Title.displayName;
|
|
100
|
+
const T = i.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ a(
|
|
101
|
+
t.Description,
|
|
97
102
|
{
|
|
98
103
|
ref: o,
|
|
99
104
|
"data-component": "drawer-description",
|
|
@@ -101,16 +106,16 @@ const h = i.forwardRef(({ className: e, ...r }, o) => /* @__PURE__ */ t(
|
|
|
101
106
|
...r
|
|
102
107
|
}
|
|
103
108
|
));
|
|
104
|
-
|
|
109
|
+
T.displayName = t.Description.displayName;
|
|
105
110
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
x as Drawer,
|
|
112
|
+
H as DrawerClose,
|
|
113
|
+
y as DrawerContent,
|
|
114
|
+
T as DrawerDescription,
|
|
115
|
+
h as DrawerFooter,
|
|
116
|
+
b as DrawerHeader,
|
|
117
|
+
c as DrawerOverlay,
|
|
118
|
+
D as DrawerPortal,
|
|
119
|
+
v as DrawerTitle,
|
|
120
|
+
F as DrawerTrigger
|
|
116
121
|
};
|
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as m, Fragment as T } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Cross as
|
|
3
|
+
import { cn as p } from "../../lib/utils.js";
|
|
4
|
+
import { Cross as k, FileUpload as I, Delete as L, Document as B, Text as M, Csv as A, Excel as O } from "../../icons/index.js";
|
|
5
5
|
import { Tooltip as U, TooltipTrigger as C, TooltipContent as D } from "./tooltip.js";
|
|
6
|
-
|
|
6
|
+
import { useImpactNovaI18n as z } from "../../i18n/ImpactNovaI18nContext.js";
|
|
7
|
+
const R = o.createContext(
|
|
7
8
|
void 0
|
|
8
|
-
),
|
|
9
|
-
const a = o.useContext(
|
|
9
|
+
), j = () => {
|
|
10
|
+
const a = o.useContext(R);
|
|
10
11
|
if (!a)
|
|
11
12
|
throw new Error("useFileUpload must be used within a FileUpload component");
|
|
12
13
|
return a;
|
|
13
|
-
},
|
|
14
|
+
}, S = o.forwardRef(
|
|
14
15
|
({
|
|
15
16
|
className: a,
|
|
16
17
|
children: t,
|
|
17
18
|
onFilesChange: l,
|
|
18
19
|
maxFiles: r = 1,
|
|
19
|
-
accept:
|
|
20
|
-
disabled:
|
|
21
|
-
value:
|
|
22
|
-
...
|
|
20
|
+
accept: d = [],
|
|
21
|
+
disabled: c = !1,
|
|
22
|
+
value: u = [],
|
|
23
|
+
...f
|
|
23
24
|
}, N) => {
|
|
24
|
-
const [
|
|
25
|
+
const [x, h] = o.useState(u);
|
|
25
26
|
o.useEffect(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
let
|
|
31
|
-
|
|
27
|
+
h(u);
|
|
28
|
+
}, [u]);
|
|
29
|
+
const i = (v) => {
|
|
30
|
+
if (c) return;
|
|
31
|
+
let n = v;
|
|
32
|
+
d.length > 0 && (n = n.filter((b) => {
|
|
32
33
|
const y = b.name.split(".").pop()?.toLowerCase();
|
|
33
|
-
return y &&
|
|
34
|
+
return y && d.includes(y);
|
|
34
35
|
}));
|
|
35
|
-
const F = r -
|
|
36
|
+
const F = r - x.length;
|
|
36
37
|
if (F <= 0) return;
|
|
37
|
-
const w =
|
|
38
|
+
const w = n.slice(0, F);
|
|
38
39
|
if (w.length > 0) {
|
|
39
|
-
const b = [...
|
|
40
|
-
|
|
40
|
+
const b = [...x, ...w];
|
|
41
|
+
h(b), l?.(b);
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
43
|
+
}, g = (v) => {
|
|
44
|
+
if (c) return;
|
|
45
|
+
const n = x.filter((F) => F !== v);
|
|
46
|
+
h(n), l?.(n);
|
|
46
47
|
};
|
|
47
48
|
return /* @__PURE__ */ e(
|
|
48
|
-
|
|
49
|
+
R.Provider,
|
|
49
50
|
{
|
|
50
|
-
value: { files:
|
|
51
|
+
value: { files: x, addFiles: i, removeFile: g, maxFiles: r, accept: d, disabled: c },
|
|
51
52
|
children: /* @__PURE__ */ e(
|
|
52
53
|
"div",
|
|
53
54
|
{
|
|
54
55
|
ref: N,
|
|
55
|
-
className:
|
|
56
|
+
className: p("w-full max-w-[550px]", a),
|
|
56
57
|
"data-component": "file-upload",
|
|
57
|
-
"data-disabled":
|
|
58
|
-
...
|
|
58
|
+
"data-disabled": c || void 0,
|
|
59
|
+
...f,
|
|
59
60
|
children: t
|
|
60
61
|
}
|
|
61
62
|
)
|
|
@@ -63,12 +64,12 @@ const z = o.createContext(
|
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
);
|
|
66
|
-
|
|
67
|
-
const
|
|
67
|
+
S.displayName = "FileUpload";
|
|
68
|
+
const _ = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__ */ e(
|
|
68
69
|
"div",
|
|
69
70
|
{
|
|
70
71
|
ref: r,
|
|
71
|
-
className:
|
|
72
|
+
className: p(
|
|
72
73
|
"flex flex-col gap-4 p-4 min-h-[274px] bg-card border border-border rounded-2xl shadow-[0px_0px_16px_2px_rgba(0,0,0,0.0588)]",
|
|
73
74
|
a
|
|
74
75
|
),
|
|
@@ -76,101 +77,104 @@ const S = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__
|
|
|
76
77
|
children: t
|
|
77
78
|
}
|
|
78
79
|
));
|
|
79
|
-
|
|
80
|
-
const
|
|
80
|
+
_.displayName = "FileUploadContent";
|
|
81
|
+
const E = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__ */ e(
|
|
81
82
|
"div",
|
|
82
83
|
{
|
|
83
84
|
ref: r,
|
|
84
|
-
className:
|
|
85
|
+
className: p("flex justify-between items-center w-full", a),
|
|
85
86
|
...l,
|
|
86
87
|
children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-[2px] w-full", children: t })
|
|
87
88
|
}
|
|
88
89
|
));
|
|
89
|
-
|
|
90
|
-
const
|
|
90
|
+
E.displayName = "FileUploadHeader";
|
|
91
|
+
const H = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__ */ e(
|
|
91
92
|
"h3",
|
|
92
93
|
{
|
|
93
94
|
ref: r,
|
|
94
|
-
className:
|
|
95
|
+
className: p("text-base font-extrabold text-foreground leading-6", a),
|
|
95
96
|
...l,
|
|
96
97
|
children: t
|
|
97
98
|
}
|
|
98
99
|
));
|
|
99
|
-
|
|
100
|
-
const
|
|
100
|
+
H.displayName = "FileUploadTitle";
|
|
101
|
+
const P = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__ */ e(
|
|
101
102
|
"p",
|
|
102
103
|
{
|
|
103
104
|
ref: r,
|
|
104
|
-
className:
|
|
105
|
+
className: p("text-sm font-medium text-[#7a8294] leading-5", a),
|
|
105
106
|
...l,
|
|
106
107
|
children: t
|
|
107
108
|
}
|
|
108
109
|
));
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
110
|
+
P.displayName = "FileUploadDescription";
|
|
111
|
+
const Z = o.forwardRef(({ className: a, ...t }, l) => {
|
|
112
|
+
const { t: r } = z(), d = r("aria.close");
|
|
113
|
+
return /* @__PURE__ */ m(U, { children: [
|
|
114
|
+
/* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ e(
|
|
115
|
+
"button",
|
|
116
|
+
{
|
|
117
|
+
ref: l,
|
|
118
|
+
className: p("text-[#60697d] hover:text-[#0d152c] transition-colors", a),
|
|
119
|
+
type: "button",
|
|
120
|
+
"aria-label": d,
|
|
121
|
+
...t,
|
|
122
|
+
children: /* @__PURE__ */ e(k, { size: 16 })
|
|
123
|
+
}
|
|
124
|
+
) }),
|
|
125
|
+
/* @__PURE__ */ e(D, { side: "top", variant: "tertiary", children: d })
|
|
126
|
+
] });
|
|
127
|
+
});
|
|
128
|
+
Z.displayName = "FileUploadClose";
|
|
129
|
+
const $ = o.forwardRef(
|
|
130
|
+
({ className: a, label: t, subLabel: l, ...r }, d) => {
|
|
131
|
+
const { addFiles: c, accept: u, disabled: f, files: N, maxFiles: x } = j(), [h, i] = o.useState(!1), g = o.useRef(null);
|
|
132
|
+
if (N.length >= x)
|
|
129
133
|
return null;
|
|
130
|
-
const
|
|
131
|
-
s.preventDefault(),
|
|
132
|
-
},
|
|
133
|
-
s.preventDefault(),
|
|
134
|
+
const v = (s) => {
|
|
135
|
+
s.preventDefault(), f || i(!0);
|
|
136
|
+
}, n = (s) => {
|
|
137
|
+
s.preventDefault(), i(!1);
|
|
134
138
|
}, F = (s) => {
|
|
135
|
-
s.preventDefault(),
|
|
139
|
+
s.preventDefault(), i(!1), !f && s.dataTransfer.files?.length && c(Array.from(s.dataTransfer.files));
|
|
136
140
|
}, w = () => {
|
|
137
|
-
|
|
141
|
+
f || g.current?.click();
|
|
138
142
|
}, b = (s) => {
|
|
139
|
-
s.target.files?.length && (
|
|
140
|
-
}, y =
|
|
141
|
-
return /* @__PURE__ */
|
|
143
|
+
s.target.files?.length && (c(Array.from(s.target.files)), s.target.value = "");
|
|
144
|
+
}, y = u.length > 0 ? u.map((s) => `.${s}`).join(",") : void 0;
|
|
145
|
+
return /* @__PURE__ */ m(
|
|
142
146
|
"div",
|
|
143
147
|
{
|
|
144
|
-
ref:
|
|
148
|
+
ref: d,
|
|
145
149
|
onClick: w,
|
|
146
|
-
onDragOver:
|
|
147
|
-
onDragLeave:
|
|
150
|
+
onDragOver: v,
|
|
151
|
+
onDragLeave: n,
|
|
148
152
|
onDrop: F,
|
|
149
|
-
className:
|
|
153
|
+
className: p(
|
|
150
154
|
"relative flex flex-col items-center justify-end p-4 pt-6 pb-6 gap-2 h-[148px] rounded-lg border border-dashed border-[#b3bdf8] bg-transparent cursor-pointer transition-colors",
|
|
151
|
-
|
|
152
|
-
|
|
155
|
+
h && "border-primary bg-primary/5",
|
|
156
|
+
f && "opacity-50 cursor-not-allowed",
|
|
153
157
|
a
|
|
154
158
|
),
|
|
155
159
|
"data-component": "file-upload-dropzone",
|
|
156
|
-
"data-state":
|
|
160
|
+
"data-state": h ? "drag-over" : "idle",
|
|
157
161
|
...r,
|
|
158
162
|
children: [
|
|
159
163
|
/* @__PURE__ */ e(
|
|
160
164
|
"input",
|
|
161
165
|
{
|
|
162
|
-
ref:
|
|
166
|
+
ref: g,
|
|
163
167
|
type: "file",
|
|
164
168
|
multiple: !0,
|
|
165
169
|
className: "hidden",
|
|
166
170
|
accept: y,
|
|
167
171
|
onChange: b,
|
|
168
|
-
disabled:
|
|
172
|
+
disabled: f
|
|
169
173
|
}
|
|
170
174
|
),
|
|
171
|
-
/* @__PURE__ */ e("div", { className: "absolute top-[24px] left-1/2 -translate-x-1/2 pointer-events-none", children: /* @__PURE__ */ e(
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-[#1f2b4d] leading-5", children: t || /* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ e("div", { className: "absolute top-[24px] left-1/2 -translate-x-1/2 pointer-events-none", children: /* @__PURE__ */ e(I, { size: 56 }) }),
|
|
176
|
+
/* @__PURE__ */ m("div", { className: "text-center space-y-1 z-10 mt-auto", children: [
|
|
177
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-[#1f2b4d] leading-5", children: t || /* @__PURE__ */ m(T, { children: [
|
|
174
178
|
"Drag your files here or",
|
|
175
179
|
" ",
|
|
176
180
|
/* @__PURE__ */ e("span", { className: "text-primary font-bold hover:underline", children: "Choose File" })
|
|
@@ -182,35 +186,35 @@ const Z = o.forwardRef(
|
|
|
182
186
|
);
|
|
183
187
|
}
|
|
184
188
|
);
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
({ className: a, file: t, onRemove: l, ...r },
|
|
190
|
-
const { removeFile:
|
|
191
|
-
i.stopPropagation(), l ? l() :
|
|
192
|
-
},
|
|
189
|
+
$.displayName = "FileUploadDropZone";
|
|
190
|
+
const G = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__ */ e("div", { ref: r, className: p("flex flex-col gap-3", a), ...l, children: t }));
|
|
191
|
+
G.displayName = "FileUploadList";
|
|
192
|
+
const K = o.forwardRef(
|
|
193
|
+
({ className: a, file: t, onRemove: l, ...r }, d) => {
|
|
194
|
+
const { t: c } = z(), { removeFile: u, disabled: f } = j(), N = (i) => {
|
|
195
|
+
i.stopPropagation(), l ? l() : u(t);
|
|
196
|
+
}, x = (i) => {
|
|
193
197
|
if (i === 0) return "0 B";
|
|
194
|
-
const
|
|
195
|
-
return parseFloat((i / Math.pow(
|
|
196
|
-
},
|
|
198
|
+
const g = 1024, v = ["B", "KB", "MB", "GB"], n = Math.floor(Math.log(i) / Math.log(g));
|
|
199
|
+
return parseFloat((i / Math.pow(g, n)).toFixed(2)) + " " + v[n];
|
|
200
|
+
}, h = (i) => {
|
|
197
201
|
switch (i.split(".").pop()?.toLowerCase()) {
|
|
198
202
|
case "xls":
|
|
199
203
|
case "xlsx":
|
|
200
|
-
return /* @__PURE__ */ e(
|
|
204
|
+
return /* @__PURE__ */ e(O, { size: 36 });
|
|
201
205
|
case "csv":
|
|
202
|
-
return /* @__PURE__ */ e(
|
|
206
|
+
return /* @__PURE__ */ e(A, { size: 36 });
|
|
203
207
|
case "txt":
|
|
204
|
-
return /* @__PURE__ */ e(
|
|
208
|
+
return /* @__PURE__ */ e(M, { size: 36 });
|
|
205
209
|
default:
|
|
206
|
-
return /* @__PURE__ */ e(
|
|
210
|
+
return /* @__PURE__ */ e(B, { size: 36, className: "text-gray-400" });
|
|
207
211
|
}
|
|
208
212
|
};
|
|
209
213
|
return /* @__PURE__ */ e(
|
|
210
214
|
"div",
|
|
211
215
|
{
|
|
212
|
-
ref:
|
|
213
|
-
className:
|
|
216
|
+
ref: d,
|
|
217
|
+
className: p(
|
|
214
218
|
"flex flex-col justify-between items-stretch gap-2 p-4 border border-[#e7e7e7] rounded-xl bg-white",
|
|
215
219
|
a
|
|
216
220
|
),
|
|
@@ -218,55 +222,55 @@ const G = o.forwardRef(
|
|
|
218
222
|
"data-file-name": t.name,
|
|
219
223
|
"data-file-size": t.size,
|
|
220
224
|
...r,
|
|
221
|
-
children: /* @__PURE__ */
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */ e("div", { className: "w-9 h-9 shrink-0", children:
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
children: /* @__PURE__ */ m("div", { className: "flex justify-between items-center gap-2 z-10", children: [
|
|
226
|
+
/* @__PURE__ */ m("div", { className: "flex gap-2 min-w-0", children: [
|
|
227
|
+
/* @__PURE__ */ e("div", { className: "w-9 h-9 shrink-0", children: h(t.name) }),
|
|
228
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col justify-between gap-[2px] min-w-0", children: [
|
|
229
|
+
/* @__PURE__ */ m(U, { children: [
|
|
226
230
|
/* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "text-xs font-bold text-[#0b0b0b] leading-[18px] line-clamp-1 break-all cursor-default", children: t.name }) }),
|
|
227
231
|
/* @__PURE__ */ e(D, { side: "top", variant: "tertiary", children: t.name })
|
|
228
232
|
] }),
|
|
229
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-[#6d6d6d] leading-[16px]", children:
|
|
233
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-medium text-[#6d6d6d] leading-[16px]", children: x(t.size) })
|
|
230
234
|
] })
|
|
231
235
|
] }),
|
|
232
|
-
!
|
|
236
|
+
!f && /* @__PURE__ */ m(U, { children: [
|
|
233
237
|
/* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ e(
|
|
234
238
|
"button",
|
|
235
239
|
{
|
|
236
|
-
onClick:
|
|
240
|
+
onClick: N,
|
|
237
241
|
className: "flex items-center justify-center text-[#60697d] hover:text-destructive transition-colors",
|
|
238
242
|
type: "button",
|
|
239
|
-
"aria-label": "
|
|
240
|
-
children: /* @__PURE__ */ e(
|
|
243
|
+
"aria-label": c("aria.removeFile"),
|
|
244
|
+
children: /* @__PURE__ */ e(L, { size: 14 })
|
|
241
245
|
}
|
|
242
246
|
) }),
|
|
243
|
-
/* @__PURE__ */ e(D, { side: "top", variant: "tertiary", children: "
|
|
247
|
+
/* @__PURE__ */ e(D, { side: "top", variant: "tertiary", children: c("aria.removeFile") })
|
|
244
248
|
] })
|
|
245
249
|
] })
|
|
246
250
|
}
|
|
247
251
|
);
|
|
248
252
|
}
|
|
249
253
|
);
|
|
250
|
-
|
|
251
|
-
const
|
|
254
|
+
K.displayName = "FileUploadItem";
|
|
255
|
+
const q = o.forwardRef(({ className: a, children: t, ...l }, r) => /* @__PURE__ */ e(
|
|
252
256
|
"div",
|
|
253
257
|
{
|
|
254
258
|
ref: r,
|
|
255
|
-
className:
|
|
259
|
+
className: p("flex items-center justify-end gap-4 mt-auto", a),
|
|
256
260
|
...l,
|
|
257
261
|
children: t
|
|
258
262
|
}
|
|
259
263
|
));
|
|
260
|
-
|
|
264
|
+
q.displayName = "FileUploadFooter";
|
|
261
265
|
export {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
S as FileUpload,
|
|
267
|
+
Z as FileUploadClose,
|
|
268
|
+
_ as FileUploadContent,
|
|
269
|
+
P as FileUploadDescription,
|
|
270
|
+
$ as FileUploadDropZone,
|
|
271
|
+
q as FileUploadFooter,
|
|
272
|
+
E as FileUploadHeader,
|
|
273
|
+
K as FileUploadItem,
|
|
274
|
+
G as FileUploadList,
|
|
275
|
+
H as FileUploadTitle
|
|
272
276
|
};
|