@hai-dev/ui-kit 1.2.1 → 1.2.2

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 (46) 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 +114 -915
  12. package/dist/components/code-input/types.d.ts +1 -0
  13. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +25 -93
  14. package/dist/components/photo-crop-uploader/components/photo-list/photo-list.js +38 -120
  15. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +16 -16
  16. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog-errors.js +4 -5
  17. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +111 -403
  18. package/dist/components/photo-crop-uploader/photo-crop-uploader.js +12 -12
  19. package/dist/components/photo-crop-uploader/utils/draw-cropped-image.js +8 -8
  20. package/dist/components/photo-crop-uploader/utils/get-cropped-source.js +10 -10
  21. package/dist/components/photo-crop-uploader/utils/get-default-cropped-photo.js +10 -10
  22. package/dist/components/photo-crop-uploader/utils/get-photo-crop.js +18 -18
  23. package/dist/upload-dialog-errors-B7V0G-Ey.js +71 -0
  24. package/package.json +1 -1
  25. package/dist/Box-BgNAyP2L.js +0 -56
  26. package/dist/Button-DTV8ztWw.js +0 -660
  27. package/dist/ButtonBase-C4krg_zd.js +0 -913
  28. package/dist/CircularProgress-BoaEg4rF.js +0 -274
  29. package/dist/Dialog-BK9lMUKV.js +0 -2632
  30. package/dist/DialogTitle-ByUfLB5M.js +0 -254
  31. package/dist/Typography-BMyz0ZCh.js +0 -255
  32. package/dist/assets/inter.css +0 -1
  33. package/dist/button.module-C0UNQnBk.js +0 -40
  34. package/dist/chainPropTypes-DgqFdXGi.js +0 -532
  35. package/dist/createSimplePaletteValueFilter-B7--0ryQ.js +0 -17
  36. package/dist/createTheme-BoOmbNvy.js +0 -4119
  37. package/dist/extendSxProp-BaUCVMKV.js +0 -50
  38. package/dist/index-CcueJ2sD.js +0 -432
  39. package/dist/index-YnD2EP-S.js +0 -43
  40. package/dist/index-h5oTv8GF.js +0 -91
  41. package/dist/isHostComponent-Dm_U9uOy.js +0 -14
  42. package/dist/memoTheme-BYBJ2Fe6.js +0 -15
  43. package/dist/refType-CsohaiiT.js +0 -60
  44. package/dist/upload-dialog-errors-BwQsTOc3.js +0 -367
  45. package/dist/useEnhancedEffect-CJGo-L3B.js +0 -5
  46. package/dist/useId-CK6Kn3Tn.js +0 -21
@@ -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
  };
@@ -0,0 +1,71 @@
1
+ import { jsxs as r, Fragment as i, jsx as n } from "react/jsx-runtime";
2
+ import { DialogTitle as g, DialogContent as v, Divider as h, DialogActions as C } from "@mui/material";
3
+ import o from "classnames";
4
+ import { localizedText as c } from "./components/photo-crop-uploader/locale.js";
5
+ import { EN_LOCALE as N, DASH_SYMBOL as f } from "./constants.js";
6
+ import { Button as a } from "./components/button/button.js";
7
+ import './assets/upload-dialog-errors.css';const A = "_dialog_c18v1_1", x = "_dark_c18v1_5", D = "_errorContent_c18v1_9", k = "_errorItem_c18v1_61", S = "_fileName_c18v1_68", T = "_topActions_c18v1_71", y = "_close_c18v1_77", B = "_botActions_c18v1_85", E = "_button_c18v1_91", I = "_title_c18v1_96", z = "_content_c18v1_103", L = "_many_c18v1_125", j = "_crop_c18v1_129", H = "_dialogText_c18v1_177", t = {
8
+ dialog: A,
9
+ dark: x,
10
+ errorContent: D,
11
+ errorItem: k,
12
+ fileName: S,
13
+ topActions: T,
14
+ close: y,
15
+ botActions: B,
16
+ button: E,
17
+ title: I,
18
+ content: z,
19
+ many: L,
20
+ crop: j,
21
+ dialogText: H
22
+ }, M = (_) => {
23
+ const {
24
+ photoSources: l,
25
+ errors: m = [],
26
+ onCloseDialogHandler: d,
27
+ onClearErrors: u,
28
+ locale: e = N
29
+ } = _;
30
+ return /* @__PURE__ */ r(i, { children: [
31
+ /* @__PURE__ */ n(g, { className: o(t.title), children: l.length ? c[e]["some-not-uploaded"] : c[e]["not-uploaded"] }),
32
+ /* @__PURE__ */ n(v, { className: o(t.errorContent), children: m.map(({ photoName: p, errorMessage: b }, s) => /* @__PURE__ */ r(i, { children: [
33
+ !!s && /* @__PURE__ */ n(h, {}),
34
+ /* @__PURE__ */ r("div", { className: o(t.errorItem), children: [
35
+ /* @__PURE__ */ n("span", { className: o(t.fileName), children: p }),
36
+ " ",
37
+ ` ${f} ${b}`
38
+ ] })
39
+ ] }, s)) }),
40
+ /* @__PURE__ */ r(C, { className: o(t.botActions), children: [
41
+ /* @__PURE__ */ n(
42
+ a,
43
+ {
44
+ buttonSize: "small",
45
+ buttonColor: "red",
46
+ buttonVariant: "outlined",
47
+ buttonWeight: 500,
48
+ onClick: d,
49
+ className: o(t.button),
50
+ children: c[e].close
51
+ }
52
+ ),
53
+ !!l.length && /* @__PURE__ */ n(
54
+ a,
55
+ {
56
+ buttonSize: "small",
57
+ buttonColor: "blue",
58
+ buttonVariant: "outlined",
59
+ buttonWeight: 500,
60
+ onClick: u,
61
+ className: o(t.button),
62
+ children: c[e].continue
63
+ }
64
+ )
65
+ ] })
66
+ ] });
67
+ };
68
+ export {
69
+ M as U,
70
+ t as s
71
+ };
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.2",
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
- };