@reportportal/ui-kit 0.0.1-alpha.170 → 0.0.1-alpha.171

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.
@@ -12,6 +12,10 @@ export interface SidePanelProps {
12
12
  isOpen?: boolean;
13
13
  onClose?: () => void;
14
14
  closeButtonAriaLabel?: string;
15
+ showOverlay?: boolean;
16
+ overlay?: 'default' | 'light-cyan';
17
+ allowCloseOutside?: boolean;
18
+ overlayClassName?: string;
15
19
  }
16
- export declare const SidePanel: ({ className, title, descriptionComponent, headerComponent, contentComponent, footerComponent, top, side, isOpen, onClose, closeButtonAriaLabel, }: SidePanelProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const SidePanel: ({ className, title, descriptionComponent, headerComponent, contentComponent, footerComponent, top, side, isOpen, onClose, closeButtonAriaLabel, showOverlay, overlay, allowCloseOutside, overlayClassName, }: SidePanelProps) => import("react/jsx-runtime").JSX.Element;
17
21
  export default SidePanel;
@@ -0,0 +1,222 @@
1
+ import { jsxs as R, Fragment as j, jsx as a } from "react/jsx-runtime";
2
+ import { useMemo as E, forwardRef as G, useRef as V } from "react";
3
+ import v from "react-datepicker/dist/es/index.js";
4
+ import { c as L } from "./bind-06a7ff84.js";
5
+ import { F as W } from "./fieldText-1749da7a.js";
6
+ import { D as x } from "./dropdown-7d024c49.js";
7
+ import { S as I } from "./calendarArrow-44c7e60e.js";
8
+ import { registerLocale as q } from "react-datepicker";
9
+ const De = (t, n) => {
10
+ q(t, n);
11
+ }, z = (t, n, d = 20) => {
12
+ const c = new Array(d).fill(void 0).map((h, u) => t - u), _ = t - d + 1;
13
+ return n > t ? [n, ...c] : n < _ ? [...c, n] : c;
14
+ }, J = "_header_1s3dn_1", K = "_disabled_1s3dn_25", Q = "_dropdown_1s3dn_8", X = {
15
+ header: J,
16
+ "dropdowns-wrapper": "_dropdowns-wrapper_1s3dn_8",
17
+ "button-prev": "_button-prev_1s3dn_13",
18
+ "button-next": "_button-next_1s3dn_14",
19
+ disabled: K,
20
+ dropdown: Q,
21
+ "month-dropdown": "_month-dropdown_1s3dn_44",
22
+ "toggle-button": "_toggle-button_1s3dn_47"
23
+ }, l = L.bind(X), Z = ({
24
+ date: t = /* @__PURE__ */ new Date(),
25
+ changeYear: n = () => {
26
+ },
27
+ changeMonth: d = () => {
28
+ },
29
+ decreaseMonth: c = () => {
30
+ },
31
+ increaseMonth: _ = () => {
32
+ },
33
+ prevMonthButtonDisabled: h = !1,
34
+ nextMonthButtonDisabled: u = !1,
35
+ headerNodes: b = null,
36
+ customClassName: y = "",
37
+ yearsOptions: f = [],
38
+ locale: D
39
+ }) => {
40
+ const i = t.getFullYear(), S = t.getMonth(), N = E(() => {
41
+ const e = Array(12).keys(), p = new Intl.DateTimeFormat(D, {
42
+ month: "long"
43
+ }), s = (w) => p.format(new Date(i, w));
44
+ return Array.from(e, s).reduce((w, P, C) => w.concat({
45
+ value: C,
46
+ label: P
47
+ }), []);
48
+ }, [D, i]), A = E(() => {
49
+ const e = (/* @__PURE__ */ new Date()).getFullYear();
50
+ return (f.length > 0 ? f : z(e, i)).reduce(
51
+ (s, r) => s.concat({ value: r, label: `${r}` }),
52
+ []
53
+ );
54
+ }, [f, i]), F = (e) => {
55
+ d(e);
56
+ }, o = (e) => {
57
+ n(e);
58
+ };
59
+ return /* @__PURE__ */ R(j, { children: [
60
+ b && /* @__PURE__ */ a("div", { className: l(y), children: b }),
61
+ /* @__PURE__ */ R("div", { className: l("header"), children: [
62
+ /* @__PURE__ */ a(
63
+ "button",
64
+ {
65
+ type: "button",
66
+ "aria-label": "Previous Months",
67
+ disabled: h,
68
+ onClick: (e) => {
69
+ e.stopPropagation(), c();
70
+ },
71
+ className: l("button-prev", { disabled: h }),
72
+ children: /* @__PURE__ */ a(I, {})
73
+ }
74
+ ),
75
+ /* @__PURE__ */ R("div", { className: l("dropdowns-wrapper"), children: [
76
+ /* @__PURE__ */ a(
77
+ x,
78
+ {
79
+ options: N,
80
+ value: S,
81
+ onChange: F,
82
+ transparentBackground: !0,
83
+ className: l("dropdown", "month-dropdown"),
84
+ toggleButtonClassName: l("toggle-button")
85
+ }
86
+ ),
87
+ /* @__PURE__ */ a(
88
+ x,
89
+ {
90
+ options: A,
91
+ value: i,
92
+ onChange: o,
93
+ transparentBackground: !0,
94
+ className: l("dropdown"),
95
+ toggleButtonClassName: l("toggle-button")
96
+ }
97
+ )
98
+ ] }),
99
+ /* @__PURE__ */ a(
100
+ "button",
101
+ {
102
+ type: "button",
103
+ "aria-label": "Next Months",
104
+ disabled: u,
105
+ onClick: (e) => {
106
+ e.stopPropagation(), _();
107
+ },
108
+ className: l("button-next", { disabled: u }),
109
+ children: /* @__PURE__ */ a(I, {})
110
+ }
111
+ )
112
+ ] })
113
+ ] });
114
+ }, ee = "_calendar_1si6u_5", te = "_date_1si6u_103", ne = "_disabled_1si6u_149", oe = "_popper_1si6u_157", se = "_input_1si6u_161", re = {
115
+ calendar: ee,
116
+ "current-date": "_current-date_1si6u_102",
117
+ date: te,
118
+ "end-date": "_end-date_1si6u_120",
119
+ "selected-range": "_selected-range_1si6u_130",
120
+ disabled: ne,
121
+ popper: oe,
122
+ input: se,
123
+ "input-range": "_input-range_1si6u_172"
124
+ }, g = L.bind(re), ae = "en", de = "MM-dd-yyyy", ce = " to ", le = G(
125
+ ({ selectsRange: t, value: n, ...d }, c) => /* @__PURE__ */ a(
126
+ W,
127
+ {
128
+ ...d,
129
+ className: g("input", t ? "input-range" : ""),
130
+ defaultWidth: !1,
131
+ value: t ? (n == null ? void 0 : n.replace(" - ", ce)) ?? "" : n,
132
+ ref: c,
133
+ readOnly: !0
134
+ }
135
+ )
136
+ ), Ne = (t) => {
137
+ const {
138
+ onChange: n = () => {
139
+ },
140
+ disabled: d = !1,
141
+ onBlur: c = () => {
142
+ },
143
+ onFocus: _ = () => {
144
+ },
145
+ headerNodes: h = null,
146
+ customClassName: u = "",
147
+ customTimeInput: b = void 0,
148
+ shouldCloseOnSelect: y = !0,
149
+ popperClassName: f = "",
150
+ calendarClassName: D = "",
151
+ popperPlacement: i = "bottom-start",
152
+ fixedHeight: S = !0,
153
+ language: N = ae,
154
+ yearsOptions: A = [],
155
+ dateFormat: F = de,
156
+ value: o = null
157
+ } = t, e = "selectsRange" in t && t.selectsRange === !0, p = V(null), s = e ? (o == null ? void 0 : o[0]) ?? void 0 : void 0, r = e ? (o == null ? void 0 : o[1]) ?? void 0 : void 0, w = s == null ? void 0 : s.toDateString(), P = r == null ? void 0 : r.toDateString(), C = r && s && r > s, O = e ? "Select date range" : "Select date", B = t.placeholder ?? O, k = {
158
+ customInput: /* @__PURE__ */ a(le, { ref: p, selectsRange: e }),
159
+ placeholderText: B,
160
+ disabled: d,
161
+ shouldCloseOnSelect: y,
162
+ fixedHeight: S,
163
+ locale: N,
164
+ showPopperArrow: !1,
165
+ dayClassName: (m) => {
166
+ if (!e) {
167
+ const H = o == null ? void 0 : o.toDateString(), U = m.toDateString();
168
+ return g("date", {
169
+ "current-date": U === H,
170
+ disabled: d
171
+ });
172
+ }
173
+ const M = m.toDateString(), Y = M === w, T = C && M === P, $ = s && r && m > s && m < r;
174
+ return g("date", {
175
+ "current-date": Y,
176
+ "selected-range": $ && !T,
177
+ "end-date": T && C,
178
+ disabled: d
179
+ });
180
+ },
181
+ calendarClassName: g(D, "calendar"),
182
+ renderCustomHeader: (m) => /* @__PURE__ */ a(
183
+ Z,
184
+ {
185
+ ...m,
186
+ headerNodes: h,
187
+ customClassName: u,
188
+ yearsOptions: A,
189
+ locale: N
190
+ }
191
+ ),
192
+ onBlur: c,
193
+ onFocus: _,
194
+ customTimeInput: b,
195
+ showTimeInput: !!b,
196
+ popperClassName: g(f, "popper"),
197
+ dateFormat: F,
198
+ className: g("datepicker"),
199
+ popperPlacement: i
200
+ };
201
+ return e ? /* @__PURE__ */ a(
202
+ v,
203
+ {
204
+ ...k,
205
+ selectsRange: !0,
206
+ startDate: s,
207
+ endDate: r,
208
+ onChange: n
209
+ }
210
+ ) : /* @__PURE__ */ a(
211
+ v,
212
+ {
213
+ ...k,
214
+ selected: o,
215
+ onChange: n
216
+ }
217
+ );
218
+ };
219
+ export {
220
+ Ne as D,
221
+ De as r
222
+ };
@@ -1,5 +1,5 @@
1
- import { D as t } from "./datePicker-412fb8e8.js";
2
- import { r as A } from "./datePicker-412fb8e8.js";
1
+ import { D as t } from "./datePicker-cde99de3.js";
2
+ import { r as A } from "./datePicker-cde99de3.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "react-datepicker/dist/es/index.js";
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { BulkPanel as J } from "./bulkPanel.js";
9
9
  import { B as _ } from "./button-97d9e587.js";
10
10
  import { C as W } from "./checkbox-493fdc63.js";
11
11
  import { Chip as j } from "./chip.js";
12
- import { D as K } from "./datePicker-412fb8e8.js";
12
+ import { D as K } from "./datePicker-cde99de3.js";
13
13
  import "react-datepicker";
14
14
  import { D as Y } from "./dropdown-7d024c49.js";
15
15
  import { FieldLabel as $ } from "./fieldLabel.js";
package/dist/sidePanel.js CHANGED
@@ -1,88 +1,131 @@
1
- import { jsxs as s, jsx as i, Fragment as p } from "react/jsx-runtime";
2
- import { useId as N, useEffect as y } from "react";
3
- import { c as g } from "./bind-06a7ff84.js";
4
- import { K as E } from "./keyCodes-f63c0e11.js";
5
- import { S as x } from "./close-4d480ef7.js";
6
- import { B as k } from "./baseIconButton-251479f7.js";
7
- const I = "_active_6bj2z_15", K = "_compact_6bj2z_39", S = "_header_6bj2z_35", w = "_title_6bj2z_65", B = "_description_6bj2z_76", D = "_content_6bj2z_85", L = "_footer_6bj2z_92", P = "_divider_6bj2z_98", $ = {
8
- "side-panel": "_side-panel_6bj2z_1",
9
- active: I,
10
- "side-right": "_side-right_6bj2z_19",
11
- "side-left": "_side-left_6bj2z_27",
12
- "header-section": "_header-section_6bj2z_35",
13
- compact: K,
14
- header: S,
15
- "header-content": "_header-content_6bj2z_55",
16
- "close-button": "_close-button_6bj2z_59",
17
- title: w,
18
- description: B,
19
- content: D,
20
- footer: L,
21
- divider: P
22
- }, e = g.bind($), J = ({
23
- className: h,
24
- title: c,
25
- descriptionComponent: r,
26
- headerComponent: d,
1
+ import { jsxs as a, jsx as i, Fragment as S } from "react/jsx-runtime";
2
+ import { useId as D, useRef as I, useMemo as K, useEffect as P } from "react";
3
+ import { c as $ } from "./bind-06a7ff84.js";
4
+ import { K as A } from "./keyCodes-f63c0e11.js";
5
+ import { u as B } from "./useOnClickOutside-8f7d68a1.js";
6
+ import "react-dnd";
7
+ import "react-dnd-html5-backend";
8
+ import { a as L } from "./dropdown-7d024c49.js";
9
+ import { S as T } from "./close-4d480ef7.js";
10
+ import { B as j } from "./baseIconButton-251479f7.js";
11
+ import "react-dom";
12
+ import "@floating-ui/react-dom";
13
+ import "downshift";
14
+ import "rc-scrollbars";
15
+ import "./clear-53660571.js";
16
+ import "./dropdown-0260bb66.js";
17
+ import "./fieldLabel.js";
18
+ import "./adaptiveTagList.js";
19
+ import "./button-97d9e587.js";
20
+ import "./isEmpty-ccacb5ff.js";
21
+ import "./checkbox-493fdc63.js";
22
+ const M = "_active_5ebdz_11", F = "_compact_5ebdz_62", H = "_header_5ebdz_58", O = "_title_5ebdz_88", U = "_description_5ebdz_99", W = "_content_5ebdz_108", Y = "_footer_5ebdz_115", q = "_divider_5ebdz_121", w = {
23
+ "side-panel-overlay": "_side-panel-overlay_5ebdz_1",
24
+ active: M,
25
+ "overlay-default": "_overlay-default_5ebdz_16",
26
+ "overlay-light-cyan": "_overlay-light-cyan_5ebdz_20",
27
+ "side-panel": "_side-panel_5ebdz_1",
28
+ "side-right": "_side-right_5ebdz_42",
29
+ "side-left": "_side-left_5ebdz_50",
30
+ "header-section": "_header-section_5ebdz_58",
31
+ compact: F,
32
+ header: H,
33
+ "header-content": "_header-content_5ebdz_78",
34
+ "close-button": "_close-button_5ebdz_82",
35
+ title: O,
36
+ description: U,
37
+ content: W,
38
+ footer: Y,
39
+ divider: q
40
+ }, e = $.bind(w), ve = ({
41
+ className: u,
42
+ title: r,
43
+ descriptionComponent: o,
44
+ headerComponent: c,
27
45
  contentComponent: n,
28
- footerComponent: o,
46
+ footerComponent: l,
29
47
  top: _ = 0,
30
- side: b = "right",
31
- isOpen: a = !0,
48
+ side: z = "right",
49
+ isOpen: d = !0,
32
50
  onClose: t,
33
- closeButtonAriaLabel: v = "Close panel"
51
+ closeButtonAriaLabel: y = "Close panel",
52
+ showOverlay: m = !1,
53
+ overlay: p = "default",
54
+ allowCloseOutside: s = !0,
55
+ overlayClassName: N
34
56
  }) => {
35
- const l = N(), f = () => {
57
+ const v = D(), f = I(null), g = () => {
36
58
  t == null || t();
37
- };
38
- y(() => {
39
- if (!a || !t)
59
+ }, E = K(
60
+ () => ({
61
+ ignoreSelectors: [`[${L}]`]
62
+ }),
63
+ []
64
+ );
65
+ B(
66
+ f,
67
+ s && m && d ? t : void 0,
68
+ E
69
+ ), P(() => {
70
+ if (!d || !t)
40
71
  return;
41
- const m = (z) => {
42
- const { keyCode: u } = z;
43
- u === E.ESCAPE_KEY_CODE && t();
72
+ const b = (x) => {
73
+ const { keyCode: R } = x;
74
+ R === A.ESCAPE_KEY_CODE && s && t();
44
75
  };
45
- return document.addEventListener("keydown", m, !1), () => {
46
- document.removeEventListener("keydown", m, !1);
76
+ return document.addEventListener("keydown", b, !1), () => {
77
+ document.removeEventListener("keydown", b, !1);
47
78
  };
48
- }, [a, t]);
49
- const j = !!(d || r);
50
- return /* @__PURE__ */ s(
79
+ }, [d, t, s]);
80
+ const k = !!(c || o), h = /* @__PURE__ */ a(
51
81
  "aside",
52
82
  {
53
- className: e("side-panel", `side-${b}`, { active: a }, h),
83
+ ref: f,
84
+ className: e("side-panel", `side-${z}`, { active: d }, u),
54
85
  role: "dialog",
55
86
  "aria-modal": "true",
56
- "aria-hidden": !a,
57
- "aria-labelledby": c ? l : void 0,
87
+ "aria-hidden": !d,
88
+ "aria-labelledby": r ? v : void 0,
58
89
  style: { top: _, height: `calc(100vh - ${_}px)` },
59
90
  tabIndex: -1,
60
91
  children: [
61
- /* @__PURE__ */ s("div", { className: e("header-section", { compact: !j }), children: [
62
- (d || c) && /* @__PURE__ */ s("div", { className: e("header"), children: [
63
- c ? /* @__PURE__ */ i("span", { id: l, className: e("title"), children: c }) : d,
92
+ /* @__PURE__ */ a("div", { className: e("header-section", { compact: !k }), children: [
93
+ (c || r) && /* @__PURE__ */ a("div", { className: e("header"), children: [
94
+ r ? /* @__PURE__ */ i("span", { id: v, className: e("title"), children: r }) : c,
64
95
  t && /* @__PURE__ */ i(
65
- k,
96
+ j,
66
97
  {
67
98
  className: e("close-button"),
68
- onClick: f,
69
- "aria-label": v,
70
- children: /* @__PURE__ */ i(x, {})
99
+ onClick: g,
100
+ "aria-label": y,
101
+ children: /* @__PURE__ */ i(T, {})
71
102
  }
72
103
  )
73
104
  ] }),
74
- r
105
+ o
75
106
  ] }),
76
107
  /* @__PURE__ */ i("div", { className: e("divider") }),
77
108
  n && /* @__PURE__ */ i("div", { className: e("content"), children: n }),
78
- o && /* @__PURE__ */ s(p, { children: [
109
+ l && /* @__PURE__ */ a(S, { children: [
79
110
  /* @__PURE__ */ i("div", { className: e("divider") }),
80
- /* @__PURE__ */ i("div", { className: e("footer"), children: o })
111
+ /* @__PURE__ */ i("div", { className: e("footer"), children: l })
81
112
  ] })
82
113
  ]
83
114
  }
84
115
  );
116
+ return m ? /* @__PURE__ */ i(
117
+ "div",
118
+ {
119
+ className: e(
120
+ "side-panel-overlay",
121
+ { active: d },
122
+ p && `overlay-${p}`,
123
+ N
124
+ ),
125
+ children: h
126
+ }
127
+ ) : h;
85
128
  };
86
129
  export {
87
- J as SidePanel
130
+ ve as SidePanel
88
131
  };