@reportportal/ui-kit 0.0.1-alpha.2 → 0.0.1-alpha.4

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.
Files changed (36) hide show
  1. package/dist/bind-06a7ff84.js +41 -0
  2. package/dist/button-d4944dbc.js +64 -0
  3. package/dist/button.js +2 -2
  4. package/dist/checkbox-7736509c.js +70 -0
  5. package/dist/checkbox.js +3 -2
  6. package/dist/{constants → common/constants}/key-codes.d.ts +2 -1
  7. package/dist/common/hooks/index.d.ts +2 -0
  8. package/dist/common/hooks/useOnClickOutside.d.ts +2 -0
  9. package/dist/common/hooks/useWindowResize.d.ts +4 -0
  10. package/dist/components/button/button.d.ts +6 -6
  11. package/dist/components/button/index.d.ts +1 -0
  12. package/dist/components/checkbox/checkbox.d.ts +3 -6
  13. package/dist/components/fieldText/fieldText.d.ts +23 -0
  14. package/dist/components/fieldText/index.d.ts +3 -0
  15. package/dist/components/index.d.ts +2 -0
  16. package/dist/components/modal/index.d.ts +4 -0
  17. package/dist/components/modal/modal.d.ts +19 -0
  18. package/dist/components/modal/modalContent/index.d.ts +1 -0
  19. package/dist/components/modal/modalContent/modalContent.d.ts +6 -0
  20. package/dist/components/modal/modalFooter/index.d.ts +2 -0
  21. package/dist/components/modal/modalFooter/modalFooter.d.ts +12 -0
  22. package/dist/components/modal/modalHeader/index.d.ts +1 -0
  23. package/dist/components/modal/modalHeader/modalHeader.d.ts +8 -0
  24. package/dist/fieldText-9621b0b7.js +99 -0
  25. package/dist/fieldText.js +8 -0
  26. package/dist/index.js +16 -9
  27. package/dist/key-codes-abbe7725.js +4 -0
  28. package/dist/modal.js +137 -0
  29. package/dist/style.css +1 -1
  30. package/dist/systemMessage-62c3133d.js +30 -0
  31. package/dist/systemMessage.js +2 -2
  32. package/package.json +6 -4
  33. package/dist/bind-e1346f99.js +0 -44
  34. package/dist/button-a4d3df83.js +0 -1867
  35. package/dist/checkbox-3fd4bcc1.js +0 -74
  36. package/dist/systemMessage-55cf51f4.js +0 -30
@@ -0,0 +1,41 @@
1
+ function a(s) {
2
+ return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
3
+ }
4
+ var u = { exports: {} };
5
+ /*!
6
+ Copyright (c) 2018 Jed Watson.
7
+ Licensed under the MIT License (MIT), see
8
+ http://jedwatson.github.io/classnames
9
+ */
10
+ (function(s) {
11
+ (function() {
12
+ var c = {}.hasOwnProperty;
13
+ function e() {
14
+ for (var n = [], i = 0; i < arguments.length; i++) {
15
+ var t = arguments[i];
16
+ if (t) {
17
+ var r = typeof t;
18
+ if (r === "string" || r === "number")
19
+ n.push(this && this[t] || t);
20
+ else if (Array.isArray(t))
21
+ n.push(e.apply(this, t));
22
+ else if (r === "object") {
23
+ if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]")) {
24
+ n.push(t.toString());
25
+ continue;
26
+ }
27
+ for (var o in t)
28
+ c.call(t, o) && t[o] && n.push(this && this[o] || o);
29
+ }
30
+ }
31
+ }
32
+ return n.join(" ");
33
+ }
34
+ s.exports ? (e.default = e, s.exports = e) : window.classNames = e;
35
+ })();
36
+ })(u);
37
+ var f = u.exports;
38
+ const l = /* @__PURE__ */ a(f);
39
+ export {
40
+ l as c
41
+ };
@@ -0,0 +1,64 @@
1
+ import { jsxs as h, jsx as l } from "react/jsx-runtime";
2
+ import { forwardRef as x } from "react";
3
+ import { c as f } from "./bind-06a7ff84.js";
4
+ const g = "_button_wutm5_1", y = "_primary_wutm5_19", N = "_disabled_wutm5_24", B = "_ghost_wutm5_36", $ = "_danger_wutm5_51", j = "_text_wutm5_67", I = "_icon_wutm5_113", R = {
5
+ button: g,
6
+ primary: y,
7
+ disabled: N,
8
+ ghost: B,
9
+ danger: $,
10
+ text: j,
11
+ "width-wide-content": "_width-wide-content_wutm5_103",
12
+ "width-parent": "_width-parent_wutm5_108",
13
+ icon: I,
14
+ "icon-start": "_icon-start_wutm5_119",
15
+ "icon-end": "_icon-end_wutm5_123"
16
+ }, c = f.bind(R), A = x(
17
+ ({
18
+ variant: t = "primary",
19
+ icon: e,
20
+ iconPlace: n = "start",
21
+ adjustWidthOn: o = "content",
22
+ type: i = "button",
23
+ children: r,
24
+ disabled: s = !1,
25
+ onClick: a,
26
+ title: m,
27
+ className: d,
28
+ dataAutomationId: u,
29
+ ...w
30
+ }, b) => {
31
+ const p = c("button", t, d, {
32
+ disabled: s,
33
+ [`width-${o}`]: o
34
+ }), _ = t === "text" && e;
35
+ return /* @__PURE__ */ h(
36
+ "button",
37
+ {
38
+ ref: b,
39
+ type: i,
40
+ disabled: s,
41
+ className: p,
42
+ onClick: a,
43
+ title: m,
44
+ "data-automation-id": u,
45
+ ...w,
46
+ children: [
47
+ _ && /* @__PURE__ */ l(
48
+ "i",
49
+ {
50
+ className: c("icon", {
51
+ [`icon-${n}`]: n
52
+ }),
53
+ children: _
54
+ }
55
+ ),
56
+ r
57
+ ]
58
+ }
59
+ );
60
+ }
61
+ );
62
+ export {
63
+ A as B
64
+ };
package/dist/button.js CHANGED
@@ -1,7 +1,7 @@
1
- import { B as o } from "./button-a4d3df83.js";
1
+ import { B as o } from "./button-d4944dbc.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
- import "./bind-e1346f99.js";
4
+ import "./bind-06a7ff84.js";
5
5
  export {
6
6
  o as Button,
7
7
  o as default
@@ -0,0 +1,70 @@
1
+ import { jsxs as d, jsx as n } from "react/jsx-runtime";
2
+ import { c as m } from "./bind-06a7ff84.js";
3
+ import { useRef as x } from "react";
4
+ import { K as p } from "./key-codes-abbe7725.js";
5
+ const f = "_checkbox_1gq3p_1", y = "_disabled_1gq3p_12", C = "_input_1gq3p_17", E = "_control_1gq3p_24", D = "_children_1gq3p_78", K = {
6
+ checkbox: f,
7
+ disabled: y,
8
+ input: C,
9
+ control: E,
10
+ children: D
11
+ }, e = m.bind(K), j = ({
12
+ children: s,
13
+ disabled: c = !1,
14
+ onChange: _,
15
+ className: b,
16
+ value: r,
17
+ dataAutomationId: h,
18
+ ...k
19
+ }) => {
20
+ const o = x(null), u = (t) => {
21
+ var l, i;
22
+ const { keyCode: a } = t;
23
+ if (a === p.SPACE_KEY_CODE) {
24
+ t.preventDefault(), (l = o.current) == null || l.click();
25
+ return;
26
+ }
27
+ a === p.ENTER_KEY_CODE && (t.preventDefault(), (i = o.current) == null || i.click());
28
+ };
29
+ return /* @__PURE__ */ d(
30
+ "label",
31
+ {
32
+ id: "rp-ui-kit-checkbox-label",
33
+ className: e("checkbox", b, {
34
+ disabled: c
35
+ }),
36
+ "data-automation-id": h,
37
+ children: [
38
+ /* @__PURE__ */ n(
39
+ "input",
40
+ {
41
+ ref: o,
42
+ tabIndex: 0,
43
+ type: "checkbox",
44
+ onKeyDown: u,
45
+ className: e("input"),
46
+ disabled: c,
47
+ onChange: _,
48
+ checked: r,
49
+ ...k
50
+ }
51
+ ),
52
+ /* @__PURE__ */ n(
53
+ "span",
54
+ {
55
+ "aria-labelledby": "rp-ui-kit-checkbox-label",
56
+ role: "checkbox",
57
+ "aria-checked": r,
58
+ className: e("control", {
59
+ disabled: c
60
+ })
61
+ }
62
+ ),
63
+ s && /* @__PURE__ */ n("span", { className: e("children", { disabled: c }), children: s })
64
+ ]
65
+ }
66
+ );
67
+ };
68
+ export {
69
+ j as C
70
+ };
package/dist/checkbox.js CHANGED
@@ -1,7 +1,8 @@
1
- import { C as r } from "./checkbox-3fd4bcc1.js";
1
+ import { C as r } from "./checkbox-7736509c.js";
2
2
  import "react/jsx-runtime";
3
- import "./bind-e1346f99.js";
3
+ import "./bind-06a7ff84.js";
4
4
  import "react";
5
+ import "./key-codes-abbe7725.js";
5
6
  export {
6
7
  r as Checkbox,
7
8
  r as default
@@ -1,4 +1,5 @@
1
1
  export declare enum KeyCodes {
2
2
  SPACE_KEY_CODE = 32,
3
- ENTER_KEY_CODE = 13
3
+ ENTER_KEY_CODE = 13,
4
+ ESCAPE_KEY_CODE = 27
4
5
  }
@@ -0,0 +1,2 @@
1
+ export { useOnClickOutside } from './useOnClickOutside';
2
+ export { useWindowResize } from './useWindowResize';
@@ -0,0 +1,2 @@
1
+ import { RefObject } from 'react';
2
+ export declare function useOnClickOutside<T extends HTMLElement = HTMLDivElement>(ref: RefObject<T>, handler?: (e?: MouseEvent) => void): void;
@@ -0,0 +1,4 @@
1
+ export declare const useWindowResize: () => {
2
+ width: number;
3
+ height: number;
4
+ };
@@ -1,16 +1,16 @@
1
- import { FC, ReactNode } from 'react';
1
+ import { FC, ReactNode, ComponentPropsWithRef, MouseEventHandler } from 'react';
2
2
  type IconPlace = 'start' | 'end';
3
3
  type ButtonVariant = 'primary' | 'ghost' | 'danger' | 'text';
4
- interface ButtonProps {
4
+ type ButtonWidth = 'content' | 'wide-content' | 'parent';
5
+ export interface ButtonProps extends ComponentPropsWithRef<'button'> {
5
6
  children?: ReactNode;
6
- icon?: string;
7
+ icon?: ReactNode;
7
8
  iconPlace?: IconPlace;
8
9
  dataAutomationId?: string;
9
- wide?: boolean;
10
+ adjustWidthOn?: ButtonWidth;
10
11
  disabled?: boolean;
11
12
  type?: 'submit' | 'reset' | 'button';
12
- onClick?: () => void;
13
- form?: string;
13
+ onClick?: MouseEventHandler<HTMLButtonElement>;
14
14
  title?: string;
15
15
  className?: string;
16
16
  variant?: ButtonVariant;
@@ -1,3 +1,4 @@
1
1
  import { Button } from './button';
2
2
  export { Button };
3
+ export type { ButtonProps } from './button';
3
4
  export default Button;
@@ -1,14 +1,11 @@
1
- import { FC, ReactNode } from 'react';
2
- interface CheckboxProps {
1
+ import { FC, ReactNode, ChangeEventHandler, HTMLAttributes } from 'react';
2
+ interface CheckboxProps extends HTMLAttributes<HTMLInputElement> {
3
3
  value: boolean;
4
4
  children?: ReactNode;
5
5
  disabled?: boolean;
6
6
  className?: string;
7
7
  dataAutomationId?: string;
8
- onChange?: () => void;
9
- onFocus?: () => void;
10
- onBlur?: () => void;
11
- form?: string;
8
+ onChange?: ChangeEventHandler<HTMLInputElement>;
12
9
  }
13
10
  export declare const Checkbox: FC<CheckboxProps>;
14
11
  export {};
@@ -0,0 +1,23 @@
1
+ import { FC, ChangeEventHandler, ReactNode, ComponentPropsWithRef } from 'react';
2
+ interface FieldTextProps extends ComponentPropsWithRef<'input'> {
3
+ value?: string;
4
+ className?: string;
5
+ error?: string;
6
+ placeholder?: string;
7
+ disabled?: boolean;
8
+ onChange?: ChangeEventHandler<HTMLInputElement>;
9
+ touched?: boolean;
10
+ title?: string;
11
+ label?: string;
12
+ helpText?: string;
13
+ defaultWidth?: boolean;
14
+ startIcon?: ReactNode;
15
+ endIcon?: ReactNode;
16
+ clearable?: boolean;
17
+ onClear?: (prevValue?: string) => void;
18
+ isRequired?: boolean;
19
+ hasDoubleMessage?: boolean;
20
+ type?: string;
21
+ }
22
+ export declare const FieldText: FC<FieldTextProps>;
23
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FieldText } from './fieldText';
2
+ export { FieldText };
3
+ export default FieldText;
@@ -1,4 +1,6 @@
1
1
  export { Button } from './button';
2
2
  export { Checkbox } from './checkbox';
3
3
  export { SystemMessage } from './systemMessage';
4
+ export { FieldText } from './fieldText';
4
5
  export { ThemeProvider } from './themeProvider';
6
+ export { Modal } from './modal';
@@ -0,0 +1,4 @@
1
+ export { Modal } from './modal';
2
+ export { ModalContent } from './modalContent';
3
+ export { ModalHeader } from './modalHeader';
4
+ export { ModalFooter } from './modalFooter';
@@ -0,0 +1,19 @@
1
+ import { ReactNode, FC } from 'react';
2
+ import { ButtonProps } from '../button';
3
+ import { ModalSize } from './modalFooter';
4
+ type ModalOverlay = 'default' | 'light-cyan';
5
+ interface ModalProps {
6
+ title?: ReactNode;
7
+ headerNode?: ReactNode;
8
+ children?: ReactNode;
9
+ footerNode?: ReactNode;
10
+ className?: string;
11
+ size?: ModalSize;
12
+ overlay?: ModalOverlay;
13
+ allowCloseOutside?: boolean;
14
+ okButton?: ButtonProps;
15
+ cancelButton?: ButtonProps;
16
+ onClose: () => void;
17
+ }
18
+ export declare const Modal: FC<ModalProps>;
19
+ export {};
@@ -0,0 +1 @@
1
+ export { ModalContent } from './modalContent';
@@ -0,0 +1,6 @@
1
+ import { ReactNode, FC } from 'react';
2
+ interface ModalContentProps {
3
+ children?: ReactNode;
4
+ }
5
+ export declare const ModalContent: FC<ModalContentProps>;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ export { ModalFooter } from './modalFooter';
2
+ export type { ModalSize } from './modalFooter';
@@ -0,0 +1,12 @@
1
+ import { ReactNode, FC, MouseEventHandler } from 'react';
2
+ import { ButtonProps } from '../../button';
3
+ export type ModalSize = 'default' | 'small' | 'large';
4
+ interface ModalFooterProps {
5
+ closeHandler: MouseEventHandler<HTMLButtonElement>;
6
+ footerNode?: ReactNode;
7
+ okButton?: ButtonProps;
8
+ cancelButton?: ButtonProps;
9
+ size?: ModalSize;
10
+ }
11
+ export declare const ModalFooter: FC<ModalFooterProps>;
12
+ export {};
@@ -0,0 +1 @@
1
+ export { ModalHeader } from './modalHeader';
@@ -0,0 +1,8 @@
1
+ import { ReactNode, FC } from 'react';
2
+ interface ModalHeaderProps {
3
+ title?: ReactNode;
4
+ headerNode?: ReactNode;
5
+ onClose: () => void;
6
+ }
7
+ export declare const ModalHeader: FC<ModalHeaderProps>;
8
+ export {};
@@ -0,0 +1,99 @@
1
+ import { jsx as e, jsxs as t, Fragment as f } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { forwardRef as A } from "react";
4
+ import { c as F } from "./bind-06a7ff84.js";
5
+ const R = (c) => /* @__PURE__ */ o.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...c }, /* @__PURE__ */ o.createElement("rect", { width: 16.2089, height: 16.1568, rx: 8.07842, fill: "#A2AAB5" }), /* @__PURE__ */ o.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M5.14768 5.14645C4.95077 5.34171 4.95077 5.65829 5.14768 5.85355L7.49578 8.18198L5.35655 10.3033C5.15963 10.4986 5.15963 10.8151 5.35655 11.0104C5.55346 11.2057 5.87271 11.2057 6.06962 11.0104L8.20886 8.88909L10.1392 10.8033C10.3361 10.9986 10.6554 10.9986 10.8523 10.8033C11.0492 10.608 11.0492 10.2915 10.8523 10.0962L8.92193 8.18198L11.0612 6.06065C11.2581 5.86539 11.2581 5.54881 11.0612 5.35355C10.8643 5.15828 10.545 5.15828 10.3481 5.35355L8.20886 7.47487L5.86076 5.14645C5.66385 4.95118 5.34459 4.95118 5.14768 5.14645Z", fill: "white" })), j = "_label_11rxn_18", y = "_asterisk_11rxn_27", B = "_disabled_11rxn_33", M = "_field_11rxn_37", S = "_error_11rxn_51", Z = "_touched_11rxn_51", z = "_input_11rxn_65", D = "_placeholder_11rxn_88", G = "_icon_11rxn_1", H = "_text_11rxn_151", J = {
6
+ "icon-container": "_icon-container_11rxn_1",
7
+ "icon-container-end": "_icon-container-end_11rxn_1",
8
+ "icon-container-start": "_icon-container-start_11rxn_1",
9
+ label: j,
10
+ asterisk: y,
11
+ disabled: B,
12
+ field: M,
13
+ error: S,
14
+ touched: Z,
15
+ "default-width": "_default-width_11rxn_61",
16
+ "input-container": "_input-container_11rxn_65",
17
+ input: z,
18
+ placeholder: D,
19
+ icon: G,
20
+ "clear-icon": "_clear-icon_11rxn_108",
21
+ "additional-content": "_additional-content_11rxn_144",
22
+ text: H,
23
+ "error-text": "_error-text_11rxn_159",
24
+ "help-text": "_help-text_11rxn_163"
25
+ }, n = F.bind(J), Q = A(
26
+ ({
27
+ value: c,
28
+ className: N,
29
+ error: r,
30
+ placeholder: _,
31
+ disabled: a = !1,
32
+ onChange: u,
33
+ touched: i = !1,
34
+ title: w,
35
+ label: s,
36
+ helpText: l,
37
+ defaultWidth: C = !0,
38
+ startIcon: d,
39
+ endIcon: x,
40
+ clearable: L = !1,
41
+ onClear: p,
42
+ isRequired: h = !1,
43
+ hasDoubleMessage: g = !1,
44
+ type: k = "text",
45
+ ...v
46
+ }, b) => {
47
+ const E = () => {
48
+ p && p(c);
49
+ }, m = /* @__PURE__ */ e("span", { className: n("text", "help-text"), children: l });
50
+ return /* @__PURE__ */ t(f, { children: [
51
+ s && /* @__PURE__ */ t("span", { className: n("label", { disabled: a }), children: [
52
+ s,
53
+ h && /* @__PURE__ */ e("span", { className: n("asterisk"), children: "*" })
54
+ ] }),
55
+ /* @__PURE__ */ t(
56
+ "div",
57
+ {
58
+ className: n("field", N, {
59
+ error: r,
60
+ touched: i,
61
+ disabled: a,
62
+ "default-width": C
63
+ }),
64
+ title: w,
65
+ children: [
66
+ d && /* @__PURE__ */ e("span", { className: n("icon-container-start"), children: /* @__PURE__ */ e("span", { className: n("icon"), children: d }) }),
67
+ /* @__PURE__ */ t("span", { className: n("input-container"), children: [
68
+ /* @__PURE__ */ e(
69
+ "input",
70
+ {
71
+ ref: b,
72
+ type: k,
73
+ className: n("input"),
74
+ value: c,
75
+ disabled: a,
76
+ onChange: u,
77
+ ...v
78
+ }
79
+ ),
80
+ _ && !c && /* @__PURE__ */ t("span", { className: n("placeholder"), children: [
81
+ _,
82
+ h && !s && /* @__PURE__ */ e("span", { className: n("asterisk") })
83
+ ] })
84
+ ] }),
85
+ x && /* @__PURE__ */ e("span", { className: n("icon-container-end"), children: /* @__PURE__ */ e("span", { className: n("icon"), children: x }) }),
86
+ L && /* @__PURE__ */ e("span", { className: n("icon-container-end"), children: /* @__PURE__ */ e("button", { type: "button", className: n("clear-icon", { disabled: a }), onClick: E, children: /* @__PURE__ */ e(R, {}) }) })
87
+ ]
88
+ }
89
+ ),
90
+ (r && i || l) && /* @__PURE__ */ e("div", { className: n("additional-content", { disabled: a }), children: r && i ? /* @__PURE__ */ t(f, { children: [
91
+ /* @__PURE__ */ e("span", { className: n("text", "error-text"), children: r }),
92
+ g && m
93
+ ] }) : l && m })
94
+ ] });
95
+ }
96
+ );
97
+ export {
98
+ Q as F
99
+ };
@@ -0,0 +1,8 @@
1
+ import { F as o } from "./fieldText-9621b0b7.js";
2
+ import "react/jsx-runtime";
3
+ import "react";
4
+ import "./bind-06a7ff84.js";
5
+ export {
6
+ o as FieldText,
7
+ o as default
8
+ };
package/dist/index.js CHANGED
@@ -1,13 +1,20 @@
1
- import { B as p } from "./button-a4d3df83.js";
2
- import { C as a } from "./checkbox-3fd4bcc1.js";
3
- import { S as f } from "./systemMessage-55cf51f4.js";
4
- import { T as h } from "./themeProvider-5800417e.js";
1
+ import { B as x } from "./button-d4944dbc.js";
2
+ import { C as f } from "./checkbox-7736509c.js";
3
+ import { S as T } from "./systemMessage-62c3133d.js";
4
+ import { F as l } from "./fieldText-9621b0b7.js";
5
+ import { T as C } from "./themeProvider-5800417e.js";
6
+ import { Modal as M } from "./modal.js";
5
7
  import "react/jsx-runtime";
6
8
  import "react";
7
- import "./bind-e1346f99.js";
9
+ import "./bind-06a7ff84.js";
10
+ import "./key-codes-abbe7725.js";
11
+ import "rc-scrollbars";
12
+ import "framer-motion";
8
13
  export {
9
- p as Button,
10
- a as Checkbox,
11
- f as SystemMessage,
12
- h as ThemeProvider
14
+ x as Button,
15
+ f as Checkbox,
16
+ l as FieldText,
17
+ M as Modal,
18
+ T as SystemMessage,
19
+ C as ThemeProvider
13
20
  };
@@ -0,0 +1,4 @@
1
+ var _ = /* @__PURE__ */ ((E) => (E[E.SPACE_KEY_CODE = 32] = "SPACE_KEY_CODE", E[E.ENTER_KEY_CODE = 13] = "ENTER_KEY_CODE", E[E.ESCAPE_KEY_CODE = 27] = "ESCAPE_KEY_CODE", E))(_ || {});
2
+ export {
3
+ _ as K
4
+ };
package/dist/modal.js ADDED
@@ -0,0 +1,137 @@
1
+ import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
+ import * as z from "react";
3
+ import { useEffect as m, useState as g, useRef as $ } from "react";
4
+ import { Scrollbars as A } from "rc-scrollbars";
5
+ import { AnimatePresence as T, motion as D } from "framer-motion";
6
+ import { c as _ } from "./bind-06a7ff84.js";
7
+ import { K as W } from "./key-codes-abbe7725.js";
8
+ import { B as x } from "./button-d4944dbc.js";
9
+ function j(e, n) {
10
+ m(() => {
11
+ if (!n)
12
+ return;
13
+ const t = (a) => {
14
+ e && e.current && !e.current.contains(a.target) && n(a);
15
+ };
16
+ return document.addEventListener("pointerdown", t), () => {
17
+ document.removeEventListener("pointerdown", t);
18
+ };
19
+ }, [e, n]);
20
+ }
21
+ const K = () => {
22
+ const [e, n] = g({ width: 0, height: 0 });
23
+ return m(() => {
24
+ const t = () => {
25
+ n({
26
+ width: window.innerWidth,
27
+ height: window.innerHeight
28
+ });
29
+ };
30
+ return window.addEventListener("resize", t), t(), () => window.removeEventListener("resize", t);
31
+ }, []), e;
32
+ }, I = {
33
+ "modal-content": "_modal-content_xak18_1"
34
+ }, F = _.bind(I), P = ({ children: e }) => /* @__PURE__ */ o("div", { className: F("modal-content"), children: e }), B = {
35
+ "buttons-block": "_buttons-block_1dgm4_1",
36
+ "button-container": "_button-container_1dgm4_5",
37
+ "modal-footer": "_modal-footer_1dgm4_14",
38
+ "with-extra-node": "_with-extra-node_1dgm4_21",
39
+ "size-small": "_size-small_1dgm4_25"
40
+ }, c = _.bind(B), G = ({
41
+ footerNode: e,
42
+ closeHandler: n,
43
+ okButton: t,
44
+ cancelButton: a,
45
+ size: s
46
+ }) => /* @__PURE__ */ l("div", { className: c("modal-footer", { "with-extra-node": e, [`size-${s}`]: s }), children: [
47
+ e && e,
48
+ /* @__PURE__ */ l("div", { className: c("buttons-block"), children: [
49
+ a && /* @__PURE__ */ o("div", { className: c("button-container"), children: /* @__PURE__ */ o(
50
+ x,
51
+ {
52
+ variant: "ghost",
53
+ adjustWidthOn: s === "small" ? "parent" : "content",
54
+ onClick: n,
55
+ ...a
56
+ }
57
+ ) }),
58
+ t && /* @__PURE__ */ o("div", { className: c("button-container"), children: /* @__PURE__ */ o(x, { adjustWidthOn: s === "small" ? "parent" : "content", ...t }) })
59
+ ] })
60
+ ] }), X = (e) => /* @__PURE__ */ z.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "#C1C7D0", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ z.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.732184 15.2698C0.330645 14.8683 0.330646 14.2172 0.732185 13.8157L6.54859 7.99928L0.732185 2.18288C0.330646 1.78134 0.330645 1.13031 0.732184 0.728774C1.13372 0.327234 1.78475 0.327234 2.18629 0.728774L8.00269 6.54518L13.8191 0.728767C14.2206 0.327228 14.8717 0.327227 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.18629 15.2698C1.78475 15.6713 1.13372 15.6713 0.732184 15.2698Z" })), Y = {
61
+ "modal-header": "_modal-header_12y1g_1",
62
+ "modal-header-content": "_modal-header-content_12y1g_11",
63
+ "modal-title": "_modal-title_12y1g_20",
64
+ "close-modal-icon": "_close-modal-icon_12y1g_28"
65
+ }, r = _.bind(Y), Z = ({ title: e, onClose: n, headerNode: t }) => /* @__PURE__ */ l("div", { className: r("modal-header"), children: [
66
+ /* @__PURE__ */ l("div", { className: r("modal-header-content"), children: [
67
+ e && /* @__PURE__ */ o("span", { className: r("modal-title"), children: e }),
68
+ t && t
69
+ ] }),
70
+ /* @__PURE__ */ o("span", { className: r("close-modal-icon"), onClick: n, children: /* @__PURE__ */ o(X, {}) })
71
+ ] }), q = "_modal_10zov_1", J = {
72
+ modal: q,
73
+ "overlay-default": "_overlay-default_10zov_11",
74
+ "overlay-light-cyan": "_overlay-light-cyan_10zov_16",
75
+ "scrolling-content": "_scrolling-content_10zov_21",
76
+ "modal-window": "_modal-window_10zov_28",
77
+ "size-default": "_size-default_10zov_45",
78
+ "size-small": "_size-small_10zov_57",
79
+ "size-large": "_size-large_10zov_69"
80
+ }, E = _.bind(J), Q = 0.9, U = 176, se = ({
81
+ title: e,
82
+ headerNode: n,
83
+ children: t,
84
+ footerNode: a,
85
+ okButton: s,
86
+ cancelButton: b,
87
+ className: L,
88
+ size: h = "default",
89
+ onClose: H = () => {
90
+ },
91
+ overlay: v = "default",
92
+ allowCloseOutside: M = !0
93
+ }) => {
94
+ const [N, f] = g(!1), [k, O] = g(0), i = $(null), p = K(), y = p.height, R = y * Q, u = (y - k) / 2, S = R - U, d = () => {
95
+ f(!1);
96
+ }, C = (w) => {
97
+ w.keyCode === W.ESCAPE_KEY_CODE && d();
98
+ };
99
+ return m(() => {
100
+ if (i && i.current) {
101
+ const { clientHeight: w } = i.current;
102
+ O(w);
103
+ }
104
+ }, [t, p]), m(() => (f(!0), i && i.current && i.current.focus(), document.addEventListener("keydown", C, !1), () => document.removeEventListener("keydown", C, !1)), []), j(i, M ? d : void 0), /* @__PURE__ */ o(T, { onExitComplete: H, children: N && /* @__PURE__ */ o("div", { className: E("modal", { [`overlay-${v}`]: v }), children: /* @__PURE__ */ l(
105
+ D.div,
106
+ {
107
+ className: E("modal-window", { [`size-${h}`]: h }, L),
108
+ ref: i,
109
+ tabIndex: 0,
110
+ initial: { opacity: 0, marginTop: -u },
111
+ animate: { opacity: 1, marginTop: u },
112
+ exit: { opacity: 0, marginTop: -u },
113
+ transition: { duration: 0.3 },
114
+ children: [
115
+ /* @__PURE__ */ o(Z, { title: e, headerNode: n, onClose: d }),
116
+ /* @__PURE__ */ o(A, { autoHeight: !0, autoHeightMax: S, hideTracksWhenNotNeeded: !0, children: /* @__PURE__ */ o(P, { children: t }) }),
117
+ /* @__PURE__ */ o(
118
+ G,
119
+ {
120
+ size: h,
121
+ footerNode: a,
122
+ okButton: s,
123
+ cancelButton: b,
124
+ closeHandler: d
125
+ }
126
+ )
127
+ ]
128
+ },
129
+ "modal-window"
130
+ ) }) });
131
+ };
132
+ export {
133
+ se as Modal,
134
+ P as ModalContent,
135
+ G as ModalFooter,
136
+ Z as ModalHeader
137
+ };