@alixpartners/ui-components 2.4.2 → 2.4.4
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/assets/FilePicker.css +1 -1
- package/dist/assets/SplitButton.css +1 -1
- package/dist/assets/ap-icons-types.d.ts +1 -1
- package/dist/assets/ap-icons.d.ts +1 -1
- package/dist/assets/main.css +1 -1
- package/dist/components/DragAndDrop/DragAndDrop.d.ts +8 -5
- package/dist/components/DragAndDrop/DragAndDrop.js +110 -110
- package/dist/components/DragAndDrop/DragAndDrop.test.js +16 -12
- package/dist/components/FilePicker/FilePicker.d.ts +8 -4
- package/dist/components/FilePicker/FilePicker.js +197 -191
- package/dist/components/FilePicker/FilePicker.test.js +90 -86
- package/dist/components/Icons/IconsGallery.js +1 -1
- package/dist/components/SplitButton/SplitButton.js +132 -127
- package/dist/components/Tooltip/Tooltip.d.ts +3 -1
- package/dist/components/Tooltip/Tooltip.js +200 -196
- package/package.json +1 -1
|
@@ -1,243 +1,249 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { c as
|
|
7
|
-
import '../../assets/FilePicker.css';const
|
|
8
|
-
container:
|
|
9
|
-
containerMultiple:
|
|
10
|
-
label:
|
|
11
|
-
required:
|
|
12
|
-
labelTooltipIcon:
|
|
13
|
-
helpers:
|
|
14
|
-
helperText:
|
|
15
|
-
errorMessage:
|
|
16
|
-
singleFileHelpLinkContainer:
|
|
17
|
-
singleFileHelpLinkReservedSpace:
|
|
18
|
-
helpLink:
|
|
19
|
-
input:
|
|
20
|
-
singleFileContainer:
|
|
21
|
-
singleFileInputContainer:
|
|
22
|
-
inputFileName:
|
|
23
|
-
inputFileNamePlaceholder:
|
|
24
|
-
inputButton:
|
|
25
|
-
multipleHelpText:
|
|
26
|
-
multipleInputButton:
|
|
27
|
-
multipleFilesList:
|
|
28
|
-
multipleFilesListItem:
|
|
29
|
-
multipleFilesListItemContent:
|
|
30
|
-
multipleFilesListItemContentData:
|
|
31
|
-
multipleFilesListItemIconContainer:
|
|
32
|
-
multipleFilesListItemIcon:
|
|
33
|
-
multipleFilesListItemText:
|
|
34
|
-
multipleFilesListItemName:
|
|
35
|
-
multipleFilesListItemSize:
|
|
36
|
-
multipleFilesListItemError:
|
|
37
|
-
multipleFilesListItemIconError:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
import { jsxs as r, jsx as t, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ae, useId as pe, useRef as ue, useState as A, useCallback as _, useEffect as me, useContext as de } from "react";
|
|
3
|
+
import _e from "../Tooltip/Tooltip.js";
|
|
4
|
+
import R from "../Icon/Icon.js";
|
|
5
|
+
import y from "../Button/Button.js";
|
|
6
|
+
import { c as D } from "../../clsx-OuTLNxxd.js";
|
|
7
|
+
import '../../assets/FilePicker.css';const Fe = "FilePicker-module__container___knCCi", Ie = "FilePicker-module__containerMultiple___Psi5u", Le = "FilePicker-module__label___al7Xe", he = "FilePicker-module__required___41Vjd", ke = "FilePicker-module__labelTooltipIcon___Cc1QF", ge = "FilePicker-module__helpers___79-g5", fe = "FilePicker-module__helperText___ja9Rr", Ne = "FilePicker-module__errorMessage___TvHrL", Pe = "FilePicker-module__singleFileHelpLinkContainer___mpjUf", Ce = "FilePicker-module__singleFileHelpLinkReservedSpace___r8j2b", Te = "FilePicker-module__helpLink___uu45D", be = "FilePicker-module__input___cL1Hs", xe = "FilePicker-module__singleFileContainer___OFSDt", ye = "FilePicker-module__singleFileInputContainer___MOkES", De = "FilePicker-module__inputFileName___sMs7R", Se = "FilePicker-module__inputFileNamePlaceholder___-mkDD", we = "FilePicker-module__inputButton___ghLlD", Be = "FilePicker-module__multipleHelpText___5tnnn", Re = "FilePicker-module__multipleInputButton___WCJp9", He = "FilePicker-module__multipleFilesList___Kim0I", ve = "FilePicker-module__multipleFilesListItem___01PDS", Me = "FilePicker-module__multipleFilesListItemContent___pKbho", Ae = "FilePicker-module__multipleFilesListItemContentData___5GC-C", Ee = "FilePicker-module__multipleFilesListItemIconContainer___7sUL5", ze = "FilePicker-module__multipleFilesListItemIcon___nfMX9", je = "FilePicker-module__multipleFilesListItemText___nPqrL", Oe = "FilePicker-module__multipleFilesListItemName___NjHhX", Ve = "FilePicker-module__multipleFilesListItemSize___wc8LJ", Ke = "FilePicker-module__multipleFilesListItemError___x9qkT", qe = "FilePicker-module__multipleFilesListItemIconError___0RO46", Xe = "FilePicker-module__multipleFilesListItemAppendedRow___nzls7", $e = "FilePicker-module__multipleFilesListItemIconDelete___9Z9Dl", Ye = "FilePicker-module__disabled___szMiq", i = {
|
|
8
|
+
container: Fe,
|
|
9
|
+
containerMultiple: Ie,
|
|
10
|
+
label: Le,
|
|
11
|
+
required: he,
|
|
12
|
+
labelTooltipIcon: ke,
|
|
13
|
+
helpers: ge,
|
|
14
|
+
helperText: fe,
|
|
15
|
+
errorMessage: Ne,
|
|
16
|
+
singleFileHelpLinkContainer: Pe,
|
|
17
|
+
singleFileHelpLinkReservedSpace: Ce,
|
|
18
|
+
helpLink: Te,
|
|
19
|
+
input: be,
|
|
20
|
+
singleFileContainer: xe,
|
|
21
|
+
singleFileInputContainer: ye,
|
|
22
|
+
inputFileName: De,
|
|
23
|
+
inputFileNamePlaceholder: Se,
|
|
24
|
+
inputButton: we,
|
|
25
|
+
multipleHelpText: Be,
|
|
26
|
+
multipleInputButton: Re,
|
|
27
|
+
multipleFilesList: He,
|
|
28
|
+
multipleFilesListItem: ve,
|
|
29
|
+
multipleFilesListItemContent: Me,
|
|
30
|
+
multipleFilesListItemContentData: Ae,
|
|
31
|
+
multipleFilesListItemIconContainer: Ee,
|
|
32
|
+
multipleFilesListItemIcon: ze,
|
|
33
|
+
multipleFilesListItemText: je,
|
|
34
|
+
multipleFilesListItemName: Oe,
|
|
35
|
+
multipleFilesListItemSize: Ve,
|
|
36
|
+
multipleFilesListItemError: Ke,
|
|
37
|
+
multipleFilesListItemIconError: qe,
|
|
38
|
+
multipleFilesListItemAppendedRow: Xe,
|
|
39
|
+
multipleFilesListItemIconDelete: $e,
|
|
40
|
+
disabled: Ye
|
|
41
|
+
}, E = ae(null);
|
|
42
|
+
function m() {
|
|
43
|
+
const e = de(E);
|
|
43
44
|
if (!e)
|
|
44
45
|
throw new Error("FilePicker compound components must be used within a FilePicker.");
|
|
45
46
|
return e;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
const Ge = (e) => `File size is too large. Must be up to ${e}MB.`, Je = (e) => `The file format is incorrect. Please make sure it is one of the extensions: ${e}.`;
|
|
49
|
+
function Ze(e) {
|
|
48
50
|
const l = e.name.toLowerCase();
|
|
49
51
|
return l.includes(".") ? l.split(".").pop() ?? "" : "";
|
|
50
52
|
}
|
|
51
|
-
function
|
|
53
|
+
function Qe({
|
|
52
54
|
type: e = "single",
|
|
53
|
-
maxFiles: l =
|
|
55
|
+
maxFiles: l = Number.POSITIVE_INFINITY,
|
|
54
56
|
fileExtensionsAllowed: s,
|
|
55
|
-
maxSize:
|
|
56
|
-
queueFiles:
|
|
57
|
+
maxSize: o = Number.POSITIVE_INFINITY,
|
|
58
|
+
queueFiles: I = !1,
|
|
57
59
|
disabled: c = !1,
|
|
58
|
-
isUploadDisabled:
|
|
59
|
-
value:
|
|
60
|
-
label:
|
|
61
|
-
required:
|
|
62
|
-
placeholder:
|
|
63
|
-
errorMessage:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
isUploadDisabled: j = !1,
|
|
61
|
+
value: k,
|
|
62
|
+
label: O,
|
|
63
|
+
required: V = !1,
|
|
64
|
+
placeholder: K,
|
|
65
|
+
errorMessage: q,
|
|
66
|
+
maxSizeErrorMessage: g,
|
|
67
|
+
fileExtensionInvalidErrorMessage: f,
|
|
68
|
+
helpText: X,
|
|
69
|
+
helpLink: $,
|
|
70
|
+
helpLinkText: Y,
|
|
71
|
+
multipleHelpText: G,
|
|
72
|
+
multipleButtonHelpText: J,
|
|
73
|
+
labelTooltip: Z,
|
|
74
|
+
uploadedFileAppendedRow: Q,
|
|
75
|
+
onUpload: d,
|
|
76
|
+
onRemoveFile: N,
|
|
77
|
+
children: P
|
|
73
78
|
}) {
|
|
74
|
-
const
|
|
79
|
+
const H = pe(), C = ue(null), [a, T] = A(k ? k.map((n) => ({
|
|
75
80
|
file: n
|
|
76
|
-
})) : []), [
|
|
77
|
-
const
|
|
78
|
-
return n.map((
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
error: y
|
|
81
|
+
})) : []), [U, S] = A(!1), b = s.join(", "), v = s.map((n) => `.${n.replace(/^\./, "")}`).join(","), x = _((n) => {
|
|
82
|
+
const p = o ? o * 1024 * 1024 : Number.POSITIVE_INFINITY, u = new Set(s.map((h) => h.toLowerCase().replace(/^\./, ""))), L = (g == null ? void 0 : g.replace(/\{maxSize\}/g, String(o))) ?? Ge(o), w = (f == null ? void 0 : f.replace(/\{fileExtensionsAllowed\}/g, b)) ?? Je(b);
|
|
83
|
+
return n.map((h) => {
|
|
84
|
+
const oe = h.size <= p, re = u.size === 0 || u.has(Ze(h));
|
|
85
|
+
let B;
|
|
86
|
+
return oe || (B = L), re || (B = w), {
|
|
87
|
+
file: h,
|
|
88
|
+
error: B
|
|
85
89
|
};
|
|
86
90
|
});
|
|
87
|
-
}, [s, b,
|
|
88
|
-
const
|
|
89
|
-
return
|
|
90
|
-
}, [l,
|
|
91
|
-
|
|
92
|
-
const n =
|
|
93
|
-
|
|
94
|
-
}, [
|
|
95
|
-
const
|
|
91
|
+
}, [s, b, o, g, f]), M = _((n) => {
|
|
92
|
+
const p = a.length;
|
|
93
|
+
return S(p + n.length > l), x(n);
|
|
94
|
+
}, [l, a.length, x]);
|
|
95
|
+
me(() => {
|
|
96
|
+
const n = x(k ?? []);
|
|
97
|
+
T(n), S(n.length > l);
|
|
98
|
+
}, [k, l, x]);
|
|
99
|
+
const W = _((n) => (n / 1024).toFixed(2) + " KB", []), ee = _(() => {
|
|
96
100
|
var n;
|
|
97
|
-
c || (n =
|
|
98
|
-
}, [c]),
|
|
99
|
-
var
|
|
100
|
-
c || n.key === "Enter" && ((
|
|
101
|
-
}, [c]),
|
|
101
|
+
c || (n = C.current) == null || n.click();
|
|
102
|
+
}, [c]), le = _((n) => {
|
|
103
|
+
var p;
|
|
104
|
+
c || n.key === "Enter" && ((p = C.current) == null || p.click());
|
|
105
|
+
}, [c]), ie = _((n) => {
|
|
102
106
|
if (c) return;
|
|
103
|
-
const
|
|
104
|
-
if (e === "multiple" &&
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
+
const p = n.target.files, u = M(Array.from(p ?? []));
|
|
108
|
+
if (e === "multiple" && I) {
|
|
109
|
+
const L = [...a, ...u];
|
|
110
|
+
T(L), d == null || d(L);
|
|
107
111
|
} else
|
|
108
|
-
|
|
112
|
+
T(u), d == null || d(u);
|
|
109
113
|
n.target.value = "";
|
|
110
|
-
}, [c, e,
|
|
111
|
-
if (c || !
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
}, [c,
|
|
115
|
-
id:
|
|
114
|
+
}, [c, e, I, a, M, d]), te = _((n) => {
|
|
115
|
+
if (c || !a || n < 0 || n >= a.length) return;
|
|
116
|
+
const p = a[n], u = a.filter((L, w) => w !== n);
|
|
117
|
+
S(u.length > l), T(u), N == null || N(p.file, u);
|
|
118
|
+
}, [c, a, l, N]), ne = {
|
|
119
|
+
id: H,
|
|
116
120
|
type: e,
|
|
117
121
|
maxFiles: l,
|
|
118
122
|
fileExtensionsAllowed: s,
|
|
119
123
|
fileExtensionsAllowedText: b,
|
|
120
|
-
maxSize:
|
|
121
|
-
queueFiles:
|
|
124
|
+
maxSize: o,
|
|
125
|
+
queueFiles: I,
|
|
122
126
|
disabled: c,
|
|
123
|
-
isUploadDisabled:
|
|
124
|
-
uploadedFiles:
|
|
125
|
-
isMaxFilesExceeded:
|
|
126
|
-
label:
|
|
127
|
-
required:
|
|
128
|
-
placeholder:
|
|
129
|
-
errorMessage:
|
|
130
|
-
helpText:
|
|
131
|
-
helpLink:
|
|
132
|
-
helpLinkText:
|
|
133
|
-
multipleHelpText:
|
|
134
|
-
multipleButtonHelpText:
|
|
135
|
-
labelTooltip:
|
|
136
|
-
accept:
|
|
137
|
-
inputRef:
|
|
138
|
-
triggerInput:
|
|
139
|
-
handleKeyDown:
|
|
140
|
-
handleRemoveFile:
|
|
141
|
-
displayFileSize:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
/* @__PURE__ */
|
|
127
|
+
isUploadDisabled: j,
|
|
128
|
+
uploadedFiles: a,
|
|
129
|
+
isMaxFilesExceeded: U,
|
|
130
|
+
label: O,
|
|
131
|
+
required: V,
|
|
132
|
+
placeholder: K,
|
|
133
|
+
errorMessage: q,
|
|
134
|
+
helpText: X,
|
|
135
|
+
helpLink: $,
|
|
136
|
+
helpLinkText: Y,
|
|
137
|
+
multipleHelpText: G,
|
|
138
|
+
multipleButtonHelpText: J,
|
|
139
|
+
labelTooltip: Z,
|
|
140
|
+
accept: v,
|
|
141
|
+
inputRef: C,
|
|
142
|
+
triggerInput: ee,
|
|
143
|
+
handleKeyDown: le,
|
|
144
|
+
handleRemoveFile: te,
|
|
145
|
+
displayFileSize: W,
|
|
146
|
+
uploadedFileAppendedRow: Q
|
|
147
|
+
}, se = P != null && (Array.isArray(P) ? P.length > 0 : !0);
|
|
148
|
+
return /* @__PURE__ */ r(E.Provider, { value: ne, children: [
|
|
149
|
+
/* @__PURE__ */ t("input", { accept: v, multiple: e === "multiple", ref: C, type: "file", id: H, className: i.input, onChange: ie }),
|
|
150
|
+
/* @__PURE__ */ t("div", { className: D(i.container, e === "multiple" && i.containerMultiple, c && i.disabled), children: se ? P : /* @__PURE__ */ t(Ue, {}) })
|
|
146
151
|
] });
|
|
147
152
|
}
|
|
148
|
-
function
|
|
149
|
-
const e =
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
e.type === "single" && /* @__PURE__ */
|
|
153
|
-
e.type === "single" && e.uploadedFiles.length > 0 && /* @__PURE__ */
|
|
154
|
-
e.type === "multiple" && /* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
153
|
+
function Ue() {
|
|
154
|
+
const e = m();
|
|
155
|
+
return /* @__PURE__ */ r(ce, { children: [
|
|
156
|
+
/* @__PURE__ */ t(F.Label, {}),
|
|
157
|
+
e.type === "single" && /* @__PURE__ */ t(F.SingleFileRow, { children: /* @__PURE__ */ t(F.BrowseButton, {}) }),
|
|
158
|
+
e.type === "single" && e.uploadedFiles.length > 0 && /* @__PURE__ */ t("span", { className: i.singleFileHelpLinkReservedSpace, children: /* @__PURE__ */ t(F.SingleFileDeleteButton, {}) }),
|
|
159
|
+
e.type === "multiple" && /* @__PURE__ */ t(F.BrowseButton, {}),
|
|
160
|
+
/* @__PURE__ */ t(F.HelpText, {}),
|
|
161
|
+
/* @__PURE__ */ t(F.UploadedFilesList, {})
|
|
157
162
|
] });
|
|
158
163
|
}
|
|
159
|
-
function
|
|
164
|
+
function We({
|
|
160
165
|
children: e
|
|
161
166
|
}) {
|
|
162
|
-
const l =
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
l.required && /* @__PURE__ */
|
|
166
|
-
l.labelTooltip && /* @__PURE__ */
|
|
167
|
-
l.type === "multiple" && l.multipleHelpText && /* @__PURE__ */
|
|
167
|
+
const l = m(), s = e ?? l.label;
|
|
168
|
+
return /* @__PURE__ */ r("label", { htmlFor: l.id, onClick: (o) => o.preventDefault(), className: D(i.label, l.type === "multiple" && i.labelMultiple), children: [
|
|
169
|
+
/* @__PURE__ */ t("span", { title: l.label, className: i.labelText, children: s }),
|
|
170
|
+
l.required && /* @__PURE__ */ t("span", { "aria-hidden": "true", className: i.required, children: "*" }),
|
|
171
|
+
l.labelTooltip && /* @__PURE__ */ t(_e, { content: l.labelTooltip.content, size: l.labelTooltip.size, theme: l.labelTooltip.theme, tipSide: l.labelTooltip.tipSide, tipAlignment: l.labelTooltip.tipAlignment, startVisible: l.labelTooltip.startVisible, children: /* @__PURE__ */ t(R, { icon: "ap-icon-info", className: i.labelTooltipIcon }) }),
|
|
172
|
+
l.type === "multiple" && l.multipleHelpText && /* @__PURE__ */ t("span", { className: i.multipleHelpText, children: l.multipleHelpText })
|
|
168
173
|
] });
|
|
169
174
|
}
|
|
170
|
-
function
|
|
175
|
+
function el({
|
|
171
176
|
children: e,
|
|
172
177
|
className: l
|
|
173
178
|
}) {
|
|
174
|
-
const s =
|
|
175
|
-
return s.type === "multiple" ? /* @__PURE__ */
|
|
176
|
-
|
|
177
|
-
}, children: /* @__PURE__ */
|
|
179
|
+
const s = m();
|
|
180
|
+
return s.type === "multiple" ? /* @__PURE__ */ t(y, { type: "secondary", variant: "default", size: "md", icon: "ap-icon-upload", className: D(i.multipleInputButton, l), onClick: s.triggerInput, onKeyDown: s.handleKeyDown, disabled: s.disabled || s.isUploadDisabled, children: /* @__PURE__ */ t("span", { children: e ?? `Browse files ${s.multipleButtonHelpText ?? ""}` }) }) : /* @__PURE__ */ t(y, { type: "tertiary", variant: "default", size: "md", icon: "ap-icon-upload", className: D(i.inputButton, l), tabIndex: -1, disabled: s.disabled || s.isUploadDisabled, onClick: (o) => {
|
|
181
|
+
o.preventDefault(), o.stopPropagation(), s.triggerInput();
|
|
182
|
+
}, children: /* @__PURE__ */ t("span", { children: e ?? "Browse file" }) });
|
|
178
183
|
}
|
|
179
|
-
function
|
|
184
|
+
function ll({
|
|
180
185
|
children: e
|
|
181
186
|
}) {
|
|
182
|
-
return
|
|
187
|
+
return m().type !== "single" ? null : /* @__PURE__ */ t("div", { className: i.singleFileContainer, children: e });
|
|
183
188
|
}
|
|
184
|
-
function
|
|
189
|
+
function il({
|
|
185
190
|
children: e
|
|
186
191
|
}) {
|
|
187
|
-
const l =
|
|
188
|
-
return l.type !== "single" ? null : /* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
192
|
+
const l = m();
|
|
193
|
+
return l.type !== "single" ? null : /* @__PURE__ */ r("div", { tabIndex: l.disabled ? -1 : 0, onClick: l.triggerInput, onKeyDown: l.handleKeyDown, className: i.singleFileInputContainer, children: [
|
|
194
|
+
/* @__PURE__ */ t("span", { className: i.inputFileName, children: l.uploadedFiles.length > 0 ? /* @__PURE__ */ t("span", { className: i.inputFileNameText, children: l.uploadedFiles[0].file.name }) : /* @__PURE__ */ t("span", { className: i.inputFileNamePlaceholder, children: l.placeholder }) }),
|
|
190
195
|
e
|
|
191
196
|
] });
|
|
192
197
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
198
|
+
function tl() {
|
|
199
|
+
return m().type !== "single" ? null : /* @__PURE__ */ t("span", { className: i.singleFileHelpLinkReservedSpace, children: /* @__PURE__ */ t(z, {}) });
|
|
195
200
|
}
|
|
196
|
-
function
|
|
197
|
-
const e =
|
|
198
|
-
|
|
199
|
-
const l = e.uploadedFiles[0].file.name;
|
|
200
|
-
return /* @__PURE__ */ i(x, { type: "tertiary", variant: "default", size: "md", icon: "ap-icon-delete", className: t.singleFileDeleteButton, onClick: () => e.handleRemoveFile(l), disabled: e.disabled });
|
|
201
|
+
function z() {
|
|
202
|
+
const e = m();
|
|
203
|
+
return e.type !== "single" || e.uploadedFiles.length === 0 ? null : /* @__PURE__ */ t(y, { type: "tertiary", variant: "default", size: "md", icon: "ap-icon-delete", className: i.singleFileDeleteButton, onClick: () => e.handleRemoveFile(0), disabled: e.disabled });
|
|
201
204
|
}
|
|
202
|
-
function
|
|
203
|
-
var
|
|
204
|
-
const e =
|
|
205
|
-
return e.type === "multiple" && !s ? null : /* @__PURE__ */
|
|
206
|
-
l ? /* @__PURE__ */
|
|
207
|
-
e.type === "single" && e.helpLink && e.helpLinkText && /* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
/* @__PURE__ */
|
|
205
|
+
function nl() {
|
|
206
|
+
var o, I;
|
|
207
|
+
const e = m(), l = e.errorMessage || e.isMaxFilesExceeded || e.type === "single" && ((o = e.uploadedFiles[0]) == null ? void 0 : o.error), s = e.type === "single" ? e.errorMessage || ((I = e.uploadedFiles[0]) == null ? void 0 : I.error) : e.errorMessage || (e.isMaxFilesExceeded ? `You can only upload up to ${e.maxFiles} files.` : "");
|
|
208
|
+
return e.type === "multiple" && !s ? null : /* @__PURE__ */ r("div", { className: i.helpers, children: [
|
|
209
|
+
l ? /* @__PURE__ */ t("span", { title: e.errorMessage, className: i.errorMessage, children: s }) : e.helpText && e.type === "single" && /* @__PURE__ */ t("span", { title: e.helpText, className: i.helperText, children: e.helpText }),
|
|
210
|
+
e.type === "single" && e.helpLink && e.helpLinkText && /* @__PURE__ */ r("span", { className: i.singleFileHelpLinkContainer, children: [
|
|
211
|
+
/* @__PURE__ */ t("a", { href: e.helpLink, className: i.helpLink, target: "_blank", rel: "noopener noreferrer", tabIndex: e.disabled ? -1 : 0, children: e.helpLinkText }),
|
|
212
|
+
/* @__PURE__ */ t("span", { className: i.singleFileHelpLinkReservedSpace })
|
|
210
213
|
] })
|
|
211
214
|
] });
|
|
212
215
|
}
|
|
213
|
-
function
|
|
214
|
-
const e =
|
|
215
|
-
return e.type !== "multiple" || !e.uploadedFiles.length ? null : /* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
216
|
+
function sl() {
|
|
217
|
+
const e = m();
|
|
218
|
+
return e.type !== "multiple" || !e.uploadedFiles.length ? null : /* @__PURE__ */ t("ul", { className: i.multipleFilesList, children: e.uploadedFiles.map((l, s) => /* @__PURE__ */ r("li", { className: i.multipleFilesListItem, children: [
|
|
219
|
+
/* @__PURE__ */ r("div", { className: i.multipleFilesListItemContent, children: [
|
|
220
|
+
/* @__PURE__ */ t("span", { className: i.multipleFilesListItemIconContainer, children: /* @__PURE__ */ t(R, { icon: "ap-icon-document", className: i.multipleFilesListItemIcon }) }),
|
|
221
|
+
/* @__PURE__ */ r("div", { className: i.multipleFilesListItemContentData, children: [
|
|
222
|
+
/* @__PURE__ */ r("div", { className: i.multipleFilesListItemText, children: [
|
|
223
|
+
/* @__PURE__ */ t("span", { className: i.multipleFilesListItemName, children: l.file.name }),
|
|
224
|
+
/* @__PURE__ */ t("span", { className: i.multipleFilesListItemSize, children: e.displayFileSize(l.file.size) }),
|
|
225
|
+
l.error && /* @__PURE__ */ r("span", { className: i.multipleFilesListItemError, children: [
|
|
226
|
+
/* @__PURE__ */ t(R, { icon: "ap-icon-alert", className: i.multipleFilesListItemIconError }),
|
|
227
|
+
l.error
|
|
228
|
+
] })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ t(y, { type: "tertiary", variant: "default", size: "sm", onClick: () => e.handleRemoveFile(s), icon: "ap-icon-delete", iconClassName: i.multipleFilesListItemIconDelete, disabled: e.disabled })
|
|
231
|
+
] })
|
|
232
|
+
] }),
|
|
233
|
+
e.uploadedFileAppendedRow && /* @__PURE__ */ t("div", { className: i.multipleFilesListItemAppendedRow, children: e.uploadedFileAppendedRow(l, s) })
|
|
234
|
+
] }, s)) });
|
|
229
235
|
}
|
|
230
|
-
const
|
|
231
|
-
Label:
|
|
232
|
-
BrowseButton:
|
|
233
|
-
HelpText:
|
|
234
|
-
UploadedFilesList:
|
|
235
|
-
SingleFileContainer:
|
|
236
|
-
SingleFileRow:
|
|
237
|
-
SingleFileActions:
|
|
238
|
-
SingleFileDeleteButton:
|
|
236
|
+
const F = Object.assign(Qe, {
|
|
237
|
+
Label: We,
|
|
238
|
+
BrowseButton: el,
|
|
239
|
+
HelpText: nl,
|
|
240
|
+
UploadedFilesList: sl,
|
|
241
|
+
SingleFileContainer: ll,
|
|
242
|
+
SingleFileRow: il,
|
|
243
|
+
SingleFileActions: tl,
|
|
244
|
+
SingleFileDeleteButton: z
|
|
239
245
|
});
|
|
240
246
|
export {
|
|
241
|
-
|
|
242
|
-
|
|
247
|
+
F as default,
|
|
248
|
+
m as useFilePickerContext
|
|
243
249
|
};
|