@reportportal/ui-kit 0.0.1-alpha.126 → 0.0.1-alpha.127

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