@reportportal/ui-kit 0.0.1-alpha.136 → 0.0.1-alpha.138
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/adaptiveTagList.js +189 -0
- package/dist/components/adaptiveTagList/adaptiveTagList.d.ts +11 -0
- package/dist/components/adaptiveTagList/constants.d.ts +6 -0
- package/dist/components/adaptiveTagList/index.d.ts +2 -0
- package/dist/components/dropdown/constants.d.ts +1 -0
- package/dist/components/dropdown/dropdown.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/{datePicker-926c9cae.js → datePicker-c2925cdd.js} +1 -1
- package/dist/datePicker.js +8 -4
- package/dist/dropdown-f33fa0ce.js +632 -0
- package/dist/dropdown.js +7 -3
- package/dist/index.js +145 -143
- package/dist/modal.js +15 -13
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/dropdown-360803d5.js +0 -550
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
import { jsxs as q, jsx as u, Fragment as Re } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as pr, useState as te, useRef as I, useMemo as C, useCallback as K, useLayoutEffect as Ye, useEffect as P } from "react";
|
|
3
|
+
import { createPortal as mr } from "react-dom";
|
|
4
|
+
import { c as He } from "./bind-06a7ff84.js";
|
|
5
|
+
import { useFloating as gr, offset as wr, flip as Er, size as yr, autoUpdate as Cr } from "@floating-ui/react-dom";
|
|
6
|
+
import { useSelect as he } from "downshift";
|
|
7
|
+
import { Scrollbars as vr } from "rc-scrollbars";
|
|
8
|
+
import { K as p } from "./keyCodes-f63c0e11.js";
|
|
9
|
+
import { B as Or } from "./baseIconButton-251479f7.js";
|
|
10
|
+
import { S as Ar } from "./clear-53660571.js";
|
|
11
|
+
import { S as Dr } from "./dropdown-0260bb66.js";
|
|
12
|
+
import { Tooltip as Nr } from "./tooltip.js";
|
|
13
|
+
import { FieldLabel as br } from "./fieldLabel.js";
|
|
14
|
+
import { AdaptiveTagList as Ir } from "./adaptiveTagList.js";
|
|
15
|
+
import { C as Kr } from "./checkbox-ed6cc375.js";
|
|
16
|
+
import { i as Pe } from "./isEmpty-ccacb5ff.js";
|
|
17
|
+
const Tr = "_disabled_14s7v_12", Lr = "_hidden_14s7v_16", kr = "_hover_14s7v_22", xr = "_selected_14s7v_38", qr = {
|
|
18
|
+
"dropdown-option": "_dropdown-option_14s7v_1",
|
|
19
|
+
disabled: Tr,
|
|
20
|
+
hidden: Lr,
|
|
21
|
+
hover: kr,
|
|
22
|
+
"depth-1": "_depth-1_14s7v_32",
|
|
23
|
+
selected: xr,
|
|
24
|
+
"multi-select": "_multi-select_14s7v_38",
|
|
25
|
+
"single-option": "_single-option_14s7v_43",
|
|
26
|
+
"sub-option": "_sub-option_14s7v_50"
|
|
27
|
+
}, Ve = He.bind(qr), Se = pr(
|
|
28
|
+
(n, t) => {
|
|
29
|
+
const {
|
|
30
|
+
option: { value: d, disabled: o, hidden: m, label: g, title: f, groupRef: v },
|
|
31
|
+
selected: U,
|
|
32
|
+
onChange: S,
|
|
33
|
+
render: B,
|
|
34
|
+
highlightHovered: j,
|
|
35
|
+
onMouseEnter: ne,
|
|
36
|
+
multiSelect: D,
|
|
37
|
+
isPartiallyChecked: G = !1,
|
|
38
|
+
depth: X = 0,
|
|
39
|
+
hasChildren: se = !1
|
|
40
|
+
} = n, ae = (J) => {
|
|
41
|
+
(J.target instanceof HTMLDivElement || J.target instanceof HTMLInputElement) && (S == null || S(d));
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ q(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: Ve("dropdown-option", {
|
|
47
|
+
selected: U,
|
|
48
|
+
disabled: o,
|
|
49
|
+
hidden: m,
|
|
50
|
+
hover: j,
|
|
51
|
+
"multi-select": D,
|
|
52
|
+
"has-children": se,
|
|
53
|
+
[`depth-${X}`]: X > 0
|
|
54
|
+
}),
|
|
55
|
+
title: f,
|
|
56
|
+
onClick: ae,
|
|
57
|
+
ref: t,
|
|
58
|
+
onMouseEnter: ne,
|
|
59
|
+
children: [
|
|
60
|
+
D && /* @__PURE__ */ u(Kr, { value: !!U, partiallyChecked: G }),
|
|
61
|
+
/* @__PURE__ */ u(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: Ve("single-option", {
|
|
65
|
+
"sub-option": !!v
|
|
66
|
+
}),
|
|
67
|
+
children: B ? B(n) : g
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
), Rr = [
|
|
75
|
+
p.ENTER_KEY_CODE,
|
|
76
|
+
p.SPACE_KEY_CODE,
|
|
77
|
+
p.ARROW_DOWN_KEY_CODE
|
|
78
|
+
], Yr = [p.ESCAPE_KEY_CODE, p.TAB_KEY_CODE];
|
|
79
|
+
var V = /* @__PURE__ */ ((n) => (n.ON_KEY_DOWN = "onKeyDown", n.ON_CLICK = "onClick", n))(V || {});
|
|
80
|
+
const Pr = 216, Vr = "data-dropdown-portal-menu", Sr = 10, Hr = (n, t) => {
|
|
81
|
+
const d = Array.isArray(t) ? t : [t];
|
|
82
|
+
return n.findIndex(({ value: o }) => d.includes(o));
|
|
83
|
+
}, Wr = (n, t) => (n % t + t) % t, _e = (n, t = 0, d = 1) => {
|
|
84
|
+
var m;
|
|
85
|
+
if (n.length === 0)
|
|
86
|
+
return 0;
|
|
87
|
+
if (!((m = n[t]) != null && m.disabled))
|
|
88
|
+
return t;
|
|
89
|
+
const o = n.length;
|
|
90
|
+
return _e(
|
|
91
|
+
n,
|
|
92
|
+
Wr(t + d, o),
|
|
93
|
+
d
|
|
94
|
+
);
|
|
95
|
+
}, Mr = (n, t) => _e(n, t), $r = (n, t) => _e(n, t, -1), We = (n, t = 0, d) => !n || n.length === 0 ? [] : n.reduce((o, m) => {
|
|
96
|
+
var g;
|
|
97
|
+
return m && (o.push({ option: m, depth: t, parent: d }), (g = m.children) != null && g.length && o.push(...We(m.children, t + 1, m))), o;
|
|
98
|
+
}, []), Me = (n) => !n || n.length === 0 ? [] : n.reduce((t, d) => {
|
|
99
|
+
var o;
|
|
100
|
+
return d && ((o = d.children) != null && o.length ? t.push(...Me(d.children)) : t.push(d)), t;
|
|
101
|
+
}, []), $e = (n) => {
|
|
102
|
+
var t;
|
|
103
|
+
return n ? (t = n.children) != null && t.length ? n.children.reduce((d, o) => (o && d.push(...$e(o)), d), []) : [n.value] : [];
|
|
104
|
+
}, zr = "_container_5qitl_1", Ur = "_icon_5qitl_7", Br = "_arrow_5qitl_15", jr = "_dropdown_5qitl_33", Gr = "_disabled_5qitl_50", Xr = "_value_5qitl_57", Jr = "_error_5qitl_60", Qr = "_touched_5qitl_60", Zr = "_opened_5qitl_64", Fr = "_placeholder_5qitl_99", et = "_ghost_5qitl_175", rt = "_divider_5qitl_196", tt = {
|
|
105
|
+
container: zr,
|
|
106
|
+
icon: Ur,
|
|
107
|
+
arrow: Br,
|
|
108
|
+
"clear-button": "_clear-button_5qitl_23",
|
|
109
|
+
dropdown: jr,
|
|
110
|
+
"transparent-background": "_transparent-background_5qitl_47",
|
|
111
|
+
disabled: Gr,
|
|
112
|
+
value: Xr,
|
|
113
|
+
error: Jr,
|
|
114
|
+
touched: Qr,
|
|
115
|
+
opened: Zr,
|
|
116
|
+
placeholder: Fr,
|
|
117
|
+
"mobile-disabled": "_mobile-disabled_5qitl_103",
|
|
118
|
+
"value-wrapper": "_value-wrapper_5qitl_108",
|
|
119
|
+
"tags-wrapper": "_tags-wrapper_5qitl_114",
|
|
120
|
+
"with-search": "_with-search_5qitl_119",
|
|
121
|
+
"search-input": "_search-input_5qitl_126",
|
|
122
|
+
"value-tooltip": "_value-tooltip_5qitl_144",
|
|
123
|
+
"select-list": "_select-list_5qitl_149",
|
|
124
|
+
"limited-width": "_limited-width_5qitl_166",
|
|
125
|
+
"options-container": "_options-container_5qitl_170",
|
|
126
|
+
ghost: et,
|
|
127
|
+
divider: rt
|
|
128
|
+
}, _ = He.bind(tt), yt = ({
|
|
129
|
+
multiSelect: n = !1,
|
|
130
|
+
value: t = n ? [] : "",
|
|
131
|
+
options: d = [],
|
|
132
|
+
disabled: o = !1,
|
|
133
|
+
error: m,
|
|
134
|
+
onChange: g,
|
|
135
|
+
onFocus: f,
|
|
136
|
+
onBlur: v,
|
|
137
|
+
mobileDisabled: U,
|
|
138
|
+
title: S,
|
|
139
|
+
touched: B = !1,
|
|
140
|
+
icon: j,
|
|
141
|
+
variant: ne,
|
|
142
|
+
placeholder: D = "",
|
|
143
|
+
label: G = "",
|
|
144
|
+
renderOption: X,
|
|
145
|
+
transparentBackground: se = !1,
|
|
146
|
+
className: ae,
|
|
147
|
+
toggleButtonClassName: J,
|
|
148
|
+
selectListClassName: ze,
|
|
149
|
+
isListWidthLimited: Ue = !1,
|
|
150
|
+
optionAll: le = { value: "all", label: "All" },
|
|
151
|
+
isOptionAllVisible: pe = !1,
|
|
152
|
+
onSelectAll: Be = () => {
|
|
153
|
+
},
|
|
154
|
+
formatDisplayedValue: me,
|
|
155
|
+
notScrollable: H = !1,
|
|
156
|
+
footer: Q,
|
|
157
|
+
includeGroupValue: ge = !1,
|
|
158
|
+
clearable: je = !1,
|
|
159
|
+
onClear: we = () => {
|
|
160
|
+
},
|
|
161
|
+
clearButtonAriaLabel: Ge = "Clear selection",
|
|
162
|
+
tooltipPortalRoot: Xe,
|
|
163
|
+
tooltipZIndex: Je,
|
|
164
|
+
menuPortalRoot: w,
|
|
165
|
+
isMultiSelectWithTags: N = !1
|
|
166
|
+
}) => {
|
|
167
|
+
const [i, T] = te(!1), [b, Ee] = te(""), ye = I(null), Ce = I(null), W = I(null), oe = I(0), ie = I(null), ce = I(null), de = I(""), [Qe, ve] = te(!1), [Ze, Z] = te(null), L = I(null), M = C(() => We(d), [d]), $ = C(() => {
|
|
168
|
+
if (!N || !b.trim())
|
|
169
|
+
return M;
|
|
170
|
+
const e = b.toLowerCase();
|
|
171
|
+
return M.filter(
|
|
172
|
+
({ option: r }) => r.label.toLowerCase().includes(e)
|
|
173
|
+
);
|
|
174
|
+
}, [M, b, N]), E = C(
|
|
175
|
+
() => $.map(({ option: e }) => e),
|
|
176
|
+
[$]
|
|
177
|
+
), Oe = C(
|
|
178
|
+
() => M.map(({ option: e }) => e),
|
|
179
|
+
[M]
|
|
180
|
+
), F = C(() => $.filter(({ option: e }) => {
|
|
181
|
+
var r;
|
|
182
|
+
return (r = e.children) == null ? void 0 : r.length;
|
|
183
|
+
}).map(({ option: e }) => e), [$]), Ae = C(() => Me(d), [d]), O = C(
|
|
184
|
+
() => Ae.map(({ value: e }) => e),
|
|
185
|
+
[Ae]
|
|
186
|
+
), ee = C(() => {
|
|
187
|
+
const e = /* @__PURE__ */ new Map();
|
|
188
|
+
return F.forEach((r) => {
|
|
189
|
+
e.set(r.value, $e(r));
|
|
190
|
+
}), e;
|
|
191
|
+
}, [F]), z = K(
|
|
192
|
+
(e) => (F.forEach((r) => {
|
|
193
|
+
const s = ee.get(r.value) ?? [], l = s.length > 0 && s.every((c) => e.has(c));
|
|
194
|
+
ge && l ? e.add(r.value) : e.delete(r.value);
|
|
195
|
+
}), e),
|
|
196
|
+
[F, ge, ee]
|
|
197
|
+
), k = C(() => !n || !Array.isArray(t) ? /* @__PURE__ */ new Set() : z(new Set(t)), [n, t, z]), De = n ? Array.isArray(t) && t.length > 0 : t || t === !1 || t === 0, Fe = je && De && !o, er = K((e) => {
|
|
198
|
+
oe.current = e.scrollTop;
|
|
199
|
+
}, []);
|
|
200
|
+
Ye(() => {
|
|
201
|
+
i && !H && W.current && !(n && L.current !== null) && W.current.scrollTop(oe.current);
|
|
202
|
+
}, [i, H, t, n]);
|
|
203
|
+
const { refs: R, floatingStyles: Ne } = gr({
|
|
204
|
+
placement: "bottom-start",
|
|
205
|
+
middleware: [
|
|
206
|
+
wr(5),
|
|
207
|
+
Er({
|
|
208
|
+
fallbackPlacements: ["bottom-start", "top-start", "bottom", "top"],
|
|
209
|
+
...w && {
|
|
210
|
+
boundary: document.documentElement,
|
|
211
|
+
rootBoundary: "viewport"
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
214
|
+
w ? yr({
|
|
215
|
+
apply({ rects: e, elements: r }) {
|
|
216
|
+
const s = e.reference.width;
|
|
217
|
+
Object.assign(r.floating.style, {
|
|
218
|
+
width: `${s}px`,
|
|
219
|
+
minWidth: `${s}px`,
|
|
220
|
+
maxWidth: `${s}px`
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}) : null
|
|
224
|
+
].filter(Boolean),
|
|
225
|
+
whileElementsMounted: i && w ? (e, r, s) => Cr(e, r, s, {
|
|
226
|
+
animationFrame: !0
|
|
227
|
+
}) : void 0
|
|
228
|
+
}), rr = () => {
|
|
229
|
+
if (!pe)
|
|
230
|
+
return;
|
|
231
|
+
const e = Array.isArray(t) ? t : [], r = new Set(e), s = O.some((c) => !r.has(c));
|
|
232
|
+
O.forEach((c) => {
|
|
233
|
+
s ? r.add(c) : r.delete(c);
|
|
234
|
+
});
|
|
235
|
+
const l = z(r);
|
|
236
|
+
g(Array.from(l)), Be();
|
|
237
|
+
}, y = K(() => {
|
|
238
|
+
T(!1), Ee(""), de.current = "", v == null || v();
|
|
239
|
+
}, [v]), ue = K(() => {
|
|
240
|
+
if (o)
|
|
241
|
+
return;
|
|
242
|
+
g(n ? [] : ""), we(), y(), requestAnimationFrame(() => {
|
|
243
|
+
const r = R.reference.current;
|
|
244
|
+
r && r instanceof HTMLElement && r.focus();
|
|
245
|
+
});
|
|
246
|
+
}, [o, n, g, we, y, R]), tr = K(
|
|
247
|
+
(e) => {
|
|
248
|
+
e.preventDefault(), e.stopPropagation(), ue();
|
|
249
|
+
},
|
|
250
|
+
[ue]
|
|
251
|
+
), be = K(
|
|
252
|
+
(e) => {
|
|
253
|
+
var c, a;
|
|
254
|
+
if (!i)
|
|
255
|
+
return;
|
|
256
|
+
const r = e == null ? void 0 : e.target;
|
|
257
|
+
if (!r)
|
|
258
|
+
return;
|
|
259
|
+
const s = (c = ye.current) == null ? void 0 : c.contains(r), l = (a = Ce.current) == null ? void 0 : a.contains(r);
|
|
260
|
+
!s && !l && y();
|
|
261
|
+
},
|
|
262
|
+
[i, y]
|
|
263
|
+
);
|
|
264
|
+
P(() => {
|
|
265
|
+
if (!i)
|
|
266
|
+
return;
|
|
267
|
+
const e = (r) => {
|
|
268
|
+
be(r);
|
|
269
|
+
};
|
|
270
|
+
return document.addEventListener("pointerdown", e), () => {
|
|
271
|
+
document.removeEventListener("pointerdown", e);
|
|
272
|
+
};
|
|
273
|
+
}, [i, be]);
|
|
274
|
+
const Ie = (e) => {
|
|
275
|
+
var r;
|
|
276
|
+
if (!e.disabled) {
|
|
277
|
+
if (n) {
|
|
278
|
+
const s = Array.isArray(t) ? t : [], l = new Set(s);
|
|
279
|
+
if ((r = e.children) != null && r.length) {
|
|
280
|
+
const a = ee.get(e.value) ?? [], h = a.some((A) => !l.has(A));
|
|
281
|
+
a.forEach((A) => {
|
|
282
|
+
h ? l.add(A) : l.delete(A);
|
|
283
|
+
});
|
|
284
|
+
} else
|
|
285
|
+
l.has(e.value) ? l.delete(e.value) : l.add(e.value);
|
|
286
|
+
const c = z(l);
|
|
287
|
+
g(Array.from(c));
|
|
288
|
+
} else
|
|
289
|
+
g(e.value);
|
|
290
|
+
T((s) => n || !s);
|
|
291
|
+
}
|
|
292
|
+
}, nr = () => E.find(({ value: e }) => e === t), Ke = Hr(E, t), {
|
|
293
|
+
getToggleButtonProps: sr,
|
|
294
|
+
getLabelProps: ar,
|
|
295
|
+
getMenuProps: Te,
|
|
296
|
+
getItemProps: lr,
|
|
297
|
+
setHighlightedIndex: x,
|
|
298
|
+
highlightedIndex: fe
|
|
299
|
+
} = he({
|
|
300
|
+
items: E,
|
|
301
|
+
itemToString: (e) => (e != null && e.label ? String(e.label) : D) || "",
|
|
302
|
+
selectedItem: nr(),
|
|
303
|
+
isOpen: i,
|
|
304
|
+
circularNavigation: !0,
|
|
305
|
+
defaultHighlightedIndex: Ke,
|
|
306
|
+
onHighlightedIndexChange: (e) => {
|
|
307
|
+
switch (e.type) {
|
|
308
|
+
case he.stateChangeTypes.MenuKeyDownArrowUp:
|
|
309
|
+
return Z(V.ON_KEY_DOWN), x($r(E, e.highlightedIndex)), e;
|
|
310
|
+
case he.stateChangeTypes.MenuKeyDownArrowDown:
|
|
311
|
+
return Z(V.ON_KEY_DOWN), x(Mr(E, e.highlightedIndex)), e;
|
|
312
|
+
default:
|
|
313
|
+
return e;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}), Le = K(
|
|
317
|
+
(e) => {
|
|
318
|
+
Ce.current = e, R.setFloating(e);
|
|
319
|
+
},
|
|
320
|
+
[R]
|
|
321
|
+
), or = K(
|
|
322
|
+
(e = {}) => {
|
|
323
|
+
const r = Te(e), s = r.ref;
|
|
324
|
+
return {
|
|
325
|
+
...r,
|
|
326
|
+
ref: (l) => {
|
|
327
|
+
Le(l), typeof s == "function" ? s(l) : s && (s.current = l);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
},
|
|
331
|
+
[Te, Le]
|
|
332
|
+
);
|
|
333
|
+
P(() => {
|
|
334
|
+
n && i && L.current !== null && L.current >= 0 && L.current < E.length && (x(L.current), L.current = null, requestAnimationFrame(() => {
|
|
335
|
+
W.current && !H && W.current.scrollTop(oe.current);
|
|
336
|
+
}));
|
|
337
|
+
}, [n, i, t, E.length, x, H]), P(() => {
|
|
338
|
+
i && N && requestAnimationFrame(() => {
|
|
339
|
+
var e;
|
|
340
|
+
(e = ce.current) == null || e.focus();
|
|
341
|
+
});
|
|
342
|
+
}, [i, N]), P(() => {
|
|
343
|
+
N && i && b !== de.current && (de.current = b, b && x(0));
|
|
344
|
+
}, [b, N, i]), Ye(() => {
|
|
345
|
+
if (!i || !w)
|
|
346
|
+
return;
|
|
347
|
+
let e = window.scrollY, r = !0;
|
|
348
|
+
const s = 300, l = () => {
|
|
349
|
+
if (!r)
|
|
350
|
+
return;
|
|
351
|
+
window.scrollY !== e && window.scrollTo(0, e);
|
|
352
|
+
}, c = (h) => {
|
|
353
|
+
r && (h.preventDefault(), h.stopImmediatePropagation(), l());
|
|
354
|
+
};
|
|
355
|
+
e = window.scrollY, window.addEventListener("scroll", c, { passive: !1, capture: !0 }), requestAnimationFrame(() => {
|
|
356
|
+
e = window.scrollY, l();
|
|
357
|
+
});
|
|
358
|
+
const a = setTimeout(() => {
|
|
359
|
+
r = !1;
|
|
360
|
+
}, s);
|
|
361
|
+
return () => {
|
|
362
|
+
clearTimeout(a), window.removeEventListener("scroll", c, { capture: !0 });
|
|
363
|
+
};
|
|
364
|
+
}, [i, w]), P(() => {
|
|
365
|
+
if (!i || !w)
|
|
366
|
+
return;
|
|
367
|
+
const e = () => {
|
|
368
|
+
y();
|
|
369
|
+
};
|
|
370
|
+
return window.addEventListener("resize", e), () => {
|
|
371
|
+
window.removeEventListener("resize", e);
|
|
372
|
+
};
|
|
373
|
+
}, [i, w, y]);
|
|
374
|
+
const ke = () => {
|
|
375
|
+
o || (T((e) => !e), i ? v == null || v() : f == null || f(), Z(V.ON_CLICK));
|
|
376
|
+
}, re = C(() => {
|
|
377
|
+
if (n && Array.isArray(t) && O.length > 0 && O.every((r) => k.has(r)))
|
|
378
|
+
return le.label;
|
|
379
|
+
const e = E.reduce((r, s) => ((Array.isArray(t) && t.includes(s.value) || s.value === t) && r.push(s.label), r), []);
|
|
380
|
+
if (e.length > 0)
|
|
381
|
+
return e.join(", ");
|
|
382
|
+
if (!t && t !== !1 && t !== 0 || Array.isArray(t) && !t.length)
|
|
383
|
+
return D;
|
|
384
|
+
}, [
|
|
385
|
+
n,
|
|
386
|
+
t,
|
|
387
|
+
O,
|
|
388
|
+
k,
|
|
389
|
+
le.label,
|
|
390
|
+
E,
|
|
391
|
+
D
|
|
392
|
+
]);
|
|
393
|
+
P(() => {
|
|
394
|
+
if (ie.current) {
|
|
395
|
+
const { offsetWidth: e, scrollWidth: r } = ie.current;
|
|
396
|
+
ve(r > e);
|
|
397
|
+
} else
|
|
398
|
+
ve(!1);
|
|
399
|
+
}, [re]);
|
|
400
|
+
const ir = (e) => {
|
|
401
|
+
const { keyCode: r } = e;
|
|
402
|
+
Rr.includes(r) && e.target === e.currentTarget && (e.preventDefault(), e.stopPropagation(), !i && (x(Ke), T(!0), f == null || f(), Z(V.ON_KEY_DOWN)));
|
|
403
|
+
}, cr = (e) => {
|
|
404
|
+
const { keyCode: r } = e;
|
|
405
|
+
if (r === p.ENTER_KEY_CODE || r === p.SPACE_KEY_CODE) {
|
|
406
|
+
const s = E[fe];
|
|
407
|
+
if (!s)
|
|
408
|
+
return;
|
|
409
|
+
n && (L.current = fe), Ie(s), n || y();
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
Yr.includes(r) && (e.stopPropagation(), y());
|
|
413
|
+
}, xe = () => /* @__PURE__ */ q("div", { className: _("options-container"), children: [
|
|
414
|
+
n && pe && /* @__PURE__ */ q(Re, { children: [
|
|
415
|
+
/* @__PURE__ */ u(
|
|
416
|
+
Se,
|
|
417
|
+
{
|
|
418
|
+
option: le,
|
|
419
|
+
selected: Array.isArray(t) && O.length > 0 && O.every((e) => k.has(e)),
|
|
420
|
+
onChange: rr,
|
|
421
|
+
multiSelect: n,
|
|
422
|
+
isPartiallyChecked: O.some((e) => k.has(e)) && !O.every((e) => k.has(e))
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
/* @__PURE__ */ u("div", { className: _("divider") }),
|
|
426
|
+
" "
|
|
427
|
+
] }),
|
|
428
|
+
$.map(({ option: e, depth: r }, s) => {
|
|
429
|
+
var h, A;
|
|
430
|
+
const l = ee.get(e.value) ?? [e.value], c = n && l.every((Y) => k.has(Y)), a = n && ((h = e.children) == null ? void 0 : h.length) && l.some((Y) => k.has(Y)) && !c;
|
|
431
|
+
return /* @__PURE__ */ u(
|
|
432
|
+
Se,
|
|
433
|
+
{
|
|
434
|
+
...lr({
|
|
435
|
+
item: e,
|
|
436
|
+
index: s
|
|
437
|
+
}),
|
|
438
|
+
multiSelect: n,
|
|
439
|
+
selected: n ? c : e.value === t,
|
|
440
|
+
option: { title: e.label, ...e },
|
|
441
|
+
highlightHovered: fe === s && Ze !== V.ON_CLICK,
|
|
442
|
+
render: X,
|
|
443
|
+
onChange: e.disabled ? null : () => Ie(e),
|
|
444
|
+
onMouseEnter: () => x(s),
|
|
445
|
+
depth: r,
|
|
446
|
+
hasChildren: !!((A = e.children) != null && A.length),
|
|
447
|
+
isPartiallyChecked: a
|
|
448
|
+
},
|
|
449
|
+
e.value
|
|
450
|
+
);
|
|
451
|
+
}),
|
|
452
|
+
Q && /* @__PURE__ */ q(Re, { children: [
|
|
453
|
+
/* @__PURE__ */ u("div", { className: _("divider") }),
|
|
454
|
+
typeof Q == "function" ? Q(y) : Q
|
|
455
|
+
] })
|
|
456
|
+
] }), dr = () => {
|
|
457
|
+
const e = Oe.reduce((a, h) => (Array.isArray(t) && t.includes(h.value) && a.push(h.label), a), []), r = (a) => {
|
|
458
|
+
const h = Oe.find(
|
|
459
|
+
({ label: _r }) => _r === a
|
|
460
|
+
);
|
|
461
|
+
if (!h)
|
|
462
|
+
return;
|
|
463
|
+
const A = Array.isArray(t) ? t : [], Y = new Set(A);
|
|
464
|
+
Y.delete(h.value);
|
|
465
|
+
const hr = z(Y);
|
|
466
|
+
g(Array.from(hr));
|
|
467
|
+
}, s = (a) => {
|
|
468
|
+
const h = a.target;
|
|
469
|
+
Ee(a.target.value), i || (T(!0), f == null || f(), requestAnimationFrame(() => {
|
|
470
|
+
h.focus();
|
|
471
|
+
}));
|
|
472
|
+
}, l = (a) => {
|
|
473
|
+
if (a.keyCode === p.ESCAPE_KEY_CODE) {
|
|
474
|
+
a.stopPropagation(), y();
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
a.keyCode === p.ENTER_KEY_CODE || a.keyCode === p.SPACE_KEY_CODE || (a.keyCode === p.ARROW_DOWN_KEY_CODE || a.keyCode === p.ARROW_UP_KEY_CODE) && (a.preventDefault(), i || (T(!0), f == null || f()));
|
|
478
|
+
}, c = /* @__PURE__ */ u(
|
|
479
|
+
"input",
|
|
480
|
+
{
|
|
481
|
+
ref: ce,
|
|
482
|
+
type: "text",
|
|
483
|
+
className: _("search-input"),
|
|
484
|
+
value: b,
|
|
485
|
+
onChange: s,
|
|
486
|
+
onKeyDown: l,
|
|
487
|
+
onClick: (a) => {
|
|
488
|
+
a.stopPropagation(), i || (T(!0), f == null || f());
|
|
489
|
+
},
|
|
490
|
+
placeholder: Pe(e) ? D : "",
|
|
491
|
+
autoComplete: "off"
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
return Pe(e) ? /* @__PURE__ */ u("div", { className: _("tags-wrapper", "with-search"), children: c }) : /* @__PURE__ */ q("div", { className: _("tags-wrapper", "with-search"), children: [
|
|
495
|
+
/* @__PURE__ */ u(
|
|
496
|
+
Ir,
|
|
497
|
+
{
|
|
498
|
+
tags: e,
|
|
499
|
+
onRemoveTag: r,
|
|
500
|
+
isShowAllView: !0,
|
|
501
|
+
defaultVisibleLines: Sr
|
|
502
|
+
}
|
|
503
|
+
),
|
|
504
|
+
c
|
|
505
|
+
] });
|
|
506
|
+
}, ur = () => {
|
|
507
|
+
if (N && n && Array.isArray(t))
|
|
508
|
+
return dr();
|
|
509
|
+
const e = me ? me(re) : re, r = /* @__PURE__ */ u(
|
|
510
|
+
"span",
|
|
511
|
+
{
|
|
512
|
+
ref: ie,
|
|
513
|
+
className: _("value", {
|
|
514
|
+
placeholder: re === D
|
|
515
|
+
}),
|
|
516
|
+
children: e
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
return De && !!e && Qe ? /* @__PURE__ */ u(
|
|
520
|
+
Nr,
|
|
521
|
+
{
|
|
522
|
+
content: e,
|
|
523
|
+
placement: "top",
|
|
524
|
+
wrapperClassName: _("value-tooltip"),
|
|
525
|
+
portalRoot: Xe,
|
|
526
|
+
zIndex: Je,
|
|
527
|
+
children: r
|
|
528
|
+
}
|
|
529
|
+
) : r;
|
|
530
|
+
}, fr = sr({
|
|
531
|
+
className: _("dropdown", ne, J, {
|
|
532
|
+
"transparent-background": se,
|
|
533
|
+
opened: i,
|
|
534
|
+
disabled: o,
|
|
535
|
+
error: m,
|
|
536
|
+
touched: B,
|
|
537
|
+
"mobile-disabled": U
|
|
538
|
+
}),
|
|
539
|
+
onClick: ke,
|
|
540
|
+
onKeyDown: ir,
|
|
541
|
+
ref: R.setReference
|
|
542
|
+
}), { type: nt, ...qe } = fr;
|
|
543
|
+
return /* @__PURE__ */ q("div", { ref: ye, className: _("container", ae), title: S, children: [
|
|
544
|
+
G && /* @__PURE__ */ u(
|
|
545
|
+
br,
|
|
546
|
+
{
|
|
547
|
+
...ar(),
|
|
548
|
+
onClick: () => !o && ke(),
|
|
549
|
+
style: { cursor: o ? "default" : "pointer" },
|
|
550
|
+
children: G
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
/* @__PURE__ */ q(
|
|
554
|
+
"div",
|
|
555
|
+
{
|
|
556
|
+
...qe,
|
|
557
|
+
role: "button",
|
|
558
|
+
"aria-disabled": o,
|
|
559
|
+
tabIndex: o ? -1 : qe.tabIndex ?? 0,
|
|
560
|
+
children: [
|
|
561
|
+
j && /* @__PURE__ */ u("span", { className: _("icon"), children: j }),
|
|
562
|
+
/* @__PURE__ */ u("div", { className: _("value-wrapper"), children: ur() }),
|
|
563
|
+
Fe && /* @__PURE__ */ u(
|
|
564
|
+
Or,
|
|
565
|
+
{
|
|
566
|
+
className: _("clear-button"),
|
|
567
|
+
onClick: tr,
|
|
568
|
+
onKeyDown: (e) => {
|
|
569
|
+
const { keyCode: r } = e;
|
|
570
|
+
(r === p.ENTER_KEY_CODE || r === p.SPACE_KEY_CODE) && (e.preventDefault(), e.stopPropagation(), ue());
|
|
571
|
+
},
|
|
572
|
+
"aria-label": Ge,
|
|
573
|
+
children: /* @__PURE__ */ u(Ar, {})
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
/* @__PURE__ */ u("span", { className: _("arrow"), "aria-hidden": "true", children: /* @__PURE__ */ u(Dr, {}) })
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
i && (() => {
|
|
581
|
+
var l;
|
|
582
|
+
const e = (l = R.reference.current) == null ? void 0 : l.getBoundingClientRect().width, r = w && e ? {
|
|
583
|
+
...Ne,
|
|
584
|
+
width: `${e}px`,
|
|
585
|
+
minWidth: `${e}px`,
|
|
586
|
+
maxWidth: `${e}px`
|
|
587
|
+
} : Ne, s = /* @__PURE__ */ u(
|
|
588
|
+
"div",
|
|
589
|
+
{
|
|
590
|
+
style: r,
|
|
591
|
+
className: _(
|
|
592
|
+
"select-list",
|
|
593
|
+
{
|
|
594
|
+
opened: i,
|
|
595
|
+
"limited-width": Ue
|
|
596
|
+
},
|
|
597
|
+
ze
|
|
598
|
+
),
|
|
599
|
+
...w && { [Vr]: "" },
|
|
600
|
+
...or({
|
|
601
|
+
onKeyDown: cr,
|
|
602
|
+
...N && {
|
|
603
|
+
tabIndex: -1,
|
|
604
|
+
onFocus: (c) => {
|
|
605
|
+
var a;
|
|
606
|
+
c.preventDefault(), (a = ce.current) == null || a.focus();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}),
|
|
610
|
+
children: H ? xe() : /* @__PURE__ */ u(
|
|
611
|
+
vr,
|
|
612
|
+
{
|
|
613
|
+
autoHeight: !0,
|
|
614
|
+
autoHeightMax: Pr,
|
|
615
|
+
hideTracksWhenNotNeeded: !0,
|
|
616
|
+
ref: (c) => {
|
|
617
|
+
W.current = c;
|
|
618
|
+
},
|
|
619
|
+
onScrollFrame: er,
|
|
620
|
+
children: xe()
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
);
|
|
625
|
+
return w ? mr(s, w) : s;
|
|
626
|
+
})()
|
|
627
|
+
] });
|
|
628
|
+
};
|
|
629
|
+
export {
|
|
630
|
+
yt as D,
|
|
631
|
+
Vr as a
|
|
632
|
+
};
|
package/dist/dropdown.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as r } from "./dropdown-
|
|
2
|
-
import { a as
|
|
1
|
+
import { D as r } from "./dropdown-f33fa0ce.js";
|
|
2
|
+
import { a as E } from "./dropdown-f33fa0ce.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-dom";
|
|
@@ -15,9 +15,13 @@ import "./tooltip.js";
|
|
|
15
15
|
import "@floating-ui/react";
|
|
16
16
|
import "./floatingUi-41f8c7b5.js";
|
|
17
17
|
import "./fieldLabel.js";
|
|
18
|
+
import "./adaptiveTagList.js";
|
|
19
|
+
import "./button-97d9e587.js";
|
|
20
|
+
import "./close-4d480ef7.js";
|
|
21
|
+
import "./isEmpty-ccacb5ff.js";
|
|
18
22
|
import "./checkbox-ed6cc375.js";
|
|
19
23
|
export {
|
|
20
|
-
|
|
24
|
+
E as DROPDOWN_PORTAL_MENU_ATTR,
|
|
21
25
|
r as Dropdown,
|
|
22
26
|
r as default
|
|
23
27
|
};
|