mimir-ui-kit 1.38.7 → 1.38.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/MultiSelectSearch.css +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/MultiSelectSearch/MultiSelectSearch.d.ts +1 -0
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +239 -207
- package/dist/components/MultiSelectSearch/constants.d.ts +3 -0
- package/dist/components/MultiSelectSearch/constants.js +6 -2
- package/dist/components/MultiSelectSearch/types.d.ts +4 -0
- package/dist/components/MultiSelectSearch/utils.d.ts +1 -0
- package/dist/components/MultiSelectSearch/utils.js +19 -14
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
._multi-select-
|
1
|
+
._multi-select-search_io0c8_2{position:relative}._multi-select-search_io0c8_2._disabled_io0c8_5{cursor:not-allowed}._container_io0c8_9{display:block;gap:var(--select-search-gap);align-items:center;justify-content:space-between;height:var(--select-search-height);background-color:var(--black-5);border-radius:var(--select-search-radius)}._container-open_io0c8_18{border-bottom:1px solid var(--citrine-100)}._input-container_io0c8_22{position:relative;width:100%}._full_io0c8_27{width:100%}._selected-icon_io0c8_31 path{fill:var(--sapphire-100)}._selector-icon-open_io0c8_35{transform:rotate(180deg)}._button_io0c8_39{display:flex;align-items:center;background:none;border:none;cursor:pointer}._button_io0c8_39._disabled_io0c8_5{cursor:not-allowed}._button_io0c8_39._disabled_io0c8_5 ._selector-icon_io0c8_35 path{fill:var(--white)}._options_io0c8_53{position:absolute;z-index:10;width:100%;min-height:50%;max-height:var(--select-search-options-height);overflow-y:auto;font-size:var(--mimir-size-text-l);background:var(--white);box-shadow:var(--mimir-box-shadow-select-search);transition:transform .2s ease-out,opacity .2s ease-out;opacity:0}._options_io0c8_53._visible_io0c8_66{opacity:1}._options_io0c8_53._top_io0c8_69{bottom:100%;margin-bottom:1px;border-radius:var(--select-search-radius) var(--select-search-radius) 0 0}._options_io0c8_53._bottom_io0c8_74{top:100%;margin-top:1px;border-radius:0 0 var(--select-search-radius) var(--select-search-radius)}._options_io0c8_53::-webkit-scrollbar{width:3px}._options_io0c8_53::-webkit-scrollbar-thumb{background-color:var(--black-80);border-radius:var(--mimir-control-radius-xs2)}._options_io0c8_53::-webkit-scrollbar-track{background-color:var(--white)}@media (max-width: 600px){._options_io0c8_53{max-height:var(--mimir-select-search-options-height-mobile)}}._no-options_io0c8_95{height:100%;padding:var(--select-search-option-space);color:var(--black-80)}._m_io0c8_2{--select-search-height: var(--mimir-select-search-height-l);--select-search-space: var(--mimir-space-xss) var(--mimir-space-m);--select-search-radius: var(--mimir-control-radius);--select-search-gap: var(--mimir-space-2xs);--select-search-btn-space: var(--mimir-space-m) var(--mimir-space-m) var(--mimir-space-m) var(--mimir-space-xs);--select-search-option-space: var(--mimir-space-2s) var(--mimir-space-m);--select-search-options-height: var( --mimir-select-search-options-height-mobile );--clear-right: var(--mimir-space-2xxl);--multi-select-input-disabled-margin-right: var(--mimir-space-l)}._l_io0c8_116{--select-search-height: var(--mimir-select-search-height-xxl);--select-search-space: var(--mimir-space-xss) var(--mimir-space-m);--select-search-radius: var(--mimir-control-radius-s);--select-search-gap: var(--mimir-space-xs);--select-search-btn-space: var(--mimir-space-l) var(--mimir-space-m) var(--mimir-space-l) var(--mimir-space-xs);--select-search-option-space: var(--mimir-space-2l) var(--mimir-space-m);--select-search-options-height: var( --mimir-select-search-options-height-desktop );--clear-right: var(--mimir-space-4xl);--multi-select-input-disabled-margin-right: var(--mimir-space-1xl)}._multi-select-input-disabled_io0c8_131{margin-right:var(--multi-select-input-disabled-margin-right)}._multi-select-input_io0c8_131._focused_io0c8_134{height:auto;min-height:var(--input-height);overflow:hidden;resize:vertical}._multi-select-input_io0c8_131:last-child{padding-right:var(--mimir-space-4xl)}._option_io0c8_53{display:flex;gap:var(--mimir-space-m);align-items:center;width:100%;padding:var(--select-search-option-space);cursor:pointer;transition:background-color .2s ease-in-out}._option-active_io0c8_153{background-color:var(--black-5)}._option-inner_io0c8_156{display:flex;flex-direction:column;gap:var(--mimir-space-xs);width:100%}._chip_io0c8_163{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}._chip-container_io0c8_168{display:flex;flex-wrap:wrap;gap:var(--mimir-space-2xs);margin-top:var(--mimir-space-xs)}._chip-root_io0c8_174{max-width:100%}._right-slot_io0c8_178{order:2;padding-top:0!important}._required-mark_io0c8_183{order:1;margin-right:var(--mimir-space-xs)}._clear_io0c8_188{position:absolute;top:50%;right:var(--clear-right);transform:translateY(-50%)}._clear_io0c8_188._disabled_io0c8_5{cursor:not-allowed}._clear_io0c8_188._disabled_io0c8_5 ._icon-button_io0c8_197 path{fill:var(--white)}
|
@@ -1,251 +1,280 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { c as
|
3
|
-
import { forwardRef as
|
4
|
-
import { EMultiSelectSearchSize as
|
5
|
-
import { getInitialInputValue as
|
6
|
-
import { Icon as
|
7
|
-
import { Button as
|
8
|
-
import { CheckboxMimir as
|
9
|
-
import { Chip as
|
10
|
-
import { I as
|
11
|
-
import { EInputVariant as
|
12
|
-
import { H as
|
13
|
-
import '../../assets/MultiSelectSearch.css';const
|
14
|
-
"multi-select-search": "_multi-select-
|
15
|
-
disabled:
|
16
|
-
container:
|
17
|
-
"container-open": "_container-
|
18
|
-
"input-container": "_input-
|
19
|
-
full:
|
20
|
-
"selected-icon": "_selected-
|
21
|
-
"selector-icon-open": "_selector-icon-
|
22
|
-
button:
|
23
|
-
"selector-icon": "_selector-
|
24
|
-
options:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"multi-select-input": "_multi-select-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
"option-
|
36
|
-
|
37
|
-
|
38
|
-
"chip-
|
39
|
-
"
|
40
|
-
"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
import { jsxs as M, jsx as n, Fragment as $ } from "react/jsx-runtime";
|
2
|
+
import { c as l } from "../../index-DIxK0V-G.js";
|
3
|
+
import { forwardRef as Ie, useId as ge, useRef as Q, useState as b, useEffect as L, useMemo as Ne, useCallback as Se } from "react";
|
4
|
+
import { EMultiSelectSearchSize as x } from "./constants.js";
|
5
|
+
import { getInitialInputValue as X, shouldShowMenuOnTop as Ce, MULTISELECT_OPEN_EVENT as Y, mapSizeToInputSize as Z, getDropdownArrowIcon as Me, dispatchMultiselectOpen as E, joinSelectedItems as ee } from "./utils.js";
|
6
|
+
import { Icon as Ee } from "../../icons/Icon.js";
|
7
|
+
import { Button as Le } from "../Button/Button.js";
|
8
|
+
import { CheckboxMimir as Te } from "../CheckboxMimir/CheckboxMimir.js";
|
9
|
+
import { Chip as ke } from "../Chip/Chip.js";
|
10
|
+
import { I as te } from "../../Input-BYrIS5GU.js";
|
11
|
+
import { EInputVariant as ye } from "../Input/constants.js";
|
12
|
+
import { H as Oe, U as oe, G as ne, K as ze, W as Ae } from "../../combobox-CVtJDVoZ.js";
|
13
|
+
import '../../assets/MultiSelectSearch.css';const Ve = "_disabled_io0c8_5", xe = "_container_io0c8_9", De = "_full_io0c8_27", Pe = "_button_io0c8_39", qe = "_options_io0c8_53", Re = "_visible_io0c8_66", Be = "_top_io0c8_69", Fe = "_bottom_io0c8_74", je = "_m_io0c8_2", Ge = "_l_io0c8_116", Ue = "_focused_io0c8_134", We = "_option_io0c8_53", He = "_chip_io0c8_163", Je = "_clear_io0c8_188", t = {
|
14
|
+
"multi-select-search": "_multi-select-search_io0c8_2",
|
15
|
+
disabled: Ve,
|
16
|
+
container: xe,
|
17
|
+
"container-open": "_container-open_io0c8_18",
|
18
|
+
"input-container": "_input-container_io0c8_22",
|
19
|
+
full: De,
|
20
|
+
"selected-icon": "_selected-icon_io0c8_31",
|
21
|
+
"selector-icon-open": "_selector-icon-open_io0c8_35",
|
22
|
+
button: Pe,
|
23
|
+
"selector-icon": "_selector-icon_io0c8_35",
|
24
|
+
options: qe,
|
25
|
+
visible: Re,
|
26
|
+
top: Be,
|
27
|
+
bottom: Fe,
|
28
|
+
"no-options": "_no-options_io0c8_95",
|
29
|
+
m: je,
|
30
|
+
l: Ge,
|
31
|
+
"multi-select-input-disabled": "_multi-select-input-disabled_io0c8_131",
|
32
|
+
"multi-select-input": "_multi-select-input_io0c8_131",
|
33
|
+
focused: Ue,
|
34
|
+
option: We,
|
35
|
+
"option-active": "_option-active_io0c8_153",
|
36
|
+
"option-inner": "_option-inner_io0c8_156",
|
37
|
+
chip: He,
|
38
|
+
"chip-container": "_chip-container_io0c8_168",
|
39
|
+
"chip-root": "_chip-root_io0c8_174",
|
40
|
+
"right-slot": "_right-slot_io0c8_178",
|
41
|
+
"required-mark": "_required-mark_io0c8_183",
|
42
|
+
clear: Je,
|
43
|
+
"icon-button": "_icon-button_io0c8_197"
|
44
|
+
}, ct = Ie(
|
45
|
+
(ie, se) => {
|
45
46
|
const {
|
46
|
-
placeholder:
|
47
|
-
size: i =
|
48
|
-
value:
|
47
|
+
placeholder: D,
|
48
|
+
size: i = x.L,
|
49
|
+
value: d,
|
49
50
|
onChange: s,
|
50
|
-
full:
|
51
|
-
showArrow:
|
52
|
-
items:
|
53
|
-
classNameOption:
|
54
|
-
displayValue:
|
55
|
-
filterOnSearch:
|
56
|
-
onSearch:
|
57
|
-
variant:
|
58
|
-
menuPlacement:
|
59
|
-
disabled:
|
60
|
-
searchProps:
|
61
|
-
withClearButton:
|
62
|
-
withChip:
|
63
|
-
chipVariant:
|
64
|
-
disableInput:
|
65
|
-
autocomplete:
|
66
|
-
id:
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
51
|
+
full: ce,
|
52
|
+
showArrow: le = !0,
|
53
|
+
items: h = [],
|
54
|
+
classNameOption: re,
|
55
|
+
displayValue: f = "name",
|
56
|
+
filterOnSearch: P = !0,
|
57
|
+
onSearch: T,
|
58
|
+
variant: q = ye.DefaultGray,
|
59
|
+
menuPlacement: w = "bottom",
|
60
|
+
disabled: r = !1,
|
61
|
+
searchProps: R,
|
62
|
+
withClearButton: k = !1,
|
63
|
+
withChip: ae = !1,
|
64
|
+
chipVariant: ue = "sapphire",
|
65
|
+
disableInput: I = !1,
|
66
|
+
autocomplete: B = "on",
|
67
|
+
id: de,
|
68
|
+
autoPlacement: y = !1
|
69
|
+
} = ie, pe = ge(), p = de || `multiselect-${pe}`, g = Q(null), v = Q(null), [m, _] = b(!1), [N, S] = b(
|
70
|
+
() => X(d, f)
|
71
|
+
), [c, C] = b(
|
72
|
+
d || []
|
73
|
+
), [O, F] = b(w), [z, j] = b(!1), [me, G] = b(!1);
|
72
74
|
L(() => {
|
73
|
-
|
74
|
-
}, [
|
75
|
-
const
|
76
|
-
var
|
77
|
-
if (!
|
78
|
-
const e = ((
|
79
|
-
return
|
75
|
+
d && (C(d), JSON.stringify(d) !== JSON.stringify(c) && S(X(d, f)));
|
76
|
+
}, [d, f, c]);
|
77
|
+
const U = Ne(() => {
|
78
|
+
var o;
|
79
|
+
if (!P) return h;
|
80
|
+
const e = ((o = N.split(",").pop()) == null ? void 0 : o.trim().toLowerCase()) ?? "";
|
81
|
+
return c.length > 0 && c[c.length - 1].name.toLowerCase() === e ? h : h.filter(
|
80
82
|
(a) => a.name.toLowerCase().includes(e)
|
81
83
|
);
|
82
|
-
}, [
|
83
|
-
|
84
|
-
const
|
85
|
-
|
86
|
-
if (
|
87
|
-
|
88
|
-
const a =
|
89
|
-
|
84
|
+
}, [P, h, N, c]), _e = (e) => {
|
85
|
+
C(e), s == null || s(e);
|
86
|
+
const o = ee(e, f);
|
87
|
+
S(o), _(!0), E(p), setTimeout(() => {
|
88
|
+
if (v.current) {
|
89
|
+
v.current.focus(), v.current.scrollLeft = v.current.scrollWidth;
|
90
|
+
const a = o.length;
|
91
|
+
v.current.setSelectionRange(a, a);
|
90
92
|
}
|
91
93
|
}, 0);
|
92
|
-
},
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
94
|
+
}, W = (e) => {
|
95
|
+
var K;
|
96
|
+
if (I) return;
|
97
|
+
const o = e.target.value;
|
98
|
+
S(o), T == null || T(o);
|
99
|
+
const a = o.split(",").map((V) => V.trim()).filter(Boolean), J = h.filter(
|
100
|
+
(V) => a.includes(V[f])
|
98
101
|
);
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
+
C(J), s == null || s(J), _(!0), E(p);
|
103
|
+
const A = (K = g.current) == null ? void 0 : K.querySelector(
|
104
|
+
`.${t.options}`
|
105
|
+
);
|
106
|
+
A && typeof A.scrollTo == "function" && A.scrollTo({ top: 0, behavior: "smooth" });
|
107
|
+
}, he = (e) => {
|
108
|
+
const o = c.filter(
|
102
109
|
(a) => a.id !== e.id
|
103
110
|
);
|
104
|
-
|
105
|
-
},
|
106
|
-
|
107
|
-
|
108
|
-
|
111
|
+
C(o), s == null || s(o), S(ee(o, f));
|
112
|
+
}, u = Se(() => {
|
113
|
+
if (!y) {
|
114
|
+
F(w);
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
const e = Ce(g, i);
|
118
|
+
F(e ? "top" : w);
|
119
|
+
}, [y, w, i]), H = () => {
|
120
|
+
const e = !m;
|
121
|
+
e && (u(), E(p)), _(e);
|
122
|
+
}, fe = (e) => {
|
109
123
|
e.preventDefault(), e.currentTarget.focus();
|
110
|
-
const
|
111
|
-
e.currentTarget.setSelectionRange(
|
112
|
-
},
|
113
|
-
|
114
|
-
},
|
115
|
-
e.stopPropagation(),
|
116
|
-
},
|
117
|
-
|
124
|
+
const o = e.currentTarget.value.length;
|
125
|
+
e.currentTarget.setSelectionRange(o, o);
|
126
|
+
}, ve = () => {
|
127
|
+
S(""), C([]), s == null || s([]);
|
128
|
+
}, be = (e) => {
|
129
|
+
e.stopPropagation(), ve();
|
130
|
+
}, we = (e) => {
|
131
|
+
if (I) {
|
132
|
+
e.target.blur();
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
u(), _(!0), E(p);
|
118
136
|
};
|
119
137
|
return L(() => {
|
120
|
-
const e = (
|
121
|
-
|
138
|
+
const e = (o) => {
|
139
|
+
g.current && !g.current.contains(o.target) && !o.defaultPrevented && _(!1);
|
122
140
|
};
|
123
141
|
return document.addEventListener("mousedown", e), () => {
|
124
142
|
document.removeEventListener("mousedown", e);
|
125
143
|
};
|
126
144
|
}, []), L(() => {
|
127
|
-
const e = (
|
128
|
-
|
145
|
+
const e = (o) => {
|
146
|
+
o.detail !== p && _(!1);
|
129
147
|
};
|
130
148
|
return window.addEventListener(
|
131
|
-
|
149
|
+
Y,
|
132
150
|
e
|
133
151
|
), () => {
|
134
152
|
window.removeEventListener(
|
135
|
-
|
153
|
+
Y,
|
136
154
|
e
|
137
155
|
);
|
138
156
|
};
|
139
|
-
}, [
|
140
|
-
|
141
|
-
|
157
|
+
}, [p]), L(() => {
|
158
|
+
if (m) {
|
159
|
+
u(), window.addEventListener("scroll", u), window.addEventListener("resize", u);
|
160
|
+
const e = requestAnimationFrame(() => {
|
161
|
+
G(!0), j(!0);
|
162
|
+
});
|
163
|
+
return () => {
|
164
|
+
window.removeEventListener("scroll", u), window.removeEventListener("resize", u), cancelAnimationFrame(e);
|
165
|
+
};
|
166
|
+
} else
|
167
|
+
j(!1), G(!1);
|
168
|
+
}, [m, w, y, i, u]), /* @__PURE__ */ M("div", { ref: g, children: [
|
169
|
+
/* @__PURE__ */ n(
|
170
|
+
Oe,
|
142
171
|
{
|
143
172
|
multiple: !0,
|
144
173
|
as: "div",
|
145
|
-
value:
|
146
|
-
className:
|
147
|
-
[t.full]:
|
148
|
-
[t.disabled]:
|
174
|
+
value: c,
|
175
|
+
className: l(t["multi-select-search"], {
|
176
|
+
[t.full]: ce,
|
177
|
+
[t.disabled]: r
|
149
178
|
}),
|
150
|
-
onChange:
|
151
|
-
ref:
|
152
|
-
disabled:
|
153
|
-
virtual: { options:
|
154
|
-
children: /* @__PURE__ */
|
179
|
+
onChange: _e,
|
180
|
+
ref: se,
|
181
|
+
disabled: r,
|
182
|
+
virtual: { options: U },
|
183
|
+
children: /* @__PURE__ */ M(
|
155
184
|
"div",
|
156
185
|
{
|
157
|
-
className:
|
158
|
-
[t["container-open"]]:
|
186
|
+
className: l(t.container, t[i], {
|
187
|
+
[t["container-open"]]: m
|
159
188
|
}),
|
160
189
|
children: [
|
161
|
-
|
162
|
-
/* @__PURE__ */
|
163
|
-
|
190
|
+
I && /* @__PURE__ */ M("div", { className: t["input-container"], children: [
|
191
|
+
/* @__PURE__ */ n(
|
192
|
+
oe,
|
164
193
|
{
|
165
|
-
disabled:
|
194
|
+
disabled: r,
|
166
195
|
style: { width: "100%" },
|
167
|
-
onClick:
|
168
|
-
children: /* @__PURE__ */
|
169
|
-
|
196
|
+
onClick: H,
|
197
|
+
children: /* @__PURE__ */ n(
|
198
|
+
ne,
|
170
199
|
{
|
171
|
-
as:
|
172
|
-
label:
|
173
|
-
size:
|
174
|
-
className:
|
175
|
-
[t["multi-select-input-disabled"]]:
|
200
|
+
as: te,
|
201
|
+
label: D,
|
202
|
+
size: Z(i),
|
203
|
+
className: l(t["multi-select-input"], {
|
204
|
+
[t["multi-select-input-disabled"]]: I && k
|
176
205
|
}),
|
177
|
-
onChange:
|
178
|
-
value:
|
179
|
-
disabled:
|
180
|
-
variant:
|
206
|
+
onChange: W,
|
207
|
+
value: N,
|
208
|
+
disabled: r,
|
209
|
+
variant: q,
|
181
210
|
rightSlotClassName: t["right-slot"],
|
182
211
|
requiredMarkClassName: t["required-mark"],
|
183
212
|
"data-testid": "select-search-input",
|
184
|
-
onFocus:
|
213
|
+
onFocus: we,
|
185
214
|
rightAddon: {
|
186
215
|
addonType: "icon",
|
187
|
-
addonContent:
|
216
|
+
addonContent: Me(m, i)
|
188
217
|
},
|
189
|
-
autocomplete:
|
190
|
-
...
|
218
|
+
autocomplete: B,
|
219
|
+
...R
|
191
220
|
}
|
192
221
|
)
|
193
222
|
}
|
194
223
|
),
|
195
|
-
|
196
|
-
|
224
|
+
k && N && /* @__PURE__ */ n(
|
225
|
+
Le,
|
197
226
|
{
|
198
227
|
tabIndex: -1,
|
199
|
-
className:
|
200
|
-
[t.disabled]:
|
228
|
+
className: l(t.clear, {
|
229
|
+
[t.disabled]: r
|
201
230
|
}),
|
202
231
|
iconButtonClassName: t["icon-button"],
|
203
232
|
isIconButton: !0,
|
204
233
|
iconName: "Close16px",
|
205
234
|
size: "m-s",
|
206
235
|
clear: !0,
|
207
|
-
disabled:
|
236
|
+
disabled: r,
|
208
237
|
variant: "secondary-gray",
|
209
|
-
onClick:
|
238
|
+
onClick: be,
|
210
239
|
"data-testid": "clear-button"
|
211
240
|
}
|
212
241
|
)
|
213
242
|
] }),
|
214
|
-
!
|
215
|
-
|
243
|
+
!I && /* @__PURE__ */ n(
|
244
|
+
ne,
|
216
245
|
{
|
217
|
-
as:
|
218
|
-
label:
|
219
|
-
size:
|
246
|
+
as: te,
|
247
|
+
label: D,
|
248
|
+
size: Z(i),
|
220
249
|
className: t["multi-select-input"],
|
221
250
|
rightSlotClassName: t["right-slot"],
|
222
251
|
requiredMarkClassName: t["required-mark"],
|
223
|
-
value:
|
224
|
-
disabled:
|
225
|
-
variant:
|
226
|
-
withClearButton:
|
252
|
+
value: N,
|
253
|
+
disabled: r,
|
254
|
+
variant: q,
|
255
|
+
withClearButton: k,
|
227
256
|
onFocus: () => {
|
228
|
-
|
257
|
+
_(!0), E(p);
|
229
258
|
},
|
230
|
-
onMouseDown:
|
231
|
-
onChange:
|
232
|
-
ref:
|
259
|
+
onMouseDown: fe,
|
260
|
+
onChange: W,
|
261
|
+
ref: v,
|
233
262
|
rightAddon: {
|
234
263
|
addonType: "react-node",
|
235
|
-
addonContent:
|
236
|
-
|
264
|
+
addonContent: le && /* @__PURE__ */ n(
|
265
|
+
oe,
|
237
266
|
{
|
238
|
-
className:
|
239
|
-
[t.disabled]:
|
267
|
+
className: l(t.button, {
|
268
|
+
[t.disabled]: r
|
240
269
|
}),
|
241
|
-
disabled:
|
242
|
-
onMouseDown:
|
243
|
-
children: /* @__PURE__ */
|
244
|
-
|
270
|
+
disabled: r,
|
271
|
+
onMouseDown: H,
|
272
|
+
children: /* @__PURE__ */ n(
|
273
|
+
Ee,
|
245
274
|
{
|
246
|
-
iconName: i ==
|
247
|
-
className:
|
248
|
-
[t["selector-icon-open"]]:
|
275
|
+
iconName: i == x.M ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
|
276
|
+
className: l(t["selector-icon"], {
|
277
|
+
[t["selector-icon-open"]]: m
|
249
278
|
})
|
250
279
|
}
|
251
280
|
)
|
@@ -253,43 +282,44 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
|
|
253
282
|
)
|
254
283
|
},
|
255
284
|
"data-testid": "select-search-input",
|
256
|
-
autocomplete:
|
257
|
-
...
|
285
|
+
autocomplete: B,
|
286
|
+
...R
|
258
287
|
}
|
259
288
|
),
|
260
|
-
|
261
|
-
|
289
|
+
m && me && /* @__PURE__ */ n($, { children: h.length ? U.length ? /* @__PURE__ */ n(
|
290
|
+
ze,
|
262
291
|
{
|
263
|
-
className:
|
292
|
+
className: l(
|
264
293
|
t.options,
|
265
294
|
t[i],
|
266
|
-
t[
|
295
|
+
t[O],
|
296
|
+
{ [t.visible]: z }
|
267
297
|
),
|
268
298
|
modal: !1,
|
269
299
|
static: !0,
|
270
|
-
children: ({ option: e }) => /* @__PURE__ */
|
271
|
-
|
300
|
+
children: ({ option: e }) => /* @__PURE__ */ n(
|
301
|
+
Ae,
|
272
302
|
{
|
273
303
|
value: e,
|
274
|
-
className: ({ focus:
|
304
|
+
className: ({ focus: o }) => l(
|
275
305
|
t.option,
|
276
|
-
|
306
|
+
re,
|
277
307
|
i && t[i],
|
278
308
|
{
|
279
|
-
[t["option-active"]]:
|
309
|
+
[t["option-active"]]: o
|
280
310
|
}
|
281
311
|
),
|
282
|
-
children: /* @__PURE__ */
|
283
|
-
/* @__PURE__ */
|
312
|
+
children: /* @__PURE__ */ M($, { children: [
|
313
|
+
/* @__PURE__ */ M("div", { className: t["option-inner"], children: [
|
284
314
|
e.name,
|
285
|
-
e.bottom && /* @__PURE__ */
|
315
|
+
e.bottom && /* @__PURE__ */ n("div", { children: e.bottom })
|
286
316
|
] }),
|
287
|
-
/* @__PURE__ */
|
288
|
-
|
317
|
+
/* @__PURE__ */ n(
|
318
|
+
Te,
|
289
319
|
{
|
290
320
|
isInteractive: !1,
|
291
|
-
checked:
|
292
|
-
(
|
321
|
+
checked: c.some(
|
322
|
+
(o) => o.id === e.id
|
293
323
|
)
|
294
324
|
}
|
295
325
|
)
|
@@ -298,25 +328,27 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
|
|
298
328
|
e.id
|
299
329
|
)
|
300
330
|
}
|
301
|
-
) : /* @__PURE__ */
|
331
|
+
) : /* @__PURE__ */ n(
|
302
332
|
"div",
|
303
333
|
{
|
304
|
-
className:
|
334
|
+
className: l(
|
305
335
|
t.options,
|
306
336
|
t[i],
|
307
337
|
t["no-options"],
|
308
|
-
t[
|
338
|
+
t[O],
|
339
|
+
{ [t.visible]: z }
|
309
340
|
),
|
310
341
|
children: "Ничего не найдено"
|
311
342
|
}
|
312
|
-
) : /* @__PURE__ */
|
343
|
+
) : /* @__PURE__ */ n(
|
313
344
|
"div",
|
314
345
|
{
|
315
|
-
className:
|
346
|
+
className: l(
|
316
347
|
t.options,
|
317
348
|
t[i],
|
318
349
|
t["no-options"],
|
319
|
-
t[
|
350
|
+
t[O],
|
351
|
+
{ [t.visible]: z }
|
320
352
|
),
|
321
353
|
children: "Нет данных"
|
322
354
|
}
|
@@ -326,15 +358,15 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
|
|
326
358
|
)
|
327
359
|
}
|
328
360
|
),
|
329
|
-
|
330
|
-
|
361
|
+
ae && c.length > 0 && /* @__PURE__ */ n("div", { className: t["chip-container"], children: c.map((e) => /* @__PURE__ */ n(
|
362
|
+
ke,
|
331
363
|
{
|
332
|
-
size: i ===
|
333
|
-
variant:
|
364
|
+
size: i === x.L ? "s" : "xs",
|
365
|
+
variant: ue,
|
334
366
|
className: t["chip-root"],
|
335
367
|
withAction: !0,
|
336
|
-
onClose: () =>
|
337
|
-
children: /* @__PURE__ */
|
368
|
+
onClose: () => he(e),
|
369
|
+
children: /* @__PURE__ */ n("span", { className: t.chip, children: e.name })
|
338
370
|
},
|
339
371
|
e.id
|
340
372
|
)) })
|
@@ -342,5 +374,5 @@ import '../../assets/MultiSelectSearch.css';const ge = "_disabled_17kql_5", ve =
|
|
342
374
|
}
|
343
375
|
);
|
344
376
|
export {
|
345
|
-
|
377
|
+
ct as MultiSelectSearch
|
346
378
|
};
|
@@ -1,4 +1,8 @@
|
|
1
|
-
var
|
1
|
+
var I = /* @__PURE__ */ ((E) => (E.M = "m", E.L = "l", E))(I || {});
|
2
|
+
const _ = 767, n = 264, o = 320;
|
2
3
|
export {
|
3
|
-
|
4
|
+
o as DESKTOP_MENU_HEIGHT,
|
5
|
+
I as EMultiSelectSearchSize,
|
6
|
+
_ as MOBILE_BREAKPOINT,
|
7
|
+
n as MOBILE_MENU_HEIGHT
|
4
8
|
};
|
@@ -8,3 +8,4 @@ export declare const getInitialInputValue: (value: TMultiSelectOption[] | undefi
|
|
8
8
|
export declare const joinSelectedItems: (items: TMultiSelectOption[], displayValue: string) => string;
|
9
9
|
export declare const MULTISELECT_OPEN_EVENT = "multiselectOpen";
|
10
10
|
export declare const dispatchMultiselectOpen: (id: string) => void;
|
11
|
+
export declare const shouldShowMenuOnTop: (selectRef: React.RefObject<HTMLDivElement>, size: EMultiSelectSearchSize) => boolean;
|
@@ -1,23 +1,28 @@
|
|
1
|
-
import { EMultiSelectSearchSize as o } from "./constants.js";
|
1
|
+
import { EMultiSelectSearchSize as o, MOBILE_MENU_HEIGHT as u, DESKTOP_MENU_HEIGHT as w } from "./constants.js";
|
2
2
|
import "../../Input-BYrIS5GU.js";
|
3
|
-
import { EInputSize as
|
4
|
-
const
|
3
|
+
import { EInputSize as r } from "../Input/constants.js";
|
4
|
+
const m = (t) => {
|
5
5
|
switch (t) {
|
6
6
|
case o.M:
|
7
|
-
return
|
7
|
+
return r.M;
|
8
8
|
case o.L:
|
9
|
-
return
|
9
|
+
return r.L;
|
10
10
|
default:
|
11
|
-
return
|
11
|
+
return r.M;
|
12
12
|
}
|
13
|
-
},
|
14
|
-
window.dispatchEvent(new CustomEvent(
|
13
|
+
}, M = (t, e) => t ? e === o.L ? "DropdownArrowUp24px" : "DropdownArrowUp16px" : e === o.L ? "DropdownArrowDown24px" : "DropdownArrowBottom16px", h = (t, e) => t && t.length > 0 ? t.map((n) => n[e]).join(", ") : "", I = (t, e) => t.map((n) => n[e]).join(", "), l = "multiselectOpen", S = (t) => {
|
14
|
+
window.dispatchEvent(new CustomEvent(l, { detail: t }));
|
15
|
+
}, f = (t, e) => {
|
16
|
+
if (!t.current) return !1;
|
17
|
+
const n = t.current.getBoundingClientRect(), p = window.innerHeight, c = e === o.M ? u : w, i = p - n.bottom, s = n.top;
|
18
|
+
return i >= c ? !1 : s > i;
|
15
19
|
};
|
16
20
|
export {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
l as MULTISELECT_OPEN_EVENT,
|
22
|
+
S as dispatchMultiselectOpen,
|
23
|
+
M as getDropdownArrowIcon,
|
24
|
+
h as getInitialInputValue,
|
25
|
+
I as joinSelectedItems,
|
26
|
+
m as mapSizeToInputSize,
|
27
|
+
f as shouldShowMenuOnTop
|
23
28
|
};
|