@emailmaker/filemanager 1.1.75 → 1.1.81

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,11 +1,11 @@
1
1
  import { r as e } from "./file-manager-rolldown-runtime-DAVfCfog.js";
2
- import { B as t, G as n, R as r } from "./file-manager-hooks-vqT-4jeg.js";
2
+ import { B as t, H as n, q as r } from "./file-manager-hooks-B_xL38Y5.js";
3
3
  import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
4
- import { Alert as l, Button as u, Checkbox as d, ColorPicker as f, Input as p, InputNumber as m, Segmented as h, Typography as g } from "antd";
5
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
6
- import { Expand01 as y } from "@untitledui/icons";
4
+ import { Alert as l, Button as u, Checkbox as d, ColorPicker as f, Input as p, InputNumber as m, Segmented as ee, Typography as h } from "antd";
5
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
6
+ import { Expand01 as v } from "@untitledui/icons";
7
7
  //#region packages/file-manager/src/components/ImageCodeGenerator/ImageCodeGenerator.module.scss
8
- var ee = r(), b = {
8
+ var y = t(), b = {
9
9
  "em-filemanager": "em-filemanager",
10
10
  emFilemanager: "em-filemanager",
11
11
  root: "root",
@@ -30,38 +30,38 @@ var ee = r(), b = {
30
30
  previewCanvas: "previewCanvas",
31
31
  previewCanvasBarcode: "previewCanvasBarcode",
32
32
  actions: "actions"
33
- }, x = 80, S = 600, C = 200, w = 24, T = 130, E = 60, te = 280, ne = 72;
34
- function re() {
33
+ }, x = 80, S = 600, te = 200, C = 24, w = 130, T = 60, E = 280, D = 72;
34
+ function ne() {
35
35
  return typeof window > "u" ? 2 : Math.min(3, Math.max(2, window.devicePixelRatio || 2));
36
36
  }
37
- var D = ({ customRequest: r, state: D, setState: O }) => {
38
- let { t: k } = n(), { options: A } = t(), j = A?.config?.iconStrokeWidth ?? 1.75, M = s(null), { mode: N, rawText: P, foregroundHex: F, backgroundHex: I, transparentBackground: L, qrSidePx: R, barcodeBarHeightPx: z } = D, B = i((e) => O((t) => ({
37
+ var O = ({ customRequest: t, state: O, setState: k }) => {
38
+ let { t: A } = r(), { options: j } = n(), M = j?.config?.iconStrokeWidth ?? 1.75, N = s(null), { mode: P, rawText: F, foregroundHex: I, backgroundHex: L, transparentBackground: R, qrSidePx: z, barcodeBarHeightPx: B } = O, V = i((e) => k((t) => ({
39
39
  ...t,
40
40
  mode: e
41
- })), [O]), V = i((e) => O((t) => ({
41
+ })), [k]), H = i((e) => k((t) => ({
42
42
  ...t,
43
43
  rawText: e
44
- })), [O]), H = i((e) => O((t) => ({
44
+ })), [k]), U = i((e) => k((t) => ({
45
45
  ...t,
46
46
  foregroundHex: e
47
- })), [O]), U = i((e) => O((t) => ({
47
+ })), [k]), re = i((e) => k((t) => ({
48
48
  ...t,
49
49
  backgroundHex: e
50
- })), [O]), ie = i((e) => O((t) => ({
50
+ })), [k]), ie = i((e) => k((t) => ({
51
51
  ...t,
52
52
  transparentBackground: e
53
- })), [O]), ae = i((e) => O((t) => ({
53
+ })), [k]), ae = i((e) => k((t) => ({
54
54
  ...t,
55
55
  qrSidePx: e
56
- })), [O]), oe = i((e) => O((t) => ({
56
+ })), [k]), oe = i((e) => k((t) => ({
57
57
  ...t,
58
58
  barcodeBarHeightPx: e
59
- })), [O]), [W, se] = c(P), [G, K] = c(null), [q, J] = c(!1), Y = o(() => (0, ee.debounce)((e) => se(e), 300), []);
60
- a(() => (Y(P), () => {
59
+ })), [k]), [W, se] = c(F), [G, K] = c(null), [q, J] = c(!1), Y = o(() => (0, y.debounce)((e) => se(e), 300), []);
60
+ a(() => (Y(F), () => {
61
61
  Y.cancel();
62
- }), [P, Y]);
63
- let X = L ? "#00000000" : I, Z = i(async (t, n) => {
64
- let r = (await import("./file-manager-browser-DDyRNDQk.js").then((t) => /* @__PURE__ */ e(t.default))).default, i = n.trim(), a = Math.min(te, Math.max(x, R));
62
+ }), [F, Y]);
63
+ let X = R ? "#00000000" : L, Z = i(async (t, n) => {
64
+ let r = (await import("./file-manager-browser-DDyRNDQk.js").then((t) => /* @__PURE__ */ e(t.default))).default, i = n.trim(), a = Math.min(E, Math.max(x, z));
65
65
  if (!i) {
66
66
  t.width = a, t.height = a;
67
67
  let e = t.getContext("2d");
@@ -72,16 +72,16 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
72
72
  width: a,
73
73
  margin: 2,
74
74
  color: {
75
- dark: F,
75
+ dark: I,
76
76
  light: X
77
77
  }
78
78
  });
79
79
  }, [
80
- F,
80
+ I,
81
81
  X,
82
- R
82
+ z
83
83
  ]), Q = i(async (t, n) => {
84
- let r = (await import("./file-manager-JsBarcode-CyaffT5b.js").then((t) => /* @__PURE__ */ e(t.default))).default, i = n.trim(), a = L ? "rgba(0,0,0,0)" : I, o = Math.min(ne, Math.max(w, z)), s = Math.max(1, Math.round(o / 42)), c = Math.max(4, Math.round(o * .07)), l = Math.max(10, Math.round(o * .15));
84
+ let r = (await import("./file-manager-JsBarcode-CyaffT5b.js").then((t) => /* @__PURE__ */ e(t.default))).default, i = n.trim(), a = R ? "rgba(0,0,0,0)" : L, o = Math.min(D, Math.max(C, B)), s = Math.max(1, Math.round(o / 42)), c = Math.max(4, Math.round(o * .07)), l = Math.max(10, Math.round(o * .15));
85
85
  if (!i) {
86
86
  t.width = Math.round(o * 4), t.height = Math.round(o * 1.65);
87
87
  let e = t.getContext("2d");
@@ -92,29 +92,29 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
92
92
  format: "CODE128",
93
93
  displayValue: !0,
94
94
  background: a,
95
- lineColor: F,
95
+ lineColor: I,
96
96
  margin: c,
97
97
  width: s,
98
98
  height: o,
99
99
  fontSize: l
100
100
  });
101
101
  }, [
102
- F,
103
102
  I,
104
103
  L,
105
- z
104
+ R,
105
+ B
106
106
  ]);
107
107
  a(() => {
108
- let e = M.current;
108
+ let e = N.current;
109
109
  if (!e) return;
110
110
  let t = !1;
111
111
  return (async () => {
112
112
  try {
113
- N === "qr" ? await Z(e, W) : await Q(e, W), t || K(null);
113
+ P === "qr" ? await Z(e, W) : await Q(e, W), t || K(null);
114
114
  } catch (n) {
115
115
  let r = n instanceof Error ? n.message : String(n);
116
116
  if (!t) {
117
- K(N === "barcode" ? k("Barcode generation failed") : r);
117
+ K(P === "barcode" ? A("Barcode generation failed") : r);
118
118
  let t = e.getContext("2d");
119
119
  t && t.clearRect(0, 0, e.width, e.height);
120
120
  }
@@ -123,24 +123,24 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
123
123
  t = !0;
124
124
  };
125
125
  }, [
126
- N,
126
+ P,
127
127
  W,
128
128
  Q,
129
129
  Z,
130
- k
130
+ A
131
131
  ]);
132
132
  let $ = i(async () => {
133
133
  Y.flush();
134
- let t = P.trim();
135
- if (!t) throw Error(k("Enter text or URL to preview"));
136
- let n = re();
137
- if (N === "qr") {
138
- let r = Math.round(Math.min(S, Math.max(x, R)) * n), i = document.createElement("canvas");
134
+ let t = F.trim();
135
+ if (!t) throw Error(A("Enter text or URL to preview"));
136
+ let n = ne();
137
+ if (P === "qr") {
138
+ let r = Math.round(Math.min(S, Math.max(x, z)) * n), i = document.createElement("canvas");
139
139
  i.width = r, i.height = r, await (await import("./file-manager-browser-DDyRNDQk.js").then((t) => /* @__PURE__ */ e(t.default))).default.toCanvas(i, t, {
140
140
  width: r,
141
141
  margin: 2,
142
142
  color: {
143
- dark: F,
143
+ dark: I,
144
144
  light: X
145
145
  }
146
146
  });
@@ -148,12 +148,12 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
148
148
  if (!a) throw Error("PNG export failed");
149
149
  return a;
150
150
  }
151
- let r = (await import("./file-manager-JsBarcode-CyaffT5b.js").then((t) => /* @__PURE__ */ e(t.default))).default, i = document.createElement("canvas"), a = L ? "rgba(0,0,0,0)" : I, o = Math.min(T, Math.max(w, z)), s = Math.max(6, Math.round(o * .1)), c = Math.max(2, Math.round(o / 36)), l = Math.max(12, Math.round(o * .16));
151
+ let r = (await import("./file-manager-JsBarcode-CyaffT5b.js").then((t) => /* @__PURE__ */ e(t.default))).default, i = document.createElement("canvas"), a = R ? "rgba(0,0,0,0)" : L, o = Math.min(w, Math.max(C, B)), s = Math.max(6, Math.round(o * .1)), c = Math.max(2, Math.round(o / 36)), l = Math.max(12, Math.round(o * .16));
152
152
  r(i, t, {
153
153
  format: "CODE128",
154
154
  displayValue: !0,
155
155
  background: a,
156
- lineColor: F,
156
+ lineColor: I,
157
157
  margin: Math.round(s * n),
158
158
  width: Math.round(c * n),
159
159
  height: Math.round(o * n),
@@ -163,18 +163,18 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
163
163
  if (!u) throw Error("PNG export failed");
164
164
  return u;
165
165
  }, [
166
- N,
167
166
  P,
168
167
  F,
169
- X,
170
168
  I,
169
+ X,
171
170
  L,
172
171
  R,
173
172
  z,
173
+ B,
174
174
  Y,
175
- k
175
+ A
176
176
  ]), ce = i(async () => {
177
- if (!q && P.trim()) {
177
+ if (!q && F.trim()) {
178
178
  J(!0);
179
179
  try {
180
180
  let e;
@@ -185,177 +185,177 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
185
185
  K(t);
186
186
  return;
187
187
  }
188
- let t = new File([e], `${N === "qr" ? "qr-code" : "barcode"}-${Date.now()}.png`, {
188
+ let n = new File([e], `${P === "qr" ? "qr-code" : "barcode"}-${Date.now()}.png`, {
189
189
  type: "image/png",
190
190
  lastModified: Date.now()
191
191
  });
192
- await Promise.resolve(r({ file: t }));
192
+ await Promise.resolve(t({ file: n }));
193
193
  } finally {
194
194
  J(!1);
195
195
  }
196
196
  }
197
197
  }, [
198
- r,
198
+ t,
199
199
  $,
200
- N,
201
200
  P,
201
+ F,
202
202
  q
203
- ]), le = !!P.trim() && !G;
204
- return /* @__PURE__ */ _("div", {
203
+ ]), le = !!F.trim() && !G;
204
+ return /* @__PURE__ */ g("div", {
205
205
  className: b.root,
206
- children: /* @__PURE__ */ v("div", {
206
+ children: /* @__PURE__ */ _("div", {
207
207
  className: b.controls,
208
208
  children: [
209
- /* @__PURE__ */ _(h, {
209
+ /* @__PURE__ */ g(ee, {
210
210
  block: !0,
211
211
  className: b.segmentedControl,
212
- value: N,
212
+ value: P,
213
213
  onChange: (e) => {
214
- B(e), K(null);
214
+ V(e), K(null);
215
215
  },
216
216
  options: [{
217
- label: k("QR code"),
217
+ label: A("QR code"),
218
218
  value: "qr"
219
219
  }, {
220
- label: k("Barcode"),
220
+ label: A("Barcode"),
221
221
  value: "barcode"
222
222
  }]
223
223
  }),
224
- G && /* @__PURE__ */ _(l, {
224
+ G && /* @__PURE__ */ g(l, {
225
225
  type: "error",
226
- title: k("Validation error"),
226
+ title: A("Validation error"),
227
227
  description: G,
228
228
  showIcon: !0,
229
229
  closable: !0,
230
230
  onClose: () => K(null)
231
231
  }),
232
- /* @__PURE__ */ _(p.TextArea, {
233
- value: P,
232
+ /* @__PURE__ */ g(p.TextArea, {
233
+ value: F,
234
234
  onChange: (e) => {
235
- V(e.target.value), K(null);
235
+ H(e.target.value), K(null);
236
236
  },
237
- placeholder: k("Text or URL"),
237
+ placeholder: A("Text or URL"),
238
238
  rows: 3,
239
239
  spellCheck: !1,
240
240
  autoComplete: "off"
241
241
  }),
242
- /* @__PURE__ */ v("div", {
242
+ /* @__PURE__ */ _("div", {
243
243
  className: b.sizeRow,
244
- children: [/* @__PURE__ */ _(g.Text, {
244
+ children: [/* @__PURE__ */ g(h.Text, {
245
245
  type: "secondary",
246
246
  className: b.sizeRowLabel,
247
- children: k(N === "qr" ? "QR image size px" : "Barcode bar height px")
248
- }), N === "qr" ? /* @__PURE__ */ _(m, {
247
+ children: A(P === "qr" ? "QR image size px" : "Barcode bar height px")
248
+ }), P === "qr" ? /* @__PURE__ */ g(m, {
249
249
  className: b.sizeInputNumber,
250
250
  min: x,
251
251
  max: S,
252
252
  step: 8,
253
- value: R,
254
- onChange: (e) => ae(typeof e == "number" && !Number.isNaN(e) ? e : C),
255
- prefix: /* @__PURE__ */ _(y, {
253
+ value: z,
254
+ onChange: (e) => ae(typeof e == "number" && !Number.isNaN(e) ? e : te),
255
+ prefix: /* @__PURE__ */ g(v, {
256
256
  size: 18,
257
- strokeWidth: j
257
+ strokeWidth: M
258
258
  }),
259
- suffix: /* @__PURE__ */ _("span", {
259
+ suffix: /* @__PURE__ */ g("span", {
260
260
  className: b.sizeSuffix,
261
261
  children: "px"
262
262
  }),
263
- "aria-label": k("QR image size px")
264
- }) : /* @__PURE__ */ _(m, {
263
+ "aria-label": A("QR image size px")
264
+ }) : /* @__PURE__ */ g(m, {
265
265
  className: b.sizeInputNumber,
266
- min: w,
267
- max: T,
266
+ min: C,
267
+ max: w,
268
268
  step: 4,
269
- value: z,
270
- onChange: (e) => oe(typeof e == "number" && !Number.isNaN(e) ? e : E),
271
- prefix: /* @__PURE__ */ _(y, {
269
+ value: B,
270
+ onChange: (e) => oe(typeof e == "number" && !Number.isNaN(e) ? e : T),
271
+ prefix: /* @__PURE__ */ g(v, {
272
272
  size: 18,
273
- strokeWidth: j
273
+ strokeWidth: M
274
274
  }),
275
- suffix: /* @__PURE__ */ _("span", {
275
+ suffix: /* @__PURE__ */ g("span", {
276
276
  className: b.sizeSuffix,
277
277
  children: "px"
278
278
  }),
279
- "aria-label": k("Barcode bar height px")
279
+ "aria-label": A("Barcode bar height px")
280
280
  })]
281
281
  }),
282
- /* @__PURE__ */ v("div", {
282
+ /* @__PURE__ */ _("div", {
283
283
  className: b.colorGrid,
284
284
  children: [
285
- /* @__PURE__ */ v("div", {
285
+ /* @__PURE__ */ _("div", {
286
286
  className: b.colorCell,
287
- children: [/* @__PURE__ */ _(g.Text, {
287
+ children: [/* @__PURE__ */ g(h.Text, {
288
288
  type: "secondary",
289
289
  className: b.colorCellLabel,
290
- children: k("Code color", "Code color")
291
- }), /* @__PURE__ */ _(f, {
290
+ children: A("Code color", "Code color")
291
+ }), /* @__PURE__ */ g(f, {
292
292
  className: b.colorPickerFull,
293
- value: F,
293
+ value: I,
294
294
  format: "hex",
295
295
  disabledAlpha: !0,
296
296
  showText: !0,
297
297
  onChange: (e, t) => {
298
298
  let n = typeof e == "string" ? e : e?.toHexString ? e.toHexString() : t;
299
- H(n);
299
+ U(n);
300
300
  }
301
301
  })]
302
302
  }),
303
- /* @__PURE__ */ v("div", {
303
+ /* @__PURE__ */ _("div", {
304
304
  className: b.colorCell,
305
- children: [/* @__PURE__ */ _(g.Text, {
305
+ children: [/* @__PURE__ */ g(h.Text, {
306
306
  type: "secondary",
307
307
  className: b.colorCellLabel,
308
- children: k("Background color", "Background color")
309
- }), /* @__PURE__ */ _(f, {
308
+ children: A("Background color", "Background color")
309
+ }), /* @__PURE__ */ g(f, {
310
310
  className: b.colorPickerFull,
311
- value: I,
311
+ value: L,
312
312
  format: "hex",
313
313
  disabledAlpha: !0,
314
314
  showText: !0,
315
- disabled: L,
315
+ disabled: R,
316
316
  onChange: (e, t) => {
317
317
  let n = typeof e == "string" ? e : e?.toHexString ? e.toHexString() : t;
318
- U(n);
318
+ re(n);
319
319
  }
320
320
  })]
321
321
  }),
322
- /* @__PURE__ */ v("div", {
322
+ /* @__PURE__ */ _("div", {
323
323
  className: b.bgExtras,
324
- children: [/* @__PURE__ */ _(d, {
325
- checked: L,
324
+ children: [/* @__PURE__ */ g(d, {
325
+ checked: R,
326
326
  onChange: (e) => ie(e.target.checked),
327
- children: k("Transparent background", "Transparent background")
328
- }), L && /* @__PURE__ */ _(l, {
327
+ children: A("Transparent background", "Transparent background")
328
+ }), R && /* @__PURE__ */ g(l, {
329
329
  type: "warning",
330
330
  showIcon: !0,
331
- title: k("QR transparent background hint"),
331
+ title: A("QR transparent background hint"),
332
332
  className: b.bgWarning
333
333
  })]
334
334
  })
335
335
  ]
336
336
  }),
337
- /* @__PURE__ */ v("div", {
337
+ /* @__PURE__ */ _("div", {
338
338
  className: b.previewSection,
339
- children: [/* @__PURE__ */ _(g.Text, {
339
+ children: [/* @__PURE__ */ g(h.Text, {
340
340
  className: b.previewTitle,
341
- children: k("Preview", "Preview")
342
- }), /* @__PURE__ */ v("div", {
343
- className: [b.previewWrap, N === "barcode" && b.previewWrapBarcode].filter(Boolean).join(" "),
344
- children: [/* @__PURE__ */ _("div", { className: [b.scanLine, N === "barcode" && b.scanLineBarcode].filter(Boolean).join(" ") }), /* @__PURE__ */ _("canvas", {
345
- ref: M,
346
- className: [b.previewCanvas, N === "barcode" && b.previewCanvasBarcode].filter(Boolean).join(" "),
347
- "aria-label": k("Preview")
341
+ children: A("Preview", "Preview")
342
+ }), /* @__PURE__ */ _("div", {
343
+ className: [b.previewWrap, P === "barcode" && b.previewWrapBarcode].filter(Boolean).join(" "),
344
+ children: [/* @__PURE__ */ g("div", { className: [b.scanLine, P === "barcode" && b.scanLineBarcode].filter(Boolean).join(" ") }), /* @__PURE__ */ g("canvas", {
345
+ ref: N,
346
+ className: [b.previewCanvas, P === "barcode" && b.previewCanvasBarcode].filter(Boolean).join(" "),
347
+ "aria-label": A("Preview")
348
348
  })]
349
349
  })]
350
350
  }),
351
- /* @__PURE__ */ _("div", {
351
+ /* @__PURE__ */ g("div", {
352
352
  className: b.actions,
353
- children: /* @__PURE__ */ _(u, {
353
+ children: /* @__PURE__ */ g(u, {
354
354
  type: "primary",
355
355
  onClick: () => void ce(),
356
356
  loading: q,
357
357
  disabled: !le,
358
- children: k("Add to My files")
358
+ children: A("Add to My files")
359
359
  })
360
360
  })
361
361
  ]
@@ -363,6 +363,6 @@ var D = ({ customRequest: r, state: D, setState: O }) => {
363
363
  });
364
364
  };
365
365
  //#endregion
366
- export { D as default };
366
+ export { O as default };
367
367
 
368
- //# sourceMappingURL=file-manager-ImageCodeGenerator-sUlzbDys.js.map
368
+ //# sourceMappingURL=file-manager-ImageCodeGenerator-Bz0238mQ.js.map