@reportportal/ui-kit 0.0.1-alpha.106 → 0.0.1-alpha.108
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/attachedFile.js +1 -1
- package/dist/autocompletes.js +694 -0
- package/dist/components/autocompletes/common/autocompleteMenu/autocompleteMenu.d.ts +9 -0
- package/dist/components/autocompletes/common/autocompleteMenu/index.d.ts +1 -0
- package/dist/components/autocompletes/common/autocompleteOption/autocompleteOption.d.ts +13 -0
- package/dist/components/autocompletes/common/autocompleteOption/index.d.ts +1 -0
- package/dist/components/autocompletes/common/autocompleteOptions.d.ts +19 -0
- package/dist/components/autocompletes/common/autocompletePrompt/autocompletePrompt.d.ts +7 -0
- package/dist/components/autocompletes/common/autocompletePrompt/index.d.ts +1 -0
- package/dist/components/autocompletes/common/index.d.ts +19 -0
- package/dist/components/autocompletes/constants.d.ts +2 -0
- package/dist/components/autocompletes/index.d.ts +3 -0
- package/dist/components/autocompletes/multipleAutocomplete/index.d.ts +17 -0
- package/dist/components/autocompletes/multipleAutocomplete/multipleAutocomplete.d.ts +46 -0
- package/dist/components/autocompletes/multipleAutocomplete/multipleDownshift.d.ts +25 -0
- package/dist/components/autocompletes/multipleAutocomplete/selectedItems/index.d.ts +1 -0
- package/dist/components/autocompletes/multipleAutocomplete/selectedItems/selectedItems.d.ts +35 -0
- package/dist/components/autocompletes/singleAutocomplete/index.d.ts +1 -0
- package/dist/components/autocompletes/singleAutocomplete/singleAutocomplete.d.ts +40 -0
- package/dist/components/autocompletes/types.d.ts +8 -0
- package/dist/components/autocompletes/utils.d.ts +5 -0
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/fieldText/fieldText.d.ts +2 -2
- package/dist/components/fieldTextFlex/fieldTextFlex.d.ts +2 -1
- package/dist/components/fileDropArea/index.d.ts +3 -3
- package/dist/components/icons/index.d.ts +4 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/components/sidePanel/index.d.ts +2 -0
- package/dist/components/sidePanel/sidePanel.d.ts +17 -0
- package/dist/{fieldNumber-1fa248f5.js → fieldNumber-d1b5a7a1.js} +15 -14
- package/dist/fieldNumber.js +3 -2
- package/dist/fieldTextFlex-2f51c173.js +80 -0
- package/dist/fieldTextFlex.js +1 -1
- package/dist/fileDropArea.js +135 -168
- package/dist/icons.js +65 -60
- package/dist/{index-803576c3.js → index-1a874a8b.js} +1 -1
- package/dist/index.js +126 -116
- package/dist/isEmpty-ccacb5ff.js +38 -0
- package/dist/minus-2857540f.js +5 -0
- package/dist/plus-199fb2a8.js +5 -0
- package/dist/sidePanel.js +74 -0
- package/dist/style.css +1 -1
- package/package.json +13 -1
- package/dist/fieldTextFlex-8afaab31.js +0 -78
- package/dist/plus-0929dda4.js +0 -6
package/dist/attachedFile.js
CHANGED
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
import { jsx as r, jsxs as F, Fragment as te } from "react/jsx-runtime";
|
|
2
|
+
import { useState as ae, useCallback as K, forwardRef as ye, useRef as Ne, useEffect as we } from "react";
|
|
3
|
+
import { c as L } from "./bind-06a7ff84.js";
|
|
4
|
+
import { Scrollbars as ke } from "rc-scrollbars";
|
|
5
|
+
import { B as xe } from "./bubblesLoader-f3ffa240.js";
|
|
6
|
+
import { B as Ee } from "./button-97d9e587.js";
|
|
7
|
+
import { S as Ie } from "./plus-199fb2a8.js";
|
|
8
|
+
import { i as Se } from "./isEmpty-ccacb5ff.js";
|
|
9
|
+
import V from "downshift";
|
|
10
|
+
import { useFloating as _e, autoUpdate as pe } from "@floating-ui/react";
|
|
11
|
+
import { F as Be } from "./fieldText-ba8a917c.js";
|
|
12
|
+
import { S as Fe } from "./close-4d480ef7.js";
|
|
13
|
+
import { S as qe } from "./openEye-7b9cf080.js";
|
|
14
|
+
import "./baseIconButton-251479f7.js";
|
|
15
|
+
import "./spinLoader-c4a53718.js";
|
|
16
|
+
import "./maxValueDisplay-9be01a75.js";
|
|
17
|
+
import "./fieldLabel.js";
|
|
18
|
+
const Ae = "_disabled_18ek6_43", $e = "_input_18ek6_97", Me = {
|
|
19
|
+
"selected-item": "_selected-item_18ek6_16",
|
|
20
|
+
"validation-error": "_validation-error_18ek6_35",
|
|
21
|
+
"highlight-un-stored-item": "_highlight-un-stored-item_18ek6_40",
|
|
22
|
+
disabled: Ae,
|
|
23
|
+
"mobile-disabled": "_mobile-disabled_18ek6_48",
|
|
24
|
+
"cross-icon": "_cross-icon_18ek6_54",
|
|
25
|
+
input: $e
|
|
26
|
+
}, le = L.bind(Me), Oe = ({
|
|
27
|
+
item: s,
|
|
28
|
+
onRemoveItem: e,
|
|
29
|
+
disabled: i = !1,
|
|
30
|
+
mobileDisabled: n = !1,
|
|
31
|
+
parseValueToString: o,
|
|
32
|
+
error: a = !1,
|
|
33
|
+
editItem: p,
|
|
34
|
+
editable: u = !1,
|
|
35
|
+
getAdditionalCreationCondition: b = () => !0,
|
|
36
|
+
storedOption: y = !0,
|
|
37
|
+
highlightUnStoredItem: h = !1,
|
|
38
|
+
variant: x = "light",
|
|
39
|
+
getItemName: g
|
|
40
|
+
}) => {
|
|
41
|
+
const [f, E] = ae(!1), [_, N] = ae(""), I = () => {
|
|
42
|
+
!i && u && !y && (N((g == null ? void 0 : g(s)) || (o == null ? void 0 : o(s)) || ""), E(!0));
|
|
43
|
+
}, B = (t) => {
|
|
44
|
+
N(t.target.value);
|
|
45
|
+
}, q = (t) => {
|
|
46
|
+
const c = b(_);
|
|
47
|
+
t.key === "Enter" && c && (p(s, _), E(!1), N(""));
|
|
48
|
+
}, l = () => {
|
|
49
|
+
E(!1), N("");
|
|
50
|
+
}, d = (t) => {
|
|
51
|
+
t.stopPropagation(), e(s);
|
|
52
|
+
};
|
|
53
|
+
return f ? /* @__PURE__ */ r(
|
|
54
|
+
"input",
|
|
55
|
+
{
|
|
56
|
+
autoFocus: !0,
|
|
57
|
+
value: _,
|
|
58
|
+
onChange: B,
|
|
59
|
+
onKeyDown: q,
|
|
60
|
+
onBlur: l,
|
|
61
|
+
className: le("input")
|
|
62
|
+
}
|
|
63
|
+
) : /* @__PURE__ */ F(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: le("selected-item", x, {
|
|
67
|
+
[`validation-${a}`]: a,
|
|
68
|
+
disabled: i,
|
|
69
|
+
"mobile-disabled": n,
|
|
70
|
+
"highlight-un-stored-item": h && !y
|
|
71
|
+
}),
|
|
72
|
+
onClick: I,
|
|
73
|
+
children: [
|
|
74
|
+
o == null ? void 0 : o(s),
|
|
75
|
+
!i && /* @__PURE__ */ r(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
className: le("cross-icon", {
|
|
80
|
+
[`validation-${a}`]: a,
|
|
81
|
+
"mobile-disabled": n,
|
|
82
|
+
disabled: i
|
|
83
|
+
}),
|
|
84
|
+
onClick: d,
|
|
85
|
+
children: /* @__PURE__ */ r(Fe, {})
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}, Re = ({
|
|
92
|
+
items: s = [],
|
|
93
|
+
parseValueToString: e,
|
|
94
|
+
getItemValidationErrorType: i,
|
|
95
|
+
storedItemsMap: n = {},
|
|
96
|
+
highlightUnStoredItem: o = !1,
|
|
97
|
+
renderCustomSelectedItem: a,
|
|
98
|
+
...p
|
|
99
|
+
}) => s.map((u) => a ? a(u) : /* @__PURE__ */ r(
|
|
100
|
+
Oe,
|
|
101
|
+
{
|
|
102
|
+
parseValueToString: e,
|
|
103
|
+
error: (i == null ? void 0 : i(u)) || "",
|
|
104
|
+
item: u,
|
|
105
|
+
storedOption: !!n[e(u)],
|
|
106
|
+
highlightUnStoredItem: o,
|
|
107
|
+
...p
|
|
108
|
+
},
|
|
109
|
+
e == null ? void 0 : e(u)
|
|
110
|
+
)), Ce = "_prompt_1xfmd_16", De = {
|
|
111
|
+
prompt: Ce
|
|
112
|
+
}, je = L.bind(De), He = ({ children: s = null }) => /* @__PURE__ */ r("div", { className: je("prompt"), children: s }), Pe = "_item_1qhaq_16", Le = "_divider_1qhaq_24", We = "_active_1qhaq_48", ze = "_value_1qhaq_60", Ke = "_tag_1qhaq_78", Ye = "_disabled_1qhaq_89", Xe = {
|
|
113
|
+
item: Pe,
|
|
114
|
+
divider: Le,
|
|
115
|
+
"new-item": "_new-item_1qhaq_31",
|
|
116
|
+
active: We,
|
|
117
|
+
value: ze,
|
|
118
|
+
"key-variant": "_key-variant_1qhaq_75",
|
|
119
|
+
tag: Ke,
|
|
120
|
+
"button-active": "_button-active_1qhaq_89",
|
|
121
|
+
disabled: Ye,
|
|
122
|
+
"value-variant": "_value-variant_1qhaq_109"
|
|
123
|
+
}, Y = L.bind(Xe), me = ({
|
|
124
|
+
isActive: s = !1,
|
|
125
|
+
isSelected: e = !1,
|
|
126
|
+
isNew: i = !1,
|
|
127
|
+
children: n = null,
|
|
128
|
+
disabled: o = !1,
|
|
129
|
+
optionVariant: a = "",
|
|
130
|
+
newItemButtonText: p = "",
|
|
131
|
+
...u
|
|
132
|
+
}) => {
|
|
133
|
+
const b = () => p || (a === "key-variant" ? "New key" : "New value");
|
|
134
|
+
return i ? /* @__PURE__ */ F(te, { children: [
|
|
135
|
+
/* @__PURE__ */ r("div", { className: Y("divider") }),
|
|
136
|
+
/* @__PURE__ */ F(
|
|
137
|
+
"li",
|
|
138
|
+
{
|
|
139
|
+
className: Y("new-item", a, {
|
|
140
|
+
active: s,
|
|
141
|
+
selected: e,
|
|
142
|
+
disabled: o
|
|
143
|
+
}),
|
|
144
|
+
...u,
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ r("span", { className: Y("value"), children: n }),
|
|
147
|
+
/* @__PURE__ */ r(
|
|
148
|
+
Ee,
|
|
149
|
+
{
|
|
150
|
+
...!o && u,
|
|
151
|
+
className: Y({ "button-active": s }),
|
|
152
|
+
icon: /* @__PURE__ */ r(Ie, {}),
|
|
153
|
+
variant: "text",
|
|
154
|
+
children: b()
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] }) : /* @__PURE__ */ r(
|
|
161
|
+
"li",
|
|
162
|
+
{
|
|
163
|
+
className: Y("item", a, {
|
|
164
|
+
active: s,
|
|
165
|
+
selected: e,
|
|
166
|
+
disabled: o
|
|
167
|
+
}),
|
|
168
|
+
...o ? {} : u,
|
|
169
|
+
children: /* @__PURE__ */ r("span", { className: Y("label", "tag"), children: n })
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}, Ge = "_container_igshu_16", Je = {
|
|
173
|
+
container: Ge
|
|
174
|
+
}, ie = L.bind(Je), Qe = (s) => {
|
|
175
|
+
const {
|
|
176
|
+
options: e,
|
|
177
|
+
async: i,
|
|
178
|
+
inputValue: n,
|
|
179
|
+
loading: o,
|
|
180
|
+
createWithoutConfirmation: a,
|
|
181
|
+
customEmptyListMessage: p,
|
|
182
|
+
customNoMatchesMessage: u,
|
|
183
|
+
optionVariant: b,
|
|
184
|
+
newItemButtonText: y,
|
|
185
|
+
renderOption: h,
|
|
186
|
+
getUniqKey: x,
|
|
187
|
+
getItemProps: g,
|
|
188
|
+
parseValueToString: f
|
|
189
|
+
} = s, E = K(() => (e || []).filter((t) => f(t).toUpperCase().indexOf((n.toUpperCase() || "").trim()) > -1), [n, e, f]), _ = K(
|
|
190
|
+
(t, c, v = !1) => h ? h(t, c, v, g) : /* @__PURE__ */ r(
|
|
191
|
+
me,
|
|
192
|
+
{
|
|
193
|
+
optionVariant: b,
|
|
194
|
+
...g({ item: t, index: c }),
|
|
195
|
+
isNew: v,
|
|
196
|
+
newItemButtonText: y,
|
|
197
|
+
children: f(t)
|
|
198
|
+
},
|
|
199
|
+
(x == null ? void 0 : x(t)) || f(t)
|
|
200
|
+
),
|
|
201
|
+
[g, x, y, b, f, h]
|
|
202
|
+
), N = K(
|
|
203
|
+
(t) => t.length ? t.map((c, v) => _(c, v)) : "",
|
|
204
|
+
[_]
|
|
205
|
+
), I = K(
|
|
206
|
+
(t) => {
|
|
207
|
+
const c = t.length;
|
|
208
|
+
return /* @__PURE__ */ r("div", { className: ie({ container: !c }), children: /* @__PURE__ */ r(
|
|
209
|
+
me,
|
|
210
|
+
{
|
|
211
|
+
optionVariant: b,
|
|
212
|
+
isNew: !0,
|
|
213
|
+
...g({ item: n, index: c }),
|
|
214
|
+
children: f(n)
|
|
215
|
+
},
|
|
216
|
+
f(n)
|
|
217
|
+
) });
|
|
218
|
+
},
|
|
219
|
+
[g, n, b, f]
|
|
220
|
+
), B = K(
|
|
221
|
+
(t) => o ? /* @__PURE__ */ F(te, { children: [
|
|
222
|
+
/* @__PURE__ */ r(He, { children: /* @__PURE__ */ r(xe, {}) }),
|
|
223
|
+
!a && I(t)
|
|
224
|
+
] }) : "",
|
|
225
|
+
[a, o, I]
|
|
226
|
+
), q = K(() => {
|
|
227
|
+
const t = (e == null ? void 0 : e.length) === 0 ? p || "No available options" : u || "No matches found";
|
|
228
|
+
return /* @__PURE__ */ r("div", { className: ie("empty-list-message"), children: t });
|
|
229
|
+
}, [p, u, e == null ? void 0 : e.length]), l = i ? e : E(), d = B(e);
|
|
230
|
+
return d || /* @__PURE__ */ F("div", { className: ie({ container: e.length }), children: [
|
|
231
|
+
/* @__PURE__ */ r(ke, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: Se(l) ? q() : N(l) }),
|
|
232
|
+
!a && I(l)
|
|
233
|
+
] });
|
|
234
|
+
}, Ze = "_menu_1bgrz_16", Te = "_opened_1bgrz_35", Ue = "_dark_1bgrz_38", Ve = {
|
|
235
|
+
menu: Ze,
|
|
236
|
+
opened: Te,
|
|
237
|
+
dark: Ue
|
|
238
|
+
}, et = L.bind(Ve), tt = (s, e) => !s || s <= e.trim().length, he = ye(
|
|
239
|
+
({
|
|
240
|
+
isOpen: s = !1,
|
|
241
|
+
style: e = {},
|
|
242
|
+
minLength: i = 1,
|
|
243
|
+
inputValue: n = "",
|
|
244
|
+
className: o = "",
|
|
245
|
+
...a
|
|
246
|
+
}, p) => /* @__PURE__ */ r(
|
|
247
|
+
"ul",
|
|
248
|
+
{
|
|
249
|
+
ref: p,
|
|
250
|
+
className: et(
|
|
251
|
+
"menu",
|
|
252
|
+
{ opened: s && tt(i, n) },
|
|
253
|
+
o
|
|
254
|
+
),
|
|
255
|
+
style: e,
|
|
256
|
+
children: /* @__PURE__ */ r(Qe, { inputValue: n, ...a })
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
), fe = (s, e) => typeof s == "string" ? s : e ? String(s[e(s)]) : "", ee = (s, e) => {
|
|
260
|
+
var n;
|
|
261
|
+
return s === e ? !0 : !!(s && e && typeof s == "object" && typeof e == "object" && Object.keys(s).length === Object.keys(e).length && ((n = Object.entries(s)) != null && n.every(([o, a]) => ee(a, e[o]))));
|
|
262
|
+
}, st = (s, e, i) => typeof s == "string" ? s === e : i ? (() => {
|
|
263
|
+
const n = i(s);
|
|
264
|
+
return s[n] === e[n];
|
|
265
|
+
})() : !1, ot = ({
|
|
266
|
+
options: s = [],
|
|
267
|
+
onChange: e,
|
|
268
|
+
selectedItems: i = [],
|
|
269
|
+
handleUnStoredItemCb: n = null,
|
|
270
|
+
existingItemsMap: o = {},
|
|
271
|
+
children: a,
|
|
272
|
+
customizeNewSelectedValue: p = (h) => h,
|
|
273
|
+
getOptionUniqKey: u,
|
|
274
|
+
getOptionUniqKeyValue: b,
|
|
275
|
+
...y
|
|
276
|
+
}) => {
|
|
277
|
+
const [h, x] = ae(o), g = (l, d) => {
|
|
278
|
+
const t = {
|
|
279
|
+
...h
|
|
280
|
+
};
|
|
281
|
+
l.forEach((c) => {
|
|
282
|
+
if (s.find((v) => st(v, c, u))) {
|
|
283
|
+
const v = fe(c, u);
|
|
284
|
+
t[v] = !0;
|
|
285
|
+
}
|
|
286
|
+
}), x(t), d(t);
|
|
287
|
+
}, f = (l, d) => {
|
|
288
|
+
const t = fe(l, u);
|
|
289
|
+
if (t in h) {
|
|
290
|
+
const c = { ...h };
|
|
291
|
+
delete c[t], x(c), d(c);
|
|
292
|
+
} else
|
|
293
|
+
d(h);
|
|
294
|
+
}, E = (l, d) => {
|
|
295
|
+
const t = p(l), c = Array.isArray(t) ? t : [t], M = [...i.filter((O) => c.indexOf(O) < 0), ...c];
|
|
296
|
+
e == null || e(M, d), g(c, (O) => n == null ? void 0 : n(M, O));
|
|
297
|
+
}, _ = (l, d) => {
|
|
298
|
+
const t = i.indexOf(l), c = [...i];
|
|
299
|
+
c.splice(t, 1, d), e == null || e(c, null);
|
|
300
|
+
}, N = (l, d) => {
|
|
301
|
+
const t = i.filter((v) => !ee(v, l));
|
|
302
|
+
e == null || e(t, d), f(l, (v) => n == null ? void 0 : n(t, v));
|
|
303
|
+
}, I = (l, d) => {
|
|
304
|
+
l && E(l, d);
|
|
305
|
+
}, B = (l) => ({
|
|
306
|
+
removeItem: N,
|
|
307
|
+
editItem: _,
|
|
308
|
+
handleChange: e,
|
|
309
|
+
getOptionUniqKeyValue: b,
|
|
310
|
+
storedItemsMap: h,
|
|
311
|
+
...l
|
|
312
|
+
});
|
|
313
|
+
return /* @__PURE__ */ r(
|
|
314
|
+
V,
|
|
315
|
+
{
|
|
316
|
+
...y,
|
|
317
|
+
stateReducer: (l, d) => {
|
|
318
|
+
switch (d.type) {
|
|
319
|
+
case V.stateChangeTypes.keyDownEnter:
|
|
320
|
+
case V.stateChangeTypes.clickItem:
|
|
321
|
+
return {
|
|
322
|
+
...d,
|
|
323
|
+
highlightedIndex: l.highlightedIndex,
|
|
324
|
+
inputValue: ""
|
|
325
|
+
};
|
|
326
|
+
default:
|
|
327
|
+
return d;
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
onChange: I,
|
|
331
|
+
selectedItem: null,
|
|
332
|
+
children: (l) => a == null ? void 0 : a(B(l))
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
}, nt = "_autocomplete_1rvi8_16", rt = "_disabled_1rvi8_32", ct = "_error_1rvi8_35", lt = "_touched_1rvi8_35", it = "_input_1rvi8_74", at = {
|
|
336
|
+
autocomplete: nt,
|
|
337
|
+
"autocomplete-wrapper": "_autocomplete-wrapper_1rvi8_28",
|
|
338
|
+
disabled: rt,
|
|
339
|
+
error: ct,
|
|
340
|
+
touched: lt,
|
|
341
|
+
"clear-icon": "_clear-icon_1rvi8_46",
|
|
342
|
+
"clear-icon--disabled": "_clear-icon--disabled_1rvi8_56",
|
|
343
|
+
"autocomplete-input": "_autocomplete-input_1rvi8_60",
|
|
344
|
+
"mobile-disabled": "_mobile-disabled_1rvi8_69",
|
|
345
|
+
input: it,
|
|
346
|
+
"type-number": "_type-number_1rvi8_98",
|
|
347
|
+
"error-text": "_error-text_1rvi8_109"
|
|
348
|
+
}, X = L.bind(at), Mt = (s) => {
|
|
349
|
+
const {
|
|
350
|
+
options: e = [],
|
|
351
|
+
loading: i = !1,
|
|
352
|
+
onStateChange: n = () => {
|
|
353
|
+
},
|
|
354
|
+
value: o = [],
|
|
355
|
+
placeholder: a = "",
|
|
356
|
+
error: p = "",
|
|
357
|
+
touched: u = !1,
|
|
358
|
+
creatable: b = !1,
|
|
359
|
+
editable: y = !1,
|
|
360
|
+
onChange: h = () => {
|
|
361
|
+
},
|
|
362
|
+
onFocus: x = () => {
|
|
363
|
+
},
|
|
364
|
+
onBlur: g = () => {
|
|
365
|
+
},
|
|
366
|
+
disabled: f = !1,
|
|
367
|
+
mobileDisabled: E = !1,
|
|
368
|
+
inputProps: _ = {},
|
|
369
|
+
parseValueToString: N = (m) => m == null ? "" : String(m),
|
|
370
|
+
maxLength: I = null,
|
|
371
|
+
async: B = !1,
|
|
372
|
+
customClass: q = "",
|
|
373
|
+
createWithoutConfirmation: l = !1,
|
|
374
|
+
getItemValidationErrorType: d = null,
|
|
375
|
+
clearItemsError: t = () => {
|
|
376
|
+
},
|
|
377
|
+
getAdditionalCreationCondition: c = () => !0,
|
|
378
|
+
highlightUnStoredItem: v = !1,
|
|
379
|
+
parseInputValueFn: M = null,
|
|
380
|
+
handleUnStoredItemCb: Z = null,
|
|
381
|
+
dataAutomationId: O = "",
|
|
382
|
+
existingItemsMap: T = {},
|
|
383
|
+
customizeNewSelectedValue: se = (m) => m,
|
|
384
|
+
renderCustomSelectedItem: oe,
|
|
385
|
+
useFixedPositioning: ne,
|
|
386
|
+
newItemButtonText: S = "",
|
|
387
|
+
...R
|
|
388
|
+
} = s, { refs: C, floatingStyles: D } = _e({
|
|
389
|
+
placement: "bottom-start",
|
|
390
|
+
strategy: ne ? "fixed" : "absolute",
|
|
391
|
+
whileElementsMounted: pe
|
|
392
|
+
}), A = o.length === 0 && !f ? a : "", j = Ne(null);
|
|
393
|
+
we(() => {
|
|
394
|
+
t();
|
|
395
|
+
}, [t, o]);
|
|
396
|
+
const re = (m, w) => {
|
|
397
|
+
h(m, w);
|
|
398
|
+
}, G = (m, w, $) => ({ item: k, index: Q, ...W }) => m({
|
|
399
|
+
item: k,
|
|
400
|
+
index: Q,
|
|
401
|
+
isSelected: $.some((ce) => ee(ce, k)),
|
|
402
|
+
...W,
|
|
403
|
+
isActive: w === Q
|
|
404
|
+
}), H = ({
|
|
405
|
+
event: m,
|
|
406
|
+
removeItem: w,
|
|
407
|
+
inputValue: $
|
|
408
|
+
}) => {
|
|
409
|
+
m.key === "Backspace" && !$ && o.length && w(o[o.length - 1], null);
|
|
410
|
+
}, P = ({
|
|
411
|
+
inputValue: m,
|
|
412
|
+
selectItem: w,
|
|
413
|
+
clearSelection: $
|
|
414
|
+
}) => {
|
|
415
|
+
if (M) {
|
|
416
|
+
const k = M(m);
|
|
417
|
+
(k.length ? k : [m]).forEach((W) => w(W)), $();
|
|
418
|
+
} else
|
|
419
|
+
w(m), $();
|
|
420
|
+
}, J = (m) => (w) => {
|
|
421
|
+
m(w, null), j.current && j.current.focus();
|
|
422
|
+
}, U = e.filter((m) => o.every((w) => !ee(w, m)));
|
|
423
|
+
return /* @__PURE__ */ r(
|
|
424
|
+
ot,
|
|
425
|
+
{
|
|
426
|
+
onChange: re,
|
|
427
|
+
itemToString: N,
|
|
428
|
+
selectedItems: o,
|
|
429
|
+
onStateChange: n,
|
|
430
|
+
options: e,
|
|
431
|
+
existingItemsMap: T,
|
|
432
|
+
handleUnStoredItemCb: Z,
|
|
433
|
+
customizeNewSelectedValue: se,
|
|
434
|
+
children: ({
|
|
435
|
+
getInputProps: m,
|
|
436
|
+
getItemProps: w,
|
|
437
|
+
isOpen: $,
|
|
438
|
+
inputValue: k,
|
|
439
|
+
highlightedIndex: Q,
|
|
440
|
+
removeItem: W,
|
|
441
|
+
editItem: ce,
|
|
442
|
+
openMenu: ve,
|
|
443
|
+
selectItem: de,
|
|
444
|
+
clearSelection: ue,
|
|
445
|
+
storedItemsMap: be,
|
|
446
|
+
getRootProps: ge
|
|
447
|
+
}) => /* @__PURE__ */ F(
|
|
448
|
+
"div",
|
|
449
|
+
{
|
|
450
|
+
...ge(void 0, { suppressRefError: !0 }),
|
|
451
|
+
className: X("autocomplete-wrapper"),
|
|
452
|
+
ref: C.setReference,
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ F(te, { children: [
|
|
455
|
+
/* @__PURE__ */ F(
|
|
456
|
+
"div",
|
|
457
|
+
{
|
|
458
|
+
className: X("autocomplete", q, {
|
|
459
|
+
"mobile-disabled": E,
|
|
460
|
+
error: p,
|
|
461
|
+
touched: u,
|
|
462
|
+
disabled: f
|
|
463
|
+
}),
|
|
464
|
+
children: [
|
|
465
|
+
/* @__PURE__ */ F(
|
|
466
|
+
"div",
|
|
467
|
+
{
|
|
468
|
+
className: X("autocomplete-input", {
|
|
469
|
+
"mobile-disabled": E
|
|
470
|
+
}),
|
|
471
|
+
children: [
|
|
472
|
+
/* @__PURE__ */ r(
|
|
473
|
+
Re,
|
|
474
|
+
{
|
|
475
|
+
items: o,
|
|
476
|
+
onRemoveItem: J(W),
|
|
477
|
+
disabled: f,
|
|
478
|
+
mobileDisabled: E,
|
|
479
|
+
parseValueToString: N,
|
|
480
|
+
getItemValidationErrorType: d,
|
|
481
|
+
renderCustomSelectedItem: oe,
|
|
482
|
+
editItem: ce,
|
|
483
|
+
editable: y,
|
|
484
|
+
getAdditionalCreationCondition: c,
|
|
485
|
+
storedItemsMap: be,
|
|
486
|
+
highlightUnStoredItem: v
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ r(
|
|
490
|
+
"input",
|
|
491
|
+
{
|
|
492
|
+
...m({
|
|
493
|
+
ref: j,
|
|
494
|
+
placeholder: A,
|
|
495
|
+
maxLength: I,
|
|
496
|
+
onFocus: () => {
|
|
497
|
+
ve(), x();
|
|
498
|
+
},
|
|
499
|
+
onKeyDown: (z) => {
|
|
500
|
+
z.key === "Enter" && k && b && c(k) && P({
|
|
501
|
+
inputValue: k,
|
|
502
|
+
selectItem: de,
|
|
503
|
+
clearSelection: ue
|
|
504
|
+
}), H({ event: z, removeItem: W, inputValue: k });
|
|
505
|
+
},
|
|
506
|
+
onBlur: () => {
|
|
507
|
+
g(), k && b && c(k) && P({
|
|
508
|
+
inputValue: k,
|
|
509
|
+
selectItem: de,
|
|
510
|
+
clearSelection: ue
|
|
511
|
+
});
|
|
512
|
+
},
|
|
513
|
+
disabled: f,
|
|
514
|
+
..._
|
|
515
|
+
}),
|
|
516
|
+
className: X("input", { disabled: f }),
|
|
517
|
+
"data-automation-id": O
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
(_ == null ? void 0 : _.clearable) && (o == null ? void 0 : o.length) > 0 && /* @__PURE__ */ r(
|
|
524
|
+
"button",
|
|
525
|
+
{
|
|
526
|
+
className: X("clear-icon", { "clear-icon--disabled": f }),
|
|
527
|
+
onClick: () => {
|
|
528
|
+
var z;
|
|
529
|
+
return !f && ((z = _ == null ? void 0 : _.onClear) == null ? void 0 : z.call(_));
|
|
530
|
+
},
|
|
531
|
+
children: /* @__PURE__ */ r(qe, {})
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
]
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
p && u && /* @__PURE__ */ r("span", { className: X("error-text"), children: p })
|
|
538
|
+
] }),
|
|
539
|
+
/* @__PURE__ */ r(
|
|
540
|
+
he,
|
|
541
|
+
{
|
|
542
|
+
isOpen: $,
|
|
543
|
+
loading: i,
|
|
544
|
+
async: B,
|
|
545
|
+
ref: C.setFloating,
|
|
546
|
+
newItemButtonText: S,
|
|
547
|
+
style: D,
|
|
548
|
+
inputValue: (k || "").trim(),
|
|
549
|
+
getItemProps: G(w, Q, o),
|
|
550
|
+
parseValueToString: N,
|
|
551
|
+
createWithoutConfirmation: l,
|
|
552
|
+
options: U,
|
|
553
|
+
...R
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
]
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
}, dt = "Enter", ut = "Tab", mt = {
|
|
562
|
+
"input-wrapper": "_input-wrapper_14hlh_1"
|
|
563
|
+
}, ft = L.bind(mt), _t = 0, Ot = (s) => {
|
|
564
|
+
const {
|
|
565
|
+
options: e = [],
|
|
566
|
+
value: i,
|
|
567
|
+
placeholder: n = "",
|
|
568
|
+
onChange: o = () => {
|
|
569
|
+
},
|
|
570
|
+
onFocus: a = () => {
|
|
571
|
+
},
|
|
572
|
+
onBlur: p = () => {
|
|
573
|
+
},
|
|
574
|
+
disabled: u = !1,
|
|
575
|
+
inputProps: b = {},
|
|
576
|
+
parseValueToString: y = (S) => S === null ? "" : String(S),
|
|
577
|
+
minLength: h = 1,
|
|
578
|
+
skipOptionCreation: x = !1,
|
|
579
|
+
maxLength: g = null,
|
|
580
|
+
optionVariant: f = "",
|
|
581
|
+
isRequired: E = !1,
|
|
582
|
+
error: _ = "",
|
|
583
|
+
touched: N = !1,
|
|
584
|
+
setTouch: I = () => {
|
|
585
|
+
},
|
|
586
|
+
createWithoutConfirmation: B = !1,
|
|
587
|
+
menuClassName: q = "",
|
|
588
|
+
icon: l,
|
|
589
|
+
isOptionUnique: d,
|
|
590
|
+
refFunction: t,
|
|
591
|
+
stateReducer: c,
|
|
592
|
+
onStateChange: v,
|
|
593
|
+
useFixedPositioning: M,
|
|
594
|
+
newItemButtonText: Z = "",
|
|
595
|
+
...O
|
|
596
|
+
} = s, { refs: T, floatingStyles: se } = _e({
|
|
597
|
+
placement: "bottom-start",
|
|
598
|
+
strategy: M ? "fixed" : "absolute",
|
|
599
|
+
whileElementsMounted: pe
|
|
600
|
+
}), oe = (S, R, C) => ({ item: D, index: A, ...j }) => S({
|
|
601
|
+
item: D,
|
|
602
|
+
index: A,
|
|
603
|
+
isSelected: C !== null && C === D,
|
|
604
|
+
...j,
|
|
605
|
+
isActive: R === A
|
|
606
|
+
}), ne = (S, R) => {
|
|
607
|
+
S.key === ut && (S.preventDefault(), R(e.length));
|
|
608
|
+
};
|
|
609
|
+
return /* @__PURE__ */ r(
|
|
610
|
+
V,
|
|
611
|
+
{
|
|
612
|
+
onChange: o,
|
|
613
|
+
itemToString: y,
|
|
614
|
+
selectedItem: i,
|
|
615
|
+
onStateChange: v,
|
|
616
|
+
defaultHighlightedIndex: _t,
|
|
617
|
+
stateReducer: c,
|
|
618
|
+
children: ({
|
|
619
|
+
getInputProps: S,
|
|
620
|
+
getItemProps: R,
|
|
621
|
+
setHighlightedIndex: C,
|
|
622
|
+
isOpen: D,
|
|
623
|
+
inputValue: A,
|
|
624
|
+
highlightedIndex: j,
|
|
625
|
+
getRootProps: re,
|
|
626
|
+
selectItem: G
|
|
627
|
+
}) => /* @__PURE__ */ r(te, { children: /* @__PURE__ */ F(
|
|
628
|
+
"div",
|
|
629
|
+
{
|
|
630
|
+
className: ft("input-wrapper"),
|
|
631
|
+
...re(void 0, { suppressRefError: !0 }),
|
|
632
|
+
ref: T.setReference,
|
|
633
|
+
children: [
|
|
634
|
+
/* @__PURE__ */ r(
|
|
635
|
+
Be,
|
|
636
|
+
{
|
|
637
|
+
...S({
|
|
638
|
+
placeholder: u ? "" : n,
|
|
639
|
+
maxLength: g || void 0,
|
|
640
|
+
onFocus: () => {
|
|
641
|
+
a();
|
|
642
|
+
},
|
|
643
|
+
refFunction: t,
|
|
644
|
+
onKeyDown: (H) => {
|
|
645
|
+
H.key === dt && H.preventDefault(), A && D && ne(H, C);
|
|
646
|
+
},
|
|
647
|
+
onBlur: (H) => {
|
|
648
|
+
const P = (A ?? "").trim(), J = !!P, U = J ? e.find((m) => y(m) === P) : void 0;
|
|
649
|
+
G(U || (!x && B && J ? P : null)), p(H), d == null || d(
|
|
650
|
+
J ? !e.some((m) => y(m) === P) : null
|
|
651
|
+
), I == null || I(!0);
|
|
652
|
+
},
|
|
653
|
+
disabled: u,
|
|
654
|
+
defaultWidth: !1,
|
|
655
|
+
isRequired: E,
|
|
656
|
+
touched: N,
|
|
657
|
+
error: _,
|
|
658
|
+
endIcon: l,
|
|
659
|
+
...b
|
|
660
|
+
})
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
/* @__PURE__ */ r(
|
|
664
|
+
he,
|
|
665
|
+
{
|
|
666
|
+
isOpen: D,
|
|
667
|
+
style: se,
|
|
668
|
+
ref: T.setFloating,
|
|
669
|
+
minLength: h,
|
|
670
|
+
inputValue: (A || "").trim(),
|
|
671
|
+
getItemProps: oe(R, j, i),
|
|
672
|
+
parseValueToString: y,
|
|
673
|
+
optionVariant: f,
|
|
674
|
+
createWithoutConfirmation: B,
|
|
675
|
+
className: q,
|
|
676
|
+
options: e,
|
|
677
|
+
newItemButtonText: Z,
|
|
678
|
+
...O
|
|
679
|
+
}
|
|
680
|
+
)
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
) })
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
};
|
|
687
|
+
export {
|
|
688
|
+
he as AutocompleteMenu,
|
|
689
|
+
me as AutocompleteOption,
|
|
690
|
+
Qe as AutocompleteOptions,
|
|
691
|
+
He as AutocompletePrompt,
|
|
692
|
+
Mt as MultipleAutocomplete,
|
|
693
|
+
Ot as SingleAutocomplete
|
|
694
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AutocompleteOptionsProps } from '../autocompleteOptions';
|
|
2
|
+
|
|
3
|
+
export declare const AutocompleteMenu: <T>(props: {
|
|
4
|
+
isOpen?: boolean | undefined;
|
|
5
|
+
style?: import('react').CSSProperties | undefined;
|
|
6
|
+
minLength: number | null;
|
|
7
|
+
inputValue?: string | undefined;
|
|
8
|
+
className?: string | undefined;
|
|
9
|
+
} & AutocompleteOptionsProps<T> & import('react').RefAttributes<HTMLUListElement>) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AutocompleteMenu } from './autocompleteMenu';
|