mimir-ui-kit 1.65.7 → 1.66.1
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.
- package/dist/ProgressBar-BtLMbQrP.js +67 -0
- package/dist/assets/ProgressBar.css +1 -1
- package/dist/components/AnchorLink/Link.d.ts +2 -0
- package/dist/components/AnchorLink/Link.js +49 -45
- package/dist/components/MergedButton/MergedButton.d.ts +6 -1
- package/dist/components/MergedButton/MergedButton.js +61 -51
- package/dist/components/OtpInput/OtpInput.d.ts +5 -0
- package/dist/components/OtpInput/OtpInput.js +75 -66
- package/dist/components/Pagination/Pagination.d.ts +8 -0
- package/dist/components/Pagination/Pagination.js +209 -176
- package/dist/components/Timer/Timer.d.ts +7 -1
- package/dist/components/Timer/Timer.js +31 -18
- package/dist/components/Toasts/ProgressBar.js +1 -1
- package/dist/components/Toasts/Toast.js +37 -37
- package/dist/components/Toasts/ToastList.js +1 -1
- package/dist/components/Toasts/ToastsProvider.js +1 -1
- package/package.json +1 -1
- package/dist/ProgressBar-F970LqqJ.js +0 -68
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { c as u } from "./index-DIxK0V-G.js";
|
|
3
|
+
import { memo as q, useRef as e, useEffect as f } from "react";
|
|
4
|
+
import { DEFAULT_TOAST_DURATION as g, EToastVariant as b } from "./components/Toasts/constants.js";
|
|
5
|
+
import './assets/ProgressBar.css';const d = "_title_lqoti_37", A = "_timer_lqoti_41", T = "_seconds_lqoti_51", h = "_message_lqoti_61", w = "_progress_lqoti_69", D = "_success_lqoti_100", F = "_alarm_lqoti_105", R = "_error_lqoti_110", E = "_purple_lqoti_115", s = {
|
|
6
|
+
"toast-list": "_toast-list_lqoti_2",
|
|
7
|
+
"toast-wrapper": "_toast-wrapper_lqoti_24",
|
|
8
|
+
title: d,
|
|
9
|
+
timer: A,
|
|
10
|
+
"timer-title": "_timer-title_lqoti_49",
|
|
11
|
+
seconds: T,
|
|
12
|
+
message: h,
|
|
13
|
+
progress: w,
|
|
14
|
+
"progress-bar": "_progress-bar_lqoti_78",
|
|
15
|
+
"close-button": "_close-button_lqoti_89",
|
|
16
|
+
default: "_default_lqoti_95",
|
|
17
|
+
success: D,
|
|
18
|
+
alarm: F,
|
|
19
|
+
error: R,
|
|
20
|
+
purple: E,
|
|
21
|
+
"top-right": "_top-right_lqoti_120",
|
|
22
|
+
"top-center": "_top-center_lqoti_126",
|
|
23
|
+
"top-left": "_top-left_lqoti_132",
|
|
24
|
+
"bottom-left": "_bottom-left_lqoti_137",
|
|
25
|
+
"bottom-center": "_bottom-center_lqoti_142",
|
|
26
|
+
"bottom-right": "_bottom-right_lqoti_148",
|
|
27
|
+
"toast-in": "_toast-in_lqoti_180",
|
|
28
|
+
"toast-out": "_toast-out_lqoti_184"
|
|
29
|
+
}, L = q(
|
|
30
|
+
({
|
|
31
|
+
duration: _ = g,
|
|
32
|
+
variant: m = b.DEFAULT,
|
|
33
|
+
isPaused: i = !1
|
|
34
|
+
}) => {
|
|
35
|
+
const t = e(), o = e(null), n = e(Date.now()), r = e(0);
|
|
36
|
+
return f(() => {
|
|
37
|
+
if (i)
|
|
38
|
+
t.current && cancelAnimationFrame(t.current);
|
|
39
|
+
else {
|
|
40
|
+
n.current = Date.now() - r.current;
|
|
41
|
+
const c = () => {
|
|
42
|
+
const p = Date.now();
|
|
43
|
+
r.current = p - n.current;
|
|
44
|
+
const a = Math.min(
|
|
45
|
+
r.current / _ * 100,
|
|
46
|
+
100
|
|
47
|
+
);
|
|
48
|
+
o.current && (o.current.style.width = `${a}%`), a < 100 && (t.current = requestAnimationFrame(c));
|
|
49
|
+
};
|
|
50
|
+
t.current = requestAnimationFrame(c);
|
|
51
|
+
}
|
|
52
|
+
return () => {
|
|
53
|
+
t.current && cancelAnimationFrame(t.current);
|
|
54
|
+
};
|
|
55
|
+
}, [_, i]), /* @__PURE__ */ l("div", { className: s.progress, "data-testid": "progress-bar", children: /* @__PURE__ */ l(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
ref: o,
|
|
59
|
+
className: u(s["progress-bar"], s[m])
|
|
60
|
+
}
|
|
61
|
+
) });
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
export {
|
|
65
|
+
L as P,
|
|
66
|
+
s as c
|
|
67
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._toast-
|
|
1
|
+
._toast-list_lqoti_2{position:fixed;z-index:var(--mimir-zindex-toasts-list);width:100vw;max-width:515px;max-height:100vh;padding:var(--mimir-space-m);overflow-x:hidden;overflow-y:auto;overflow:hidden auto}._toast-list_lqoti_2::-webkit-scrollbar{display:none}._toast-list_lqoti_2::-webkit-scrollbar-track{background-color:transparent}._toast-list_lqoti_2::-webkit-scrollbar-thumb{background-color:transparent}._toast-list_lqoti_2::-webkit-scrollbar-thumb:window-inactive{background-color:transparent}._toast-wrapper_lqoti_24{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:var(--mimir-space-m);background-color:var(--toast-bg-color);border-radius:var(--mimir-control-radius);-webkit-transition:all .3s ease;transition:all .3s ease}._toast-wrapper_lqoti_24:not(:last-child){margin-bottom:var(--mimir-space-s)}._title_lqoti_37:not(:last-child){margin-bottom:var(--mimir-space-xs)}._timer_lqoti_41{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}._timer_lqoti_41:not(:last-child){margin-bottom:var(--mimir-space-2xs)}._timer-title_lqoti_49,._title_lqoti_37,._seconds_lqoti_51{color:var(--black-60);font-size:var(--mimir-size-text-m);line-height:var(--mimir-line-height-text-xxs)}._seconds_lqoti_51{color:var(--black-100)}._message_lqoti_61{font-size:var(--mimir-size-text-l);line-height:var(--mimir-line-height-text-s1)}._message_lqoti_61:not(:last-child){margin-bottom:var(--mimir-space-xs)}._progress_lqoti_69{position:relative;width:100%;height:8px;overflow:hidden;background-color:var(--black-5);border-radius:var(--mimir-control-radius-xs)}._progress-bar_lqoti_78{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;background-color:var(--progress-bg-color);border-radius:var(--mimir-control-radius-xs)}._close-button_lqoti_89{position:absolute;top:var(--mimir-space-s);right:var(--mimir-space-s)}._default_lqoti_95{--toast-bg-color: var(--white);--progress-bg-color: var(--sapphire-100)}._success_lqoti_100{--toast-bg-color: var(--success-bg-active);--progress-bg-color: var(--success-normal)}._alarm_lqoti_105{--toast-bg-color: var(--alarm-bg-active);--progress-bg-color: var(--alarm-normal)}._error_lqoti_110{--toast-bg-color: var(--error-bg-active);--progress-bg-color: var(--error-normal)}._purple_lqoti_115{--toast-bg-color: var(--purple-bg-active);--progress-bg-color: var(--purple-normal)}._top-right_lqoti_120{top:0;right:0;-webkit-transition:all .3s ease;transition:all .3s ease}._top-center_lqoti_126{top:0;right:50%;-webkit-transform:translateX(50%);transform:translate(50%)}._top-left_lqoti_132{top:0;left:0}._bottom-left_lqoti_137{bottom:0;left:0}._bottom-center_lqoti_142{right:50%;bottom:0;-webkit-transform:translateX(50%);transform:translate(50%)}._bottom-right_lqoti_148{right:0;bottom:0}@-webkit-keyframes _toast-in_lqoti_180{0%{-webkit-transform:var(--elm-translate);transform:var(--elm-translate);opacity:.7}80%{-webkit-transform:translate(0);transform:translate(0);opacity:.7}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes _toast-in_lqoti_180{0%{-webkit-transform:var(--elm-translate);transform:var(--elm-translate);opacity:.7}80%{-webkit-transform:translate(0);transform:translate(0);opacity:.7}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@-webkit-keyframes _toast-out_lqoti_184{0%{opacity:1}20%{-webkit-transform:translate(0);transform:translate(0);opacity:.7}to{-webkit-transform:var(--elm-translate);transform:var(--elm-translate);opacity:.7}}@keyframes _toast-out_lqoti_184{0%{opacity:1}20%{-webkit-transform:translate(0);transform:translate(0);opacity:.7}to{-webkit-transform:var(--elm-translate);transform:var(--elm-translate);opacity:.7}}._toast-in_lqoti_180{-webkit-animation:_toast-in_lqoti_180 .3s both;animation:_toast-in_lqoti_180 .3s both}._toast-out_lqoti_184{-webkit-animation:_toast-out_lqoti_184 .8s both;animation:_toast-out_lqoti_184 .8s both}
|
|
@@ -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
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { ELinkSize as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import '../../assets/Link.css';const
|
|
7
|
-
link:
|
|
8
|
-
sample:
|
|
9
|
-
anchor:
|
|
10
|
-
disabled:
|
|
11
|
-
icon:
|
|
12
|
-
xs:
|
|
13
|
-
s:
|
|
14
|
-
m:
|
|
15
|
-
l:
|
|
16
|
-
},
|
|
17
|
-
(
|
|
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:
|
|
20
|
-
disabled:
|
|
21
|
-
leftIcon:
|
|
22
|
-
children:
|
|
23
|
-
rightIcon:
|
|
24
|
-
className:
|
|
25
|
-
size:
|
|
26
|
-
variant:
|
|
27
|
-
rel:
|
|
28
|
-
|
|
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
|
-
} =
|
|
31
|
-
[
|
|
31
|
+
} = l, p = i(c.link, b, c[f], c[d], {
|
|
32
|
+
[c.disabled]: e
|
|
32
33
|
});
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
34
|
+
return /* @__PURE__ */ x(
|
|
35
|
+
_,
|
|
35
36
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
+
o && /* @__PURE__ */ a(
|
|
45
|
+
r,
|
|
44
46
|
{
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
+
m,
|
|
53
|
+
n && /* @__PURE__ */ a(
|
|
54
|
+
r,
|
|
52
55
|
{
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
import { c
|
|
3
|
-
import { memo as
|
|
4
|
-
import { EMergedButtonVariantRound as
|
|
5
|
-
import { Button as
|
|
6
|
-
import '../../assets/MergedButton.css';const
|
|
7
|
-
buttons:
|
|
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:
|
|
10
|
-
white:
|
|
11
|
-
transparent:
|
|
12
|
-
asphalt:
|
|
9
|
+
gray: p,
|
|
10
|
+
white: N,
|
|
11
|
+
transparent: v,
|
|
12
|
+
asphalt: y,
|
|
13
13
|
"is-icon": "_is-icon_12jbn_61",
|
|
14
|
-
s:
|
|
15
|
-
m:
|
|
14
|
+
s: w,
|
|
15
|
+
m: a,
|
|
16
16
|
"one-button": "_one-button_12jbn_74"
|
|
17
|
-
},
|
|
18
|
-
({ buttons:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
className:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
66
|
+
I.displayName = "MergedButton";
|
|
57
67
|
export {
|
|
58
|
-
|
|
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
|
/**
|
|
@@ -24,4 +25,8 @@ export declare const OtpInput: import('react').ForwardRefExoticComponent<Omit<TI
|
|
|
24
25
|
* Позиции полей, после которых отображаются разделители.
|
|
25
26
|
*/
|
|
26
27
|
separatorPositions?: number[];
|
|
28
|
+
/**
|
|
29
|
+
* Объект, для передачи в компонент и его элементы data-testid-react, для автоматизированного тестирования
|
|
30
|
+
*/
|
|
31
|
+
dataTestIdReactMap?: TDataTestIdReactMap<"otp">;
|
|
27
32
|
} & import('react').RefAttributes<unknown>>;
|
|
@@ -1,77 +1,86 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { DEFAULT_VALUE_LENGTH as
|
|
5
|
-
import { useOTPInput as
|
|
6
|
-
import { getValidSeparatorPositions as
|
|
7
|
-
import { I as
|
|
8
|
-
import '../../assets/OtpInput.css';const
|
|
9
|
-
otp:
|
|
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,
|
|
10
10
|
"input-wrapper": "_input-wrapper_1ncuz_13",
|
|
11
|
-
input:
|
|
12
|
-
separator:
|
|
13
|
-
},
|
|
11
|
+
input: U,
|
|
12
|
+
separator: V
|
|
13
|
+
}, G = C(
|
|
14
14
|
({
|
|
15
|
-
value:
|
|
16
|
-
valueLength:
|
|
17
|
-
needSeparator:
|
|
18
|
-
onChange:
|
|
19
|
-
className:
|
|
20
|
-
separatorPositions:
|
|
21
|
-
|
|
22
|
-
|
|
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) => {
|
|
23
24
|
const {
|
|
24
|
-
data: { inputRefs:
|
|
25
|
-
handlers: { handleChange:
|
|
26
|
-
} =
|
|
27
|
-
onChange:
|
|
28
|
-
value:
|
|
29
|
-
valueLength:
|
|
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
|
|
30
31
|
});
|
|
31
|
-
|
|
32
|
+
D(P, () => ({
|
|
32
33
|
focus: () => {
|
|
33
|
-
var
|
|
34
|
-
(
|
|
34
|
+
var n;
|
|
35
|
+
(n = a.current[0]) == null || n.focus();
|
|
35
36
|
}
|
|
36
37
|
}));
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
),
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
);
|
|
72
81
|
}
|
|
73
82
|
);
|
|
74
|
-
|
|
83
|
+
G.displayName = "OtpInput";
|
|
75
84
|
export {
|
|
76
|
-
|
|
85
|
+
G as OtpInput
|
|
77
86
|
};
|
|
@@ -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>>;
|