mimir-ui-kit 1.58.1 → 1.59.0
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/MultiSelectSearch/MultiSelectSearch.js +222 -217
- package/dist/components/MultiSelectSearch/hooks/useNestedSelection.d.ts +2 -1
- package/dist/components/MultiSelectSearch/hooks/useNestedSelection.js +1 -1
- package/dist/components/Toasts/Toast.d.ts +12 -2
- package/dist/components/Toasts/Toast.js +63 -53
- package/dist/components/Toasts/types.d.ts +1 -1
- package/dist/{useNestedSelection-D1WOAYnL.js → useNestedSelection-CBfin3s1.js} +77 -75
- package/package.json +1 -1
|
@@ -1,211 +1,215 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as st, useId as it, useRef as P, useState as rt, useEffect as
|
|
4
|
-
import { EMultiSelectSearchSize as
|
|
1
|
+
import { jsxs as v, jsx as c, Fragment as le } from "react/jsx-runtime";
|
|
2
|
+
import { c as y } from "../../index-DIxK0V-G.js";
|
|
3
|
+
import { forwardRef as st, useId as it, useRef as P, useState as rt, useEffect as ce } from "react";
|
|
4
|
+
import { EMultiSelectSearchSize as de, ELoadingIndicatorPlacement as V } from "./constants.js";
|
|
5
5
|
import { useChips as lt } from "./hooks/useChips.js";
|
|
6
6
|
import { useDataLoading as ct } from "./hooks/useDataLoading.js";
|
|
7
7
|
import { useEventHandling as dt } from "./hooks/useEventHandling.js";
|
|
8
8
|
import { useMenuPlacement as ut } from "./hooks/useMenuPlacement.js";
|
|
9
9
|
import { useMultiSelectState as mt } from "./hooks/useMultiSelectState.js";
|
|
10
|
-
import { u as pt, c as t } from "../../useNestedSelection-
|
|
10
|
+
import { u as pt, c as t } from "../../useNestedSelection-CBfin3s1.js";
|
|
11
11
|
import { useRenderVirtualizedList as ft } from "./hooks/useRenderVirtualizedList.js";
|
|
12
12
|
import { useSearch as ht } from "./hooks/useSearch.js";
|
|
13
13
|
import { useVirtualization as gt } from "./hooks/useVirtualization.js";
|
|
14
|
-
import { normalizeDataForNestedSelection as It, flattenOptions as St, updateInputValueAfterChange as
|
|
14
|
+
import { normalizeDataForNestedSelection as It, flattenOptions as St, updateInputValueAfterChange as ue, getInitialInputValue as Nt, mapSizeToInputSize as me, getDropdownArrowIcon as zt, processNestedSelectionChange as pe, flattenSelectedItems as wt, dispatchMultiselectOpen as A, highlightReactNode as Ct } from "./utils.js";
|
|
15
15
|
import { Icon as vt } from "../../icons/Icon.js";
|
|
16
16
|
import { Button as yt } from "../Button/Button.js";
|
|
17
|
-
import { I as
|
|
17
|
+
import { I as fe } from "../../Input-DPnH8pKc.js";
|
|
18
18
|
import { EInputVariant as bt } from "../Input/constants.js";
|
|
19
|
-
import { Loader as
|
|
20
|
-
import { H as Ot, U as
|
|
19
|
+
import { Loader as he } from "../Loader/Loader.js";
|
|
20
|
+
import { H as Ot, U as ge, G as Ie } from "../../combobox-fIVOzEhl.js";
|
|
21
21
|
const Wt = st(
|
|
22
|
-
(
|
|
22
|
+
(Se, Ne) => {
|
|
23
23
|
const {
|
|
24
|
-
placeholder:
|
|
25
|
-
size: d =
|
|
24
|
+
placeholder: U,
|
|
25
|
+
size: d = de.L,
|
|
26
26
|
value: S,
|
|
27
|
-
onChange:
|
|
28
|
-
full:
|
|
29
|
-
showArrow:
|
|
30
|
-
items:
|
|
31
|
-
classNameOption:
|
|
32
|
-
displayValue:
|
|
33
|
-
filterOnSearch:
|
|
27
|
+
onChange: i,
|
|
28
|
+
full: ze,
|
|
29
|
+
showArrow: we = !0,
|
|
30
|
+
items: r = [],
|
|
31
|
+
classNameOption: $,
|
|
32
|
+
displayValue: f = "name",
|
|
33
|
+
filterOnSearch: Ce = !0,
|
|
34
34
|
onSearch: k,
|
|
35
|
-
variant:
|
|
36
|
-
menuPlacement:
|
|
35
|
+
variant: W = bt.DefaultGray,
|
|
36
|
+
menuPlacement: ve = "bottom",
|
|
37
37
|
disabled: m = !1,
|
|
38
|
-
searchProps:
|
|
38
|
+
searchProps: K,
|
|
39
39
|
withClearButton: E = !1,
|
|
40
|
-
withChip:
|
|
41
|
-
chipVariant:
|
|
42
|
-
disableInput:
|
|
43
|
-
autocomplete:
|
|
44
|
-
id:
|
|
45
|
-
autoPlacement:
|
|
46
|
-
onIsOpen:
|
|
47
|
-
noOptionsText:
|
|
48
|
-
noMatchText:
|
|
49
|
-
loadOnOpen:
|
|
50
|
-
loading:
|
|
51
|
-
loadingIndicatorPlacement:
|
|
40
|
+
withChip: ye = !1,
|
|
41
|
+
chipVariant: be = "sapphire",
|
|
42
|
+
disableInput: b = !1,
|
|
43
|
+
autocomplete: X = "on",
|
|
44
|
+
id: Oe,
|
|
45
|
+
autoPlacement: De = !1,
|
|
46
|
+
onIsOpen: T,
|
|
47
|
+
noOptionsText: Me = "Нет данных",
|
|
48
|
+
noMatchText: xe = "Ничего не найдено",
|
|
49
|
+
loadOnOpen: Ve,
|
|
50
|
+
loading: Te,
|
|
51
|
+
loadingIndicatorPlacement: L = V.Both,
|
|
52
52
|
groupBy: N,
|
|
53
|
-
getGroupTitle:
|
|
53
|
+
getGroupTitle: Le = (e) => e,
|
|
54
54
|
highlightMatches: F = !1,
|
|
55
55
|
enableNestedSelection: a = !1,
|
|
56
|
-
searchInNestedItems:
|
|
57
|
-
useIconInsteadOfCheckbox:
|
|
56
|
+
searchInNestedItems: Y = !1,
|
|
57
|
+
useIconInsteadOfCheckbox: Z = !1,
|
|
58
58
|
searchInHeaderGroupItems: G = !1,
|
|
59
59
|
showCollapsedSearchedGroups: Re = !1,
|
|
60
|
-
showSearchResultsAfterOptionSelect:
|
|
61
|
-
} =
|
|
62
|
-
isOpen:
|
|
63
|
-
setIsOpen:
|
|
64
|
-
inputValue:
|
|
60
|
+
showSearchResultsAfterOptionSelect: O = !1
|
|
61
|
+
} = Se, Be = it(), D = Oe || `multiselect-${Be}`, R = P(null), z = P(null), Pe = P(!1), _ = P(null), [o, ee] = rt(null), Ae = mt({ value: S, displayValue: f }), {
|
|
62
|
+
isOpen: p,
|
|
63
|
+
setIsOpen: M,
|
|
64
|
+
inputValue: x,
|
|
65
65
|
setInputValue: w,
|
|
66
66
|
selectedItems: u,
|
|
67
|
-
setSelectedItems:
|
|
68
|
-
expandedOptions:
|
|
69
|
-
setExpandedOptions:
|
|
70
|
-
internalSearchQuery:
|
|
67
|
+
setSelectedItems: I,
|
|
68
|
+
expandedOptions: ke,
|
|
69
|
+
setExpandedOptions: Ee,
|
|
70
|
+
internalSearchQuery: h,
|
|
71
71
|
setInternalSearchQuery: q,
|
|
72
|
-
firstSelectedSearchQuery:
|
|
73
|
-
setFirstSelectedSearchQuery:
|
|
74
|
-
} =
|
|
75
|
-
autoPlacement:
|
|
76
|
-
menuPlacement:
|
|
72
|
+
firstSelectedSearchQuery: Fe,
|
|
73
|
+
setFirstSelectedSearchQuery: C
|
|
74
|
+
} = Ae, Ge = ut({
|
|
75
|
+
autoPlacement: De,
|
|
76
|
+
menuPlacement: ve,
|
|
77
77
|
size: d,
|
|
78
|
-
selectSearchRef:
|
|
79
|
-
isOpen:
|
|
80
|
-
}), { actualMenuPlacement:
|
|
81
|
-
filterOnSearch:
|
|
82
|
-
items: a && o ? o.normalizedItems :
|
|
83
|
-
internalSearchQuery:
|
|
78
|
+
selectSearchRef: R,
|
|
79
|
+
isOpen: p
|
|
80
|
+
}), { actualMenuPlacement: qe, isVisible: He, isMenuReady: Qe, updateMenuPlacement: te } = Ge, je = ct({ loadOnOpen: Ve, loading: Te }), { isLoading: ne, handleDataLoading: H } = je, Je = ht({
|
|
81
|
+
filterOnSearch: Ce,
|
|
82
|
+
items: a && o ? o.normalizedItems : r,
|
|
83
|
+
internalSearchQuery: h,
|
|
84
84
|
selectedItems: u,
|
|
85
85
|
enableNestedSelection: a,
|
|
86
|
-
searchInNestedItems:
|
|
87
|
-
displayValue:
|
|
86
|
+
searchInNestedItems: Y,
|
|
87
|
+
displayValue: f,
|
|
88
88
|
groupBy: N,
|
|
89
89
|
searchInHeaderGroupItems: G,
|
|
90
|
-
firstSelectedSearchQuery:
|
|
91
|
-
}), { filteredItems: B } =
|
|
90
|
+
firstSelectedSearchQuery: Fe
|
|
91
|
+
}), { filteredItems: B } = Je, Ue = gt({
|
|
92
92
|
filteredItems: B,
|
|
93
93
|
groupBy: N,
|
|
94
|
-
getGroupTitle:
|
|
94
|
+
getGroupTitle: Le,
|
|
95
95
|
size: d,
|
|
96
|
-
parentRef:
|
|
97
|
-
}), { virtualItems:
|
|
98
|
-
|
|
99
|
-
if (a &&
|
|
100
|
-
const e = It(
|
|
101
|
-
|
|
96
|
+
parentRef: _
|
|
97
|
+
}), { virtualItems: $e, virtualizer: We } = Ue;
|
|
98
|
+
ce(() => {
|
|
99
|
+
if (a && r.length > 0) {
|
|
100
|
+
const e = It(r);
|
|
101
|
+
ee(e);
|
|
102
102
|
} else
|
|
103
|
-
|
|
104
|
-
}, [
|
|
103
|
+
ee(null);
|
|
104
|
+
}, [r, a]), ce(() => {
|
|
105
105
|
if (S) {
|
|
106
106
|
let e = S;
|
|
107
|
-
a && o && (e = S.map((
|
|
107
|
+
a && o && (e = S.map((l) => St(
|
|
108
108
|
o.normalizedItems
|
|
109
109
|
).find(
|
|
110
|
-
(
|
|
111
|
-
)).filter(Boolean)),
|
|
112
|
-
const n = a ?
|
|
110
|
+
(s) => s.id === l.id || s.originalId === (l.originalId || l.id) && s.name === l.name
|
|
111
|
+
)).filter(Boolean)), I(e);
|
|
112
|
+
const n = a ? ue(
|
|
113
113
|
e,
|
|
114
114
|
a,
|
|
115
|
-
o ? o.normalizedItems :
|
|
116
|
-
|
|
117
|
-
) : Nt(e,
|
|
115
|
+
o ? o.normalizedItems : r,
|
|
116
|
+
f
|
|
117
|
+
) : Nt(e, f);
|
|
118
118
|
w(n);
|
|
119
|
-
} else S === null && (
|
|
120
|
-
}, [S,
|
|
121
|
-
const
|
|
119
|
+
} else S === null && (I([]), w(""));
|
|
120
|
+
}, [S, f, a, o, r]);
|
|
121
|
+
const Ke = (e) => {
|
|
122
122
|
let n = e;
|
|
123
123
|
if (a && o) {
|
|
124
|
-
const { normalizedItems:
|
|
125
|
-
n =
|
|
124
|
+
const { normalizedItems: s } = o;
|
|
125
|
+
n = pe(
|
|
126
126
|
e,
|
|
127
127
|
u,
|
|
128
|
-
|
|
128
|
+
s
|
|
129
129
|
);
|
|
130
|
-
} else a && (n =
|
|
130
|
+
} else a && (n = pe(
|
|
131
131
|
e,
|
|
132
132
|
u,
|
|
133
|
-
|
|
133
|
+
r
|
|
134
134
|
));
|
|
135
|
-
const
|
|
135
|
+
const l = wt(
|
|
136
136
|
n,
|
|
137
|
-
a && o ? o.normalizedItems :
|
|
137
|
+
a && o ? o.normalizedItems : r
|
|
138
138
|
);
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
139
|
+
I(n), i == null || i(l);
|
|
140
|
+
const g = ue(
|
|
141
|
+
l,
|
|
142
142
|
a,
|
|
143
|
-
a && o ? o.normalizedItems :
|
|
144
|
-
|
|
143
|
+
a && o ? o.normalizedItems : r,
|
|
144
|
+
f
|
|
145
145
|
);
|
|
146
|
-
w(
|
|
146
|
+
if (w(g), q(""), O) {
|
|
147
|
+
const s = x.replace(h, "").trim(), Q = s[s.length - 1] === ",";
|
|
148
|
+
(u.length === 0 || Q) && C(h), n.length === 0 && C("");
|
|
149
|
+
}
|
|
150
|
+
M(!0), A(D), setTimeout(() => {
|
|
147
151
|
if (z.current) {
|
|
148
152
|
z.current.focus(), z.current.scrollLeft = z.current.scrollWidth;
|
|
149
|
-
const
|
|
150
|
-
z.current.setSelectionRange(
|
|
153
|
+
const s = g.length;
|
|
154
|
+
z.current.setSelectionRange(s, s);
|
|
151
155
|
}
|
|
152
156
|
}, 0);
|
|
153
|
-
},
|
|
154
|
-
var
|
|
155
|
-
if (
|
|
157
|
+
}, ae = async (e) => {
|
|
158
|
+
var g, s;
|
|
159
|
+
if (b) return;
|
|
156
160
|
const n = e.target.value;
|
|
157
|
-
if (w(n), q(((
|
|
158
|
-
|
|
161
|
+
if (w(n), q(((g = n.split(",").pop()) == null ? void 0 : g.trim()) || ""), k == null || k(n), a)
|
|
162
|
+
O && n[n.length - 1] === "," && C(""), n === "" && u.length > 0 && (O && C(""), I([]), i == null || i([]));
|
|
159
163
|
else {
|
|
160
|
-
const
|
|
161
|
-
(
|
|
164
|
+
const Q = n.split(",").map((J) => J.trim()).filter(Boolean), j = r.filter(
|
|
165
|
+
(J) => Q.includes(J[f])
|
|
162
166
|
);
|
|
163
|
-
JSON.stringify(
|
|
167
|
+
JSON.stringify(j) !== JSON.stringify(u) && (I(j), i == null || i(j));
|
|
164
168
|
}
|
|
165
|
-
|
|
166
|
-
const
|
|
169
|
+
p || (M(!0), A(D), await H());
|
|
170
|
+
const l = (s = R.current) == null ? void 0 : s.querySelector(
|
|
167
171
|
`.${t.options}`
|
|
168
172
|
);
|
|
169
|
-
|
|
170
|
-
},
|
|
173
|
+
l && typeof l.scrollTo == "function" && l.scrollTo({ top: 0, behavior: "smooth" });
|
|
174
|
+
}, Xe = (e) => {
|
|
171
175
|
e.preventDefault(), e.currentTarget.focus();
|
|
172
176
|
const n = e.currentTarget.value.length;
|
|
173
177
|
e.currentTarget.setSelectionRange(n, n);
|
|
174
|
-
},
|
|
175
|
-
w(""), q(""),
|
|
176
|
-
},
|
|
177
|
-
e.stopPropagation(),
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
if (
|
|
178
|
+
}, Ye = () => {
|
|
179
|
+
w(""), q(""), I([]), O && C(""), i == null || i([]);
|
|
180
|
+
}, Ze = (e) => {
|
|
181
|
+
e.stopPropagation(), Ye();
|
|
182
|
+
}, oe = async () => {
|
|
183
|
+
te(), M(!0), A(D), await H();
|
|
184
|
+
}, _e = async (e) => {
|
|
185
|
+
if (b) {
|
|
182
186
|
e.target.blur();
|
|
183
187
|
return;
|
|
184
188
|
}
|
|
185
|
-
await
|
|
186
|
-
},
|
|
187
|
-
const e = !
|
|
188
|
-
e && (
|
|
189
|
-
},
|
|
190
|
-
if (
|
|
189
|
+
await oe();
|
|
190
|
+
}, se = async () => {
|
|
191
|
+
const e = !p;
|
|
192
|
+
e && (te(), A(D), O && C(""), await H()), M(e), T == null || T(e);
|
|
193
|
+
}, et = () => {
|
|
194
|
+
if (we)
|
|
191
195
|
return {
|
|
192
196
|
addonType: "react-node",
|
|
193
|
-
addonContent: /* @__PURE__ */
|
|
194
|
-
|
|
197
|
+
addonContent: /* @__PURE__ */ v(le, { children: [
|
|
198
|
+
ne && (L === V.Input || L === V.Both) && /* @__PURE__ */ c(he, { size: "s" }),
|
|
195
199
|
/* @__PURE__ */ c(
|
|
196
|
-
|
|
200
|
+
ge,
|
|
197
201
|
{
|
|
198
|
-
className:
|
|
202
|
+
className: y(t.button, {
|
|
199
203
|
[t.disabled]: m
|
|
200
204
|
}),
|
|
201
205
|
disabled: m,
|
|
202
|
-
onMouseDown:
|
|
206
|
+
onMouseDown: se,
|
|
203
207
|
children: /* @__PURE__ */ c(
|
|
204
208
|
vt,
|
|
205
209
|
{
|
|
206
|
-
iconName: d ==
|
|
207
|
-
className:
|
|
208
|
-
[t["selector-icon-open"]]:
|
|
210
|
+
iconName: d == de.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
|
211
|
+
className: y(t["selector-icon"], {
|
|
212
|
+
[t["selector-icon-open"]]: p
|
|
209
213
|
})
|
|
210
214
|
}
|
|
211
215
|
)
|
|
@@ -213,144 +217,145 @@ const Wt = st(
|
|
|
213
217
|
)
|
|
214
218
|
] })
|
|
215
219
|
};
|
|
216
|
-
},
|
|
217
|
-
/* @__PURE__ */ c(
|
|
220
|
+
}, tt = () => ne && (L === V.Dropdown || L === V.Both) ? /* @__PURE__ */ v("div", { className: t.loader, children: [
|
|
221
|
+
/* @__PURE__ */ c(he, { size: "s" }),
|
|
218
222
|
"Загрузка..."
|
|
219
|
-
] }) :
|
|
223
|
+
] }) : Me, ie = (e) => {
|
|
220
224
|
let n = e.name;
|
|
221
|
-
const
|
|
222
|
-
if (F &&
|
|
223
|
-
const
|
|
224
|
-
(typeof e.name == "string" ? e.name : String(e.name || "")).toLowerCase().includes(
|
|
225
|
+
const l = e.bottom && /* @__PURE__ */ c("div", { children: e.bottom });
|
|
226
|
+
if (F && h && !(N && G)) {
|
|
227
|
+
const g = h.toLowerCase();
|
|
228
|
+
(typeof e.name == "string" ? e.name : String(e.name || "")).toLowerCase().includes(g) && (n = Ct(
|
|
225
229
|
e.name,
|
|
226
|
-
|
|
230
|
+
h,
|
|
227
231
|
t["highlighted-text"]
|
|
228
232
|
));
|
|
229
233
|
}
|
|
230
|
-
return /* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ v(le, { children: [
|
|
231
235
|
n,
|
|
232
|
-
|
|
236
|
+
l
|
|
233
237
|
] });
|
|
234
|
-
},
|
|
235
|
-
|
|
238
|
+
}, nt = pt({
|
|
239
|
+
isOpen: p,
|
|
240
|
+
inputValue: x,
|
|
236
241
|
filteredItems: B,
|
|
237
242
|
selectedItems: u,
|
|
238
|
-
expandedOptions:
|
|
239
|
-
setExpandedOptions:
|
|
243
|
+
expandedOptions: ke,
|
|
244
|
+
setExpandedOptions: Ee,
|
|
240
245
|
size: d,
|
|
241
|
-
classNameOption:
|
|
242
|
-
items: a && o ? o.normalizedItems :
|
|
246
|
+
classNameOption: $,
|
|
247
|
+
items: a && o ? o.normalizedItems : r,
|
|
243
248
|
enableNestedSelection: a,
|
|
244
|
-
searchInNestedItems:
|
|
245
|
-
internalSearchQuery:
|
|
246
|
-
renderOptionContent:
|
|
249
|
+
searchInNestedItems: Y,
|
|
250
|
+
internalSearchQuery: h,
|
|
251
|
+
renderOptionContent: ie,
|
|
247
252
|
groupBy: N,
|
|
248
|
-
useIconInsteadOfCheckbox:
|
|
253
|
+
useIconInsteadOfCheckbox: Z,
|
|
249
254
|
highlightMatches: F,
|
|
250
255
|
showCollapsedSearchedGroups: Re
|
|
251
|
-
}), { renderNestedOptions:
|
|
256
|
+
}), { renderNestedOptions: at } = nt, re = lt({
|
|
252
257
|
selectedItems: u,
|
|
253
258
|
enableNestedSelection: a,
|
|
254
259
|
size: d,
|
|
255
|
-
chipVariant:
|
|
256
|
-
items: a && o ? o.normalizedItems :
|
|
257
|
-
displayValue:
|
|
258
|
-
setSelectedItems:
|
|
259
|
-
onChange:
|
|
260
|
+
chipVariant: be,
|
|
261
|
+
items: a && o ? o.normalizedItems : r,
|
|
262
|
+
displayValue: f,
|
|
263
|
+
setSelectedItems: I,
|
|
264
|
+
onChange: i,
|
|
260
265
|
setInputValue: w
|
|
261
266
|
});
|
|
262
267
|
dt({
|
|
263
|
-
isOpen:
|
|
264
|
-
setIsOpen:
|
|
265
|
-
onIsOpen:
|
|
266
|
-
id:
|
|
267
|
-
selectSearchRef:
|
|
268
|
-
isHandlingRef:
|
|
268
|
+
isOpen: p,
|
|
269
|
+
setIsOpen: M,
|
|
270
|
+
onIsOpen: T,
|
|
271
|
+
id: D,
|
|
272
|
+
selectSearchRef: R,
|
|
273
|
+
isHandlingRef: Pe
|
|
269
274
|
});
|
|
270
|
-
const
|
|
271
|
-
items: a && o ? o.normalizedItems :
|
|
275
|
+
const ot = ft({
|
|
276
|
+
items: a && o ? o.normalizedItems : r,
|
|
272
277
|
filteredItems: B,
|
|
273
278
|
size: d,
|
|
274
|
-
actualMenuPlacement:
|
|
275
|
-
isVisible:
|
|
276
|
-
noOptionsText:
|
|
277
|
-
noMatchText:
|
|
279
|
+
actualMenuPlacement: qe,
|
|
280
|
+
isVisible: He,
|
|
281
|
+
noOptionsText: tt(),
|
|
282
|
+
noMatchText: xe,
|
|
278
283
|
enableNestedSelection: a,
|
|
279
|
-
renderNestedOptions:
|
|
284
|
+
renderNestedOptions: at,
|
|
280
285
|
groupBy: N,
|
|
281
|
-
parentRef:
|
|
282
|
-
virtualItems:
|
|
283
|
-
virtualizer:
|
|
284
|
-
classNameOption:
|
|
286
|
+
parentRef: _,
|
|
287
|
+
virtualItems: $e,
|
|
288
|
+
virtualizer: We,
|
|
289
|
+
classNameOption: $,
|
|
285
290
|
selectedItems: u,
|
|
286
|
-
renderOptionContent:
|
|
291
|
+
renderOptionContent: ie,
|
|
287
292
|
cls: t,
|
|
288
|
-
useIconInsteadOfCheckbox:
|
|
293
|
+
useIconInsteadOfCheckbox: Z,
|
|
289
294
|
highlightMatches: F,
|
|
290
|
-
internalSearchQuery:
|
|
295
|
+
internalSearchQuery: h,
|
|
291
296
|
searchInHeaderGroupItems: G
|
|
292
297
|
});
|
|
293
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ v("div", { ref: R, children: [
|
|
294
299
|
/* @__PURE__ */ c(
|
|
295
300
|
Ot,
|
|
296
301
|
{
|
|
297
302
|
multiple: !0,
|
|
298
303
|
as: "div",
|
|
299
304
|
value: u,
|
|
300
|
-
className:
|
|
301
|
-
[t.full]:
|
|
305
|
+
className: y(t["multi-select-search"], {
|
|
306
|
+
[t.full]: ze,
|
|
302
307
|
[t.disabled]: m
|
|
303
308
|
}),
|
|
304
|
-
onChange:
|
|
305
|
-
ref:
|
|
309
|
+
onChange: Ke,
|
|
310
|
+
ref: Ne,
|
|
306
311
|
disabled: m,
|
|
307
312
|
virtual: N ? void 0 : { options: B },
|
|
308
|
-
children: /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ v(
|
|
309
314
|
"div",
|
|
310
315
|
{
|
|
311
|
-
className:
|
|
312
|
-
[t["container-open"]]:
|
|
316
|
+
className: y(t.container, t[d], {
|
|
317
|
+
[t["container-open"]]: p
|
|
313
318
|
}),
|
|
314
319
|
children: [
|
|
315
|
-
|
|
320
|
+
b && /* @__PURE__ */ v("div", { className: t["input-container"], children: [
|
|
316
321
|
/* @__PURE__ */ c(
|
|
317
|
-
|
|
322
|
+
ge,
|
|
318
323
|
{
|
|
319
324
|
disabled: m,
|
|
320
325
|
style: { width: "100%" },
|
|
321
|
-
onClick:
|
|
326
|
+
onClick: se,
|
|
322
327
|
children: /* @__PURE__ */ c(
|
|
323
|
-
|
|
328
|
+
Ie,
|
|
324
329
|
{
|
|
325
|
-
as:
|
|
326
|
-
label:
|
|
327
|
-
size:
|
|
328
|
-
className:
|
|
329
|
-
[t["multi-select-input-disabled"]]:
|
|
330
|
+
as: fe,
|
|
331
|
+
label: U,
|
|
332
|
+
size: me(d),
|
|
333
|
+
className: y(t["multi-select-input"], {
|
|
334
|
+
[t["multi-select-input-disabled"]]: b && E
|
|
330
335
|
}),
|
|
331
|
-
onChange:
|
|
332
|
-
value:
|
|
336
|
+
onChange: ae,
|
|
337
|
+
value: x,
|
|
333
338
|
disabled: m,
|
|
334
|
-
variant:
|
|
339
|
+
variant: W,
|
|
335
340
|
rightSlotClassName: t["right-slot"],
|
|
336
341
|
requiredMarkClassName: t["required-mark"],
|
|
337
342
|
"data-testid": "select-search-input",
|
|
338
|
-
onFocus:
|
|
343
|
+
onFocus: _e,
|
|
339
344
|
rightAddon: {
|
|
340
345
|
addonType: "icon",
|
|
341
|
-
addonContent: zt(
|
|
346
|
+
addonContent: zt(p, d)
|
|
342
347
|
},
|
|
343
|
-
autocomplete:
|
|
344
|
-
...
|
|
348
|
+
autocomplete: X,
|
|
349
|
+
...K
|
|
345
350
|
}
|
|
346
351
|
)
|
|
347
352
|
}
|
|
348
353
|
),
|
|
349
|
-
E &&
|
|
354
|
+
E && x && /* @__PURE__ */ c(
|
|
350
355
|
yt,
|
|
351
356
|
{
|
|
352
357
|
tabIndex: -1,
|
|
353
|
-
className:
|
|
358
|
+
className: y(t.clear, {
|
|
354
359
|
[t.disabled]: m
|
|
355
360
|
}),
|
|
356
361
|
iconButtonClassName: t["icon-button"],
|
|
@@ -360,41 +365,41 @@ const Wt = st(
|
|
|
360
365
|
clear: !0,
|
|
361
366
|
disabled: m,
|
|
362
367
|
variant: "secondary-gray",
|
|
363
|
-
onClick:
|
|
368
|
+
onClick: Ze,
|
|
364
369
|
"data-testid": "clear-button"
|
|
365
370
|
}
|
|
366
371
|
)
|
|
367
372
|
] }),
|
|
368
|
-
!
|
|
369
|
-
|
|
373
|
+
!b && /* @__PURE__ */ c(
|
|
374
|
+
Ie,
|
|
370
375
|
{
|
|
371
|
-
as:
|
|
372
|
-
label:
|
|
373
|
-
size:
|
|
376
|
+
as: fe,
|
|
377
|
+
label: U,
|
|
378
|
+
size: me(d),
|
|
374
379
|
className: t["multi-select-input"],
|
|
375
380
|
rightSlotClassName: t["right-slot"],
|
|
376
381
|
requiredMarkClassName: t["required-mark"],
|
|
377
|
-
value:
|
|
382
|
+
value: x,
|
|
378
383
|
disabled: m,
|
|
379
|
-
variant:
|
|
384
|
+
variant: W,
|
|
380
385
|
withClearButton: E,
|
|
381
|
-
onFocus:
|
|
382
|
-
onMouseDown:
|
|
383
|
-
onChange:
|
|
386
|
+
onFocus: oe,
|
|
387
|
+
onMouseDown: Xe,
|
|
388
|
+
onChange: ae,
|
|
384
389
|
ref: z,
|
|
385
|
-
rightAddon:
|
|
390
|
+
rightAddon: et(),
|
|
386
391
|
"data-testid": "select-search-input",
|
|
387
|
-
autocomplete:
|
|
388
|
-
...
|
|
392
|
+
autocomplete: X,
|
|
393
|
+
...K
|
|
389
394
|
}
|
|
390
395
|
),
|
|
391
|
-
|
|
396
|
+
p && Qe && ot()
|
|
392
397
|
]
|
|
393
398
|
}
|
|
394
399
|
)
|
|
395
400
|
}
|
|
396
401
|
),
|
|
397
|
-
|
|
402
|
+
ye && re && /* @__PURE__ */ c("div", { className: t["chip-container"], children: re })
|
|
398
403
|
] });
|
|
399
404
|
}
|
|
400
405
|
);
|
|
@@ -3,6 +3,7 @@ import { EMultiSelectSearchSize } from '../constants';
|
|
|
3
3
|
import { TMultiSelectOption } from '../types';
|
|
4
4
|
|
|
5
5
|
type TUseNestedSelectionProps = {
|
|
6
|
+
isOpen: boolean;
|
|
6
7
|
inputValue: string;
|
|
7
8
|
filteredItems: TMultiSelectOption[];
|
|
8
9
|
selectedItems: TMultiSelectOption[];
|
|
@@ -24,5 +25,5 @@ type TUseNestedSelectionReturn = {
|
|
|
24
25
|
toggleExpanded: (optionId: string | number) => void;
|
|
25
26
|
renderNestedOptions: (options: TMultiSelectOption[], level?: number) => ReactNode[];
|
|
26
27
|
};
|
|
27
|
-
export declare const useNestedSelection: ({ inputValue, filteredItems, selectedItems, expandedOptions, setExpandedOptions, size, classNameOption, items, enableNestedSelection, searchInNestedItems, internalSearchQuery, renderOptionContent, groupBy, useIconInsteadOfCheckbox, showCollapsedSearchedGroups }: TUseNestedSelectionProps) => TUseNestedSelectionReturn;
|
|
28
|
+
export declare const useNestedSelection: ({ isOpen, inputValue, filteredItems, selectedItems, expandedOptions, setExpandedOptions, size, classNameOption, items, enableNestedSelection, searchInNestedItems, internalSearchQuery, renderOptionContent, groupBy, useIconInsteadOfCheckbox, showCollapsedSearchedGroups }: TUseNestedSelectionProps) => TUseNestedSelectionReturn;
|
|
28
29
|
export {};
|
|
@@ -4,7 +4,7 @@ import "react";
|
|
|
4
4
|
import "../../../icons/Icon.js";
|
|
5
5
|
import "../../CheckboxMimir/CheckboxMimir.js";
|
|
6
6
|
import "../constants.js";
|
|
7
|
-
import { u as c } from "../../../useNestedSelection-
|
|
7
|
+
import { u as c } from "../../../useNestedSelection-CBfin3s1.js";
|
|
8
8
|
import "../utils.js";
|
|
9
9
|
import "../../../combobox-fIVOzEhl.js";
|
|
10
10
|
export {
|
|
@@ -46,13 +46,23 @@ export type TProps = {
|
|
|
46
46
|
* Функция обратного вызова, вызываемая при удалении уведомления.
|
|
47
47
|
*/
|
|
48
48
|
onToastRemove?: (toastId: string, ref: RefObject<HTMLDivElement>) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Функция обратного вызова, вызываемая при удалении тоста по причине истечения таймера.
|
|
51
|
+
*/
|
|
52
|
+
onExpire?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Функция обратного вызова, вызываемая при клике на крестик.
|
|
55
|
+
*/
|
|
56
|
+
onButtonRemoveClick?: () => void;
|
|
49
57
|
/**
|
|
50
58
|
* Слот уведомления.
|
|
51
59
|
*/
|
|
52
|
-
slot?: ReactNode
|
|
60
|
+
slot?: ReactNode | ((props: {
|
|
61
|
+
handleToastRemove: VoidFunction;
|
|
62
|
+
}) => JSX.Element);
|
|
53
63
|
/**
|
|
54
64
|
* Флаг, указывающий на приостановку таймера при наведении курсора.
|
|
55
65
|
*/
|
|
56
66
|
pauseOnHover?: boolean;
|
|
57
67
|
};
|
|
58
|
-
export declare const Toast: import('react').MemoExoticComponent<({ id, title, message, position, variant, duration, autoClose, needProgress, needTimer, needCloseButton, onToastRemove, slot, pauseOnHover }: TProps) => import("react/jsx-runtime").JSX.Element>;
|
|
68
|
+
export declare const Toast: import('react').MemoExoticComponent<({ id, title, message, position, variant, duration, autoClose, needProgress, needTimer, needCloseButton, onToastRemove, onExpire, onButtonRemoveClick, slot, pauseOnHover }: TProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,87 +1,97 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { ANIMATION_VARIABLES_MAP as
|
|
5
|
-
import { c as s, P as
|
|
6
|
-
import { useTimer as
|
|
7
|
-
import { Button as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as S } from "../../index-DIxK0V-G.js";
|
|
3
|
+
import { memo as w, useRef as y, useState as O } from "react";
|
|
4
|
+
import { ANIMATION_VARIABLES_MAP as U, EToastPosition as j, EToastVariant as x, DEFAULT_TOAST_DURATION as F } from "./constants.js";
|
|
5
|
+
import { c as s, P as V } from "../../ProgressBar-F970LqqJ.js";
|
|
6
|
+
import { useTimer as b } from "../../hooks/useTimer/index.js";
|
|
7
|
+
import { Button as G } from "../Button/Button.js";
|
|
8
|
+
const Q = w(
|
|
9
9
|
({
|
|
10
|
-
id:
|
|
11
|
-
title:
|
|
12
|
-
message:
|
|
13
|
-
position:
|
|
14
|
-
variant:
|
|
15
|
-
duration:
|
|
16
|
-
autoClose:
|
|
17
|
-
needProgress:
|
|
18
|
-
needTimer:
|
|
19
|
-
needCloseButton:
|
|
20
|
-
onToastRemove:
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
id: i,
|
|
11
|
+
title: m = "",
|
|
12
|
+
message: u,
|
|
13
|
+
position: P = j.TOP_RIGHT,
|
|
14
|
+
variant: h = x.DEFAULT,
|
|
15
|
+
duration: c = F,
|
|
16
|
+
autoClose: p = !0,
|
|
17
|
+
needProgress: N = !0,
|
|
18
|
+
needTimer: A = !0,
|
|
19
|
+
needCloseButton: L = !0,
|
|
20
|
+
onToastRemove: r,
|
|
21
|
+
onExpire: f,
|
|
22
|
+
onButtonRemoveClick: d,
|
|
23
|
+
slot: e,
|
|
24
|
+
pauseOnHover: I = !1
|
|
23
25
|
}) => {
|
|
24
|
-
const l =
|
|
25
|
-
expiryTimestamp: Date.now() +
|
|
26
|
-
autoStart:
|
|
27
|
-
onExpire:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
26
|
+
const l = y(null), [n, M] = O(!1), { seconds: _ } = b({
|
|
27
|
+
expiryTimestamp: Date.now() + c,
|
|
28
|
+
autoStart: p,
|
|
29
|
+
onExpire: p ? () => {
|
|
30
|
+
r == null || r(i, l), f == null || f();
|
|
31
|
+
} : void 0,
|
|
32
|
+
isPaused: n
|
|
33
|
+
}), D = () => {
|
|
34
|
+
I && M(!0);
|
|
35
|
+
}, E = () => {
|
|
36
|
+
I && M(!1);
|
|
33
37
|
};
|
|
34
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ t(
|
|
35
39
|
"div",
|
|
36
40
|
{
|
|
37
41
|
style: {
|
|
38
|
-
"--elm-translate":
|
|
42
|
+
"--elm-translate": U[P]
|
|
39
43
|
},
|
|
40
|
-
className:
|
|
44
|
+
className: S(
|
|
41
45
|
s["toast-in"],
|
|
42
46
|
s["toast-wrapper"],
|
|
43
|
-
s[
|
|
47
|
+
s[h]
|
|
44
48
|
),
|
|
45
49
|
ref: l,
|
|
46
50
|
role: "alert",
|
|
47
|
-
onMouseEnter:
|
|
48
|
-
onMouseLeave:
|
|
51
|
+
onMouseEnter: D,
|
|
52
|
+
onMouseLeave: E,
|
|
49
53
|
children: [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
!!
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
|
|
54
|
+
m && /* @__PURE__ */ a("h3", { className: s.title, children: m }),
|
|
55
|
+
u && /* @__PURE__ */ a("div", { className: s.message, children: u }),
|
|
56
|
+
(A || N) && /* @__PURE__ */ t("div", { children: [
|
|
57
|
+
!!c && A && /* @__PURE__ */ t("div", { className: s.timer, children: [
|
|
58
|
+
/* @__PURE__ */ a("h4", { className: s["timer-title"], children: "Осталось" }),
|
|
59
|
+
/* @__PURE__ */ t("p", { className: s.seconds, children: [
|
|
60
|
+
_,
|
|
57
61
|
" сек"
|
|
58
62
|
] })
|
|
59
63
|
] }),
|
|
60
|
-
!!
|
|
61
|
-
|
|
64
|
+
!!c && N && /* @__PURE__ */ a(
|
|
65
|
+
V,
|
|
62
66
|
{
|
|
63
|
-
variant:
|
|
64
|
-
duration:
|
|
65
|
-
isPaused:
|
|
67
|
+
variant: h,
|
|
68
|
+
duration: c,
|
|
69
|
+
isPaused: n
|
|
66
70
|
}
|
|
67
71
|
)
|
|
68
72
|
] }),
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
L && /* @__PURE__ */ a(
|
|
74
|
+
G,
|
|
71
75
|
{
|
|
72
|
-
onClick: () =>
|
|
76
|
+
onClick: () => {
|
|
77
|
+
r == null || r(i, l), d == null || d();
|
|
78
|
+
},
|
|
73
79
|
clear: !0,
|
|
74
80
|
isIconButton: !0,
|
|
75
81
|
className: s["close-button"],
|
|
76
82
|
iconName: "Close24px"
|
|
77
83
|
}
|
|
78
84
|
),
|
|
79
|
-
|
|
85
|
+
e && /* @__PURE__ */ a("div", { className: s.slot, children: typeof e == "function" ? e({
|
|
86
|
+
handleToastRemove: () => {
|
|
87
|
+
r == null || r(i, l);
|
|
88
|
+
}
|
|
89
|
+
}) : e })
|
|
80
90
|
]
|
|
81
91
|
}
|
|
82
92
|
);
|
|
83
93
|
}
|
|
84
94
|
);
|
|
85
95
|
export {
|
|
86
|
-
|
|
96
|
+
Q as Toast
|
|
87
97
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EToastVariant } from './constants';
|
|
2
2
|
import { TProps } from './Toast';
|
|
3
3
|
|
|
4
|
-
export type TToast = Record<EToastVariant | `${EToastVariant}`, (toast: Omit<TProps, 'id' | 'variant'>) => void>;
|
|
4
|
+
export type TToast = Record<EToastVariant | `${EToastVariant}`, (toast: Omit<TProps, 'id' | 'variant' | 'onToastRemove'>) => void>;
|
|
5
5
|
export type ToastContextType = TToast;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { CheckboxMimir as
|
|
6
|
-
import { EMultiSelectSearchSize as
|
|
7
|
-
import { getAllChildrenIds as
|
|
8
|
-
import { W } from "./combobox-fIVOzEhl.js";
|
|
9
|
-
import './assets/useNestedSelection.css';const
|
|
1
|
+
import { jsxs as M, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { c as v } from "./index-DIxK0V-G.js";
|
|
3
|
+
import { useEffect as L } from "react";
|
|
4
|
+
import { Icon as S } from "./icons/Icon.js";
|
|
5
|
+
import { CheckboxMimir as P } from "./components/CheckboxMimir/CheckboxMimir.js";
|
|
6
|
+
import { EMultiSelectSearchSize as N } from "./components/MultiSelectSearch/constants.js";
|
|
7
|
+
import { getAllChildrenIds as W } from "./components/MultiSelectSearch/utils.js";
|
|
8
|
+
import { W as B } from "./combobox-fIVOzEhl.js";
|
|
9
|
+
import './assets/useNestedSelection.css';const T = "_disabled_1l3p8_5", $ = "_container_1l3p8_9", y = "_l_1l3p8_36", H = "_loader_1l3p8_40", J = "_full_1l3p8_50", K = "_button_1l3p8_62", R = "_options_1l3p8_32", U = "_visible_1l3p8_89", X = "_top_1l3p8_92", Y = "_bottom_1l3p8_97", Z = "_m_1l3p8_2", G = "_focused_1l3p8_157", Q = "_option_1l3p8_32", V = "_chip_1l3p8_186", z = "_clear_1l3p8_211", l = {
|
|
10
10
|
"multi-select-search": "_multi-select-search_1l3p8_2",
|
|
11
|
-
disabled:
|
|
12
|
-
container:
|
|
11
|
+
disabled: T,
|
|
12
|
+
container: $,
|
|
13
13
|
"container-open": "_container-open_1l3p8_18",
|
|
14
14
|
"group-header": "_group-header_1l3p8_22",
|
|
15
15
|
"options-container": "_options-container_1l3p8_32",
|
|
16
|
-
l:
|
|
17
|
-
loader:
|
|
16
|
+
l: y,
|
|
17
|
+
loader: H,
|
|
18
18
|
"input-container": "_input-container_1l3p8_45",
|
|
19
|
-
full:
|
|
19
|
+
full: J,
|
|
20
20
|
"selected-icon": "_selected-icon_1l3p8_54",
|
|
21
21
|
"selector-icon-open": "_selector-icon-open_1l3p8_58",
|
|
22
|
-
button:
|
|
22
|
+
button: K,
|
|
23
23
|
"selector-icon": "_selector-icon_1l3p8_58",
|
|
24
|
-
options:
|
|
25
|
-
visible:
|
|
26
|
-
top:
|
|
27
|
-
bottom:
|
|
24
|
+
options: R,
|
|
25
|
+
visible: U,
|
|
26
|
+
top: X,
|
|
27
|
+
bottom: Y,
|
|
28
28
|
"no-options": "_no-options_1l3p8_118",
|
|
29
|
-
m:
|
|
29
|
+
m: Z,
|
|
30
30
|
"multi-select-input-disabled": "_multi-select-input-disabled_1l3p8_154",
|
|
31
31
|
"multi-select-input": "_multi-select-input_1l3p8_154",
|
|
32
|
-
focused:
|
|
33
|
-
option:
|
|
32
|
+
focused: G,
|
|
33
|
+
option: Q,
|
|
34
34
|
"option-active": "_option-active_1l3p8_176",
|
|
35
35
|
"option-inner": "_option-inner_1l3p8_179",
|
|
36
|
-
chip:
|
|
36
|
+
chip: V,
|
|
37
37
|
"chip-container": "_chip-container_1l3p8_191",
|
|
38
38
|
"chip-root": "_chip-root_1l3p8_197",
|
|
39
39
|
"right-slot": "_right-slot_1l3p8_201",
|
|
40
40
|
"required-mark": "_required-mark_1l3p8_206",
|
|
41
|
-
clear:
|
|
41
|
+
clear: z,
|
|
42
42
|
"icon-button": "_icon-button_1l3p8_220",
|
|
43
43
|
"highlighted-text": "_highlighted-text_1l3p8_224",
|
|
44
44
|
"highlighted-text-wrapper": "_highlighted-text-wrapper_1l3p8_229",
|
|
@@ -46,73 +46,75 @@ import './assets/useNestedSelection.css';const B = "_disabled_1l3p8_5", T = "_co
|
|
|
46
46
|
"expand-button": "_expand-button_1l3p8_241",
|
|
47
47
|
"expand-icon": "_expand-icon_1l3p8_253",
|
|
48
48
|
"expand-icon-expanded": "_expand-icon-expanded_1l3p8_256"
|
|
49
|
-
},
|
|
49
|
+
}, rn = ({
|
|
50
|
+
isOpen: m,
|
|
50
51
|
inputValue: h,
|
|
51
52
|
filteredItems: u,
|
|
52
|
-
selectedItems:
|
|
53
|
-
expandedOptions:
|
|
53
|
+
selectedItems: D,
|
|
54
|
+
expandedOptions: A,
|
|
54
55
|
setExpandedOptions: p,
|
|
55
56
|
size: a,
|
|
56
|
-
classNameOption:
|
|
57
|
+
classNameOption: E,
|
|
57
58
|
items: f,
|
|
58
59
|
enableNestedSelection: g,
|
|
59
60
|
searchInNestedItems: x = !1,
|
|
60
|
-
internalSearchQuery:
|
|
61
|
-
renderOptionContent:
|
|
62
|
-
groupBy:
|
|
63
|
-
useIconInsteadOfCheckbox:
|
|
64
|
-
showCollapsedSearchedGroups:
|
|
61
|
+
internalSearchQuery: b,
|
|
62
|
+
renderOptionContent: I,
|
|
63
|
+
groupBy: j,
|
|
64
|
+
useIconInsteadOfCheckbox: q = !1,
|
|
65
|
+
showCollapsedSearchedGroups: C = !1
|
|
65
66
|
}) => {
|
|
66
|
-
const
|
|
67
|
-
p((
|
|
68
|
-
const e = new Set(
|
|
69
|
-
return e.has(
|
|
67
|
+
const w = (c) => {
|
|
68
|
+
p((i) => {
|
|
69
|
+
const e = new Set(i);
|
|
70
|
+
return e.has(c) ? e.delete(c) : e.add(c), e;
|
|
70
71
|
});
|
|
71
72
|
};
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
73
|
+
L(() => {
|
|
74
|
+
const c = h.trim()[h.length - 1] === ",";
|
|
75
|
+
if (C && (c || !m)) {
|
|
75
76
|
p(/* @__PURE__ */ new Set([]));
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
|
-
if (g && x &&
|
|
79
|
-
const
|
|
79
|
+
if (g && x && b) {
|
|
80
|
+
const i = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set(), s = (n) => {
|
|
80
81
|
n.forEach((o) => {
|
|
81
82
|
e.has(o.id) || (e.add(o.id), o.children && o.children.length > 0 && (o.children.some(
|
|
82
83
|
(t) => u.some((_) => _.id === t.id)
|
|
83
|
-
) &&
|
|
84
|
+
) && i.add(o.id), s(o.children)));
|
|
84
85
|
});
|
|
85
86
|
};
|
|
86
|
-
s(f), p((n) => /* @__PURE__ */ new Set([...n, ...
|
|
87
|
+
s(f), p((n) => /* @__PURE__ */ new Set([...n, ...i]));
|
|
87
88
|
}
|
|
88
89
|
}, [
|
|
90
|
+
m,
|
|
89
91
|
h,
|
|
90
|
-
|
|
92
|
+
C,
|
|
91
93
|
u,
|
|
92
94
|
g,
|
|
93
95
|
x,
|
|
94
|
-
|
|
96
|
+
b,
|
|
95
97
|
f,
|
|
96
98
|
p
|
|
97
99
|
]);
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
100
|
+
const F = (c) => {
|
|
101
|
+
const i = D.map((t) => t.id);
|
|
102
|
+
if (!c.children || c.children.length === 0)
|
|
101
103
|
return {
|
|
102
|
-
checked:
|
|
104
|
+
checked: i.includes(c.id),
|
|
103
105
|
isMinusIcon: !1
|
|
104
106
|
};
|
|
105
|
-
const e =
|
|
107
|
+
const e = c.children.flatMap((t) => [
|
|
106
108
|
t.id,
|
|
107
|
-
...
|
|
109
|
+
...W(t)
|
|
108
110
|
]), s = e.filter(
|
|
109
|
-
(t) =>
|
|
111
|
+
(t) => i.includes(t)
|
|
110
112
|
).length, n = e.length, o = s > 0;
|
|
111
113
|
return {
|
|
112
114
|
checked: o,
|
|
113
115
|
isMinusIcon: o && !(s === n)
|
|
114
116
|
};
|
|
115
|
-
},
|
|
117
|
+
}, k = (c, i = 0) => {
|
|
116
118
|
const e = /* @__PURE__ */ new Map(), s = (n) => {
|
|
117
119
|
if (e.has(n.id))
|
|
118
120
|
return e.get(n.id);
|
|
@@ -126,46 +128,46 @@ import './assets/useNestedSelection.css';const B = "_disabled_1l3p8_5", T = "_co
|
|
|
126
128
|
}
|
|
127
129
|
return e.set(n.id, !1), !1;
|
|
128
130
|
};
|
|
129
|
-
return
|
|
130
|
-
const o =
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
|
|
131
|
+
return c.filter((n) => i === 0 ? s(n) && f.some((o) => o.id === n.id) : x ? s(n) : !n.children).map((n) => {
|
|
132
|
+
const o = A.has(n.id), r = n.children && n.children.length > 0, t = F(n);
|
|
133
|
+
return /* @__PURE__ */ M("div", { children: [
|
|
134
|
+
/* @__PURE__ */ M(
|
|
135
|
+
B,
|
|
134
136
|
{
|
|
135
137
|
value: n,
|
|
136
|
-
className: ({ focus: _ }) =>
|
|
137
|
-
[l["option-active"]]: _ && !
|
|
138
|
-
[l["nested-option"]]:
|
|
138
|
+
className: ({ focus: _ }) => v(l.option, E, a && l[a], {
|
|
139
|
+
[l["option-active"]]: _ && !j && !g,
|
|
140
|
+
[l["nested-option"]]: i > 0
|
|
139
141
|
}),
|
|
140
142
|
children: [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
q ? t.checked && /* @__PURE__ */ d(
|
|
144
|
+
S,
|
|
143
145
|
{
|
|
144
|
-
iconName: a ===
|
|
146
|
+
iconName: a === N.L ? "Done24px" : "Done16px",
|
|
145
147
|
className: l["selected-icon"]
|
|
146
148
|
}
|
|
147
149
|
) : /* @__PURE__ */ d(
|
|
148
|
-
|
|
150
|
+
P,
|
|
149
151
|
{
|
|
150
152
|
isInteractive: !1,
|
|
151
153
|
checked: t.checked,
|
|
152
154
|
isMinusIcon: t.isMinusIcon
|
|
153
155
|
}
|
|
154
156
|
),
|
|
155
|
-
/* @__PURE__ */ d("div", { className: l["option-inner"], children:
|
|
157
|
+
/* @__PURE__ */ d("div", { className: l["option-inner"], children: I(n) }),
|
|
156
158
|
r && /* @__PURE__ */ d(
|
|
157
159
|
"div",
|
|
158
160
|
{
|
|
159
161
|
className: l["expand-button"],
|
|
160
162
|
"data-testid": `expand-button-${n.id}`,
|
|
161
163
|
onMouseDown: (_) => {
|
|
162
|
-
_.stopPropagation(),
|
|
164
|
+
_.stopPropagation(), w(n.id);
|
|
163
165
|
},
|
|
164
166
|
children: /* @__PURE__ */ d(
|
|
165
|
-
|
|
167
|
+
S,
|
|
166
168
|
{
|
|
167
|
-
iconName: a ===
|
|
168
|
-
className:
|
|
169
|
+
iconName: a === N.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
|
170
|
+
className: v(l["expand-icon"], {
|
|
169
171
|
[l["expand-icon-expanded"]]: o
|
|
170
172
|
})
|
|
171
173
|
}
|
|
@@ -175,16 +177,16 @@ import './assets/useNestedSelection.css';const B = "_disabled_1l3p8_5", T = "_co
|
|
|
175
177
|
]
|
|
176
178
|
}
|
|
177
179
|
),
|
|
178
|
-
r && o && /* @__PURE__ */ d("div", { className: l["nested-children"], children:
|
|
180
|
+
r && o && /* @__PURE__ */ d("div", { className: l["nested-children"], children: k(n.children, i + 1) })
|
|
179
181
|
] }, n.id);
|
|
180
182
|
});
|
|
181
183
|
};
|
|
182
184
|
return {
|
|
183
|
-
toggleExpanded:
|
|
184
|
-
renderNestedOptions:
|
|
185
|
+
toggleExpanded: w,
|
|
186
|
+
renderNestedOptions: k
|
|
185
187
|
};
|
|
186
188
|
};
|
|
187
189
|
export {
|
|
188
190
|
l as c,
|
|
189
|
-
|
|
191
|
+
rn as u
|
|
190
192
|
};
|