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.
Files changed (75) hide show
  1. package/README.md +6 -0
  2. package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-editor.js +73 -94
  3. package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-focus.d.ts +53 -0
  4. package/dist/components/data/ag-grid-react/cell-renderers/editors/split-cell-focus.js +98 -0
  5. package/dist/components/data/ag-grid-react/headers/column-menu/column-settings-menu.js +15 -13
  6. package/dist/components/data/ag-grid-react/headers/custom-header.js +56 -58
  7. package/dist/components/data/ag-grid-react/headers/custom-inner-header-group.d.ts +12 -0
  8. package/dist/components/data/ag-grid-react/headers/custom-inner-header-group.js +31 -0
  9. package/dist/components/data/ag-grid-react/headers/header-search-active-state.d.ts +10 -0
  10. package/dist/components/data/ag-grid-react/headers/header-search-active-state.js +38 -0
  11. package/dist/components/data/ag-grid-react/index.js +166 -163
  12. package/dist/components/data/ag-grid-react/notify-column-indicator-sync.d.ts +3 -4
  13. package/dist/components/data/ag-grid-react/theme.js +0 -2
  14. package/dist/components/data/data-table/data-table-column-list.js +1 -1
  15. package/dist/components/data/data-table/data-table-saved-views.js +1 -1
  16. package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +7 -6
  17. package/dist/components/data/nested-list/components/SortableItem.d.ts +3 -1
  18. package/dist/components/data/nested-list/components/SortableItem.js +111 -109
  19. package/dist/components/data-display/calendar/calendar-footer-emphasis.d.ts +28 -0
  20. package/dist/components/data-display/calendar/calendar-footer-emphasis.js +8 -0
  21. package/dist/components/data-display/calendar/calendar-footer.d.ts +4 -1
  22. package/dist/components/data-display/calendar/calendar-footer.js +60 -38
  23. package/dist/components/data-display/calendar/calendar.js +86 -82
  24. package/dist/components/data-display/calendar/calendar.types.d.ts +2 -0
  25. package/dist/components/data-display/calendar/use-calendar-state.d.ts +3 -0
  26. package/dist/components/feedback/tooltip/tab-tooltip-render.js +3 -2
  27. package/dist/components/flows/filter-strip/filter-strip.js +36 -29
  28. package/dist/components/flows/filter-strip/filter-summary.js +2 -2
  29. package/dist/components/forms/date-picker/date-input-behavior.d.ts +118 -0
  30. package/dist/components/forms/date-picker/date-input-behavior.js +164 -0
  31. package/dist/components/forms/date-picker/date-picker.js +202 -138
  32. package/dist/components/forms/date-picker/date-range-picker.js +302 -215
  33. package/dist/components/forms/date-picker/month-picker.js +160 -119
  34. package/dist/components/forms/date-picker/month-range-picker.js +302 -245
  35. package/dist/components/forms/date-picker/multi-date-picker.js +94 -80
  36. package/dist/components/forms/date-picker/multi-month-picker.js +97 -83
  37. package/dist/components/forms/date-picker/multi-week-picker.js +107 -93
  38. package/dist/components/forms/date-picker/week-picker.js +230 -140
  39. package/dist/components/forms/date-picker/week-range-picker.js +332 -226
  40. package/dist/components/forms/file-upload/file-upload.js +312 -174
  41. package/dist/components/forms/file-upload/file-upload.types.d.ts +17 -2
  42. package/dist/components/layout/dynamic-layout/dynamic-layout.variants.d.ts +1 -1
  43. package/dist/components/layout/header/header.js +45 -38
  44. package/dist/components/layout/horizontal-scroller/index.d.ts +1 -0
  45. package/dist/components/layout/horizontal-scroller/index.js +3 -2
  46. package/dist/components/ui/local-raster-icons/assets/excel-error-icon.webp.js +4 -0
  47. package/dist/components/ui/local-raster-icons/assets/file-upload-error.webp.js +4 -0
  48. package/dist/components/ui/local-raster-icons/rasterIcons.d.ts +2 -0
  49. package/dist/components/ui/local-raster-icons/rasterIcons.js +32 -22
  50. package/dist/components/ui/show.d.ts +10 -0
  51. package/dist/components/ui/show.js +7 -0
  52. package/dist/components/ui/show.types.d.ts +5 -0
  53. package/dist/i18n/defaultMessages.d.ts +17 -0
  54. package/dist/i18n/defaultMessages.js +29 -17
  55. package/dist/i18n/index.d.ts +1 -1
  56. package/dist/i18n/locales/de.js +12 -0
  57. package/dist/i18n/locales/es.js +12 -0
  58. package/dist/i18n/locales/hi.js +12 -0
  59. package/dist/i18n/locales/kn.js +12 -0
  60. package/dist/impact-nova-base.scss +6 -2
  61. package/dist/impact-nova-components.css +141 -16
  62. package/dist/impact-nova-tokens.scss +12 -0
  63. package/dist/impact-nova.css +1 -1
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.js +273 -271
  66. package/dist/lib/utils.js +40 -24
  67. package/dist/llms/rules/ag-grid.js +1 -1
  68. package/dist/llms/rules/installation.js +1 -1
  69. package/dist/llms/rules/requirements.js +1 -1
  70. package/dist/tailwind.config.js +36 -4
  71. package/dist/theme/tailwind-colors.js +3 -1
  72. package/package.json +15 -6
  73. package/tailwind.config.d.ts +3 -0
  74. package/dist/components/data/ag-grid-react/headers/custom-header-group.d.ts +0 -10
  75. 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 L } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { createComponent as v } from "../../../lib/primitives/create-component.js";
4
- import { createCompoundPart as j } from "../../../lib/primitives/create-compound.js";
5
- import { cn as F } from "../../../lib/utils.js";
6
- import { Cross as E, Eye as M, Delete as B, Document as P } from "impact-nova-icons";
7
- import { FileUpload as S, Text as A, Csv as O, Excel as R } from "../../ui/local-raster-icons/rasterIcons.js";
8
- import { Tooltip as w, TooltipTrigger as D, TooltipContent as z } from "../../feedback/tooltip/tooltip.js";
9
- import { useImpactNovaI18n as T } from "../../../i18n/use-impact-nova-i18n.js";
10
- const k = y.createContext(void 0), H = [], I = () => {
11
- const a = y.useContext(k);
12
- if (!a)
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 a;
15
- }, J = v(
20
+ return i;
21
+ }, ue = j(
16
22
  "FileUpload",
17
23
  ({
18
- className: a,
19
- children: t,
20
- onFilesChange: l,
21
- maxFiles: o = 1,
22
- accept: s = [],
23
- disabled: p = !1,
24
- value: m = H,
25
- ...d
26
- }, U) => {
27
- const [f, u] = y.useState(m);
28
- y.useEffect(() => {
29
- u(m);
30
- }, [m]);
31
- const x = (n) => {
32
- if (p) return;
33
- let r = n;
34
- s.length > 0 && (r = r.filter((N) => {
35
- const C = N.name.split(".").pop()?.toLowerCase();
36
- return C && s.includes(C);
37
- }));
38
- const h = o - f.length;
39
- if (h <= 0) return;
40
- const g = r.slice(0, h);
41
- if (g.length > 0) {
42
- const N = [...f, ...g];
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
- }, b = (n) => {
46
- if (p) return;
47
- const r = f.filter((h) => h !== n);
48
- u(r), l?.(r);
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
- k.Provider,
56
+ $.Provider,
52
57
  {
53
- value: { files: f, addFiles: x, removeFile: b, maxFiles: o, accept: s, disabled: p },
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: U,
58
- className: F("w-full max-w-[550px]", a),
62
+ ref: m,
63
+ className: y("w-full max-w-[550px]", i),
59
64
  "data-component": "file-upload",
60
- "data-disabled": p || void 0,
61
- ...d,
62
- children: t
65
+ "data-disabled": u || void 0,
66
+ ...b,
67
+ children: l
63
68
  }
64
69
  )
65
70
  }
66
71
  );
67
72
  }
68
- ), Q = j("file-upload", {
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
- }), W = v("FileUploadHeader", ({ className: a, children: t, ...l }, o) => /* @__PURE__ */ e(
77
+ }), me = j("FileUploadHeader", ({ className: i, children: l, ...r }, p) => /* @__PURE__ */ e(
73
78
  "div",
74
79
  {
75
- ref: o,
76
- className: F("flex justify-between items-center w-full", a),
77
- ...l,
78
- children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-[2px] w-full", children: t })
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
- )), X = v("FileUploadTitle", ({ className: a, children: t, ...l }, o) => /* @__PURE__ */ e(
85
+ )), xe = j("FileUploadTitle", ({ className: i, children: l, ...r }, p) => /* @__PURE__ */ e(
81
86
  "h3",
82
87
  {
83
- ref: o,
84
- className: F("text-base font-extrabold text-content leading-6", a),
85
- ...l,
86
- children: t
88
+ ref: p,
89
+ className: y("text-base font-extrabold text-content leading-6", i),
90
+ ...r,
91
+ children: l
87
92
  }
88
- )), ee = v("FileUploadDescription", ({ className: a, children: t, ...l }, o) => /* @__PURE__ */ e(
93
+ )), ve = j("FileUploadDescription", ({ className: i, children: l, ...r }, p) => /* @__PURE__ */ e(
89
94
  "p",
90
95
  {
91
- ref: o,
92
- className: F(
96
+ ref: p,
97
+ className: y(
93
98
  "text-sm font-medium text-navigation-muted leading-5",
94
- a
99
+ i
95
100
  ),
96
- ...l,
97
- children: t
101
+ ...r,
102
+ children: l
98
103
  }
99
- )), te = v("FileUploadClose", ({ className: a, ...t }, l) => {
100
- const { t: o } = T(), s = o("aria.close");
101
- return /* @__PURE__ */ c(w, { children: [
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: l,
106
- className: F(
110
+ ref: r,
111
+ className: y(
107
112
  "text-content-tertiary hover:text-content transition-colors",
108
- a
113
+ i
109
114
  ),
110
115
  type: "button",
111
- "aria-label": s,
112
- ...t,
113
- children: /* @__PURE__ */ e(E, { size: 16 })
116
+ "aria-label": d,
117
+ ...l,
118
+ children: /* @__PURE__ */ e(P, { size: 16 })
114
119
  }
115
120
  ) }),
116
- /* @__PURE__ */ e(z, { side: "top", variant: "tertiary", children: s })
121
+ /* @__PURE__ */ e(T, { side: "top", variant: "tertiary", children: d })
117
122
  ] });
118
- }), ae = v("FileUploadDropZone", ({ className: a, label: t, subLabel: l, ...o }, s) => {
119
- const { addFiles: p, accept: m, disabled: d, files: U, maxFiles: f } = I(), [u, x] = y.useState(!1), b = y.useRef(null);
120
- if (U.length >= f)
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 n = (i) => {
123
- i.preventDefault(), d || x(!0);
124
- }, r = (i) => {
125
- i.preventDefault(), x(!1);
126
- }, h = (i) => {
127
- i.preventDefault(), x(!1), !d && i.dataTransfer.files?.length && p(Array.from(i.dataTransfer.files));
128
- }, g = () => {
129
- d || b.current?.click();
130
- }, N = (i) => {
131
- i.target.files?.length && (p(Array.from(i.target.files)), i.target.value = "");
132
- }, C = m.length > 0 ? m.map((i) => `.${i}`).join(",") : void 0;
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: s,
137
- onClick: g,
138
- onDragOver: n,
139
- onDragLeave: r,
140
- onDrop: h,
141
- className: F(
142
- "relative flex flex-col items-center justify-end p-4 pt-6 pb-6 gap-2 h-[148px] rounded-lg border border-dashed border-stroke-accent bg-transparent cursor-pointer transition-colors",
143
- u && "border-brand bg-brand/5",
144
- d && "opacity-50 cursor-not-allowed",
145
- a
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": u ? "drag-over" : "idle",
149
- ...o,
170
+ "data-state": E,
171
+ ...p,
150
172
  children: [
151
173
  /* @__PURE__ */ e(
152
174
  "input",
153
175
  {
154
- ref: b,
176
+ ref: F,
155
177
  type: "file",
156
- multiple: !0,
178
+ multiple: s > 1,
157
179
  className: "hidden",
158
- accept: C,
159
- onChange: N,
160
- disabled: d
180
+ accept: I,
181
+ onChange: S,
182
+ disabled: m
161
183
  }
162
184
  ),
163
- /* @__PURE__ */ e("div", { className: "absolute top-[24px] left-1/2 -translate-x-1/2 pointer-events-none", children: /* @__PURE__ */ e(S, { size: 56 }) }),
164
- /* @__PURE__ */ c("div", { className: "text-center space-y-1 z-10 mt-auto", children: [
165
- /* @__PURE__ */ e("p", { className: "text-sm font-medium text-content leading-5", children: t || /* @__PURE__ */ c(L, { children: [
166
- "Drag your files here or",
167
- " ",
168
- /* @__PURE__ */ e("span", { className: "text-brand text-sm font-medium hover:underline", children: "Choose File" })
169
- ] }) }),
170
- l && /* @__PURE__ */ e("p", { className: "text-xs font-medium text-navigation-muted", children: l })
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
- }), le = j("file-upload", {
221
+ }), we = A("file-upload", {
176
222
  part: "list",
177
223
  displayName: "FileUploadList",
178
224
  className: "flex flex-col gap-3"
179
- }), oe = v(
180
- "FileUploadItem",
181
- ({ className: a, file: t, onRemove: l, onView: o, onClick: s, ...p }, m) => {
182
- const { t: d } = T(), { removeFile: U, disabled: f } = I(), u = (n) => {
183
- n.stopPropagation(), l ? l() : U(t);
184
- }, x = (n) => {
185
- if (n === 0) return "0 B";
186
- const r = 1024, h = ["B", "KB", "MB", "GB"], g = Math.floor(Math.log(n) / Math.log(r));
187
- return parseFloat((n / Math.pow(r, g)).toFixed(2)) + " " + h[g];
188
- }, b = (n) => {
189
- switch (n.split(".").pop()?.toLowerCase()) {
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(R, { size: 36 });
260
+ return /* @__PURE__ */ e(ee, { size: 36 });
193
261
  case "csv":
194
- return /* @__PURE__ */ e(O, { size: 36 });
262
+ return /* @__PURE__ */ e(X, { size: 36 });
195
263
  case "txt":
196
- return /* @__PURE__ */ e(A, { size: 36 });
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(P, { size: 36, className: "text-content-icon" });
274
+ return /* @__PURE__ */ e(H, { size: 36 });
199
275
  }
200
276
  };
201
277
  return /* @__PURE__ */ e(
202
278
  "div",
203
279
  {
204
- ref: m,
205
- onClick: s,
206
- className: F(
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
- s && "cursor-pointer",
209
- a
284
+ p && "cursor-pointer",
285
+ i
210
286
  ),
211
287
  "data-component": "file-upload-item",
212
- "data-file-name": t.name,
213
- "data-file-size": t.size,
214
- ...p,
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: b(t.name) }),
218
- /* @__PURE__ */ c("div", { className: "flex flex-col justify-between gap-[2px] min-w-0", children: [
219
- /* @__PURE__ */ c(w, { children: [
220
- /* @__PURE__ */ e(D, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "text-xs font-bold text-content leading-[18px] line-clamp-1 break-all cursor-default", children: t.name }) }),
221
- /* @__PURE__ */ e(z, { side: "top", variant: "tertiary", children: t.name })
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("span", { className: "text-xs font-medium text-secondary-foreground leading-[16px]", children: x(t.size) })
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
- o && /* @__PURE__ */ c(w, { children: [
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: (n) => {
232
- n.stopPropagation(), o();
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": "View file data",
237
- children: /* @__PURE__ */ e(M, { size: 18 })
348
+ "aria-label": s("fileUpload.cancelUpload"),
349
+ children: /* @__PURE__ */ e(P, { size: 16 })
238
350
  }
239
351
  ) }),
240
- /* @__PURE__ */ e(z, { side: "top", variant: "tertiary", children: "View" })
241
- ] }),
242
- !f && /* @__PURE__ */ c(w, { children: [
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: u,
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": d("aria.removeFile"),
250
- children: /* @__PURE__ */ e(B, { size: 14 })
361
+ "aria-label": s("aria.removeFile"),
362
+ children: /* @__PURE__ */ e(Y, { size: 14 })
251
363
  }
252
364
  ) }),
253
- /* @__PURE__ */ e(z, { side: "top", variant: "tertiary", children: d("aria.removeFile") })
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
- ), ne = j("file-upload", {
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
- J as FileUpload,
267
- te as FileUploadClose,
268
- Q as FileUploadContent,
269
- ee as FileUploadDescription,
270
- ae as FileUploadDropZone,
271
- ne as FileUploadFooter,
272
- W as FileUploadHeader,
273
- oe as FileUploadItem,
274
- le as FileUploadList,
275
- X as FileUploadTitle
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 FileUploadItemProps extends React.HTMLAttributes<HTMLDivElement> {
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 | 4 | 3 | 6 | 12 | null | undefined;
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;