mimir-ui-kit 1.35.1 → 1.35.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,91 +1,99 @@
1
- import { jsxs as f, jsx as x } from "react/jsx-runtime";
2
- import { c as g } from "../../index-DIxK0V-G.js";
1
+ import { jsxs as N, jsx as l } from "react/jsx-runtime";
2
+ import { c } from "../../index-DIxK0V-G.js";
3
3
  import { forwardRef as B } from "react";
4
- import { EButtonVariantDefault as N, EButtonForm as I } from "./constants.js";
4
+ import { EButtonVariantDefault as I, EButtonForm as k } from "./constants.js";
5
5
  import { Icon as j } from "../../icons/Icon.js";
6
- import '../../assets/Button.css';const D = "_button_1kw2t_2", E = "_clear_1kw2t_42", P = "_black_1kw2t_120", v = "_gray_1kw2t_129", z = "_white_1kw2t_138", C = "_xs_1kw2t_236", F = "_s_1kw2t_72", R = "_m_1kw2t_244", S = "_l_1kw2t_268", V = "_xl_1kw2t_276", q = "_xxl_1kw2t_285", A = "_full_1kw2t_294", G = "_disabled_1kw2t_300", t = {
7
- button: D,
8
- clear: E,
9
- "default-button": "_default-button_1kw2t_54",
10
- "primary-sapphire": "_primary-sapphire_1kw2t_54",
11
- "primary-citrine": "_primary-citrine_1kw2t_63",
12
- "secondary-asphalt": "_secondary-asphalt_1kw2t_72",
13
- "secondary-gray": "_secondary-gray_1kw2t_81",
14
- "secondary-white": "_secondary-white_1kw2t_90",
15
- "secondary-red": "_secondary-red_1kw2t_99",
16
- "round-button": "_round-button_1kw2t_109",
6
+ import '../../assets/Button.css';const C = "_button_1qnsv_2", D = "_clear_1qnsv_42", E = "_count_1qnsv_53", P = "_black_1qnsv_132", z = "_gray_1qnsv_141", F = "_white_1qnsv_150", R = "_xs_1qnsv_250", S = "_s_1qnsv_83", V = "_m_1qnsv_259", A = "_l_1qnsv_283", G = "_xl_1qnsv_291", H = "_xxl_1qnsv_299", J = "_full_1qnsv_314", K = "_disabled_1qnsv_320", s = {
7
+ button: C,
8
+ clear: D,
9
+ count: E,
10
+ "default-button": "_default-button_1qnsv_61",
11
+ "primary-sapphire": "_primary-sapphire_1qnsv_64",
12
+ "primary-citrine": "_primary-citrine_1qnsv_73",
13
+ "secondary-asphalt": "_secondary-asphalt_1qnsv_83",
14
+ "secondary-gray": "_secondary-gray_1qnsv_92",
15
+ "secondary-white": "_secondary-white_1qnsv_101",
16
+ "secondary-red": "_secondary-red_1qnsv_110",
17
+ "round-button": "_round-button_1qnsv_120",
17
18
  black: P,
18
- gray: v,
19
- white: z,
20
- "outline-button": "_outline-button_1kw2t_148",
21
- "outline-asphalt": "_outline-asphalt_1kw2t_155",
22
- "outline-gray": "_outline-gray_1kw2t_163",
23
- "outline-white": "_outline-white_1kw2t_172",
24
- "outline-red": "_outline-red_1kw2t_181",
25
- "borderless-button": "_borderless-button_1kw2t_191",
26
- "borderless-asphalt": "_borderless-asphalt_1kw2t_197",
27
- "borderless-gray": "_borderless-gray_1kw2t_202",
28
- "borderless-white": "_borderless-white_1kw2t_207",
29
- "borderless-red": "_borderless-red_1kw2t_212",
30
- xs: C,
31
- "m-s": "_m-s_1kw2t_244",
32
- s: F,
33
- m: R,
34
- l: S,
35
- xl: V,
36
- xxl: q,
37
- full: A,
38
- disabled: G,
39
- "icon-button": "_icon-button_1kw2t_320"
40
- }, H = B(
41
- (e, s) => {
19
+ gray: z,
20
+ white: F,
21
+ "outline-button": "_outline-button_1qnsv_160",
22
+ "outline-asphalt": "_outline-asphalt_1qnsv_168",
23
+ "outline-gray": "_outline-gray_1qnsv_176",
24
+ "outline-white": "_outline-white_1qnsv_185",
25
+ "outline-red": "_outline-red_1qnsv_194",
26
+ "borderless-button": "_borderless-button_1qnsv_204",
27
+ "borderless-asphalt": "_borderless-asphalt_1qnsv_211",
28
+ "borderless-gray": "_borderless-gray_1qnsv_216",
29
+ "borderless-white": "_borderless-white_1qnsv_221",
30
+ "borderless-red": "_borderless-red_1qnsv_226",
31
+ xs: R,
32
+ "m-s": "_m-s_1qnsv_259",
33
+ s: S,
34
+ m: V,
35
+ l: A,
36
+ xl: G,
37
+ xxl: H,
38
+ full: J,
39
+ disabled: K,
40
+ "icon-button": "_icon-button_1qnsv_341"
41
+ }, L = B(
42
+ (i, u) => {
42
43
  const {
43
- size: n = "m",
44
- variant: a = N.PrimarySapphire,
45
- form: l = I.DefaultButton,
46
- full: i,
47
- clear: o,
44
+ size: o = "m",
45
+ variant: d = I.PrimarySapphire,
46
+ form: _ = k.DefaultButton,
47
+ full: b,
48
+ clear: n,
48
49
  isIconButton: r = !1,
49
- iconName: c,
50
- children: u,
51
- className: d,
52
- formId: w,
53
- type: b = "button",
54
- rightIcon: k,
55
- leftIcon: m,
56
- disabled: _,
57
- ...p
58
- } = e, y = {
59
- [t.full]: i && !o,
60
- [t.disabled]: _ && !o,
61
- [t.clear]: o,
62
- [t[a ?? ""]]: !_ || o,
63
- [t["icon-button"]]: r
64
- }, h = g(
65
- d,
66
- t.button,
67
- y,
68
- o ? [] : [t[l ?? ""], t[n]]
50
+ iconName: v,
51
+ children: m,
52
+ className: q,
53
+ formId: p,
54
+ type: y = "button",
55
+ rightIcon: h,
56
+ count: e,
57
+ leftIcon: f,
58
+ disabled: t,
59
+ ...x
60
+ } = i, a = {
61
+ [s.full]: b && !n,
62
+ [s.disabled]: t && !n,
63
+ [s.clear]: n,
64
+ [s[d ?? ""]]: !t || n,
65
+ [s["icon-button"]]: r
66
+ }, g = c(
67
+ q,
68
+ s.button,
69
+ a,
70
+ n ? [] : [s[_ ?? ""], s[o]]
71
+ ), w = c(
72
+ s.count,
73
+ a,
74
+ s[o],
75
+ s[_ ?? ""]
69
76
  );
70
- return /* @__PURE__ */ f(
77
+ return /* @__PURE__ */ N(
71
78
  "button",
72
79
  {
73
- type: b,
74
- form: w,
75
- ...p,
76
- disabled: _,
77
- ref: s,
78
- className: h,
80
+ type: y,
81
+ form: p,
82
+ ...x,
83
+ disabled: t,
84
+ ref: u,
85
+ className: g,
79
86
  children: [
80
- m,
81
- r ? /* @__PURE__ */ x(j, { iconName: c }) : u,
82
- k
87
+ f,
88
+ r ? /* @__PURE__ */ l(j, { iconName: v }) : m,
89
+ h,
90
+ !!e && /* @__PURE__ */ l("span", { className: w, children: e })
83
91
  ]
84
92
  }
85
93
  );
86
94
  }
87
95
  );
88
- H.displayName = "Button";
96
+ L.displayName = "Button";
89
97
  export {
90
- H as Button
98
+ L as Button
91
99
  };
@@ -1,6 +1,6 @@
1
1
  import { TInputProps } from '../Input';
2
2
 
3
- export type DatePicker = {
3
+ export type TProps = {
4
4
  /**
5
5
  * Функция обратного вызова при изменении значения даты
6
6
  */
@@ -1,140 +1,123 @@
1
- import { jsxs as K, jsx as N } from "react/jsx-runtime";
2
- import { c as I } from "../../index-DIxK0V-G.js";
3
- import { memo as Q, forwardRef as W, useState as D, useEffect as T } from "react";
4
- import { DatePickerModal as Z } from "./DatePickerModal.js";
5
- import { MonthPickerModal as b } from "./MonthPickerModal.js";
6
- import { c as r } from "../../styles.module-BQZZ6FB1.js";
7
- import { formatDatePart as h } from "./utils.js";
8
- import { YearPickerModal as C } from "./YearPickerModal.js";
9
- import { useClickOutside as E } from "../../hooks/useClickOutside/useClickOutside.js";
10
- import { formating as B } from "../../utils/index.js";
11
- import { I as V } from "../../Input-B-gKQ9FT.js";
12
- import { EInputStatus as tt } from "../Input/constants.js";
13
- const st = 31, et = 12, it = 10, at = Q(
1
+ import { jsxs as J, jsx as I } from "react/jsx-runtime";
2
+ import { c as g } from "../../index-DIxK0V-G.js";
3
+ import { memo as Q, forwardRef as W, useState as d, useEffect as N } from "react";
4
+ import { MAX_DAY as Z, MAX_MONTH as E, DATE_LENGTH as B } from "./constants.js";
5
+ import { DatePickerModal as V } from "./DatePickerModal.js";
6
+ import { MonthPickerModal as tt } from "./MonthPickerModal.js";
7
+ import { c as a } from "../../styles.module-Chnn6DA-.js";
8
+ import { formatDatePart as j } from "./utils.js";
9
+ import { YearPickerModal as st } from "./YearPickerModal.js";
10
+ import { useClickOutside as et } from "../../hooks/useClickOutside/useClickOutside.js";
11
+ import { formating as it } from "../../utils/index.js";
12
+ import { I as at } from "../../Input-B-gKQ9FT.js";
13
+ import { EInputStatus as rt } from "../Input/constants.js";
14
+ const ot = {
15
+ days: V,
16
+ months: tt,
17
+ years: st
18
+ }, ct = Q(
14
19
  W(
15
20
  ({
16
- size: H,
17
- value: e,
18
- onChangeValue: i,
19
- name: p,
20
- before: a,
21
- type: m = "days",
22
- error: A,
23
- onError: f,
24
- onBlur: n,
25
- validateImmediately: P,
26
- variant: X,
27
- disabled: u = !1,
21
+ size: Y,
22
+ value: s,
23
+ onChangeValue: e,
24
+ name: r,
25
+ before: D,
26
+ type: o = "days",
27
+ error: y,
28
+ onError: c,
29
+ onBlur: m,
30
+ validateImmediately: v,
31
+ variant: $,
32
+ disabled: x = !1,
28
33
  editable: S = !1,
29
- ...G
34
+ ...H
30
35
  }, L) => {
31
- const [d, c] = D(!1), [w, o] = D(m), [t, l] = D(
32
- e && !isNaN(new Date(e).getTime()) ? new Date(e) : void 0
33
- ), [g, k] = D(A), [R, v] = D("");
34
- T(() => {
35
- k(A);
36
- }, [A]), T(() => {
36
+ const [n, f] = d(!1), [T, p] = d(o), [i, l] = d(
37
+ () => s && !isNaN(new Date(s).getTime()) ? new Date(s) : void 0
38
+ ), [A, k] = d(y), [R, M] = d("");
39
+ N(() => {
40
+ k(y);
41
+ }, [y]), N(() => {
37
42
  l(
38
- e && !isNaN(new Date(e).getTime()) ? new Date(e) : void 0
43
+ s && !isNaN(new Date(s).getTime()) ? new Date(s) : void 0
39
44
  );
40
- }, [e]), T(() => {
41
- t && typeof t != "string" && !isNaN(t == null ? void 0 : t.getTime()) ? v(B.Date(t, "dd/mm/yyyy")) : v("");
42
- }, [t]);
43
- const j = e && new Date(e).getTime;
44
- T(() => {
45
- P && (j ? (k(!1), f == null || f({ name: p, active: !1 })) : (k(!0), f == null || f({ name: p, active: !0 })));
46
- }, [P, p, j]), E({
47
- isActive: d,
48
- setActive: (s) => {
49
- c(s), o(m);
45
+ }, [s]), N(() => {
46
+ i && typeof i != "string" && !isNaN(i == null ? void 0 : i.getTime()) ? M(it.Date(i, "dd/mm/yyyy")) : M("");
47
+ }, [i]);
48
+ const _ = s && new Date(s).getTime;
49
+ N(() => {
50
+ v && (_ ? (k(!1), c == null || c({ name: r, active: !1 })) : (k(!0), c == null || c({ name: r, active: !0 })));
51
+ }, [v, r, _]), et({
52
+ isActive: n,
53
+ setActive: (t) => {
54
+ f(t), p(o);
50
55
  },
51
- className: r["calendar-block"]
56
+ className: a["calendar-block"]
52
57
  });
53
- const U = () => {
54
- u || c(!0);
55
- }, M = (s) => {
56
- isNaN(s.getTime()) || (l(s), i == null || i({ value: s, name: p })), w === "years" && (m === "years" ? (c(!1), o(m)) : o("months")), w === "months" && (m === "months" ? (c(!1), o(m)) : o("days")), l(s), i == null || i({ value: s, name: p }), n == null || n(s);
57
- }, q = (s) => {
58
+ const X = () => {
59
+ x || f(!0);
60
+ }, G = (t) => {
61
+ isNaN(t.getTime()) || (l(t), e == null || e({ value: t, name: r })), T === "years" && (o === "years" ? (f(!1), p(o)) : p("months")), T === "months" && (o === "months" ? (f(!1), p(o)) : p("days")), l(t), e == null || e({ value: t, name: r }), m == null || m(t);
62
+ }, K = (t) => {
58
63
  if (S) {
59
- const x = s.target.value.replace(/[^\d]/g, ""), [O, Y, _] = [
60
- h(x.substring(0, 2), st),
61
- h(x.substring(2, 4), et),
62
- x.substring(4, 8)
63
- ], $ = [O, Y, _].filter(Boolean).join("/");
64
- if (v($), $.length === it) {
65
- const J = parseInt(_), y = /* @__PURE__ */ new Date(
66
- `${J}-${Y.padStart(2, "0")}-${O.padStart(2, "0")}`
64
+ const P = t.target.value.replace(/[^\d]/g, ""), [b, h, u] = [
65
+ j(P.substring(0, 2), Z),
66
+ j(P.substring(2, 4), E),
67
+ P.substring(4, 8)
68
+ ], O = [b, h, u].filter(Boolean).join("/");
69
+ if (M(O), O.length === B) {
70
+ const F = parseInt(u), w = /* @__PURE__ */ new Date(
71
+ `${F}-${h.padStart(2, "0")}-${b.padStart(2, "0")}`
67
72
  );
68
- isNaN(y.getTime()) || (l(y), i == null || i({ value: y, name: p }), n == null || n(y));
73
+ isNaN(w.getTime()) || (l(w), e == null || e({ value: w, name: r }), m == null || m(w));
69
74
  }
70
75
  }
71
- }, z = I(r.wrapper, d && r.active), F = I(r.input, r.inputBorderControl);
72
- return /* @__PURE__ */ K("div", { className: z, "data-disabled": u, children: [
73
- /* @__PURE__ */ N(
76
+ }, U = g(a.wrapper, n && a.active), q = g(a.input, a.inputBorderControl), z = {
77
+ onChangeValue: G,
78
+ date: i || /* @__PURE__ */ new Date(),
79
+ before: typeof D == "string" ? new Date(D) : D,
80
+ onChangeType: p,
81
+ setIsActive: f
82
+ }, C = ot[T];
83
+ return /* @__PURE__ */ J("div", { className: U, "data-disabled": x, children: [
84
+ /* @__PURE__ */ I(
74
85
  "div",
75
86
  {
76
- "data-error": g,
77
- className: I(r["date-wrapper"], {
78
- [r.editable]: S
87
+ role: "button",
88
+ "data-error": A,
89
+ className: g(a["date-wrapper"], {
90
+ [a.editable]: S
79
91
  }),
80
- onClick: U,
81
- children: /* @__PURE__ */ N(
82
- V,
92
+ onClick: X,
93
+ children: /* @__PURE__ */ I(
94
+ at,
83
95
  {
84
96
  ref: L,
85
- className: F,
86
- wrapperClassName: r["input-wrapper"],
87
- size: H,
97
+ className: q,
98
+ wrapperClassName: a["input-wrapper"],
99
+ size: Y,
88
100
  type: "text",
89
- variant: X,
90
- status: g ? tt.Error : void 0,
101
+ variant: $,
102
+ status: A ? rt.Error : void 0,
91
103
  value: R,
92
- onChange: q,
104
+ onChange: K,
93
105
  rightAddon: {
94
106
  addonType: "icon",
95
- addonContent: d ? "DropdownArrowUp24px" : "DropdownArrowDown24px"
107
+ addonContent: n ? "DropdownArrowUp24px" : "DropdownArrowDown24px"
96
108
  },
97
- "data-error": g,
98
- ...G
109
+ "data-error": A,
110
+ ...H
99
111
  }
100
112
  )
101
113
  }
102
114
  ),
103
- w === "days" && d && /* @__PURE__ */ N(
104
- Z,
105
- {
106
- onChangeValue: M,
107
- date: t || /* @__PURE__ */ new Date(),
108
- setActive: c,
109
- before: typeof a == "string" ? new Date(a) : a,
110
- onType: o
111
- }
112
- ),
113
- w === "months" && d && /* @__PURE__ */ N(
114
- b,
115
- {
116
- onChangeValue: M,
117
- date: t || /* @__PURE__ */ new Date(),
118
- setActive: c,
119
- before: typeof a == "string" ? new Date(a) : a,
120
- onType: o
121
- }
122
- ),
123
- w === "years" && d && /* @__PURE__ */ N(
124
- C,
125
- {
126
- onChangeValue: M,
127
- date: t || /* @__PURE__ */ new Date(),
128
- setActive: c,
129
- before: typeof a == "string" ? new Date(a) : a,
130
- onType: o
131
- }
132
- )
115
+ n && /* @__PURE__ */ I(C, { ...z })
133
116
  ] });
134
117
  }
135
118
  )
136
119
  );
137
- at.displayName = "DatePicker";
120
+ ct.displayName = "DatePicker";
138
121
  export {
139
- at as DatePicker
122
+ ct as DatePicker
140
123
  };
@@ -1,9 +1,9 @@
1
- type DatePickerModal = {
1
+ type TProps = {
2
2
  date: Date;
3
- onChangeValue: (d: Date) => void;
4
- setActive: (s: boolean) => void;
5
3
  before?: Date;
6
- onType?: (s: 'days' | 'months' | 'years') => void;
4
+ onChangeValue: (date: Date) => void;
5
+ setIsActive: (isActive: boolean) => void;
6
+ onChangeType?: (s: 'days' | 'months' | 'years') => void;
7
7
  };
8
- export declare function DatePickerModal({ date, onChangeValue, setActive, before, onType }: DatePickerModal): import("react/jsx-runtime").JSX.Element;
8
+ export declare const DatePickerModal: ({ date, onChangeValue, setIsActive, before, onChangeType }: TProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};