@reportportal/ui-kit 0.0.1-alpha.41 → 0.0.1-alpha.43

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.
@@ -14,7 +14,7 @@ export interface DropdownProps {
14
14
  transparentBackground?: boolean;
15
15
  className?: string;
16
16
  toggleButtonClassName?: string;
17
- onChange: (value: DropdownValue) => void;
17
+ onChange: (value: DropdownValue | DropdownValue[]) => void;
18
18
  onFocus?: () => void;
19
19
  onBlur?: () => void;
20
20
  renderOption?: RenderDropdownOption;
@@ -17,7 +17,7 @@ export { Pagination } from './pagination';
17
17
  export { Table } from './table';
18
18
  export { DatePicker } from './datePicker';
19
19
  export { DatePicker1 } from './datePicker1';
20
- export { DatePicker2 } from './dataPicker2/dataPicker2';
21
20
  export { Date2 } from './date2';
21
+ export { ReactDatePicker2 } from './reactDatePicker2';
22
22
  export { SystemAlert } from './systemAlert';
23
23
  export * from './icons';
@@ -0,0 +1,3 @@
1
+ import { ReactDatePicker2 } from './reactDatePicker';
2
+ export { ReactDatePicker2 };
3
+ export default ReactDatePicker2;
@@ -0,0 +1,2 @@
1
+ import ReactDatePicker from 'react-datepicker';
2
+ export declare const ReactDatePicker2: typeof ReactDatePicker;
@@ -0,0 +1,3 @@
1
+ import { ReactDatePicker2 } from './reactDatePicker2';
2
+ export { ReactDatePicker2 };
3
+ export default ReactDatePicker2;
@@ -0,0 +1,2 @@
1
+ import ReactDatePicker from 'react-datepicker';
2
+ export declare const ReactDatePicker2: typeof ReactDatePicker;
@@ -5,7 +5,7 @@ import { useMemo as E, useRef as B } from "react";
5
5
  import { F as D } from "./fieldText-65e4c614.js";
6
6
  import "./baseIconButton-b6adc843.js";
7
7
  import { S as T, a as G } from "./calendar-f154eb78.js";
8
- import { D as P } from "./dropdown-9f4d1928.js";
8
+ import { D as P } from "./dropdown-b78dd5d4.js";
9
9
  const H = (a, c = 20) => {
10
10
  const l = a + c;
11
11
  return new Array(l - a).fill(void 0).map((g, e) => a - e);
@@ -5,7 +5,7 @@ import { useMemo as E, useRef as B } from "react";
5
5
  import { F as D } from "./fieldText-65e4c614.js";
6
6
  import "./baseIconButton-b6adc843.js";
7
7
  import { S as T, a as G } from "./calendar-f154eb78.js";
8
- import { D as P } from "./dropdown-9f4d1928.js";
8
+ import { D as P } from "./dropdown-b78dd5d4.js";
9
9
  const H = (a, c = 20) => {
10
10
  const l = a + c;
11
11
  return new Array(l - a).fill(void 0).map((g, e) => a - e);
@@ -1,4 +1,4 @@
1
- import { D as t } from "./datePicker-a005ebc6.js";
1
+ import { D as t } from "./datePicker-543e9043.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react-datepicker";
4
4
  import "./bind-06a7ff84.js";
@@ -6,7 +6,7 @@ import "react";
6
6
  import "./fieldText-65e4c614.js";
7
7
  import "./baseIconButton-b6adc843.js";
8
8
  import "./calendar-f154eb78.js";
9
- import "./dropdown-9f4d1928.js";
9
+ import "./dropdown-b78dd5d4.js";
10
10
  import "@floating-ui/react-dom";
11
11
  import "downshift";
12
12
  import "rc-scrollbars";
@@ -1,4 +1,4 @@
1
- import { D as t } from "./datePicker-e85bee1d.js";
1
+ import { D as t } from "./datePicker-0d4910b6.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react-datepicker";
4
4
  import "./bind-06a7ff84.js";
@@ -6,7 +6,7 @@ import "react";
6
6
  import "./fieldText-65e4c614.js";
7
7
  import "./baseIconButton-b6adc843.js";
8
8
  import "./calendar-f154eb78.js";
9
- import "./dropdown-9f4d1928.js";
9
+ import "./dropdown-b78dd5d4.js";
10
10
  import "@floating-ui/react-dom";
11
11
  import "downshift";
12
12
  import "rc-scrollbars";
@@ -0,0 +1,256 @@
1
+ import { jsxs as g, jsx as d, Fragment as S } from "react/jsx-runtime";
2
+ import * as V from "react";
3
+ import { forwardRef as le, useState as $, useRef as oe } from "react";
4
+ import { c as q } from "./bind-06a7ff84.js";
5
+ import { useFloating as ce, offset as _e, flip as he } from "@floating-ui/react-dom";
6
+ import { useSelect as k } from "downshift";
7
+ import { Scrollbars as ge } from "rc-scrollbars";
8
+ import { u as fe } from "./useOnClickOutside-c332f7d3.js";
9
+ import { K as p } from "./keyCodes-f63c0e11.js";
10
+ import { B as pe } from "./baseIconButton-b6adc843.js";
11
+ import { C as me } from "./checkbox-9a6c7ce1.js";
12
+ const Ce = (r) => /* @__PURE__ */ V.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...r }, /* @__PURE__ */ V.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" })), ye = "_disabled_t3cjj_12", ue = "_hidden_t3cjj_16", we = "_hover_t3cjj_22", Oe = {
13
+ "dropdown-option": "_dropdown-option_t3cjj_1",
14
+ disabled: ye,
15
+ hidden: ue,
16
+ hover: we,
17
+ "single-option": "_single-option_t3cjj_35",
18
+ "sub-option": "_sub-option_t3cjj_42"
19
+ }, U = q.bind(Oe), Z = le(
20
+ (r, e) => {
21
+ const {
22
+ option: { value: n, disabled: l, hidden: D, label: m, title: c, groupRef: a },
23
+ selected: v,
24
+ onChange: C,
25
+ render: y,
26
+ highlightHovered: u,
27
+ onMouseEnter: A,
28
+ multiSelect: w,
29
+ isPartiallyChecked: K = !1
30
+ } = r, x = (O) => {
31
+ (O.target instanceof HTMLDivElement || O.target instanceof HTMLInputElement) && (C == null || C(n));
32
+ };
33
+ return /* @__PURE__ */ g(
34
+ "div",
35
+ {
36
+ className: U("dropdown-option", {
37
+ disabled: l,
38
+ hidden: D,
39
+ hover: u
40
+ }),
41
+ title: c,
42
+ onClick: x,
43
+ ref: e,
44
+ onMouseEnter: A,
45
+ children: [
46
+ w && /* @__PURE__ */ d(me, { value: !!v, partiallyChecked: K }),
47
+ /* @__PURE__ */ d("div", { className: U("single-option", { "sub-option": !!a }), children: y ? y(r) : m })
48
+ ]
49
+ }
50
+ );
51
+ }
52
+ ), be = [
53
+ p.ENTER_KEY_CODE,
54
+ p.SPACE_KEY_CODE,
55
+ p.ARROW_DOWN_KEY_CODE
56
+ ], Ee = [p.ESCAPE_KEY_CODE, p.TAB_KEY_CODE];
57
+ var f = /* @__PURE__ */ ((r) => (r.ON_KEY_DOWN = "onKeyDown", r.ON_CLICK = "onClick", r))(f || {});
58
+ const Ne = (r, e) => {
59
+ const n = Array.isArray(e) ? e : [e];
60
+ return r.findIndex(({ value: l }) => n.includes(l));
61
+ }, De = (r, e) => (r % e + e) % e, j = (r, e = 0, n = 1) => {
62
+ if (!r[e].disabled)
63
+ return e;
64
+ const l = r.length;
65
+ return j(
66
+ r,
67
+ De(e + n, l),
68
+ n
69
+ );
70
+ }, ve = (r, e) => j(r, e), Ae = (r, e) => j(r, e, -1), Ke = "_container_re5ge_1", xe = "_icon_re5ge_7", Ie = "_arrow_re5ge_13", ke = "_dropdown_re5ge_19", je = "_disabled_re5ge_36", Le = "_value_re5ge_43", Pe = "_error_re5ge_46", Re = "_touched_re5ge_46", Ye = "_opened_re5ge_50", Te = "_placeholder_re5ge_72", He = "_ghost_re5ge_118", Me = "_divider_re5ge_132", We = {
71
+ container: Ke,
72
+ icon: xe,
73
+ arrow: Ie,
74
+ dropdown: ke,
75
+ "transparent-background": "_transparent-background_re5ge_33",
76
+ disabled: je,
77
+ value: Le,
78
+ error: Pe,
79
+ touched: Re,
80
+ opened: Ye,
81
+ placeholder: Te,
82
+ "mobile-disabled": "_mobile-disabled_re5ge_87",
83
+ "select-list": "_select-list_re5ge_92",
84
+ "limited-width": "_limited-width_re5ge_109",
85
+ "options-container": "_options-container_re5ge_113",
86
+ ghost: He,
87
+ divider: Me
88
+ }, o = q.bind(We), Fe = ({
89
+ multiSelect: r = !1,
90
+ value: e = r ? [] : "",
91
+ options: n = [],
92
+ disabled: l = !1,
93
+ error: D,
94
+ onChange: m,
95
+ onFocus: c,
96
+ onBlur: a,
97
+ mobileDisabled: v,
98
+ title: C,
99
+ touched: y = !1,
100
+ icon: u,
101
+ variant: A,
102
+ placeholder: w = "",
103
+ renderOption: K,
104
+ transparentBackground: x = !1,
105
+ className: O,
106
+ toggleButtonClassName: z,
107
+ isListWidthLimited: G = !1,
108
+ optionAll: L = { value: "all", label: "All" },
109
+ isOptionAllVisible: P = !1,
110
+ onSelectAll: J = () => {
111
+ },
112
+ footer: R
113
+ }) => {
114
+ const [_, h] = $(!1), Y = oe(null), [Q, b] = $(null), I = r && Array.isArray(e) ? n.filter((t) => e.includes(t.value)) : null, { refs: T, floatingStyles: X } = ce({
115
+ middleware: [
116
+ _e(5),
117
+ he({
118
+ fallbackPlacements: ["bottom", "top"]
119
+ })
120
+ ]
121
+ }), F = () => {
122
+ if (P && Array.isArray(e)) {
123
+ const t = n.map((s) => s.value);
124
+ m(e.length === n.length ? [] : t), J();
125
+ }
126
+ };
127
+ fe(Y, () => {
128
+ _ && (h(!1), a == null || a());
129
+ });
130
+ const H = (t) => {
131
+ if (!t.disabled) {
132
+ if (r) {
133
+ const s = Array.isArray(e) ? [...e] : [], i = s.indexOf(t.value);
134
+ i === -1 ? s.push(t.value) : s.splice(i, 1), m(s);
135
+ } else
136
+ m(t.value);
137
+ h((s) => r || !s);
138
+ }
139
+ }, B = () => n.find(({ value: t }) => t === e), M = Ne(n, e), {
140
+ getToggleButtonProps: ee,
141
+ getMenuProps: te,
142
+ getItemProps: re,
143
+ setHighlightedIndex: E,
144
+ highlightedIndex: W,
145
+ selectedItem: N
146
+ } = k({
147
+ items: n,
148
+ itemToString: (t) => (t != null && t.label ? String(t.label) : w) || "",
149
+ selectedItem: B(),
150
+ isOpen: _,
151
+ circularNavigation: !0,
152
+ defaultHighlightedIndex: M,
153
+ onHighlightedIndexChange: (t) => {
154
+ switch (t.type) {
155
+ case k.stateChangeTypes.MenuKeyDownArrowUp:
156
+ return b(f.ON_KEY_DOWN), E(Ae(n, t.highlightedIndex)), t;
157
+ case k.stateChangeTypes.MenuKeyDownArrowDown:
158
+ return b(f.ON_KEY_DOWN), E(ve(n, t.highlightedIndex)), t;
159
+ default:
160
+ return t;
161
+ }
162
+ }
163
+ }), ne = () => {
164
+ l || (h((t) => !t), _ ? a == null || a() : c == null || c(), b(f.ON_CLICK));
165
+ }, se = () => !e && e !== !1 && e !== 0 || Array.isArray(e) && !e.length ? w : r && Array.isArray(e) && n.length === e.length ? L.label : n.reduce((s, i) => ((Array.isArray(e) && e.includes(i.value) || i.value === e) && s.push(i.label), s), []).join(", "), ae = (t) => {
166
+ const { keyCode: s } = t;
167
+ be.includes(s) && !_ && (t.preventDefault(), E(M), h(!0), c == null || c(), b(f.ON_KEY_DOWN));
168
+ }, de = (t) => {
169
+ const { keyCode: s } = t;
170
+ if (s === p.ENTER_KEY_CODE) {
171
+ const i = n[W];
172
+ H(i), r || (h(!1), a == null || a());
173
+ return;
174
+ }
175
+ Ee.includes(s) && (t.stopPropagation(), h(!1), a == null || a());
176
+ }, ie = () => /* @__PURE__ */ g("div", { className: o("options-container"), children: [
177
+ r && P && Array.isArray(e) && /* @__PURE__ */ g(S, { children: [
178
+ /* @__PURE__ */ d(
179
+ Z,
180
+ {
181
+ option: L,
182
+ selected: e.length === n.length,
183
+ onChange: F,
184
+ multiSelect: r,
185
+ isPartiallyChecked: !!e.length
186
+ }
187
+ ),
188
+ /* @__PURE__ */ d("div", { className: o("divider") }),
189
+ " "
190
+ ] }),
191
+ n.map((t, s) => /* @__PURE__ */ d(
192
+ Z,
193
+ {
194
+ ...re({
195
+ item: t,
196
+ index: s
197
+ }),
198
+ multiSelect: r,
199
+ selected: r ? I == null ? void 0 : I.some((i) => i.value === t.value) : t.value === ((N == null ? void 0 : N.value) ?? N),
200
+ option: { title: t.label, ...t },
201
+ highlightHovered: W === s && Q !== f.ON_CLICK,
202
+ render: K,
203
+ onChange: t.disabled ? null : () => H(t),
204
+ onMouseEnter: () => E(s)
205
+ },
206
+ t.value
207
+ )),
208
+ R && /* @__PURE__ */ g(S, { children: [
209
+ /* @__PURE__ */ d("div", { className: o("divider") }),
210
+ R
211
+ ] })
212
+ ] });
213
+ return /* @__PURE__ */ g("div", { ref: Y, className: o("container", O), title: C, children: [
214
+ /* @__PURE__ */ g(
215
+ "button",
216
+ {
217
+ disabled: l,
218
+ ...ee({
219
+ className: o("dropdown", A, z, {
220
+ "transparent-background": x,
221
+ opened: _,
222
+ disabled: l,
223
+ error: D,
224
+ touched: y,
225
+ "mobile-disabled": v
226
+ }),
227
+ onClick: ne,
228
+ onKeyDown: ae,
229
+ ref: T.setReference
230
+ }),
231
+ type: "button",
232
+ children: [
233
+ u && /* @__PURE__ */ d("span", { className: o("icon"), children: u }),
234
+ /* @__PURE__ */ d("span", { className: o("value", { placeholder: !e }), children: se() }),
235
+ /* @__PURE__ */ d(pe, { className: o("arrow"), tabIndex: -1, children: /* @__PURE__ */ d(Ce, {}) })
236
+ ]
237
+ }
238
+ ),
239
+ _ && /* @__PURE__ */ d(
240
+ "div",
241
+ {
242
+ style: X,
243
+ className: o("select-list", { opened: _, "limited-width": G }),
244
+ ...te({
245
+ onKeyDown: de,
246
+ ref: T.setFloating
247
+ }),
248
+ children: /* @__PURE__ */ d(ge, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: ie() })
249
+ }
250
+ )
251
+ ] });
252
+ };
253
+ export {
254
+ Fe as D,
255
+ Ce as S
256
+ };
package/dist/dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as r } from "./dropdown-9f4d1928.js";
1
+ import { D as r } from "./dropdown-b78dd5d4.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "./bind-06a7ff84.js";