@studiolxd/brand 49.26.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 +12 -0
- package/dist/_types/atoms/FileUpload/FileUpload.d.ts +5 -3
- package/dist/file-upload.js +90 -90
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ El paquete sigue [semver](https://semver.org/lang/es/): **patch** para bug fixes
|
|
|
7
7
|
regeneración de `dist`, **minor** para componentes/props/variantes/tokens nuevos, **major**
|
|
8
8
|
para breaking changes.
|
|
9
9
|
|
|
10
|
+
## [49.27.0] — 2026-10-05
|
|
11
|
+
|
|
12
|
+
> **Minor (49.27.0).** «Subiendo…» pasa a ser texto del catálogo de brand. **Atención:** `fileUpload.uploading`
|
|
13
|
+
> es una clave nueva y obligatoria de `BrandMessages`: cada aplicación debe añadirla a su catálogo (es, en, fr…).
|
|
14
|
+
|
|
15
|
+
### `FileUpload` / `FileUploadField` — texto de la subida por defecto
|
|
16
|
+
|
|
17
|
+
- Clave nueva **`fileUpload.uploading`** («Subiendo…» / «Uploading…»). `uploading` sin `uploadingLabel` anuncia
|
|
18
|
+
ese texto (antes salía de `spinner.label`, «Cargando…»).
|
|
19
|
+
- `uploadingLabelVisible` sin `uploadingLabel` propio **pinta** el texto del catálogo (antes no pintaba nada).
|
|
20
|
+
- Las fixtures de Storybook (es) y de tests (en) llevan la clave nueva.
|
|
21
|
+
|
|
10
22
|
## [49.26.0] — 2026-10-05
|
|
11
23
|
|
|
12
24
|
> **Minor (49.26.0).** `LoadingState` puede pintar su texto en esperas largas con pasos. Sin cambios
|
|
@@ -34,6 +34,8 @@ export interface FileUploadMessages {
|
|
|
34
34
|
tooLarge: (maxSize: string) => string;
|
|
35
35
|
/** Error de tipo de archivo no admitido. */
|
|
36
36
|
invalidType: string;
|
|
37
|
+
/** Texto de la subida en curso («Subiendo…»): lo anuncia el lector y, con `uploadingLabelVisible`, se pinta en la zona. */
|
|
38
|
+
uploading: string;
|
|
37
39
|
}
|
|
38
40
|
export interface FileUploadProps {
|
|
39
41
|
multiple?: boolean;
|
|
@@ -57,13 +59,13 @@ export interface FileUploadProps {
|
|
|
57
59
|
/**
|
|
58
60
|
* Texto de la subida en curso («Subiendo 2 de 5…»). **No se ve** salvo con
|
|
59
61
|
* `uploadingLabelVisible`: es lo que anuncia el lector de pantalla. **Sin
|
|
60
|
-
* default**: sin él, sale de `
|
|
62
|
+
* default**: sin él, sale de `fileUpload.uploading` del `BrandMessagesProvider`.
|
|
61
63
|
*/
|
|
62
64
|
uploadingLabel?: string;
|
|
63
65
|
/**
|
|
64
66
|
* Pinta `uploadingLabel` en la zona, bajo el girador, para subidas largas con
|
|
65
|
-
* progreso por pasos.
|
|
66
|
-
*
|
|
67
|
+
* progreso por pasos. Sin `uploadingLabel` propio pinta el texto del catálogo
|
|
68
|
+
* (`fileUpload.uploading`, «Subiendo…»). Default `false`.
|
|
67
69
|
*/
|
|
68
70
|
uploadingLabelVisible?: boolean;
|
|
69
71
|
disabled?: boolean;
|
package/dist/file-upload.js
CHANGED
|
@@ -6,148 +6,148 @@ import { VisuallyHidden as n } from "./visually-hidden.js";
|
|
|
6
6
|
import { Spinner as r } from "./spinner.js";
|
|
7
7
|
import { n as i } from "./_shared/form-size.js";
|
|
8
8
|
import { t as ee } from "./_shared/progressbar.js";
|
|
9
|
-
import { i as te, n as a, t as
|
|
10
|
-
import { forwardRef as
|
|
11
|
-
import { Fragment as
|
|
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";
|
|
12
12
|
//#region src/stories/atoms/FileUpload/FileUpload.tsx
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var m = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
function h(e) {
|
|
15
15
|
if (!e.type.startsWith("image/")) return;
|
|
16
|
-
let t =
|
|
17
|
-
return t || (t = URL.createObjectURL(e),
|
|
16
|
+
let t = m.get(e);
|
|
17
|
+
return t || (t = URL.createObjectURL(e), m.set(e, t)), t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
let t =
|
|
21
|
-
t && (URL.revokeObjectURL(t),
|
|
19
|
+
function g(e) {
|
|
20
|
+
let t = m.get(e);
|
|
21
|
+
t && (URL.revokeObjectURL(t), m.delete(e));
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function ie(e, t) {
|
|
24
24
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
let N = e("fileUpload"),
|
|
28
|
-
|
|
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
29
|
K.forEach((e) => U.current.add(e));
|
|
30
|
-
}, [K]),
|
|
30
|
+
}, [K]), c(() => {
|
|
31
31
|
let e = U.current;
|
|
32
32
|
return () => {
|
|
33
|
-
e.forEach(
|
|
33
|
+
e.forEach(g);
|
|
34
34
|
};
|
|
35
35
|
}, []);
|
|
36
|
-
let q =
|
|
37
|
-
if (
|
|
38
|
-
let t = Array.from(e), n = I ?
|
|
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];
|
|
39
39
|
for (let e of t) {
|
|
40
|
-
if (
|
|
41
|
-
let t = te(e,
|
|
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);
|
|
42
42
|
t && r.set(e, t), i.push(e);
|
|
43
43
|
}
|
|
44
44
|
B(r), I || R(i), x?.(i.filter((e) => !r.has(e)));
|
|
45
45
|
}, [
|
|
46
|
-
|
|
46
|
+
w,
|
|
47
47
|
C,
|
|
48
|
-
|
|
48
|
+
m,
|
|
49
|
+
_,
|
|
49
50
|
v,
|
|
50
|
-
y,
|
|
51
51
|
I,
|
|
52
|
-
|
|
52
|
+
y,
|
|
53
53
|
L,
|
|
54
54
|
z,
|
|
55
55
|
x,
|
|
56
56
|
N,
|
|
57
57
|
k,
|
|
58
58
|
A,
|
|
59
|
-
|
|
60
|
-
]),
|
|
59
|
+
E
|
|
60
|
+
]), Ce = s((e) => {
|
|
61
61
|
if (C) return;
|
|
62
|
-
let t = (I ?
|
|
63
|
-
n.delete(e),
|
|
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 = "");
|
|
64
64
|
}, [
|
|
65
65
|
C,
|
|
66
66
|
I,
|
|
67
|
-
|
|
67
|
+
y,
|
|
68
68
|
L,
|
|
69
69
|
z,
|
|
70
70
|
x
|
|
71
|
-
]),
|
|
71
|
+
]), we = (e) => {
|
|
72
72
|
e.target.files && q(e.target.files);
|
|
73
|
+
}, Te = (e) => {
|
|
74
|
+
e.preventDefault(), !w && !C && H(!0);
|
|
73
75
|
}, Ee = (e) => {
|
|
74
|
-
e.preventDefault(), !T && !C && H(!0);
|
|
75
|
-
}, De = (e) => {
|
|
76
76
|
e.preventDefault(), H(!1);
|
|
77
|
-
},
|
|
78
|
-
e.preventDefault(), H(!1), !
|
|
79
|
-
},
|
|
80
|
-
!
|
|
81
|
-
},
|
|
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 = [
|
|
82
82
|
"file-upload",
|
|
83
83
|
P === "md" ? "" : `file-upload--${P}`,
|
|
84
84
|
V ? "file-upload--dragging" : "",
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
T ? "file-upload--error" : "",
|
|
86
|
+
w ? "file-upload--disabled" : "",
|
|
87
87
|
C ? "file-upload--uploading" : "",
|
|
88
88
|
K.length > 0 ? "file-upload--has-files" : "",
|
|
89
|
-
|
|
90
|
-
].filter(Boolean).join(" "), Y = `${G}-hint`,
|
|
91
|
-
return
|
|
92
|
-
className:
|
|
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,
|
|
93
93
|
children: [
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ f(n, { children: /* @__PURE__ */ f("input", {
|
|
95
95
|
ref: (e) => {
|
|
96
|
-
W.current = e,
|
|
96
|
+
W.current = e, ie(M, e);
|
|
97
97
|
},
|
|
98
98
|
type: "file",
|
|
99
99
|
id: G,
|
|
100
|
-
name:
|
|
101
|
-
multiple:
|
|
102
|
-
accept:
|
|
103
|
-
disabled:
|
|
104
|
-
required:
|
|
105
|
-
"aria-label":
|
|
106
|
-
"aria-describedby":
|
|
107
|
-
"aria-invalid":
|
|
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
108
|
"aria-busy": C || void 0,
|
|
109
109
|
"aria-disabled": C || void 0,
|
|
110
110
|
onClick: C ? (e) => e.preventDefault() : void 0,
|
|
111
|
-
onChange:
|
|
112
|
-
onBlur:
|
|
111
|
+
onChange: we,
|
|
112
|
+
onBlur: me
|
|
113
113
|
}) }),
|
|
114
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ f("div", {
|
|
115
115
|
className: "file-upload__dropzone",
|
|
116
|
-
onClick:
|
|
117
|
-
onDragOver:
|
|
118
|
-
onDragLeave:
|
|
119
|
-
onDrop:
|
|
116
|
+
onClick: Oe,
|
|
117
|
+
onDragOver: Te,
|
|
118
|
+
onDragLeave: Ee,
|
|
119
|
+
onDrop: De,
|
|
120
120
|
"aria-hidden": "true",
|
|
121
|
-
children: C ? /* @__PURE__ */
|
|
121
|
+
children: C ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", {
|
|
122
122
|
className: "file-upload__icon",
|
|
123
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ f(r, {
|
|
124
124
|
size: F,
|
|
125
125
|
"aria-hidden": !0
|
|
126
126
|
})
|
|
127
|
-
}),
|
|
127
|
+
}), Ae && /* @__PURE__ */ f("span", {
|
|
128
128
|
className: "file-upload__text",
|
|
129
129
|
children: Q
|
|
130
|
-
})] }) : /* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
130
|
+
})] }) : /* @__PURE__ */ p(d, { children: [
|
|
131
|
+
/* @__PURE__ */ f(t, {
|
|
132
132
|
name: "upload",
|
|
133
133
|
size: F,
|
|
134
134
|
className: "file-upload__icon"
|
|
135
135
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ f("span", {
|
|
137
137
|
className: "file-upload__text",
|
|
138
|
-
children: V ? N("dropzoneActive",
|
|
138
|
+
children: V ? N("dropzoneActive", _e) : X
|
|
139
139
|
}),
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ f("span", {
|
|
141
141
|
className: "file-upload__text file-upload__text--secondary",
|
|
142
142
|
children: Z
|
|
143
143
|
}),
|
|
144
|
-
$.length > 0 && /* @__PURE__ */
|
|
144
|
+
$.length > 0 && /* @__PURE__ */ f("span", {
|
|
145
145
|
className: "file-upload__subtext",
|
|
146
146
|
children: $.join(" · ")
|
|
147
147
|
})
|
|
148
148
|
] })
|
|
149
149
|
}),
|
|
150
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ f(n, {
|
|
151
151
|
id: Y,
|
|
152
152
|
children: [
|
|
153
153
|
X,
|
|
@@ -155,56 +155,56 @@ var v = s(function({ multiple: s = !1, accept: h, maxSize: v, maxFiles: y, value
|
|
|
155
155
|
...$
|
|
156
156
|
].join(". ")
|
|
157
157
|
}),
|
|
158
|
-
C && /* @__PURE__ */
|
|
158
|
+
C && /* @__PURE__ */ f(n, {
|
|
159
159
|
role: "status",
|
|
160
160
|
"aria-live": "polite",
|
|
161
161
|
"aria-atomic": "false",
|
|
162
162
|
children: Q
|
|
163
163
|
}),
|
|
164
|
-
K.length > 0 && /* @__PURE__ */
|
|
164
|
+
K.length > 0 && /* @__PURE__ */ f("ul", {
|
|
165
165
|
className: "file-upload__list",
|
|
166
|
-
"aria-label": N("files",
|
|
166
|
+
"aria-label": N("files", xe),
|
|
167
167
|
children: K.map((e, n) => {
|
|
168
|
-
let r = z.get(e), i =
|
|
169
|
-
return /* @__PURE__ */
|
|
168
|
+
let r = z.get(e), i = h(e);
|
|
169
|
+
return /* @__PURE__ */ p("li", {
|
|
170
170
|
className: `file-upload__item${r ? " file-upload__item--error" : ""}`,
|
|
171
171
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ f("div", {
|
|
173
173
|
className: "file-upload__item-thumb",
|
|
174
174
|
"aria-hidden": "true",
|
|
175
|
-
children: i ? /* @__PURE__ */
|
|
175
|
+
children: i ? /* @__PURE__ */ f("img", {
|
|
176
176
|
src: i,
|
|
177
177
|
alt: ""
|
|
178
|
-
}) : /* @__PURE__ */
|
|
178
|
+
}) : /* @__PURE__ */ f(t, {
|
|
179
179
|
name: "file-text",
|
|
180
180
|
size: "sm"
|
|
181
181
|
})
|
|
182
182
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ p("div", {
|
|
184
184
|
className: "file-upload__item-info",
|
|
185
185
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ f("span", {
|
|
187
187
|
className: "file-upload__item-name",
|
|
188
188
|
children: e.name
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ f("span", {
|
|
191
191
|
className: "file-upload__item-size",
|
|
192
|
-
children: a(e.size,
|
|
192
|
+
children: a(e.size, E)
|
|
193
193
|
}),
|
|
194
|
-
r && /* @__PURE__ */
|
|
194
|
+
r && /* @__PURE__ */ f("span", {
|
|
195
195
|
className: "file-upload__item-error-msg",
|
|
196
196
|
role: "alert",
|
|
197
197
|
children: r
|
|
198
198
|
})
|
|
199
199
|
]
|
|
200
200
|
}),
|
|
201
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ f("button", {
|
|
202
202
|
className: "file-upload__item-remove",
|
|
203
203
|
type: "button",
|
|
204
|
-
onClick: () =>
|
|
204
|
+
onClick: () => Ce(e),
|
|
205
205
|
"aria-disabled": C || void 0,
|
|
206
206
|
"aria-label": N("removeFile", O)(e.name),
|
|
207
|
-
children: /* @__PURE__ */
|
|
207
|
+
children: /* @__PURE__ */ f(t, {
|
|
208
208
|
name: "close",
|
|
209
209
|
size: "sm"
|
|
210
210
|
})
|
|
@@ -213,9 +213,9 @@ var v = s(function({ multiple: s = !1, accept: h, maxSize: v, maxFiles: y, value
|
|
|
213
213
|
}, `${e.name}-${e.size}-${n}`);
|
|
214
214
|
})
|
|
215
215
|
}),
|
|
216
|
-
S !== void 0 && /* @__PURE__ */
|
|
216
|
+
S !== void 0 && /* @__PURE__ */ f(ee, {
|
|
217
217
|
value: S,
|
|
218
|
-
label: N("progress",
|
|
218
|
+
label: N("progress", D),
|
|
219
219
|
size: "sm",
|
|
220
220
|
className: "file-upload__progress"
|
|
221
221
|
})
|
|
@@ -223,4 +223,4 @@ var v = s(function({ multiple: s = !1, accept: h, maxSize: v, maxFiles: y, value
|
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
225
|
//#endregion
|
|
226
|
-
export {
|
|
226
|
+
export { _ as FileUpload };
|