@hai-dev/ui-kit 1.1.11 → 1.2.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.
Files changed (65) hide show
  1. package/dist/{Box-TrgOqpYk.js → Box-BgNAyP2L.js} +2 -2
  2. package/dist/{Button-BN3fv8kr.js → Button-DTV8ztWw.js} +5 -5
  3. package/dist/{ButtonBase-CSWuFxUv.js → ButtonBase-C4krg_zd.js} +3 -3
  4. package/dist/{CircularProgress-sPARyPfh.js → CircularProgress-BoaEg4rF.js} +3 -3
  5. package/dist/{Dialog-Cf0d7zi7.js → Dialog-BK9lMUKV.js} +12 -11
  6. package/dist/{DialogTitle-BtvmXSZP.js → DialogTitle-ByUfLB5M.js} +4 -4
  7. package/dist/{Typography-Bjd6ZHeX.js → Typography-BMyz0ZCh.js} +4 -4
  8. package/dist/assets/button.css +1 -1
  9. package/dist/assets/circular-progress-loader.css +1 -1
  10. package/dist/assets/code-input.css +1 -1
  11. package/dist/assets/error-upload-dialog.css +1 -1
  12. package/dist/assets/inter.css +1 -0
  13. package/dist/assets/photo-list.css +1 -1
  14. package/dist/assets/upload-dialog-errors.css +1 -1
  15. package/dist/button.module-C0UNQnBk.js +40 -0
  16. package/dist/chainPropTypes-DgqFdXGi.js +532 -0
  17. package/dist/components/button/button-content.js +11 -11
  18. package/dist/components/button/button.d.ts +18 -0
  19. package/dist/components/button/button.js +42 -35
  20. package/dist/components/button/constants.d.ts +17 -0
  21. package/dist/components/button/constants.js +28 -11
  22. package/dist/components/button/types.d.ts +11 -8
  23. package/dist/components/button/utils/get-button-classnames.d.ts +6 -0
  24. package/dist/components/button/utils/get-button-classnames.js +22 -10
  25. package/dist/components/circular-progress-loader/circular-progress-loader.js +14 -13
  26. package/dist/components/code-input/code-input.js +114 -112
  27. package/dist/components/photo-crop-uploader/components/error-upload-dialog/error-upload-dialog.js +37 -34
  28. package/dist/components/photo-crop-uploader/components/error-upload-dialog/types.d.ts +2 -1
  29. package/dist/components/photo-crop-uploader/components/photo-list/constants.d.ts +5 -1
  30. package/dist/components/photo-crop-uploader/components/photo-list/constants.js +6 -2
  31. package/dist/components/photo-crop-uploader/components/photo-list/photo-list.js +136 -33
  32. package/dist/components/photo-crop-uploader/components/photo-list/types.d.ts +2 -0
  33. package/dist/components/photo-crop-uploader/components/photo-list/use-container-size.d.ts +4 -0
  34. package/dist/components/photo-crop-uploader/components/photo-list/use-container-size.js +22 -0
  35. package/dist/components/photo-crop-uploader/components/upload-button/upload-button.js +1 -1
  36. package/dist/components/photo-crop-uploader/components/upload-dialog/constants.d.ts +1 -1
  37. package/dist/components/photo-crop-uploader/components/upload-dialog/constants.js +1 -1
  38. package/dist/components/photo-crop-uploader/components/upload-dialog/types.d.ts +2 -1
  39. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog-errors.js +4 -3
  40. package/dist/components/photo-crop-uploader/components/upload-dialog/upload-dialog.js +159 -147
  41. package/dist/components/photo-crop-uploader/components/upload-dialog/use-scaled-min-dimension.d.ts +4 -0
  42. package/dist/components/photo-crop-uploader/components/upload-dialog/use-scaled-min-dimension.js +31 -0
  43. package/dist/components/photo-crop-uploader/locale.js +6 -2
  44. package/dist/components/photo-crop-uploader/photo-crop-uploader.js +131 -128
  45. package/dist/components/photo-crop-uploader/types.d.ts +2 -1
  46. package/dist/constants.d.ts +2 -0
  47. package/dist/constants.js +5 -3
  48. package/dist/{createTheme-D8R2Cz2N.js → createTheme-BoOmbNvy.js} +426 -390
  49. package/dist/{extendSxProp-Cw_ym9sl.js → extendSxProp-BaUCVMKV.js} +2 -1
  50. package/dist/{index-CL3JU48X.js → index-h5oTv8GF.js} +3 -3
  51. package/dist/index.d.ts +3 -3
  52. package/dist/index.js +26 -24
  53. package/dist/{memoTheme-D5VCpQCz.js → memoTheme-BYBJ2Fe6.js} +1 -1
  54. package/dist/refType-CsohaiiT.js +60 -0
  55. package/dist/types.d.ts +2 -1
  56. package/dist/{upload-dialog-errors-Cyz6_7n4.js → upload-dialog-errors-CCRxzIZp.js} +69 -67
  57. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  58. package/dist/utils/debounce.d.ts +5 -0
  59. package/dist/utils/debounce.js +12 -0
  60. package/dist/utils/index.d.ts +1 -0
  61. package/dist/utils/index.js +4 -0
  62. package/package.json +10 -2
  63. package/dist/button.module-BZPPmSAS.js +0 -21
  64. package/dist/chainPropTypes-DiJb1lGa.js +0 -568
  65. package/dist/refType-CUEs_vK5.js +0 -61
@@ -1,37 +1,140 @@
1
- import { jsxs as p, jsx as m } from "react/jsx-runtime";
2
- import { c as o } from "../../../../index-YnD2EP-S.js";
3
- import { MAX_ITEMS_COUNT as r } from "./constants.js";
4
- import { B as n } from "../../../../Box-TrgOqpYk.js";
5
- import '../../../../assets/photo-list.css';const g = "_photoList_rrp1z_1", u = "_item_rrp1z_6", x = "_image_rrp1z_17", t = {
6
- photoList: g,
7
- item: u,
8
- image: x
9
- }, z = (l) => {
10
- const { photoSources: h, photoIndex: _, className: a, ...c } = l, s = h.slice(_);
11
- return s.length > r ? /* @__PURE__ */ p(n, { className: o(t.photoList, a), ...c, children: [
12
- s.slice(0, r - 1).map((e, i) => /* @__PURE__ */ m(
13
- "img",
14
- {
15
- className: o(t.item, t.image),
16
- src: e,
17
- alt: "photo in queue"
18
- },
19
- i
20
- )),
21
- /* @__PURE__ */ p("div", { className: o(t.item), children: [
22
- "Еще ",
23
- s.length - r + 1
24
- ] })
25
- ] }) : /* @__PURE__ */ m(n, { className: o(t.photoList, a), ...c, children: s.map((e, i) => /* @__PURE__ */ m(
26
- "img",
1
+ import { jsxs as T, jsx as g } from "react/jsx-runtime";
2
+ import * as f from "react";
3
+ import { useState as N } from "react";
4
+ import { c as E } from "../../../../index-YnD2EP-S.js";
5
+ import { useContainerSize as P } from "./use-container-size.js";
6
+ import { EN_LOCALE as w } from "../../../../constants.js";
7
+ import { FALLBACK_MAX_ITEMS as Q, MOBILE_MIN_GAP as b, MOBILE_ITEM_SIZE as O, DESKTOP_MIN_GAP as U, DESKTOP_ITEM_SIZE as j } from "./constants.js";
8
+ import { localizedText as x } from "../../locale.js";
9
+ import { r as D, T as A } from "../../../../createTheme-BoOmbNvy.js";
10
+ import { a as C } from "../../../../extendSxProp-BaUCVMKV.js";
11
+ import { u as k } from "../../../../useEnhancedEffect-CJGo-L3B.js";
12
+ import { B as y } from "../../../../Box-BgNAyP2L.js";
13
+ import '../../../../assets/photo-list.css';function B(t) {
14
+ const {
15
+ theme: o,
16
+ name: e,
17
+ props: n
18
+ } = t;
19
+ return !o || !o.components || !o.components[e] || !o.components[e].defaultProps ? n : D(o.components[e].defaultProps, n);
20
+ }
21
+ function $(t, o, e, n, a) {
22
+ const [s, m] = f.useState(() => a && e ? e(t).matches : n ? n(t).matches : o);
23
+ return k(() => {
24
+ if (!e)
25
+ return;
26
+ const i = e(t), c = () => {
27
+ m(i.matches);
28
+ };
29
+ return c(), i.addEventListener("change", c), () => {
30
+ i.removeEventListener("change", c);
31
+ };
32
+ }, [t, e]), s;
33
+ }
34
+ const K = {
35
+ ...f
36
+ }, v = K.useSyncExternalStore;
37
+ function R(t, o, e, n, a) {
38
+ const s = f.useCallback(() => o, [o]), m = f.useMemo(() => {
39
+ if (a && e)
40
+ return () => e(t).matches;
41
+ if (n !== null) {
42
+ const {
43
+ matches: u
44
+ } = n(t);
45
+ return () => u;
46
+ }
47
+ return s;
48
+ }, [s, t, n, a, e]), [i, c] = f.useMemo(() => {
49
+ if (e === null)
50
+ return [s, () => () => {
51
+ }];
52
+ const u = e(t);
53
+ return [() => u.matches, (r) => (u.addEventListener("change", r), () => {
54
+ u.removeEventListener("change", r);
55
+ })];
56
+ }, [s, e, t]);
57
+ return v(c, i, m);
58
+ }
59
+ function S(t = {}) {
60
+ const {
61
+ themeId: o
62
+ } = t;
63
+ return function(n, a = {}) {
64
+ let s = C();
65
+ s && o && (s = s[o] || s);
66
+ const m = typeof window < "u" && typeof window.matchMedia < "u", {
67
+ defaultMatches: i = !1,
68
+ matchMedia: c = m ? window.matchMedia : null,
69
+ ssrMatchMedia: _ = null,
70
+ noSsr: u = !1
71
+ } = B({
72
+ name: "MuiUseMediaQuery",
73
+ props: a,
74
+ theme: s
75
+ });
76
+ process.env.NODE_ENV !== "production" && typeof n == "function" && s === null && console.error(["MUI: The `query` argument provided is invalid.", "You are providing a function without a theme in the context.", "One of the parent elements needs to use a ThemeProvider."].join(`
77
+ `));
78
+ let r = typeof n == "function" ? n(s) : n;
79
+ r = r.replace(/^@media( ?)/m, ""), r.includes("print") && console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.", "Using the print media query to modify print styles can lead to unexpected results.", "Consider using the `displayPrint` field in the `sx` prop instead.", "More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
80
+ `));
81
+ const h = (v !== void 0 ? R : $)(r, i, c, _, u);
82
+ return process.env.NODE_ENV !== "production" && f.useDebugValue({
83
+ query: r,
84
+ match: h
85
+ }), h;
86
+ };
87
+ }
88
+ S();
89
+ const V = S({
90
+ themeId: A
91
+ }), z = "_photoList_1j5k1_1", X = "_item_1j5k1_7", Y = "_image_1j5k1_21", l = {
92
+ photoList: z,
93
+ item: X,
94
+ image: Y
95
+ };
96
+ function L(t, o, e) {
97
+ return t <= 0 ? Q : Math.max(1, Math.floor((t + e) / (o + e)));
98
+ }
99
+ const se = (t) => {
100
+ const { photoSources: o, photoIndex: e, locale: n, className: a, ...s } = t, [m, i] = N(null), { width: c, height: _ } = P(m), r = V("(max-width: 768px)") ? L(c, O, b) : L(_, j, U), d = o.slice(e), h = x[n]["photo-in-queue"], I = (p) => n === w ? `${p} ${x[n].more}` : `${x[n].more} ${p}`;
101
+ return d.length > r ? /* @__PURE__ */ T(
102
+ y,
103
+ {
104
+ ref: i,
105
+ className: E(l.photoList, a),
106
+ ...s,
107
+ children: [
108
+ d.slice(0, r - 1).map((p, M) => /* @__PURE__ */ g(
109
+ "img",
110
+ {
111
+ className: E(l.item, l.image),
112
+ src: p,
113
+ alt: h
114
+ },
115
+ M
116
+ )),
117
+ /* @__PURE__ */ g("div", { className: E(l.item), children: I(d.length - r + 1) })
118
+ ]
119
+ }
120
+ ) : /* @__PURE__ */ g(
121
+ y,
27
122
  {
28
- className: o(t.item, t.image),
29
- src: e,
30
- alt: "photo in queue"
31
- },
32
- i
33
- )) });
123
+ ref: i,
124
+ className: E(l.photoList, a),
125
+ ...s,
126
+ children: d.map((p, M) => /* @__PURE__ */ g(
127
+ "img",
128
+ {
129
+ className: E(l.item, l.image),
130
+ src: p,
131
+ alt: h
132
+ },
133
+ M
134
+ ))
135
+ }
136
+ );
34
137
  };
35
138
  export {
36
- z as PhotoList
139
+ se as PhotoList
37
140
  };
@@ -1,8 +1,10 @@
1
1
  import { BoxProps } from '@mui/material';
2
2
  import { PhotoDataUrl } from '../../types';
3
+ import { Locale } from '../../../../types';
3
4
  type PhotoListCustomProps = {
4
5
  photoSources: PhotoDataUrl[];
5
6
  photoIndex: number;
7
+ locale: Locale;
6
8
  };
7
9
  export type PhotoListProps = PhotoListCustomProps & BoxProps;
8
10
  export {};
@@ -0,0 +1,4 @@
1
+ export declare function useContainerSize(el: Element | null): {
2
+ width: number;
3
+ height: number;
4
+ };
@@ -0,0 +1,22 @@
1
+ import { useState as h, useEffect as u } from "react";
2
+ import { debounce as d } from "../../../../utils/debounce.js";
3
+ const f = 100;
4
+ function b(e) {
5
+ const [o, t] = h({ width: 0, height: 0 });
6
+ return u(() => {
7
+ if (!e) {
8
+ t({ width: 0, height: 0 });
9
+ return;
10
+ }
11
+ const n = d(([r]) => {
12
+ const { width: s, height: c } = r.contentRect;
13
+ t({ width: s, height: c });
14
+ }, f), i = new ResizeObserver(n);
15
+ return i.observe(e), () => {
16
+ n.cancel(), i.disconnect();
17
+ };
18
+ }, [e]), o;
19
+ }
20
+ export {
21
+ b as useContainerSize
22
+ };
@@ -5,7 +5,7 @@ import { localizedText as T } from "../../locale.js";
5
5
  import { EN_LOCALE as y } from "../../../../constants.js";
6
6
  import { SUPPORTED_IMAGE_EXTENSIONS as M, MP4_VIDEO_EXT as j, WEBM_VIDEO_EXT as H } from "../../constants.js";
7
7
  import { UPLOAD_BUTTON_WIDTH_DEFAULT as X, UPLOAD_BUTTON_TAB_INDEX as F, UPLOAD_BUTTON_IMAGE_SIZE as x } from "./constants.js";
8
- import { B as z } from "../../../../Button-BN3fv8kr.js";
8
+ import { B as z } from "../../../../Button-DTV8ztWw.js";
9
9
  import '../../../../assets/upload-button.css';const Y = "data:image/svg+xml,%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Transformed%20by:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23000000'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'/%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3cpath%20fill='%23ffffff'%20d='M544%20864V672h128L512%20480%20352%20672h128v192H320v-1.6c-5.376.32-10.496%201.6-16%201.6A240%20240%200%200%201%2064%20624c0-123.136%2093.12-223.488%20212.608-237.248A239.808%20239.808%200%200%201%20512%20192a239.872%20239.872%200%200%201%20235.456%20194.752c119.488%2013.76%20212.48%20114.112%20212.48%20237.248a240%20240%200%200%201-240%20240c-5.376%200-10.56-1.28-16-1.6v1.6H544z'/%3e%3c/g%3e%3c/svg%3e", Z = "_dragDropWrapper_cgx9x_1", q = "_input_cgx9x_4", a = {
10
10
  dragDropWrapper: Z,
11
11
  input: q
@@ -1 +1 @@
1
- export declare const CLOSE_ICON_SIZE = 40;
1
+ export declare const CLOSE_ICON_SIZE = 22;
@@ -1,4 +1,4 @@
1
- const o = 40;
1
+ const o = 22;
2
2
  export {
3
3
  o as CLOSE_ICON_SIZE
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { SyntheticEvent } from 'react';
2
2
  import { DialogProps } from '@mui/material';
3
3
  import { Crop, PercentCrop, PixelCrop } from 'react-image-crop';
4
- import { Locale } from '../../../../types';
4
+ import { Locale, Theme } from '../../../../types';
5
5
  import { FileErrorItem, PhotoDataUrl } from '../../types';
6
6
  type OnPhotoLoad = (event: SyntheticEvent<HTMLImageElement, Event>) => void;
7
7
  type OnCropChange = (pixelCrop: PixelCrop, percentCrop: PercentCrop) => void;
@@ -29,6 +29,7 @@ type UploadDialogCustomProps = {
29
29
  photoSourceLoading: boolean;
30
30
  loadingValue?: number;
31
31
  errors?: FileErrorItem[];
32
+ theme?: Theme;
32
33
  };
33
34
  export type UploadDialogProps = UploadDialogCustomProps & DialogProps;
34
35
  export type UploadDialogErrorsProps = {
@@ -2,9 +2,10 @@ import "react/jsx-runtime";
2
2
  import "../../../../index-YnD2EP-S.js";
3
3
  import "../../locale.js";
4
4
  import "../../../../constants.js";
5
- import { U as s } from "../../../../upload-dialog-errors-Cyz6_7n4.js";
6
- import "../../../../DialogTitle-BtvmXSZP.js";
5
+ import '../../../../assets/inter.css';/* empty css */
6
+ import { U } from "../../../../upload-dialog-errors-CCRxzIZp.js";
7
+ import "../../../../DialogTitle-ByUfLB5M.js";
7
8
  import "../../../button/button.js";
8
9
  export {
9
- s as UploadDialogErrors
10
+ U as UploadDialogErrors
10
11
  };