@reportportal/ui-kit 0.0.1-alpha.59 → 0.0.1-alpha.60
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/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/{datePicker-c93e0835.js → datePicker-5253e237.js} +1 -1
- package/dist/datePicker.js +3 -3
- package/dist/dropdown-d6aea1b9.js +273 -0
- package/dist/dropdown.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/dropdown-937ba0eb.js +0 -265
|
@@ -24,7 +24,7 @@ export interface DropdownProps {
|
|
|
24
24
|
optionAll?: DropdownOptionType;
|
|
25
25
|
isOptionAllVisible?: boolean;
|
|
26
26
|
onSelectAll?: () => void;
|
|
27
|
-
|
|
27
|
+
formatDisplayedValue?: (value: string | undefined) => string;
|
|
28
28
|
notScrollable?: boolean;
|
|
29
29
|
footer?: ReactNode;
|
|
30
30
|
}
|
|
@@ -4,7 +4,7 @@ import { c as R } from "./bind-06a7ff84.js";
|
|
|
4
4
|
import { useMemo as P, useRef as B } from "react";
|
|
5
5
|
import { F as D } from "./fieldText-10046ca8.js";
|
|
6
6
|
import { a as E, S as G } from "./calendarArrow-3e1339ea.js";
|
|
7
|
-
import { D as T } from "./dropdown-
|
|
7
|
+
import { D as T } from "./dropdown-d6aea1b9.js";
|
|
8
8
|
import { registerLocale as H } from "react-datepicker";
|
|
9
9
|
const pe = (r, s) => {
|
|
10
10
|
H(r, s);
|
package/dist/datePicker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as t } from "./datePicker-
|
|
2
|
-
import { r as q } from "./datePicker-
|
|
1
|
+
import { D as t } from "./datePicker-5253e237.js";
|
|
2
|
+
import { r as q } from "./datePicker-5253e237.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 "./button-33c88abf.js";
|
|
|
10
10
|
import "./spinLoader-c4a53718.js";
|
|
11
11
|
import "./maxValueDisplay-9be01a75.js";
|
|
12
12
|
import "./calendarArrow-3e1339ea.js";
|
|
13
|
-
import "./dropdown-
|
|
13
|
+
import "./dropdown-d6aea1b9.js";
|
|
14
14
|
import "@floating-ui/react-dom";
|
|
15
15
|
import "downshift";
|
|
16
16
|
import "rc-scrollbars";
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { jsxs as f, jsx as d, Fragment as U } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as oe, useState as q, useRef as ce } from "react";
|
|
3
|
+
import { c as J } from "./bind-06a7ff84.js";
|
|
4
|
+
import { useFloating as _e, offset as he, flip as fe } from "@floating-ui/react-dom";
|
|
5
|
+
import { useSelect as j } from "downshift";
|
|
6
|
+
import { Scrollbars as ge } from "rc-scrollbars";
|
|
7
|
+
import { u as ue } from "./useOnClickOutside-c332f7d3.js";
|
|
8
|
+
import { K as u } from "./keyCodes-f63c0e11.js";
|
|
9
|
+
import { B as ye } from "./baseIconButton-251479f7.js";
|
|
10
|
+
import { S as pe } from "./dropdown-0260bb66.js";
|
|
11
|
+
import { C as me } from "./checkbox-9a6c7ce1.js";
|
|
12
|
+
const Ce = "_disabled_t3cjj_12", Oe = "_hidden_t3cjj_16", be = "_hover_t3cjj_22", Ne = {
|
|
13
|
+
"dropdown-option": "_dropdown-option_t3cjj_1",
|
|
14
|
+
disabled: Ce,
|
|
15
|
+
hidden: Oe,
|
|
16
|
+
hover: be,
|
|
17
|
+
"single-option": "_single-option_t3cjj_35",
|
|
18
|
+
"sub-option": "_sub-option_t3cjj_42"
|
|
19
|
+
}, z = J.bind(Ne), G = oe(
|
|
20
|
+
(r, t) => {
|
|
21
|
+
const {
|
|
22
|
+
option: { value: n, disabled: l, hidden: w, label: y, title: c, groupRef: a },
|
|
23
|
+
selected: v,
|
|
24
|
+
onChange: p,
|
|
25
|
+
render: C,
|
|
26
|
+
highlightHovered: O,
|
|
27
|
+
onMouseEnter: K,
|
|
28
|
+
multiSelect: m,
|
|
29
|
+
isPartiallyChecked: A = !1
|
|
30
|
+
} = r, x = (b) => {
|
|
31
|
+
(b.target instanceof HTMLDivElement || b.target instanceof HTMLInputElement) && (p == null || p(n));
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ f(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: z("dropdown-option", {
|
|
37
|
+
disabled: l,
|
|
38
|
+
hidden: w,
|
|
39
|
+
hover: O
|
|
40
|
+
}),
|
|
41
|
+
title: c,
|
|
42
|
+
onClick: x,
|
|
43
|
+
ref: t,
|
|
44
|
+
onMouseEnter: K,
|
|
45
|
+
children: [
|
|
46
|
+
m && /* @__PURE__ */ d(me, { value: !!v, partiallyChecked: A }),
|
|
47
|
+
/* @__PURE__ */ d("div", { className: z("single-option", { "sub-option": !!a }), children: C ? C(r) : y })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
), De = [
|
|
53
|
+
u.ENTER_KEY_CODE,
|
|
54
|
+
u.SPACE_KEY_CODE,
|
|
55
|
+
u.ARROW_DOWN_KEY_CODE
|
|
56
|
+
], Ee = [u.ESCAPE_KEY_CODE, u.TAB_KEY_CODE];
|
|
57
|
+
var g = /* @__PURE__ */ ((r) => (r.ON_KEY_DOWN = "onKeyDown", r.ON_CLICK = "onClick", r))(g || {});
|
|
58
|
+
const we = (r, t) => {
|
|
59
|
+
const n = Array.isArray(t) ? t : [t];
|
|
60
|
+
return r.findIndex(({ value: l }) => n.includes(l));
|
|
61
|
+
}, ve = (r, t) => (r % t + t) % t, P = (r, t = 0, n = 1) => {
|
|
62
|
+
if (!r[t].disabled)
|
|
63
|
+
return t;
|
|
64
|
+
const l = r.length;
|
|
65
|
+
return P(
|
|
66
|
+
r,
|
|
67
|
+
ve(t + n, l),
|
|
68
|
+
n
|
|
69
|
+
);
|
|
70
|
+
}, Ke = (r, t) => P(r, t), Ae = (r, t) => P(r, t, -1), xe = "_container_1yr7u_1", Ie = "_icon_1yr7u_7", ke = "_arrow_1yr7u_13", je = "_dropdown_1yr7u_19", Pe = "_disabled_1yr7u_36", Ye = "_value_1yr7u_43", Re = "_error_1yr7u_46", Te = "_touched_1yr7u_46", He = "_opened_1yr7u_50", Me = "_placeholder_1yr7u_83", We = "_ghost_1yr7u_118", Le = "_divider_1yr7u_132", Se = {
|
|
71
|
+
container: xe,
|
|
72
|
+
icon: Ie,
|
|
73
|
+
arrow: ke,
|
|
74
|
+
dropdown: je,
|
|
75
|
+
"transparent-background": "_transparent-background_1yr7u_33",
|
|
76
|
+
disabled: Pe,
|
|
77
|
+
value: Ye,
|
|
78
|
+
error: Re,
|
|
79
|
+
touched: Te,
|
|
80
|
+
opened: He,
|
|
81
|
+
placeholder: Me,
|
|
82
|
+
"mobile-disabled": "_mobile-disabled_1yr7u_87",
|
|
83
|
+
"select-list": "_select-list_1yr7u_92",
|
|
84
|
+
"limited-width": "_limited-width_1yr7u_109",
|
|
85
|
+
"options-container": "_options-container_1yr7u_113",
|
|
86
|
+
ghost: We,
|
|
87
|
+
divider: Le
|
|
88
|
+
}, o = J.bind(Se), tt = ({
|
|
89
|
+
multiSelect: r = !1,
|
|
90
|
+
value: t = r ? [] : "",
|
|
91
|
+
options: n = [],
|
|
92
|
+
disabled: l = !1,
|
|
93
|
+
error: w,
|
|
94
|
+
onChange: y,
|
|
95
|
+
onFocus: c,
|
|
96
|
+
onBlur: a,
|
|
97
|
+
mobileDisabled: v,
|
|
98
|
+
title: p,
|
|
99
|
+
touched: C = !1,
|
|
100
|
+
icon: O,
|
|
101
|
+
variant: K,
|
|
102
|
+
placeholder: m = "",
|
|
103
|
+
renderOption: A,
|
|
104
|
+
transparentBackground: x = !1,
|
|
105
|
+
className: b,
|
|
106
|
+
toggleButtonClassName: Q,
|
|
107
|
+
isListWidthLimited: X = !1,
|
|
108
|
+
optionAll: Y = { value: "all", label: "All" },
|
|
109
|
+
isOptionAllVisible: R = !1,
|
|
110
|
+
onSelectAll: Z = () => {
|
|
111
|
+
},
|
|
112
|
+
formatDisplayedValue: T,
|
|
113
|
+
notScrollable: F = !1,
|
|
114
|
+
footer: H
|
|
115
|
+
}) => {
|
|
116
|
+
const [_, h] = q(!1), M = ce(null), [B, N] = q(null), I = r && Array.isArray(t) ? n.filter((e) => t.includes(e.value)) : null, { refs: W, floatingStyles: ee } = _e({
|
|
117
|
+
middleware: [
|
|
118
|
+
he(5),
|
|
119
|
+
fe({
|
|
120
|
+
fallbackPlacements: ["bottom", "top"]
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
}), te = () => {
|
|
124
|
+
if (R && Array.isArray(t)) {
|
|
125
|
+
const e = n.map((s) => s.value);
|
|
126
|
+
y(t.length === n.length ? [] : e), Z();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
ue(M, () => {
|
|
130
|
+
_ && (h(!1), a == null || a());
|
|
131
|
+
});
|
|
132
|
+
const L = (e) => {
|
|
133
|
+
if (!e.disabled) {
|
|
134
|
+
if (r) {
|
|
135
|
+
const s = Array.isArray(t) ? [...t] : [], i = s.indexOf(e.value);
|
|
136
|
+
i === -1 ? s.push(e.value) : s.splice(i, 1), y(s);
|
|
137
|
+
} else
|
|
138
|
+
y(e.value);
|
|
139
|
+
h((s) => r || !s);
|
|
140
|
+
}
|
|
141
|
+
}, re = () => n.find(({ value: e }) => e === t), S = we(n, t), {
|
|
142
|
+
getToggleButtonProps: ne,
|
|
143
|
+
getMenuProps: se,
|
|
144
|
+
getItemProps: ae,
|
|
145
|
+
setHighlightedIndex: D,
|
|
146
|
+
highlightedIndex: V,
|
|
147
|
+
selectedItem: E
|
|
148
|
+
} = j({
|
|
149
|
+
items: n,
|
|
150
|
+
itemToString: (e) => (e != null && e.label ? String(e.label) : m) || "",
|
|
151
|
+
selectedItem: re(),
|
|
152
|
+
isOpen: _,
|
|
153
|
+
circularNavigation: !0,
|
|
154
|
+
defaultHighlightedIndex: S,
|
|
155
|
+
onHighlightedIndexChange: (e) => {
|
|
156
|
+
switch (e.type) {
|
|
157
|
+
case j.stateChangeTypes.MenuKeyDownArrowUp:
|
|
158
|
+
return N(g.ON_KEY_DOWN), D(Ae(n, e.highlightedIndex)), e;
|
|
159
|
+
case j.stateChangeTypes.MenuKeyDownArrowDown:
|
|
160
|
+
return N(g.ON_KEY_DOWN), D(Ke(n, e.highlightedIndex)), e;
|
|
161
|
+
default:
|
|
162
|
+
return e;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}), de = () => {
|
|
166
|
+
l || (h((e) => !e), _ ? a == null || a() : c == null || c(), N(g.ON_CLICK));
|
|
167
|
+
}, k = (() => {
|
|
168
|
+
if (r && Array.isArray(t) && n.length === t.length)
|
|
169
|
+
return Y.label;
|
|
170
|
+
const e = n.reduce((s, i) => ((Array.isArray(t) && t.includes(i.value) || i.value === t) && s.push(i.label), s), []);
|
|
171
|
+
if (e.length > 0)
|
|
172
|
+
return e.join(", ");
|
|
173
|
+
if (!t && t !== !1 && t !== 0 || Array.isArray(t) && !t.length)
|
|
174
|
+
return m;
|
|
175
|
+
})(), ie = (e) => {
|
|
176
|
+
const { keyCode: s } = e;
|
|
177
|
+
De.includes(s) && !_ && (e.preventDefault(), D(S), h(!0), c == null || c(), N(g.ON_KEY_DOWN));
|
|
178
|
+
}, le = (e) => {
|
|
179
|
+
const { keyCode: s } = e;
|
|
180
|
+
if (s === u.ENTER_KEY_CODE) {
|
|
181
|
+
const i = n[V];
|
|
182
|
+
L(i), r || (h(!1), a == null || a());
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
Ee.includes(s) && (e.stopPropagation(), h(!1), a == null || a());
|
|
186
|
+
}, $ = () => /* @__PURE__ */ f("div", { className: o("options-container"), children: [
|
|
187
|
+
r && R && Array.isArray(t) && /* @__PURE__ */ f(U, { children: [
|
|
188
|
+
/* @__PURE__ */ d(
|
|
189
|
+
G,
|
|
190
|
+
{
|
|
191
|
+
option: Y,
|
|
192
|
+
selected: t.length === n.length,
|
|
193
|
+
onChange: te,
|
|
194
|
+
multiSelect: r,
|
|
195
|
+
isPartiallyChecked: !!t.length
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ d("div", { className: o("divider") }),
|
|
199
|
+
" "
|
|
200
|
+
] }),
|
|
201
|
+
n.map((e, s) => /* @__PURE__ */ d(
|
|
202
|
+
G,
|
|
203
|
+
{
|
|
204
|
+
...ae({
|
|
205
|
+
item: e,
|
|
206
|
+
index: s
|
|
207
|
+
}),
|
|
208
|
+
multiSelect: r,
|
|
209
|
+
selected: r ? I == null ? void 0 : I.some((i) => i.value === e.value) : e.value === ((E == null ? void 0 : E.value) ?? E),
|
|
210
|
+
option: { title: e.label, ...e },
|
|
211
|
+
highlightHovered: V === s && B !== g.ON_CLICK,
|
|
212
|
+
render: A,
|
|
213
|
+
onChange: e.disabled ? null : () => L(e),
|
|
214
|
+
onMouseEnter: () => D(s)
|
|
215
|
+
},
|
|
216
|
+
e.value
|
|
217
|
+
)),
|
|
218
|
+
H && /* @__PURE__ */ f(U, { children: [
|
|
219
|
+
/* @__PURE__ */ d("div", { className: o("divider") }),
|
|
220
|
+
H
|
|
221
|
+
] })
|
|
222
|
+
] });
|
|
223
|
+
return /* @__PURE__ */ f("div", { ref: M, className: o("container", b), title: p, children: [
|
|
224
|
+
/* @__PURE__ */ f(
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
disabled: l,
|
|
228
|
+
...ne({
|
|
229
|
+
className: o("dropdown", K, Q, {
|
|
230
|
+
"transparent-background": x,
|
|
231
|
+
opened: _,
|
|
232
|
+
disabled: l,
|
|
233
|
+
error: w,
|
|
234
|
+
touched: C,
|
|
235
|
+
"mobile-disabled": v
|
|
236
|
+
}),
|
|
237
|
+
onClick: de,
|
|
238
|
+
onKeyDown: ie,
|
|
239
|
+
ref: W.setReference
|
|
240
|
+
}),
|
|
241
|
+
type: "button",
|
|
242
|
+
children: [
|
|
243
|
+
O && /* @__PURE__ */ d("span", { className: o("icon"), children: O }),
|
|
244
|
+
/* @__PURE__ */ d(
|
|
245
|
+
"span",
|
|
246
|
+
{
|
|
247
|
+
className: o("value", {
|
|
248
|
+
placeholder: k === m
|
|
249
|
+
}),
|
|
250
|
+
children: T ? T(k) : k
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ d(ye, { className: o("arrow"), tabIndex: -1, children: /* @__PURE__ */ d(pe, {}) })
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
_ && /* @__PURE__ */ d(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
style: ee,
|
|
261
|
+
className: o("select-list", { opened: _, "limited-width": X }),
|
|
262
|
+
...se({
|
|
263
|
+
onKeyDown: le,
|
|
264
|
+
ref: W.setFloating
|
|
265
|
+
}),
|
|
266
|
+
children: F ? $() : /* @__PURE__ */ d(ge, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: $() })
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] });
|
|
270
|
+
};
|
|
271
|
+
export {
|
|
272
|
+
tt as D
|
|
273
|
+
};
|
package/dist/dropdown.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { S as B } from "./systemMessage-1ced6079.js";
|
|
|
5
5
|
import { F as P } from "./fieldText-10046ca8.js";
|
|
6
6
|
import { T as g } from "./themeProvider-46c2be7b.js";
|
|
7
7
|
import { Modal as v } from "./modal.js";
|
|
8
|
-
import { D as M } from "./dropdown-
|
|
8
|
+
import { D as M } from "./dropdown-d6aea1b9.js";
|
|
9
9
|
import { T as A } from "./toggle-1a3aacb5.js";
|
|
10
10
|
import { F as L } from "./fieldNumber-d81e551e.js";
|
|
11
11
|
import { B as O } from "./bubblesLoader-a7e709d4.js";
|
|
@@ -16,7 +16,7 @@ import { Tooltip as J } from "./tooltip.js";
|
|
|
16
16
|
import { Popover as Q } from "./popover.js";
|
|
17
17
|
import { P as W } from "./pagination-2076b7b6.js";
|
|
18
18
|
import { T as Y } from "./table-32fc8c70.js";
|
|
19
|
-
import { D as _ } from "./datePicker-
|
|
19
|
+
import { D as _ } from "./datePicker-5253e237.js";
|
|
20
20
|
import "react-datepicker";
|
|
21
21
|
import { SystemAlert as oo } from "./systemAlert.js";
|
|
22
22
|
import { S as eo, a as to } from "./arrowUp-4a5caee7.js";
|
package/package.json
CHANGED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { jsxs as f, jsx as d, Fragment as V } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as oe, useState as $, useRef as ce } from "react";
|
|
3
|
-
import { c as z } from "./bind-06a7ff84.js";
|
|
4
|
-
import { useFloating as _e, offset as he, flip as fe } from "@floating-ui/react-dom";
|
|
5
|
-
import { useSelect as k } from "downshift";
|
|
6
|
-
import { Scrollbars as ye } from "rc-scrollbars";
|
|
7
|
-
import { u as ge } from "./useOnClickOutside-c332f7d3.js";
|
|
8
|
-
import { K as g } from "./keyCodes-f63c0e11.js";
|
|
9
|
-
import { B as ue } from "./baseIconButton-251479f7.js";
|
|
10
|
-
import { S as pe } from "./dropdown-0260bb66.js";
|
|
11
|
-
import { C as me } from "./checkbox-9a6c7ce1.js";
|
|
12
|
-
const Ce = "_disabled_t3cjj_12", Oe = "_hidden_t3cjj_16", be = "_hover_t3cjj_22", Ne = {
|
|
13
|
-
"dropdown-option": "_dropdown-option_t3cjj_1",
|
|
14
|
-
disabled: Ce,
|
|
15
|
-
hidden: Oe,
|
|
16
|
-
hover: be,
|
|
17
|
-
"single-option": "_single-option_t3cjj_35",
|
|
18
|
-
"sub-option": "_sub-option_t3cjj_42"
|
|
19
|
-
}, U = z.bind(Ne), q = oe(
|
|
20
|
-
(t, e) => {
|
|
21
|
-
const {
|
|
22
|
-
option: { value: n, disabled: l, hidden: w, label: u, title: c, groupRef: a },
|
|
23
|
-
selected: A,
|
|
24
|
-
onChange: p,
|
|
25
|
-
render: m,
|
|
26
|
-
highlightHovered: C,
|
|
27
|
-
onMouseEnter: K,
|
|
28
|
-
multiSelect: O,
|
|
29
|
-
isPartiallyChecked: v = !1
|
|
30
|
-
} = t, x = (b) => {
|
|
31
|
-
(b.target instanceof HTMLDivElement || b.target instanceof HTMLInputElement) && (p == null || p(n));
|
|
32
|
-
};
|
|
33
|
-
return /* @__PURE__ */ f(
|
|
34
|
-
"div",
|
|
35
|
-
{
|
|
36
|
-
className: U("dropdown-option", {
|
|
37
|
-
disabled: l,
|
|
38
|
-
hidden: w,
|
|
39
|
-
hover: C
|
|
40
|
-
}),
|
|
41
|
-
title: c,
|
|
42
|
-
onClick: x,
|
|
43
|
-
ref: e,
|
|
44
|
-
onMouseEnter: K,
|
|
45
|
-
children: [
|
|
46
|
-
O && /* @__PURE__ */ d(me, { value: !!A, partiallyChecked: v }),
|
|
47
|
-
/* @__PURE__ */ d("div", { className: U("single-option", { "sub-option": !!a }), children: m ? m(t) : u })
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
), De = [
|
|
53
|
-
g.ENTER_KEY_CODE,
|
|
54
|
-
g.SPACE_KEY_CODE,
|
|
55
|
-
g.ARROW_DOWN_KEY_CODE
|
|
56
|
-
], Ee = [g.ESCAPE_KEY_CODE, g.TAB_KEY_CODE];
|
|
57
|
-
var y = /* @__PURE__ */ ((t) => (t.ON_KEY_DOWN = "onKeyDown", t.ON_CLICK = "onClick", t))(y || {});
|
|
58
|
-
const we = (t, e) => {
|
|
59
|
-
const n = Array.isArray(e) ? e : [e];
|
|
60
|
-
return t.findIndex(({ value: l }) => n.includes(l));
|
|
61
|
-
}, Ae = (t, e) => (t % e + e) % e, j = (t, e = 0, n = 1) => {
|
|
62
|
-
if (!t[e].disabled)
|
|
63
|
-
return e;
|
|
64
|
-
const l = t.length;
|
|
65
|
-
return j(
|
|
66
|
-
t,
|
|
67
|
-
Ae(e + n, l),
|
|
68
|
-
n
|
|
69
|
-
);
|
|
70
|
-
}, Ke = (t, e) => j(t, e), ve = (t, e) => j(t, e, -1), xe = "_container_1yr7u_1", Ie = "_icon_1yr7u_7", ke = "_arrow_1yr7u_13", je = "_dropdown_1yr7u_19", Pe = "_disabled_1yr7u_36", Ye = "_value_1yr7u_43", Re = "_error_1yr7u_46", Te = "_touched_1yr7u_46", He = "_opened_1yr7u_50", Me = "_placeholder_1yr7u_83", We = "_ghost_1yr7u_118", Le = "_divider_1yr7u_132", Se = {
|
|
71
|
-
container: xe,
|
|
72
|
-
icon: Ie,
|
|
73
|
-
arrow: ke,
|
|
74
|
-
dropdown: je,
|
|
75
|
-
"transparent-background": "_transparent-background_1yr7u_33",
|
|
76
|
-
disabled: Pe,
|
|
77
|
-
value: Ye,
|
|
78
|
-
error: Re,
|
|
79
|
-
touched: Te,
|
|
80
|
-
opened: He,
|
|
81
|
-
placeholder: Me,
|
|
82
|
-
"mobile-disabled": "_mobile-disabled_1yr7u_87",
|
|
83
|
-
"select-list": "_select-list_1yr7u_92",
|
|
84
|
-
"limited-width": "_limited-width_1yr7u_109",
|
|
85
|
-
"options-container": "_options-container_1yr7u_113",
|
|
86
|
-
ghost: We,
|
|
87
|
-
divider: Le
|
|
88
|
-
}, o = z.bind(Se), er = ({
|
|
89
|
-
multiSelect: t = !1,
|
|
90
|
-
value: e = t ? [] : "",
|
|
91
|
-
options: n = [],
|
|
92
|
-
disabled: l = !1,
|
|
93
|
-
error: w,
|
|
94
|
-
onChange: u,
|
|
95
|
-
onFocus: c,
|
|
96
|
-
onBlur: a,
|
|
97
|
-
mobileDisabled: A,
|
|
98
|
-
title: p,
|
|
99
|
-
touched: m = !1,
|
|
100
|
-
icon: C,
|
|
101
|
-
variant: K,
|
|
102
|
-
placeholder: O = "",
|
|
103
|
-
renderOption: v,
|
|
104
|
-
transparentBackground: x = !1,
|
|
105
|
-
className: b,
|
|
106
|
-
toggleButtonClassName: G,
|
|
107
|
-
isListWidthLimited: J = !1,
|
|
108
|
-
optionAll: P = { value: "all", label: "All" },
|
|
109
|
-
isOptionAllVisible: Y = !1,
|
|
110
|
-
onSelectAll: Q = () => {
|
|
111
|
-
},
|
|
112
|
-
customDisplayedValue: X,
|
|
113
|
-
notScrollable: Z = !1,
|
|
114
|
-
footer: R
|
|
115
|
-
}) => {
|
|
116
|
-
const [_, h] = $(!1), T = ce(null), [F, N] = $(null), I = t && Array.isArray(e) ? n.filter((r) => e.includes(r.value)) : null, { refs: H, floatingStyles: B } = _e({
|
|
117
|
-
middleware: [
|
|
118
|
-
he(5),
|
|
119
|
-
fe({
|
|
120
|
-
fallbackPlacements: ["bottom", "top"]
|
|
121
|
-
})
|
|
122
|
-
]
|
|
123
|
-
}), ee = () => {
|
|
124
|
-
if (Y && Array.isArray(e)) {
|
|
125
|
-
const r = n.map((s) => s.value);
|
|
126
|
-
u(e.length === n.length ? [] : r), Q();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
ge(T, () => {
|
|
130
|
-
_ && (h(!1), a == null || a());
|
|
131
|
-
});
|
|
132
|
-
const M = (r) => {
|
|
133
|
-
if (!r.disabled) {
|
|
134
|
-
if (t) {
|
|
135
|
-
const s = Array.isArray(e) ? [...e] : [], i = s.indexOf(r.value);
|
|
136
|
-
i === -1 ? s.push(r.value) : s.splice(i, 1), u(s);
|
|
137
|
-
} else
|
|
138
|
-
u(r.value);
|
|
139
|
-
h((s) => t || !s);
|
|
140
|
-
}
|
|
141
|
-
}, re = () => n.find(({ value: r }) => r === e), W = we(n, e), {
|
|
142
|
-
getToggleButtonProps: te,
|
|
143
|
-
getMenuProps: ne,
|
|
144
|
-
getItemProps: se,
|
|
145
|
-
setHighlightedIndex: D,
|
|
146
|
-
highlightedIndex: L,
|
|
147
|
-
selectedItem: E
|
|
148
|
-
} = k({
|
|
149
|
-
items: n,
|
|
150
|
-
itemToString: (r) => (r != null && r.label ? String(r.label) : O) || "",
|
|
151
|
-
selectedItem: re(),
|
|
152
|
-
isOpen: _,
|
|
153
|
-
circularNavigation: !0,
|
|
154
|
-
defaultHighlightedIndex: W,
|
|
155
|
-
onHighlightedIndexChange: (r) => {
|
|
156
|
-
switch (r.type) {
|
|
157
|
-
case k.stateChangeTypes.MenuKeyDownArrowUp:
|
|
158
|
-
return N(y.ON_KEY_DOWN), D(ve(n, r.highlightedIndex)), r;
|
|
159
|
-
case k.stateChangeTypes.MenuKeyDownArrowDown:
|
|
160
|
-
return N(y.ON_KEY_DOWN), D(Ke(n, r.highlightedIndex)), r;
|
|
161
|
-
default:
|
|
162
|
-
return r;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}), ae = () => {
|
|
166
|
-
l || (h((r) => !r), _ ? a == null || a() : c == null || c(), N(y.ON_CLICK));
|
|
167
|
-
}, de = () => !e && e !== !1 && e !== 0 || Array.isArray(e) && !e.length ? O : t && Array.isArray(e) && n.length === e.length ? P.label : n.reduce((s, i) => ((Array.isArray(e) && e.includes(i.value) || i.value === e) && s.push(i.label), s), []).join(", "), ie = (r) => {
|
|
168
|
-
const { keyCode: s } = r;
|
|
169
|
-
De.includes(s) && !_ && (r.preventDefault(), D(W), h(!0), c == null || c(), N(y.ON_KEY_DOWN));
|
|
170
|
-
}, le = (r) => {
|
|
171
|
-
const { keyCode: s } = r;
|
|
172
|
-
if (s === g.ENTER_KEY_CODE) {
|
|
173
|
-
const i = n[L];
|
|
174
|
-
M(i), t || (h(!1), a == null || a());
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
Ee.includes(s) && (r.stopPropagation(), h(!1), a == null || a());
|
|
178
|
-
}, S = () => /* @__PURE__ */ f("div", { className: o("options-container"), children: [
|
|
179
|
-
t && Y && Array.isArray(e) && /* @__PURE__ */ f(V, { children: [
|
|
180
|
-
/* @__PURE__ */ d(
|
|
181
|
-
q,
|
|
182
|
-
{
|
|
183
|
-
option: P,
|
|
184
|
-
selected: e.length === n.length,
|
|
185
|
-
onChange: ee,
|
|
186
|
-
multiSelect: t,
|
|
187
|
-
isPartiallyChecked: !!e.length
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
|
-
/* @__PURE__ */ d("div", { className: o("divider") }),
|
|
191
|
-
" "
|
|
192
|
-
] }),
|
|
193
|
-
n.map((r, s) => /* @__PURE__ */ d(
|
|
194
|
-
q,
|
|
195
|
-
{
|
|
196
|
-
...se({
|
|
197
|
-
item: r,
|
|
198
|
-
index: s
|
|
199
|
-
}),
|
|
200
|
-
multiSelect: t,
|
|
201
|
-
selected: t ? I == null ? void 0 : I.some((i) => i.value === r.value) : r.value === ((E == null ? void 0 : E.value) ?? E),
|
|
202
|
-
option: { title: r.label, ...r },
|
|
203
|
-
highlightHovered: L === s && F !== y.ON_CLICK,
|
|
204
|
-
render: v,
|
|
205
|
-
onChange: r.disabled ? null : () => M(r),
|
|
206
|
-
onMouseEnter: () => D(s)
|
|
207
|
-
},
|
|
208
|
-
r.value
|
|
209
|
-
)),
|
|
210
|
-
R && /* @__PURE__ */ f(V, { children: [
|
|
211
|
-
/* @__PURE__ */ d("div", { className: o("divider") }),
|
|
212
|
-
R
|
|
213
|
-
] })
|
|
214
|
-
] });
|
|
215
|
-
return /* @__PURE__ */ f("div", { ref: T, className: o("container", b), title: p, children: [
|
|
216
|
-
/* @__PURE__ */ f(
|
|
217
|
-
"button",
|
|
218
|
-
{
|
|
219
|
-
disabled: l,
|
|
220
|
-
...te({
|
|
221
|
-
className: o("dropdown", K, G, {
|
|
222
|
-
"transparent-background": x,
|
|
223
|
-
opened: _,
|
|
224
|
-
disabled: l,
|
|
225
|
-
error: w,
|
|
226
|
-
touched: m,
|
|
227
|
-
"mobile-disabled": A
|
|
228
|
-
}),
|
|
229
|
-
onClick: ae,
|
|
230
|
-
onKeyDown: ie,
|
|
231
|
-
ref: H.setReference
|
|
232
|
-
}),
|
|
233
|
-
type: "button",
|
|
234
|
-
children: [
|
|
235
|
-
C && /* @__PURE__ */ d("span", { className: o("icon"), children: C }),
|
|
236
|
-
/* @__PURE__ */ d(
|
|
237
|
-
"span",
|
|
238
|
-
{
|
|
239
|
-
className: o("value", {
|
|
240
|
-
placeholder: !e || Array.isArray(e) && !e.length
|
|
241
|
-
}),
|
|
242
|
-
children: X || de()
|
|
243
|
-
}
|
|
244
|
-
),
|
|
245
|
-
/* @__PURE__ */ d(ue, { className: o("arrow"), tabIndex: -1, children: /* @__PURE__ */ d(pe, {}) })
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
),
|
|
249
|
-
_ && /* @__PURE__ */ d(
|
|
250
|
-
"div",
|
|
251
|
-
{
|
|
252
|
-
style: B,
|
|
253
|
-
className: o("select-list", { opened: _, "limited-width": J }),
|
|
254
|
-
...ne({
|
|
255
|
-
onKeyDown: le,
|
|
256
|
-
ref: H.setFloating
|
|
257
|
-
}),
|
|
258
|
-
children: Z ? S() : /* @__PURE__ */ d(ye, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: S() })
|
|
259
|
-
}
|
|
260
|
-
)
|
|
261
|
-
] });
|
|
262
|
-
};
|
|
263
|
-
export {
|
|
264
|
-
er as D
|
|
265
|
-
};
|