@studiolxd/brand 49.25.0 → 49.27.0
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/CHANGELOG.md +38 -0
- package/dist/_shared/tokens.js +4 -0
- package/dist/_types/atoms/FileUpload/FileUpload.d.ts +24 -0
- package/dist/_types/molecules/LoadingState/LoadingState.d.ts +13 -2
- package/dist/brand.css +9 -1
- package/dist/file-upload.css +1 -1
- package/dist/file-upload.js +137 -113
- package/dist/loading-state.css +1 -1
- package/dist/loading-state.js +22 -16
- package/dist/tokens.css +9 -1
- package/package.json +1 -1
- package/src/tokens/molecules/loading-state.css +4 -0
- package/src/tokens/scss/molecules/_loading-state.scss +4 -0
- package/src/tokens/surface-dark-derived.css +1 -0
- package/src/tokens/surface-invert.css +1 -0
- package/src/tokens/surface-light.css +1 -0
- package/src/tokens/surface-public.css +1 -0
- package/src/tokens/tokens.json +4 -0
package/dist/file-upload.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.file-upload{width:100%}.file-upload__dropzone{--_drop-color:var(--file-upload-border-color);--_drop-bg:var(--file-upload-bg);--_dash:var(--file-upload-border-dash-length);--_gap:var(--file-upload-border-dash-gap)}.file-upload.file-upload--sm{--file-upload-padding-block:var(--file-upload-sm-padding-block);--file-upload-padding-inline:var(--file-upload-sm-padding-inline);--file-upload-text-font-size:var(--file-upload-sm-text-font-size);--file-upload-subtext-font-size:var(--file-upload-sm-subtext-font-size);--file-upload-thumb-size:var(--file-upload-sm-thumb-size);--file-upload-item-name-font-size:var(--file-upload-sm-item-name-font-size)}.file-upload.file-upload--lg{--file-upload-padding-block:var(--file-upload-lg-padding-block);--file-upload-padding-inline:var(--file-upload-lg-padding-inline);--file-upload-text-font-size:var(--file-upload-lg-text-font-size);--file-upload-subtext-font-size:var(--file-upload-lg-subtext-font-size);--file-upload-thumb-size:var(--file-upload-lg-thumb-size);--file-upload-item-name-font-size:var(--file-upload-lg-item-name-font-size)}.file-upload__dropzone{justify-content:center;align-items:center;gap:var(--file-upload-gap);width:100%;padding-block:var(--file-upload-padding-block);padding-inline:var(--file-upload-padding-inline);background-image:repeating-linear-gradient(90deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap))), repeating-linear-gradient(90deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap))), repeating-linear-gradient(180deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap))), repeating-linear-gradient(180deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap)));background-size:100% var(--file-upload-border-width), 100% var(--file-upload-border-width), var(--file-upload-border-width) 100%, var(--file-upload-border-width) 100%;background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-color:var(--_drop-bg);color:var(--file-upload-text-color);cursor:pointer;transition:background-image var(--file-upload-transition-duration) var(--file-upload-transition-easing), background-color var(--file-upload-transition-duration) var(--file-upload-transition-easing);text-align:center;box-sizing:border-box;outline:none;flex-direction:column;display:flex}.file-upload:has(input[type=file]:focus-visible) .file-upload__dropzone{outline:var(--input-focus-ring-width) solid var(--input-focus-ring-color);outline-offset:var(--file-upload-remove-focus-ring-offset)}.file-upload.file-upload--dragging .file-upload__dropzone{--_drop-color:var(--file-upload-drag-border-color);--_drop-bg:var(--file-upload-drag-bg)}.file-upload.file-upload--error .file-upload__dropzone{--_drop-color:var(--file-upload-error-border-color);--_drop-bg:var(--file-upload-error-bg)}.file-upload.file-upload--disabled .file-upload__dropzone{opacity:var(--file-upload-disabled-opacity);cursor:var(--file-upload-disabled-cursor);pointer-events:none}.file-upload__icon{color:var(--file-upload-icon-color);flex-shrink:0;margin-block-end:var(--file-upload-gap)}.file-upload__text{font-family:var(--file-upload-text-font-family);font-size:var(--file-upload-text-font-size);font-weight:var(--file-upload-text-font-weight);color:var(--file-upload-text-color)}.file-upload__text--secondary{color:var(--file-upload-subtext-color);font-weight:var(--file-upload-subtext-font-weight)}.file-upload__subtext{font-family:var(--file-upload-text-font-family);font-size:var(--file-upload-subtext-font-size);color:var(--file-upload-subtext-color);margin-block-start:var(--file-upload-gap)}.file-upload__list{gap:var(--file-upload-list-gap);flex-direction:column;margin:0;margin-block-start:var(--file-upload-list-margin-block-start);padding:0;list-style:none;display:flex}.file-upload__item{align-items:center;gap:var(--file-upload-item-gap);padding-block:var(--file-upload-item-padding-block);padding-inline:var(--file-upload-item-padding-inline);border-width:var(--file-upload-item-border-width);border-style:solid;border-color:var(--file-upload-item-border-color);border-radius:var(--file-upload-item-border-radius);background-color:var(--file-upload-item-bg);display:flex}.file-upload__item.file-upload__item--error{border-color:var(--file-upload-item-error-border-color);background-color:var(--file-upload-item-error-bg)}.file-upload__item-thumb{width:var(--file-upload-thumb-size);height:var(--file-upload-thumb-size);border-radius:var(--file-upload-thumb-border-radius);background-color:var(--file-upload-thumb-bg);color:var(--file-upload-thumb-icon-color);flex-shrink:0;justify-content:center;align-items:center;display:flex;overflow:hidden}.file-upload__item-thumb img{object-fit:cover;width:100%;height:100%}.file-upload__item-info{gap:var(--file-upload-item-info-gap);flex-direction:column;flex:1;min-width:0;display:flex}.file-upload__item-name{font-family:var(--file-upload-item-name-font-family);font-size:var(--file-upload-item-name-font-size);font-weight:var(--file-upload-item-name-font-weight);color:var(--file-upload-item-name-color);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.file-upload__item-size{font-family:var(--file-upload-item-name-font-family);font-size:var(--file-upload-item-size-font-size);color:var(--file-upload-item-size-color)}.file-upload__item-error-msg{font-family:var(--file-upload-item-name-font-family);font-size:var(--file-upload-item-error-font-size);color:var(--file-upload-item-error-color)}.file-upload__item-remove{cursor:pointer;color:var(--file-upload-remove-color);transition:color var(--file-upload-transition-duration) var(--file-upload-transition-easing);background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;display:flex}.file-upload__item-remove:hover{color:var(--file-upload-remove-color-hover)}.file-upload__item-remove:focus-visible{outline:var(--input-focus-ring-width) solid var(--input-focus-ring-color);outline-offset:var(--file-upload-remove-focus-ring-offset);border-radius:var(--file-upload-remove-border-radius)}.file-upload__progress{margin-block-start:var(--file-upload-progress-margin-block-start)}
|
|
1
|
+
.file-upload{width:100%}.file-upload__dropzone{--_drop-color:var(--file-upload-border-color);--_drop-bg:var(--file-upload-bg);--_dash:var(--file-upload-border-dash-length);--_gap:var(--file-upload-border-dash-gap)}.file-upload.file-upload--sm{--file-upload-padding-block:var(--file-upload-sm-padding-block);--file-upload-padding-inline:var(--file-upload-sm-padding-inline);--file-upload-text-font-size:var(--file-upload-sm-text-font-size);--file-upload-subtext-font-size:var(--file-upload-sm-subtext-font-size);--file-upload-thumb-size:var(--file-upload-sm-thumb-size);--file-upload-item-name-font-size:var(--file-upload-sm-item-name-font-size)}.file-upload.file-upload--lg{--file-upload-padding-block:var(--file-upload-lg-padding-block);--file-upload-padding-inline:var(--file-upload-lg-padding-inline);--file-upload-text-font-size:var(--file-upload-lg-text-font-size);--file-upload-subtext-font-size:var(--file-upload-lg-subtext-font-size);--file-upload-thumb-size:var(--file-upload-lg-thumb-size);--file-upload-item-name-font-size:var(--file-upload-lg-item-name-font-size)}.file-upload__dropzone{justify-content:center;align-items:center;gap:var(--file-upload-gap);width:100%;padding-block:var(--file-upload-padding-block);padding-inline:var(--file-upload-padding-inline);background-image:repeating-linear-gradient(90deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap))), repeating-linear-gradient(90deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap))), repeating-linear-gradient(180deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap))), repeating-linear-gradient(180deg, var(--_drop-color) 0, var(--_drop-color) var(--_dash), transparent var(--_dash), transparent calc(var(--_dash) + var(--_gap)));background-size:100% var(--file-upload-border-width), 100% var(--file-upload-border-width), var(--file-upload-border-width) 100%, var(--file-upload-border-width) 100%;background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;background-color:var(--_drop-bg);color:var(--file-upload-text-color);cursor:pointer;transition:background-image var(--file-upload-transition-duration) var(--file-upload-transition-easing), background-color var(--file-upload-transition-duration) var(--file-upload-transition-easing);text-align:center;box-sizing:border-box;outline:none;flex-direction:column;display:flex}.file-upload:has(input[type=file]:focus-visible) .file-upload__dropzone{outline:var(--input-focus-ring-width) solid var(--input-focus-ring-color);outline-offset:var(--file-upload-remove-focus-ring-offset)}.file-upload.file-upload--dragging .file-upload__dropzone{--_drop-color:var(--file-upload-drag-border-color);--_drop-bg:var(--file-upload-drag-bg)}.file-upload.file-upload--error .file-upload__dropzone{--_drop-color:var(--file-upload-error-border-color);--_drop-bg:var(--file-upload-error-bg)}.file-upload.file-upload--disabled .file-upload__dropzone{opacity:var(--file-upload-disabled-opacity);cursor:var(--file-upload-disabled-cursor);pointer-events:none}.file-upload.file-upload--uploading .file-upload__dropzone{cursor:progress;pointer-events:none}.file-upload.file-upload--uploading span.file-upload__icon{display:flex}.file-upload.file-upload--uploading .file-upload__item-remove{pointer-events:none}.file-upload__icon{color:var(--file-upload-icon-color);flex-shrink:0;margin-block-end:var(--file-upload-gap)}.file-upload__text{font-family:var(--file-upload-text-font-family);font-size:var(--file-upload-text-font-size);font-weight:var(--file-upload-text-font-weight);color:var(--file-upload-text-color)}.file-upload__text--secondary{color:var(--file-upload-subtext-color);font-weight:var(--file-upload-subtext-font-weight)}.file-upload__subtext{font-family:var(--file-upload-text-font-family);font-size:var(--file-upload-subtext-font-size);color:var(--file-upload-subtext-color);margin-block-start:var(--file-upload-gap)}.file-upload__list{gap:var(--file-upload-list-gap);flex-direction:column;margin:0;margin-block-start:var(--file-upload-list-margin-block-start);padding:0;list-style:none;display:flex}.file-upload__item{align-items:center;gap:var(--file-upload-item-gap);padding-block:var(--file-upload-item-padding-block);padding-inline:var(--file-upload-item-padding-inline);border-width:var(--file-upload-item-border-width);border-style:solid;border-color:var(--file-upload-item-border-color);border-radius:var(--file-upload-item-border-radius);background-color:var(--file-upload-item-bg);display:flex}.file-upload__item.file-upload__item--error{border-color:var(--file-upload-item-error-border-color);background-color:var(--file-upload-item-error-bg)}.file-upload__item-thumb{width:var(--file-upload-thumb-size);height:var(--file-upload-thumb-size);border-radius:var(--file-upload-thumb-border-radius);background-color:var(--file-upload-thumb-bg);color:var(--file-upload-thumb-icon-color);flex-shrink:0;justify-content:center;align-items:center;display:flex;overflow:hidden}.file-upload__item-thumb img{object-fit:cover;width:100%;height:100%}.file-upload__item-info{gap:var(--file-upload-item-info-gap);flex-direction:column;flex:1;min-width:0;display:flex}.file-upload__item-name{font-family:var(--file-upload-item-name-font-family);font-size:var(--file-upload-item-name-font-size);font-weight:var(--file-upload-item-name-font-weight);color:var(--file-upload-item-name-color);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.file-upload__item-size{font-family:var(--file-upload-item-name-font-family);font-size:var(--file-upload-item-size-font-size);color:var(--file-upload-item-size-color)}.file-upload__item-error-msg{font-family:var(--file-upload-item-name-font-family);font-size:var(--file-upload-item-error-font-size);color:var(--file-upload-item-error-color)}.file-upload__item-remove{cursor:pointer;color:var(--file-upload-remove-color);transition:color var(--file-upload-transition-duration) var(--file-upload-transition-easing);background:0 0;border:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;display:flex}.file-upload__item-remove:hover{color:var(--file-upload-remove-color-hover)}.file-upload__item-remove:focus-visible{outline:var(--input-focus-ring-width) solid var(--input-focus-ring-color);outline-offset:var(--file-upload-remove-focus-ring-offset);border-radius:var(--file-upload-remove-border-radius)}.file-upload__progress{margin-block-start:var(--file-upload-progress-margin-block-start)}
|
package/dist/file-upload.js
CHANGED
|
@@ -3,184 +3,208 @@ import './file-upload.css';
|
|
|
3
3
|
import { n as e } from "./_shared/brandmessagescontext.js";
|
|
4
4
|
import { Icon as t } from "./icon.js";
|
|
5
5
|
import { VisuallyHidden as n } from "./visually-hidden.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { Spinner as r } from "./spinner.js";
|
|
7
|
+
import { n as i } from "./_shared/form-size.js";
|
|
8
|
+
import { t as ee } from "./_shared/progressbar.js";
|
|
9
|
+
import { i as te, n as a, t as ne } from "./_shared/validate.js";
|
|
10
|
+
import { forwardRef as o, useCallback as s, useEffect as c, useId as re, useRef as l, useState as u } from "react";
|
|
11
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
12
|
//#region src/stories/atoms/FileUpload/FileUpload.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
13
|
+
var m = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
function h(e) {
|
|
14
15
|
if (!e.type.startsWith("image/")) return;
|
|
15
|
-
let t =
|
|
16
|
-
return t || (t = URL.createObjectURL(e),
|
|
16
|
+
let t = m.get(e);
|
|
17
|
+
return t || (t = URL.createObjectURL(e), m.set(e, t)), t;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
let t =
|
|
20
|
-
t && (URL.revokeObjectURL(t),
|
|
19
|
+
function g(e) {
|
|
20
|
+
let t = m.get(e);
|
|
21
|
+
t && (URL.revokeObjectURL(t), m.delete(e));
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function ie(e, t) {
|
|
23
24
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
24
25
|
}
|
|
25
|
-
var
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
let e =
|
|
26
|
+
var _ = o(function({ multiple: o = !1, accept: m, maxSize: _, maxFiles: v, value: y, defaultValue: b = [], onChange: x, progress: S, uploading: C = !1, uploadingLabel: ae, uploadingLabelVisible: oe = !1, disabled: w = !1, error: T = !1, id: se, name: ce, describedBy: le, ariaLabel: ue, "aria-describedby": de, "aria-label": fe, required: pe, onBlur: me, className: he, locale: E = ne, dropzoneLabel: ge, dropzoneActiveLabel: _e, dropzoneHintLabel: ve, maxSizeHint: ye, maxFilesHint: be, filesLabel: xe, progressLabel: D, removeFileLabel: O, tooLargeError: k, invalidTypeError: A, size: j }, M) {
|
|
27
|
+
let N = e("fileUpload"), P = i(j), F = P === "sm" ? "sm" : P === "lg" ? "lg" : "md", I = y !== void 0, [L, R] = u(b), [z, B] = u(/* @__PURE__ */ new Map()), [V, H] = u(!1), U = l(/* @__PURE__ */ new Set()), W = l(null), Se = re(), G = se ?? `file-upload-${Se}`, K = I ? y : L;
|
|
28
|
+
c(() => {
|
|
29
|
+
K.forEach((e) => U.current.add(e));
|
|
30
|
+
}, [K]), c(() => {
|
|
31
|
+
let e = U.current;
|
|
31
32
|
return () => {
|
|
32
|
-
e.forEach(
|
|
33
|
+
e.forEach(g);
|
|
33
34
|
};
|
|
34
35
|
}, []);
|
|
35
|
-
let
|
|
36
|
-
if (
|
|
37
|
-
let t = Array.from(e), n =
|
|
36
|
+
let q = s((e) => {
|
|
37
|
+
if (w || C) return;
|
|
38
|
+
let t = Array.from(e), n = I ? y ?? [] : L, r = new Map(z), i = [...n];
|
|
38
39
|
for (let e of t) {
|
|
39
|
-
if (
|
|
40
|
-
let t =
|
|
40
|
+
if (v !== void 0 && i.filter((e) => !r.has(e)).length >= v) break;
|
|
41
|
+
let t = te(e, m, _, N("tooLarge", k), N("invalidType", A), E);
|
|
41
42
|
t && r.set(e, t), i.push(e);
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
B(r), I || R(i), x?.(i.filter((e) => !r.has(e)));
|
|
44
45
|
}, [
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
w,
|
|
47
|
+
C,
|
|
48
|
+
m,
|
|
49
|
+
_,
|
|
50
|
+
v,
|
|
51
|
+
I,
|
|
47
52
|
y,
|
|
48
|
-
b,
|
|
49
53
|
L,
|
|
54
|
+
z,
|
|
50
55
|
x,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
C,
|
|
54
|
-
P,
|
|
56
|
+
N,
|
|
57
|
+
k,
|
|
55
58
|
A,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let t = (
|
|
60
|
-
n.delete(e),
|
|
59
|
+
E
|
|
60
|
+
]), Ce = s((e) => {
|
|
61
|
+
if (C) return;
|
|
62
|
+
let t = (I ? y ?? [] : L).filter((t) => t !== e), n = new Map(z);
|
|
63
|
+
n.delete(e), g(e), B(n), I || R(t), x?.(t.filter((e) => !n.has(e))), W.current && (W.current.value = "");
|
|
61
64
|
}, [
|
|
65
|
+
C,
|
|
66
|
+
I,
|
|
67
|
+
y,
|
|
62
68
|
L,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
e.
|
|
69
|
-
},
|
|
70
|
-
e.preventDefault(),
|
|
71
|
-
},
|
|
72
|
-
e.preventDefault(),
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
T || G.current?.click();
|
|
77
|
-
}, Se = [
|
|
69
|
+
z,
|
|
70
|
+
x
|
|
71
|
+
]), we = (e) => {
|
|
72
|
+
e.target.files && q(e.target.files);
|
|
73
|
+
}, Te = (e) => {
|
|
74
|
+
e.preventDefault(), !w && !C && H(!0);
|
|
75
|
+
}, Ee = (e) => {
|
|
76
|
+
e.preventDefault(), H(!1);
|
|
77
|
+
}, De = (e) => {
|
|
78
|
+
e.preventDefault(), H(!1), !w && !C && e.dataTransfer.files && q(e.dataTransfer.files);
|
|
79
|
+
}, Oe = () => {
|
|
80
|
+
!w && !C && W.current?.click();
|
|
81
|
+
}, J = [
|
|
78
82
|
"file-upload",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
P === "md" ? "" : `file-upload--${P}`,
|
|
84
|
+
V ? "file-upload--dragging" : "",
|
|
85
|
+
T ? "file-upload--error" : "",
|
|
86
|
+
w ? "file-upload--disabled" : "",
|
|
87
|
+
C ? "file-upload--uploading" : "",
|
|
88
|
+
K.length > 0 ? "file-upload--has-files" : "",
|
|
89
|
+
he ?? ""
|
|
90
|
+
].filter(Boolean).join(" "), Y = `${G}-hint`, ke = [le ?? de, Y].filter(Boolean).join(" "), X = N("dropzone", ge), Z = N("dropzoneHint", ve), Q = C ? N("uploading", ae) : "", Ae = C && oe, $ = [];
|
|
91
|
+
return m && $.push(m), _ && $.push(N("maxSize", ye)(a(_, E))), o && v && $.push(N("maxFiles", be)(v)), /* @__PURE__ */ p("div", {
|
|
92
|
+
className: J,
|
|
88
93
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ f(n, { children: /* @__PURE__ */ f("input", {
|
|
90
95
|
ref: (e) => {
|
|
91
|
-
|
|
96
|
+
W.current = e, ie(M, e);
|
|
92
97
|
},
|
|
93
98
|
type: "file",
|
|
94
|
-
id:
|
|
95
|
-
name:
|
|
96
|
-
multiple:
|
|
97
|
-
accept:
|
|
98
|
-
disabled:
|
|
99
|
-
required:
|
|
100
|
-
"aria-label":
|
|
101
|
-
"aria-describedby":
|
|
102
|
-
"aria-invalid":
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
id: G,
|
|
100
|
+
name: ce,
|
|
101
|
+
multiple: o,
|
|
102
|
+
accept: m,
|
|
103
|
+
disabled: w,
|
|
104
|
+
required: pe,
|
|
105
|
+
"aria-label": ue ?? fe,
|
|
106
|
+
"aria-describedby": ke,
|
|
107
|
+
"aria-invalid": T || void 0,
|
|
108
|
+
"aria-busy": C || void 0,
|
|
109
|
+
"aria-disabled": C || void 0,
|
|
110
|
+
onClick: C ? (e) => e.preventDefault() : void 0,
|
|
111
|
+
onChange: we,
|
|
112
|
+
onBlur: me
|
|
105
113
|
}) }),
|
|
106
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ f("div", {
|
|
107
115
|
className: "file-upload__dropzone",
|
|
108
|
-
onClick:
|
|
109
|
-
onDragOver:
|
|
110
|
-
onDragLeave:
|
|
111
|
-
onDrop:
|
|
116
|
+
onClick: Oe,
|
|
117
|
+
onDragOver: Te,
|
|
118
|
+
onDragLeave: Ee,
|
|
119
|
+
onDrop: De,
|
|
112
120
|
"aria-hidden": "true",
|
|
113
|
-
children: [
|
|
114
|
-
|
|
121
|
+
children: C ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", {
|
|
122
|
+
className: "file-upload__icon",
|
|
123
|
+
children: /* @__PURE__ */ f(r, {
|
|
124
|
+
size: F,
|
|
125
|
+
"aria-hidden": !0
|
|
126
|
+
})
|
|
127
|
+
}), Ae && /* @__PURE__ */ f("span", {
|
|
128
|
+
className: "file-upload__text",
|
|
129
|
+
children: Q
|
|
130
|
+
})] }) : /* @__PURE__ */ p(d, { children: [
|
|
131
|
+
/* @__PURE__ */ f(t, {
|
|
115
132
|
name: "upload",
|
|
116
|
-
size:
|
|
133
|
+
size: F,
|
|
117
134
|
className: "file-upload__icon"
|
|
118
135
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ f("span", {
|
|
120
137
|
className: "file-upload__text",
|
|
121
|
-
children:
|
|
138
|
+
children: V ? N("dropzoneActive", _e) : X
|
|
122
139
|
}),
|
|
123
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ f("span", {
|
|
124
141
|
className: "file-upload__text file-upload__text--secondary",
|
|
125
|
-
children:
|
|
142
|
+
children: Z
|
|
126
143
|
}),
|
|
127
|
-
$.length > 0 && /* @__PURE__ */
|
|
144
|
+
$.length > 0 && /* @__PURE__ */ f("span", {
|
|
128
145
|
className: "file-upload__subtext",
|
|
129
146
|
children: $.join(" · ")
|
|
130
147
|
})
|
|
131
|
-
]
|
|
148
|
+
] })
|
|
132
149
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
id:
|
|
150
|
+
/* @__PURE__ */ f(n, {
|
|
151
|
+
id: Y,
|
|
135
152
|
children: [
|
|
153
|
+
X,
|
|
136
154
|
Z,
|
|
137
|
-
Q,
|
|
138
155
|
...$
|
|
139
156
|
].join(". ")
|
|
140
157
|
}),
|
|
141
|
-
|
|
158
|
+
C && /* @__PURE__ */ f(n, {
|
|
159
|
+
role: "status",
|
|
160
|
+
"aria-live": "polite",
|
|
161
|
+
"aria-atomic": "false",
|
|
162
|
+
children: Q
|
|
163
|
+
}),
|
|
164
|
+
K.length > 0 && /* @__PURE__ */ f("ul", {
|
|
142
165
|
className: "file-upload__list",
|
|
143
|
-
"aria-label":
|
|
144
|
-
children:
|
|
145
|
-
let r =
|
|
146
|
-
return /* @__PURE__ */
|
|
166
|
+
"aria-label": N("files", xe),
|
|
167
|
+
children: K.map((e, n) => {
|
|
168
|
+
let r = z.get(e), i = h(e);
|
|
169
|
+
return /* @__PURE__ */ p("li", {
|
|
147
170
|
className: `file-upload__item${r ? " file-upload__item--error" : ""}`,
|
|
148
171
|
children: [
|
|
149
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ f("div", {
|
|
150
173
|
className: "file-upload__item-thumb",
|
|
151
174
|
"aria-hidden": "true",
|
|
152
|
-
children: i ? /* @__PURE__ */
|
|
175
|
+
children: i ? /* @__PURE__ */ f("img", {
|
|
153
176
|
src: i,
|
|
154
177
|
alt: ""
|
|
155
|
-
}) : /* @__PURE__ */
|
|
178
|
+
}) : /* @__PURE__ */ f(t, {
|
|
156
179
|
name: "file-text",
|
|
157
180
|
size: "sm"
|
|
158
181
|
})
|
|
159
182
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ p("div", {
|
|
161
184
|
className: "file-upload__item-info",
|
|
162
185
|
children: [
|
|
163
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ f("span", {
|
|
164
187
|
className: "file-upload__item-name",
|
|
165
188
|
children: e.name
|
|
166
189
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ f("span", {
|
|
168
191
|
className: "file-upload__item-size",
|
|
169
|
-
children:
|
|
192
|
+
children: a(e.size, E)
|
|
170
193
|
}),
|
|
171
|
-
r && /* @__PURE__ */
|
|
194
|
+
r && /* @__PURE__ */ f("span", {
|
|
172
195
|
className: "file-upload__item-error-msg",
|
|
173
196
|
role: "alert",
|
|
174
197
|
children: r
|
|
175
198
|
})
|
|
176
199
|
]
|
|
177
200
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ f("button", {
|
|
179
202
|
className: "file-upload__item-remove",
|
|
180
203
|
type: "button",
|
|
181
|
-
onClick: () =>
|
|
182
|
-
"aria-
|
|
183
|
-
|
|
204
|
+
onClick: () => Ce(e),
|
|
205
|
+
"aria-disabled": C || void 0,
|
|
206
|
+
"aria-label": N("removeFile", O)(e.name),
|
|
207
|
+
children: /* @__PURE__ */ f(t, {
|
|
184
208
|
name: "close",
|
|
185
209
|
size: "sm"
|
|
186
210
|
})
|
|
@@ -189,9 +213,9 @@ var y = c(function({ multiple: c = !1, accept: g, maxSize: y, maxFiles: b, value
|
|
|
189
213
|
}, `${e.name}-${e.size}-${n}`);
|
|
190
214
|
})
|
|
191
215
|
}),
|
|
192
|
-
|
|
193
|
-
value:
|
|
194
|
-
label:
|
|
216
|
+
S !== void 0 && /* @__PURE__ */ f(ee, {
|
|
217
|
+
value: S,
|
|
218
|
+
label: N("progress", D),
|
|
195
219
|
size: "sm",
|
|
196
220
|
className: "file-upload__progress"
|
|
197
221
|
})
|
|
@@ -199,4 +223,4 @@ var y = c(function({ multiple: c = !1, accept: g, maxSize: y, maxFiles: b, value
|
|
|
199
223
|
});
|
|
200
224
|
});
|
|
201
225
|
//#endregion
|
|
202
|
-
export {
|
|
226
|
+
export { _ as FileUpload };
|
package/dist/loading-state.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.loading-state{justify-content:center;align-items:center;gap:var(--loading-state-gap);block-size:100%;min-block-size:var(--loading-state-min-block-size);padding-block:var(--loading-state-padding-block);padding-inline:var(--loading-state-padding-inline);text-align:center;flex-direction:column;flex:auto;display:flex}.loading-state__spinner{color:var(--loading-state-spinner-color);display:flex}.loading-state.loading-state--sm{min-block-size:var(--loading-state-sm-min-block-size);padding-block:var(--loading-state-sm-padding-block)}.loading-state.loading-state--fill{min-block-size:calc(100dvh - var(--app-shell-chrome-block-start,0px) - 2 * var(--section-padding-block-lg))}
|
|
1
|
+
.loading-state{justify-content:center;align-items:center;gap:var(--loading-state-gap);block-size:100%;min-block-size:var(--loading-state-min-block-size);padding-block:var(--loading-state-padding-block);padding-inline:var(--loading-state-padding-inline);text-align:center;flex-direction:column;flex:auto;display:flex}.loading-state__spinner{color:var(--loading-state-spinner-color);display:flex}.loading-state__label{font-family:var(--loading-state-label-font-family);font-size:var(--loading-state-label-font-size);color:var(--loading-state-label-color);margin-block:0;margin-inline:0}.loading-state.loading-state--sm .loading-state__label{font-size:var(--loading-state-sm-label-font-size)}.loading-state.loading-state--sm{min-block-size:var(--loading-state-sm-min-block-size);padding-block:var(--loading-state-sm-padding-block)}.loading-state.loading-state--fill{min-block-size:calc(100dvh - var(--app-shell-chrome-block-start,0px) - 2 * var(--section-padding-block-lg))}
|
package/dist/loading-state.js
CHANGED
|
@@ -7,37 +7,43 @@ import { Button as r } from "./button.js";
|
|
|
7
7
|
import { useId as i } from "react";
|
|
8
8
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
9
9
|
//#region src/stories/molecules/LoadingState/LoadingState.tsx
|
|
10
|
-
function s({ label: s,
|
|
11
|
-
let
|
|
10
|
+
function s({ label: s, labelVisible: c = !1, size: l = "md", fill: u = !1, action: d, className: f, ...p }) {
|
|
11
|
+
let m = e("spinner"), h = i(), g = m("label", s), _ = c && !!s;
|
|
12
12
|
return /* @__PURE__ */ o("div", {
|
|
13
13
|
className: [
|
|
14
14
|
"loading-state",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
l === "sm" ? "loading-state--sm" : "",
|
|
16
|
+
u ? "loading-state--fill" : "",
|
|
17
|
+
f
|
|
18
18
|
].filter(Boolean).join(" "),
|
|
19
19
|
role: "status",
|
|
20
20
|
"aria-busy": "true",
|
|
21
|
-
"aria-labelledby":
|
|
22
|
-
|
|
21
|
+
"aria-labelledby": h,
|
|
22
|
+
"aria-live": "polite",
|
|
23
|
+
"aria-atomic": "false",
|
|
24
|
+
...p,
|
|
23
25
|
children: [
|
|
24
26
|
/* @__PURE__ */ a("span", {
|
|
25
27
|
className: "loading-state__spinner",
|
|
26
28
|
children: /* @__PURE__ */ a(n, {
|
|
27
|
-
size:
|
|
29
|
+
size: l === "sm" ? "md" : "lg",
|
|
28
30
|
"aria-hidden": !0
|
|
29
31
|
})
|
|
30
32
|
}),
|
|
31
|
-
/* @__PURE__ */ a(
|
|
32
|
-
id:
|
|
33
|
-
|
|
33
|
+
_ ? /* @__PURE__ */ a("p", {
|
|
34
|
+
id: h,
|
|
35
|
+
className: "loading-state__label",
|
|
36
|
+
children: g
|
|
37
|
+
}) : /* @__PURE__ */ a(t, {
|
|
38
|
+
id: h,
|
|
39
|
+
children: g
|
|
34
40
|
}),
|
|
35
|
-
|
|
41
|
+
d && /* @__PURE__ */ a(r, {
|
|
36
42
|
variant: "outline",
|
|
37
|
-
size:
|
|
38
|
-
onClick:
|
|
39
|
-
href:
|
|
40
|
-
children:
|
|
43
|
+
size: l === "sm" ? "sm" : "md",
|
|
44
|
+
onClick: d.onClick,
|
|
45
|
+
href: d.href,
|
|
46
|
+
children: d.label
|
|
41
47
|
})
|
|
42
48
|
]
|
|
43
49
|
});
|