impact-nova 2.1.0-alpha.9 → 2.2.1
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 +6 -0
- package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-editor.js +73 -94
- package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-focus.d.ts +53 -0
- package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-focus.js +98 -0
- package/dist/components/data/ag-grid-react/headers/column-menu/column-settings-menu.js +15 -13
- package/dist/components/data/ag-grid-react/headers/custom-header.js +56 -58
- package/dist/components/data/ag-grid-react/headers/custom-inner-header-group.d.ts +12 -0
- package/dist/components/data/ag-grid-react/headers/custom-inner-header-group.js +31 -0
- package/dist/components/data/ag-grid-react/headers/header-search-active-state.d.ts +10 -0
- package/dist/components/data/ag-grid-react/headers/header-search-active-state.js +38 -0
- package/dist/components/data/ag-grid-react/index.js +166 -163
- package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +3 -4
- package/dist/components/data/ag-grid-react/theme.js +0 -2
- package/dist/components/data/data-table/data-table-column-list.js +1 -1
- package/dist/components/data/data-table/data-table-saved-views.js +1 -1
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +7 -6
- package/dist/components/data/nested-list/components/SortableItem.d.ts +3 -1
- package/dist/components/data/nested-list/components/SortableItem.js +111 -109
- package/dist/components/data-display/calendar/calendar-footer-emphasis.d.ts +28 -0
- package/dist/components/data-display/calendar/calendar-footer-emphasis.js +8 -0
- package/dist/components/data-display/calendar/calendar-footer.d.ts +4 -1
- package/dist/components/data-display/calendar/calendar-footer.js +60 -38
- package/dist/components/data-display/calendar/calendar.js +86 -82
- package/dist/components/data-display/calendar/calendar.types.d.ts +2 -0
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +3 -0
- package/dist/components/feedback/tooltip/tab-tooltip-render.js +3 -2
- package/dist/components/flows/filter-strip/filter-strip.js +36 -29
- package/dist/components/flows/filter-strip/filter-summary.js +2 -2
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +118 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +164 -0
- package/dist/components/forms/date-picker/date-picker.js +202 -138
- package/dist/components/forms/date-picker/date-range-picker.js +302 -215
- package/dist/components/forms/date-picker/month-picker.js +160 -119
- package/dist/components/forms/date-picker/month-range-picker.js +302 -245
- package/dist/components/forms/date-picker/multi-date-picker.js +94 -80
- package/dist/components/forms/date-picker/multi-month-picker.js +97 -83
- package/dist/components/forms/date-picker/multi-week-picker.js +107 -93
- package/dist/components/forms/date-picker/week-picker.js +230 -140
- package/dist/components/forms/date-picker/week-range-picker.js +332 -226
- package/dist/components/forms/file-upload/file-upload.js +312 -174
- package/dist/components/forms/file-upload/file-upload.types.d.ts +17 -2
- package/dist/components/layout/dynamic-layout/dynamic-layout.variants.d.ts +1 -1
- package/dist/components/layout/header/header.js +45 -38
- package/dist/components/layout/horizontal-scroller/index.d.ts +1 -0
- package/dist/components/layout/horizontal-scroller/index.js +3 -2
- package/dist/components/ui/local-raster-icons/assets/excel-error-icon.webp.js +4 -0
- package/dist/components/ui/local-raster-icons/assets/file-upload-error.webp.js +4 -0
- package/dist/components/ui/local-raster-icons/rasterIcons.d.ts +2 -0
- package/dist/components/ui/local-raster-icons/rasterIcons.js +32 -22
- package/dist/components/ui/show.d.ts +10 -0
- package/dist/components/ui/show.js +7 -0
- package/dist/components/ui/show.types.d.ts +5 -0
- package/dist/i18n/defaultMessages.d.ts +17 -0
- package/dist/i18n/defaultMessages.js +29 -17
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/locales/de.js +12 -0
- package/dist/i18n/locales/es.js +12 -0
- package/dist/i18n/locales/hi.js +12 -0
- package/dist/i18n/locales/kn.js +12 -0
- package/dist/impact-nova-base.scss +6 -2
- package/dist/impact-nova-components.css +141 -16
- package/dist/impact-nova-tokens.scss +12 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +273 -271
- package/dist/lib/utils.js +40 -24
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/dist/tailwind.config.js +36 -4
- package/dist/theme/tailwind-colors.js +3 -1
- package/package.json +15 -6
- package/tailwind.config.d.ts +3 -0
- package/dist/components/data/ag-grid-react/headers/custom-header-group.d.ts +0 -10
- package/dist/components/data/ag-grid-react/headers/custom-header-group.js +0 -58
|
@@ -1,276 +1,414 @@
|
|
|
1
|
-
import { jsx as e, jsxs as c, Fragment as
|
|
2
|
-
import * as
|
|
3
|
-
import { createComponent as
|
|
4
|
-
import { createCompoundPart as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Cross as
|
|
7
|
-
import { FileUpload as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { useImpactNovaI18n as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as K } from "react/jsx-runtime";
|
|
2
|
+
import * as g from "react";
|
|
3
|
+
import { createComponent as j } from "../../../lib/primitives/create-component.js";
|
|
4
|
+
import { createCompoundPart as A } from "../../../lib/primitives/create-compound.js";
|
|
5
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
6
|
+
import { Cross as P, Delete as Y, Reset as _, Download as q, Document as H } from "impact-nova-icons";
|
|
7
|
+
import { FileUploadError as J, FileUpload as Q, ExcelErrorIcon as V, Text as W, Csv as X, Excel as ee } from "../../ui/local-raster-icons/rasterIcons.js";
|
|
8
|
+
import { Tooltip as z, TooltipTrigger as D, TooltipContent as T } from "../../feedback/tooltip/tooltip.js";
|
|
9
|
+
import { useImpactNovaI18n as M } from "../../../i18n/use-impact-nova-i18n.js";
|
|
10
|
+
import { Progress as te } from "../../primitives/progress/progress.js";
|
|
11
|
+
import { Show as f } from "../../ui/show.js";
|
|
12
|
+
function Z(i, l) {
|
|
13
|
+
const r = i.name.split(".").pop()?.toLowerCase();
|
|
14
|
+
return !!(r && l.includes(r));
|
|
15
|
+
}
|
|
16
|
+
const $ = g.createContext(void 0), le = [], G = () => {
|
|
17
|
+
const i = g.useContext($);
|
|
18
|
+
if (!i)
|
|
13
19
|
throw new Error("useFileUpload must be used within a FileUpload component");
|
|
14
|
-
return
|
|
15
|
-
},
|
|
20
|
+
return i;
|
|
21
|
+
}, ue = j(
|
|
16
22
|
"FileUpload",
|
|
17
23
|
({
|
|
18
|
-
className:
|
|
19
|
-
children:
|
|
20
|
-
onFilesChange:
|
|
21
|
-
maxFiles:
|
|
22
|
-
accept:
|
|
23
|
-
disabled:
|
|
24
|
-
value:
|
|
25
|
-
...
|
|
26
|
-
},
|
|
27
|
-
const [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
const x = (
|
|
32
|
-
if (
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
u(N), l?.(N);
|
|
24
|
+
className: i,
|
|
25
|
+
children: l,
|
|
26
|
+
onFilesChange: r,
|
|
27
|
+
maxFiles: p = 1,
|
|
28
|
+
accept: d = [],
|
|
29
|
+
disabled: u = !1,
|
|
30
|
+
value: h = le,
|
|
31
|
+
...b
|
|
32
|
+
}, m) => {
|
|
33
|
+
const [U, s] = g.useState(h);
|
|
34
|
+
g.useEffect(() => {
|
|
35
|
+
s(h);
|
|
36
|
+
}, [h]);
|
|
37
|
+
const x = (t) => {
|
|
38
|
+
if (u) return;
|
|
39
|
+
let o = t;
|
|
40
|
+
if (d.length > 0 && (o = o.filter(
|
|
41
|
+
(N) => Z(N, d)
|
|
42
|
+
)), o.length === 0) return;
|
|
43
|
+
const F = p - U.length;
|
|
44
|
+
if (F <= 0) return;
|
|
45
|
+
const C = o.slice(0, F);
|
|
46
|
+
if (C.length > 0) {
|
|
47
|
+
const N = [...U, ...C];
|
|
48
|
+
s(N), r?.(N);
|
|
44
49
|
}
|
|
45
|
-
},
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
|
|
50
|
+
}, w = (t) => {
|
|
51
|
+
if (u) return;
|
|
52
|
+
const o = U.filter((F) => F !== t);
|
|
53
|
+
s(o), r?.(o);
|
|
49
54
|
};
|
|
50
55
|
return /* @__PURE__ */ e(
|
|
51
|
-
|
|
56
|
+
$.Provider,
|
|
52
57
|
{
|
|
53
|
-
value: { files:
|
|
58
|
+
value: { files: U, addFiles: x, removeFile: w, maxFiles: p, accept: d, disabled: u },
|
|
54
59
|
children: /* @__PURE__ */ e(
|
|
55
60
|
"div",
|
|
56
61
|
{
|
|
57
|
-
ref:
|
|
58
|
-
className:
|
|
62
|
+
ref: m,
|
|
63
|
+
className: y("w-full max-w-[550px]", i),
|
|
59
64
|
"data-component": "file-upload",
|
|
60
|
-
"data-disabled":
|
|
61
|
-
...
|
|
62
|
-
children:
|
|
65
|
+
"data-disabled": u || void 0,
|
|
66
|
+
...b,
|
|
67
|
+
children: l
|
|
63
68
|
}
|
|
64
69
|
)
|
|
65
70
|
}
|
|
66
71
|
);
|
|
67
72
|
}
|
|
68
|
-
),
|
|
73
|
+
), he = A("file-upload", {
|
|
69
74
|
part: "content",
|
|
70
75
|
displayName: "FileUploadContent",
|
|
71
76
|
className: "flex flex-col gap-4 p-4 min-h-[274px] bg-canvas-elevated rounded-2xl shadow-elevation-header"
|
|
72
|
-
}),
|
|
77
|
+
}), me = j("FileUploadHeader", ({ className: i, children: l, ...r }, p) => /* @__PURE__ */ e(
|
|
73
78
|
"div",
|
|
74
79
|
{
|
|
75
|
-
ref:
|
|
76
|
-
className:
|
|
77
|
-
...
|
|
78
|
-
children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-[2px] w-full", children:
|
|
80
|
+
ref: p,
|
|
81
|
+
className: y("flex justify-between items-center w-full", i),
|
|
82
|
+
...r,
|
|
83
|
+
children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-[2px] w-full", children: l })
|
|
79
84
|
}
|
|
80
|
-
)),
|
|
85
|
+
)), xe = j("FileUploadTitle", ({ className: i, children: l, ...r }, p) => /* @__PURE__ */ e(
|
|
81
86
|
"h3",
|
|
82
87
|
{
|
|
83
|
-
ref:
|
|
84
|
-
className:
|
|
85
|
-
...
|
|
86
|
-
children:
|
|
88
|
+
ref: p,
|
|
89
|
+
className: y("text-base font-extrabold text-content leading-6", i),
|
|
90
|
+
...r,
|
|
91
|
+
children: l
|
|
87
92
|
}
|
|
88
|
-
)),
|
|
93
|
+
)), ve = j("FileUploadDescription", ({ className: i, children: l, ...r }, p) => /* @__PURE__ */ e(
|
|
89
94
|
"p",
|
|
90
95
|
{
|
|
91
|
-
ref:
|
|
92
|
-
className:
|
|
96
|
+
ref: p,
|
|
97
|
+
className: y(
|
|
93
98
|
"text-sm font-medium text-navigation-muted leading-5",
|
|
94
|
-
|
|
99
|
+
i
|
|
95
100
|
),
|
|
96
|
-
...
|
|
97
|
-
children:
|
|
101
|
+
...r,
|
|
102
|
+
children: l
|
|
98
103
|
}
|
|
99
|
-
)),
|
|
100
|
-
const { t:
|
|
101
|
-
return /* @__PURE__ */ c(
|
|
104
|
+
)), ge = j("FileUploadClose", ({ className: i, ...l }, r) => {
|
|
105
|
+
const { t: p } = M(), d = p("aria.close");
|
|
106
|
+
return /* @__PURE__ */ c(z, { children: [
|
|
102
107
|
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
103
108
|
"button",
|
|
104
109
|
{
|
|
105
|
-
ref:
|
|
106
|
-
className:
|
|
110
|
+
ref: r,
|
|
111
|
+
className: y(
|
|
107
112
|
"text-content-tertiary hover:text-content transition-colors",
|
|
108
|
-
|
|
113
|
+
i
|
|
109
114
|
),
|
|
110
115
|
type: "button",
|
|
111
|
-
"aria-label":
|
|
112
|
-
...
|
|
113
|
-
children: /* @__PURE__ */ e(
|
|
116
|
+
"aria-label": d,
|
|
117
|
+
...l,
|
|
118
|
+
children: /* @__PURE__ */ e(P, { size: 16 })
|
|
114
119
|
}
|
|
115
120
|
) }),
|
|
116
|
-
/* @__PURE__ */ e(
|
|
121
|
+
/* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: d })
|
|
117
122
|
] });
|
|
118
|
-
}),
|
|
119
|
-
const { addFiles:
|
|
120
|
-
if (U.length >=
|
|
123
|
+
}), be = g.forwardRef(({ className: i, label: l, subLabel: r, ...p }, d) => {
|
|
124
|
+
const { t: u } = M(), { addFiles: h, accept: b, disabled: m, files: U, maxFiles: s } = G(), [x, w] = g.useState(!1), [t, o] = g.useState(!1), F = g.useRef(null);
|
|
125
|
+
if (U.length >= s)
|
|
121
126
|
return null;
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
const C = (n) => {
|
|
128
|
+
if (!(m || n.length === 0)) {
|
|
129
|
+
if (b.length > 0) {
|
|
130
|
+
const a = n.filter(
|
|
131
|
+
(R) => Z(R, b)
|
|
132
|
+
), v = a.length < n.length;
|
|
133
|
+
if (a.length === 0) {
|
|
134
|
+
o(!0);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
o(v), h(a);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
o(!1), h(n);
|
|
141
|
+
}
|
|
142
|
+
}, N = (n) => {
|
|
143
|
+
n.preventDefault(), m || (w(!0), o(!1));
|
|
144
|
+
}, k = (n) => {
|
|
145
|
+
n.preventDefault(), !n.currentTarget.contains(n.relatedTarget) && w(!1);
|
|
146
|
+
}, B = (n) => {
|
|
147
|
+
n.preventDefault(), w(!1), !m && n.dataTransfer.files?.length && C(Array.from(n.dataTransfer.files));
|
|
148
|
+
}, L = () => {
|
|
149
|
+
m || (o(!1), F.current?.click());
|
|
150
|
+
}, S = (n) => {
|
|
151
|
+
n.target.files?.length && (h(Array.from(n.target.files)), n.target.value = "");
|
|
152
|
+
}, I = b.length > 0 ? b.map((n) => `.${n}`).join(",") : void 0, E = x ? "drag-over" : t ? "invalid-type" : "idle";
|
|
133
153
|
return /* @__PURE__ */ c(
|
|
134
154
|
"div",
|
|
135
155
|
{
|
|
136
|
-
ref:
|
|
137
|
-
onClick:
|
|
138
|
-
onDragOver:
|
|
139
|
-
onDragLeave:
|
|
140
|
-
onDrop:
|
|
141
|
-
className:
|
|
142
|
-
"relative flex flex-col items-center
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
ref: d,
|
|
157
|
+
onClick: L,
|
|
158
|
+
onDragOver: N,
|
|
159
|
+
onDragLeave: k,
|
|
160
|
+
onDrop: B,
|
|
161
|
+
className: y(
|
|
162
|
+
"relative flex flex-col items-center p-4 pt-6 pb-6 gap-2 h-[148px] cursor-pointer transition-colors",
|
|
163
|
+
x && "justify-center rounded-lg border border-solid border-brand shadow-file-upload-drag bg-file-upload-drag",
|
|
164
|
+
!x && t && "justify-end rounded-2xl border border-solid border-destructive shadow-file-upload-error bg-file-upload-error",
|
|
165
|
+
!x && !t && "justify-end rounded-lg border border-dashed border-stroke-accent bg-transparent",
|
|
166
|
+
m && "opacity-50 cursor-not-allowed",
|
|
167
|
+
i
|
|
146
168
|
),
|
|
147
169
|
"data-component": "file-upload-dropzone",
|
|
148
|
-
"data-state":
|
|
149
|
-
...
|
|
170
|
+
"data-state": E,
|
|
171
|
+
...p,
|
|
150
172
|
children: [
|
|
151
173
|
/* @__PURE__ */ e(
|
|
152
174
|
"input",
|
|
153
175
|
{
|
|
154
|
-
ref:
|
|
176
|
+
ref: F,
|
|
155
177
|
type: "file",
|
|
156
|
-
multiple:
|
|
178
|
+
multiple: s > 1,
|
|
157
179
|
className: "hidden",
|
|
158
|
-
accept:
|
|
159
|
-
onChange:
|
|
160
|
-
disabled:
|
|
180
|
+
accept: I,
|
|
181
|
+
onChange: S,
|
|
182
|
+
disabled: m
|
|
161
183
|
}
|
|
162
184
|
),
|
|
163
|
-
/* @__PURE__ */ e("
|
|
164
|
-
/* @__PURE__ */ c(
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
185
|
+
/* @__PURE__ */ e(f, { when: x, children: /* @__PURE__ */ e("p", { className: "absolute inset-0 flex items-center justify-center text-center text-sm font-bold leading-[21px] text-content z-10 pointer-events-none", children: u("fileUpload.dropInProgress") }) }),
|
|
186
|
+
/* @__PURE__ */ c(f, { when: !x, children: [
|
|
187
|
+
/* @__PURE__ */ c("div", { className: "absolute top-[24px] left-1/2 -translate-x-1/2 pointer-events-none size-14", children: [
|
|
188
|
+
/* @__PURE__ */ e(f, { when: t, children: /* @__PURE__ */ e(J, { size: 56 }) }),
|
|
189
|
+
/* @__PURE__ */ e(f, { when: !t, children: /* @__PURE__ */ e(Q, { size: 56 }) })
|
|
190
|
+
] }),
|
|
191
|
+
/* @__PURE__ */ c("div", { className: "text-center space-y-1 z-10 mt-auto", children: [
|
|
192
|
+
/* @__PURE__ */ c(
|
|
193
|
+
"p",
|
|
194
|
+
{
|
|
195
|
+
className: y(
|
|
196
|
+
"text-sm font-medium leading-5",
|
|
197
|
+
t && "text-destructive",
|
|
198
|
+
!t && "text-content"
|
|
199
|
+
),
|
|
200
|
+
...t ? { role: "alert", "aria-live": "assertive" } : {},
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ c(f, { when: t, children: [
|
|
203
|
+
u("fileUpload.fileTypeNotSupported"),
|
|
204
|
+
" ",
|
|
205
|
+
/* @__PURE__ */ e("span", { className: "text-brand text-sm font-medium hover:underline", children: u("fileUpload.chooseFile") })
|
|
206
|
+
] }),
|
|
207
|
+
/* @__PURE__ */ e(f, { when: !t, children: l || /* @__PURE__ */ c(K, { children: [
|
|
208
|
+
u("fileUpload.dragDropLabel"),
|
|
209
|
+
" ",
|
|
210
|
+
/* @__PURE__ */ e("span", { className: "text-brand text-sm font-medium hover:underline", children: u("fileUpload.chooseFile") })
|
|
211
|
+
] }) })
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ e(f, { when: !!r, children: /* @__PURE__ */ e("p", { className: "text-xs font-medium text-navigation-muted", children: r }) })
|
|
216
|
+
] })
|
|
171
217
|
] })
|
|
172
218
|
]
|
|
173
219
|
}
|
|
174
220
|
);
|
|
175
|
-
}),
|
|
221
|
+
}), we = A("file-upload", {
|
|
176
222
|
part: "list",
|
|
177
223
|
displayName: "FileUploadList",
|
|
178
224
|
className: "flex flex-col gap-3"
|
|
179
|
-
}),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
225
|
+
}), Fe = g.forwardRef(
|
|
226
|
+
({
|
|
227
|
+
className: i,
|
|
228
|
+
file: l,
|
|
229
|
+
onRemove: r,
|
|
230
|
+
onClick: p,
|
|
231
|
+
loadingProgress: d,
|
|
232
|
+
errorMessage: u,
|
|
233
|
+
onReset: h,
|
|
234
|
+
onDownload: b,
|
|
235
|
+
...m
|
|
236
|
+
}, U) => {
|
|
237
|
+
const { t: s } = M(), { removeFile: x, disabled: w } = G(), t = !!d, o = !!u, F = !w && !t && o && !!h, C = !w && !t && !o && !!b, N = (a) => {
|
|
238
|
+
a.stopPropagation(), r ? r() : x(l);
|
|
239
|
+
}, k = (a) => {
|
|
240
|
+
a.stopPropagation(), d?.onAbort?.();
|
|
241
|
+
}, B = (a) => {
|
|
242
|
+
a.stopPropagation(), h?.();
|
|
243
|
+
}, L = (a) => {
|
|
244
|
+
a.stopPropagation(), b?.();
|
|
245
|
+
}, S = (a) => {
|
|
246
|
+
if (a === 0) return "0 B";
|
|
247
|
+
const v = 1024, R = ["B", "KB", "MB", "GB"], O = Math.floor(Math.log(a) / Math.log(v));
|
|
248
|
+
return parseFloat((a / Math.pow(v, O)).toFixed(2)) + " " + R[O];
|
|
249
|
+
}, I = g.useMemo(() => {
|
|
250
|
+
if (!d) return null;
|
|
251
|
+
const a = Math.round(d.value), v = d.timeRemainingSeconds;
|
|
252
|
+
return v == null ? s("fileUpload.progressPercent", { percent: a }) : s(
|
|
253
|
+
v === 1 ? "fileUpload.progressTimeRemainingSingular" : "fileUpload.progressTimeRemaining",
|
|
254
|
+
{ percent: a, count: v }
|
|
255
|
+
);
|
|
256
|
+
}, [d, s]), E = (a) => {
|
|
257
|
+
switch (a.split(".").pop()?.toLowerCase()) {
|
|
190
258
|
case "xls":
|
|
191
259
|
case "xlsx":
|
|
192
|
-
return /* @__PURE__ */ e(
|
|
260
|
+
return /* @__PURE__ */ e(ee, { size: 36 });
|
|
193
261
|
case "csv":
|
|
194
|
-
return /* @__PURE__ */ e(
|
|
262
|
+
return /* @__PURE__ */ e(X, { size: 36 });
|
|
195
263
|
case "txt":
|
|
196
|
-
return /* @__PURE__ */ e(
|
|
264
|
+
return /* @__PURE__ */ e(W, { size: 36 });
|
|
265
|
+
default:
|
|
266
|
+
return /* @__PURE__ */ e(H, { size: 36, className: "text-content-icon" });
|
|
267
|
+
}
|
|
268
|
+
}, n = (a) => {
|
|
269
|
+
switch (a.split(".").pop()?.toLowerCase()) {
|
|
270
|
+
case "xls":
|
|
271
|
+
case "xlsx":
|
|
272
|
+
return /* @__PURE__ */ e(V, { size: 36 });
|
|
197
273
|
default:
|
|
198
|
-
return /* @__PURE__ */ e(
|
|
274
|
+
return /* @__PURE__ */ e(H, { size: 36 });
|
|
199
275
|
}
|
|
200
276
|
};
|
|
201
277
|
return /* @__PURE__ */ e(
|
|
202
278
|
"div",
|
|
203
279
|
{
|
|
204
|
-
ref:
|
|
205
|
-
onClick:
|
|
206
|
-
className:
|
|
280
|
+
ref: U,
|
|
281
|
+
onClick: p,
|
|
282
|
+
className: y(
|
|
207
283
|
"flex flex-col justify-between items-stretch gap-2 p-4 border border-stroke-hairline rounded-xl bg-canvas-elevated",
|
|
208
|
-
|
|
209
|
-
|
|
284
|
+
p && "cursor-pointer",
|
|
285
|
+
i
|
|
210
286
|
),
|
|
211
287
|
"data-component": "file-upload-item",
|
|
212
|
-
"data-file-name":
|
|
213
|
-
"data-file-size":
|
|
214
|
-
|
|
288
|
+
"data-file-name": l.name,
|
|
289
|
+
"data-file-size": l.size,
|
|
290
|
+
"data-loading": t || void 0,
|
|
291
|
+
...m,
|
|
215
292
|
children: /* @__PURE__ */ c("div", { className: "flex justify-between items-center gap-2 z-10", children: [
|
|
216
|
-
/* @__PURE__ */ c("div", { className: "flex gap-2 min-w-0", children: [
|
|
217
|
-
/* @__PURE__ */ e("div", { className: "w-9 h-9 shrink-0", children:
|
|
218
|
-
/* @__PURE__ */ c("div", { className: "flex flex-col justify-between gap-[2px] min-w-0", children: [
|
|
219
|
-
/* @__PURE__ */ c(
|
|
220
|
-
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
221
|
-
|
|
293
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2 min-w-0 flex-1", children: [
|
|
294
|
+
/* @__PURE__ */ e("div", { className: "w-9 h-9 shrink-0", children: o ? n(l.name) : E(l.name) }),
|
|
295
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col justify-between gap-[2px] min-w-0 flex-1", children: [
|
|
296
|
+
/* @__PURE__ */ c(z, { children: [
|
|
297
|
+
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
298
|
+
"span",
|
|
299
|
+
{
|
|
300
|
+
className: y(
|
|
301
|
+
"text-xs font-bold leading-[18px] line-clamp-1 break-all cursor-default",
|
|
302
|
+
o ? "text-content-icon" : "text-content"
|
|
303
|
+
),
|
|
304
|
+
children: l.name
|
|
305
|
+
}
|
|
306
|
+
) }),
|
|
307
|
+
/* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: l.name })
|
|
222
308
|
] }),
|
|
223
|
-
/* @__PURE__ */ e("
|
|
309
|
+
/* @__PURE__ */ e(f, { when: t, children: /* @__PURE__ */ c("div", { className: "flex flex-col gap-1 w-full min-w-0", children: [
|
|
310
|
+
/* @__PURE__ */ e(
|
|
311
|
+
te,
|
|
312
|
+
{
|
|
313
|
+
value: d?.value ?? 0,
|
|
314
|
+
label: !1,
|
|
315
|
+
className: "h-1.5"
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ e(f, { when: !!I, children: /* @__PURE__ */ e(
|
|
319
|
+
"span",
|
|
320
|
+
{
|
|
321
|
+
className: "text-xs font-medium text-content-tertiary leading-[16px]",
|
|
322
|
+
"data-component": "file-upload-item-progress-label",
|
|
323
|
+
children: I
|
|
324
|
+
}
|
|
325
|
+
) })
|
|
326
|
+
] }) }),
|
|
327
|
+
/* @__PURE__ */ e(f, { when: !t && o, children: /* @__PURE__ */ e(
|
|
328
|
+
"span",
|
|
329
|
+
{
|
|
330
|
+
className: "text-xs font-medium text-destructive leading-[16px]",
|
|
331
|
+
"data-component": "file-upload-item-error",
|
|
332
|
+
role: "alert",
|
|
333
|
+
"aria-live": "polite",
|
|
334
|
+
children: u
|
|
335
|
+
}
|
|
336
|
+
) }),
|
|
337
|
+
/* @__PURE__ */ e(f, { when: !t && !o, children: /* @__PURE__ */ e("span", { className: "text-xs font-medium text-secondary-foreground leading-[16px]", children: S(l.size) }) })
|
|
224
338
|
] })
|
|
225
339
|
] }),
|
|
226
340
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-4 shrink-0", children: [
|
|
227
|
-
|
|
341
|
+
/* @__PURE__ */ e(f, { when: t && !!d?.onAbort, children: /* @__PURE__ */ c(z, { children: [
|
|
228
342
|
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
229
343
|
"button",
|
|
230
344
|
{
|
|
231
|
-
onClick:
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
className: "flex items-center justify-center text-content-tertiary hover:text-content transition-colors",
|
|
345
|
+
onClick: k,
|
|
346
|
+
className: "flex items-center justify-center text-content-tertiary hover:text-destructive transition-colors",
|
|
235
347
|
type: "button",
|
|
236
|
-
"aria-label": "
|
|
237
|
-
children: /* @__PURE__ */ e(
|
|
348
|
+
"aria-label": s("fileUpload.cancelUpload"),
|
|
349
|
+
children: /* @__PURE__ */ e(P, { size: 16 })
|
|
238
350
|
}
|
|
239
351
|
) }),
|
|
240
|
-
/* @__PURE__ */ e(
|
|
241
|
-
] }),
|
|
242
|
-
|
|
352
|
+
/* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: s("fileUpload.cancelUpload") })
|
|
353
|
+
] }) }),
|
|
354
|
+
/* @__PURE__ */ e(f, { when: !w && !t, children: /* @__PURE__ */ c(z, { children: [
|
|
243
355
|
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
244
356
|
"button",
|
|
245
357
|
{
|
|
246
|
-
onClick:
|
|
358
|
+
onClick: N,
|
|
247
359
|
className: "flex items-center justify-center text-content-tertiary hover:text-destructive transition-colors",
|
|
248
360
|
type: "button",
|
|
249
|
-
"aria-label":
|
|
250
|
-
children: /* @__PURE__ */ e(
|
|
361
|
+
"aria-label": s("aria.removeFile"),
|
|
362
|
+
children: /* @__PURE__ */ e(Y, { size: 14 })
|
|
251
363
|
}
|
|
252
364
|
) }),
|
|
253
|
-
/* @__PURE__ */ e(
|
|
254
|
-
] })
|
|
365
|
+
/* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: s("aria.removeFile") })
|
|
366
|
+
] }) }),
|
|
367
|
+
/* @__PURE__ */ e(f, { when: F, children: /* @__PURE__ */ c(z, { children: [
|
|
368
|
+
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
369
|
+
"button",
|
|
370
|
+
{
|
|
371
|
+
onClick: B,
|
|
372
|
+
className: "flex items-center justify-center text-content-tertiary hover:text-content transition-colors",
|
|
373
|
+
type: "button",
|
|
374
|
+
"aria-label": s("fileUpload.retryUpload"),
|
|
375
|
+
children: /* @__PURE__ */ e(_, { size: 14 })
|
|
376
|
+
}
|
|
377
|
+
) }),
|
|
378
|
+
/* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: s("fileUpload.retryUpload") })
|
|
379
|
+
] }) }),
|
|
380
|
+
/* @__PURE__ */ e(f, { when: C, children: /* @__PURE__ */ c(z, { children: [
|
|
381
|
+
/* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e(
|
|
382
|
+
"button",
|
|
383
|
+
{
|
|
384
|
+
onClick: L,
|
|
385
|
+
className: "flex items-center justify-center text-content-tertiary hover:text-content transition-colors",
|
|
386
|
+
type: "button",
|
|
387
|
+
"aria-label": s("fileUpload.downloadFile"),
|
|
388
|
+
children: /* @__PURE__ */ e(q, { size: 14 })
|
|
389
|
+
}
|
|
390
|
+
) }),
|
|
391
|
+
/* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: s("fileUpload.downloadFile") })
|
|
392
|
+
] }) })
|
|
255
393
|
] })
|
|
256
394
|
] })
|
|
257
395
|
}
|
|
258
396
|
);
|
|
259
397
|
}
|
|
260
|
-
),
|
|
398
|
+
), ye = A("file-upload", {
|
|
261
399
|
part: "footer",
|
|
262
400
|
displayName: "FileUploadFooter",
|
|
263
401
|
className: "flex items-center justify-end gap-4 mt-auto"
|
|
264
402
|
});
|
|
265
403
|
export {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
404
|
+
ue as FileUpload,
|
|
405
|
+
ge as FileUploadClose,
|
|
406
|
+
he as FileUploadContent,
|
|
407
|
+
ve as FileUploadDescription,
|
|
408
|
+
be as FileUploadDropZone,
|
|
409
|
+
ye as FileUploadFooter,
|
|
410
|
+
me as FileUploadHeader,
|
|
411
|
+
Fe as FileUploadItem,
|
|
412
|
+
we as FileUploadList,
|
|
413
|
+
xe as FileUploadTitle
|
|
276
414
|
};
|
|
@@ -18,9 +18,24 @@ export interface FileUploadDropZoneProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
18
18
|
label?: string;
|
|
19
19
|
subLabel?: string;
|
|
20
20
|
}
|
|
21
|
-
export interface
|
|
21
|
+
export interface FileUploadItemLoadingProgress {
|
|
22
|
+
/** Progress percentage, 0-100. */
|
|
23
|
+
value: number;
|
|
24
|
+
/** Estimated seconds remaining; omit to show percent only. */
|
|
25
|
+
timeRemainingSeconds?: number;
|
|
26
|
+
/** Called when the user aborts the in-flight upload. */
|
|
27
|
+
onAbort?: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface FileUploadItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onReset"> {
|
|
22
30
|
file: File;
|
|
23
31
|
onRemove?: () => void;
|
|
24
|
-
onView?: () => void;
|
|
25
32
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
33
|
+
/** When set, renders upload progress UI for this item. */
|
|
34
|
+
loadingProgress?: FileUploadItemLoadingProgress;
|
|
35
|
+
/** Error text shown for a failed upload. */
|
|
36
|
+
errorMessage?: string;
|
|
37
|
+
/** Retry a failed upload. */
|
|
38
|
+
onReset?: () => void;
|
|
39
|
+
/** Download the uploaded/processed file. */
|
|
40
|
+
onDownload?: () => void;
|
|
26
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const dynamicLayoutVariants: (props?: ({
|
|
2
2
|
layout?: "grid" | "flex" | "stack" | null | undefined;
|
|
3
|
-
columns?: 1 | 2 |
|
|
3
|
+
columns?: 1 | 2 | 3 | 4 | 6 | 12 | null | undefined;
|
|
4
4
|
gap?: "sm" | "md" | "lg" | "none" | "xl" | null | undefined;
|
|
5
5
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|