@reportportal/ui-kit 0.0.1-alpha.120 → 0.0.1-alpha.122
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/autocompletes.js +7 -6
- package/dist/clear-53660571.js +5 -0
- package/dist/components/dropdown/constants.d.ts +1 -0
- package/dist/components/dropdown/dropdown.d.ts +11 -0
- package/dist/components/dropdown/types.d.ts +8 -0
- package/dist/components/dropdown/utils.d.ts +4 -1
- package/dist/components/filtersButton/filtersButton.d.ts +9 -0
- package/dist/components/filtersButton/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/{datePicker-fe5bfdcd.js → datePicker-fcff097b.js} +2 -2
- package/dist/datePicker.js +11 -6
- package/dist/dropdown-e85dd323.js +436 -0
- package/dist/dropdown.js +6 -1
- package/dist/{fieldText-e4a554dc.js → fieldText-2c4790e1.js} +11 -10
- package/dist/fieldText.js +3 -2
- package/dist/filterOutline-819b4b0d.js +6 -0
- package/dist/filtersButton.js +25 -0
- package/dist/icons.js +66 -64
- package/dist/index.js +93 -89
- package/dist/openEye-950159cb.js +6 -0
- package/dist/{pagination-902e46fc.js → pagination-5cc0ebdd.js} +1 -1
- package/dist/pagination.js +4 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/dropdown-ec754bbe.js +0 -289
- package/dist/openEye-7b9cf080.js +0 -7
package/dist/autocompletes.js
CHANGED
|
@@ -8,10 +8,11 @@ import { S as Me } from "./plus-199fb2a8.js";
|
|
|
8
8
|
import { i as qe } from "./isEmpty-ccacb5ff.js";
|
|
9
9
|
import U from "downshift";
|
|
10
10
|
import { useFloating as he, autoUpdate as be } from "@floating-ui/react";
|
|
11
|
-
import { F as Ae } from "./fieldText-
|
|
11
|
+
import { F as Ae } from "./fieldText-2c4790e1.js";
|
|
12
12
|
import { S as ve } from "./dropdown-0260bb66.js";
|
|
13
13
|
import { S as $e } from "./close-4d480ef7.js";
|
|
14
|
-
import { S as De } from "./
|
|
14
|
+
import { S as De } from "./clear-53660571.js";
|
|
15
|
+
import "./openEye-950159cb.js";
|
|
15
16
|
import "./baseIconButton-251479f7.js";
|
|
16
17
|
import "./spinLoader-c4a53718.js";
|
|
17
18
|
import "./maxValueDisplay-9be01a75.js";
|
|
@@ -349,7 +350,7 @@ const Ce = "_disabled_18ek6_43", Re = "_input_18ek6_97", Oe = {
|
|
|
349
350
|
"error-text": "_error-text_w0t1o_109",
|
|
350
351
|
"dropdown-button": "_dropdown-button_w0t1o_118",
|
|
351
352
|
"icon-reversed": "_icon-reversed_w0t1o_126"
|
|
352
|
-
}, j = H.bind(ft),
|
|
353
|
+
}, j = H.bind(ft), jt = (o) => {
|
|
353
354
|
const {
|
|
354
355
|
options: e = [],
|
|
355
356
|
loading: a = !1,
|
|
@@ -580,7 +581,7 @@ const Ce = "_disabled_18ek6_43", Re = "_input_18ek6_97", Oe = {
|
|
|
580
581
|
"input-wrapper": "_input-wrapper_d9vma_1",
|
|
581
582
|
"dropdown-button": "_dropdown-button_d9vma_6",
|
|
582
583
|
"icon-reversed": "_icon-reversed_d9vma_14"
|
|
583
|
-
}, pe = H.bind(ht), bt = 0,
|
|
584
|
+
}, pe = H.bind(ht), bt = 0, Ht = (o) => {
|
|
584
585
|
const {
|
|
585
586
|
options: e = [],
|
|
586
587
|
value: a,
|
|
@@ -723,6 +724,6 @@ export {
|
|
|
723
724
|
fe as AutocompleteOption,
|
|
724
725
|
Ve as AutocompleteOptions,
|
|
725
726
|
ze as AutocompletePrompt,
|
|
726
|
-
|
|
727
|
-
|
|
727
|
+
jt as MultipleAutocomplete,
|
|
728
|
+
Ht as SingleAutocomplete
|
|
728
729
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const t = (l) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...l }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1 8C1 4.14001 4.14001 1 8 1C11.86 1 15 4.14001 15 8C15 11.8595 11.86 15 8 15C4.14001 15 1 11.8595 1 8ZM5 5.54545L5.54545 5L8 7.45455L10.4545 5L11 5.54545L8.54545 8L11 10.4545L10.4545 11L8 8.54545L5.54545 11L5 10.4545L7.45455 8L5 5.54545Z", fill: "#A2AAB5" }));
|
|
3
|
+
export {
|
|
4
|
+
t as S
|
|
5
|
+
};
|
|
@@ -29,5 +29,16 @@ export interface DropdownProps {
|
|
|
29
29
|
formatDisplayedValue?: (value: string | undefined) => string;
|
|
30
30
|
notScrollable?: boolean;
|
|
31
31
|
footer?: ReactNode | ((closeHandler: () => void) => ReactNode);
|
|
32
|
+
/**
|
|
33
|
+
* For nested options: whether to include parent group values in the onChange callback
|
|
34
|
+
* when all children are selected. Default: false (only leaf values are included)
|
|
35
|
+
*/
|
|
36
|
+
includeGroupValue?: boolean;
|
|
37
|
+
/** Whether to show a clear button to reset the selection */
|
|
38
|
+
clearable?: boolean;
|
|
39
|
+
/** Callback fired when the clear button is clicked */
|
|
40
|
+
onClear?: () => void;
|
|
41
|
+
/** ARIA label for the clear button */
|
|
42
|
+
clearButtonAriaLabel?: string;
|
|
32
43
|
}
|
|
33
44
|
export declare const Dropdown: FC<DropdownProps>;
|
|
@@ -10,6 +10,7 @@ export type DropdownOptionType = {
|
|
|
10
10
|
hidden?: boolean;
|
|
11
11
|
title?: string;
|
|
12
12
|
groupRef?: string;
|
|
13
|
+
children?: DropdownOptionType[];
|
|
13
14
|
};
|
|
14
15
|
export interface DropdownOptionProps {
|
|
15
16
|
selected?: boolean;
|
|
@@ -19,5 +20,12 @@ export interface DropdownOptionProps {
|
|
|
19
20
|
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
20
21
|
multiSelect?: boolean;
|
|
21
22
|
isPartiallyChecked?: boolean;
|
|
23
|
+
depth?: number;
|
|
24
|
+
hasChildren?: boolean;
|
|
22
25
|
option: DropdownOptionType;
|
|
23
26
|
}
|
|
27
|
+
export type FlattenedDropdownOption = {
|
|
28
|
+
option: DropdownOptionType;
|
|
29
|
+
depth: number;
|
|
30
|
+
parent?: DropdownOptionType;
|
|
31
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { DropdownValue, DropdownOptionType } from './types';
|
|
1
|
+
import { DropdownValue, DropdownOptionType, FlattenedDropdownOption } from './types';
|
|
2
2
|
|
|
3
3
|
export declare const calculateDefaultIndex: (options: DropdownOptionType[], selectedValue: DropdownValue | DropdownValue[]) => number;
|
|
4
4
|
export declare const calculateNextIndex: (options: DropdownOptionType[], index?: number) => number;
|
|
5
5
|
export declare const calculatePrevIndex: (options: DropdownOptionType[], index?: number) => number;
|
|
6
|
+
export declare const flattenOptions: (options: DropdownOptionType[], depth?: number, parent?: DropdownOptionType) => FlattenedDropdownOption[];
|
|
7
|
+
export declare const getLeafOptions: (options: DropdownOptionType[]) => DropdownOptionType[];
|
|
8
|
+
export declare const getOptionLeafValues: (option: DropdownOptionType) => DropdownValue[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface FiltersButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'type'> {
|
|
4
|
+
appliedFiltersCount?: number;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
type?: 'button' | 'submit';
|
|
7
|
+
}
|
|
8
|
+
export declare const FiltersButton: (props: FiltersButtonProps & import('react').RefAttributes<HTMLButtonElement>) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>> | null;
|
|
9
|
+
export default FiltersButton;
|
|
@@ -11,6 +11,7 @@ export { FieldNumber } from './fieldNumber';
|
|
|
11
11
|
export { FieldText } from './fieldText';
|
|
12
12
|
export { FieldTextFlex } from './fieldTextFlex';
|
|
13
13
|
export { FileDropArea } from './fileDropArea';
|
|
14
|
+
export { FiltersButton } from './filtersButton';
|
|
14
15
|
export { Modal } from './modal';
|
|
15
16
|
export { MultipleAutocomplete } from './autocompletes/multipleAutocomplete';
|
|
16
17
|
export { Pagination } from './pagination';
|
|
@@ -2,8 +2,8 @@ import { jsxs as F, Fragment as $, jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
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
|
-
import { F as I } from "./fieldText-
|
|
6
|
-
import { D as E } from "./dropdown-
|
|
5
|
+
import { F as I } from "./fieldText-2c4790e1.js";
|
|
6
|
+
import { D as E } from "./dropdown-e85dd323.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,27 +1,32 @@
|
|
|
1
|
-
import { D as t } from "./datePicker-
|
|
2
|
-
import { r as
|
|
1
|
+
import { D as t } from "./datePicker-fcff097b.js";
|
|
2
|
+
import { r as A } from "./datePicker-fcff097b.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react-datepicker/dist/es/index.js";
|
|
5
5
|
import "./bind-06a7ff84.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import "./fieldText-
|
|
8
|
-
import "./
|
|
7
|
+
import "./fieldText-2c4790e1.js";
|
|
8
|
+
import "./clear-53660571.js";
|
|
9
|
+
import "./openEye-950159cb.js";
|
|
9
10
|
import "./baseIconButton-251479f7.js";
|
|
10
11
|
import "./spinLoader-c4a53718.js";
|
|
11
12
|
import "./maxValueDisplay-9be01a75.js";
|
|
12
13
|
import "./fieldLabel.js";
|
|
13
|
-
import "./dropdown-
|
|
14
|
+
import "./dropdown-e85dd323.js";
|
|
14
15
|
import "@floating-ui/react-dom";
|
|
15
16
|
import "downshift";
|
|
16
17
|
import "rc-scrollbars";
|
|
17
18
|
import "./useOnClickOutside-c332f7d3.js";
|
|
18
19
|
import "./keyCodes-f63c0e11.js";
|
|
19
20
|
import "./dropdown-0260bb66.js";
|
|
21
|
+
import "./tooltip.js";
|
|
22
|
+
import "react-dom";
|
|
23
|
+
import "@floating-ui/react";
|
|
24
|
+
import "./floatingUi-41f8c7b5.js";
|
|
20
25
|
import "./checkbox-ed6cc375.js";
|
|
21
26
|
import "./calendarArrow-44c7e60e.js";
|
|
22
27
|
import "react-datepicker";
|
|
23
28
|
export {
|
|
24
29
|
t as DatePicker,
|
|
25
30
|
t as default,
|
|
26
|
-
|
|
31
|
+
A as registerDatePickerLocale
|
|
27
32
|
};
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { jsxs as D, jsx as l, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Je, useState as oe, useRef as P, useMemo as y, useCallback as x, useLayoutEffect as Qe, useEffect as Oe } from "react";
|
|
3
|
+
import { c as be } from "./bind-06a7ff84.js";
|
|
4
|
+
import { useFloating as Ze, offset as er, flip as rr } from "@floating-ui/react-dom";
|
|
5
|
+
import { useSelect as le } from "downshift";
|
|
6
|
+
import { Scrollbars as tr } from "rc-scrollbars";
|
|
7
|
+
import { u as nr } from "./useOnClickOutside-c332f7d3.js";
|
|
8
|
+
import { K as w } from "./keyCodes-f63c0e11.js";
|
|
9
|
+
import { B as sr } from "./baseIconButton-251479f7.js";
|
|
10
|
+
import { S as ar } from "./clear-53660571.js";
|
|
11
|
+
import { S as or } from "./dropdown-0260bb66.js";
|
|
12
|
+
import { Tooltip as lr } from "./tooltip.js";
|
|
13
|
+
import { FieldLabel as cr } from "./fieldLabel.js";
|
|
14
|
+
import { C as dr } from "./checkbox-ed6cc375.js";
|
|
15
|
+
const ir = "_disabled_14s7v_12", ur = "_hidden_14s7v_16", hr = "_hover_14s7v_22", fr = "_selected_14s7v_38", _r = {
|
|
16
|
+
"dropdown-option": "_dropdown-option_14s7v_1",
|
|
17
|
+
disabled: ir,
|
|
18
|
+
hidden: ur,
|
|
19
|
+
hover: hr,
|
|
20
|
+
"depth-1": "_depth-1_14s7v_32",
|
|
21
|
+
selected: fr,
|
|
22
|
+
"multi-select": "_multi-select_14s7v_38",
|
|
23
|
+
"single-option": "_single-option_14s7v_43",
|
|
24
|
+
"sub-option": "_sub-option_14s7v_50"
|
|
25
|
+
}, ve = be.bind(_r), Ne = Je(
|
|
26
|
+
(t, r) => {
|
|
27
|
+
const {
|
|
28
|
+
option: { value: a, disabled: s, hidden: d, label: f, title: m, groupRef: p },
|
|
29
|
+
selected: R,
|
|
30
|
+
onChange: K,
|
|
31
|
+
render: V,
|
|
32
|
+
highlightHovered: L,
|
|
33
|
+
onMouseEnter: J,
|
|
34
|
+
multiSelect: C,
|
|
35
|
+
isPartiallyChecked: H = !1,
|
|
36
|
+
depth: Y = 0,
|
|
37
|
+
hasChildren: Q = !1
|
|
38
|
+
} = t, Z = (M) => {
|
|
39
|
+
(M.target instanceof HTMLDivElement || M.target instanceof HTMLInputElement) && (K == null || K(a));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ D(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: ve("dropdown-option", {
|
|
45
|
+
selected: R,
|
|
46
|
+
disabled: s,
|
|
47
|
+
hidden: d,
|
|
48
|
+
hover: L,
|
|
49
|
+
"multi-select": C,
|
|
50
|
+
"has-children": Q,
|
|
51
|
+
[`depth-${Y}`]: Y > 0
|
|
52
|
+
}),
|
|
53
|
+
title: m,
|
|
54
|
+
onClick: Z,
|
|
55
|
+
ref: r,
|
|
56
|
+
onMouseEnter: J,
|
|
57
|
+
children: [
|
|
58
|
+
C && /* @__PURE__ */ l(dr, { value: !!R, partiallyChecked: H }),
|
|
59
|
+
/* @__PURE__ */ l(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: ve("single-option", {
|
|
63
|
+
"sub-option": !!p
|
|
64
|
+
}),
|
|
65
|
+
children: V ? V(t) : f
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
), pr = [
|
|
73
|
+
w.ENTER_KEY_CODE,
|
|
74
|
+
w.SPACE_KEY_CODE,
|
|
75
|
+
w.ARROW_DOWN_KEY_CODE
|
|
76
|
+
], gr = [w.ESCAPE_KEY_CODE, w.TAB_KEY_CODE];
|
|
77
|
+
var A = /* @__PURE__ */ ((t) => (t.ON_KEY_DOWN = "onKeyDown", t.ON_CLICK = "onClick", t))(A || {});
|
|
78
|
+
const wr = 216, mr = (t, r) => {
|
|
79
|
+
const a = Array.isArray(r) ? r : [r];
|
|
80
|
+
return t.findIndex(({ value: s }) => a.includes(s));
|
|
81
|
+
}, yr = (t, r) => (t % r + r) % r, ce = (t, r = 0, a = 1) => {
|
|
82
|
+
var d;
|
|
83
|
+
if (t.length === 0)
|
|
84
|
+
return 0;
|
|
85
|
+
if (!((d = t[r]) != null && d.disabled))
|
|
86
|
+
return r;
|
|
87
|
+
const s = t.length;
|
|
88
|
+
return ce(
|
|
89
|
+
t,
|
|
90
|
+
yr(r + a, s),
|
|
91
|
+
a
|
|
92
|
+
);
|
|
93
|
+
}, Cr = (t, r) => ce(t, r), Er = (t, r) => ce(t, r, -1), De = (t, r = 0, a) => !t || t.length === 0 ? [] : t.reduce((s, d) => {
|
|
94
|
+
var f;
|
|
95
|
+
return d && (s.push({ option: d, depth: r, parent: a }), (f = d.children) != null && f.length && s.push(...De(d.children, r + 1, d))), s;
|
|
96
|
+
}, []), Ae = (t) => !t || t.length === 0 ? [] : t.reduce((r, a) => {
|
|
97
|
+
var s;
|
|
98
|
+
return a && ((s = a.children) != null && s.length ? r.push(...Ae(a.children)) : r.push(a)), r;
|
|
99
|
+
}, []), Ke = (t) => {
|
|
100
|
+
var r;
|
|
101
|
+
return t ? (r = t.children) != null && r.length ? t.children.reduce((a, s) => (s && a.push(...Ke(s)), a), []) : [t.value] : [];
|
|
102
|
+
}, Or = "_container_owe49_1", vr = "_icon_owe49_7", Nr = "_arrow_owe49_13", br = "_dropdown_owe49_27", Dr = "_disabled_owe49_44", Ar = "_value_owe49_51", Kr = "_error_owe49_54", Ir = "_touched_owe49_54", Tr = "_opened_owe49_58", kr = "_placeholder_owe49_93", Pr = "_ghost_owe49_139", xr = "_divider_owe49_160", Rr = {
|
|
103
|
+
container: Or,
|
|
104
|
+
icon: vr,
|
|
105
|
+
arrow: Nr,
|
|
106
|
+
"clear-button": "_clear-button_owe49_19",
|
|
107
|
+
dropdown: br,
|
|
108
|
+
"transparent-background": "_transparent-background_owe49_41",
|
|
109
|
+
disabled: Dr,
|
|
110
|
+
value: Ar,
|
|
111
|
+
error: Kr,
|
|
112
|
+
touched: Ir,
|
|
113
|
+
opened: Tr,
|
|
114
|
+
placeholder: kr,
|
|
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: Pr,
|
|
122
|
+
divider: xr
|
|
123
|
+
}, i = be.bind(Rr), Jr = ({
|
|
124
|
+
multiSelect: t = !1,
|
|
125
|
+
value: r = t ? [] : "",
|
|
126
|
+
options: a = [],
|
|
127
|
+
disabled: s = !1,
|
|
128
|
+
error: d,
|
|
129
|
+
onChange: f,
|
|
130
|
+
onFocus: m,
|
|
131
|
+
onBlur: p,
|
|
132
|
+
mobileDisabled: R,
|
|
133
|
+
title: K,
|
|
134
|
+
touched: V = !1,
|
|
135
|
+
icon: L,
|
|
136
|
+
variant: J,
|
|
137
|
+
placeholder: C = "",
|
|
138
|
+
label: H = "",
|
|
139
|
+
renderOption: Y,
|
|
140
|
+
transparentBackground: Q = !1,
|
|
141
|
+
className: Z,
|
|
142
|
+
toggleButtonClassName: M,
|
|
143
|
+
selectListClassName: Ie,
|
|
144
|
+
isListWidthLimited: Te = !1,
|
|
145
|
+
optionAll: ee = { value: "all", label: "All" },
|
|
146
|
+
isOptionAllVisible: de = !1,
|
|
147
|
+
onSelectAll: ke = () => {
|
|
148
|
+
},
|
|
149
|
+
formatDisplayedValue: ie,
|
|
150
|
+
notScrollable: I = !1,
|
|
151
|
+
footer: W,
|
|
152
|
+
includeGroupValue: ue = !1,
|
|
153
|
+
clearable: Pe = !1,
|
|
154
|
+
onClear: he = () => {
|
|
155
|
+
},
|
|
156
|
+
clearButtonAriaLabel: xe = "Clear selection"
|
|
157
|
+
}) => {
|
|
158
|
+
const [u, S] = oe(!1), fe = P(null), T = P(null), re = P(0), te = P(null), [Re, _e] = oe(!1), [Ve, $] = oe(null), E = P(null), k = y(() => De(a), [a]), _ = y(
|
|
159
|
+
() => k.map(({ option: e }) => e),
|
|
160
|
+
[k]
|
|
161
|
+
), j = y(() => k.filter(({ option: e }) => {
|
|
162
|
+
var n;
|
|
163
|
+
return (n = e.children) == null ? void 0 : n.length;
|
|
164
|
+
}).map(({ option: e }) => e), [k]), pe = y(() => Ae(a), [a]), g = y(
|
|
165
|
+
() => pe.map(({ value: e }) => e),
|
|
166
|
+
[pe]
|
|
167
|
+
), z = y(() => {
|
|
168
|
+
const e = /* @__PURE__ */ new Map();
|
|
169
|
+
return j.forEach((n) => {
|
|
170
|
+
e.set(n.value, Ke(n));
|
|
171
|
+
}), e;
|
|
172
|
+
}, [j]), q = x(
|
|
173
|
+
(e) => (j.forEach((n) => {
|
|
174
|
+
const o = z.get(n.value) ?? [], c = o.length > 0 && o.every((h) => e.has(h));
|
|
175
|
+
ue && c ? e.add(n.value) : e.delete(n.value);
|
|
176
|
+
}), e),
|
|
177
|
+
[j, ue, z]
|
|
178
|
+
), O = y(() => !t || !Array.isArray(r) ? /* @__PURE__ */ new Set() : q(new Set(r)), [t, r, q]), ge = t ? Array.isArray(r) && r.length > 0 : r || r === !1 || r === 0, Le = Pe && ge && !s, He = x((e) => {
|
|
179
|
+
re.current = e.scrollTop;
|
|
180
|
+
}, []);
|
|
181
|
+
Qe(() => {
|
|
182
|
+
u && !I && T.current && !(t && E.current !== null) && T.current.scrollTop(re.current);
|
|
183
|
+
}, [u, I, r, t]);
|
|
184
|
+
const { refs: B, floatingStyles: Ye } = Ze({
|
|
185
|
+
placement: "bottom-start",
|
|
186
|
+
middleware: [
|
|
187
|
+
er(5),
|
|
188
|
+
rr({
|
|
189
|
+
fallbackPlacements: ["bottom-start", "top-start", "bottom", "top"]
|
|
190
|
+
})
|
|
191
|
+
]
|
|
192
|
+
}), Me = () => {
|
|
193
|
+
if (!de)
|
|
194
|
+
return;
|
|
195
|
+
const e = Array.isArray(r) ? r : [], n = new Set(e), o = g.some((h) => !n.has(h));
|
|
196
|
+
g.forEach((h) => {
|
|
197
|
+
o ? n.add(h) : n.delete(h);
|
|
198
|
+
});
|
|
199
|
+
const c = q(n);
|
|
200
|
+
f(Array.from(c)), ke();
|
|
201
|
+
}, N = x(() => {
|
|
202
|
+
S(!1), p == null || p();
|
|
203
|
+
}, [p]), ne = x(() => {
|
|
204
|
+
if (s)
|
|
205
|
+
return;
|
|
206
|
+
f(t ? [] : ""), he(), N(), requestAnimationFrame(() => {
|
|
207
|
+
const n = B.reference.current;
|
|
208
|
+
n && n instanceof HTMLElement && n.focus();
|
|
209
|
+
});
|
|
210
|
+
}, [s, t, f, he, N, B]), We = x(
|
|
211
|
+
(e) => {
|
|
212
|
+
e.preventDefault(), e.stopPropagation(), ne();
|
|
213
|
+
},
|
|
214
|
+
[ne]
|
|
215
|
+
);
|
|
216
|
+
nr(fe, () => {
|
|
217
|
+
u && N();
|
|
218
|
+
});
|
|
219
|
+
const we = (e) => {
|
|
220
|
+
var n;
|
|
221
|
+
if (!e.disabled) {
|
|
222
|
+
if (t) {
|
|
223
|
+
const o = Array.isArray(r) ? r : [], c = new Set(o);
|
|
224
|
+
if ((n = e.children) != null && n.length) {
|
|
225
|
+
const F = z.get(e.value) ?? [], G = F.some((v) => !c.has(v));
|
|
226
|
+
F.forEach((v) => {
|
|
227
|
+
G ? c.add(v) : c.delete(v);
|
|
228
|
+
});
|
|
229
|
+
} else
|
|
230
|
+
c.has(e.value) ? c.delete(e.value) : c.add(e.value);
|
|
231
|
+
const h = q(c);
|
|
232
|
+
f(Array.from(h));
|
|
233
|
+
} else
|
|
234
|
+
f(e.value);
|
|
235
|
+
S((o) => t || !o);
|
|
236
|
+
}
|
|
237
|
+
}, Se = () => _.find(({ value: e }) => e === r), me = mr(_, r), {
|
|
238
|
+
getToggleButtonProps: $e,
|
|
239
|
+
getLabelProps: je,
|
|
240
|
+
getMenuProps: ze,
|
|
241
|
+
getItemProps: qe,
|
|
242
|
+
setHighlightedIndex: b,
|
|
243
|
+
highlightedIndex: se,
|
|
244
|
+
selectedItem: U
|
|
245
|
+
} = le({
|
|
246
|
+
items: _,
|
|
247
|
+
itemToString: (e) => (e != null && e.label ? String(e.label) : C) || "",
|
|
248
|
+
selectedItem: Se(),
|
|
249
|
+
isOpen: u,
|
|
250
|
+
circularNavigation: !0,
|
|
251
|
+
defaultHighlightedIndex: me,
|
|
252
|
+
onHighlightedIndexChange: (e) => {
|
|
253
|
+
switch (e.type) {
|
|
254
|
+
case le.stateChangeTypes.MenuKeyDownArrowUp:
|
|
255
|
+
return $(A.ON_KEY_DOWN), b(Er(_, e.highlightedIndex)), e;
|
|
256
|
+
case le.stateChangeTypes.MenuKeyDownArrowDown:
|
|
257
|
+
return $(A.ON_KEY_DOWN), b(Cr(_, e.highlightedIndex)), e;
|
|
258
|
+
default:
|
|
259
|
+
return e;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
Oe(() => {
|
|
264
|
+
t && u && E.current !== null && E.current >= 0 && E.current < _.length && (b(E.current), E.current = null, requestAnimationFrame(() => {
|
|
265
|
+
T.current && !I && T.current.scrollTop(re.current);
|
|
266
|
+
}));
|
|
267
|
+
}, [t, u, r, _.length, b, I]);
|
|
268
|
+
const Be = () => {
|
|
269
|
+
s || (S((e) => !e), u ? p == null || p() : m == null || m(), $(A.ON_CLICK));
|
|
270
|
+
}, X = y(() => {
|
|
271
|
+
if (t && Array.isArray(r) && g.length > 0 && g.every((n) => O.has(n)))
|
|
272
|
+
return ee.label;
|
|
273
|
+
const e = _.reduce((n, o) => ((Array.isArray(r) && r.includes(o.value) || o.value === r) && n.push(o.label), n), []);
|
|
274
|
+
if (e.length > 0)
|
|
275
|
+
return e.join(", ");
|
|
276
|
+
if (!r && r !== !1 && r !== 0 || Array.isArray(r) && !r.length)
|
|
277
|
+
return C;
|
|
278
|
+
}, [
|
|
279
|
+
t,
|
|
280
|
+
r,
|
|
281
|
+
g,
|
|
282
|
+
O,
|
|
283
|
+
ee.label,
|
|
284
|
+
_,
|
|
285
|
+
C
|
|
286
|
+
]);
|
|
287
|
+
Oe(() => {
|
|
288
|
+
if (te.current) {
|
|
289
|
+
const { offsetWidth: e, scrollWidth: n } = te.current;
|
|
290
|
+
_e(n > e);
|
|
291
|
+
} else
|
|
292
|
+
_e(!1);
|
|
293
|
+
}, [X]);
|
|
294
|
+
const Ue = (e) => {
|
|
295
|
+
const { keyCode: n } = e;
|
|
296
|
+
pr.includes(n) && e.target === e.currentTarget && (e.preventDefault(), e.stopPropagation(), !u && (b(me), S(!0), m == null || m(), $(A.ON_KEY_DOWN)));
|
|
297
|
+
}, Xe = (e) => {
|
|
298
|
+
const { keyCode: n } = e;
|
|
299
|
+
if (n === w.ENTER_KEY_CODE || n === w.SPACE_KEY_CODE) {
|
|
300
|
+
const o = _[se];
|
|
301
|
+
if (!o)
|
|
302
|
+
return;
|
|
303
|
+
t && (E.current = se), we(o), t || N();
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
gr.includes(n) && (e.stopPropagation(), N());
|
|
307
|
+
}, ye = () => /* @__PURE__ */ D("div", { className: i("options-container"), children: [
|
|
308
|
+
t && de && /* @__PURE__ */ D(Ee, { children: [
|
|
309
|
+
/* @__PURE__ */ l(
|
|
310
|
+
Ne,
|
|
311
|
+
{
|
|
312
|
+
option: ee,
|
|
313
|
+
selected: Array.isArray(r) && g.length > 0 && g.every((e) => O.has(e)),
|
|
314
|
+
onChange: Me,
|
|
315
|
+
multiSelect: t,
|
|
316
|
+
isPartiallyChecked: g.some((e) => O.has(e)) && !g.every((e) => O.has(e))
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ l("div", { className: i("divider") }),
|
|
320
|
+
" "
|
|
321
|
+
] }),
|
|
322
|
+
k.map(({ option: e, depth: n }, o) => {
|
|
323
|
+
var G, v;
|
|
324
|
+
const c = z.get(e.value) ?? [e.value], h = t && c.every((ae) => O.has(ae)), F = t && ((G = e.children) == null ? void 0 : G.length) && c.some((ae) => O.has(ae)) && !h;
|
|
325
|
+
return /* @__PURE__ */ l(
|
|
326
|
+
Ne,
|
|
327
|
+
{
|
|
328
|
+
...qe({
|
|
329
|
+
item: e,
|
|
330
|
+
index: o
|
|
331
|
+
}),
|
|
332
|
+
multiSelect: t,
|
|
333
|
+
selected: t ? h : e.value === ((U == null ? void 0 : U.value) ?? U),
|
|
334
|
+
option: { title: e.label, ...e },
|
|
335
|
+
highlightHovered: se === o && Ve !== A.ON_CLICK,
|
|
336
|
+
render: Y,
|
|
337
|
+
onChange: e.disabled ? null : () => we(e),
|
|
338
|
+
onMouseEnter: () => b(o),
|
|
339
|
+
depth: n,
|
|
340
|
+
hasChildren: !!((v = e.children) != null && v.length),
|
|
341
|
+
isPartiallyChecked: F
|
|
342
|
+
},
|
|
343
|
+
e.value
|
|
344
|
+
);
|
|
345
|
+
}),
|
|
346
|
+
W && /* @__PURE__ */ D(Ee, { children: [
|
|
347
|
+
/* @__PURE__ */ l("div", { className: i("divider") }),
|
|
348
|
+
typeof W == "function" ? W(N) : W
|
|
349
|
+
] })
|
|
350
|
+
] }), Fe = () => {
|
|
351
|
+
const e = ie ? ie(X) : X, n = /* @__PURE__ */ l(
|
|
352
|
+
"span",
|
|
353
|
+
{
|
|
354
|
+
ref: te,
|
|
355
|
+
className: i("value", {
|
|
356
|
+
placeholder: X === C
|
|
357
|
+
}),
|
|
358
|
+
children: e
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
return ge && !!e && Re ? /* @__PURE__ */ l(lr, { content: e, placement: "top", wrapperClassName: i("value-tooltip"), children: n }) : n;
|
|
362
|
+
}, Ge = $e({
|
|
363
|
+
className: i("dropdown", J, M, {
|
|
364
|
+
"transparent-background": Q,
|
|
365
|
+
opened: u,
|
|
366
|
+
disabled: s,
|
|
367
|
+
error: d,
|
|
368
|
+
touched: V,
|
|
369
|
+
"mobile-disabled": R
|
|
370
|
+
}),
|
|
371
|
+
onClick: Be,
|
|
372
|
+
onKeyDown: Ue,
|
|
373
|
+
ref: B.setReference
|
|
374
|
+
}), { type: Lr, ...Ce } = Ge;
|
|
375
|
+
return /* @__PURE__ */ D("div", { ref: fe, className: i("container", Z), title: K, children: [
|
|
376
|
+
H && /* @__PURE__ */ l(cr, { ...je(), children: H }),
|
|
377
|
+
/* @__PURE__ */ D(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
...Ce,
|
|
381
|
+
role: "button",
|
|
382
|
+
"aria-disabled": s,
|
|
383
|
+
tabIndex: s ? -1 : Ce.tabIndex ?? 0,
|
|
384
|
+
children: [
|
|
385
|
+
L && /* @__PURE__ */ l("span", { className: i("icon"), children: L }),
|
|
386
|
+
/* @__PURE__ */ l("div", { className: i("value-wrapper"), children: Fe() }),
|
|
387
|
+
Le && /* @__PURE__ */ l(
|
|
388
|
+
sr,
|
|
389
|
+
{
|
|
390
|
+
className: i("clear-button"),
|
|
391
|
+
onClick: We,
|
|
392
|
+
onKeyDown: (e) => {
|
|
393
|
+
const { keyCode: n } = e;
|
|
394
|
+
(n === w.ENTER_KEY_CODE || n === w.SPACE_KEY_CODE) && (e.preventDefault(), e.stopPropagation(), ne());
|
|
395
|
+
},
|
|
396
|
+
"aria-label": xe,
|
|
397
|
+
children: /* @__PURE__ */ l(ar, {})
|
|
398
|
+
}
|
|
399
|
+
),
|
|
400
|
+
/* @__PURE__ */ l("span", { className: i("arrow"), "aria-hidden": "true", children: /* @__PURE__ */ l(or, {}) })
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
),
|
|
404
|
+
u && /* @__PURE__ */ l(
|
|
405
|
+
"div",
|
|
406
|
+
{
|
|
407
|
+
style: Ye,
|
|
408
|
+
className: i(
|
|
409
|
+
"select-list",
|
|
410
|
+
{ opened: u, "limited-width": Te },
|
|
411
|
+
Ie
|
|
412
|
+
),
|
|
413
|
+
...ze({
|
|
414
|
+
onKeyDown: Xe,
|
|
415
|
+
ref: B.setFloating
|
|
416
|
+
}),
|
|
417
|
+
children: I ? ye() : /* @__PURE__ */ l(
|
|
418
|
+
tr,
|
|
419
|
+
{
|
|
420
|
+
autoHeight: !0,
|
|
421
|
+
autoHeightMax: wr,
|
|
422
|
+
hideTracksWhenNotNeeded: !0,
|
|
423
|
+
ref: (e) => {
|
|
424
|
+
T.current = e;
|
|
425
|
+
},
|
|
426
|
+
onScrollFrame: He,
|
|
427
|
+
children: ye()
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
] });
|
|
433
|
+
};
|
|
434
|
+
export {
|
|
435
|
+
Jr as D
|
|
436
|
+
};
|
package/dist/dropdown.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as r } from "./dropdown-
|
|
1
|
+
import { D as r } from "./dropdown-e85dd323.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "./bind-06a7ff84.js";
|
|
@@ -8,7 +8,12 @@ import "rc-scrollbars";
|
|
|
8
8
|
import "./useOnClickOutside-c332f7d3.js";
|
|
9
9
|
import "./keyCodes-f63c0e11.js";
|
|
10
10
|
import "./baseIconButton-251479f7.js";
|
|
11
|
+
import "./clear-53660571.js";
|
|
11
12
|
import "./dropdown-0260bb66.js";
|
|
13
|
+
import "./tooltip.js";
|
|
14
|
+
import "react-dom";
|
|
15
|
+
import "@floating-ui/react";
|
|
16
|
+
import "./floatingUi-41f8c7b5.js";
|
|
12
17
|
import "./fieldLabel.js";
|
|
13
18
|
import "./checkbox-ed6cc375.js";
|
|
14
19
|
export {
|