@reportportal/ui-kit 0.0.1-alpha.5 → 0.0.1-alpha.6

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 (45) hide show
  1. package/dist/bubblesLoader-9bec3797.js +17 -0
  2. package/dist/bubblesLoader.js +7 -0
  3. package/dist/checkbox-fdc44740.js +68 -0
  4. package/dist/checkbox.js +2 -2
  5. package/dist/clear-4963efcd.js +5 -0
  6. package/dist/common/constants/keyCodes.d.ts +24 -0
  7. package/dist/components/bubblesLoader/bubblesLoader.d.ts +7 -0
  8. package/dist/components/bubblesLoader/index.d.ts +3 -0
  9. package/dist/components/checkbox/checkbox.d.ts +0 -1
  10. package/dist/components/dropdown/constants.d.ts +3 -0
  11. package/dist/components/dropdown/dropdown.d.ts +24 -0
  12. package/dist/components/dropdown/dropdownOption/dropdownOption.d.ts +3 -0
  13. package/dist/components/dropdown/dropdownOption/index.d.ts +3 -0
  14. package/dist/components/dropdown/index.d.ts +3 -0
  15. package/dist/components/dropdown/types.d.ts +20 -0
  16. package/dist/components/dropdown/utils.d.ts +4 -0
  17. package/dist/components/fieldNumber/constants.d.ts +4 -0
  18. package/dist/components/fieldNumber/fieldNumber.d.ts +18 -0
  19. package/dist/components/fieldNumber/index.d.ts +3 -0
  20. package/dist/components/icon/icon.d.ts +11 -0
  21. package/dist/components/icon/icons.d.ts +21 -0
  22. package/dist/components/icon/index.d.ts +3 -0
  23. package/dist/components/index.d.ts +5 -0
  24. package/dist/components/toggle/index.d.ts +3 -0
  25. package/dist/components/toggle/toggle.d.ts +11 -0
  26. package/dist/dropdown-45e7bc7d.js +204 -0
  27. package/dist/dropdown.js +15 -0
  28. package/dist/fieldNumber-8417cd65.js +132 -0
  29. package/dist/fieldNumber.js +11 -0
  30. package/dist/fieldText-c7085849.js +99 -0
  31. package/dist/fieldText.js +2 -1
  32. package/dist/icon-71262f5c.js +26 -0
  33. package/dist/icon.js +9 -0
  34. package/dist/index.js +27 -13
  35. package/dist/keyCodes-f63c0e11.js +4 -0
  36. package/dist/modal.js +85 -94
  37. package/dist/style.css +1 -1
  38. package/dist/toggle-5b3d8333.js +67 -0
  39. package/dist/toggle.js +9 -0
  40. package/dist/useOnClickOutside-c332f7d3.js +16 -0
  41. package/package.json +5 -2
  42. package/dist/checkbox-7736509c.js +0 -70
  43. package/dist/common/constants/key-codes.d.ts +0 -5
  44. package/dist/fieldText-9621b0b7.js +0 -99
  45. package/dist/key-codes-abbe7725.js +0 -4
@@ -0,0 +1,132 @@
1
+ import { jsxs as O, jsx as r } from "react/jsx-runtime";
2
+ import { useRef as A, useMemo as j } from "react";
3
+ import { c as T } from "./bind-06a7ff84.js";
4
+ import { K as _ } from "./keyCodes-f63c0e11.js";
5
+ import { I as d } from "./icon-71262f5c.js";
6
+ const W = 5, D = 16, g = [
7
+ _.TAB_KEY_CODE,
8
+ _.BACKSPACE_KEY_CODE,
9
+ _.ARROW_LEFT_KEY_CODE,
10
+ _.ARROW_UP_KEY_CODE,
11
+ _.ARROW_RIGHT_KEY_CODE,
12
+ _.ARROW_DOWN_KEY_CODE,
13
+ _.DELETE_KEY_CODE,
14
+ _.NUM_LOCK_0_KEY_CODE,
15
+ _.NUM_LOCK_1_KEY_CODE,
16
+ _.NUM_LOCK_2_KEY_CODE,
17
+ _.NUM_LOCK_3_KEY_CODE,
18
+ _.NUM_LOCK_4_KEY_CODE,
19
+ _.NUM_LOCK_5_KEY_CODE,
20
+ _.NUM_LOCK_6_KEY_CODE,
21
+ _.NUM_LOCK_7_KEY_CODE,
22
+ _.NUM_LOCK_8_KEY_CODE,
23
+ _.NUM_LOCK_9_KEY_CODE
24
+ ], y = "_disabled_1jvvf_6", I = "_label_1jvvf_10", w = "_sign_1jvvf_21", b = "_error_1jvvf_36", k = "_touched_1jvvf_36", B = "_filled_1jvvf_41", F = "_input_1jvvf_26", H = {
25
+ "field-number": "_field-number_1jvvf_1",
26
+ disabled: y,
27
+ label: I,
28
+ sign: w,
29
+ "input-container": "_input-container_1jvvf_26",
30
+ error: b,
31
+ touched: k,
32
+ filled: B,
33
+ "input-field": "_input-field_1jvvf_48",
34
+ input: F
35
+ }, c = T.bind(H), q = ({
36
+ value: e = "",
37
+ placeholder: a = "0",
38
+ disabled: s = !1,
39
+ onChange: l,
40
+ onFocus: f,
41
+ onBlur: S,
42
+ label: u,
43
+ postfix: i = "",
44
+ min: o = 0,
45
+ max: E = Number.MAX_SAFE_INTEGER,
46
+ title: p,
47
+ error: N,
48
+ touched: h = !1,
49
+ ...m
50
+ }) => {
51
+ const C = A(null), Y = (n) => {
52
+ let t = n.target.value.replace(/^0(?=\d+|^\d)/g, "");
53
+ if (t === "") {
54
+ l("");
55
+ return;
56
+ }
57
+ t = +t, t >= o && t <= E && l(t);
58
+ }, v = (n) => {
59
+ const { keyCode: t } = n;
60
+ g.includes(t) || (t < _.NUMBER_START_KEY_CODE || t > _.NUMBER_END_KEY_CODE || n.shiftKey) && n.preventDefault();
61
+ }, L = () => {
62
+ const n = +e - 1;
63
+ n >= o && n <= E && l(n);
64
+ }, M = () => {
65
+ const n = +e + 1;
66
+ n >= o && n <= E && l(n);
67
+ }, K = a + i, R = j(() => {
68
+ let n = (String(e) || K).length;
69
+ return i && !e && (n += 1), n > D ? `${D}ch` : `${n || W}ch`;
70
+ }, [K, i, e]), U = () => {
71
+ C && C.current && C.current.focus(), f && f();
72
+ };
73
+ return /* @__PURE__ */ O("div", { className: c("field-number", { disabled: s }), children: [
74
+ u && /* @__PURE__ */ r("span", { className: c("label"), children: u }),
75
+ /* @__PURE__ */ O(
76
+ "div",
77
+ {
78
+ className: c("input-container", {
79
+ filled: !!e || e === 0,
80
+ error: N,
81
+ disabled: s,
82
+ touched: h
83
+ }),
84
+ title: p,
85
+ children: [
86
+ /* @__PURE__ */ r(
87
+ d,
88
+ {
89
+ icon: "minus",
90
+ className: c("sign", "minus"),
91
+ disabled: s,
92
+ onClick: L
93
+ }
94
+ ),
95
+ /* @__PURE__ */ O("span", { className: c("input-field", { disabled: s }), onClick: U, children: [
96
+ /* @__PURE__ */ r(
97
+ "input",
98
+ {
99
+ ref: C,
100
+ className: c("input"),
101
+ type: "number",
102
+ value: e,
103
+ placeholder: K,
104
+ disabled: s,
105
+ min: o,
106
+ max: E,
107
+ onKeyDown: s ? void 0 : v,
108
+ onChange: s ? void 0 : Y,
109
+ onFocus: s ? void 0 : f,
110
+ style: { width: R },
111
+ ...m
112
+ }
113
+ ),
114
+ !!i && (e === 0 || !!e) && /* @__PURE__ */ r("span", { children: i.slice(0, 1) })
115
+ ] }),
116
+ /* @__PURE__ */ r(
117
+ d,
118
+ {
119
+ icon: "plus",
120
+ className: c("sign", "plus"),
121
+ disabled: s,
122
+ onClick: M
123
+ }
124
+ )
125
+ ]
126
+ }
127
+ )
128
+ ] });
129
+ };
130
+ export {
131
+ q as F
132
+ };
@@ -0,0 +1,11 @@
1
+ import { F as m } from "./fieldNumber-8417cd65.js";
2
+ import "react/jsx-runtime";
3
+ import "react";
4
+ import "./bind-06a7ff84.js";
5
+ import "./keyCodes-f63c0e11.js";
6
+ import "./icon-71262f5c.js";
7
+ import "./clear-4963efcd.js";
8
+ export {
9
+ m as FieldNumber,
10
+ m as default
11
+ };
@@ -0,0 +1,99 @@
1
+ import { jsx as e, jsxs as t, Fragment as h } from "react/jsx-runtime";
2
+ import { forwardRef as S } from "react";
3
+ import { c as v } from "./bind-06a7ff84.js";
4
+ import { S as C } from "./clear-4963efcd.js";
5
+ const E = "_label_11rxn_18", z = "_asterisk_11rxn_27", A = "_disabled_11rxn_33", B = "_field_11rxn_37", D = "_error_11rxn_51", G = "_touched_11rxn_51", H = "_input_11rxn_65", J = "_placeholder_11rxn_88", K = "_icon_11rxn_1", L = "_text_11rxn_151", M = {
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: E,
10
+ asterisk: z,
11
+ disabled: A,
12
+ field: B,
13
+ error: D,
14
+ touched: G,
15
+ "default-width": "_default-width_11rxn_61",
16
+ "input-container": "_input-container_11rxn_65",
17
+ input: H,
18
+ placeholder: J,
19
+ icon: K,
20
+ "clear-icon": "_clear-icon_11rxn_108",
21
+ "additional-content": "_additional-content_11rxn_144",
22
+ text: L,
23
+ "error-text": "_error-text_11rxn_159",
24
+ "help-text": "_help-text_11rxn_163"
25
+ }, n = v.bind(M), T = S(
26
+ ({
27
+ value: s,
28
+ className: f,
29
+ error: c,
30
+ placeholder: l,
31
+ disabled: a = !1,
32
+ onChange: N,
33
+ touched: r = !1,
34
+ title: u,
35
+ label: i,
36
+ helpText: o,
37
+ defaultWidth: k = !0,
38
+ startIcon: _,
39
+ endIcon: d,
40
+ clearable: b = !1,
41
+ onClear: x,
42
+ isRequired: p = !1,
43
+ hasDoubleMessage: w = !1,
44
+ type: F = "text",
45
+ ...g
46
+ }, j) => {
47
+ const y = () => {
48
+ x && x(s);
49
+ }, m = /* @__PURE__ */ e("span", { className: n("text", "help-text"), children: o });
50
+ return /* @__PURE__ */ t(h, { children: [
51
+ i && /* @__PURE__ */ t("span", { className: n("label", { disabled: a }), children: [
52
+ i,
53
+ p && /* @__PURE__ */ e("span", { className: n("asterisk"), children: "*" })
54
+ ] }),
55
+ /* @__PURE__ */ t(
56
+ "div",
57
+ {
58
+ className: n("field", f, {
59
+ error: c,
60
+ touched: r,
61
+ disabled: a,
62
+ "default-width": k
63
+ }),
64
+ title: u,
65
+ children: [
66
+ _ && /* @__PURE__ */ e("span", { className: n("icon-container-start"), children: /* @__PURE__ */ e("span", { className: n("icon"), children: _ }) }),
67
+ /* @__PURE__ */ t("span", { className: n("input-container"), children: [
68
+ /* @__PURE__ */ e(
69
+ "input",
70
+ {
71
+ ref: j,
72
+ type: F,
73
+ className: n("input"),
74
+ value: s,
75
+ disabled: a,
76
+ onChange: N,
77
+ ...g
78
+ }
79
+ ),
80
+ l && !s && /* @__PURE__ */ t("span", { className: n("placeholder"), children: [
81
+ l,
82
+ p && !i && /* @__PURE__ */ e("span", { className: n("asterisk") })
83
+ ] })
84
+ ] }),
85
+ d && /* @__PURE__ */ e("span", { className: n("icon-container-end"), children: /* @__PURE__ */ e("span", { className: n("icon"), children: d }) }),
86
+ b && /* @__PURE__ */ e("span", { className: n("icon-container-end"), children: /* @__PURE__ */ e("button", { type: "button", className: n("clear-icon", { disabled: a }), onClick: y, children: /* @__PURE__ */ e(C, {}) }) })
87
+ ]
88
+ }
89
+ ),
90
+ (c && r || o) && /* @__PURE__ */ e("div", { className: n("additional-content", { disabled: a }), children: c && r ? /* @__PURE__ */ t(h, { children: [
91
+ /* @__PURE__ */ e("span", { className: n("text", "error-text"), children: c }),
92
+ w && m
93
+ ] }) : o && m })
94
+ ] });
95
+ }
96
+ );
97
+ export {
98
+ T as F
99
+ };
package/dist/fieldText.js CHANGED
@@ -1,7 +1,8 @@
1
- import { F as o } from "./fieldText-9621b0b7.js";
1
+ import { F as o } from "./fieldText-c7085849.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "./bind-06a7ff84.js";
5
+ import "./clear-4963efcd.js";
5
6
  export {
6
7
  o as FieldText,
7
8
  o as default
@@ -0,0 +1,26 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { c as i } from "./bind-06a7ff84.js";
3
+ import { S as c } from "./clear-4963efcd.js";
4
+ import * as l from "react";
5
+ const L = (e) => /* @__PURE__ */ l.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ l.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" })), d = (e) => /* @__PURE__ */ l.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ l.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" })), a = (e) => /* @__PURE__ */ l.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ l.createElement("path", { d: "M9.80051 6.3661C9.95672 6.20989 10.21 6.20989 10.3662 6.3661L10.6338 6.63375C10.7901 6.78996 10.7901 7.04323 10.6338 7.19944L8.83331 8.99996L10.6338 10.8005C10.79 10.9567 10.79 11.2099 10.6338 11.3662L10.3662 11.6338C10.21 11.79 9.95669 11.79 9.80048 11.6338L7.99998 9.8333L6.19953 11.6338C6.04332 11.79 5.79005 11.79 5.63384 11.6338L5.36619 11.3661C5.20998 11.2099 5.20998 10.9566 5.36619 10.8004L7.16665 8.99996L5.36617 7.19949C5.20996 7.04328 5.20996 6.79001 5.36617 6.6338L5.63382 6.36615C5.79003 6.20994 6.04329 6.20994 6.1995 6.36615L7.99998 8.16663L9.80051 6.3661Z", fill: "#A2AAB5" }), /* @__PURE__ */ l.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.99878 3V2C4.99878 1.44772 5.44649 1 5.99878 1H9.99878C10.5511 1 10.9988 1.44772 10.9988 2V3H14.5C14.7761 3 15 3.22386 15 3.5C15 3.77614 14.7761 4 14.5 4H13.4167L12.6146 13.6246C12.5498 14.402 11.8999 15 11.1198 15H4.8802C4.10007 15 3.45017 14.402 3.38538 13.6246L2.58333 4H1.5C1.22386 4 1 3.77614 1 3.5C1 3.22386 1.22386 3 1.5 3H4.99878ZM5.99878 2H9.99878V3H5.99878V2ZM3.5868 4L4.38193 13.5415C4.40352 13.8007 4.62016 14 4.8802 14H11.1198C11.3798 14 11.5965 13.8007 11.6181 13.5415L12.4132 4H3.5868Z", fill: "#A2AAB5" })), r = (e) => /* @__PURE__ */ l.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "#C1C7D0", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ l.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.00117 2.62046C7.63142 2.6189 7.33294 2.91738 7.3345 3.28712L7.35159 7.35159L3.28712 7.3345C2.91738 7.33295 2.6189 7.63142 2.62045 8.00117C2.62201 8.37091 2.92301 8.67191 3.29275 8.67346L7.35722 8.69056L7.37391 12.6599C7.37547 13.0296 7.67647 13.3306 8.04621 13.3322C8.41596 13.3337 8.71443 13.0352 8.71288 12.6655L8.69619 8.69619L12.6655 8.71288C13.0352 8.71444 13.3337 8.41596 13.3322 8.04621C13.3306 7.67647 13.0296 7.37547 12.6599 7.37392L8.69056 7.35722L8.67346 3.29275C8.67191 2.92301 8.37091 2.62201 8.00117 2.62046Z" })), w = (e) => /* @__PURE__ */ l.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "#C1C7D0", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ l.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.31082 7.31081C2.94108 7.30926 2.6426 7.60773 2.64415 7.97748C2.64571 8.34722 2.9467 8.64822 3.31645 8.64977L12.6892 8.68919C13.0589 8.69074 13.3574 8.39227 13.3559 8.02252C13.3543 7.65278 13.0533 7.35178 12.6836 7.35023L3.31082 7.31081Z" })), v = {
6
+ clear: c,
7
+ close: L,
8
+ dropdown: d,
9
+ delete: a,
10
+ plus: r,
11
+ minus: w
12
+ }, g = "_icon_pgc7q_1", h = "_disabled_pgc7q_4", m = {
13
+ icon: g,
14
+ disabled: h
15
+ }, p = i.bind(m), A = ({
16
+ icon: e,
17
+ className: o,
18
+ disabled: t = !1,
19
+ onClick: s
20
+ }) => {
21
+ const C = v[e];
22
+ return /* @__PURE__ */ n("span", { className: p("icon", o, { disabled: t }), onClick: t ? void 0 : s, children: /* @__PURE__ */ n(C, {}) });
23
+ };
24
+ export {
25
+ A as I
26
+ };
package/dist/icon.js ADDED
@@ -0,0 +1,9 @@
1
+ import { I as r } from "./icon-71262f5c.js";
2
+ import "react/jsx-runtime";
3
+ import "./bind-06a7ff84.js";
4
+ import "./clear-4963efcd.js";
5
+ import "react";
6
+ export {
7
+ r as Icon,
8
+ r as default
9
+ };
package/dist/index.js CHANGED
@@ -1,20 +1,34 @@
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";
1
+ import { B as l } from "./button-d4944dbc.js";
2
+ import { C as b } from "./checkbox-fdc44740.js";
3
+ import { S as F } from "./systemMessage-62c3133d.js";
4
+ import { F as n } from "./fieldText-c7085849.js";
5
+ import { T as c } from "./themeProvider-5800417e.js";
6
+ import { Modal as C } from "./modal.js";
7
+ import { D as I } from "./dropdown-45e7bc7d.js";
8
+ import { T as S } from "./toggle-5b3d8333.js";
9
+ import { I as v } from "./icon-71262f5c.js";
10
+ import { F as y } from "./fieldNumber-8417cd65.js";
11
+ import { B as N } from "./bubblesLoader-9bec3797.js";
7
12
  import "react/jsx-runtime";
8
13
  import "react";
9
14
  import "./bind-06a7ff84.js";
10
- import "./key-codes-abbe7725.js";
15
+ import "./keyCodes-f63c0e11.js";
16
+ import "./clear-4963efcd.js";
11
17
  import "rc-scrollbars";
12
18
  import "framer-motion";
19
+ import "./useOnClickOutside-c332f7d3.js";
20
+ import "react-popper";
21
+ import "downshift";
13
22
  export {
14
- x as Button,
15
- f as Checkbox,
16
- l as FieldText,
17
- M as Modal,
18
- T as SystemMessage,
19
- C as ThemeProvider
23
+ N as BubblesLoader,
24
+ l as Button,
25
+ b as Checkbox,
26
+ I as Dropdown,
27
+ y as FieldNumber,
28
+ n as FieldText,
29
+ v as Icon,
30
+ C as Modal,
31
+ F as SystemMessage,
32
+ c as ThemeProvider,
33
+ S as Toggle
20
34
  };
@@ -0,0 +1,4 @@
1
+ var E = /* @__PURE__ */ ((_) => (_[_.BACKSPACE_KEY_CODE = 8] = "BACKSPACE_KEY_CODE", _[_.TAB_KEY_CODE = 9] = "TAB_KEY_CODE", _[_.ENTER_KEY_CODE = 13] = "ENTER_KEY_CODE", _[_.ESCAPE_KEY_CODE = 27] = "ESCAPE_KEY_CODE", _[_.SPACE_KEY_CODE = 32] = "SPACE_KEY_CODE", _[_.ARROW_LEFT_KEY_CODE = 37] = "ARROW_LEFT_KEY_CODE", _[_.ARROW_UP_KEY_CODE = 38] = "ARROW_UP_KEY_CODE", _[_.ARROW_RIGHT_KEY_CODE = 39] = "ARROW_RIGHT_KEY_CODE", _[_.ARROW_DOWN_KEY_CODE = 40] = "ARROW_DOWN_KEY_CODE", _[_.DELETE_KEY_CODE = 46] = "DELETE_KEY_CODE", _[_.NUMBER_START_KEY_CODE = 48] = "NUMBER_START_KEY_CODE", _[_.NUMBER_END_KEY_CODE = 57] = "NUMBER_END_KEY_CODE", _[_.NUM_LOCK_0_KEY_CODE = 96] = "NUM_LOCK_0_KEY_CODE", _[_.NUM_LOCK_1_KEY_CODE = 97] = "NUM_LOCK_1_KEY_CODE", _[_.NUM_LOCK_2_KEY_CODE = 98] = "NUM_LOCK_2_KEY_CODE", _[_.NUM_LOCK_3_KEY_CODE = 99] = "NUM_LOCK_3_KEY_CODE", _[_.NUM_LOCK_4_KEY_CODE = 100] = "NUM_LOCK_4_KEY_CODE", _[_.NUM_LOCK_5_KEY_CODE = 101] = "NUM_LOCK_5_KEY_CODE", _[_.NUM_LOCK_6_KEY_CODE = 102] = "NUM_LOCK_6_KEY_CODE", _[_.NUM_LOCK_7_KEY_CODE = 103] = "NUM_LOCK_7_KEY_CODE", _[_.NUM_LOCK_8_KEY_CODE = 104] = "NUM_LOCK_8_KEY_CODE", _[_.NUM_LOCK_9_KEY_CODE = 105] = "NUM_LOCK_9_KEY_CODE", _))(E || {});
2
+ export {
3
+ E as K
4
+ };
package/dist/modal.js CHANGED
@@ -1,75 +1,65 @@
1
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
2
- import * as x 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 E } from "./button-d4944dbc.js";
9
- function j(e, n) {
10
- m(() => {
11
- if (!n)
12
- return;
13
- const t = (i) => {
14
- e && e.current && !e.current.contains(i.target) && n(i);
15
- };
16
- return document.addEventListener("pointerdown", t), () => {
17
- document.removeEventListener("pointerdown", t);
18
- };
19
- }, [e, n]);
20
- }
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import { useState as w, useEffect as f, useRef as R } from "react";
3
+ import { Scrollbars as T } from "rc-scrollbars";
4
+ import { AnimatePresence as L, motion as W } from "framer-motion";
5
+ import { c as m } from "./bind-06a7ff84.js";
6
+ import { u as D } from "./useOnClickOutside-c332f7d3.js";
7
+ import { K as I } from "./keyCodes-f63c0e11.js";
8
+ import { B as b } from "./button-d4944dbc.js";
9
+ import { I as j } from "./icon-71262f5c.js";
10
+ import "./clear-4963efcd.js";
21
11
  const K = () => {
22
- const [e, n] = g({ width: 0, height: 0 });
23
- return m(() => {
24
- const t = () => {
25
- n({
12
+ const [t, a] = w({ width: 0, height: 0 });
13
+ return f(() => {
14
+ const o = () => {
15
+ a({
26
16
  width: window.innerWidth,
27
17
  height: window.innerHeight
28
18
  });
29
19
  };
30
- return window.addEventListener("resize", t), t(), () => window.removeEventListener("resize", t);
31
- }, []), e;
32
- }, I = {
20
+ return window.addEventListener("resize", o), o(), () => window.removeEventListener("resize", o);
21
+ }, []), t;
22
+ }, F = {
33
23
  "modal-content": "_modal-content_xak18_1"
34
- }, F = _.bind(I), P = ({ children: e }) => /* @__PURE__ */ o("div", { className: F("modal-content"), children: e }), B = {
24
+ }, P = m.bind(F), G = ({ children: t }) => /* @__PURE__ */ e("div", { className: P("modal-content"), children: t }), X = {
35
25
  "buttons-block": "_buttons-block_1dgm4_1",
36
26
  "button-container": "_button-container_1dgm4_5",
37
27
  "modal-footer": "_modal-footer_1dgm4_14",
38
28
  "with-extra-node": "_with-extra-node_1dgm4_21",
39
29
  "size-small": "_size-small_1dgm4_25"
40
- }, c = _.bind(B), G = ({
41
- footerNode: e,
42
- closeHandler: n,
43
- okButton: t,
44
- cancelButton: i,
45
- size: l
46
- }) => /* @__PURE__ */ s("div", { className: c("modal-footer", { "with-extra-node": e, [`size-${l}`]: l }), children: [
47
- e && e,
48
- /* @__PURE__ */ s("div", { className: c("buttons-block"), children: [
49
- i && /* @__PURE__ */ o("div", { className: c("button-container"), children: /* @__PURE__ */ o(
50
- E,
30
+ }, c = m.bind(X), Y = ({
31
+ footerNode: t,
32
+ closeHandler: a,
33
+ okButton: o,
34
+ cancelButton: s,
35
+ size: i
36
+ }) => /* @__PURE__ */ l("div", { className: c("modal-footer", { "with-extra-node": t, [`size-${i}`]: i }), children: [
37
+ t && t,
38
+ /* @__PURE__ */ l("div", { className: c("buttons-block"), children: [
39
+ s && /* @__PURE__ */ e("div", { className: c("button-container"), children: /* @__PURE__ */ e(
40
+ b,
51
41
  {
52
42
  variant: "ghost",
53
- adjustWidthOn: l === "small" ? "parent" : "content",
54
- onClick: n,
55
- ...i
43
+ adjustWidthOn: i === "small" ? "parent" : "content",
44
+ onClick: a,
45
+ ...s
56
46
  }
57
47
  ) }),
58
- t && /* @__PURE__ */ o("div", { className: c("button-container"), children: /* @__PURE__ */ o(E, { adjustWidthOn: l === "small" ? "parent" : "content", ...t }) })
48
+ o && /* @__PURE__ */ e("div", { className: c("button-container"), children: /* @__PURE__ */ e(b, { adjustWidthOn: i === "small" ? "parent" : "content", ...o }) })
59
49
  ] })
60
- ] }), X = (e) => /* @__PURE__ */ x.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "#C1C7D0", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ x.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__ */ s("div", { className: r("modal-header"), children: [
66
- /* @__PURE__ */ s("div", { className: r("modal-header-content"), children: [
67
- e && /* @__PURE__ */ o("span", { className: r("modal-title"), children: e }),
68
- t && t
50
+ ] }), q = {
51
+ "modal-header": "_modal-header_1d7tr_1",
52
+ "modal-header-content": "_modal-header-content_1d7tr_11",
53
+ "modal-title": "_modal-title_1d7tr_20",
54
+ "close-modal-icon": "_close-modal-icon_1d7tr_28"
55
+ }, r = m.bind(q), B = ({ title: t, onClose: a, headerNode: o }) => /* @__PURE__ */ l("div", { className: r("modal-header"), children: [
56
+ /* @__PURE__ */ l("div", { className: r("modal-header-content"), children: [
57
+ t && /* @__PURE__ */ e("span", { className: r("modal-title"), children: t }),
58
+ o && o
69
59
  ] }),
70
- /* @__PURE__ */ o("span", { className: r("close-modal-icon"), onClick: n, children: /* @__PURE__ */ o(X, {}) })
71
- ] }), q = "_modal_8a5l_1", J = {
72
- modal: q,
60
+ /* @__PURE__ */ e(j, { icon: "close", className: r("close-modal-icon"), onClick: a })
61
+ ] }), J = "_modal_8a5l_1", Q = {
62
+ modal: J,
73
63
  "overlay-default": "_overlay-default_8a5l_11",
74
64
  "overlay-light-cyan": "_overlay-light-cyan_8a5l_16",
75
65
  "scrolling-content": "_scrolling-content_8a5l_21",
@@ -77,50 +67,51 @@ const K = () => {
77
67
  "size-default": "_size-default_8a5l_45",
78
68
  "size-small": "_size-small_8a5l_57",
79
69
  "size-large": "_size-large_8a5l_69"
80
- }, b = _.bind(J), Q = 0.9, U = 176, le = ({
81
- title: e,
82
- headerNode: n,
83
- children: t,
84
- footerNode: i,
85
- okButton: l,
86
- cancelButton: L,
87
- className: H,
88
- size: h = "default",
89
- onClose: M = () => {
70
+ }, E = m.bind(Q), U = 0.9, V = 176, ce = ({
71
+ title: t,
72
+ headerNode: a,
73
+ children: o,
74
+ footerNode: s,
75
+ okButton: i,
76
+ cancelButton: H,
77
+ className: M,
78
+ size: _ = "default",
79
+ onClose: z = () => {
90
80
  },
91
- overlay: f = "default",
92
- allowCloseOutside: z = !0
81
+ overlay: g = "default",
82
+ allowCloseOutside: N = !0
93
83
  }) => {
94
- const [N, v] = g(!1), [k, O] = g(0), a = $(null), p = K(), y = p.height, R = y * Q, u = (y - k) / 2, S = R - U, d = () => {
95
- v(!1);
96
- }, C = (w) => {
97
- w.keyCode === W.ESCAPE_KEY_CODE && d();
84
+ const [k, p] = w(!1), [C, O] = w(0), n = R(null), v = K(), y = v.height, $ = y * U, h = (y - C) / 2, A = $ - V, d = () => {
85
+ p(!1);
86
+ }, x = (u) => {
87
+ const { keyCode: S } = u;
88
+ S === I.ESCAPE_KEY_CODE && d();
98
89
  };
99
- return m(() => {
100
- if (a && a.current) {
101
- const { clientHeight: w } = a.current;
102
- O(w);
90
+ return f(() => {
91
+ if (n && n.current) {
92
+ const { clientHeight: u } = n.current;
93
+ O(u);
103
94
  }
104
- }, [t, p]), m(() => (v(!0), a && a.current && a.current.focus(), document.addEventListener("keydown", C, !1), () => document.removeEventListener("keydown", C, !1)), []), j(a, z ? d : void 0), /* @__PURE__ */ o(T, { onExitComplete: M, children: N && /* @__PURE__ */ o("div", { className: b("modal", { [`overlay-${f}`]: f }), children: /* @__PURE__ */ s(
105
- D.div,
95
+ }, [o, v]), f(() => (p(!0), n && n.current && n.current.focus(), document.addEventListener("keydown", x, !1), () => document.removeEventListener("keydown", x, !1)), []), D(n, N ? d : void 0), /* @__PURE__ */ e(L, { onExitComplete: z, children: k && /* @__PURE__ */ e("div", { className: E("modal", { [`overlay-${g}`]: g }), children: /* @__PURE__ */ l(
96
+ W.div,
106
97
  {
107
- className: b("modal-window", { [`size-${h}`]: h }, H),
108
- ref: a,
98
+ className: E("modal-window", { [`size-${_}`]: _ }, M),
99
+ ref: n,
109
100
  tabIndex: 0,
110
- initial: { opacity: 0, marginTop: -u },
111
- animate: { opacity: 1, marginTop: u },
112
- exit: { opacity: 0, marginTop: -u },
101
+ initial: { opacity: 0, marginTop: -h },
102
+ animate: { opacity: 1, marginTop: h },
103
+ exit: { opacity: 0, marginTop: -h },
113
104
  transition: { duration: 0.3 },
114
105
  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,
106
+ /* @__PURE__ */ e(B, { title: t, headerNode: a, onClose: d }),
107
+ /* @__PURE__ */ e(T, { autoHeight: !0, autoHeightMax: A, hideTracksWhenNotNeeded: !0, children: /* @__PURE__ */ e(G, { children: o }) }),
108
+ /* @__PURE__ */ e(
109
+ Y,
119
110
  {
120
- size: h,
121
- footerNode: i,
122
- okButton: l,
123
- cancelButton: L,
111
+ size: _,
112
+ footerNode: s,
113
+ okButton: i,
114
+ cancelButton: H,
124
115
  closeHandler: d
125
116
  }
126
117
  )
@@ -130,8 +121,8 @@ const K = () => {
130
121
  ) }) });
131
122
  };
132
123
  export {
133
- le as Modal,
134
- P as ModalContent,
135
- G as ModalFooter,
136
- Z as ModalHeader
124
+ ce as Modal,
125
+ G as ModalContent,
126
+ Y as ModalFooter,
127
+ B as ModalHeader
137
128
  };