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