@hai-dev/ui-kit 1.2.1 → 1.2.3

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.
Files changed (56) hide show
  1. package/dist/assets/button.css +1 -1
  2. package/dist/assets/circular-progress-loader.css +1 -1
  3. package/dist/assets/code-input.css +1 -1
  4. package/dist/assets/error-upload-dialog.css +1 -1
  5. package/dist/assets/upload-dialog-errors.css +1 -1
  6. package/dist/button.module-BnTmlu-U.js +40 -0
  7. package/dist/components/button/button-content.js +8 -8
  8. package/dist/components/button/button.js +21 -22
  9. package/dist/components/button/utils/get-button-classnames.js +10 -10
  10. package/dist/components/circular-progress-loader/circular-progress-loader.js +25 -28
  11. package/dist/components/code-input/code-input.js +129 -912
  12. package/dist/components/code-input/constants.d.ts +1 -0
  13. package/dist/components/code-input/constants.js +9 -8
  14. package/dist/components/code-input/types.d.ts +1 -0
  15. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +46 -94
  16. package/dist/components/photo-crop-uploader/components/photo-list/photo-list.js +38 -120
  17. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +16 -16
  18. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog-errors.js +4 -4
  19. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +113 -404
  20. package/dist/components/photo-crop-uploader/constants.d.ts +2 -2
  21. package/dist/components/photo-crop-uploader/constants.js +1 -1
  22. package/dist/components/photo-crop-uploader/errors/photo-size.error.d.ts +1 -1
  23. package/dist/components/photo-crop-uploader/errors/photo-size.error.js +17 -12
  24. package/dist/components/photo-crop-uploader/locale.js +2 -2
  25. package/dist/components/photo-crop-uploader/photo-crop-uploader.js +45 -38
  26. package/dist/components/photo-crop-uploader/utils/draw-cropped-image.js +8 -8
  27. package/dist/components/photo-crop-uploader/utils/get-cropped-source.js +10 -10
  28. package/dist/components/photo-crop-uploader/utils/get-default-cropped-photo.js +10 -10
  29. package/dist/components/photo-crop-uploader/utils/get-photo-crop.js +18 -18
  30. package/dist/components/photo-crop-uploader/utils/read-photo.d.ts +1 -1
  31. package/dist/components/photo-crop-uploader/utils/read-photo.js +39 -39
  32. package/dist/raw-cross-BhC4FBfp.js +4 -0
  33. package/dist/upload-dialog-errors-BIwMA_MN.js +89 -0
  34. package/package.json +1 -1
  35. package/dist/Box-BgNAyP2L.js +0 -56
  36. package/dist/Button-DTV8ztWw.js +0 -660
  37. package/dist/ButtonBase-C4krg_zd.js +0 -913
  38. package/dist/CircularProgress-BoaEg4rF.js +0 -274
  39. package/dist/Dialog-BK9lMUKV.js +0 -2632
  40. package/dist/DialogTitle-ByUfLB5M.js +0 -254
  41. package/dist/Typography-BMyz0ZCh.js +0 -255
  42. package/dist/assets/inter.css +0 -1
  43. package/dist/button.module-C0UNQnBk.js +0 -40
  44. package/dist/chainPropTypes-DgqFdXGi.js +0 -532
  45. package/dist/createSimplePaletteValueFilter-B7--0ryQ.js +0 -17
  46. package/dist/createTheme-BoOmbNvy.js +0 -4119
  47. package/dist/extendSxProp-BaUCVMKV.js +0 -50
  48. package/dist/index-CcueJ2sD.js +0 -432
  49. package/dist/index-YnD2EP-S.js +0 -43
  50. package/dist/index-h5oTv8GF.js +0 -91
  51. package/dist/isHostComponent-Dm_U9uOy.js +0 -14
  52. package/dist/memoTheme-BYBJ2Fe6.js +0 -15
  53. package/dist/refType-CsohaiiT.js +0 -60
  54. package/dist/upload-dialog-errors-BwQsTOc3.js +0 -367
  55. package/dist/useEnhancedEffect-CJGo-L3B.js +0 -5
  56. package/dist/useId-CK6Kn3Tn.js +0 -21
@@ -1,10 +1,10 @@
1
1
  import { jsxs as Ho, Fragment as Vo, jsx as A } from "react/jsx-runtime";
2
2
  import { useState as i, useRef as U } from "react";
3
- import { v as bo, D as ko } from "../../index-CcueJ2sD.js";
4
- import { c as zo } from "../../index-YnD2EP-S.js";
3
+ import { convertToPercentCrop as bo, convertToPixelCrop as ko } from "react-image-crop";
4
+ import zo from "classnames";
5
5
  import { localizedText as jo } from "./locale.js";
6
6
  import { EN_LOCALE as Wo, DARK_THEME as Bo } from "../../constants.js";
7
- import { DEFAULT_MIN_DIMENSION as Go, DEFAULT_ASPECT_RATIO as Xo, DEFAULT_TIMEOUT as Yo, DEFAULT_FILE_MAX_SIZE as Zo, DEFAULT_VIDEO_FILE_MAX_SIZE as Ko, DEFAULT_BASE_DIMENSION as qo, FULL_PROGRESS_VALUE as oo, PHOTO_LOADING_DELAY as Jo, RESET_DATA_DELAY as d } from "./constants.js";
7
+ import { DEFAULT_MIN_DIMENSION as Go, DEFAULT_ASPECT_RATIO as Xo, DEFAULT_TIMEOUT as Yo, DEFAULT_FILE_MAX_SIZE as Zo, DEFAULT_VIDEO_FILE_MAX_SIZE as Ko, DEFAULT_BASE_DIMENSION as qo, FULL_PROGRESS_VALUE as oo, PHOTO_LOADING_DELAY as Jo, RESET_DATA_DELAY as C } from "./constants.js";
8
8
  import { UploadDialog as Qo } from "./components/upload-dialog/upload-dialog.js";
9
9
  import { UploadButton as $o } from "./components/upload-button/upload-button.js";
10
10
  import { ErrorUploadDialog as oe } from "./components/error-upload-dialog/error-upload-dialog.js";
@@ -37,7 +37,7 @@ function Te(a) {
37
37
  },
38
38
  showErrorPopup: mo = !1,
39
39
  minDimension: l = Go,
40
- aspectRatio: C = Xo,
40
+ aspectRatio: f = Xo,
41
41
  locale: n = Wo,
42
42
  timeout: y = Yo,
43
43
  fileMaxSize: N = Zo,
@@ -61,48 +61,48 @@ function Te(a) {
61
61
  onEndCrop: se,
62
62
  onClose: ae,
63
63
  ..._o
64
- } = Lo, [To, g] = i(!1), [P, D] = i([]), [I, x] = i([]), f = U([]), h = U([]), [p, W] = i(0), B = U(null), G = U(null), [c, O] = i(!1), [Ao, X] = i(0), [Y, Z] = i(""), [Uo, S] = i([]), [wo, K] = i(!1), vo = To || c && E, Io = () => {
64
+ } = Lo, [To, g] = i(!1), [P, D] = i([]), [x, I] = i([]), h = U([]), m = U([]), [p, W] = i(0), B = U(null), G = U(null), [c, O] = i(!1), [Ao, X] = i(0), [Y, Z] = i(""), [Uo, S] = i([]), [wo, K] = i(!1), vo = To || c && E, xo = () => {
65
65
  S([]);
66
66
  }, F = (e = []) => {
67
67
  c || (a.returnCropParams === !0 && a.onClose?.(
68
68
  e,
69
- f.current,
70
- h.current
71
- ), g(!1), setTimeout(() => S([]), d), setTimeout(() => D([]), d), setTimeout(() => {
72
- f.current = [], h.current = [];
73
- }, d));
69
+ h.current,
70
+ m.current
71
+ ), g(!1), setTimeout(() => S([]), C), setTimeout(() => D([]), C), setTimeout(() => {
72
+ h.current = [], m.current = [];
73
+ }, C));
74
74
  }, R = (e = []) => {
75
75
  c || (a.returnCropParams || a.onClose?.(
76
76
  e,
77
- f.current,
78
- h.current
79
- ), g(!1), setTimeout(() => S([]), d), setTimeout(() => D([]), d), setTimeout(() => {
80
- f.current = [], h.current = [];
81
- }, d));
77
+ h.current,
78
+ m.current
79
+ ), g(!1), setTimeout(() => S([]), C), setTimeout(() => D([]), C), setTimeout(() => {
80
+ h.current = [], m.current = [];
81
+ }, C));
82
82
  }, q = () => {
83
83
  c || (a.returnCropParams === !0 ? F([]) : R([]));
84
- }, xo = () => {
84
+ }, Io = () => {
85
85
  K(!1);
86
86
  }, L = (e, t = e, o = [], r = !1) => {
87
- lo(e), Z(""), D(e), x(Array(e.length)), W(0), g(!0), f.current = t, h.current = o, !e.length && !r && q();
87
+ lo(e), Z(""), D(e), I(Array(e.length)), W(0), g(!0), h.current = t, m.current = o, !e.length && !r && q();
88
88
  }, M = (e) => {
89
- e instanceof Error && (console.warn(e.message), co(e), Z(e.message), K(!0), D([]), g(!1), f.current = [], h.current = []);
89
+ e instanceof Error && (console.warn(e.message), co(e), Z(e.message), K(!0), D([]), g(!1), h.current = [], m.current = []);
90
90
  }, Oo = async (e) => {
91
91
  const { files: t } = e.target;
92
92
  if (t?.length && !c)
93
93
  try {
94
94
  if (O(!0), io(), E) {
95
95
  const o = Array.from(t), r = oo / o.length, _ = [], u = [], Q = [], T = [];
96
- for (const m of o) {
97
- const No = eo(m);
96
+ for (const d of o) {
97
+ const No = eo(d);
98
98
  try {
99
99
  if (v && No) {
100
- to(m, H, n);
101
- const s = URL.createObjectURL(m);
100
+ to(d, H, n);
101
+ const s = URL.createObjectURL(d);
102
102
  Q.push(u.length), u.push(s);
103
103
  } else {
104
104
  ro(
105
- m,
105
+ d,
106
106
  {
107
107
  maxSize: N,
108
108
  allowedExtensions: w,
@@ -111,17 +111,18 @@ function Te(a) {
111
111
  n
112
112
  );
113
113
  const s = await no(
114
- m,
114
+ d,
115
115
  l,
116
116
  n,
117
- y
117
+ y,
118
+ f
118
119
  );
119
120
  _.push(s), u.push(s);
120
121
  }
121
122
  } catch (s) {
122
123
  let $ = "";
123
124
  s instanceof Error && ($ = s.message), T.push({
124
- photoName: m.name,
125
+ photoName: d.name,
125
126
  errorMessage: $
126
127
  });
127
128
  }
@@ -144,7 +145,13 @@ function Te(a) {
144
145
  { maxSize: N, allowedExtensions: w, allowedMimeTypes: V },
145
146
  n
146
147
  );
147
- const r = await no(o, l, n, y);
148
+ const r = await no(
149
+ o,
150
+ l,
151
+ n,
152
+ y,
153
+ f
154
+ );
148
155
  L([r]);
149
156
  }
150
157
  }
@@ -160,24 +167,24 @@ function Te(a) {
160
167
  t,
161
168
  o,
162
169
  l,
163
- C,
170
+ f,
164
171
  !1,
165
172
  So
166
173
  );
167
- x((_) => {
174
+ I((_) => {
168
175
  const u = [..._];
169
176
  return u[p] = r, u;
170
177
  });
171
178
  }, Ro = (e, t) => {
172
- x((o) => {
179
+ I((o) => {
173
180
  const r = [...o];
174
181
  return r[p] = t, r;
175
182
  });
176
183
  }, J = () => {
177
184
  const e = G.current, t = B.current;
178
- if (e && t && I)
185
+ if (e && t && x)
179
186
  try {
180
- const o = I[p];
187
+ const o = x[p];
181
188
  if (!o) return !1;
182
189
  if (po(), a.returnCropParams === !0) {
183
190
  if (b) {
@@ -222,7 +229,7 @@ function Te(a) {
222
229
  (o) => so(
223
230
  o,
224
231
  l,
225
- C,
232
+ f,
226
233
  n,
227
234
  !0,
228
235
  b
@@ -236,7 +243,7 @@ function Te(a) {
236
243
  (o) => so(
237
244
  o,
238
245
  l,
239
- C,
246
+ f,
240
247
  n,
241
248
  !1
242
249
  )
@@ -279,11 +286,11 @@ function Te(a) {
279
286
  photoSourceLoading: c,
280
287
  loadingValue: Ao,
281
288
  errors: Uo,
282
- photoCrops: I,
289
+ photoCrops: x,
283
290
  photoSources: P,
284
291
  onNextPhoto: Mo,
285
292
  onSkipCrop: yo,
286
- onClearErrors: Io,
293
+ onClearErrors: xo,
287
294
  photoError: Y,
288
295
  onCloseDialogHandler: q,
289
296
  onCropChange: Ro,
@@ -291,7 +298,7 @@ function Te(a) {
291
298
  onPhotoLoad: Fo,
292
299
  imageRef: B,
293
300
  minDimension: l,
294
- aspectRatio: C,
301
+ aspectRatio: f,
295
302
  locale: n,
296
303
  circular: Co,
297
304
  keepSelection: go,
@@ -305,7 +312,7 @@ function Te(a) {
305
312
  className: z,
306
313
  open: mo && wo,
307
314
  photoError: Y,
308
- onCloseErrorDialog: xo,
315
+ onCloseErrorDialog: Io,
309
316
  locale: n,
310
317
  theme: j
311
318
  }
@@ -1,16 +1,16 @@
1
- import { D as w } from "../../../index-CcueJ2sD.js";
1
+ import { convertToPixelCrop as w } from "react-image-crop";
2
2
  import { localizedText as m } from "../locale.js";
3
- import { EN_LOCALE as E } from "../../../constants.js";
4
- import { PHOTO_CANVAS_CONTEXT as x } from "../constants.js";
5
- const L = (o, d, s, n = E) => new Promise((p, i) => {
3
+ import { EN_LOCALE as x } from "../../../constants.js";
4
+ import { PHOTO_CANVAS_CONTEXT as C } from "../constants.js";
5
+ const u = (o, d, p, n = x) => new Promise((s, i) => {
6
6
  const r = new Image();
7
7
  r.src = d, r.addEventListener("load", () => {
8
- const { width: e, height: c } = o, { naturalWidth: g, naturalHeight: h } = r, a = o.getContext(x);
8
+ const { width: e, height: c } = o, { naturalWidth: g, naturalHeight: h } = r, a = o.getContext(C);
9
9
  if (!a) {
10
10
  i(new Error(m[n]["canvas-error"]));
11
11
  return;
12
12
  }
13
- const t = w(s, g, h);
13
+ const t = w(p, g, h);
14
14
  a.drawImage(
15
15
  r,
16
16
  t.x,
@@ -21,12 +21,12 @@ const L = (o, d, s, n = E) => new Promise((p, i) => {
21
21
  0,
22
22
  e,
23
23
  c
24
- ), p();
24
+ ), s();
25
25
  }), r.addEventListener("error", () => {
26
26
  const e = new Error(m[n]["paint-error"]);
27
27
  i(e);
28
28
  });
29
29
  });
30
30
  export {
31
- L as drawCroppedImage
31
+ u as drawCroppedImage
32
32
  };
@@ -1,15 +1,15 @@
1
- import { D as w } from "../../../index-CcueJ2sD.js";
2
- import { localizedText as x } from "../locale.js";
1
+ import { convertToPixelCrop as x } from "react-image-crop";
2
+ import { localizedText as w } from "../locale.js";
3
3
  import { EN_LOCALE as O } from "../../../constants.js";
4
- import { PHOTO_CANVAS_CONTEXT as f, PHOTO_SMOOTHING_QUALITY as T } from "../constants.js";
5
- const H = (c, o, d, m = O) => {
6
- const t = o.getContext(f);
4
+ import { PHOTO_CANVAS_CONTEXT as T, PHOTO_SMOOTHING_QUALITY as f } from "../constants.js";
5
+ const H = (c, o, p, d = O) => {
6
+ const t = o.getContext(T);
7
7
  if (!t)
8
- throw new Error(x[m]["canvas-error"]);
9
- const { width: l, height: n, naturalWidth: i, naturalHeight: a } = c, r = w(d, l, n), e = window.devicePixelRatio, h = i / l, s = a / n;
10
- o.width = Math.floor(r.width * h * e), o.height = Math.floor(r.height * s * e), t.scale(e, e), t.imageSmoothingQuality = T, t.save();
11
- const p = r.x * h, g = r.y * s;
12
- return t.translate(-p, -g), t.drawImage(
8
+ throw new Error(w[d]["canvas-error"]);
9
+ const { width: l, height: n, naturalWidth: i, naturalHeight: a } = c, r = x(p, l, n), e = window.devicePixelRatio, h = i / l, s = a / n;
10
+ o.width = Math.floor(r.width * h * e), o.height = Math.floor(r.height * s * e), t.scale(e, e), t.imageSmoothingQuality = f, t.save();
11
+ const m = r.x * h, g = r.y * s;
12
+ return t.translate(-m, -g), t.drawImage(
13
13
  c,
14
14
  0,
15
15
  0,
@@ -1,14 +1,14 @@
1
- import { v as g, D as v } from "../../../index-CcueJ2sD.js";
2
- import { getPhotoCrop as w } from "./get-photo-crop.js";
3
- import { getCroppedSource as C } from "./get-cropped-source.js";
4
- import { localizedText as E } from "../locale.js";
5
- function L(a, i, m, n, s, d) {
1
+ import { convertToPercentCrop as C, convertToPixelCrop as P } from "react-image-crop";
2
+ import { getPhotoCrop as g } from "./get-photo-crop.js";
3
+ import { getCroppedSource as v } from "./get-cropped-source.js";
4
+ import { localizedText as l } from "../locale.js";
5
+ function D(a, i, m, n, s, d) {
6
6
  return new Promise((c, p) => {
7
7
  const o = new Image(), h = document.createElement("canvas");
8
8
  o.src = a, o.addEventListener("load", () => {
9
9
  const { width: r, height: e } = o;
10
10
  try {
11
- const t = w(
11
+ const t = g(
12
12
  r,
13
13
  e,
14
14
  i,
@@ -16,11 +16,11 @@ function L(a, i, m, n, s, d) {
16
16
  !0
17
17
  );
18
18
  if (s) {
19
- const u = d ? g(t, r, e) : v(t, r, e);
19
+ const u = d ? C(t, r, e) : P(t, r, e);
20
20
  c(u);
21
21
  return;
22
22
  }
23
- const f = C(
23
+ const f = v(
24
24
  o,
25
25
  h,
26
26
  t,
@@ -31,11 +31,11 @@ function L(a, i, m, n, s, d) {
31
31
  p(t);
32
32
  }
33
33
  }), o.addEventListener("error", () => {
34
- const r = new Error(E[n]["paint-error"]);
34
+ const r = new Error(l[n]["paint-error"]);
35
35
  p(r);
36
36
  });
37
37
  });
38
38
  }
39
39
  export {
40
- L as getDefaultCroppedPhoto
40
+ D as getDefaultCroppedPhoto
41
41
  };
@@ -1,35 +1,35 @@
1
- import { B as _, L as N } from "../../../index-CcueJ2sD.js";
2
- import { DEFAULT_MIN_DIMENSION as n, DEFAULT_ASPECT_RATIO as A, FULL_CROP_SIZE as E, PERCENT_UNIT as t } from "../constants.js";
3
- const M = (r, c, C = n, I = A, P = !1, o) => {
4
- const L = r / c / I, T = C / r * E, e = C / c * E;
5
- let p;
6
- return o && o >= T && o >= e ? L <= 1 ? p = _(
1
+ import { makeAspectCrop as C, centerCrop as A } from "react-image-crop";
2
+ import { DEFAULT_MIN_DIMENSION as N, DEFAULT_ASPECT_RATIO as L, PERCENT_UNIT as I, FULL_CROP_SIZE as t } from "../constants.js";
3
+ const s = (r, c, E = N, p = L, _ = !1, o) => {
4
+ const n = r / c / p, P = E / r * t, T = E / c * t;
5
+ let e;
6
+ return o && o >= P && o >= T ? n <= 1 ? e = C(
7
7
  {
8
- unit: t,
8
+ unit: I,
9
9
  width: o
10
10
  },
11
- I,
11
+ p,
12
12
  r,
13
13
  c
14
- ) : p = _(
14
+ ) : e = C(
15
15
  {
16
- unit: t,
16
+ unit: I,
17
17
  height: o
18
18
  },
19
- I,
19
+ p,
20
20
  r,
21
21
  c
22
- ) : p = _(
22
+ ) : e = C(
23
23
  {
24
- unit: t,
25
- width: P ? E : T,
26
- height: P ? E : e
24
+ unit: I,
25
+ width: _ ? t : P,
26
+ height: _ ? t : T
27
27
  },
28
- I,
28
+ p,
29
29
  r,
30
30
  c
31
- ), N(p, r, c);
31
+ ), A(e, r, c);
32
32
  };
33
33
  export {
34
- M as getPhotoCrop
34
+ s as getPhotoCrop
35
35
  };
@@ -1,3 +1,3 @@
1
1
  import { Locale } from '../../../types';
2
2
  import { PhotoDataUrl } from '../types';
3
- export declare const readPhoto: (file: File, minDimension?: number, locale?: Locale, timeout?: number) => Promise<PhotoDataUrl>;
3
+ export declare const readPhoto: (file: File, minDimension?: number, locale?: Locale, timeout?: number, aspectRatio?: number) => Promise<PhotoDataUrl>;
@@ -1,54 +1,54 @@
1
- import { localizedText as s } from "../locale.js";
1
+ import { localizedText as E } from "../locale.js";
2
2
  import { EN_LOCALE as c } from "../../../constants.js";
3
- import { DEFAULT_MIN_DIMENSION as p, DEFAULT_TIMEOUT as A, MS_UNIT as _, MAX_ASPECT_RATIO as w, MIN_ASPECT_RATIO as l } from "../constants.js";
4
- import { PhotoSizeError as v } from "../errors/photo-size.error.js";
5
- const S = async (L, d = p, o = c, T = A) => new Promise(
6
- (m, e) => {
7
- const t = new FileReader();
3
+ import { DEFAULT_MIN_DIMENSION as h, DEFAULT_TIMEOUT as w, DEFAULT_ASPECT_RATIO as M, MS_UNIT as g, MAX_ASPECT_RATIO as v, MIN_ASPECT_RATIO as S } from "../constants.js";
4
+ import { PhotoSizeError as U } from "../errors/photo-size.error.js";
5
+ const p = async (m, a = h, o = c, A = w, d = M) => new Promise(
6
+ (f, t) => {
7
+ const e = new FileReader();
8
8
  let r = !1;
9
- const E = setTimeout(() => {
10
- r || (r = !0, t.abort(), e(
9
+ const u = setTimeout(() => {
10
+ r || (r = !0, e.abort(), t(
11
11
  new Error(
12
- `${s[o]["timeout-error"]}: ${T}${_}`
12
+ `${E[o]["timeout-error"]}: ${A}${g}`
13
13
  )
14
14
  ));
15
- }, T);
16
- t.addEventListener("load", () => {
15
+ }, A);
16
+ e.addEventListener("load", () => {
17
17
  if (r) return;
18
- r = !0, clearTimeout(E);
19
- const a = t.result?.toString() || "";
20
- if (!a) {
21
- m("");
18
+ r = !0, clearTimeout(u);
19
+ const i = e.result?.toString() || "";
20
+ if (!i) {
21
+ f("");
22
22
  return;
23
23
  }
24
- const i = new Image();
25
- i.src = a, i.addEventListener("load", () => {
26
- const { naturalWidth: n, naturalHeight: f } = i, I = f / n;
27
- if (n < d || f < d) {
28
- const u = v.get(d, o);
29
- e(u);
30
- } else if (I > w || I < l) {
31
- const u = new Error(s[o].aspect);
32
- e(u);
24
+ const s = new Image();
25
+ s.src = i, s.addEventListener("load", () => {
26
+ const { naturalWidth: n, naturalHeight: I } = s, L = I / n, _ = d >= 1 ? Math.ceil(a * d) : a, l = d >= 1 ? a : Math.ceil(a / d);
27
+ if (n < _ || I < l) {
28
+ const T = U.get(a, o, d);
29
+ t(T);
30
+ } else if (L > v || L < S) {
31
+ const T = new Error(E[o].aspect);
32
+ t(T);
33
33
  } else
34
- m(a);
35
- }), i.addEventListener("error", () => {
36
- const n = new Error(s[o]["paint-error"]);
37
- e(n);
38
- }), i.addEventListener("abort", () => {
39
- const n = new Error(s[o]["read-abort"]);
40
- e(n);
34
+ f(i);
35
+ }), s.addEventListener("error", () => {
36
+ const n = new Error(E[o]["paint-error"]);
37
+ t(n);
38
+ }), s.addEventListener("abort", () => {
39
+ const n = new Error(E[o]["read-abort"]);
40
+ t(n);
41
41
  });
42
- }), t.addEventListener("error", () => {
43
- r || (r = !0, clearTimeout(E), e(t.error));
44
- }), t.addEventListener("abort", () => {
42
+ }), e.addEventListener("error", () => {
43
+ r || (r = !0, clearTimeout(u), t(e.error));
44
+ }), e.addEventListener("abort", () => {
45
45
  if (r) return;
46
- r = !0, clearTimeout(E);
47
- const a = new Error(s[o]["paint-abort"]);
48
- e(a);
49
- }), t.readAsDataURL(L);
46
+ r = !0, clearTimeout(u);
47
+ const i = new Error(E[o]["paint-abort"]);
48
+ t(i);
49
+ }), e.readAsDataURL(m);
50
50
  }
51
51
  );
52
52
  export {
53
- S as readPhoto
53
+ p as readPhoto
54
54
  };
@@ -0,0 +1,4 @@
1
+ const s = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.27623%200.391122C1.75553%20-0.129577%200.911316%20-0.129578%200.390616%200.391122C-0.130083%200.911821%20-0.130083%201.75604%200.390616%202.27674L6.04747%207.93359L0.390616%2013.5904C-0.130083%2014.1111%20-0.130083%2014.9554%200.390616%2015.4761C0.911316%2015.9968%201.75553%2015.9968%202.27623%2015.4761L7.93309%209.81921L13.5899%2015.4761C14.1106%2015.9968%2014.9549%2015.9968%2015.4756%2015.4761C15.9963%2014.9554%2015.9963%2014.1111%2015.4756%2013.5904L9.81871%207.93359L15.4756%202.27674C15.9963%201.75604%2015.9963%200.911822%2015.4756%200.391122C14.9549%20-0.129577%2014.1106%20-0.129578%2013.5899%200.391123L7.93309%206.04798L2.27623%200.391122Z'%20fill='%233AA8FF'/%3e%3c/svg%3e";
2
+ export {
3
+ s as c
4
+ };
@@ -0,0 +1,89 @@
1
+ import { jsxs as l, Fragment as i, jsx as o } from "react/jsx-runtime";
2
+ import { DialogActions as d, IconButton as v, DialogTitle as h, DialogContent as N, Divider as C } from "@mui/material";
3
+ import t from "classnames";
4
+ import { localizedText as r } from "./components/photo-crop-uploader/locale.js";
5
+ import { EN_LOCALE as f, DASH_SYMBOL as A } from "./constants.js";
6
+ import { c as x } from "./raw-cross-BhC4FBfp.js";
7
+ import { Button as _ } from "./components/button/button.js";
8
+ import './assets/upload-dialog-errors.css';const D = "_dialog_1v8d5_1", k = "_dark_1v8d5_5", I = "_errorContent_1v8d5_9", B = "_errorItem_1v8d5_61", S = "_fileName_1v8d5_68", T = "_topActions_1v8d5_71", W = "_close_1v8d5_77", y = "_botActions_1v8d5_85", E = "_button_1v8d5_91", z = "_title_1v8d5_96", L = "_content_1v8d5_103", j = "_many_1v8d5_125", H = "_cropWrapper_1v8d5_129", O = "_crop_1v8d5_129", U = "_dialogText_1v8d5_198", e = {
9
+ dialog: D,
10
+ dark: k,
11
+ errorContent: I,
12
+ errorItem: B,
13
+ fileName: S,
14
+ topActions: T,
15
+ close: W,
16
+ botActions: y,
17
+ button: E,
18
+ title: z,
19
+ content: L,
20
+ many: j,
21
+ cropWrapper: H,
22
+ crop: O,
23
+ dialogText: U
24
+ }, G = (m) => {
25
+ const {
26
+ photoSources: c,
27
+ errors: p = [],
28
+ onCloseDialogHandler: s,
29
+ onClearErrors: u,
30
+ locale: n = f
31
+ } = m;
32
+ return /* @__PURE__ */ l(i, { children: [
33
+ /* @__PURE__ */ o(d, { className: t(e.topActions), children: /* @__PURE__ */ o(
34
+ v,
35
+ {
36
+ onClick: s,
37
+ className: t(e.close),
38
+ "aria-label": r[n].close,
39
+ children: /* @__PURE__ */ o(
40
+ "img",
41
+ {
42
+ draggable: !1,
43
+ src: x,
44
+ alt: r[n].close
45
+ }
46
+ )
47
+ }
48
+ ) }),
49
+ /* @__PURE__ */ o(h, { className: t(e.title), children: c.length ? r[n]["some-not-uploaded"] : r[n]["not-uploaded"] }),
50
+ /* @__PURE__ */ o(N, { className: t(e.errorContent), children: p.map(({ photoName: b, errorMessage: g }, a) => /* @__PURE__ */ l(i, { children: [
51
+ !!a && /* @__PURE__ */ o(C, {}),
52
+ /* @__PURE__ */ l("div", { className: t(e.errorItem), children: [
53
+ /* @__PURE__ */ o("span", { className: t(e.fileName), children: b }),
54
+ " ",
55
+ ` ${A} ${g}`
56
+ ] })
57
+ ] }, a)) }),
58
+ /* @__PURE__ */ l(d, { className: t(e.botActions), children: [
59
+ /* @__PURE__ */ o(
60
+ _,
61
+ {
62
+ buttonSize: "small",
63
+ buttonColor: "red",
64
+ buttonVariant: "outlined",
65
+ buttonWeight: 500,
66
+ onClick: s,
67
+ className: t(e.button),
68
+ children: r[n].close
69
+ }
70
+ ),
71
+ !!c.length && /* @__PURE__ */ o(
72
+ _,
73
+ {
74
+ buttonSize: "small",
75
+ buttonColor: "blue",
76
+ buttonVariant: "outlined",
77
+ buttonWeight: 500,
78
+ onClick: u,
79
+ className: t(e.button),
80
+ children: r[n].continue
81
+ }
82
+ )
83
+ ] })
84
+ ] });
85
+ };
86
+ export {
87
+ G as U,
88
+ e as s
89
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hai-dev/ui-kit",
3
3
  "private": false,
4
- "version": "1.2.1",
4
+ "version": "1.2.3",
5
5
  "license": "UNLICENSED",
6
6
  "author": {
7
7
  "name": "Vladislav Knitrunov",
@@ -1,56 +0,0 @@
1
- import { s as i, d as p, c as h, a as T, C as y, T as B, e as N, P as e } from "./createTheme-BoOmbNvy.js";
2
- import * as C from "react";
3
- import { jsx as b } from "react/jsx-runtime";
4
- import { u as g, e as v } from "./extendSxProp-BaUCVMKV.js";
5
- function E(n = {}) {
6
- const {
7
- themeId: t,
8
- defaultTheme: c,
9
- defaultClassName: a = "MuiBox-root",
10
- generateClassName: r
11
- } = n, m = i("div", {
12
- shouldForwardProp: (o) => o !== "theme" && o !== "sx" && o !== "as"
13
- })(p);
14
- return /* @__PURE__ */ C.forwardRef(function(l, d) {
15
- const s = g(c), {
16
- className: f,
17
- component: u = "div",
18
- ...x
19
- } = v(l);
20
- return /* @__PURE__ */ b(m, {
21
- as: u,
22
- ref: d,
23
- className: h(f, r ? r(a) : a),
24
- theme: t && s[t] || s,
25
- ...x
26
- });
27
- });
28
- }
29
- const O = T("MuiBox", ["root"]), P = N(), j = E({
30
- themeId: B,
31
- defaultTheme: P,
32
- defaultClassName: O.root,
33
- generateClassName: y.generate
34
- });
35
- process.env.NODE_ENV !== "production" && (j.propTypes = {
36
- // ┌────────────────────────────── Warning ──────────────────────────────┐
37
- // │ These PropTypes are generated from the TypeScript type definitions. │
38
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
39
- // └─────────────────────────────────────────────────────────────────────┘
40
- /**
41
- * @ignore
42
- */
43
- children: e.node,
44
- /**
45
- * The component used for the root node.
46
- * Either a string to use a HTML element or a component.
47
- */
48
- component: e.elementType,
49
- /**
50
- * The system prop that allows defining system overrides as well as additional CSS styles.
51
- */
52
- sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object])
53
- });
54
- export {
55
- j as B
56
- };