mimir-ui-kit 1.38.1 → 1.38.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/dist/assets/SelectSearch.css +1 -1
  2. package/dist/{combobox-CVtJDVoZ.js → combobox-DgSZTriw.js} +254 -251
  3. package/dist/components/Accordion/Accordion.js +3 -3
  4. package/dist/components/CheckboxMimir/CheckboxMimir.js +4 -4
  5. package/dist/components/DatePicker/hooks.js +12 -12
  6. package/dist/components/Dropdown/Dropdown.js +32 -32
  7. package/dist/components/MultiSelectSearch/MultiSelectSearch.js +18 -18
  8. package/dist/components/RadioGroup/RadioGroup.js +3 -3
  9. package/dist/components/SelectSearch/SelectSearch.js +116 -116
  10. package/dist/components/Switcher/Switcher.js +4 -4
  11. package/dist/components/TabTrail/TabTrail.js +4 -4
  12. package/dist/components/UniversalUploader/UniversalUploader.js +56 -50
  13. package/dist/components/Uploader/Uploader.d.ts +12 -0
  14. package/dist/components/Uploader/Uploader.js +64 -59
  15. package/dist/components/UploaderFiles/UploaderFiles.d.ts +12 -0
  16. package/dist/components/UploaderFiles/UploaderFiles.js +45 -39
  17. package/dist/components/UploaderPhotos/UploaderPhotos.d.ts +12 -0
  18. package/dist/components/UploaderPhotos/UploaderPhotos.js +40 -34
  19. package/dist/{field-FJ34aSs4.js → field-C1kt7aNM.js} +2 -2
  20. package/dist/{focus-management-DE4t_lW3.js → focus-management-BtPpk3D1.js} +1 -1
  21. package/dist/{hidden-DbgtYPOH.js → hidden-PvGXrYUY.js} +1 -1
  22. package/dist/{keyboard-B0lm_zyn.js → keyboard-mgWkd2Vh.js} +114 -111
  23. package/dist/{label-y3ANLTNC.js → label-D4GFpe5F.js} +2 -2
  24. package/dist/open-closed-D2VjDhAN.js +86 -0
  25. package/dist/portal-DPqg52FR.js +1946 -0
  26. package/dist/{use-active-press-86hajhdd.js → use-active-press-CqLGIFz7.js} +1 -1
  27. package/package.json +1 -1
  28. package/dist/open-closed-CdldUPoq.js +0 -86
  29. package/dist/portal-WDFNoIMz.js +0 -1908
@@ -1,13 +1,13 @@
1
- import { jsxs as n, jsx as a, Fragment as S } from "react/jsx-runtime";
2
- import { forwardRef as U, useRef as u, useId as V } from "react";
3
- import { Icon as A } from "../../icons/Icon.js";
4
- import { Button as B } from "../Button/Button.js";
5
- import { EButtonVariantDefault as M } from "../Button/constants.js";
6
- import '../../assets/Uploader.css';const p = {
1
+ import { jsxs as o, jsx as n, Fragment as A } from "react/jsx-runtime";
2
+ import { forwardRef as B, useRef as _, useId as k } from "react";
3
+ import { Icon as D } from "../../icons/Icon.js";
4
+ import { Button as G } from "../Button/Button.js";
5
+ import { EButtonVariantDefault as O } from "../Button/constants.js";
6
+ import '../../assets/Uploader.css';const s = {
7
7
  "upload-file-wrapper": "_upload-file-wrapper_bplvw_2",
8
8
  "upload-text": "_upload-text_bplvw_25",
9
9
  "upload-file-input": "_upload-file-input_bplvw_35"
10
- }, g = {
10
+ }, j = {
11
11
  jpeg: "image/jpeg",
12
12
  jpg: "image/jpg",
13
13
  png: "image/png",
@@ -21,85 +21,90 @@ import '../../assets/Uploader.css';const p = {
21
21
  xls: "application/excel",
22
22
  txt: "text/plain",
23
23
  xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
24
- }, k = [
24
+ }, L = [
25
25
  "jpeg",
26
26
  "jpg",
27
27
  "png",
28
28
  "tiff",
29
29
  "gif",
30
30
  "heic"
31
- ], D = () => {
31
+ ], X = () => {
32
32
  let i = 0;
33
33
  return () => (i = (i + 1) % Number.MAX_SAFE_INTEGER, i);
34
- }, G = D(), J = U(
35
- (i, x) => {
34
+ }, q = X(), W = B(
35
+ (i, v) => {
36
36
  const {
37
- filesType: o = k,
38
- onChangeValue: h,
39
- arrayName: b,
40
- maxSize: r = 15,
41
- maxFiles: w,
42
- isDisabled: s,
43
- titleUploader: c = "Или перетащите сюда",
44
- buttonText: y = "Выберите файлы",
45
- showOnlyUploadButton: _ = !1,
46
- uploadButtonVariant: j = M.SecondaryAsphalt,
47
- buttonSize: v = "m",
48
- buttonClassName: I
49
- } = i, d = u(null), l = u(null), f = V(), N = (e) => {
50
- var t;
51
- return e.type ? e.type : ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) === "heic" ? "image/heic" : "";
52
- }, T = (e) => {
37
+ filesType: l = L,
38
+ onChangeValue: I,
39
+ arrayName: N,
40
+ maxSize: c = 15,
41
+ maxFiles: d,
42
+ isDisabled: f,
43
+ titleUploader: m = "Или перетащите сюда",
44
+ buttonText: T = "Выберите файлы",
45
+ showOnlyUploadButton: E = !1,
46
+ uploadButtonVariant: F = O.SecondaryAsphalt,
47
+ buttonSize: z = "m",
48
+ buttonClassName: S,
49
+ onMaxFilesExceeded: u,
50
+ onMaxSizeExceeded: g,
51
+ onInvalidFileType: x
52
+ } = i, h = _(null), p = _(null), b = k(), C = (e) => {
53
+ var a;
54
+ return e.type ? e.type : ((a = e.name.split(".").pop()) == null ? void 0 : a.toLowerCase()) === "heic" ? "image/heic" : "";
55
+ }, M = (e) => {
53
56
  if (e.target.files && e.target.files[0]) {
54
- const m = Array.from(e.target.files).filter((t) => {
55
- const C = N(t), E = o.map((R) => g[R]).includes(C), F = t.size / 1024 ** 2 <= r;
56
- return E && F;
57
- }).slice(0, w).map((t) => ({ file: t, id: G() }));
58
- h({ arrayName: b, value: m }), l.current && (l.current.value = "");
57
+ const r = Array.from(e.target.files);
58
+ r.length > d && u && u();
59
+ const a = r.filter((t) => {
60
+ const U = C(t), w = l.map((V) => j[V]).includes(U), y = t.size / 1024 ** 2 <= c;
61
+ return !w && x && x(t.name), !y && g && g(t.name), w && y;
62
+ }).slice(0, d).map((t) => ({ file: t, id: q() }));
63
+ I({ arrayName: N, value: a }), p.current && (p.current.value = "");
59
64
  }
60
- }, z = () => {
65
+ }, R = () => {
61
66
  var e;
62
- (e = d.current) == null || e.click();
67
+ (e = h.current) == null || e.click();
63
68
  };
64
- return /* @__PURE__ */ n("div", { className: p["upload-file-wrapper"], ref: x, children: [
65
- /* @__PURE__ */ a(
69
+ return /* @__PURE__ */ o("div", { className: s["upload-file-wrapper"], ref: v, children: [
70
+ /* @__PURE__ */ n(
66
71
  "input",
67
72
  {
68
- ref: l,
73
+ ref: p,
69
74
  type: "file",
70
- className: p["upload-file-input"],
75
+ className: s["upload-file-input"],
71
76
  "aria-label": "Upload",
72
77
  name: "image[]",
73
78
  multiple: !0,
74
- onChange: T,
79
+ onChange: M,
75
80
  title: "",
76
- id: f,
77
- accept: o.map((e) => g[e]).join(),
78
- disabled: s
81
+ id: b,
82
+ accept: l.map((e) => j[e]).join(),
83
+ disabled: f
79
84
  }
80
85
  ),
81
- /* @__PURE__ */ n("label", { htmlFor: f, ref: d, children: [
82
- /* @__PURE__ */ a(
83
- B,
86
+ /* @__PURE__ */ o("label", { htmlFor: b, ref: h, children: [
87
+ /* @__PURE__ */ n(
88
+ G,
84
89
  {
85
- size: v,
86
- variant: j,
87
- leftIcon: /* @__PURE__ */ a(A, { iconName: "UnionIcon16px" }),
88
- onClick: z,
89
- disabled: s,
90
- className: I,
91
- children: y
90
+ size: z,
91
+ variant: F,
92
+ leftIcon: /* @__PURE__ */ n(D, { iconName: "UnionIcon16px" }),
93
+ onClick: R,
94
+ disabled: f,
95
+ className: S,
96
+ children: T
92
97
  }
93
98
  ),
94
- !_ && /* @__PURE__ */ n(S, { children: [
95
- c && /* @__PURE__ */ a("b", { children: c }),
96
- /* @__PURE__ */ n("span", { className: p["upload-text"], children: [
99
+ !E && /* @__PURE__ */ o(A, { children: [
100
+ m && /* @__PURE__ */ n("b", { children: m }),
101
+ /* @__PURE__ */ o("span", { className: s["upload-text"], children: [
97
102
  "Максимальный размер одного файла – ",
98
- r,
103
+ c,
99
104
  " Мб",
100
- /* @__PURE__ */ a("br", {}),
105
+ /* @__PURE__ */ n("br", {}),
101
106
  "Загрузить можно файлы следующих форматов: ",
102
- o.join(", ")
107
+ l.join(", ")
103
108
  ] })
104
109
  ] })
105
110
  ] })
@@ -107,5 +112,5 @@ import '../../assets/Uploader.css';const p = {
107
112
  }
108
113
  );
109
114
  export {
110
- J as Uploader
115
+ W as Uploader
111
116
  };
@@ -38,6 +38,18 @@ export type TUploaderFiles = {
38
38
  * необязательное поле, имя формы загрузчика на случай, если на странице несколько форм
39
39
  */
40
40
  name?: string;
41
+ /**
42
+ * Проп для обработки ошибки при превышении максимального количества файлов
43
+ */
44
+ onMaxFilesExceeded?: () => void;
45
+ /**
46
+ * Проп для обработки ошибки при превышении максимального размера файла
47
+ */
48
+ onMaxSizeExceeded?: (fileName: string) => void;
49
+ /**
50
+ * Проп для обработки ошибки при загрузке файла неразрешенного типа
51
+ */
52
+ onInvalidFileType?: (fileName: string) => void;
41
53
  };
42
54
  export type TOnChangeFilesUpdate = {
43
55
  type: string;
@@ -1,70 +1,76 @@
1
- import { jsxs as _, jsx as c } from "react/jsx-runtime";
2
- import { c as h } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as D, useState as I, useEffect as R } from "react";
4
- import { ListFiles as S } from "../ListFiles/ListFiles.js";
5
- import { Uploader as T } from "../Uploader/Uploader.js";
6
- import '../../assets/UploaderPhotos.css';const n = {
1
+ import { jsxs as S, jsx as n } from "react/jsx-runtime";
2
+ import { c as T } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as _, useState as h, useEffect as D } from "react";
4
+ import { ListFiles as R } from "../ListFiles/ListFiles.js";
5
+ import { Uploader as U } from "../Uploader/Uploader.js";
6
+ import '../../assets/UploaderPhotos.css';const c = {
7
7
  "upload-file-wrapper": "_upload-file-wrapper_1a115_2"
8
- }, g = D(
8
+ }, q = _(
9
9
  (u, x) => {
10
10
  const {
11
- filesType: y,
12
- arrayName: F,
11
+ filesType: F,
12
+ arrayName: y,
13
13
  maxSize: v,
14
14
  onChange: a,
15
- value: t,
16
- name: o,
17
- maxFiles: d,
18
- buttonText: w
19
- } = u, [i, r] = I(t || []), p = i.length >= d;
20
- R(() => {
21
- t && r(t);
22
- }, [t]);
23
- const b = (s) => {
15
+ value: s,
16
+ name: d,
17
+ maxFiles: r,
18
+ buttonText: w,
19
+ onMaxFilesExceeded: z,
20
+ onMaxSizeExceeded: b,
21
+ onInvalidFileType: E
22
+ } = u, [t, o] = h(s || []), l = t.length >= r;
23
+ D(() => {
24
+ s && o(s);
25
+ }, [s]);
26
+ const I = (i) => {
24
27
  const N = [
25
- ...i,
26
- ...s.value.map((e) => {
27
- var l, f, m;
28
+ ...t,
29
+ ...i.value.map((e) => {
30
+ var p, f, m;
28
31
  return {
29
32
  id: e.id,
30
33
  url: "",
31
- size: (l = e == null ? void 0 : e.file) == null ? void 0 : l.size,
34
+ size: (p = e == null ? void 0 : e.file) == null ? void 0 : p.size,
32
35
  name: (f = e == null ? void 0 : e.file) == null ? void 0 : f.name,
33
36
  type: (m = e == null ? void 0 : e.file) == null ? void 0 : m.type
34
37
  };
35
38
  })
36
39
  ];
37
- r(N), a == null || a({ type: "add", data: s.value, name: o });
38
- }, z = (s) => {
39
- r(s.list), s.deleteId && (a == null || a({ type: "delete", data: s.deleteId, name: o }));
40
+ o(N), a == null || a({ type: "add", data: i.value, name: d });
41
+ }, M = (i) => {
42
+ o(i.list), i.deleteId && (a == null || a({ type: "delete", data: i.deleteId, name: d }));
40
43
  };
41
- return /* @__PURE__ */ _(
44
+ return /* @__PURE__ */ S(
42
45
  "div",
43
46
  {
44
- className: h(
45
- n["upload-file-wrapper"],
46
- p && n.disabled
47
+ className: T(
48
+ c["upload-file-wrapper"],
49
+ l && c.disabled
47
50
  ),
48
51
  children: [
49
- /* @__PURE__ */ c(
50
- T,
52
+ /* @__PURE__ */ n(
53
+ U,
51
54
  {
52
- filesType: y,
53
- arrayName: F,
55
+ filesType: F,
56
+ arrayName: y,
54
57
  maxSize: v,
55
- onChangeValue: b,
58
+ onChangeValue: I,
56
59
  ref: x,
57
- maxFiles: d,
58
- isDisabled: p,
59
- buttonText: w
60
+ maxFiles: r,
61
+ isDisabled: l,
62
+ buttonText: w,
63
+ onMaxFilesExceeded: z,
64
+ onMaxSizeExceeded: b,
65
+ onInvalidFileType: E
60
66
  }
61
67
  ),
62
- /* @__PURE__ */ c(S, { value: i, onChange: z })
68
+ /* @__PURE__ */ n(R, { value: t, onChange: M })
63
69
  ]
64
70
  }
65
71
  );
66
72
  }
67
73
  );
68
74
  export {
69
- g as UploaderFiles
75
+ q as UploaderFiles
70
76
  };
@@ -39,6 +39,18 @@ export type TUploaderPhotos = {
39
39
  * необязательное поле, имя формы загрузчика на случай, если на странице несколько форм
40
40
  */
41
41
  name?: string;
42
+ /**
43
+ * Проп для обработки ошибки при превышении максимального количества файлов
44
+ */
45
+ onMaxFilesExceeded?: () => void;
46
+ /**
47
+ * Проп для обработки ошибки при превышении максимального размера файла
48
+ */
49
+ onMaxSizeExceeded?: (fileName: string) => void;
50
+ /**
51
+ * Проп для обработки ошибки при загрузке файла неразрешенного типа
52
+ */
53
+ onInvalidFileType?: (fileName: string) => void;
42
54
  };
43
55
  export type TOnChangePhotosUpdate = {
44
56
  type: string;
@@ -1,61 +1,67 @@
1
- import { jsxs as y, jsx as p } from "react/jsx-runtime";
2
- import { c as P } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as R, useState as L, useEffect as N } from "react";
4
- import { ListPhotos as _ } from "../ListPhotos/ListPhotos.js";
5
- import { Uploader as D } from "../Uploader/Uploader.js";
1
+ import { jsxs as R, jsx as p } from "react/jsx-runtime";
2
+ import { c as E } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as I, useState as L, useEffect as M } from "react";
4
+ import { ListPhotos as N } from "../ListPhotos/ListPhotos.js";
5
+ import { Uploader as S } from "../Uploader/Uploader.js";
6
6
  import '../../assets/UploaderPhotos.css';const c = {
7
7
  "upload-file-wrapper": "_upload-file-wrapper_1a115_2"
8
- }, j = R(
9
- (m, f) => {
8
+ }, j = I(
9
+ (n, m) => {
10
10
  const {
11
- filesType: n,
11
+ filesType: f,
12
12
  arrayName: u,
13
- maxSize: h,
13
+ maxSize: x,
14
14
  onChange: e,
15
15
  value: a,
16
16
  maxFiles: l,
17
- titleUploader: x,
18
- name: r,
19
- buttonText: v = "Выберите файлы"
20
- } = m, [o, s] = L(a || []), i = o.length >= l;
21
- N(() => {
17
+ titleUploader: h,
18
+ name: i,
19
+ buttonText: v = "Выберите файлы",
20
+ onMaxFilesExceeded: w,
21
+ onMaxSizeExceeded: y,
22
+ onInvalidFileType: U
23
+ } = n, [o, s] = L(a || []), d = o.length >= l;
24
+ M(() => {
22
25
  a && s(a);
23
26
  }, [a]);
24
- const w = (t) => {
25
- const b = [
27
+ const b = (t) => {
28
+ const P = [
26
29
  ...o,
27
- ...t.value.map((d) => ({
28
- url: URL.createObjectURL(d.file),
29
- id: d.id
30
+ ...t.value.map((r) => ({
31
+ url: URL.createObjectURL(r.file),
32
+ id: r.id
30
33
  }))
31
34
  ];
32
- s(b), e == null || e({ type: "add", data: t.value, name: r });
33
- }, U = (t) => {
34
- s(t.list), t.deleteId && (e == null || e({ type: "delete", data: t.deleteId, name: r }));
35
+ s(P), e == null || e({ type: "add", data: t.value, name: i });
36
+ }, F = (t) => {
37
+ s(t.list), t.deleteId && (e == null || e({ type: "delete", data: t.deleteId, name: i }));
35
38
  };
36
- return /* @__PURE__ */ y(
39
+ return /* @__PURE__ */ R(
37
40
  "div",
38
41
  {
39
- className: P(
42
+ className: E(
40
43
  c["upload-file-wrapper"],
41
- i && c.disabled
44
+ d && c.disabled
42
45
  ),
43
46
  children: [
44
47
  /* @__PURE__ */ p(
45
- D,
48
+ S,
46
49
  {
47
- filesType: n,
50
+ filesType: f,
48
51
  arrayName: u,
49
- maxSize: h,
50
- onChangeValue: w,
51
- ref: f,
52
+ maxSize: x,
53
+ onChangeValue: b,
54
+ ref: m,
52
55
  maxFiles: l,
53
- isDisabled: i,
54
- titleUploader: x,
55
- buttonText: v
56
+ isDisabled: d,
57
+ titleUploader: h,
58
+ buttonText: v,
59
+ onMaxFilesExceeded: w,
60
+ onMaxSizeExceeded: y,
61
+ onInvalidFileType: U
56
62
  }
57
63
  ),
58
- !!o.length && /* @__PURE__ */ p(_, { value: o, onChange: U })
64
+ !!o.length && /* @__PURE__ */ p(N, { value: o, onChange: F })
59
65
  ]
60
66
  }
61
67
  );
@@ -1,6 +1,6 @@
1
1
  import l, { useId as u, useMemo as f } from "react";
2
- import { z as p, U as h, a as v, l as E, f as b, W as $ } from "./label-y3ANLTNC.js";
3
- import { W as H, H as W } from "./keyboard-B0lm_zyn.js";
2
+ import { z as p, U as h, a as v, l as E, f as b, W as $ } from "./label-D4GFpe5F.js";
3
+ import { W as H, H as W } from "./keyboard-mgWkd2Vh.js";
4
4
  let P = "div";
5
5
  function _(a, i) {
6
6
  let d = `headlessui-control-${u()}`, [o, n] = p(), [m, s] = h(), c = v(), { disabled: e = c || !1, ...t } = a, r = f(() => ({ disabled: e }), [e]);
@@ -1,4 +1,4 @@
1
- import { u as N, a as v } from "./keyboard-B0lm_zyn.js";
1
+ import { u as N, a as v } from "./keyboard-mgWkd2Vh.js";
2
2
  let m = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), F = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
3
3
  var h = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(h || {}), x = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(x || {}), A = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(A || {});
4
4
  function y(e = document.body) {
@@ -1,4 +1,4 @@
1
- import { W as t, H as a } from "./keyboard-B0lm_zyn.js";
1
+ import { W as t, H as a } from "./keyboard-mgWkd2Vh.js";
2
2
  let l = "span";
3
3
  var p = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(p || {});
4
4
  function s(e, n) {