@reportportal/ui-kit 0.0.1-alpha.120 → 0.0.1-alpha.121

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.120",
3
+ "version": "0.0.1-alpha.121",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,289 +0,0 @@
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
- };
@@ -1,7 +0,0 @@
1
- import * as e from "react";
2
- const l = (C) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...C }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1 8C1 4.14001 4.14001 1 8 1C11.86 1 15 4.14001 15 8C15 11.8595 11.86 15 8 15C4.14001 15 1 11.8595 1 8ZM5 5.54545L5.54545 5L8 7.45455L10.4545 5L11 5.54545L8.54545 8L11 10.4545L10.4545 11L8 8.54545L5.54545 11L5 10.4545L7.45455 8L5 5.54545Z", fill: "#A2AAB5" })), t = (C) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...C }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9.09194 3.90153C8.73249 3.84853 8.36745 3.82135 7.99778 3.82135C5.24735 3.82135 2.75312 5.32613 0.912626 7.77031C0.762442 7.97055 0.762442 8.25031 0.912626 8.45055C1.96494 9.84971 3.23098 10.9408 4.63642 11.6187L5.59679 9.95532C5.16732 9.39694 4.92809 8.68447 4.97644 7.91459C5.07067 6.40686 6.29276 5.18478 7.80049 5.09055C8.00285 5.07782 8.2013 5.08498 8.39407 5.11028L9.09194 3.90153ZM7.56961 6.5383C6.91222 6.71981 6.41543 7.30478 6.37225 8.00589C6.36032 8.18701 6.37814 8.36223 6.42131 8.5272L7.56961 6.5383ZM8.40613 9.68939L9.57119 7.67146C9.61868 7.84288 9.6387 8.02571 9.62624 8.21497C9.58001 8.92637 9.07238 9.51681 8.40613 9.68939ZM7.58518 11.1113C7.78307 11.1384 7.98701 11.1463 8.19509 11.1332C9.69987 11.0361 10.922 9.81398 11.0191 8.3092C11.0679 7.53332 10.8245 6.81576 10.3887 6.25546L11.3454 4.59845C12.7563 5.27587 14.0272 6.36953 15.0829 7.77325C15.2331 7.9735 15.2331 8.25325 15.0829 8.4535C13.2424 10.8977 10.7482 12.4025 7.99778 12.4025C7.62256 12.4025 7.25211 12.3744 6.88743 12.3199L7.58518 11.1113Z", fill: "#A2AAB5" }), /* @__PURE__ */ e.createElement("path", { d: "M10.5051 2.25952C10.7122 1.9008 11.1709 1.7779 11.5296 1.985C11.8883 2.19211 12.0112 2.6508 11.8041 3.00952L5.35413 14.1812C5.14702 14.54 4.68833 14.6629 4.32961 14.4558C3.97089 14.2487 3.84798 13.79 4.05509 13.4312L10.5051 2.25952Z", fill: "#A2AAB5" })), n = (C) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...C }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M7.99778 3.82135C5.24735 3.82135 2.75312 5.32613 0.912626 7.77031C0.762442 7.97055 0.762442 8.25031 0.912626 8.45055C2.75312 10.8977 5.24735 12.4025 7.99778 12.4025C10.7482 12.4025 13.2424 10.8977 15.0829 8.4535C15.2331 8.25325 15.2331 7.9735 15.0829 7.77325C13.2424 5.32614 10.7482 3.82135 7.99778 3.82135ZM8.19509 11.1332C6.36932 11.2481 4.86159 9.74331 4.97644 7.91459C5.07067 6.40686 6.29276 5.18478 7.80049 5.09055C9.62625 4.9757 11.134 6.48048 11.0191 8.3092C10.922 9.81398 9.69987 11.0361 8.19509 11.1332ZM6.37225 8.00589C6.30746 8.98945 7.12022 9.79926 8.10378 9.73742C8.9136 9.68736 9.57323 9.03068 9.62624 8.21497C9.69102 7.23141 8.87826 6.4216 7.8947 6.48344C7.08194 6.53644 6.42231 7.19313 6.37225 8.00589Z", fill: "#A2AAB5" }));
3
- export {
4
- l as S,
5
- t as a,
6
- n as b
7
- };