@reportportal/ui-kit 0.0.1-alpha.97 → 0.0.1-alpha.99

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.
@@ -15,6 +15,7 @@ export interface DropdownProps {
15
15
  transparentBackground?: boolean;
16
16
  className?: string;
17
17
  toggleButtonClassName?: string;
18
+ selectListClassName?: string;
18
19
  label?: ReactNode;
19
20
  onChange: (value: DropdownValue | DropdownValue[]) => void;
20
21
  onFocus?: () => void;
@@ -27,6 +28,6 @@ export interface DropdownProps {
27
28
  onSelectAll?: () => void;
28
29
  formatDisplayedValue?: (value: string | undefined) => string;
29
30
  notScrollable?: boolean;
30
- footer?: ReactNode;
31
+ footer?: ReactNode | ((closeHandler: () => void) => ReactNode);
31
32
  }
32
33
  export declare const Dropdown: FC<DropdownProps>;
@@ -3,13 +3,19 @@ import { ReactElement } from 'react';
3
3
  export declare enum SystemAlertType {
4
4
  INFO = "info",
5
5
  SUCCESS = "success",
6
+ WARNING = "warning",
6
7
  ERROR = "error"
7
8
  }
9
+ export declare enum SystemAlertTypographyColorType {
10
+ WHITE = "white",
11
+ BLACK = "black"
12
+ }
8
13
  export interface SystemAlertProps {
9
14
  title: string;
10
15
  onClose: () => void;
11
16
  icon?: ReactElement | null;
12
17
  type?: SystemAlertType;
18
+ typographyColor?: SystemAlertTypographyColorType;
13
19
  duration?: number;
14
20
  className?: string;
15
21
  dataAutomationId?: string;
@@ -3,7 +3,7 @@ import B from "react-datepicker/dist/es/index.js";
3
3
  import { c as R } from "./bind-06a7ff84.js";
4
4
  import { useMemo as P, useRef as D } from "react";
5
5
  import { F as I } from "./fieldText-ba8a917c.js";
6
- import { D as E } from "./dropdown-b26b8fd8.js";
6
+ import { D as E } from "./dropdown-ec754bbe.js";
7
7
  import { S as T } from "./calendarArrow-44c7e60e.js";
8
8
  import { registerLocale as j } from "react-datepicker";
9
9
  const ie = (n, s) => {
@@ -1,5 +1,5 @@
1
- import { D as t } from "./datePicker-0aca795c.js";
2
- import { r as q } from "./datePicker-0aca795c.js";
1
+ import { D as t } from "./datePicker-efa4e2d6.js";
2
+ import { r as q } from "./datePicker-efa4e2d6.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react-datepicker/dist/es/index.js";
5
5
  import "./bind-06a7ff84.js";
@@ -10,7 +10,7 @@ import "./baseIconButton-251479f7.js";
10
10
  import "./spinLoader-c4a53718.js";
11
11
  import "./maxValueDisplay-9be01a75.js";
12
12
  import "./fieldLabel.js";
13
- import "./dropdown-b26b8fd8.js";
13
+ import "./dropdown-ec754bbe.js";
14
14
  import "@floating-ui/react-dom";
15
15
  import "downshift";
16
16
  import "rc-scrollbars";
@@ -0,0 +1,289 @@
1
+ import { jsxs as u, jsx as a, Fragment as q } from "react/jsx-runtime";
2
+ import { forwardRef as ue, useState as z, useRef as fe, useCallback as ge } from "react";
3
+ import { c as Q } from "./bind-06a7ff84.js";
4
+ import { useFloating as pe, offset as me, flip as ye } from "@floating-ui/react-dom";
5
+ import { useSelect as j } from "downshift";
6
+ import { Scrollbars as be } from "rc-scrollbars";
7
+ import { u as Ce } from "./useOnClickOutside-c332f7d3.js";
8
+ import { K as g } from "./keyCodes-f63c0e11.js";
9
+ import { B as ke } from "./baseIconButton-251479f7.js";
10
+ import { S as Oe } from "./dropdown-0260bb66.js";
11
+ import { FieldLabel as Ne } from "./fieldLabel.js";
12
+ import { C as De } from "./checkbox-ed6cc375.js";
13
+ const Ee = "_disabled_1etj7_12", we = "_hidden_1etj7_16", ve = "_hover_1etj7_22", Ke = "_selected_1etj7_34", Ae = {
14
+ "dropdown-option": "_dropdown-option_1etj7_1",
15
+ disabled: Ee,
16
+ hidden: we,
17
+ hover: ve,
18
+ selected: Ke,
19
+ "multi-select": "_multi-select_1etj7_34",
20
+ "single-option": "_single-option_1etj7_39",
21
+ "sub-option": "_sub-option_1etj7_46"
22
+ }, G = Q.bind(Ae), J = ue(
23
+ (n, t) => {
24
+ const {
25
+ option: { value: r, disabled: d, hidden: A, label: p, title: c, groupRef: i },
26
+ selected: y,
27
+ onChange: m,
28
+ render: b,
29
+ highlightHovered: C,
30
+ onMouseEnter: x,
31
+ multiSelect: h,
32
+ isPartiallyChecked: k = !1
33
+ } = n, I = (O) => {
34
+ (O.target instanceof HTMLDivElement || O.target instanceof HTMLInputElement) && (m == null || m(r));
35
+ };
36
+ return /* @__PURE__ */ u(
37
+ "div",
38
+ {
39
+ className: G("dropdown-option", {
40
+ selected: y,
41
+ disabled: d,
42
+ hidden: A,
43
+ hover: C,
44
+ "multi-select": h
45
+ }),
46
+ title: c,
47
+ onClick: I,
48
+ ref: t,
49
+ onMouseEnter: x,
50
+ children: [
51
+ h && /* @__PURE__ */ a(De, { value: !!y, partiallyChecked: k }),
52
+ /* @__PURE__ */ a("div", { className: G("single-option", { "sub-option": !!i }), children: b ? b(n) : p })
53
+ ]
54
+ }
55
+ );
56
+ }
57
+ ), xe = [
58
+ g.ENTER_KEY_CODE,
59
+ g.SPACE_KEY_CODE,
60
+ g.ARROW_DOWN_KEY_CODE
61
+ ], Ie = [g.ESCAPE_KEY_CODE, g.TAB_KEY_CODE];
62
+ var f = /* @__PURE__ */ ((n) => (n.ON_KEY_DOWN = "onKeyDown", n.ON_CLICK = "onClick", n))(f || {});
63
+ const Pe = (n, t) => {
64
+ const r = Array.isArray(t) ? t : [t];
65
+ return n.findIndex(({ value: d }) => r.includes(d));
66
+ }, Ye = (n, t) => (n % t + t) % t, H = (n, t = 0, r = 1) => {
67
+ if (!n[t].disabled)
68
+ return t;
69
+ const d = n.length;
70
+ return H(
71
+ n,
72
+ Ye(t + r, d),
73
+ r
74
+ );
75
+ }, je = (n, t) => H(n, t), He = (n, t) => H(n, t, -1), Re = "_container_5enku_1", Te = "_icon_5enku_7", Me = "_arrow_5enku_13", We = "_dropdown_5enku_19", Le = "_disabled_5enku_36", Se = "_value_5enku_43", Ve = "_error_5enku_46", $e = "_touched_5enku_46", Ue = "_opened_5enku_50", qe = "_placeholder_5enku_83", ze = "_ghost_5enku_118", Ge = "_divider_5enku_139", Je = {
76
+ container: Re,
77
+ icon: Te,
78
+ arrow: Me,
79
+ dropdown: We,
80
+ "transparent-background": "_transparent-background_5enku_33",
81
+ disabled: Le,
82
+ value: Se,
83
+ error: Ve,
84
+ touched: $e,
85
+ opened: Ue,
86
+ placeholder: qe,
87
+ "mobile-disabled": "_mobile-disabled_5enku_87",
88
+ "select-list": "_select-list_5enku_92",
89
+ "limited-width": "_limited-width_5enku_109",
90
+ "options-container": "_options-container_5enku_113",
91
+ ghost: ze,
92
+ divider: Ge
93
+ }, o = Q.bind(Je), ot = ({
94
+ multiSelect: n = !1,
95
+ value: t = n ? [] : "",
96
+ options: r = [],
97
+ disabled: d = !1,
98
+ error: A,
99
+ onChange: p,
100
+ onFocus: c,
101
+ onBlur: i,
102
+ mobileDisabled: y,
103
+ title: m,
104
+ touched: b = !1,
105
+ icon: C,
106
+ variant: x,
107
+ placeholder: h = "",
108
+ label: k = "",
109
+ renderOption: I,
110
+ transparentBackground: O = !1,
111
+ className: X,
112
+ toggleButtonClassName: Z,
113
+ selectListClassName: B,
114
+ isListWidthLimited: F = !1,
115
+ optionAll: R = { value: "all", label: "All" },
116
+ isOptionAllVisible: T = !1,
117
+ onSelectAll: ee = () => {
118
+ },
119
+ formatDisplayedValue: M,
120
+ notScrollable: te = !1,
121
+ footer: N
122
+ }) => {
123
+ const [_, D] = z(!1), W = fe(null), [ne, E] = z(null), P = n && Array.isArray(t) ? r.filter((e) => t.includes(e.value)) : null, { refs: L, floatingStyles: re } = pe({
124
+ placement: "bottom-start",
125
+ middleware: [
126
+ me(5),
127
+ ye({
128
+ fallbackPlacements: ["bottom-start", "top-start", "bottom", "top"]
129
+ })
130
+ ]
131
+ }), se = () => {
132
+ if (T && Array.isArray(t)) {
133
+ const e = r.map((s) => s.value);
134
+ p(t.length === r.length ? [] : e), ee();
135
+ }
136
+ }, w = ge(() => {
137
+ D(!1), i == null || i();
138
+ }, [i]);
139
+ Ce(W, () => {
140
+ _ && w();
141
+ });
142
+ const S = (e) => {
143
+ if (!e.disabled) {
144
+ if (n) {
145
+ const s = Array.isArray(t) ? [...t] : [], l = s.indexOf(e.value);
146
+ l === -1 ? s.push(e.value) : s.splice(l, 1), p(s);
147
+ } else
148
+ p(e.value);
149
+ D((s) => n || !s);
150
+ }
151
+ }, ae = () => r.find(({ value: e }) => e === t), V = Pe(r, t), {
152
+ getToggleButtonProps: le,
153
+ getLabelProps: de,
154
+ getMenuProps: ie,
155
+ getItemProps: oe,
156
+ setHighlightedIndex: v,
157
+ highlightedIndex: $,
158
+ selectedItem: K
159
+ } = j({
160
+ items: r,
161
+ itemToString: (e) => (e != null && e.label ? String(e.label) : h) || "",
162
+ selectedItem: ae(),
163
+ isOpen: _,
164
+ circularNavigation: !0,
165
+ defaultHighlightedIndex: V,
166
+ onHighlightedIndexChange: (e) => {
167
+ switch (e.type) {
168
+ case j.stateChangeTypes.MenuKeyDownArrowUp:
169
+ return E(f.ON_KEY_DOWN), v(He(r, e.highlightedIndex)), e;
170
+ case j.stateChangeTypes.MenuKeyDownArrowDown:
171
+ return E(f.ON_KEY_DOWN), v(je(r, e.highlightedIndex)), e;
172
+ default:
173
+ return e;
174
+ }
175
+ }
176
+ }), ce = () => {
177
+ d || (D((e) => !e), _ ? i == null || i() : c == null || c(), E(f.ON_CLICK));
178
+ }, Y = (() => {
179
+ if (n && Array.isArray(t) && r.length === t.length)
180
+ return R.label;
181
+ const e = r.reduce((s, l) => ((Array.isArray(t) && t.includes(l.value) || l.value === t) && s.push(l.label), s), []);
182
+ if (e.length > 0)
183
+ return e.join(", ");
184
+ if (!t && t !== !1 && t !== 0 || Array.isArray(t) && !t.length)
185
+ return h;
186
+ })(), _e = (e) => {
187
+ const { keyCode: s } = e;
188
+ xe.includes(s) && !_ && (e.preventDefault(), v(V), D(!0), c == null || c(), E(f.ON_KEY_DOWN));
189
+ }, he = (e) => {
190
+ const { keyCode: s } = e;
191
+ if (s === g.ENTER_KEY_CODE) {
192
+ const l = r[$];
193
+ S(l), n || w();
194
+ return;
195
+ }
196
+ Ie.includes(s) && (e.stopPropagation(), w());
197
+ }, U = () => /* @__PURE__ */ u("div", { className: o("options-container"), children: [
198
+ n && T && Array.isArray(t) && /* @__PURE__ */ u(q, { children: [
199
+ /* @__PURE__ */ a(
200
+ J,
201
+ {
202
+ option: R,
203
+ selected: t.length === r.length,
204
+ onChange: se,
205
+ multiSelect: n,
206
+ isPartiallyChecked: !!t.length
207
+ }
208
+ ),
209
+ /* @__PURE__ */ a("div", { className: o("divider") }),
210
+ " "
211
+ ] }),
212
+ r.map((e, s) => /* @__PURE__ */ a(
213
+ J,
214
+ {
215
+ ...oe({
216
+ item: e,
217
+ index: s
218
+ }),
219
+ multiSelect: n,
220
+ selected: n ? P == null ? void 0 : P.some((l) => l.value === e.value) : e.value === ((K == null ? void 0 : K.value) ?? K),
221
+ option: { title: e.label, ...e },
222
+ highlightHovered: $ === s && ne !== f.ON_CLICK,
223
+ render: I,
224
+ onChange: e.disabled ? null : () => S(e),
225
+ onMouseEnter: () => v(s)
226
+ },
227
+ e.value
228
+ )),
229
+ N && /* @__PURE__ */ u(q, { children: [
230
+ /* @__PURE__ */ a("div", { className: o("divider") }),
231
+ typeof N == "function" ? N(w) : N
232
+ ] })
233
+ ] });
234
+ return /* @__PURE__ */ u("div", { ref: W, className: o("container", X), title: m, children: [
235
+ k && /* @__PURE__ */ a(Ne, { ...de(), children: k }),
236
+ /* @__PURE__ */ u(
237
+ "button",
238
+ {
239
+ disabled: d,
240
+ ...le({
241
+ className: o("dropdown", x, Z, {
242
+ "transparent-background": O,
243
+ opened: _,
244
+ disabled: d,
245
+ error: A,
246
+ touched: b,
247
+ "mobile-disabled": y
248
+ }),
249
+ onClick: ce,
250
+ onKeyDown: _e,
251
+ ref: L.setReference
252
+ }),
253
+ type: "button",
254
+ children: [
255
+ C && /* @__PURE__ */ a("span", { className: o("icon"), children: C }),
256
+ /* @__PURE__ */ a(
257
+ "span",
258
+ {
259
+ className: o("value", {
260
+ placeholder: Y === h
261
+ }),
262
+ children: M ? M(Y) : Y
263
+ }
264
+ ),
265
+ /* @__PURE__ */ a(ke, { className: o("arrow"), tabIndex: -1, children: /* @__PURE__ */ a(Oe, {}) })
266
+ ]
267
+ }
268
+ ),
269
+ _ && /* @__PURE__ */ a(
270
+ "div",
271
+ {
272
+ style: re,
273
+ className: o(
274
+ "select-list",
275
+ { opened: _, "limited-width": F },
276
+ B
277
+ ),
278
+ ...ie({
279
+ onKeyDown: he,
280
+ ref: L.setFloating
281
+ }),
282
+ children: te ? U() : /* @__PURE__ */ a(be, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: U() })
283
+ }
284
+ )
285
+ ] });
286
+ };
287
+ export {
288
+ ot as D
289
+ };
package/dist/dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as r } from "./dropdown-b26b8fd8.js";
1
+ import { D as r } from "./dropdown-ec754bbe.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "./bind-06a7ff84.js";
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import { B as D } from "./breadcrumbs-8e5ca8d7.js";
4
4
  import { B as g } from "./bubblesLoader-f3ffa240.js";
5
5
  import { B as h } from "./button-97d9e587.js";
6
6
  import { C as y } from "./checkbox-ed6cc375.js";
7
- import { D as M } from "./datePicker-0aca795c.js";
7
+ import { D as M } from "./datePicker-efa4e2d6.js";
8
8
  import "react-datepicker";
9
- import { D as w } from "./dropdown-b26b8fd8.js";
9
+ import { D as w } from "./dropdown-ec754bbe.js";
10
10
  import { FieldLabel as k } from "./fieldLabel.js";
11
11
  import { F as R } from "./fieldNumber-c9113a7f.js";
12
12
  import { F as H } from "./fieldText-ba8a917c.js";