@studiolxd/brand 42.0.0 → 44.0.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.
@@ -1,29 +1,30 @@
1
1
  import '../imagecropdialog.css';
2
- import { Spinner as e } from "../spinner.js";
3
- import { Button as t } from "../button.js";
4
- import { Alert as n } from "../alert.js";
5
- import { Modal as r } from "../modal.js";
6
- import i, { PureComponent as a, createRef as o, useRef as s, useState as c } from "react";
7
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
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 f = {
10
+ var p = {
10
11
  x: 0,
11
12
  y: 0,
12
13
  width: 0,
13
14
  height: 0,
14
15
  unit: "px"
15
- }, p = (e, t, n) => Math.min(Math.max(e, t), n), m = (...e) => e.filter((e) => e && typeof e == "string").join(" "), h = (e, t) => e === t || e.width === t.width && e.height === t.height && e.x === t.x && e.y === t.y && e.unit === t.unit;
16
- function g(e, t, n, r) {
17
- let i = y(e, n, r);
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 === "%" ? v(i, n, r) : i;
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
- ...f,
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 y(e, t, n) {
38
+ function b(e, t, n) {
38
39
  return !e.unit || e.unit === "px" ? {
39
- ...f,
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 b(e, t, n, r, i, a = 0, o = 0, s = r, c = i) {
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 x(e, t, n, r) {
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 S = {
73
+ var C = {
73
74
  capture: !0,
74
75
  passive: !1
75
- }, C = 0, w = class e extends a {
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 = o();
114
- mediaRef = o();
114
+ componentRef = s();
115
+ mediaRef = s();
115
116
  resizeObserver;
116
117
  initChangeCalled = !1;
117
- instanceId = `rc-${C++}`;
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(y(t, e, r), v(t, e, r));
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, S), this.document.addEventListener("pointerup", this.onDocPointerDone, S), this.document.addEventListener("pointercancel", this.onDocPointerDone, S), !0);
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, S), this.document.removeEventListener("pointerup", this.onDocPointerDone, S), this.document.removeEventListener("pointercancel", this.onDocPointerDone, S), !1);
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 = y(t, r.width, r.height);
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(y(l, o.width, o.height), v(l, o.width, o.height)), this.setState({
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(), h(t, s) || r(y(s, a.width, a.height), v(s, a.width, a.height));
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 = p(l.x, 0, c.width - l.width), l.y = p(l.y, 0, c.height - l.height);
217
- let e = y(l, c.width, c.height), n = v(l, c.width, c.height);
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 = b(x(y(i, f.width, f.height), t.key, p, n), r, n, f.width, f.height, o, s, c, l);
227
- if (!h(i, m)) {
228
- let e = v(m, f.width, f.height);
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(y(t, a.width, a.height), v(t, a.width, a.height)), this.setState({
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 = p(e.startCropX + r, 0, t.width - n.width), n.y = p(e.startCropY + i, 0, t.height - n.height), n;
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 m = {
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" ? (m.x = t.startCropX, m.width = d, n ? (m.height = m.width / n, m.y = t.startCropY - m.height) : (m.height = Math.abs(f), m.y = t.startCropY - m.height)) : l === "se" ? (m.x = t.startCropX, m.y = t.startCropY, m.width = d, n ? m.height = m.width / n : m.height = f) : l === "sw" ? (m.x = t.startCropX + d, m.y = t.startCropY, m.width = Math.abs(d), n ? m.height = m.width / n : m.height = f) : l === "nw" && (m.x = t.startCropX + d, m.width = Math.abs(d), n ? (m.height = m.width / n, m.y = t.startCropY - m.height) : (m.height = Math.abs(f), m.y = t.startCropY + f));
276
- let h = b(m, n, l, a.width, a.height, o, s, r, i);
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 = p(c.x, 0, a.width - c.width), c.y = p(c.y, 0, a.height - c.height), c;
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: a, ruleOfThirds: o, crop: s } = this.props, c = this.getCropStyle();
281
- if (s) return /* @__PURE__ */ i.createElement("div", {
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__ */ i.createElement("div", {
290
+ }, !n && !r && /* @__PURE__ */ a.createElement("div", {
290
291
  className: "ReactCrop__drag-elements",
291
292
  onFocus: this.onDragFocus
292
- }, /* @__PURE__ */ i.createElement("div", {
293
+ }, /* @__PURE__ */ a.createElement("div", {
293
294
  className: "ReactCrop__drag-bar ord-n",
294
295
  "data-ord": "n"
295
- }), /* @__PURE__ */ i.createElement("div", {
296
+ }), /* @__PURE__ */ a.createElement("div", {
296
297
  className: "ReactCrop__drag-bar ord-e",
297
298
  "data-ord": "e"
298
- }), /* @__PURE__ */ i.createElement("div", {
299
+ }), /* @__PURE__ */ a.createElement("div", {
299
300
  className: "ReactCrop__drag-bar ord-s",
300
301
  "data-ord": "s"
301
- }), /* @__PURE__ */ i.createElement("div", {
302
+ }), /* @__PURE__ */ a.createElement("div", {
302
303
  className: "ReactCrop__drag-bar ord-w",
303
304
  "data-ord": "w"
304
- }), /* @__PURE__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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__ */ i.createElement("div", {
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
- })), a && /* @__PURE__ */ i.createElement("div", {
361
+ })), i && /* @__PURE__ */ a.createElement("div", {
361
362
  className: "ReactCrop__selection-addon",
362
363
  onPointerDown: (e) => e.stopPropagation()
363
- }, a(this.state)), o && /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("div", { className: "ReactCrop__rule-of-thirds-hz" }), /* @__PURE__ */ i.createElement("div", { className: "ReactCrop__rule-of-thirds-vt" })));
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 y({
367
- ...f,
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: a, disabled: o, locked: s, style: c, ruleOfThirds: l } = this.props, { cropIsActive: u, newCropIsBeingDrawn: d } = this.state, f = a ? this.renderCropSelection() : null, p = m("ReactCrop", r, u && "ReactCrop--active", o && "ReactCrop--disabled", s && "ReactCrop--locked", d && "ReactCrop--new-crop", a && e && "ReactCrop--fixed-aspect", a && n && "ReactCrop--circular-crop", a && l && "ReactCrop--rule-of-thirds", !this.dragStarted && a && !a.width && !a.height && "ReactCrop--invisible-crop", n && "ReactCrop--no-animate");
373
- return /* @__PURE__ */ i.createElement("div", {
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__ */ i.createElement("div", {
378
+ }, /* @__PURE__ */ a.createElement("div", {
378
379
  ref: this.mediaRef,
379
380
  className: "ReactCrop__child-wrapper",
380
381
  onPointerDown: this.onComponentPointerDown
381
- }, t), a ? /* @__PURE__ */ i.createElement("svg", {
382
+ }, t), i ? /* @__PURE__ */ a.createElement("svg", {
382
383
  className: "ReactCrop__crop-mask",
383
384
  width: "100%",
384
385
  height: "100%"
385
- }, /* @__PURE__ */ i.createElement("defs", null, /* @__PURE__ */ i.createElement("mask", { id: `hole-${this.instanceId}` }, /* @__PURE__ */ i.createElement("rect", {
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__ */ i.createElement("ellipse", {
390
- cx: `${a.x + a.width / 2}${a.unit}`,
391
- cy: `${a.y + a.height / 2}${a.unit}`,
392
- rx: `${a.width / 2}${a.unit}`,
393
- ry: `${a.height / 2}${a.unit}`,
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__ */ i.createElement("rect", {
396
- x: `${a.x}${a.unit}`,
397
- y: `${a.y}${a.unit}`,
398
- width: `${a.width}${a.unit}`,
399
- height: `${a.height}${a.unit}`,
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__ */ i.createElement("rect", {
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 T(e, t, n = {}) {
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 E(e, t, n) {
424
- return _(g(t / n >= e ? {
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 D({ sourceUrl: i, title: a, description: o, circularCrop: f = !1, aspect: p = 1, outputSize: m = 512, outputMimeType: h, busy: g = !1, cancelLabel: _, confirmLabel: v, closeLabel: y, loadingLabel: b = "Cargando imagen…", errorMessage: x = "No hemos podido cargar la imagen. Prueba con otro archivo.", onConfirm: S, onClose: C, className: D }) {
435
- let O = s(null), [k, A] = c(), [j, M] = c(), [N, P] = c("loading"), [F, I] = c(i);
436
- i !== F && (I(i), P("loading"), A(void 0), M(void 0));
437
- let L = () => {
438
- A(void 0), M(void 0), C();
439
- }, R = async () => {
440
- let e = O.current;
441
- !e || !j || j.width === 0 || (await S(await T(e, j, {
442
- mimeType: h,
443
- outputSize: m
444
- })), L());
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__ */ u(r, {
447
- open: i !== null,
447
+ return /* @__PURE__ */ d(i, {
448
+ open: a !== null,
448
449
  onClose: () => {
449
- g || L();
450
+ _ || z();
450
451
  },
451
- title: a,
452
- ...y ? { closeLabel: y } : {},
453
- ...o == null ? {} : { description: o },
452
+ title: o,
453
+ ...b ? { closeLabel: b } : {},
454
+ ...s == null ? {} : { description: s },
454
455
  footerClassName: "image-crop-dialog__actions",
455
- footer: /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(t, {
456
+ footer: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(n, {
456
457
  variant: "outline",
457
- disabled: g,
458
- onClick: L,
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__ */ u("div", {
466
- className: ["image-crop-dialog", D].filter(Boolean).join(" "),
467
- children: /* @__PURE__ */ d("div", {
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
- N === "loading" && /* @__PURE__ */ u(e, {
471
+ F === "loading" && /* @__PURE__ */ d(t, {
471
472
  size: "lg",
472
- label: b
473
+ label: k("loading", x)
473
474
  }),
474
- N === "error" && /* @__PURE__ */ u(n, {
475
+ F === "error" && /* @__PURE__ */ d(r, {
475
476
  variant: "error",
476
- description: x,
477
+ description: k("error", S),
477
478
  className: "image-crop-dialog__error"
478
479
  }),
479
- i && N !== "error" && /* @__PURE__ */ u(w, {
480
- crop: k,
481
- onChange: (e, t) => A(t),
482
- onComplete: (e) => M(e),
483
- aspect: p,
484
- circularCrop: f,
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__ */ u("img", {
488
- ref: O,
489
- src: i,
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
- P("ready"), A(E(p, t, n));
494
+ I("ready"), M(D(m, t, n));
494
495
  },
495
- onError: () => P("error")
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 { D as t };
505
+ export { O as t };
@@ -1,9 +1,35 @@
1
1
  //#region src/stories/atoms/FileUpload/validate.ts
2
- function e(e) {
3
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
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 t(t, n, r, i, a) {
6
- return r !== void 0 && t.size > r ? i(e(r)) : n && !n.split(",").map((e) => e.trim()).some((e) => e.startsWith(".") ? t.name.toLowerCase().endsWith(e.toLowerCase()) : e.endsWith("/*") ? t.type.startsWith(e.slice(0, -2)) : t.type === e) ? a : null;
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 };