@studiolxd/brand 43.0.0 → 44.1.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 +69 -0
- package/dist/_shared/imagecropdialog.js +124 -123
- package/dist/_shared/validate.js +31 -5
- package/dist/_types/atoms/FileUpload/FileUpload.d.ts +79 -11
- package/dist/_types/atoms/FileUpload/validate.d.ts +36 -3
- package/dist/_types/messages/BrandMessages.d.ts +7 -1
- package/dist/_types/messages/index.d.ts +1 -1
- package/dist/_types/molecules/AvatarUpload/AvatarUpload.d.ts +123 -25
- package/dist/_types/molecules/CalendarPlanner/CalendarPlanner.d.ts +5 -4
- package/dist/_types/molecules/CalendarRoster/CalendarRoster.d.ts +5 -4
- package/dist/_types/molecules/ImageCropDialog/ImageCropDialog.d.ts +28 -4
- package/dist/avatar-upload.js +98 -95
- package/dist/brand.css +2 -2
- package/dist/calendar-planner.js +47 -46
- package/dist/calendar-roster.js +62 -61
- package/dist/file-upload.js +120 -117
- package/dist/tokens.css +2 -2
- package/package.json +1 -1
- package/src/tokens/components/star-rating.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,75 @@ 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
|
+
## [44.1.0] — 2026-09-15
|
|
11
|
+
|
|
12
|
+
> **Minor.** Las estrellas ganadas de `StarRating` se rellenan en accent-2 sobre superficie
|
|
13
|
+
> oscura.
|
|
14
|
+
|
|
15
|
+
Un solo token, `star-rating.surface-dark-fill-color`, pasa de `{color.accent-1}` a
|
|
16
|
+
`{color.accent-2}` (decisión del 2026-09-15). Sobre superficie clara sigue en prusia, que
|
|
17
|
+
ahí sí contrasta. Ningún color nuevo.
|
|
18
|
+
|
|
19
|
+
## [44.0.0] — 2026-09-15
|
|
20
|
+
|
|
21
|
+
> **Major.** Quinta familia al proveedor de textos: las subidas. `FileUpload`,
|
|
22
|
+
> `AvatarUpload` e `ImageCropDialog` dejan de traer castellano puesto, el peso de un
|
|
23
|
+
> archivo lo escribe el `locale`, y una lista de formatos lleva la conjunción de su idioma.
|
|
24
|
+
|
|
25
|
+
### Las subidas leen del proveedor
|
|
26
|
+
|
|
27
|
+
Tres espacios nuevos en `BrandMessages`: **`fileUpload`**, **`imageCropDialog`** y
|
|
28
|
+
**`avatarUpload`**, veintidós claves. `CalendarPlanner` y `CalendarRoster` no estrenan
|
|
29
|
+
espacio: sus dos flechas leen `calendar.previousMonth` y `calendar.nextMonth`, que es
|
|
30
|
+
literalmente el mismo texto que el del `Calendar`. Mismo orden —**prop → proveedor →
|
|
31
|
+
error**— y misma naturaleza: incompatible **en tiempo de compilación**.
|
|
32
|
+
|
|
33
|
+
Un cambio incompatible más, de props: `AvatarUpload.cropTitle` pasa a **obligatorio**. El
|
|
34
|
+
diálogo no sabe qué se recorta —«Recorta tu foto», «Recorta tu logo»—, y eso es contenido de
|
|
35
|
+
la pantalla, no del sistema.
|
|
36
|
+
|
|
37
|
+
### «2,5 MB» tiene dos mitades
|
|
38
|
+
|
|
39
|
+
`formatBytes` hacía `toFixed(1) + ' KB'`: punto decimal inglés cableado, en todos los
|
|
40
|
+
idiomas. Ahora el peso lo escribe `Intl.NumberFormat` con `style: 'unit'` en el `locale`
|
|
41
|
+
del componente, y al catálogo va solo la plantilla que lo envuelve («máx. {size}»). Con el
|
|
42
|
+
mismo catálogo inglés, `es-ES` escribe «max. 2,5 MB» y `en-US` «max. 2.5 MB». Es la regla
|
|
43
|
+
de la v43 aplicada a otra cosa: *si cambia al cambiar de idioma es cromo; si cambia al
|
|
44
|
+
cambiar de país es formato.*
|
|
45
|
+
|
|
46
|
+
Efecto de asumir CLDR: las unidades son las suyas —«kB» y no «KB»— y por debajo de un
|
|
47
|
+
kilobyte un `en-US` escribe «500 byte». La alternativa era volver a decidir a mano la
|
|
48
|
+
colocación del sufijo, que es justo lo que la regla prohíbe.
|
|
49
|
+
|
|
50
|
+
### Dos textos que no se pueden traducir por separado
|
|
51
|
+
|
|
52
|
+
`AvatarUpload` tiene un botón con texto visible («Subir») y un nombre accesible («Subir el
|
|
53
|
+
logo»), y WCAG 2.5.3 exige que el segundo **contenga** al primero. Traducirlos en dos
|
|
54
|
+
sitios distintos es dejar que una traducción los despareje sin que falle nada; concatenarlos
|
|
55
|
+
en el componente es castellano disfrazado, porque el orden es del idioma —«Subir el logo»
|
|
56
|
+
lleva el verbo delante, «das Logo hochladen» lo lleva detrás—. Así que van los dos al
|
|
57
|
+
catálogo, `avatarUpload.button` y `avatarUpload.buttonFor(subject)`, con la regla escrita
|
|
58
|
+
al lado; la pantalla solo aporta el sujeto. El aviso de consola en desarrollo sigue
|
|
59
|
+
vigilando la contención.
|
|
60
|
+
|
|
61
|
+
### Una lista lleva la conjunción de su idioma
|
|
62
|
+
|
|
63
|
+
Los formatos admitidos se unían con `join(', ')` y no ponían conjunción en ningún idioma:
|
|
64
|
+
«JPEG, PNG, WEBP». Ahora es `Intl.ListFormat` con `type: 'disjunction'`: «JPEG, PNG o
|
|
65
|
+
WEBP», «JPEG, PNG, or WEBP», «JPEG, PNG oder WEBP».
|
|
66
|
+
|
|
67
|
+
### Lo que se queda como prop
|
|
68
|
+
|
|
69
|
+
`ImageCropDialog.title`, `cancelLabel` y `confirmLabel` eran ya obligatorias y sin default,
|
|
70
|
+
y son el modelo de toda la ola: el diálogo no sabe qué se recorta ni qué pasa al confirmar.
|
|
71
|
+
En `AvatarUpload`, en cambio, `cropCancel` y `cropConfirm` sí salen del catálogo, y no es
|
|
72
|
+
incoherencia: esa subida sí sabe lo que confirma —se guarda un recorte—, y vale igual en
|
|
73
|
+
todas las pantallas.
|
|
74
|
+
|
|
75
|
+
Quedan dos reenvíos puros a una pieza sin migrar: `ImageCropDialog.closeLabel` y
|
|
76
|
+
`AvatarUpload.cropCloseLabel` van al `Modal`, que aún trae su «Cerrar». Es la deuda que
|
|
77
|
+
esta ola deja apuntada, y es por donde sigue la siguiente.
|
|
78
|
+
|
|
10
79
|
## [43.0.0] — 2026-09-15
|
|
11
80
|
|
|
12
81
|
> **Major.** Cuarta familia al proveedor de textos: fecha y hora. `Calendar`, `DatePicker`
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import '../imagecropdialog.css';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
2
|
+
import { n as e } from "./brandmessagescontext.js";
|
|
3
|
+
import { Spinner as t } from "../spinner.js";
|
|
4
|
+
import { Button as n } from "../button.js";
|
|
5
|
+
import { Alert as r } from "../alert.js";
|
|
6
|
+
import { Modal as i } from "../modal.js";
|
|
7
|
+
import a, { PureComponent as o, createRef as s, useRef as c, useState as l } from "react";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
9
|
//#region node_modules/.pnpm/react-image-crop@11.1.2_react@19.2.4/node_modules/react-image-crop/dist/index.js
|
|
9
|
-
var
|
|
10
|
+
var p = {
|
|
10
11
|
x: 0,
|
|
11
12
|
y: 0,
|
|
12
13
|
width: 0,
|
|
13
14
|
height: 0,
|
|
14
15
|
unit: "px"
|
|
15
|
-
},
|
|
16
|
-
function
|
|
17
|
-
let i =
|
|
18
|
-
return e.width && (i.height = i.width / t), e.height && (i.width = i.height * t), i.y + i.height > r && (i.height = r - i.y, i.width = i.height * t), i.x + i.width > n && (i.width = n - i.x, i.height = i.width / t), e.unit === "%" ?
|
|
19
|
-
}
|
|
20
|
-
function _(e, t, n) {
|
|
21
|
-
let r = y(e, t, n);
|
|
22
|
-
return r.x = (t - r.width) / 2, r.y = (n - r.height) / 2, e.unit === "%" ? v(r, t, n) : r;
|
|
16
|
+
}, m = (e, t, n) => Math.min(Math.max(e, t), n), h = (...e) => e.filter((e) => e && typeof e == "string").join(" "), g = (e, t) => e === t || e.width === t.width && e.height === t.height && e.x === t.x && e.y === t.y && e.unit === t.unit;
|
|
17
|
+
function _(e, t, n, r) {
|
|
18
|
+
let i = b(e, n, r);
|
|
19
|
+
return e.width && (i.height = i.width / t), e.height && (i.width = i.height * t), i.y + i.height > r && (i.height = r - i.y, i.width = i.height * t), i.x + i.width > n && (i.width = n - i.x, i.height = i.width / t), e.unit === "%" ? y(i, n, r) : i;
|
|
23
20
|
}
|
|
24
21
|
function v(e, t, n) {
|
|
22
|
+
let r = b(e, t, n);
|
|
23
|
+
return r.x = (t - r.width) / 2, r.y = (n - r.height) / 2, e.unit === "%" ? y(r, t, n) : r;
|
|
24
|
+
}
|
|
25
|
+
function y(e, t, n) {
|
|
25
26
|
return e.unit === "%" ? {
|
|
26
|
-
...
|
|
27
|
+
...p,
|
|
27
28
|
...e,
|
|
28
29
|
unit: "%"
|
|
29
30
|
} : {
|
|
@@ -34,9 +35,9 @@ function v(e, t, n) {
|
|
|
34
35
|
height: e.height ? e.height / n * 100 : 0
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function b(e, t, n) {
|
|
38
39
|
return !e.unit || e.unit === "px" ? {
|
|
39
|
-
...
|
|
40
|
+
...p,
|
|
40
41
|
...e,
|
|
41
42
|
unit: "px"
|
|
42
43
|
} : {
|
|
@@ -47,7 +48,7 @@ function y(e, t, n) {
|
|
|
47
48
|
height: e.height ? e.height * n / 100 : 0
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function x(e, t, n, r, i, a = 0, o = 0, s = r, c = i) {
|
|
51
52
|
let l = { ...e }, u = Math.min(a, r), d = Math.min(o, i), f = Math.min(s, r), p = Math.min(c, i);
|
|
52
53
|
t && (t > 1 ? (u = o ? o * t : u, d = u / t, f = s * t) : (d = a ? a / t : d, u = d * t, p = c / t)), l.y < 0 && (l.height = Math.max(l.height + l.y, d), l.y = 0), l.x < 0 && (l.width = Math.max(l.width + l.x, u), l.x = 0);
|
|
53
54
|
let m = r - (l.x + l.width);
|
|
@@ -65,14 +66,14 @@ function b(e, t, n, r, i, a = 0, o = 0, s = r, c = i) {
|
|
|
65
66
|
}
|
|
66
67
|
return l;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function S(e, t, n, r) {
|
|
69
70
|
let i = { ...e };
|
|
70
71
|
return t === "ArrowLeft" ? r === "nw" ? (i.x -= n, i.y -= n, i.width += n, i.height += n) : r === "w" ? (i.x -= n, i.width += n) : r === "sw" ? (i.x -= n, i.width += n, i.height += n) : r === "ne" ? (i.y += n, i.width -= n, i.height -= n) : r === "e" ? i.width -= n : r === "se" && (i.width -= n, i.height -= n) : t === "ArrowRight" && (r === "nw" ? (i.x += n, i.y += n, i.width -= n, i.height -= n) : r === "w" ? (i.x += n, i.width -= n) : r === "sw" ? (i.x += n, i.width -= n, i.height -= n) : r === "ne" ? (i.y -= n, i.width += n, i.height += n) : r === "e" ? i.width += n : r === "se" && (i.width += n, i.height += n)), t === "ArrowUp" ? r === "nw" ? (i.x -= n, i.y -= n, i.width += n, i.height += n) : r === "n" ? (i.y -= n, i.height += n) : r === "ne" ? (i.y -= n, i.width += n, i.height += n) : r === "sw" ? (i.x += n, i.width -= n, i.height -= n) : r === "s" ? i.height -= n : r === "se" && (i.width -= n, i.height -= n) : t === "ArrowDown" && (r === "nw" ? (i.x += n, i.y += n, i.width -= n, i.height -= n) : r === "n" ? (i.y += n, i.height -= n) : r === "ne" ? (i.y += n, i.width -= n, i.height -= n) : r === "sw" ? (i.x -= n, i.width += n, i.height += n) : r === "s" ? i.height += n : r === "se" && (i.width += n, i.height += n)), i;
|
|
71
72
|
}
|
|
72
|
-
var
|
|
73
|
+
var C = {
|
|
73
74
|
capture: !0,
|
|
74
75
|
passive: !1
|
|
75
|
-
},
|
|
76
|
+
}, w = 0, T = class e extends o {
|
|
76
77
|
static xOrds = ["e", "w"];
|
|
77
78
|
static yOrds = ["n", "s"];
|
|
78
79
|
static xyOrds = [
|
|
@@ -110,11 +111,11 @@ var S = {
|
|
|
110
111
|
clientY: 0,
|
|
111
112
|
isResize: !0
|
|
112
113
|
};
|
|
113
|
-
componentRef =
|
|
114
|
-
mediaRef =
|
|
114
|
+
componentRef = s();
|
|
115
|
+
mediaRef = s();
|
|
115
116
|
resizeObserver;
|
|
116
117
|
initChangeCalled = !1;
|
|
117
|
-
instanceId = `rc-${
|
|
118
|
+
instanceId = `rc-${w++}`;
|
|
118
119
|
state = {
|
|
119
120
|
cropIsActive: !1,
|
|
120
121
|
newCropIsBeingDrawn: !1
|
|
@@ -139,22 +140,22 @@ var S = {
|
|
|
139
140
|
let { crop: t, onComplete: n } = this.props;
|
|
140
141
|
if (n && !e.crop && t) {
|
|
141
142
|
let { width: e, height: r } = this.getBox();
|
|
142
|
-
e && r && n(
|
|
143
|
+
e && r && n(b(t, e, r), y(t, e, r));
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
componentWillUnmount() {
|
|
146
147
|
this.resizeObserver && this.resizeObserver.disconnect(), this.unbindDocMove();
|
|
147
148
|
}
|
|
148
149
|
bindDocMove() {
|
|
149
|
-
this.docMoveBound ||= (this.document.addEventListener("pointermove", this.onDocPointerMove,
|
|
150
|
+
this.docMoveBound ||= (this.document.addEventListener("pointermove", this.onDocPointerMove, C), this.document.addEventListener("pointerup", this.onDocPointerDone, C), this.document.addEventListener("pointercancel", this.onDocPointerDone, C), !0);
|
|
150
151
|
}
|
|
151
152
|
unbindDocMove() {
|
|
152
|
-
this.docMoveBound &&= (this.document.removeEventListener("pointermove", this.onDocPointerMove,
|
|
153
|
+
this.docMoveBound &&= (this.document.removeEventListener("pointermove", this.onDocPointerMove, C), this.document.removeEventListener("pointerup", this.onDocPointerDone, C), this.document.removeEventListener("pointercancel", this.onDocPointerDone, C), !1);
|
|
153
154
|
}
|
|
154
155
|
onCropPointerDown = (e) => {
|
|
155
156
|
let { crop: t, disabled: n } = this.props, r = this.getBox();
|
|
156
157
|
if (!t) return;
|
|
157
|
-
let i =
|
|
158
|
+
let i = b(t, r.width, r.height);
|
|
158
159
|
if (n) return;
|
|
159
160
|
e.cancelable && e.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
160
161
|
let a = e.target.dataset.ord, o = !!a, s = e.clientX, c = e.clientY, l = i.x, u = i.y;
|
|
@@ -192,7 +193,7 @@ var S = {
|
|
|
192
193
|
clientX: e.clientX,
|
|
193
194
|
clientY: e.clientY,
|
|
194
195
|
isResize: !0
|
|
195
|
-
}, this.mouseDownOnCrop = !0, a(
|
|
196
|
+
}, this.mouseDownOnCrop = !0, a(b(l, o.width, o.height), y(l, o.width, o.height)), this.setState({
|
|
196
197
|
cropIsActive: !0,
|
|
197
198
|
newCropIsBeingDrawn: !0
|
|
198
199
|
});
|
|
@@ -204,7 +205,7 @@ var S = {
|
|
|
204
205
|
let { evData: o } = this;
|
|
205
206
|
o.clientX = e.clientX, o.clientY = e.clientY;
|
|
206
207
|
let s;
|
|
207
|
-
s = o.isResize ? this.resizeCrop() : this.dragCrop(),
|
|
208
|
+
s = o.isResize ? this.resizeCrop() : this.dragCrop(), g(t, s) || r(b(s, a.width, a.height), y(s, a.width, a.height));
|
|
208
209
|
};
|
|
209
210
|
onComponentKeyDown = (t) => {
|
|
210
211
|
let { crop: n, disabled: r, onChange: i, onComplete: a } = this.props;
|
|
@@ -213,8 +214,8 @@ var S = {
|
|
|
213
214
|
if (!n) return;
|
|
214
215
|
let c = this.getBox(), l = this.makePixelCrop(c), u = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? e.nudgeStepLarge : t.shiftKey ? e.nudgeStepMedium : e.nudgeStep;
|
|
215
216
|
if (o === "ArrowLeft" ? (l.x -= u, s = !0) : o === "ArrowRight" ? (l.x += u, s = !0) : o === "ArrowUp" ? (l.y -= u, s = !0) : o === "ArrowDown" && (l.y += u, s = !0), s) {
|
|
216
|
-
t.cancelable && t.preventDefault(), l.x =
|
|
217
|
-
let e =
|
|
217
|
+
t.cancelable && t.preventDefault(), l.x = m(l.x, 0, c.width - l.width), l.y = m(l.y, 0, c.height - l.height);
|
|
218
|
+
let e = b(l, c.width, c.height), n = y(l, c.width, c.height);
|
|
218
219
|
i(e, n), a && a(e, n);
|
|
219
220
|
}
|
|
220
221
|
};
|
|
@@ -223,15 +224,15 @@ var S = {
|
|
|
223
224
|
if (a || !i) return;
|
|
224
225
|
if (t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight") t.stopPropagation(), t.preventDefault();
|
|
225
226
|
else return;
|
|
226
|
-
let p = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? e.nudgeStepLarge : t.shiftKey ? e.nudgeStepMedium : e.nudgeStep, m =
|
|
227
|
-
if (!
|
|
228
|
-
let e =
|
|
227
|
+
let p = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? e.nudgeStepLarge : t.shiftKey ? e.nudgeStepMedium : e.nudgeStep, m = x(S(b(i, f.width, f.height), t.key, p, n), r, n, f.width, f.height, o, s, c, l);
|
|
228
|
+
if (!g(i, m)) {
|
|
229
|
+
let e = y(m, f.width, f.height);
|
|
229
230
|
u(m, e), d && d(m, e);
|
|
230
231
|
}
|
|
231
232
|
};
|
|
232
233
|
onDocPointerDone = (e) => {
|
|
233
234
|
let { crop: t, disabled: n, onComplete: r, onDragEnd: i } = this.props, a = this.getBox();
|
|
234
|
-
this.unbindDocMove(), !(n || !t) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, i && i(e), r && r(
|
|
235
|
+
this.unbindDocMove(), !(n || !t) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, i && i(e), r && r(b(t, a.width, a.height), y(t, a.width, a.height)), this.setState({
|
|
235
236
|
cropIsActive: !1,
|
|
236
237
|
newCropIsBeingDrawn: !1
|
|
237
238
|
}));
|
|
@@ -250,7 +251,7 @@ var S = {
|
|
|
250
251
|
}
|
|
251
252
|
dragCrop() {
|
|
252
253
|
let { evData: e } = this, t = this.getBox(), n = this.makePixelCrop(t), r = e.clientX - e.startClientX, i = e.clientY - e.startClientY;
|
|
253
|
-
return n.x =
|
|
254
|
+
return n.x = m(e.startCropX + r, 0, t.width - n.width), n.y = m(e.startCropY + i, 0, t.height - n.height), n;
|
|
254
255
|
}
|
|
255
256
|
getPointRegion(e, t, n, r) {
|
|
256
257
|
let { evData: i } = this, a = i.clientX - e.x, o = i.clientY - e.y, s;
|
|
@@ -265,20 +266,20 @@ var S = {
|
|
|
265
266
|
resizeCrop() {
|
|
266
267
|
let { evData: t } = this, { aspect: n = 0, maxWidth: r, maxHeight: i } = this.props, a = this.getBox(), [o, s] = this.resolveMinDimensions(a, n, this.props.minWidth, this.props.minHeight), c = this.makePixelCrop(a), l = this.getPointRegion(a, t.ord, o, s), u = t.ord || l, d = t.clientX - t.startClientX, f = t.clientY - t.startClientY;
|
|
267
268
|
(o && u === "nw" || u === "w" || u === "sw") && (d = Math.min(d, -o)), (s && u === "nw" || u === "n" || u === "ne") && (f = Math.min(f, -s));
|
|
268
|
-
let
|
|
269
|
+
let p = {
|
|
269
270
|
unit: "px",
|
|
270
271
|
x: 0,
|
|
271
272
|
y: 0,
|
|
272
273
|
width: 0,
|
|
273
274
|
height: 0
|
|
274
275
|
};
|
|
275
|
-
l === "ne" ? (
|
|
276
|
-
let h =
|
|
277
|
-
return n || e.xyOrds.indexOf(u) > -1 ? c = h : e.xOrds.indexOf(u) > -1 ? (c.x = h.x, c.width = h.width) : e.yOrds.indexOf(u) > -1 && (c.y = h.y, c.height = h.height), c.x =
|
|
276
|
+
l === "ne" ? (p.x = t.startCropX, p.width = d, n ? (p.height = p.width / n, p.y = t.startCropY - p.height) : (p.height = Math.abs(f), p.y = t.startCropY - p.height)) : l === "se" ? (p.x = t.startCropX, p.y = t.startCropY, p.width = d, n ? p.height = p.width / n : p.height = f) : l === "sw" ? (p.x = t.startCropX + d, p.y = t.startCropY, p.width = Math.abs(d), n ? p.height = p.width / n : p.height = f) : l === "nw" && (p.x = t.startCropX + d, p.width = Math.abs(d), n ? (p.height = p.width / n, p.y = t.startCropY - p.height) : (p.height = Math.abs(f), p.y = t.startCropY + f));
|
|
277
|
+
let h = x(p, n, l, a.width, a.height, o, s, r, i);
|
|
278
|
+
return n || e.xyOrds.indexOf(u) > -1 ? c = h : e.xOrds.indexOf(u) > -1 ? (c.x = h.x, c.width = h.width) : e.yOrds.indexOf(u) > -1 && (c.y = h.y, c.height = h.height), c.x = m(c.x, 0, a.width - c.width), c.y = m(c.y, 0, a.height - c.height), c;
|
|
278
279
|
}
|
|
279
280
|
renderCropSelection() {
|
|
280
|
-
let { ariaLabels: t = e.defaultProps.ariaLabels, disabled: n, locked: r, renderSelectionAddon:
|
|
281
|
-
if (s) return /* @__PURE__ */
|
|
281
|
+
let { ariaLabels: t = e.defaultProps.ariaLabels, disabled: n, locked: r, renderSelectionAddon: i, ruleOfThirds: o, crop: s } = this.props, c = this.getCropStyle();
|
|
282
|
+
if (s) return /* @__PURE__ */ a.createElement("div", {
|
|
282
283
|
style: c,
|
|
283
284
|
className: "ReactCrop__crop-selection",
|
|
284
285
|
onPointerDown: this.onCropPointerDown,
|
|
@@ -286,119 +287,119 @@ var S = {
|
|
|
286
287
|
tabIndex: 0,
|
|
287
288
|
onKeyDown: this.onComponentKeyDown,
|
|
288
289
|
role: "group"
|
|
289
|
-
}, !n && !r && /* @__PURE__ */
|
|
290
|
+
}, !n && !r && /* @__PURE__ */ a.createElement("div", {
|
|
290
291
|
className: "ReactCrop__drag-elements",
|
|
291
292
|
onFocus: this.onDragFocus
|
|
292
|
-
}, /* @__PURE__ */
|
|
293
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
293
294
|
className: "ReactCrop__drag-bar ord-n",
|
|
294
295
|
"data-ord": "n"
|
|
295
|
-
}), /* @__PURE__ */
|
|
296
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
296
297
|
className: "ReactCrop__drag-bar ord-e",
|
|
297
298
|
"data-ord": "e"
|
|
298
|
-
}), /* @__PURE__ */
|
|
299
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
299
300
|
className: "ReactCrop__drag-bar ord-s",
|
|
300
301
|
"data-ord": "s"
|
|
301
|
-
}), /* @__PURE__ */
|
|
302
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
302
303
|
className: "ReactCrop__drag-bar ord-w",
|
|
303
304
|
"data-ord": "w"
|
|
304
|
-
}), /* @__PURE__ */
|
|
305
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
305
306
|
className: "ReactCrop__drag-handle ord-nw",
|
|
306
307
|
"data-ord": "nw",
|
|
307
308
|
tabIndex: 0,
|
|
308
309
|
"aria-label": t.nwDragHandle,
|
|
309
310
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "nw"),
|
|
310
311
|
role: "button"
|
|
311
|
-
}), /* @__PURE__ */
|
|
312
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
312
313
|
className: "ReactCrop__drag-handle ord-n",
|
|
313
314
|
"data-ord": "n",
|
|
314
315
|
tabIndex: 0,
|
|
315
316
|
"aria-label": t.nDragHandle,
|
|
316
317
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "n"),
|
|
317
318
|
role: "button"
|
|
318
|
-
}), /* @__PURE__ */
|
|
319
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
319
320
|
className: "ReactCrop__drag-handle ord-ne",
|
|
320
321
|
"data-ord": "ne",
|
|
321
322
|
tabIndex: 0,
|
|
322
323
|
"aria-label": t.neDragHandle,
|
|
323
324
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "ne"),
|
|
324
325
|
role: "button"
|
|
325
|
-
}), /* @__PURE__ */
|
|
326
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
326
327
|
className: "ReactCrop__drag-handle ord-e",
|
|
327
328
|
"data-ord": "e",
|
|
328
329
|
tabIndex: 0,
|
|
329
330
|
"aria-label": t.eDragHandle,
|
|
330
331
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "e"),
|
|
331
332
|
role: "button"
|
|
332
|
-
}), /* @__PURE__ */
|
|
333
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
333
334
|
className: "ReactCrop__drag-handle ord-se",
|
|
334
335
|
"data-ord": "se",
|
|
335
336
|
tabIndex: 0,
|
|
336
337
|
"aria-label": t.seDragHandle,
|
|
337
338
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "se"),
|
|
338
339
|
role: "button"
|
|
339
|
-
}), /* @__PURE__ */
|
|
340
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
340
341
|
className: "ReactCrop__drag-handle ord-s",
|
|
341
342
|
"data-ord": "s",
|
|
342
343
|
tabIndex: 0,
|
|
343
344
|
"aria-label": t.sDragHandle,
|
|
344
345
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "s"),
|
|
345
346
|
role: "button"
|
|
346
|
-
}), /* @__PURE__ */
|
|
347
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
347
348
|
className: "ReactCrop__drag-handle ord-sw",
|
|
348
349
|
"data-ord": "sw",
|
|
349
350
|
tabIndex: 0,
|
|
350
351
|
"aria-label": t.swDragHandle,
|
|
351
352
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "sw"),
|
|
352
353
|
role: "button"
|
|
353
|
-
}), /* @__PURE__ */
|
|
354
|
+
}), /* @__PURE__ */ a.createElement("div", {
|
|
354
355
|
className: "ReactCrop__drag-handle ord-w",
|
|
355
356
|
"data-ord": "w",
|
|
356
357
|
tabIndex: 0,
|
|
357
358
|
"aria-label": t.wDragHandle,
|
|
358
359
|
onKeyDown: (e) => this.onHandlerKeyDown(e, "w"),
|
|
359
360
|
role: "button"
|
|
360
|
-
})),
|
|
361
|
+
})), i && /* @__PURE__ */ a.createElement("div", {
|
|
361
362
|
className: "ReactCrop__selection-addon",
|
|
362
363
|
onPointerDown: (e) => e.stopPropagation()
|
|
363
|
-
},
|
|
364
|
+
}, i(this.state)), o && /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("div", { className: "ReactCrop__rule-of-thirds-hz" }), /* @__PURE__ */ a.createElement("div", { className: "ReactCrop__rule-of-thirds-vt" })));
|
|
364
365
|
}
|
|
365
366
|
makePixelCrop(e) {
|
|
366
|
-
return
|
|
367
|
-
...
|
|
367
|
+
return b({
|
|
368
|
+
...p,
|
|
368
369
|
...this.props.crop || {}
|
|
369
370
|
}, e.width, e.height);
|
|
370
371
|
}
|
|
371
372
|
render() {
|
|
372
|
-
let { aspect: e, children: t, circularCrop: n, className: r, crop:
|
|
373
|
-
return /* @__PURE__ */
|
|
373
|
+
let { aspect: e, children: t, circularCrop: n, className: r, crop: i, disabled: o, locked: s, style: c, ruleOfThirds: l } = this.props, { cropIsActive: u, newCropIsBeingDrawn: d } = this.state, f = i ? this.renderCropSelection() : null, p = h("ReactCrop", r, u && "ReactCrop--active", o && "ReactCrop--disabled", s && "ReactCrop--locked", d && "ReactCrop--new-crop", i && e && "ReactCrop--fixed-aspect", i && n && "ReactCrop--circular-crop", i && l && "ReactCrop--rule-of-thirds", !this.dragStarted && i && !i.width && !i.height && "ReactCrop--invisible-crop", n && "ReactCrop--no-animate");
|
|
374
|
+
return /* @__PURE__ */ a.createElement("div", {
|
|
374
375
|
ref: this.componentRef,
|
|
375
376
|
className: p,
|
|
376
377
|
style: c
|
|
377
|
-
}, /* @__PURE__ */
|
|
378
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
378
379
|
ref: this.mediaRef,
|
|
379
380
|
className: "ReactCrop__child-wrapper",
|
|
380
381
|
onPointerDown: this.onComponentPointerDown
|
|
381
|
-
}, t),
|
|
382
|
+
}, t), i ? /* @__PURE__ */ a.createElement("svg", {
|
|
382
383
|
className: "ReactCrop__crop-mask",
|
|
383
384
|
width: "100%",
|
|
384
385
|
height: "100%"
|
|
385
|
-
}, /* @__PURE__ */
|
|
386
|
+
}, /* @__PURE__ */ a.createElement("defs", null, /* @__PURE__ */ a.createElement("mask", { id: `hole-${this.instanceId}` }, /* @__PURE__ */ a.createElement("rect", {
|
|
386
387
|
width: "100%",
|
|
387
388
|
height: "100%",
|
|
388
389
|
fill: "white"
|
|
389
|
-
}), n ? /* @__PURE__ */
|
|
390
|
-
cx: `${
|
|
391
|
-
cy: `${
|
|
392
|
-
rx: `${
|
|
393
|
-
ry: `${
|
|
390
|
+
}), n ? /* @__PURE__ */ a.createElement("ellipse", {
|
|
391
|
+
cx: `${i.x + i.width / 2}${i.unit}`,
|
|
392
|
+
cy: `${i.y + i.height / 2}${i.unit}`,
|
|
393
|
+
rx: `${i.width / 2}${i.unit}`,
|
|
394
|
+
ry: `${i.height / 2}${i.unit}`,
|
|
394
395
|
fill: "black"
|
|
395
|
-
}) : /* @__PURE__ */
|
|
396
|
-
x: `${
|
|
397
|
-
y: `${
|
|
398
|
-
width: `${
|
|
399
|
-
height: `${
|
|
396
|
+
}) : /* @__PURE__ */ a.createElement("rect", {
|
|
397
|
+
x: `${i.x}${i.unit}`,
|
|
398
|
+
y: `${i.y}${i.unit}`,
|
|
399
|
+
width: `${i.width}${i.unit}`,
|
|
400
|
+
height: `${i.height}${i.unit}`,
|
|
400
401
|
fill: "black"
|
|
401
|
-
}))), /* @__PURE__ */
|
|
402
|
+
}))), /* @__PURE__ */ a.createElement("rect", {
|
|
402
403
|
fill: "black",
|
|
403
404
|
fillOpacity: .5,
|
|
404
405
|
width: "100%",
|
|
@@ -410,7 +411,7 @@ var S = {
|
|
|
410
411
|
Math.PI / 180;
|
|
411
412
|
//#endregion
|
|
412
413
|
//#region src/stories/molecules/ImageCropDialog/crop.ts
|
|
413
|
-
async function
|
|
414
|
+
async function E(e, t, n = {}) {
|
|
414
415
|
let r = n.outputSize ?? 512, i = n.mimeType ?? "image/jpeg", a = n.quality ?? .9, o = document.createElement("canvas");
|
|
415
416
|
o.width = r, o.height = r;
|
|
416
417
|
let s = o.getContext("2d");
|
|
@@ -420,8 +421,8 @@ async function T(e, t, n = {}) {
|
|
|
420
421
|
o.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("Canvas toBlob returned null")), i, a);
|
|
421
422
|
});
|
|
422
423
|
}
|
|
423
|
-
function
|
|
424
|
-
return _(
|
|
424
|
+
function D(e, t, n) {
|
|
425
|
+
return v(_(t / n >= e ? {
|
|
425
426
|
unit: "%",
|
|
426
427
|
height: 100
|
|
427
428
|
} : {
|
|
@@ -431,68 +432,68 @@ function E(e, t, n) {
|
|
|
431
432
|
}
|
|
432
433
|
//#endregion
|
|
433
434
|
//#region src/stories/molecules/ImageCropDialog/ImageCropDialog.tsx
|
|
434
|
-
function
|
|
435
|
-
let
|
|
436
|
-
|
|
437
|
-
let
|
|
438
|
-
|
|
439
|
-
},
|
|
440
|
-
let e =
|
|
441
|
-
!e || !
|
|
442
|
-
mimeType:
|
|
443
|
-
outputSize:
|
|
444
|
-
})),
|
|
435
|
+
function O({ sourceUrl: a, title: o, description: s, circularCrop: p = !1, aspect: m = 1, outputSize: h = 512, outputMimeType: g, busy: _ = !1, cancelLabel: v, confirmLabel: y, closeLabel: b, loadingLabel: x, errorMessage: S, onConfirm: C, onClose: w, className: O }) {
|
|
436
|
+
let k = e("imageCropDialog"), A = c(null), [j, M] = l(), [N, P] = l(), [F, I] = l("loading"), [L, R] = l(a);
|
|
437
|
+
a !== L && (R(a), I("loading"), M(void 0), P(void 0));
|
|
438
|
+
let z = () => {
|
|
439
|
+
M(void 0), P(void 0), w();
|
|
440
|
+
}, B = async () => {
|
|
441
|
+
let e = A.current;
|
|
442
|
+
!e || !N || N.width === 0 || (await C(await E(e, N, {
|
|
443
|
+
mimeType: g,
|
|
444
|
+
outputSize: h
|
|
445
|
+
})), z());
|
|
445
446
|
};
|
|
446
|
-
return /* @__PURE__ */
|
|
447
|
-
open:
|
|
447
|
+
return /* @__PURE__ */ d(i, {
|
|
448
|
+
open: a !== null,
|
|
448
449
|
onClose: () => {
|
|
449
|
-
|
|
450
|
+
_ || z();
|
|
450
451
|
},
|
|
451
|
-
title:
|
|
452
|
-
...
|
|
453
|
-
...
|
|
452
|
+
title: o,
|
|
453
|
+
...b ? { closeLabel: b } : {},
|
|
454
|
+
...s == null ? {} : { description: s },
|
|
454
455
|
footerClassName: "image-crop-dialog__actions",
|
|
455
|
-
footer: /* @__PURE__ */
|
|
456
|
+
footer: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(n, {
|
|
456
457
|
variant: "outline",
|
|
457
|
-
disabled:
|
|
458
|
-
onClick:
|
|
459
|
-
children: _
|
|
460
|
-
}), /* @__PURE__ */ u(t, {
|
|
461
|
-
disabled: g || !j?.width,
|
|
462
|
-
onClick: R,
|
|
458
|
+
disabled: _,
|
|
459
|
+
onClick: z,
|
|
463
460
|
children: v
|
|
461
|
+
}), /* @__PURE__ */ d(n, {
|
|
462
|
+
disabled: _ || !N?.width,
|
|
463
|
+
onClick: B,
|
|
464
|
+
children: y
|
|
464
465
|
})] }),
|
|
465
|
-
children: /* @__PURE__ */
|
|
466
|
-
className: ["image-crop-dialog",
|
|
467
|
-
children: /* @__PURE__ */
|
|
466
|
+
children: /* @__PURE__ */ d("div", {
|
|
467
|
+
className: ["image-crop-dialog", O].filter(Boolean).join(" "),
|
|
468
|
+
children: /* @__PURE__ */ f("div", {
|
|
468
469
|
className: "image-crop-dialog__area",
|
|
469
470
|
children: [
|
|
470
|
-
|
|
471
|
+
F === "loading" && /* @__PURE__ */ d(t, {
|
|
471
472
|
size: "lg",
|
|
472
|
-
label:
|
|
473
|
+
label: k("loading", x)
|
|
473
474
|
}),
|
|
474
|
-
|
|
475
|
+
F === "error" && /* @__PURE__ */ d(r, {
|
|
475
476
|
variant: "error",
|
|
476
|
-
description:
|
|
477
|
+
description: k("error", S),
|
|
477
478
|
className: "image-crop-dialog__error"
|
|
478
479
|
}),
|
|
479
|
-
|
|
480
|
-
crop:
|
|
481
|
-
onChange: (e, t) =>
|
|
482
|
-
onComplete: (e) =>
|
|
483
|
-
aspect:
|
|
484
|
-
circularCrop:
|
|
480
|
+
a && F !== "error" && /* @__PURE__ */ d(T, {
|
|
481
|
+
crop: j,
|
|
482
|
+
onChange: (e, t) => M(t),
|
|
483
|
+
onComplete: (e) => P(e),
|
|
484
|
+
aspect: m,
|
|
485
|
+
circularCrop: p,
|
|
485
486
|
minWidth: 64,
|
|
486
487
|
keepSelection: !0,
|
|
487
|
-
children: /* @__PURE__ */
|
|
488
|
-
ref:
|
|
489
|
-
src:
|
|
488
|
+
children: /* @__PURE__ */ d("img", {
|
|
489
|
+
ref: A,
|
|
490
|
+
src: a,
|
|
490
491
|
alt: "",
|
|
491
492
|
onLoad: (e) => {
|
|
492
493
|
let { width: t, height: n } = e.currentTarget;
|
|
493
|
-
|
|
494
|
+
I("ready"), M(D(m, t, n));
|
|
494
495
|
},
|
|
495
|
-
onError: () =>
|
|
496
|
+
onError: () => I("error")
|
|
496
497
|
})
|
|
497
498
|
})
|
|
498
499
|
]
|
|
@@ -501,4 +502,4 @@ function D({ sourceUrl: i, title: a, description: o, circularCrop: f = !1, aspec
|
|
|
501
502
|
});
|
|
502
503
|
}
|
|
503
504
|
//#endregion
|
|
504
|
-
export {
|
|
505
|
+
export { O as t };
|
package/dist/_shared/validate.js
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
//#region src/stories/atoms/FileUpload/validate.ts
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var e = "es-ES";
|
|
3
|
+
function t(t, n = e) {
|
|
4
|
+
let [r, i, a] = t < 1024 ? [
|
|
5
|
+
t,
|
|
6
|
+
"byte",
|
|
7
|
+
0
|
|
8
|
+
] : t < 1024 * 1024 ? [
|
|
9
|
+
t / 1024,
|
|
10
|
+
"kilobyte",
|
|
11
|
+
1
|
|
12
|
+
] : [
|
|
13
|
+
t / (1024 * 1024),
|
|
14
|
+
"megabyte",
|
|
15
|
+
1
|
|
16
|
+
];
|
|
17
|
+
return new Intl.NumberFormat(n, {
|
|
18
|
+
style: "unit",
|
|
19
|
+
unit: i,
|
|
20
|
+
unitDisplay: "short",
|
|
21
|
+
minimumFractionDigits: a,
|
|
22
|
+
maximumFractionDigits: a
|
|
23
|
+
}).format(r);
|
|
4
24
|
}
|
|
5
|
-
function
|
|
6
|
-
return
|
|
25
|
+
function n(t, n = e) {
|
|
26
|
+
return new Intl.ListFormat(n, {
|
|
27
|
+
style: "long",
|
|
28
|
+
type: "disjunction"
|
|
29
|
+
}).format(t);
|
|
30
|
+
}
|
|
31
|
+
function r(n, r, i, a, o, s = e) {
|
|
32
|
+
return i !== void 0 && n.size > i ? a(t(i, s)) : r && !r.split(",").map((e) => e.trim()).some((e) => e.startsWith(".") ? n.name.toLowerCase().endsWith(e.toLowerCase()) : e.endsWith("/*") ? n.type.startsWith(e.slice(0, -2)) : n.type === e) ? o : null;
|
|
7
33
|
}
|
|
8
34
|
//#endregion
|
|
9
|
-
export { t as n, e as t };
|
|
35
|
+
export { r as i, t as n, n as r, e as t };
|