mimir-ui-kit 1.65.6 → 1.66.0

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.
@@ -1,6 +1,7 @@
1
1
  import { ElementType, ReactElement, ReactNode } from 'react';
2
2
  import { ELinkSize, ELinkVariant } from './constants';
3
3
  import { TIconProps } from '../../icons';
4
+ import { TDataTestIdReactMap } from '../../types';
4
5
  import { Props } from '../../types/propsWithAs';
5
6
 
6
7
  type TProps = {
@@ -13,6 +14,7 @@ type TProps = {
13
14
  children?: ReactNode;
14
15
  rel?: string;
15
16
  target?: string;
17
+ dataTestIdReactMap?: TDataTestIdReactMap<'link' | 'leftIcon' | 'rightIcon'>;
16
18
  };
17
19
  type TLinkComponent = <C extends ElementType = 'span'>(props: Props<C, TProps>) => ReactElement | ReactNode;
18
20
  export declare const Link: TLinkComponent;
@@ -1,57 +1,61 @@
1
- import { jsxs as k, jsx as n } from "react/jsx-runtime";
2
- import { c as o } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as x } from "react";
4
- import { ELinkSize as L, ELinkVariant as I } from "./constants.js";
5
- import { Icon as t } from "../../icons/Icon.js";
6
- import '../../assets/Link.css';const g = "_link_1bc9a_2", j = "_sample_1bc9a_20", u = "_anchor_1bc9a_24", z = "_disabled_1bc9a_28", C = "_icon_1bc9a_38", E = "_xs_1bc9a_47", R = "_s_1bc9a_20", v = "_m_1bc9a_59", w = "_l_1bc9a_2", s = {
7
- link: g,
8
- sample: j,
9
- anchor: u,
10
- disabled: z,
11
- icon: C,
12
- xs: E,
13
- s: R,
14
- m: v,
15
- l: w
16
- }, V = x(
17
- (i, e) => {
1
+ import { jsxs as x, jsx as a } from "react/jsx-runtime";
2
+ import { c as i } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as L } from "react";
4
+ import { ELinkSize as g, ELinkVariant as j } from "./constants.js";
5
+ import { Icon as r } from "../../icons/Icon.js";
6
+ import '../../assets/Link.css';const u = "_link_1bc9a_2", z = "_sample_1bc9a_20", C = "_anchor_1bc9a_24", E = "_disabled_1bc9a_28", v = "_icon_1bc9a_38", w = "_xs_1bc9a_47", A = "_s_1bc9a_20", H = "_m_1bc9a_59", O = "_l_1bc9a_2", c = {
7
+ link: u,
8
+ sample: z,
9
+ anchor: C,
10
+ disabled: E,
11
+ icon: v,
12
+ xs: w,
13
+ s: A,
14
+ m: H,
15
+ l: O
16
+ }, B = L(
17
+ (l, t) => {
18
18
  const {
19
- as: l = "button",
20
- disabled: r,
21
- leftIcon: c,
22
- children: _,
23
- rightIcon: a,
24
- className: m,
25
- size: b = L.L,
26
- variant: d = I.ANCHOR,
27
- rel: p,
28
- target: f,
19
+ as: _ = "button",
20
+ disabled: e,
21
+ leftIcon: o,
22
+ children: m,
23
+ rightIcon: n,
24
+ className: b,
25
+ size: d = g.L,
26
+ variant: f = j.ANCHOR,
27
+ rel: h,
28
+ dataTestIdReactMap: s,
29
+ target: k,
29
30
  ...N
30
- } = i, h = o(s.link, m, s[d], s[b], {
31
- [s.disabled]: r
31
+ } = l, p = i(c.link, b, c[f], c[d], {
32
+ [c.disabled]: e
32
33
  });
33
- return /* @__PURE__ */ k(
34
- l,
34
+ return /* @__PURE__ */ x(
35
+ _,
35
36
  {
36
- ref: e,
37
- className: h,
38
- rel: p,
39
- target: f,
37
+ "data-testid-react": s == null ? void 0 : s.link,
38
+ ref: t,
39
+ className: p,
40
+ rel: h,
41
+ target: k,
40
42
  ...N,
41
43
  children: [
42
- c && /* @__PURE__ */ n(
43
- t,
44
+ o && /* @__PURE__ */ a(
45
+ r,
44
46
  {
45
- ...c,
46
- className: o(s.icon, c.className)
47
+ "data-testid-react": s == null ? void 0 : s.leftIcon,
48
+ ...o,
49
+ className: i(c.icon, o.className)
47
50
  }
48
51
  ),
49
- _,
50
- a && /* @__PURE__ */ n(
51
- t,
52
+ m,
53
+ n && /* @__PURE__ */ a(
54
+ r,
52
55
  {
53
- ...a,
54
- className: o(s.icon, a.className)
56
+ "data-testid-react": s == null ? void 0 : s.rightIcon,
57
+ ...n,
58
+ className: i(c.icon, n.className)
55
59
  }
56
60
  )
57
61
  ]
@@ -60,5 +64,5 @@ import '../../assets/Link.css';const g = "_link_1bc9a_2", j = "_sample_1bc9a_20"
60
64
  }
61
65
  );
62
66
  export {
63
- V as Link
67
+ B as Link
64
68
  };
@@ -1,4 +1,5 @@
1
1
  import { EMergedButtonVariantRound } from './constants';
2
+ import { TDataTestIdReactMap } from '../../types';
2
3
  import { TButtonProps, EButtonSize } from '../Button';
3
4
 
4
5
  export type TButtonPropsWithoutStyles = Omit<TButtonProps, 'clear' | 'variant' | 'form' | 'size'> & {
@@ -15,8 +16,12 @@ export type TProps = {
15
16
  * Класс, применяемый к списку карточек (ul).
16
17
  */
17
18
  buttonsWrapperClassName?: string;
19
+ /**
20
+ * Объект, для передачи в компонент и его элементы data-testid-react, для автоматизированного тестирования
21
+ */
22
+ dataTestIdReactMap?: TDataTestIdReactMap<'buttons' | 'btn'>;
18
23
  };
19
24
  /**
20
25
  * Компонент объединенных кнопок, с округлением у первой и последней кнопки, а так же с другими variant, нежели у обычного Button.
21
26
  */
22
- export declare const MergedButton: import('react').MemoExoticComponent<({ buttons, buttonsWrapperClassName }: TProps) => import("react/jsx-runtime").JSX.Element>;
27
+ export declare const MergedButton: import('react').MemoExoticComponent<({ buttons, buttonsWrapperClassName, dataTestIdReactMap }: TProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,59 +1,69 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { c as r } from "../../index-DIxK0V-G.js";
3
- import { memo as l } from "react";
4
- import { EMergedButtonVariantRound as g } from "./constants.js";
5
- import { Button as b } from "../Button/Button.js";
6
- import '../../assets/MergedButton.css';const d = "_buttons_12jbn_2", h = "_gray_12jbn_28", j = "_white_12jbn_36", B = "_transparent_12jbn_44", I = "_asphalt_12jbn_53", f = "_s_12jbn_66", N = "_m_12jbn_6", t = {
7
- buttons: d,
1
+ import { jsx as _ } from "react/jsx-runtime";
2
+ import { c } from "../../index-DIxK0V-G.js";
3
+ import { memo as h } from "react";
4
+ import { EMergedButtonVariantRound as j } from "./constants.js";
5
+ import { Button as B } from "../Button/Button.js";
6
+ import '../../assets/MergedButton.css';const f = "_buttons_12jbn_2", p = "_gray_12jbn_28", N = "_white_12jbn_36", v = "_transparent_12jbn_44", y = "_asphalt_12jbn_53", w = "_s_12jbn_66", a = "_m_12jbn_6", o = {
7
+ buttons: f,
8
8
  "merged-button": "_merged-button_12jbn_6",
9
- gray: h,
10
- white: j,
11
- transparent: B,
12
- asphalt: I,
9
+ gray: p,
10
+ white: N,
11
+ transparent: v,
12
+ asphalt: y,
13
13
  "is-icon": "_is-icon_12jbn_61",
14
- s: f,
15
- m: N,
14
+ s: w,
15
+ m: a,
16
16
  "one-button": "_one-button_12jbn_74"
17
- }, v = l(
18
- ({ buttons: s, buttonsWrapperClassName: c }) => /* @__PURE__ */ e("div", { className: r(t.buttons, c), children: s.map(
19
- ({
20
- variant: a = g.White,
21
- disabled: o,
22
- className: i,
23
- size: _ = "m",
24
- ...n
25
- }, m) => {
26
- const u = {
27
- ...n,
28
- isIconButton: n.isIconButton ?? !1,
29
- iconName: n.isIconButton ? n.iconName : void 0,
30
- leftIcon: n.isIconButton ? void 0 : n.leftIcon,
31
- rightIcon: n.isIconButton ? void 0 : n.rightIcon
32
- }, p = r(
33
- t["merged-button"],
34
- t[_ ?? "m"],
35
- i,
36
- {
37
- [t[a]]: !o,
38
- [t.disabled]: o,
39
- [t["is-icon"]]: n.isIconButton,
40
- [t["one-button"]]: s.length === 1
17
+ }, I = h(
18
+ ({ buttons: r, buttonsWrapperClassName: m, dataTestIdReactMap: t }) => /* @__PURE__ */ _(
19
+ "div",
20
+ {
21
+ "data-testid-react": t == null ? void 0 : t.buttons,
22
+ className: c(o.buttons, m),
23
+ children: r.map(
24
+ ({
25
+ variant: e = j.White,
26
+ disabled: s,
27
+ className: u,
28
+ size: b = "m",
29
+ ...n
30
+ }, i) => {
31
+ const l = {
32
+ ...n,
33
+ isIconButton: n.isIconButton ?? !1,
34
+ iconName: n.isIconButton ? n.iconName : void 0,
35
+ leftIcon: n.isIconButton ? void 0 : n.leftIcon,
36
+ rightIcon: n.isIconButton ? void 0 : n.rightIcon
37
+ }, g = c(
38
+ o["merged-button"],
39
+ o[b ?? "m"],
40
+ u,
41
+ {
42
+ [o[e]]: !s,
43
+ [o.disabled]: s,
44
+ [o["is-icon"]]: n.isIconButton,
45
+ [o["one-button"]]: r.length === 1
46
+ }
47
+ );
48
+ return /* @__PURE__ */ _(
49
+ B,
50
+ {
51
+ clear: !0,
52
+ disabled: s,
53
+ dataTestIdReactMap: {
54
+ button: `${t == null ? void 0 : t.btn}-${i}`
55
+ },
56
+ className: g,
57
+ ...l
58
+ },
59
+ i
60
+ );
41
61
  }
42
- );
43
- return /* @__PURE__ */ e(
44
- b,
45
- {
46
- clear: !0,
47
- disabled: o,
48
- className: p,
49
- ...u
50
- },
51
- m
52
- );
62
+ )
53
63
  }
54
- ) })
64
+ )
55
65
  );
56
- v.displayName = "MergedButton";
66
+ I.displayName = "MergedButton";
57
67
  export {
58
- v as MergedButton
68
+ I as MergedButton
59
69
  };
@@ -1,3 +1,4 @@
1
+ import { TDataTestIdReactMap } from '../../types';
1
2
  import { TInputProps } from '../Input';
2
3
 
3
4
  /**
@@ -20,4 +21,12 @@ export declare const OtpInput: import('react').ForwardRefExoticComponent<Omit<TI
20
21
  * Флаг, показывающий нужно ли отображать разделитель между вводами.
21
22
  */
22
23
  needSeparator?: boolean;
24
+ /**
25
+ * Позиции полей, после которых отображаются разделители.
26
+ */
27
+ separatorPositions?: number[];
28
+ /**
29
+ * Объект, для передачи в компонент и его элементы data-testid-react, для автоматизированного тестирования
30
+ */
31
+ dataTestIdReactMap?: TDataTestIdReactMap<"otp">;
23
32
  } & import('react').RefAttributes<unknown>>;
@@ -1,70 +1,86 @@
1
- import { jsx as r, jsxs as g } from "react/jsx-runtime";
2
- import { c as u } from "../../index-DIxK0V-G.js";
3
- import { forwardRef as P, useImperativeHandle as R, Fragment as T } from "react";
4
- import { ITEMS_PER_SEPARATOR as v, DEFAULT_VALUE_LENGTH as y } from "./constants.js";
5
- import { useOTPInput as z } from "./hooks.js";
6
- import { I as A } from "../../Input-JwHUiwVK.js";
7
- import '../../assets/OtpInput.css';const C = "_otp_1ncuz_2", F = "_input_1ncuz_13", L = "_separator_1ncuz_27", n = {
8
- otp: C,
1
+ import { jsx as p, jsxs as A } from "react/jsx-runtime";
2
+ import { c as i } from "../../index-DIxK0V-G.js";
3
+ import { forwardRef as C, useImperativeHandle as D, Fragment as F } from "react";
4
+ import { DEFAULT_VALUE_LENGTH as L, ITEMS_PER_SEPARATOR as O } from "./constants.js";
5
+ import { useOTPInput as d } from "./hooks.js";
6
+ import { getValidSeparatorPositions as x, getDefaultSeparatorPositions as j } from "./utils.js";
7
+ import { I as H } from "../../Input-JwHUiwVK.js";
8
+ import '../../assets/OtpInput.css';const K = "_otp_1ncuz_2", U = "_input_1ncuz_13", V = "_separator_1ncuz_27", e = {
9
+ otp: K,
9
10
  "input-wrapper": "_input-wrapper_1ncuz_13",
10
- input: F,
11
- separator: L
12
- }, O = P(
11
+ input: U,
12
+ separator: V
13
+ }, G = C(
13
14
  ({
14
- value: c = "",
15
- valueLength: m = y,
16
- needSeparator: l = !0,
17
- onChange: i,
18
- className: _,
19
- ...d
20
- }, f) => {
15
+ value: m = "",
16
+ valueLength: l = L,
17
+ needSeparator: c = !0,
18
+ onChange: _,
19
+ className: f,
20
+ separatorPositions: h,
21
+ dataTestIdReactMap: t,
22
+ ...g
23
+ }, P) => {
21
24
  const {
22
- data: { inputRefs: o, valueItems: p },
23
- handlers: { handleChange: h, handleFocus: I, handleKeyDown: w, handlePaste: N }
24
- } = z({
25
- onChange: i,
26
- value: c,
27
- valueLength: m
25
+ data: { inputRefs: a, valueItems: s },
26
+ handlers: { handleChange: w, handleFocus: N, handleKeyDown: S, handlePaste: E }
27
+ } = d({
28
+ onChange: _,
29
+ value: m,
30
+ valueLength: l
28
31
  });
29
- return R(f, () => ({
32
+ D(P, () => ({
30
33
  focus: () => {
31
- var a;
32
- (a = o.current[0]) == null || a.focus();
34
+ var n;
35
+ (n = a.current[0]) == null || n.focus();
33
36
  }
34
- })), /* @__PURE__ */ r("div", { className: u(n.otp, _), children: p.map((a, e) => {
35
- const s = e + 1, E = l && s % v === 0 && s !== p.length;
36
- return /* @__PURE__ */ g(T, { children: [
37
- /* @__PURE__ */ r(
38
- A,
39
- {
40
- ref: (t) => o.current[e] = t,
41
- type: "text",
42
- inputMode: "numeric",
43
- autoComplete: "one-time-code",
44
- pattern: "\\d{1}",
45
- maxLength: 1,
46
- value: a,
47
- className: n.input,
48
- wrapperClassName: n["input-wrapper"],
49
- onChange: (t) => h(t, e),
50
- onKeyDown: (t) => w(t, e),
51
- onFocus: (t) => I(t, e),
52
- onPaste: N,
53
- ...d
54
- }
55
- ),
56
- E && /* @__PURE__ */ r(
57
- "span",
58
- {
59
- className: u(n.separator),
60
- "data-testid": "separator"
61
- }
62
- )
63
- ] }, e);
64
- }) });
37
+ }));
38
+ const u = x(
39
+ h,
40
+ s.length
41
+ ), v = u.length ? u : j(s.length, O);
42
+ return /* @__PURE__ */ p(
43
+ "div",
44
+ {
45
+ "data-testid-react": t == null ? void 0 : t.otp,
46
+ className: i(e.otp, f),
47
+ children: s.map((n, r) => {
48
+ const y = r + 1, z = c && v.includes(y);
49
+ return /* @__PURE__ */ A(F, { children: [
50
+ /* @__PURE__ */ p(
51
+ H,
52
+ {
53
+ "data-testid-react": `${t == null ? void 0 : t.otp}-idx`,
54
+ ref: (o) => a.current[r] = o,
55
+ type: "text",
56
+ inputMode: "numeric",
57
+ autoComplete: "one-time-code",
58
+ pattern: "\\d{1}",
59
+ maxLength: 1,
60
+ value: n,
61
+ className: e.input,
62
+ wrapperClassName: e["input-wrapper"],
63
+ onChange: (o) => w(o, r),
64
+ onKeyDown: (o) => S(o, r),
65
+ onFocus: (o) => N(o, r),
66
+ onPaste: E,
67
+ ...g
68
+ }
69
+ ),
70
+ z && /* @__PURE__ */ p(
71
+ "span",
72
+ {
73
+ className: i(e.separator),
74
+ "data-testid": "separator"
75
+ }
76
+ )
77
+ ] }, r);
78
+ })
79
+ }
80
+ );
65
81
  }
66
82
  );
67
- O.displayName = "OtpInput";
83
+ G.displayName = "OtpInput";
68
84
  export {
69
- O as OtpInput
85
+ G as OtpInput
70
86
  };
@@ -0,0 +1,2 @@
1
+ export declare const getValidSeparatorPositions: (positions: number[] | undefined, valueLength: number) => number[];
2
+ export declare const getDefaultSeparatorPositions: (valueLength: number, itemsPerSeparator: number) => number[];
@@ -0,0 +1,9 @@
1
+ const f = (e, t) => Array.isArray(e) ? e.filter(
2
+ (r) => typeof r == "number" && Number.isInteger(r) && r > 0 && r < t
3
+ ) : [], l = (e, t) => Array.from({ length: e }, (r, a) => a + 1).filter(
4
+ (r) => r % t === 0 && r !== e
5
+ );
6
+ export {
7
+ l as getDefaultSeparatorPositions,
8
+ f as getValidSeparatorPositions
9
+ };
@@ -1,10 +1,12 @@
1
1
  import { ECounterVariant } from './constants';
2
+ import { TDataTestIdReactMap } from '../../types';
2
3
 
3
4
  export type TBackProps = {
4
5
  currentPageNumber: number;
5
6
  onClick: (nextPage: number) => void;
6
7
  setCurrentPage: (nextPage: number) => void;
7
8
  disabled?: boolean;
9
+ dataTestIdReactMap?: TDataTestIdReactMap<'backButtons' | 'backBtn'>;
8
10
  };
9
11
  export type TNextProps = {
10
12
  currentPageNumber: number;
@@ -12,6 +14,7 @@ export type TNextProps = {
12
14
  onClick: (nextPage: number) => void;
13
15
  setCurrentPage: (nextPage: number) => void;
14
16
  disabled?: boolean;
17
+ dataTestIdReactMap?: TDataTestIdReactMap<'nextButtons' | 'nextBtn'>;
15
18
  };
16
19
  export type TPageData = {
17
20
  date?: string;
@@ -39,6 +42,7 @@ export type TItemProps = {
39
42
  disabled?: boolean;
40
43
  pageData?: TPageData;
41
44
  isDateMode?: boolean;
45
+ dataTestIdReactMap?: TDataTestIdReactMap<'paginationBtn'>;
42
46
  };
43
47
  export type TProps = {
44
48
  /**
@@ -89,5 +93,9 @@ export type TProps = {
89
93
  * Данные для каждой страницы (даты и счетчики)
90
94
  */
91
95
  pagesData?: TPageData[];
96
+ /**
97
+ * Объект, для передачи в компонент и его элементы data-testid-react, для автоматизированного тестирования
98
+ */
99
+ dataTestIdReactMap?: TDataTestIdReactMap<'pagination' | 'backButtons' | 'backBtn' | 'nextButtons' | 'nextBtn' | 'paginationBtn'>;
92
100
  };
93
101
  export declare const Pagination: import('react').ForwardRefExoticComponent<TProps & import('react').RefAttributes<HTMLElement>>;