mimir-ui-kit 1.34.6 → 1.34.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
- import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as R, useRef as m, useId as z } from "react";
3
- import { Icon as C } from "../../icons/Icon.js";
4
- import { Button as E } from "../Button/Button.js";
1
+ import { jsxs as n, jsx as a, Fragment as U } from "react/jsx-runtime";
2
+ import { forwardRef as V, useRef as m, useId as z } from "react";
3
+ import { Icon as A } from "../../icons/Icon.js";
4
+ import { Button as B } from "../Button/Button.js";
5
+ import { EButtonVariantDefault as C } from "../Button/constants.js";
5
6
  import '../../assets/Uploader.css';const p = {
6
7
  "upload-file-wrapper": "_upload-file-wrapper_bplvw_2",
7
8
  "upload-text": "_upload-text_bplvw_25",
@@ -20,42 +21,45 @@ import '../../assets/Uploader.css';const p = {
20
21
  xls: "application/excel",
21
22
  txt: "text/plain",
22
23
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
23
- }, F = [
24
+ }, S = [
24
25
  "jpeg",
25
26
  "jpg",
26
27
  "png",
27
28
  "tiff",
28
29
  "gif",
29
30
  "heic"
30
- ], U = () => {
31
- let t = 0;
32
- return () => (t = (t + 1) % Number.MAX_SAFE_INTEGER, t);
33
- }, A = U(), G = R(
34
- (t, g) => {
31
+ ], M = () => {
32
+ let i = 0;
33
+ return () => (i = (i + 1) % Number.MAX_SAFE_INTEGER, i);
34
+ }, k = M(), q = V(
35
+ (i, g) => {
35
36
  const {
36
- filesType: n = F,
37
+ filesType: o = S,
37
38
  onChangeValue: x,
38
39
  arrayName: h,
39
40
  maxSize: r = 15,
40
41
  maxFiles: b,
41
42
  isDisabled: s,
42
- titleUploader: w = "Или перетащите сюда"
43
- } = t, c = m(null), l = m(null), d = z(), y = (e) => {
44
- var i;
45
- return e.type ? e.type : ((i = e.name.split(".").pop()) == null ? void 0 : i.toLowerCase()) === "heic" ? "image/heic" : "";
46
- }, _ = (e) => {
43
+ titleUploader: w = "Или перетащите сюда",
44
+ buttonText: y = "Выберите файлы",
45
+ showOnlyUploadButton: _ = !1,
46
+ uploadButtonVariant: j = C.SecondaryAsphalt
47
+ } = i, c = m(null), l = m(null), d = z(), v = (e) => {
48
+ var t;
49
+ return e.type ? e.type : ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) === "heic" ? "image/heic" : "";
50
+ }, I = (e) => {
47
51
  if (e.target.files && e.target.files[0]) {
48
- const f = Array.from(e.target.files).filter((i) => {
49
- const v = y(i), I = n.map((T) => u[T]).includes(v), N = i.size / 1024 ** 2 <= r;
50
- return I && N;
51
- }).slice(0, b).map((i) => ({ file: i, id: A() }));
52
+ const f = Array.from(e.target.files).filter((t) => {
53
+ const T = v(t), E = o.map((R) => u[R]).includes(T), F = t.size / 1024 ** 2 <= r;
54
+ return E && F;
55
+ }).slice(0, b).map((t) => ({ file: t, id: k() }));
52
56
  x({ arrayName: h, value: f }), l.current && (l.current.value = "");
53
57
  }
54
- }, j = () => {
58
+ }, N = () => {
55
59
  var e;
56
60
  (e = c.current) == null || e.click();
57
61
  };
58
- return /* @__PURE__ */ o("div", { className: p["upload-file-wrapper"], ref: g, children: [
62
+ return /* @__PURE__ */ n("div", { className: p["upload-file-wrapper"], ref: g, children: [
59
63
  /* @__PURE__ */ a(
60
64
  "input",
61
65
  {
@@ -65,38 +69,40 @@ import '../../assets/Uploader.css';const p = {
65
69
  "aria-label": "Upload",
66
70
  name: "image[]",
67
71
  multiple: !0,
68
- onChange: _,
72
+ onChange: I,
69
73
  title: "",
70
74
  id: d,
71
- accept: n.map((e) => u[e]).join(),
75
+ accept: o.map((e) => u[e]).join(),
72
76
  disabled: s
73
77
  }
74
78
  ),
75
- /* @__PURE__ */ o("label", { htmlFor: d, ref: c, children: [
79
+ /* @__PURE__ */ n("label", { htmlFor: d, ref: c, children: [
76
80
  /* @__PURE__ */ a(
77
- E,
81
+ B,
78
82
  {
79
83
  size: "m",
80
- variant: "secondary-asphalt",
81
- leftIcon: /* @__PURE__ */ a(C, { iconName: "UnionIcon16px" }),
82
- onClick: j,
84
+ variant: j,
85
+ leftIcon: /* @__PURE__ */ a(A, { iconName: "UnionIcon16px" }),
86
+ onClick: N,
83
87
  disabled: s,
84
- children: "Выберите файлы"
88
+ children: y
85
89
  }
86
90
  ),
87
- /* @__PURE__ */ a("b", { children: w }),
88
- /* @__PURE__ */ o("span", { className: p["upload-text"], children: [
89
- "Максимальный размер одного файла ",
90
- r,
91
- " Мб",
92
- /* @__PURE__ */ a("br", {}),
93
- "Загрузить можно файлы следующих форматов: ",
94
- n.join(", ")
91
+ !_ && /* @__PURE__ */ n(U, { children: [
92
+ /* @__PURE__ */ a("b", { children: w }),
93
+ /* @__PURE__ */ n("span", { className: p["upload-text"], children: [
94
+ "Максимальный размер одного файла – ",
95
+ r,
96
+ " Мб",
97
+ /* @__PURE__ */ a("br", {}),
98
+ "Загрузить можно файлы следующих форматов: ",
99
+ o.join(", ")
100
+ ] })
95
101
  ] })
96
102
  ] })
97
103
  ] });
98
104
  }
99
105
  );
100
106
  export {
101
- G as Uploader
107
+ q as Uploader
102
108
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.34.6",
4
+ "version": "1.34.7",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {