@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.13",
3
+ "version": "0.0.1-alpha.15",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -29,7 +29,8 @@
29
29
  "classnames": "^2.3.2",
30
30
  "downshift": "^6.1.12",
31
31
  "framer-motion": "^10.15.2",
32
- "rc-scrollbars": "^1.1.6"
32
+ "rc-scrollbars": "^1.1.6",
33
+ "react-datepicker": "^7.3.0"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@storybook/addon-essentials": "^7.2.0",
@@ -42,10 +43,12 @@
42
43
  "@storybook/testing-library": "^0.2.0",
43
44
  "@types/node": "^20.4.5",
44
45
  "@types/react": "^18.3.3",
46
+ "@types/react-datepicker": "^6.2.0",
45
47
  "@types/react-dom": "^18.2.7",
46
48
  "@typescript-eslint/eslint-plugin": "^5.62.0",
47
49
  "@typescript-eslint/parser": "^5.62.0",
48
50
  "@vitejs/plugin-react": "^4.0.3",
51
+ "date-fns": "^3.6.0",
49
52
  "eslint": "^8.46.0",
50
53
  "eslint-config-airbnb-typescript": "^15.0.0",
51
54
  "eslint-config-prettier": "^8.10.0",
@@ -1,212 +0,0 @@
1
- import { jsx as a, 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 x } from "downshift";
7
- import { Scrollbars as de } from "rc-scrollbars";
8
- import { u as oe } from "./useOnClickOutside-c332f7d3.js";
9
- import { K as f } from "./keyCodes-f63c0e11.js";
10
- import { B as se } from "./baseIconButton-7bc53dec.js";
11
- const ae = (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_nx3fh_13", re = "_hidden_nx3fh_17", ie = "_selected_nx3fh_23", ce = "_hover_nx3fh_26", _e = {
12
- "dropdown-option": "_dropdown-option_nx3fh_1",
13
- disabled: le,
14
- hidden: re,
15
- selected: ie,
16
- hover: ce,
17
- "single-option": "_single-option_nx3fh_39",
18
- "sub-option": "_sub-option_nx3fh_45"
19
- }, P = A.bind(_e), he = F(
20
- (t, n) => {
21
- const {
22
- option: { value: s, disabled: i, hidden: O, label: l, title: d, groupRef: E },
23
- selected: D,
24
- onChange: p,
25
- render: g,
26
- highlightHovered: b,
27
- onMouseEnter: w
28
- } = t, N = () => {
29
- p && p(s);
30
- };
31
- return /* @__PURE__ */ a(
32
- "div",
33
- {
34
- className: P("dropdown-option", {
35
- selected: D,
36
- disabled: i,
37
- hidden: O,
38
- hover: b
39
- }),
40
- title: i && d || void 0,
41
- onClick: N,
42
- ref: n,
43
- onMouseEnter: w,
44
- children: /* @__PURE__ */ a("div", { className: P("single-option", { "sub-option": !!E }), children: g ? g(t) : l })
45
- }
46
- );
47
- }
48
- ), fe = [
49
- f.ENTER_KEY_CODE,
50
- f.SPACE_KEY_CODE,
51
- f.ARROW_DOWN_KEY_CODE
52
- ], ge = [f.ESCAPE_KEY_CODE, f.TAB_KEY_CODE];
53
- var h = /* @__PURE__ */ ((t) => (t.ON_KEY_DOWN = "onKeyDown", t.ON_CLICK = "onClick", t))(h || {});
54
- const pe = (t, n) => t.map(({ value: s }) => s).indexOf(n), we = (t, n) => (t % n + n) % n, v = (t, n = 0, s = 1) => {
55
- if (!t[n].disabled)
56
- return n;
57
- const i = t.length;
58
- return v(
59
- t,
60
- we(n + s, i),
61
- s
62
- );
63
- }, me = (t, n) => v(t, n), ue = (t, n) => v(t, n, -1), Ce = "_container_3wi7d_1", Oe = "_icon_3wi7d_7", Ee = "_arrow_3wi7d_13", De = "_dropdown_3wi7d_19", be = "_disabled_3wi7d_36", Ne = "_value_3wi7d_43", xe = "_error_3wi7d_46", ve = "_touched_3wi7d_46", Ke = "_opened_3wi7d_50", ye = "_placeholder_3wi7d_72", Ie = "_ghost_3wi7d_108", ke = {
64
- container: Ce,
65
- icon: Oe,
66
- arrow: Ee,
67
- dropdown: De,
68
- "transparent-background": "_transparent-background_3wi7d_33",
69
- disabled: be,
70
- value: Ne,
71
- error: xe,
72
- touched: ve,
73
- opened: Ke,
74
- placeholder: ye,
75
- "mobile-disabled": "_mobile-disabled_3wi7d_87",
76
- "select-list": "_select-list_3wi7d_92",
77
- ghost: Ie
78
- }, _ = A.bind(ke), $e = ({
79
- value: t = "",
80
- options: n = [],
81
- disabled: s = !1,
82
- error: i,
83
- onChange: O,
84
- onFocus: l,
85
- onBlur: d,
86
- mobileDisabled: E,
87
- title: D,
88
- touched: p = !1,
89
- icon: g,
90
- variant: b,
91
- placeholder: w = "",
92
- renderOption: N,
93
- transparentBackground: T = !1,
94
- className: W,
95
- toggleButtonClassName: H
96
- }) => {
97
- const [r, c] = Y(!1), K = B(null), [M, m] = Y(null), { refs: y, floatingStyles: $ } = ee({
98
- middleware: [
99
- te(5),
100
- ne({
101
- fallbackPlacements: ["bottom", "top"]
102
- })
103
- ]
104
- });
105
- oe(K, () => {
106
- r && (c(!1), d == null || d());
107
- });
108
- const I = (e) => {
109
- e.disabled || (O(e.value), c((o) => !o));
110
- }, j = () => n.find(({ value: e }) => e === t), k = pe(n, t), {
111
- getToggleButtonProps: V,
112
- getMenuProps: U,
113
- getItemProps: Z,
114
- setHighlightedIndex: u,
115
- highlightedIndex: S,
116
- selectedItem: C
117
- } = x({
118
- items: n,
119
- itemToString: (e) => (e != null && e.label ? String(e.label) : w) || "",
120
- selectedItem: j(),
121
- isOpen: r,
122
- circularNavigation: !0,
123
- defaultHighlightedIndex: k,
124
- onHighlightedIndexChange: (e) => {
125
- switch (e.type) {
126
- case x.stateChangeTypes.MenuKeyDownArrowUp:
127
- return m(h.ON_KEY_DOWN), u(ue(n, e.highlightedIndex)), e;
128
- case x.stateChangeTypes.MenuKeyDownArrowDown:
129
- return m(h.ON_KEY_DOWN), u(me(n, e.highlightedIndex)), e;
130
- default:
131
- return e;
132
- }
133
- }
134
- }), q = () => {
135
- s || (c((e) => !e), r ? d == null || d() : l == null || l(), m(h.ON_CLICK));
136
- }, z = () => {
137
- if (!t && t !== !1)
138
- return w;
139
- let e = t;
140
- return n.forEach((o) => {
141
- o.value === t && (e = o.label);
142
- }), e;
143
- }, G = (e) => {
144
- const { keyCode: o } = e;
145
- fe.includes(o) && !r && (e.preventDefault(), u(k), c(!0), l == null || l(), m(h.ON_KEY_DOWN));
146
- }, J = (e) => {
147
- const { keyCode: o } = e;
148
- if (o === f.ENTER_KEY_CODE) {
149
- const X = n[S];
150
- I(X), c(!1), d == null || d();
151
- return;
152
- }
153
- ge.includes(o) && (e.stopPropagation(), c(!1), d == null || d());
154
- }, Q = () => n.map((e, o) => /* @__PURE__ */ a(
155
- he,
156
- {
157
- ...Z({
158
- item: e,
159
- index: o
160
- }),
161
- selected: e.value === ((C == null ? void 0 : C.value) ?? C),
162
- option: e,
163
- highlightHovered: S === o && M !== h.ON_CLICK,
164
- render: N,
165
- onChange: e.disabled ? null : () => I(e),
166
- onMouseEnter: () => u(o)
167
- },
168
- e.value
169
- ));
170
- return /* @__PURE__ */ L("div", { ref: K, className: _("container", W), title: D, children: [
171
- /* @__PURE__ */ L(
172
- "button",
173
- {
174
- disabled: s,
175
- ...V({
176
- className: _("dropdown", b, H, {
177
- "transparent-background": T,
178
- opened: r,
179
- disabled: s,
180
- error: i,
181
- touched: p,
182
- "mobile-disabled": E
183
- }),
184
- onClick: q,
185
- onKeyDown: G,
186
- ref: y.setReference
187
- }),
188
- children: [
189
- g && /* @__PURE__ */ a("span", { className: _("icon"), children: g }),
190
- /* @__PURE__ */ a("span", { className: _("value", { placeholder: !t }), children: z() }),
191
- /* @__PURE__ */ a(se, { className: _("arrow"), tabIndex: -1, children: /* @__PURE__ */ a(ae, {}) })
192
- ]
193
- }
194
- ),
195
- r && /* @__PURE__ */ a(
196
- "div",
197
- {
198
- style: $,
199
- className: _("select-list", { opened: r }),
200
- ...U({
201
- onKeyDown: J,
202
- ref: y.setFloating
203
- }),
204
- children: /* @__PURE__ */ a(de, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: Q() })
205
- }
206
- )
207
- ] });
208
- };
209
- export {
210
- $e as D,
211
- ae as S
212
- };
@@ -1,131 +0,0 @@
1
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { useState as w, useEffect as g, useRef as j } from "react";
4
- import { Scrollbars as B } from "rc-scrollbars";
5
- import { AnimatePresence as D, motion as I } from "framer-motion";
6
- import { c as m } from "./bind-06a7ff84.js";
7
- import { u as K } from "./useOnClickOutside-c332f7d3.js";
8
- import { K as F } from "./keyCodes-f63c0e11.js";
9
- import { B as C } from "./button-7fb84fde.js";
10
- import { B as P } from "./baseIconButton-7bc53dec.js";
11
- const G = (t) => /* @__PURE__ */ y.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ y.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" })), X = () => {
12
- const [t, a] = w({ width: 0, height: 0 });
13
- return g(() => {
14
- const o = () => {
15
- a({
16
- width: window.innerWidth,
17
- height: window.innerHeight
18
- });
19
- };
20
- return window.addEventListener("resize", o), o(), () => window.removeEventListener("resize", o);
21
- }, []), t;
22
- }, Y = {
23
- "modal-content": "_modal-content_ojybs_1"
24
- }, Z = m.bind(Y), b = ({ children: t }) => /* @__PURE__ */ e("div", { className: Z("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
- }, c = m.bind(q), J = ({
31
- footerNode: t,
32
- closeHandler: a,
33
- okButton: o,
34
- cancelButton: l,
35
- size: s
36
- }) => /* @__PURE__ */ i("div", { className: c("modal-footer", { "with-extra-node": t, [`size-${s}`]: s }), children: [
37
- t && t,
38
- /* @__PURE__ */ i("div", { className: c("buttons-block"), children: [
39
- l && /* @__PURE__ */ e("div", { className: c("button-container"), children: /* @__PURE__ */ e(
40
- C,
41
- {
42
- variant: "ghost",
43
- adjustWidthOn: s === "small" ? "parent" : "content",
44
- onClick: a,
45
- ...l
46
- }
47
- ) }),
48
- o && /* @__PURE__ */ e("div", { className: c("button-container"), children: /* @__PURE__ */ e(C, { adjustWidthOn: s === "small" ? "parent" : "content", ...o }) })
49
- ] })
50
- ] }), Q = {
51
- "modal-header": "_modal-header_11gdx_1",
52
- "modal-header-content": "_modal-header-content_11gdx_11",
53
- "modal-title": "_modal-title_11gdx_20",
54
- "close-modal-icon": "_close-modal-icon_11gdx_28"
55
- }, r = m.bind(Q), U = ({ title: t, onClose: a, headerNode: o }) => /* @__PURE__ */ i("div", { className: r("modal-header"), children: [
56
- /* @__PURE__ */ i("div", { className: r("modal-header-content"), children: [
57
- t && /* @__PURE__ */ e("span", { className: r("modal-title"), children: t }),
58
- o && o
59
- ] }),
60
- /* @__PURE__ */ e(P, { className: r("close-modal-icon"), onClick: a, children: /* @__PURE__ */ e(G, {}) })
61
- ] }), V = "_modal_1kzzv_1", ee = {
62
- modal: V,
63
- "overlay-default": "_overlay-default_1kzzv_11",
64
- "overlay-light-cyan": "_overlay-light-cyan_1kzzv_15",
65
- "scrolling-content": "_scrolling-content_1kzzv_19",
66
- "modal-window": "_modal-window_1kzzv_25",
67
- "size-default": "_size-default_1kzzv_42",
68
- "size-small": "_size-small_1kzzv_54",
69
- "size-large": "_size-large_1kzzv_66"
70
- }, k = m.bind(ee), te = 0.9, oe = 176, _e = ({
71
- title: t,
72
- headerNode: a,
73
- children: o,
74
- footerNode: l,
75
- okButton: s,
76
- cancelButton: E,
77
- className: M,
78
- size: _ = "default",
79
- onClose: H = () => {
80
- },
81
- overlay: v = "default",
82
- zIndex: L = 2,
83
- allowCloseOutside: N = !0,
84
- scrollable: A = !1
85
- }) => {
86
- const [O, f] = w(!1), [R, S] = w(0), n = j(null), z = X(), p = z.height, $ = p * te, h = (p - R) / 2, T = $ - oe, d = () => {
87
- f(!1);
88
- }, x = (u) => {
89
- const { keyCode: W } = u;
90
- W === F.ESCAPE_KEY_CODE && d();
91
- };
92
- return g(() => {
93
- if (n && n.current) {
94
- const { clientHeight: u } = n.current;
95
- S(u);
96
- }
97
- }, [o, z]), g(() => (f(!0), n && n.current && n.current.focus(), document.addEventListener("keydown", x, !1), () => document.removeEventListener("keydown", x, !1)), []), K(n, N ? d : void 0), /* @__PURE__ */ e(D, { onExitComplete: H, children: O && /* @__PURE__ */ e("div", { className: k("modal", { [`overlay-${v}`]: v }), style: { zIndex: L }, children: /* @__PURE__ */ i(
98
- I.div,
99
- {
100
- className: k("modal-window", { [`size-${_}`]: _ }, M),
101
- ref: n,
102
- tabIndex: 0,
103
- initial: { opacity: 0, marginTop: -h },
104
- animate: { opacity: 1, marginTop: h },
105
- exit: { opacity: 0, marginTop: -h },
106
- transition: { duration: 0.3 },
107
- children: [
108
- /* @__PURE__ */ e(U, { title: t, headerNode: a, onClose: d }),
109
- A ? /* @__PURE__ */ e(B, { autoHeight: !0, autoHeightMax: T, hideTracksWhenNotNeeded: !0, children: /* @__PURE__ */ e(b, { children: o }) }) : /* @__PURE__ */ e(b, { children: o }),
110
- /* @__PURE__ */ e(
111
- J,
112
- {
113
- size: _,
114
- footerNode: l,
115
- okButton: s,
116
- cancelButton: E,
117
- closeHandler: d
118
- }
119
- )
120
- ]
121
- },
122
- "modal-window"
123
- ) }) });
124
- };
125
- export {
126
- _e as M,
127
- G as S,
128
- b as a,
129
- U as b,
130
- J as c
131
- };
@@ -1,67 +0,0 @@
1
- import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
- import { c as b } from "./bind-06a7ff84.js";
3
- import { useRef as k } from "react";
4
- import { K as d } from "./keyCodes-f63c0e11.js";
5
- const h = "_toggle_p1gaq_1", x = "_slider_p1gaq_26", y = "_round_p1gaq_46", E = "_input_p1gaq_50", q = "_disabled_p1gaq_63", D = {
6
- toggle: h,
7
- "children-container": "_children-container_p1gaq_13",
8
- slider: x,
9
- round: y,
10
- input: E,
11
- disabled: q
12
- }, e = b.bind(D), T = ({
13
- children: s,
14
- value: c,
15
- onChange: p,
16
- className: _,
17
- disabled: n = !1,
18
- title: g,
19
- ...u
20
- }) => {
21
- const o = k(null), m = (t) => {
22
- var a, i;
23
- const { keyCode: l } = t;
24
- if (l === d.SPACE_KEY_CODE) {
25
- t.preventDefault(), (a = o.current) == null || a.click();
26
- return;
27
- }
28
- l === d.ENTER_KEY_CODE && (t.preventDefault(), (i = o.current) == null || i.click());
29
- };
30
- return /* @__PURE__ */ f(
31
- "label",
32
- {
33
- id: "rp-ui-kit-toggle-label",
34
- title: g,
35
- className: e("toggle", _, { disabled: n }),
36
- children: [
37
- /* @__PURE__ */ r(
38
- "input",
39
- {
40
- ref: o,
41
- tabIndex: n ? -1 : 0,
42
- onChange: p,
43
- checked: c,
44
- disabled: n,
45
- onKeyDown: m,
46
- className: e("input"),
47
- type: "checkbox",
48
- ...u
49
- }
50
- ),
51
- /* @__PURE__ */ r(
52
- "div",
53
- {
54
- "aria-labelledby": "rp-ui-kit-toggle-label",
55
- role: "checkbox",
56
- "aria-checked": c,
57
- className: e("slider", "round")
58
- }
59
- ),
60
- s && /* @__PURE__ */ r("span", { className: e("children-container"), children: s })
61
- ]
62
- }
63
- );
64
- };
65
- export {
66
- T
67
- };