mimir-ui-kit 1.39.1 → 1.39.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.
package/README.md CHANGED
@@ -58,5 +58,6 @@ npm version patch
58
58
  ```bash
59
59
  npm run icons
60
60
  ```
61
- 4. Смотрим в папку `icons/components`
62
- 5. Готово.
61
+ 4. Переходим в `icons/components/svgs/catalog.json` и добавляем имена компонентов в массив. (необходимо для вывода в сторибуке)
62
+ 5. Смотрим в папку `icons/components`
63
+ 6. Готово.
@@ -1,106 +1,113 @@
1
- import { jsxs as h, jsx as f, Fragment as j } from "react/jsx-runtime";
2
- import { c as B } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as D, useState as _, useEffect as C, useMemo as O } from "react";
4
- import { imageTypes as y } from "./constants.js";
1
+ import { jsxs as F, jsx as m, Fragment as B } from "react/jsx-runtime";
2
+ import { c as _ } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as j, useState as A, useEffect as C, useMemo as O } from "react";
4
+ import { imageTypes as v } from "./constants.js";
5
5
  import "../Button/Button.js";
6
- import { EButtonVariantDefault as P } from "../Button/constants.js";
7
- import { ListFiles as A } from "../ListFiles/ListFiles.js";
8
- import { EFileItemVariant as k } from "../ListFiles/constants.js";
9
- import { ListPhotos as q } from "../ListPhotos/ListPhotos.js";
10
- import { Uploader as G } from "../Uploader/Uploader.js";
6
+ import { EButtonVariantDefault as k } from "../Button/constants.js";
7
+ import { ListFiles as q } from "../ListFiles/ListFiles.js";
8
+ import { EFileItemVariant as G } from "../ListFiles/constants.js";
9
+ import { ListPhotos as H } from "../ListPhotos/ListPhotos.js";
10
+ import { Uploader as J } from "../Uploader/Uploader.js";
11
11
  import '../../assets/UploaderPhotos.css';const x = {
12
12
  "upload-file-wrapper": "_upload-file-wrapper_1a115_2"
13
- }, d = (i) => "file" in i && i.file instanceof File ? y.includes(i.file.type) : "type" in i && typeof i.type == "string" ? y.includes(i.type) : !1, te = D(
14
- (i, F) => {
13
+ }, u = (i) => "file" in i && i.file instanceof File ? v.includes(i.file.type) : "type" in i && typeof i.type == "string" ? v.includes(i.type) : !1, se = j(
14
+ (i, g) => {
15
15
  const {
16
- type: a,
17
- filesType: v,
18
- arrayName: g,
19
- maxSize: w,
20
- onChange: s,
21
- value: r,
16
+ type: s,
17
+ filesType: w,
18
+ arrayName: z,
19
+ maxSize: I,
20
+ onChange: a,
21
+ value: l,
22
22
  maxFiles: n,
23
- titleUploader: z,
23
+ titleUploader: P,
24
24
  buttonText: U = "Выберите файлы",
25
- showOnlyUploadButton: m = !1,
26
- uploadButtonVariant: b = P.SecondaryAsphalt,
27
- buttonSize: I = "m",
28
- buttonClassName: E,
29
- variantListFiles: L = k.white,
30
- onMaxFilesExceeded: S,
31
- onMaxSizeExceeded: V,
25
+ showOnlyUploadButton: c = !1,
26
+ uploadButtonVariant: b = k.SecondaryAsphalt,
27
+ buttonSize: E = "m",
28
+ buttonClassName: S,
29
+ variantListFiles: V = G.white,
30
+ onMaxFilesExceeded: D,
31
+ onMaxSizeExceeded: L,
32
32
  onInvalidFileType: M
33
- } = i, [l, p] = _(
34
- r || []
35
- ), u = !!n && l.length >= n;
33
+ } = i, [r, p] = A(
34
+ l || []
35
+ ), h = !!n && r.length >= n;
36
36
  C(() => {
37
- r && p(r);
38
- }, [r]);
37
+ l && p(l);
38
+ }, [l]);
39
39
  const N = (t) => {
40
- const o = t.value.map((e) => d(e.file) ? {
41
- id: e.id,
42
- url: URL.createObjectURL(e.file),
43
- type: e.file.type,
44
- name: e.file.name,
45
- size: e.file.size
46
- } : {
40
+ const o = t.value.map((e) => u(e.file) ? new Promise((d) => {
41
+ const f = new FileReader();
42
+ f.onload = () => {
43
+ d({
44
+ id: e.id,
45
+ url: f.result,
46
+ type: e.file.type,
47
+ name: e.file.name,
48
+ size: e.file.size
49
+ });
50
+ }, f.readAsDataURL(e.file);
51
+ }) : Promise.resolve({
47
52
  id: e.id,
48
53
  url: "",
49
54
  size: e.file.size,
50
55
  name: e.file.name,
51
56
  type: e.file.type
57
+ }));
58
+ Promise.all(o).then((e) => {
59
+ p((d) => [...d, ...e]), a == null || a({ type: "add", data: t.value });
52
60
  });
53
- p((e) => [...e, ...o]), s == null || s({ type: "add", data: t.value });
54
- }, c = (t) => {
55
- p((o) => o.filter((e) => e.id !== t)), s == null || s({ type: "delete", data: t });
61
+ }, y = (t) => {
62
+ p((o) => o.filter((e) => e.id !== t)), a == null || a({ type: "delete", data: t });
56
63
  }, { photos: R, files: T } = O(() => {
57
- const t = () => l.filter((e) => !d(e)), o = () => l.filter(d);
58
- return a === "all" ? { files: t(), photos: o() } : a === "files" ? { photos: [], files: t() } : a === "photos" ? { files: [], photos: o() } : { files: [], photos: [] };
59
- }, [l, a]);
60
- return /* @__PURE__ */ h(
64
+ const t = () => r.filter((e) => !u(e)), o = () => r.filter(u);
65
+ return s === "all" ? { files: t(), photos: o() } : s === "files" ? { photos: [], files: t() } : s === "photos" ? { files: [], photos: o() } : { files: [], photos: [] };
66
+ }, [r, s]);
67
+ return /* @__PURE__ */ F(
61
68
  "div",
62
69
  {
63
70
  "data-testid": "universal-uploader",
64
- className: B(
71
+ className: _(
65
72
  x["upload-file-wrapper"],
66
- u && x.disabled
73
+ h && x.disabled
67
74
  ),
68
75
  children: [
69
- /* @__PURE__ */ f(
70
- G,
76
+ /* @__PURE__ */ m(
77
+ J,
71
78
  {
72
- filesType: v,
73
- arrayName: g,
74
- maxSize: w,
79
+ filesType: w,
80
+ arrayName: z,
81
+ maxSize: I,
75
82
  onChangeValue: N,
76
- ref: F,
77
- maxFiles: n && n - l.length,
78
- isDisabled: u,
79
- titleUploader: z,
80
- showOnlyUploadButton: m,
83
+ ref: g,
84
+ maxFiles: n && n - r.length,
85
+ isDisabled: h,
86
+ titleUploader: P,
87
+ showOnlyUploadButton: c,
81
88
  buttonText: U,
82
89
  uploadButtonVariant: b,
83
- buttonSize: I,
84
- buttonClassName: E,
85
- onMaxFilesExceeded: S,
86
- onMaxSizeExceeded: V,
90
+ buttonSize: E,
91
+ buttonClassName: S,
92
+ onMaxFilesExceeded: D,
93
+ onMaxSizeExceeded: L,
87
94
  onInvalidFileType: M
88
95
  }
89
96
  ),
90
- !m && /* @__PURE__ */ h(j, { children: [
91
- (a === "files" || a === "all") && /* @__PURE__ */ f(
92
- A,
97
+ !c && /* @__PURE__ */ F(B, { children: [
98
+ (s === "files" || s === "all") && /* @__PURE__ */ m(
99
+ q,
93
100
  {
94
101
  value: T,
95
- onChange: (t) => c(t.deleteId),
96
- variant: L
102
+ onChange: (t) => y(t.deleteId),
103
+ variant: V
97
104
  }
98
105
  ),
99
- (a === "photos" || a === "all") && /* @__PURE__ */ f(
100
- q,
106
+ (s === "photos" || s === "all") && /* @__PURE__ */ m(
107
+ H,
101
108
  {
102
109
  value: R,
103
- onChange: (t) => c(t.deleteId)
110
+ onChange: (t) => y(t.deleteId)
104
111
  }
105
112
  )
106
113
  ] })
@@ -110,5 +117,5 @@ import '../../assets/UploaderPhotos.css';const x = {
110
117
  }
111
118
  );
112
119
  export {
113
- te as UniversalUploader
120
+ se as UniversalUploader
114
121
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { Suspense as s } from "react";
3
- import { i as e } from "../index-DhAMYnGs.js";
3
+ import { i as e } from "../index-__gOemjc.js";
4
4
  const p = ({ iconName: o, ...n }) => {
5
5
  const r = e[o];
6
6
  return r ? /* @__PURE__ */ t(s, { fallback: null, children: /* @__PURE__ */ t(r, { ...n, "data-testid": o }) }) : null;
@@ -10,7 +10,6 @@ const t = (e) => /* @__PURE__ */ l(
10
10
  "path",
11
11
  {
12
12
  fill: "currentColor",
13
- fillRule: "evenodd",
14
13
  d: "m0 12 3.785-8.487C4.737 1.376 6.89.003 9.25.003L36 0l-3.783 8.487c-.953 2.137-3.107 3.51-5.467 3.51l-26.749.002z",
15
14
  clipRule: "evenodd"
16
15
  }