@reportportal/ui-kit 0.0.1-alpha.13 → 0.0.1-alpha.15
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/components/datePicker/datePicker.d.ts +24 -0
- package/dist/components/datePicker/header/datePickerHeader.d.ts +15 -0
- package/dist/components/datePicker/header/index.d.ts +3 -0
- package/dist/components/datePicker/index.d.ts +3 -0
- package/dist/components/datePicker/utils.d.ts +3 -0
- package/dist/components/icons/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/modal/modal.d.ts +6 -2
- package/dist/components/modal/modalHeader/modalHeader.d.ts +1 -1
- package/dist/dropdown-bbfa828e.js +213 -0
- package/dist/dropdown.js +1 -1
- package/dist/index-0be12e80.js +145 -0
- package/dist/index.js +237 -48
- package/dist/modal.js +1 -1
- package/dist/style.css +1 -1
- package/dist/toggle-9284387b.js +67 -0
- package/dist/toggle.js +1 -1
- package/package.json +5 -2
- package/dist/dropdown-e07f2a71.js +0 -212
- package/dist/index-bb9b62ef.js +0 -131
- package/dist/toggle-707ecb74.js +0 -67
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC, ReactNode, ReactElement } from 'react';
|
|
2
|
+
interface DatePickerProps {
|
|
3
|
+
onChange?: (date: Date | any) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
onFocus?: () => void;
|
|
6
|
+
headerNodes?: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
shouldCloseOnSelect?: boolean;
|
|
9
|
+
fixedHeight?: boolean;
|
|
10
|
+
startDate?: Date | undefined;
|
|
11
|
+
endDate?: Date | undefined;
|
|
12
|
+
customClassName?: string;
|
|
13
|
+
popperClassName?: string;
|
|
14
|
+
calendarClassName?: string;
|
|
15
|
+
customTimeInput?: ReactElement;
|
|
16
|
+
language?: string;
|
|
17
|
+
yearsOptions?: number[];
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
dateFormat?: string;
|
|
20
|
+
selects?: 'start' | 'end' | 'none';
|
|
21
|
+
value?: Date | null;
|
|
22
|
+
}
|
|
23
|
+
export declare const DatePicker: FC<DatePickerProps>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export interface DatePickerHeaderProps {
|
|
3
|
+
changeYear: (year: number) => void;
|
|
4
|
+
changeMonth: (month: number) => void;
|
|
5
|
+
decreaseMonth: () => void;
|
|
6
|
+
increaseMonth: () => void;
|
|
7
|
+
headerNodes: ReactNode;
|
|
8
|
+
date: Date;
|
|
9
|
+
prevMonthButtonDisabled: boolean;
|
|
10
|
+
nextMonthButtonDisabled: boolean;
|
|
11
|
+
customClassName: string;
|
|
12
|
+
yearsOptions: number[];
|
|
13
|
+
locale: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DatePickerHeader: FC<DatePickerHeaderProps>;
|
|
@@ -10,3 +10,5 @@ export { default as PrevChapterIcon } from './svg/prevChapter.svg';
|
|
|
10
10
|
export { default as ArrowDownIcon } from './svg/arrowDown.svg';
|
|
11
11
|
export { default as ArrowUpIcon } from './svg/arrowUp.svg';
|
|
12
12
|
export { default as MeatballMenuIcon } from './svg/meatballMenu.svg';
|
|
13
|
+
export { default as CalendarArrowIcon } from './svg/calendarArrow.svg';
|
|
14
|
+
export { default as CalendarIcon } from './svg/calendar.svg';
|
|
@@ -3,9 +3,8 @@ import { ButtonProps } from '../button';
|
|
|
3
3
|
import { ModalSize } from './modalFooter';
|
|
4
4
|
type ModalOverlay = 'default' | 'light-cyan';
|
|
5
5
|
interface ModalProps {
|
|
6
|
-
onClose
|
|
6
|
+
onClose?: () => void;
|
|
7
7
|
title?: ReactNode;
|
|
8
|
-
headerNode?: ReactNode;
|
|
9
8
|
children?: ReactNode;
|
|
10
9
|
footerNode?: ReactNode;
|
|
11
10
|
className?: string;
|
|
@@ -16,6 +15,11 @@ interface ModalProps {
|
|
|
16
15
|
okButton?: ButtonProps;
|
|
17
16
|
cancelButton?: ButtonProps;
|
|
18
17
|
scrollable?: boolean;
|
|
18
|
+
withoutFooter?: boolean;
|
|
19
|
+
CustomFooter?: FC<{
|
|
20
|
+
closeHandler: () => void;
|
|
21
|
+
}>;
|
|
22
|
+
description?: ReactNode;
|
|
19
23
|
}
|
|
20
24
|
export declare const Modal: FC<ModalProps>;
|
|
21
25
|
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { jsx as r, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import { forwardRef as F, useState as Y, useRef as B } from "react";
|
|
4
|
+
import { c as A } from "./bind-06a7ff84.js";
|
|
5
|
+
import { useFloating as ee, offset as te, flip as ne } from "@floating-ui/react-dom";
|
|
6
|
+
import { useSelect as N } from "downshift";
|
|
7
|
+
import { Scrollbars as oe } from "rc-scrollbars";
|
|
8
|
+
import { u as se } from "./useOnClickOutside-c332f7d3.js";
|
|
9
|
+
import { K as h } from "./keyCodes-f63c0e11.js";
|
|
10
|
+
import { B as ae } from "./baseIconButton-7bc53dec.js";
|
|
11
|
+
const re = (t) => /* @__PURE__ */ R.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ R.createElement("path", { d: "M14.2174 5.82426C14.3736 5.66805 14.3736 5.41479 14.2174 5.25858L14.0759 5.11716C13.9197 4.96095 13.6665 4.96095 13.5103 5.11716L8.16726 10.4602L2.82426 5.11716C2.66805 4.96095 2.41479 4.96095 2.25858 5.11716L2.11716 5.25858C1.96095 5.41479 1.96095 5.66805 2.11716 5.82426L7.89176 11.5989C8.04797 11.7551 8.30124 11.7551 8.45745 11.5989L8.88171 11.1746L8.87436 11.1673L14.2174 5.82426Z", fill: "#A2AAB5" })), le = "_disabled_f4c9h_11", de = "_hidden_f4c9h_15", ce = "_selected_f4c9h_21", ie = "_hover_f4c9h_24", _e = {
|
|
12
|
+
"dropdown-option": "_dropdown-option_f4c9h_1",
|
|
13
|
+
disabled: le,
|
|
14
|
+
hidden: de,
|
|
15
|
+
selected: ce,
|
|
16
|
+
hover: ie,
|
|
17
|
+
"single-option": "_single-option_f4c9h_37",
|
|
18
|
+
"sub-option": "_sub-option_f4c9h_45"
|
|
19
|
+
}, P = A.bind(_e), he = F(
|
|
20
|
+
(t, n) => {
|
|
21
|
+
const {
|
|
22
|
+
option: { value: a, disabled: f, hidden: w, label: l, title: o, groupRef: y },
|
|
23
|
+
selected: E,
|
|
24
|
+
onChange: g,
|
|
25
|
+
render: p,
|
|
26
|
+
highlightHovered: b,
|
|
27
|
+
onMouseEnter: m
|
|
28
|
+
} = t, D = () => {
|
|
29
|
+
g && g(a);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ r(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: P("dropdown-option", {
|
|
35
|
+
selected: E,
|
|
36
|
+
disabled: f,
|
|
37
|
+
hidden: w,
|
|
38
|
+
hover: b
|
|
39
|
+
}),
|
|
40
|
+
title: o,
|
|
41
|
+
onClick: D,
|
|
42
|
+
ref: n,
|
|
43
|
+
onMouseEnter: m,
|
|
44
|
+
children: /* @__PURE__ */ r("div", { className: P("single-option", { "sub-option": !!y }), children: p ? p(t) : l })
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
), fe = [
|
|
49
|
+
h.ENTER_KEY_CODE,
|
|
50
|
+
h.SPACE_KEY_CODE,
|
|
51
|
+
h.ARROW_DOWN_KEY_CODE
|
|
52
|
+
], pe = [h.ESCAPE_KEY_CODE, h.TAB_KEY_CODE];
|
|
53
|
+
var _ = /* @__PURE__ */ ((t) => (t.ON_KEY_DOWN = "onKeyDown", t.ON_CLICK = "onClick", t))(_ || {});
|
|
54
|
+
const ge = (t, n) => t.map(({ value: a }) => a).indexOf(n), me = (t, n) => (t % n + n) % n, K = (t, n = 0, a = 1) => {
|
|
55
|
+
if (!t[n].disabled)
|
|
56
|
+
return n;
|
|
57
|
+
const f = t.length;
|
|
58
|
+
return K(
|
|
59
|
+
t,
|
|
60
|
+
me(n + a, f),
|
|
61
|
+
a
|
|
62
|
+
);
|
|
63
|
+
}, ue = (t, n) => K(t, n), Ce = (t, n) => K(t, n, -1), Oe = "_container_1o5y6_1", we = "_icon_1o5y6_7", ye = "_arrow_1o5y6_13", Ee = "_dropdown_1o5y6_19", be = "_disabled_1o5y6_36", De = "_value_1o5y6_43", Ne = "_error_1o5y6_46", Ke = "_touched_1o5y6_46", ve = "_opened_1o5y6_50", xe = "_placeholder_1o5y6_72", Ie = "_ghost_1o5y6_115", ke = {
|
|
64
|
+
container: Oe,
|
|
65
|
+
icon: we,
|
|
66
|
+
arrow: ye,
|
|
67
|
+
dropdown: Ee,
|
|
68
|
+
"transparent-background": "_transparent-background_1o5y6_33",
|
|
69
|
+
disabled: be,
|
|
70
|
+
value: De,
|
|
71
|
+
error: Ne,
|
|
72
|
+
touched: Ke,
|
|
73
|
+
opened: ve,
|
|
74
|
+
placeholder: xe,
|
|
75
|
+
"mobile-disabled": "_mobile-disabled_1o5y6_87",
|
|
76
|
+
"select-list": "_select-list_1o5y6_92",
|
|
77
|
+
"options-container": "_options-container_1o5y6_110",
|
|
78
|
+
ghost: Ie
|
|
79
|
+
}, c = A.bind(ke), $e = ({
|
|
80
|
+
value: t = "",
|
|
81
|
+
options: n = [],
|
|
82
|
+
disabled: a = !1,
|
|
83
|
+
error: f,
|
|
84
|
+
onChange: w,
|
|
85
|
+
onFocus: l,
|
|
86
|
+
onBlur: o,
|
|
87
|
+
mobileDisabled: y,
|
|
88
|
+
title: E,
|
|
89
|
+
touched: g = !1,
|
|
90
|
+
icon: p,
|
|
91
|
+
variant: b,
|
|
92
|
+
placeholder: m = "",
|
|
93
|
+
renderOption: D,
|
|
94
|
+
transparentBackground: T = !1,
|
|
95
|
+
className: W,
|
|
96
|
+
toggleButtonClassName: H
|
|
97
|
+
}) => {
|
|
98
|
+
const [d, i] = Y(!1), v = B(null), [M, u] = Y(null), { refs: x, floatingStyles: $ } = ee({
|
|
99
|
+
middleware: [
|
|
100
|
+
te(5),
|
|
101
|
+
ne({
|
|
102
|
+
fallbackPlacements: ["bottom", "top"]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
se(v, () => {
|
|
107
|
+
d && (i(!1), o == null || o());
|
|
108
|
+
});
|
|
109
|
+
const I = (e) => {
|
|
110
|
+
e.disabled || (w(e.value), i((s) => !s));
|
|
111
|
+
}, j = () => n.find(({ value: e }) => e === t), k = ge(n, t), {
|
|
112
|
+
getToggleButtonProps: V,
|
|
113
|
+
getMenuProps: U,
|
|
114
|
+
getItemProps: Z,
|
|
115
|
+
setHighlightedIndex: C,
|
|
116
|
+
highlightedIndex: S,
|
|
117
|
+
selectedItem: O
|
|
118
|
+
} = N({
|
|
119
|
+
items: n,
|
|
120
|
+
itemToString: (e) => (e != null && e.label ? String(e.label) : m) || "",
|
|
121
|
+
selectedItem: j(),
|
|
122
|
+
isOpen: d,
|
|
123
|
+
circularNavigation: !0,
|
|
124
|
+
defaultHighlightedIndex: k,
|
|
125
|
+
onHighlightedIndexChange: (e) => {
|
|
126
|
+
switch (e.type) {
|
|
127
|
+
case N.stateChangeTypes.MenuKeyDownArrowUp:
|
|
128
|
+
return u(_.ON_KEY_DOWN), C(Ce(n, e.highlightedIndex)), e;
|
|
129
|
+
case N.stateChangeTypes.MenuKeyDownArrowDown:
|
|
130
|
+
return u(_.ON_KEY_DOWN), C(ue(n, e.highlightedIndex)), e;
|
|
131
|
+
default:
|
|
132
|
+
return e;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}), q = () => {
|
|
136
|
+
a || (i((e) => !e), d ? o == null || o() : l == null || l(), u(_.ON_CLICK));
|
|
137
|
+
}, z = () => {
|
|
138
|
+
if (!t && t !== !1 && t !== 0)
|
|
139
|
+
return m;
|
|
140
|
+
let e = t;
|
|
141
|
+
return n.forEach((s) => {
|
|
142
|
+
s.value === t && (e = s.label);
|
|
143
|
+
}), e;
|
|
144
|
+
}, G = (e) => {
|
|
145
|
+
const { keyCode: s } = e;
|
|
146
|
+
fe.includes(s) && !d && (e.preventDefault(), C(k), i(!0), l == null || l(), u(_.ON_KEY_DOWN));
|
|
147
|
+
}, J = (e) => {
|
|
148
|
+
const { keyCode: s } = e;
|
|
149
|
+
if (s === h.ENTER_KEY_CODE) {
|
|
150
|
+
const X = n[S];
|
|
151
|
+
I(X), i(!1), o == null || o();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
pe.includes(s) && (e.stopPropagation(), i(!1), o == null || o());
|
|
155
|
+
}, Q = () => /* @__PURE__ */ r("div", { className: c("options-container"), children: n.map((e, s) => /* @__PURE__ */ r(
|
|
156
|
+
he,
|
|
157
|
+
{
|
|
158
|
+
...Z({
|
|
159
|
+
item: e,
|
|
160
|
+
index: s
|
|
161
|
+
}),
|
|
162
|
+
selected: e.value === ((O == null ? void 0 : O.value) ?? O),
|
|
163
|
+
option: { title: e.label, ...e },
|
|
164
|
+
highlightHovered: S === s && M !== _.ON_CLICK,
|
|
165
|
+
render: D,
|
|
166
|
+
onChange: e.disabled ? null : () => I(e),
|
|
167
|
+
onMouseEnter: () => C(s)
|
|
168
|
+
},
|
|
169
|
+
e.value
|
|
170
|
+
)) });
|
|
171
|
+
return /* @__PURE__ */ L("div", { ref: v, className: c("container", W), title: E, children: [
|
|
172
|
+
/* @__PURE__ */ L(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
disabled: a,
|
|
176
|
+
...V({
|
|
177
|
+
className: c("dropdown", b, H, {
|
|
178
|
+
"transparent-background": T,
|
|
179
|
+
opened: d,
|
|
180
|
+
disabled: a,
|
|
181
|
+
error: f,
|
|
182
|
+
touched: g,
|
|
183
|
+
"mobile-disabled": y
|
|
184
|
+
}),
|
|
185
|
+
onClick: q,
|
|
186
|
+
onKeyDown: G,
|
|
187
|
+
ref: x.setReference
|
|
188
|
+
}),
|
|
189
|
+
children: [
|
|
190
|
+
p && /* @__PURE__ */ r("span", { className: c("icon"), children: p }),
|
|
191
|
+
/* @__PURE__ */ r("span", { className: c("value", { placeholder: !t }), children: z() }),
|
|
192
|
+
/* @__PURE__ */ r(ae, { className: c("arrow"), tabIndex: -1, children: /* @__PURE__ */ r(re, {}) })
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
d && /* @__PURE__ */ r(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
style: $,
|
|
200
|
+
className: c("select-list", { opened: d }),
|
|
201
|
+
...U({
|
|
202
|
+
onKeyDown: J,
|
|
203
|
+
ref: x.setFloating
|
|
204
|
+
}),
|
|
205
|
+
children: /* @__PURE__ */ r(oe, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: Q() })
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
] });
|
|
209
|
+
};
|
|
210
|
+
export {
|
|
211
|
+
$e as D,
|
|
212
|
+
re as S
|
|
213
|
+
};
|
package/dist/dropdown.js
CHANGED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import * as M from "react";
|
|
3
|
+
import { useState as f, useEffect as g, useRef as j } from "react";
|
|
4
|
+
import { Scrollbars as G } from "rc-scrollbars";
|
|
5
|
+
import { AnimatePresence as K, motion as P } from "framer-motion";
|
|
6
|
+
import { c as u } from "./bind-06a7ff84.js";
|
|
7
|
+
import { u as Y } from "./useOnClickOutside-c332f7d3.js";
|
|
8
|
+
import { K as F } from "./keyCodes-f63c0e11.js";
|
|
9
|
+
import { B as L } from "./button-7fb84fde.js";
|
|
10
|
+
import { B as U } from "./baseIconButton-7bc53dec.js";
|
|
11
|
+
const X = (t) => /* @__PURE__ */ M.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ M.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.732179 15.2698C0.330639 14.8683 0.33064 14.2172 0.73218 13.8157L6.54858 7.99928L0.73218 2.18288C0.33064 1.78134 0.330639 1.13031 0.732179 0.728774C1.13372 0.327235 1.78474 0.327235 2.18628 0.728774L8.00269 6.54518L13.8191 0.728767C14.2206 0.327229 14.8717 0.327228 15.2732 0.728767C15.6747 1.13031 15.6747 1.78133 15.2732 2.18287L9.45679 7.99928L15.2732 13.8157C15.6747 14.2172 15.6747 14.8683 15.2732 15.2698C14.8717 15.6713 14.2206 15.6713 13.8191 15.2698L8.00269 9.45338L2.18628 15.2698C1.78474 15.6713 1.13372 15.6713 0.732179 15.2698Z", fill: "#A2AAB5" })), Z = () => {
|
|
12
|
+
const [t, s] = f({ width: 0, height: 0 });
|
|
13
|
+
return g(() => {
|
|
14
|
+
const n = () => {
|
|
15
|
+
s({
|
|
16
|
+
width: window.innerWidth,
|
|
17
|
+
height: window.innerHeight
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return window.addEventListener("resize", n), n(), () => window.removeEventListener("resize", n);
|
|
21
|
+
}, []), t;
|
|
22
|
+
}, q = {
|
|
23
|
+
"modal-content": "_modal-content_17fct_1"
|
|
24
|
+
}, J = u.bind(q), A = ({ children: t }) => /* @__PURE__ */ e("div", { className: J("modal-content"), children: t }), Q = {
|
|
25
|
+
"buttons-block": "_buttons-block_1dgm4_1",
|
|
26
|
+
"button-container": "_button-container_1dgm4_5",
|
|
27
|
+
"modal-footer": "_modal-footer_1dgm4_14",
|
|
28
|
+
"with-extra-node": "_with-extra-node_1dgm4_21",
|
|
29
|
+
"size-small": "_size-small_1dgm4_25"
|
|
30
|
+
}, m = u.bind(Q), V = ({
|
|
31
|
+
footerNode: t,
|
|
32
|
+
closeHandler: s,
|
|
33
|
+
okButton: n,
|
|
34
|
+
cancelButton: r,
|
|
35
|
+
size: a
|
|
36
|
+
}) => /* @__PURE__ */ d("div", { className: m("modal-footer", { "with-extra-node": t, [`size-${a}`]: a }), children: [
|
|
37
|
+
t && t,
|
|
38
|
+
/* @__PURE__ */ d("div", { className: m("buttons-block"), children: [
|
|
39
|
+
r && /* @__PURE__ */ e("div", { className: m("button-container"), children: /* @__PURE__ */ e(
|
|
40
|
+
L,
|
|
41
|
+
{
|
|
42
|
+
variant: "ghost",
|
|
43
|
+
adjustWidthOn: a === "small" ? "parent" : "content",
|
|
44
|
+
onClick: s,
|
|
45
|
+
...r
|
|
46
|
+
}
|
|
47
|
+
) }),
|
|
48
|
+
n && /* @__PURE__ */ e("div", { className: m("button-container"), children: /* @__PURE__ */ e(L, { adjustWidthOn: a === "small" ? "parent" : "content", ...n }) })
|
|
49
|
+
] })
|
|
50
|
+
] }), ee = {
|
|
51
|
+
"modal-header": "_modal-header_1rhdb_1",
|
|
52
|
+
"width-description": "_width-description_1rhdb_10",
|
|
53
|
+
"modal-header-content": "_modal-header-content_1rhdb_14",
|
|
54
|
+
"modal-title": "_modal-title_1rhdb_20",
|
|
55
|
+
"close-modal-icon": "_close-modal-icon_1rhdb_28"
|
|
56
|
+
}, _ = u.bind(ee), te = ({ title: t, onClose: s, withDescription: n = !1 }) => /* @__PURE__ */ d("div", { className: _("modal-header", { "width-description": n }), children: [
|
|
57
|
+
/* @__PURE__ */ e("div", { className: _("modal-header-content"), children: t && /* @__PURE__ */ e("span", { className: _("modal-title"), children: t }) }),
|
|
58
|
+
/* @__PURE__ */ e(U, { className: _("close-modal-icon"), onClick: s, children: /* @__PURE__ */ e(X, {}) })
|
|
59
|
+
] }), oe = "_modal_sp7xo_1", ne = "_description_sp7xo_42", se = {
|
|
60
|
+
modal: oe,
|
|
61
|
+
"overlay-default": "_overlay-default_sp7xo_11",
|
|
62
|
+
"overlay-light-cyan": "_overlay-light-cyan_sp7xo_15",
|
|
63
|
+
"scrolling-content": "_scrolling-content_sp7xo_19",
|
|
64
|
+
"modal-window": "_modal-window_sp7xo_25",
|
|
65
|
+
description: ne,
|
|
66
|
+
"size-default": "_size-default_sp7xo_53",
|
|
67
|
+
"size-small": "_size-small_sp7xo_65",
|
|
68
|
+
"size-large": "_size-large_sp7xo_77"
|
|
69
|
+
}, h = u.bind(se), ae = 0.9, ie = 32 + 24, le = 32 + 8, de = 36 + 16, ce = 32 * 2, xe = ({
|
|
70
|
+
title: t,
|
|
71
|
+
children: s,
|
|
72
|
+
footerNode: n,
|
|
73
|
+
okButton: r,
|
|
74
|
+
cancelButton: a,
|
|
75
|
+
className: N,
|
|
76
|
+
size: w = "default",
|
|
77
|
+
onClose: O = () => {
|
|
78
|
+
},
|
|
79
|
+
overlay: x = "default",
|
|
80
|
+
zIndex: z = 2,
|
|
81
|
+
allowCloseOutside: D = !0,
|
|
82
|
+
scrollable: R = !1,
|
|
83
|
+
withoutFooter: v = !1,
|
|
84
|
+
CustomFooter: b = null,
|
|
85
|
+
description: i = null
|
|
86
|
+
}) => {
|
|
87
|
+
const [S, H] = f(!1), [T, I] = f(0), l = j(null), E = Z(), C = E.height, k = C * ae, p = (C - T) / 2, $ = () => {
|
|
88
|
+
let o = k - ce;
|
|
89
|
+
return v || (o = o - de), i ? o = o - le : o = o - ie, o;
|
|
90
|
+
}, c = () => {
|
|
91
|
+
H(!1);
|
|
92
|
+
}, y = (o) => {
|
|
93
|
+
const { keyCode: W } = o;
|
|
94
|
+
W === F.ESCAPE_KEY_CODE && c();
|
|
95
|
+
};
|
|
96
|
+
return g(() => {
|
|
97
|
+
if (l && l.current) {
|
|
98
|
+
const { clientHeight: o } = l.current;
|
|
99
|
+
I(o);
|
|
100
|
+
}
|
|
101
|
+
}, [s, E]), g(() => (H(!0), document.addEventListener("keydown", y, !1), () => document.removeEventListener("keydown", y, !1)), []), Y(l, D ? c : void 0), /* @__PURE__ */ e(K, { onExitComplete: O, children: S && /* @__PURE__ */ e("div", { className: h("modal", { [`overlay-${x}`]: x }), style: { zIndex: z }, children: /* @__PURE__ */ d(
|
|
102
|
+
P.div,
|
|
103
|
+
{
|
|
104
|
+
className: h("modal-window", { [`size-${w}`]: w }, N),
|
|
105
|
+
ref: l,
|
|
106
|
+
tabIndex: 0,
|
|
107
|
+
initial: { opacity: 0, marginTop: -p },
|
|
108
|
+
animate: { opacity: 1, marginTop: p },
|
|
109
|
+
exit: { opacity: 0, marginTop: -p },
|
|
110
|
+
transition: { duration: 0.3 },
|
|
111
|
+
onAnimationStart: () => {
|
|
112
|
+
var o;
|
|
113
|
+
return (o = l.current) == null ? void 0 : o.focus();
|
|
114
|
+
},
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ e(te, { title: t, onClose: c, withDescription: !!i }),
|
|
117
|
+
R ? /* @__PURE__ */ d(G, { autoHeight: !0, autoHeightMax: $(), hideTracksWhenNotNeeded: !0, children: [
|
|
118
|
+
i && /* @__PURE__ */ e("span", { className: h("description"), children: i }),
|
|
119
|
+
/* @__PURE__ */ e(A, { children: s })
|
|
120
|
+
] }) : /* @__PURE__ */ d(B, { children: [
|
|
121
|
+
i && /* @__PURE__ */ e("span", { className: h("description"), children: i }),
|
|
122
|
+
/* @__PURE__ */ e(A, { children: s })
|
|
123
|
+
] }),
|
|
124
|
+
!v && (b ? /* @__PURE__ */ e(b, { closeHandler: c }) : /* @__PURE__ */ e(
|
|
125
|
+
V,
|
|
126
|
+
{
|
|
127
|
+
size: w,
|
|
128
|
+
footerNode: n,
|
|
129
|
+
okButton: r,
|
|
130
|
+
cancelButton: a,
|
|
131
|
+
closeHandler: c
|
|
132
|
+
}
|
|
133
|
+
))
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"modal-window"
|
|
137
|
+
) }) });
|
|
138
|
+
};
|
|
139
|
+
export {
|
|
140
|
+
xe as M,
|
|
141
|
+
X as S,
|
|
142
|
+
A as a,
|
|
143
|
+
te as b,
|
|
144
|
+
V as c
|
|
145
|
+
};
|