mimir-ui-kit 1.38.25 → 1.38.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- ._gos-znak_dm2gm_2{display:inline-flex;align-items:center;width:var(--gos-znak-width);height:var(--gos-znak-height);overflow:hidden;background-color:var(--gos-znak-background-color);border-radius:var(--mimir-control-radius-xs1);outline:1px solid var(--gos-znak-outline-color)}._number_dm2gm_13{font-size:var(--gos-znak-number-font-size)}._number_dm2gm_13,._number-letter_dm2gm_16{font-weight:var(--mimir-font-weight-text-medium);font-family:var(--mimir-font-montserrat);line-height:var(--mimir-line-height-text-xss);letter-spacing:-.02em;text-align:center}._number-letter_dm2gm_16{font-size:var(--gos-znak-number-letter-font-size);text-transform:uppercase}._number-container_dm2gm_27{display:flex;align-items:center;justify-content:center;min-width:var(--gos-znak-number-container-width);height:100%;overflow:hidden;border-right:1px solid var(--number-border-right-color)}._region_dm2gm_37{font-weight:var(--mimir-font-weight-text-regular);font-size:var(--gos-znak-region-text-size);font-family:var(--mimir-font-inter);line-height:var(--mimir-line-height-text-l)}._region-container_dm2gm_43{display:flex;flex-direction:column;align-items:center;width:100%;overflow:hidden}._country_dm2gm_51{color:var(--gos-znak-country-color);font-size:var(--gos-znak-country-text-size);line-height:var(--mimir-line-height-text-s1);text-transform:uppercase}._l_dm2gm_58{--gos-znak-number-font-size: var(--mimir-size-text-xl3);--gos-znak-number-letter-font-size: var(--mimir-size-text-xl2);--gos-znak-region-text-size: var(--mimir-size-text-xl);--gos-znak-country-text-size: var(--mimir-size-text-l);--gos-znak-number-container-width: 172px;--gos-znak-width: 242px;--gos-znak-height: 64px}._s_dm2gm_68{--gos-znak-number-font-size: var(--mimir-size-text-l);--gos-znak-number-letter-font-size: var(--mimir-size-text-s);--gos-znak-region-text-size: var(--mimir-size-text-xs);--gos-znak-country-text-size: var(--mimir-size-text-xs2);--gos-znak-number-container-width: 86px;--gos-znak-width: 121px;--gos-znak-height: 32px}._normal_dm2gm_78{--gos-znak-background-color: var(--white);--gos-znak-outline-color: var(--black-20);--number-border-right-color: var(--black-20);--gos-znak-country-color: var(--black-60)}._traffic_dm2gm_85{--gos-znak-background-color: var(--gos-znak-traffic-background-color);--gos-znak-outline-color: var(--gos-znak-military-background-color);--number-border-right-color: var(--gos-znak-military-background-color);--gos-znak-country-color: var(--black-60)}._military_dm2gm_92{--gos-znak-background-color: var(--gos-znak-military-background-color);--gos-znak-outline-color: var(--black-5);--number-border-right-color: var(--black-5);--gos-znak-country-color: var(--black-30)}._police_dm2gm_99{--gos-znak-background-color: var(--gos-znak-police-background-color);--gos-znak-outline-color: var(--black-5);--number-border-right-color: var(--black-5);--gos-znak-country-color: var(--sapphire-30)}._diplomatic_dm2gm_106{--gos-znak-background-color: var(--gos-znak-diplomatic-background-color);--gos-znak-outline-color: var(--black-5);--number-border-right-color: var(--black-5);--gos-znak-country-color: var(--gos-znak-diplomatic-country-color)}._military_dm2gm_92,._police_dm2gm_99,._diplomatic_dm2gm_106{color:var(--white)}
1
+ ._gos-znak_dr109_2{display:inline-flex;align-items:center;width:var(--gos-znak-width);height:var(--gos-znak-height);overflow:hidden;background-color:var(--gos-znak-background-color);border-radius:var(--mimir-control-radius-xs1);outline:1px solid var(--gos-znak-outline-color)}._number_dr109_13{font-weight:var(--mimir-font-weight-text-medium);font-size:var(--gos-znak-number-font-size);font-family:var(--mimir-font-montserrat);line-height:var(--mimir-line-height-text-xss);letter-spacing:-.02em;text-align:center;text-transform:lowercase}._number-container_dr109_22{display:flex;align-items:center;justify-content:center;min-width:var(--gos-znak-number-container-width);height:100%;overflow:hidden;border-right:1px solid var(--number-border-right-color)}._region_dr109_32{font-weight:var(--mimir-font-weight-text-regular);font-size:var(--gos-znak-region-text-size);font-family:var(--mimir-font-inter);line-height:var(--mimir-line-height-text-l)}._region-container_dr109_38{display:flex;flex-direction:column;align-items:center;width:100%;overflow:hidden}._country_dr109_46{color:var(--gos-znak-country-color);font-size:var(--gos-znak-country-text-size);line-height:var(--mimir-line-height-text-s1);text-transform:uppercase}._l_dr109_53{--gos-znak-number-font-size: var(--mimir-size-text-xl3);--gos-znak-region-text-size: var(--mimir-size-text-xl);--gos-znak-country-text-size: var(--mimir-size-text-l);--gos-znak-number-container-width: 172px;--gos-znak-width: 242px;--gos-znak-height: 64px}._s_dr109_62{--gos-znak-number-font-size: var(--mimir-size-text-l);--gos-znak-region-text-size: var(--mimir-size-text-xs);--gos-znak-country-text-size: var(--mimir-size-text-xs2);--gos-znak-number-container-width: 86px;--gos-znak-width: 121px;--gos-znak-height: 32px}._normal_dr109_71{--gos-znak-background-color: var(--white);--gos-znak-outline-color: var(--black-20);--number-border-right-color: var(--black-20);--gos-znak-country-color: var(--black-60)}._traffic_dr109_78{--gos-znak-background-color: var(--gos-znak-traffic-background-color);--gos-znak-outline-color: var(--gos-znak-military-background-color);--number-border-right-color: var(--gos-znak-military-background-color);--gos-znak-country-color: var(--black-60)}._military_dr109_85{--gos-znak-background-color: var(--gos-znak-military-background-color);--gos-znak-outline-color: var(--black-5);--number-border-right-color: var(--black-5);--gos-znak-country-color: var(--black-30)}._police_dr109_92{--gos-znak-background-color: var(--gos-znak-police-background-color);--gos-znak-outline-color: var(--black-5);--number-border-right-color: var(--black-5);--gos-znak-country-color: var(--sapphire-30)}._diplomatic_dr109_99{--gos-znak-background-color: var(--gos-znak-diplomatic-background-color);--gos-znak-outline-color: var(--black-5);--number-border-right-color: var(--black-5);--gos-znak-country-color: var(--gos-znak-diplomatic-country-color)}._military_dr109_85,._police_dr109_92,._diplomatic_dr109_99{color:var(--white)}
@@ -0,0 +1 @@
1
+ ._container_aj93w_2{display:flex;flex-direction:column;gap:var(--mimir-space-m);padding:var(--mimir-space-4xl) var(--mimir-space-xl);overflow:hidden;border:var(--mimir-control-border-width) dashed var(--black-20);border-radius:var(--mimir-control-radius-s)}._container_aj93w_2._white_aj93w_11{background-color:var(--white)}._container_aj93w_2._gray_aj93w_14{background-color:var(--black-5)}._container_aj93w_2._compact_aj93w_17{padding:var(--mimir-space-xl) var(--mimir-space-m)}
@@ -1,78 +1,63 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import { c as r } from "../../index-DIxK0V-G.js";
3
- import { EGosZnakSize as h, EGosZnakType as N } from "./constants.js";
4
- import { formatGosZnakNumber as y } from "./utils.js";
5
- import '../../assets/GosZnak.css';const k = "_number_dm2gm_13", v = "_region_dm2gm_37", z = "_country_dm2gm_51", G = "_l_dm2gm_58", Z = "_s_dm2gm_68", x = "_normal_dm2gm_78", L = "_traffic_dm2gm_85", j = "_military_dm2gm_92", E = "_police_dm2gm_99", S = "_diplomatic_dm2gm_106", n = {
6
- "gos-znak": "_gos-znak_dm2gm_2",
7
- number: k,
8
- "number-letter": "_number-letter_dm2gm_16",
9
- "number-container": "_number-container_dm2gm_27",
10
- region: v,
11
- "region-container": "_region-container_dm2gm_43",
12
- country: z,
13
- l: G,
14
- s: Z,
15
- normal: x,
16
- traffic: L,
17
- military: j,
18
- police: E,
19
- diplomatic: S
20
- }, B = ({
21
- number: t = "",
22
- region: c,
23
- country: i,
24
- size: s = h.L,
25
- type: a = N.Normal,
26
- className: _,
27
- numberClassName: o,
28
- regionClassName: l,
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { c as n } from "../../index-DIxK0V-G.js";
3
+ import { EGosZnakSize as g, EGosZnakType as f } from "./constants.js";
4
+ import '../../assets/GosZnak.css';const y = "_number_dr109_13", N = "_region_dr109_32", b = "_country_dr109_46", h = "_l_dr109_53", k = "_s_dr109_62", z = "_normal_dr109_71", v = "_traffic_dr109_78", x = "_military_dr109_85", G = "_police_dr109_92", Z = "_diplomatic_dr109_99", r = {
5
+ "gos-znak": "_gos-znak_dr109_2",
6
+ number: y,
7
+ "number-container": "_number-container_dr109_22",
8
+ region: N,
9
+ "region-container": "_region-container_dr109_38",
10
+ country: b,
11
+ l: h,
12
+ s: k,
13
+ normal: z,
14
+ traffic: v,
15
+ military: x,
16
+ police: G,
17
+ diplomatic: Z
18
+ }, S = ({
19
+ number: i,
20
+ region: s,
21
+ country: a,
22
+ size: e = g.L,
23
+ type: _ = f.Normal,
24
+ className: t,
25
+ numberClassName: l,
26
+ regionClassName: m,
29
27
  countryClassName: d,
30
- numberContainerClassName: g,
31
- regionContainerClassName: p
32
- }) => {
33
- const [u, f, b] = y(t);
34
- return /* @__PURE__ */ m(
35
- "div",
36
- {
37
- className: r(n["gos-znak"], n[s], n[a], _),
38
- children: [
39
- /* @__PURE__ */ e(
40
- "div",
41
- {
42
- className: r(
43
- n["number-container"],
44
- g
45
- ),
46
- children: /* @__PURE__ */ m("div", { children: [
47
- /* @__PURE__ */ m("span", { className: r(n["number-letter"], o), children: [
48
- u,
49
- " "
50
- ] }),
51
- /* @__PURE__ */ m("span", { className: r(n.number, o), children: [
52
- f,
53
- " "
54
- ] }),
55
- /* @__PURE__ */ e("span", { className: r(n["number-letter"], o), children: b })
56
- ] })
57
- }
58
- ),
59
- /* @__PURE__ */ m(
60
- "div",
61
- {
62
- className: r(
63
- n["region-container"],
64
- p
65
- ),
66
- children: [
67
- /* @__PURE__ */ e("span", { className: r(n.region, l), children: c }),
68
- /* @__PURE__ */ e("span", { className: r(n.country, d), children: i })
69
- ]
70
- }
71
- )
72
- ]
73
- }
74
- );
75
- };
28
+ numberContainerClassName: p,
29
+ regionContainerClassName: u
30
+ }) => /* @__PURE__ */ c(
31
+ "div",
32
+ {
33
+ className: n(r["gos-znak"], r[e], r[_], t),
34
+ children: [
35
+ /* @__PURE__ */ o(
36
+ "div",
37
+ {
38
+ className: n(
39
+ r["number-container"],
40
+ p
41
+ ),
42
+ children: /* @__PURE__ */ o("span", { className: n(r.number, l), children: i })
43
+ }
44
+ ),
45
+ /* @__PURE__ */ c(
46
+ "div",
47
+ {
48
+ className: n(
49
+ r["region-container"],
50
+ u
51
+ ),
52
+ children: [
53
+ /* @__PURE__ */ o("span", { className: n(r.region, m), children: s }),
54
+ /* @__PURE__ */ o("span", { className: n(r.country, d), children: a })
55
+ ]
56
+ }
57
+ )
58
+ ]
59
+ }
60
+ );
76
61
  export {
77
- B as GosZnak
62
+ S as GosZnak
78
63
  };
@@ -17,6 +17,10 @@ export type TListFiles = {
17
17
  * Вариант отображения файла
18
18
  */
19
19
  variant?: EFileItemVariant | `${EFileItemVariant}`;
20
+ /**
21
+ * Блок удаления файлов
22
+ */
23
+ disabled?: boolean;
20
24
  };
21
25
  export type TFileItem = {
22
26
  id: number;
@@ -33,4 +37,4 @@ export type TFilesDetail = {
33
37
  size?: number;
34
38
  type?: string;
35
39
  };
36
- export declare function ListFiles({ value, onChange, classNameWrapper, variant }: TListFiles): import("react/jsx-runtime").JSX.Element | null;
40
+ export declare function ListFiles({ value, onChange, classNameWrapper, variant, disabled }: TListFiles): import("react/jsx-runtime").JSX.Element | null;
@@ -1,10 +1,10 @@
1
1
  import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
- import { c as _ } from "../../index-DIxK0V-G.js";
3
- import { useState as d, useEffect as u } from "react";
4
- import { EFileItemVariant as w } from "./constants.js";
5
- import { formating as g } from "../../utils/index.js";
6
- import { Button as N } from "../Button/Button.js";
7
- import '../../assets/ListFiles.css';const h = "_white_wnnpg_58", z = "_gray_wnnpg_63", e = {
2
+ import { c as d } from "../../index-DIxK0V-G.js";
3
+ import { useState as u, useEffect as w } from "react";
4
+ import { EFileItemVariant as g } from "./constants.js";
5
+ import { formating as N } from "../../utils/index.js";
6
+ import { Button as h } from "../Button/Button.js";
7
+ import '../../assets/ListFiles.css';const z = "_white_wnnpg_58", y = "_gray_wnnpg_63", e = {
8
8
  "file-info": "_file-info_wnnpg_2",
9
9
  "file-info-size": "_file-info-size_wnnpg_8",
10
10
  "file-info-name-wrapper": "_file-info-name-wrapper_wnnpg_16",
@@ -12,27 +12,28 @@ import '../../assets/ListFiles.css';const h = "_white_wnnpg_58", z = "_gray_wnnp
12
12
  "file-upload-container": "_file-upload-container_wnnpg_34",
13
13
  "file-upload-container-item": "_file-upload-container-item_wnnpg_42",
14
14
  "delete-button": "_delete-button_wnnpg_51",
15
- white: h,
16
- gray: z
15
+ white: z,
16
+ gray: y
17
17
  };
18
- function v({
18
+ function B({
19
19
  value: o,
20
20
  onChange: s,
21
21
  classNameWrapper: f,
22
- variant: c = w.white
22
+ variant: c = g.white,
23
+ disabled: m
23
24
  }) {
24
- const [a, l] = d(o);
25
- u(() => {
25
+ const [a, l] = u(o);
26
+ w(() => {
26
27
  l(o);
27
28
  }, [o]);
28
- const m = async (i) => {
29
- const n = [...a.filter((p) => p.id !== i)];
29
+ const p = async (i) => {
30
+ const n = [...a.filter((_) => _.id !== i)];
30
31
  l(n), s == null || s({ deleteId: i, list: n });
31
32
  };
32
33
  return a.length ? /* @__PURE__ */ t(
33
34
  "ul",
34
35
  {
35
- className: _(
36
+ className: d(
36
37
  e["file-upload-container"],
37
38
  f,
38
39
  e[c]
@@ -41,19 +42,19 @@ function v({
41
42
  /* @__PURE__ */ r("div", { className: e["file-info"], children: [
42
43
  (i == null ? void 0 : i.size) && /* @__PURE__ */ r("span", { className: e["file-info-size"], children: [
43
44
  " ",
44
- g.Size(i == null ? void 0 : i.size)
45
+ N.Size(i == null ? void 0 : i.size)
45
46
  ] }),
46
47
  /* @__PURE__ */ t("div", { className: e["file-info-name-wrapper"], children: /* @__PURE__ */ t("div", { className: e["file-info-name"], children: i.name }) })
47
48
  ] }),
48
- /* @__PURE__ */ t(
49
- N,
49
+ !m && /* @__PURE__ */ t(
50
+ h,
50
51
  {
51
52
  isIconButton: !0,
52
53
  iconName: "Close12px",
53
54
  size: "m-s",
54
55
  variant: "secondary-gray",
55
56
  className: e["delete-button"],
56
- onClick: () => m(i.id)
57
+ onClick: () => p(i.id)
57
58
  }
58
59
  )
59
60
  ] }, n))
@@ -61,5 +62,5 @@ function v({
61
62
  ) : null;
62
63
  }
63
64
  export {
64
- v as ListFiles
65
+ B as ListFiles
65
66
  };
@@ -1,5 +1,5 @@
1
1
  import { jsxs as o, jsx as n, Fragment as B } from "react/jsx-runtime";
2
- import { forwardRef as M, useRef as _, useId as k } from "react";
2
+ import { forwardRef as R, useRef as M, useId as k } from "react";
3
3
  import { Icon as D } from "../../icons/Icon.js";
4
4
  import { Button as G } from "../Button/Button.js";
5
5
  import { EButtonVariantDefault as O } from "../Button/constants.js";
@@ -7,7 +7,7 @@ import '../../assets/Uploader.css';const c = {
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
- }, j = {
10
+ }, y = {
11
11
  jpeg: "image/jpeg",
12
12
  jpg: "image/jpg",
13
13
  png: "image/png",
@@ -31,76 +31,76 @@ import '../../assets/Uploader.css';const c = {
31
31
  ], X = () => {
32
32
  let i = 0;
33
33
  return () => (i = (i + 1) % Number.MAX_SAFE_INTEGER, i);
34
- }, q = X(), W = M(
34
+ }, q = X(), W = R(
35
35
  (i, v) => {
36
36
  const {
37
37
  filesType: l = L,
38
- onChangeValue: I,
39
- arrayName: N,
40
- maxSize: f = 15,
41
- maxFiles: d,
42
- isDisabled: m,
43
- titleUploader: u = "Или перетащите сюда",
44
- buttonText: T = "Выберите файлы",
45
- showOnlyUploadButton: z = !1,
46
- uploadButtonVariant: S = O.SecondaryAsphalt,
47
- buttonSize: C = "m",
48
- buttonClassName: E,
49
- onMaxFilesExceeded: p,
50
- onMaxSizeExceeded: g,
51
- onInvalidFileType: x
52
- } = i, h = _(null), r = _(null), b = k(), F = (e) => {
38
+ onChangeValue: _,
39
+ arrayName: j,
40
+ maxSize: d = 15,
41
+ maxFiles: p,
42
+ isDisabled: f,
43
+ titleUploader: m = "Или перетащите сюда",
44
+ buttonText: I = "Выберите файлы",
45
+ showOnlyUploadButton: N = !1,
46
+ uploadButtonVariant: T = O.SecondaryAsphalt,
47
+ buttonSize: z = "m",
48
+ buttonClassName: S,
49
+ onMaxFilesExceeded: r,
50
+ onMaxSizeExceeded: u,
51
+ onInvalidFileType: g
52
+ } = i, x = M(null), h = k(), C = (e) => {
53
53
  var a;
54
54
  return e.type ? e.type : ((a = e.name.split(".").pop()) == null ? void 0 : a.toLowerCase()) === "heic" ? "image/heic" : "";
55
- }, R = (e) => {
55
+ }, E = (e) => {
56
+ var s;
56
57
  if (e.target.files && e.target.files[0]) {
57
- const s = Array.from(e.target.files);
58
- s.length > d && (p == null || p());
59
- const a = s.filter((t) => {
60
- const V = F(t), w = l.map((A) => j[A]).includes(V), y = t.size / 1024 ** 2 <= f;
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 }), r.current && (r.current.value = "");
58
+ const a = Array.from(e.target.files);
59
+ p && a.length > p && (r == null || r());
60
+ const U = a.filter((t) => {
61
+ const V = C(t), b = l.map((A) => y[A]).includes(V), w = t.size / 1024 ** 2 <= d;
62
+ return !b && g && g(t.name), !w && u && u(t.name), b && w;
63
+ }).slice(0, p).map((t) => ({ file: t, id: q() }));
64
+ _({ arrayName: j, value: U }), (s = e.target) != null && s.value && (e.target.value = "");
64
65
  }
65
- }, U = () => {
66
+ }, F = () => {
66
67
  var e;
67
- (e = h.current) == null || e.click();
68
+ (e = x.current) == null || e.click();
68
69
  };
69
70
  return /* @__PURE__ */ o("div", { className: c["upload-file-wrapper"], ref: v, children: [
70
71
  /* @__PURE__ */ n(
71
72
  "input",
72
73
  {
73
- ref: r,
74
74
  type: "file",
75
75
  className: c["upload-file-input"],
76
76
  "aria-label": "Upload",
77
77
  name: "image[]",
78
78
  multiple: !0,
79
- onChange: R,
79
+ onChange: E,
80
80
  title: "",
81
- id: b,
82
- accept: l.map((e) => j[e]).join(),
83
- disabled: m
81
+ id: h,
82
+ accept: l.map((e) => y[e]).join(),
83
+ disabled: f
84
84
  }
85
85
  ),
86
- /* @__PURE__ */ o("label", { htmlFor: b, ref: h, children: [
86
+ /* @__PURE__ */ o("label", { htmlFor: h, ref: x, children: [
87
87
  /* @__PURE__ */ n(
88
88
  G,
89
89
  {
90
- size: C,
91
- variant: S,
90
+ size: z,
91
+ variant: T,
92
92
  leftIcon: /* @__PURE__ */ n(D, { iconName: "UnionIcon16px" }),
93
- onClick: U,
94
- disabled: m,
95
- className: E,
96
- children: T
93
+ onClick: F,
94
+ disabled: f,
95
+ className: S,
96
+ children: I
97
97
  }
98
98
  ),
99
- !z && /* @__PURE__ */ o(B, { children: [
100
- u && /* @__PURE__ */ n("b", { children: u }),
99
+ !N && /* @__PURE__ */ o(B, { children: [
100
+ m && /* @__PURE__ */ n("b", { children: m }),
101
101
  /* @__PURE__ */ o("span", { className: c["upload-text"], children: [
102
102
  "Максимальный размер одного файла – ",
103
- f,
103
+ d,
104
104
  " Мб",
105
105
  /* @__PURE__ */ n("br", {}),
106
106
  "Загрузить можно файлы следующих форматов: ",
@@ -1,59 +1,3 @@
1
- import { TFilesDetail } from '../ListFiles/ListFiles';
2
- import { imageTypesArr } from '../Uploader/constants';
3
- import { TFileItem } from '../Uploader/Uploader';
1
+ import { TUploaderFiles } from './types';
4
2
 
5
- export type TUploaderFiles = {
6
- /**
7
- * Массив разрешенных типов файлов для настройки валидации
8
- * 'jpeg' | 'jpg' | 'png' | 'tiff' | 'gif' | 'heic' | 'doc' | 'xls' | 'pdf' |'docx' | 'txt'
9
- */
10
- filesType: imageTypesArr[];
11
- /**
12
- * Наименование передаваемого массива файлов
13
- */
14
- arrayName: string;
15
- /**
16
- * Максимальный размер файлов.
17
- */
18
- maxSize: number;
19
- /**
20
- * Функция обратного вызова, передает параметры type и data,
21
- * type 'add' в data передает массив файлов,
22
- * type:'delete' в data передает id удаленного файла
23
- */
24
- onChange: (j: TOnChangeFilesUpdate) => void;
25
- /**
26
- * Передаваемые файлы.
27
- */
28
- value?: TFilesDetail[];
29
- /**
30
- * Максимальное количество файлов.
31
- */
32
- maxFiles: number;
33
- /**
34
- * Текст внутри кнопки загрузки файла
35
- */
36
- buttonText?: string;
37
- /**
38
- * необязательное поле, имя формы загрузчика на случай, если на странице несколько форм
39
- */
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;
53
- };
54
- export type TOnChangeFilesUpdate = {
55
- type: string;
56
- data: TFileItem[] | number;
57
- name?: string;
58
- };
59
3
  export declare const UploaderFiles: import('react').ForwardRefExoticComponent<TUploaderFiles & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,76 +1,92 @@
1
- import { jsxs as N, jsx as f } from "react/jsx-runtime";
2
- import { c as S } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as T, useState as _, 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
- "upload-file-wrapper": "_upload-file-wrapper_1a115_2"
8
- }, q = T(
9
- (u, x) => {
1
+ import { jsxs as Q, jsx as y } from "react/jsx-runtime";
2
+ import { c as R } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as W, useState as L, useEffect as X } from "react";
4
+ import { EUploaderFilesVariant as u } from "./constants.js";
5
+ import { useMediaQuery as k } from "../../hooks/useMediaQuery/useMediaQuery.js";
6
+ import { EMediaQuery as q } from "../../hooks/useMediaQuery/constants.js";
7
+ import { ListFiles as A } from "../ListFiles/ListFiles.js";
8
+ import { EFileItemVariant as x } from "../ListFiles/constants.js";
9
+ import { Uploader as B } from "../Uploader/Uploader.js";
10
+ import '../../assets/UploaderFiles.css';const C = "_container_aj93w_2", G = "_white_aj93w_11", H = "_gray_aj93w_14", J = "_compact_aj93w_17", c = {
11
+ container: C,
12
+ white: G,
13
+ gray: H,
14
+ compact: J
15
+ }, ta = W(
16
+ (F, _) => {
10
17
  const {
11
- filesType: F,
12
- arrayName: y,
13
- maxSize: v,
14
- onChange: a,
15
- value: s,
18
+ compact: w,
19
+ readonly: l,
20
+ filesType: h,
21
+ arrayName: S,
22
+ maxSize: j,
23
+ onChange: i,
24
+ value: t,
16
25
  name: d,
17
- maxFiles: l,
18
- buttonText: w,
19
- onMaxFilesExceeded: z,
20
- onMaxSizeExceeded: b,
21
- onInvalidFileType: h
22
- } = u, [t, o] = _(s || []), r = t.length >= l;
23
- D(() => {
24
- s && o(s);
25
- }, [s]);
26
- const E = (i) => {
27
- const M = [
28
- ...t,
29
- ...i.value.map((e) => {
30
- var p, m, n;
26
+ maxFiles: o,
27
+ buttonText: E,
28
+ variant: n = u.White,
29
+ className: M,
30
+ onMaxFilesExceeded: b,
31
+ onMaxSizeExceeded: g,
32
+ onInvalidFileType: v
33
+ } = F, z = k(q.XSS), [e, r] = L(t || []), N = o && e.length >= o, I = n === u.White ? x.gray : x.white;
34
+ X(() => {
35
+ t && r(t);
36
+ }, [t]);
37
+ const V = (s) => {
38
+ const D = [
39
+ ...e,
40
+ ...s.value.map((a) => {
41
+ var p, m, f;
31
42
  return {
32
- id: e.id,
43
+ id: a.id,
33
44
  url: "",
34
- size: (p = e == null ? void 0 : e.file) == null ? void 0 : p.size,
35
- name: (m = e == null ? void 0 : e.file) == null ? void 0 : m.name,
36
- type: (n = e == null ? void 0 : e.file) == null ? void 0 : n.type
45
+ size: (p = a == null ? void 0 : a.file) == null ? void 0 : p.size,
46
+ name: (m = a == null ? void 0 : a.file) == null ? void 0 : m.name,
47
+ type: (f = a == null ? void 0 : a.file) == null ? void 0 : f.type
37
48
  };
38
49
  })
39
50
  ];
40
- o(M), a == null || a({ type: "add", data: i.value, name: d });
41
- }, I = (i) => {
42
- o(i.list), i.deleteId && (a == null || a({ type: "delete", data: i.deleteId, name: d }));
43
- };
44
- return /* @__PURE__ */ N(
45
- "div",
46
- {
47
- className: S(
48
- c["upload-file-wrapper"],
49
- r && c.disabled
50
- ),
51
- children: [
52
- /* @__PURE__ */ f(
53
- U,
54
- {
55
- filesType: F,
56
- arrayName: y,
57
- maxSize: v,
58
- onChangeValue: E,
59
- ref: x,
60
- maxFiles: l - t.length,
61
- isDisabled: r,
62
- buttonText: w,
63
- onMaxFilesExceeded: z,
64
- onMaxSizeExceeded: b,
65
- onInvalidFileType: h
66
- }
67
- ),
68
- /* @__PURE__ */ f(R, { value: t, onChange: I })
69
- ]
70
- }
71
- );
51
+ r(D), i == null || i({ type: "add", data: s.value, name: d });
52
+ }, T = (s) => {
53
+ r(s.list), s.deleteId && (i == null || i({ type: "delete", data: s.deleteId, name: d }));
54
+ }, U = R([
55
+ c.container,
56
+ c[n],
57
+ w && c.compact,
58
+ M
59
+ ]);
60
+ return /* @__PURE__ */ Q("div", { className: U, children: [
61
+ /* @__PURE__ */ y(
62
+ B,
63
+ {
64
+ filesType: h,
65
+ arrayName: S,
66
+ maxSize: j,
67
+ onChangeValue: V,
68
+ ref: _,
69
+ buttonSize: z ? "s" : "m",
70
+ maxFiles: o && o - e.length,
71
+ isDisabled: N || l,
72
+ buttonText: E,
73
+ onMaxFilesExceeded: b,
74
+ onMaxSizeExceeded: g,
75
+ onInvalidFileType: v
76
+ }
77
+ ),
78
+ /* @__PURE__ */ y(
79
+ A,
80
+ {
81
+ value: e,
82
+ variant: I,
83
+ onChange: T,
84
+ disabled: l
85
+ }
86
+ )
87
+ ] });
72
88
  }
73
89
  );
74
90
  export {
75
- q as UploaderFiles
91
+ ta as UploaderFiles
76
92
  };
@@ -0,0 +1,4 @@
1
+ export declare enum EUploaderFilesVariant {
2
+ Gray = "gray",
3
+ White = "white"
4
+ }
@@ -0,0 +1,4 @@
1
+ var t = /* @__PURE__ */ ((r) => (r.Gray = "gray", r.White = "white", r))(t || {});
2
+ export {
3
+ t as EUploaderFilesVariant
4
+ };
@@ -1,2 +1,3 @@
1
1
  export { UploaderFiles } from './UploaderFiles';
2
- export type { TUploaderFiles, TOnChangeFilesUpdate } from './UploaderFiles';
2
+ export type { TUploaderFiles, TOnChangeFilesUpdate } from './types';
3
+ export { EUploaderFilesVariant } from './constants';
@@ -1,4 +1,6 @@
1
- import { UploaderFiles as r } from "./UploaderFiles.js";
1
+ import { UploaderFiles as o } from "./UploaderFiles.js";
2
+ import { EUploaderFilesVariant as l } from "./constants.js";
2
3
  export {
3
- r as UploaderFiles
4
+ l as EUploaderFilesVariant,
5
+ o as UploaderFiles
4
6
  };