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