@reportportal/ui-kit 0.0.1-alpha.226 → 0.0.1-alpha.228

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,197 +1,197 @@
1
- import { jsx as r, jsxs as D, Fragment as he } from "react/jsx-runtime";
2
- import { useState as oe, useRef as Me, useEffect as we, useCallback as Y, forwardRef as Te, useLayoutEffect as je, useMemo as He } from "react";
3
- import { c as Q } from "./bind-06a7ff84.js";
4
- import { Scrollbars as We } from "rc-scrollbars";
5
- import { B as Ye } from "./bubblesLoader-f3ffa240.js";
6
- import { B as Ke } from "./button-7ab874f3.js";
7
- import { S as Xe } from "./plus-199fb2a8.js";
8
- import { i as ze } from "./isEmpty-ccacb5ff.js";
9
- import { createPortal as Ge } from "react-dom";
10
- import pe from "downshift";
11
- import { useFloating as Be, autoUpdate as De, flip as Je, size as Qe } from "@floating-ui/react";
12
- import { F as Ze } from "./fieldText-1749da7a.js";
13
- import { S as Fe } from "./dropdown-0260bb66.js";
14
- import { E as Oe, A as qe, T as Ue } from "./constants-85822a6b.js";
15
- import { S as Ve } from "./close-4d480ef7.js";
16
- import { S as et } from "./clear-53660571.js";
1
+ import { jsx as r, jsxs as B, Fragment as fe } from "react/jsx-runtime";
2
+ import { useState as oe, useRef as ke, useEffect as pe, useCallback as H, forwardRef as je, useLayoutEffect as He, useMemo as We } from "react";
3
+ import { c as J } from "./bind-06a7ff84.js";
4
+ import { Scrollbars as Ye } from "rc-scrollbars";
5
+ import { B as Ke } from "./bubblesLoader-f3ffa240.js";
6
+ import { B as Xe } from "./button-7ab874f3.js";
7
+ import { S as Ge } from "./plus-199fb2a8.js";
8
+ import { i as Ce } from "./isEmpty-ccacb5ff.js";
9
+ import { createPortal as Je } from "react-dom";
10
+ import ue from "downshift";
11
+ import { useFloating as De, autoUpdate as Fe, flip as Qe, size as Ze } from "@floating-ui/react";
12
+ import { F as qe } from "./fieldText-1749da7a.js";
13
+ import { S as Oe } from "./dropdown-0260bb66.js";
14
+ import { E as $e, A as Ue, T as Ve } from "./constants-85822a6b.js";
15
+ import { S as et } from "./close-4d480ef7.js";
16
+ import { S as tt } from "./clear-53660571.js";
17
17
  import "./openEye-950159cb.js";
18
18
  import "./baseIconButton-251479f7.js";
19
19
  import "./spinLoader-c4a53718.js";
20
20
  import "./maxValueDisplay-9be01a75.js";
21
21
  import "./fieldLabel.js";
22
- const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
22
+ const ot = "_disabled_1rpph_43", st = "_input_1rpph_107", nt = {
23
23
  "selected-item": "_selected-item_1rpph_16",
24
24
  "validation-error": "_validation-error_1rpph_35",
25
25
  "highlight-un-stored-item": "_highlight-un-stored-item_1rpph_40",
26
- disabled: tt,
26
+ disabled: ot,
27
27
  "mobile-disabled": "_mobile-disabled_1rpph_48",
28
28
  "selected-item-text": "_selected-item-text_1rpph_54",
29
29
  "single-line": "_single-line_1rpph_58",
30
30
  "cross-icon": "_cross-icon_1rpph_64",
31
- input: ot
32
- }, me = Q.bind(st), nt = (t) => t.scrollWidth > t.clientWidth, rt = ({
31
+ input: st
32
+ }, ae = J.bind(nt), rt = (t) => t.scrollWidth > t.clientWidth, lt = ({
33
33
  item: t,
34
34
  onRemoveItem: e,
35
35
  disabled: n = !1,
36
36
  mobileDisabled: o = !1,
37
37
  parseValueToString: s,
38
38
  error: l = !1,
39
- editItem: h,
39
+ editItem: w,
40
40
  editable: u = !1,
41
- getAdditionalCreationCondition: v = () => !0,
42
- storedOption: g = !0,
43
- highlightUnStoredItem: p = !1,
44
- variant: z = "light",
45
- getItemName: k,
46
- singleLine: m = !1,
47
- className: L,
48
- textClassName: P
41
+ getAdditionalCreationCondition: b = () => !0,
42
+ storedOption: N = !0,
43
+ highlightUnStoredItem: _ = !1,
44
+ variant: M = "light",
45
+ getItemName: I,
46
+ singleLine: f = !1,
47
+ className: R,
48
+ textClassName: L
49
49
  }) => {
50
- const [b, x] = oe(!1), [A, F] = oe(""), [c, i] = oe(!1), a = Me(null), d = () => {
51
- !n && u && !g && (F((k == null ? void 0 : k(t)) || (s == null ? void 0 : s(t)) || ""), x(!0));
52
- }, y = (B) => {
53
- F(B.target.value);
54
- }, C = (B) => {
55
- const j = v(A);
56
- B.key === "Enter" && j && (h(t, A), x(!1), F(""));
57
- }, _ = () => {
58
- x(!1), F("");
59
- }, N = (B) => {
60
- B.stopPropagation(), e(t);
61
- }, R = (s == null ? void 0 : s(t)) || "";
62
- we(() => {
63
- if (a.current && m) {
64
- const B = () => {
65
- a.current && i(nt(a.current));
50
+ const [y, E] = oe(!1), [z, D] = oe(""), [i, a] = oe(!1), d = ke(null), c = () => {
51
+ !n && u && !N && (D((I == null ? void 0 : I(t)) || (s == null ? void 0 : s(t)) || ""), E(!0));
52
+ }, g = (P) => {
53
+ D(P.target.value);
54
+ }, k = (P) => {
55
+ const $ = b(z);
56
+ P.key === "Enter" && $ && (w(t, z), E(!1), D(""));
57
+ }, h = () => {
58
+ E(!1), D("");
59
+ }, S = (P) => {
60
+ P.stopPropagation(), e(t);
61
+ }, A = (s == null ? void 0 : s(t)) || "";
62
+ pe(() => {
63
+ if (d.current && f) {
64
+ const P = () => {
65
+ d.current && a(rt(d.current));
66
66
  };
67
- if (B(), typeof ResizeObserver < "u") {
68
- const j = new ResizeObserver(B);
69
- return j.observe(a.current), () => j.disconnect();
67
+ if (P(), typeof ResizeObserver < "u") {
68
+ const $ = new ResizeObserver(P);
69
+ return $.observe(d.current), () => $.disconnect();
70
70
  }
71
71
  } else
72
- i(!1);
73
- }, [R, m]);
74
- const ee = me(
72
+ a(!1);
73
+ }, [A, f]);
74
+ const V = ae(
75
75
  "selected-item-text",
76
76
  {
77
- "single-line": m
77
+ "single-line": f
78
78
  },
79
- P
80
- ), $ = me(
79
+ L
80
+ ), O = ae(
81
81
  "selected-item",
82
- z,
82
+ M,
83
83
  {
84
84
  [`validation-${l}`]: l,
85
85
  disabled: n,
86
86
  "mobile-disabled": o,
87
- "highlight-un-stored-item": p && !g
87
+ "highlight-un-stored-item": _ && !N
88
88
  },
89
- L
89
+ R
90
90
  );
91
- return b ? /* @__PURE__ */ r(
91
+ return y ? /* @__PURE__ */ r(
92
92
  "input",
93
93
  {
94
94
  autoFocus: !0,
95
- value: A,
96
- onChange: y,
97
- onKeyDown: C,
98
- onBlur: _,
99
- className: me("input")
95
+ value: z,
96
+ onChange: g,
97
+ onKeyDown: k,
98
+ onBlur: h,
99
+ className: ae("input")
100
100
  }
101
- ) : /* @__PURE__ */ D("div", { className: $, onClick: d, children: [
101
+ ) : /* @__PURE__ */ B("div", { className: O, onClick: c, children: [
102
102
  /* @__PURE__ */ r(
103
103
  "span",
104
104
  {
105
- ref: a,
106
- className: ee,
107
- title: m && c ? R : void 0,
108
- children: R
105
+ ref: d,
106
+ className: V,
107
+ title: f && i ? A : void 0,
108
+ children: A
109
109
  }
110
110
  ),
111
111
  !n && /* @__PURE__ */ r(
112
112
  "button",
113
113
  {
114
114
  type: "button",
115
- className: me("cross-icon", {
115
+ className: ae("cross-icon", {
116
116
  [`validation-${l}`]: l,
117
117
  "mobile-disabled": o,
118
118
  disabled: n
119
119
  }),
120
- onClick: N,
121
- children: /* @__PURE__ */ r(Ve, {})
120
+ onClick: S,
121
+ children: /* @__PURE__ */ r(et, {})
122
122
  }
123
123
  )
124
124
  ] });
125
- }, lt = ({
125
+ }, ct = ({
126
126
  items: t = [],
127
127
  parseValueToString: e,
128
128
  getItemValidationErrorType: n,
129
129
  storedItemsMap: o = {},
130
130
  highlightUnStoredItem: s = !1,
131
131
  renderCustomSelectedItem: l,
132
- selectedItemSingleLine: h,
132
+ selectedItemSingleLine: w,
133
133
  selectedItemClassName: u,
134
- selectedItemTextClassName: v,
135
- ...g
136
- }) => t.map((p) => l ? l(p) : /* @__PURE__ */ r(
137
- rt,
134
+ selectedItemTextClassName: b,
135
+ ...N
136
+ }) => t.map((_) => l ? l(_) : /* @__PURE__ */ r(
137
+ lt,
138
138
  {
139
139
  parseValueToString: e,
140
- error: (n == null ? void 0 : n(p)) || "",
141
- item: p,
142
- storedOption: !!o[e(p)],
140
+ error: (n == null ? void 0 : n(_)) || "",
141
+ item: _,
142
+ storedOption: !!o[e(_)],
143
143
  highlightUnStoredItem: s,
144
- singleLine: h,
144
+ singleLine: w,
145
145
  className: u,
146
- textClassName: v,
147
- ...g
146
+ textClassName: b,
147
+ ...N
148
148
  },
149
- e == null ? void 0 : e(p)
150
- )), ct = "_prompt_1xfmd_16", it = {
151
- prompt: ct
152
- }, at = Q.bind(it), dt = ({ children: t = null }) => /* @__PURE__ */ r("div", { className: at("prompt"), children: t }), ut = "_item_zw4ux_16", mt = "_divider_zw4ux_24", ft = "_active_zw4ux_49", pt = "_value_zw4ux_55", _t = "_tag_zw4ux_69", ht = "_disabled_zw4ux_80", wt = {
153
- item: ut,
154
- divider: mt,
149
+ e == null ? void 0 : e(_)
150
+ )), it = "_prompt_1xfmd_16", at = {
151
+ prompt: it
152
+ }, dt = J.bind(at), ut = ({ children: t = null }) => /* @__PURE__ */ r("div", { className: dt("prompt"), children: t }), mt = "_item_zw4ux_16", ft = "_divider_zw4ux_24", pt = "_active_zw4ux_49", _t = "_value_zw4ux_55", ht = "_tag_zw4ux_69", wt = "_disabled_zw4ux_80", vt = {
153
+ item: mt,
154
+ divider: ft,
155
155
  "new-item": "_new-item_zw4ux_31",
156
- active: ft,
157
- value: pt,
156
+ active: pt,
157
+ value: _t,
158
158
  "key-variant": "_key-variant_zw4ux_66",
159
- tag: _t,
159
+ tag: ht,
160
160
  "button-active": "_button-active_zw4ux_80",
161
- disabled: ht,
161
+ disabled: wt,
162
162
  "value-variant": "_value-variant_zw4ux_100"
163
- }, V = Q.bind(wt), Re = ({
163
+ }, U = J.bind(vt), Le = ({
164
164
  isActive: t = !1,
165
165
  isSelected: e = !1,
166
166
  isNew: n = !1,
167
167
  children: o = null,
168
168
  disabled: s = !1,
169
169
  optionVariant: l = "",
170
- newItemButtonText: h = "",
170
+ newItemButtonText: w = "",
171
171
  ...u
172
172
  }) => {
173
- const v = () => h || (l === "key-variant" ? "New key" : "New value");
174
- return n ? /* @__PURE__ */ D(he, { children: [
175
- /* @__PURE__ */ r("div", { className: V("divider") }),
176
- /* @__PURE__ */ D(
173
+ const b = () => w || (l === "key-variant" ? "New key" : "New value");
174
+ return n ? /* @__PURE__ */ B(fe, { children: [
175
+ /* @__PURE__ */ r("div", { className: U("divider") }),
176
+ /* @__PURE__ */ B(
177
177
  "li",
178
178
  {
179
- className: V("new-item", l, {
179
+ className: U("new-item", l, {
180
180
  active: t,
181
181
  selected: e,
182
182
  disabled: s
183
183
  }),
184
184
  ...u,
185
185
  children: [
186
- /* @__PURE__ */ r("span", { className: V("value"), children: o }),
186
+ /* @__PURE__ */ r("span", { className: U("value"), children: o }),
187
187
  /* @__PURE__ */ r(
188
- Ke,
188
+ Xe,
189
189
  {
190
190
  ...!s && u,
191
- className: V({ "button-active": t }),
192
- icon: /* @__PURE__ */ r(Xe, {}),
191
+ className: U({ "button-active": t }),
192
+ icon: /* @__PURE__ */ r(Ge, {}),
193
193
  variant: "text",
194
- children: v()
194
+ children: b()
195
195
  }
196
196
  )
197
197
  ]
@@ -200,94 +200,94 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
200
200
  ] }) : /* @__PURE__ */ r(
201
201
  "li",
202
202
  {
203
- className: V("item", l, {
203
+ className: U("item", l, {
204
204
  active: t,
205
205
  selected: e,
206
206
  disabled: s
207
207
  }),
208
208
  ...s ? {} : u,
209
- children: /* @__PURE__ */ r("span", { className: V("label", "tag"), children: o })
209
+ children: /* @__PURE__ */ r("span", { className: U("label", "tag"), children: o })
210
210
  }
211
211
  );
212
- }, vt = "_container_12uzd_16", bt = {
213
- container: vt,
212
+ }, bt = "_container_12uzd_16", yt = {
213
+ container: bt,
214
214
  "empty-list-message": "_empty-list-message_12uzd_20",
215
215
  "limitation-item": "_limitation-item_12uzd_28"
216
- }, fe = Q.bind(bt), yt = (t) => {
216
+ }, de = J.bind(yt), gt = (t) => {
217
217
  const {
218
218
  options: e,
219
219
  async: n,
220
220
  inputValue: o,
221
221
  loading: s,
222
222
  createWithoutConfirmation: l,
223
- customEmptyListMessage: h,
223
+ customEmptyListMessage: w,
224
224
  customNoMatchesMessage: u,
225
- optionVariant: v,
226
- newItemButtonText: g,
227
- renderOption: p,
228
- getUniqKey: z,
229
- getItemProps: k,
230
- parseValueToString: m,
231
- limitationText: L = "Too many results. Type to search",
232
- optionsLimit: P = 0,
233
- shouldShowEmptyListMessage: b = !0
234
- } = t, x = Y(() => (e || []).filter((_) => m(_).toUpperCase().indexOf((o.toUpperCase() || "").trim()) > -1), [o, e, m]), A = Y(
235
- (_, N, R = !1) => p ? p(_, N, R, k) : /* @__PURE__ */ r(
236
- Re,
225
+ optionVariant: b,
226
+ newItemButtonText: N,
227
+ renderOption: _,
228
+ getUniqKey: M,
229
+ getItemProps: I,
230
+ parseValueToString: f,
231
+ limitationText: R = "Too many results. Type to search",
232
+ optionsLimit: L = 0,
233
+ shouldShowEmptyListMessage: y = !0
234
+ } = t, E = H(() => (e || []).filter((h) => f(h).toUpperCase().indexOf((o.toUpperCase() || "").trim()) > -1), [o, e, f]), z = H(
235
+ (h, S, A = !1) => _ ? _(h, S, A, I) : /* @__PURE__ */ r(
236
+ Le,
237
237
  {
238
- optionVariant: v,
239
- ...k({ item: _, index: N }),
240
- isNew: R,
241
- newItemButtonText: g,
242
- children: m(_)
238
+ optionVariant: b,
239
+ ...I({ item: h, index: S }),
240
+ isNew: A,
241
+ newItemButtonText: N,
242
+ children: f(h)
243
243
  },
244
- (z == null ? void 0 : z(_)) || m(_)
244
+ (M == null ? void 0 : M(h)) || f(h)
245
245
  ),
246
- [k, z, g, v, m, p]
247
- ), F = Y(
248
- (_) => _.length ? _.map((N, R) => A(N, R)) : "",
249
- [A]
250
- ), c = Y(
251
- (_) => {
252
- const N = _.length;
253
- return /* @__PURE__ */ r("div", { className: fe({ container: !N }), children: /* @__PURE__ */ r(
254
- Re,
246
+ [I, M, N, b, f, _]
247
+ ), D = H(
248
+ (h) => h.length ? h.map((S, A) => z(S, A)) : "",
249
+ [z]
250
+ ), i = H(
251
+ (h) => {
252
+ const S = h.length;
253
+ return /* @__PURE__ */ r("div", { className: de({ container: !S }), children: /* @__PURE__ */ r(
254
+ Le,
255
255
  {
256
- optionVariant: v,
256
+ optionVariant: b,
257
257
  isNew: !0,
258
- newItemButtonText: g,
259
- ...k({ item: o, index: N }),
260
- children: m(o)
258
+ newItemButtonText: N,
259
+ ...I({ item: o, index: S }),
260
+ children: f(o)
261
261
  },
262
- m(o)
262
+ f(o)
263
263
  ) });
264
264
  },
265
- [k, o, g, v, m]
266
- ), i = Y(
267
- (_) => s ? /* @__PURE__ */ D(he, { children: [
268
- /* @__PURE__ */ r(dt, { children: /* @__PURE__ */ r(Ye, {}) }),
269
- !l && c(_)
265
+ [I, o, N, b, f]
266
+ ), a = H(
267
+ (h) => s ? /* @__PURE__ */ B(fe, { children: [
268
+ /* @__PURE__ */ r(ut, { children: /* @__PURE__ */ r(Ke, {}) }),
269
+ !l && i(h)
270
270
  ] }) : "",
271
- [l, s, c]
272
- ), a = Y(() => {
273
- const _ = (e == null ? void 0 : e.length) === 0 ? h || "No available options" : u || "No matches found";
274
- return /* @__PURE__ */ r("div", { className: fe("empty-list-message"), children: _ });
275
- }, [h, u, e == null ? void 0 : e.length]), d = n ? e : x(), y = i(e);
276
- if (y)
277
- return y;
278
- const C = ze(d);
279
- return C && !b && l ? null : /* @__PURE__ */ D("div", { className: fe({ container: e.length }), children: [
280
- /* @__PURE__ */ D(We, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: [
281
- C ? b && a() : F(d),
282
- (d == null ? void 0 : d.length) > P && P > 0 && L ? /* @__PURE__ */ r("li", { className: fe("limitation-item"), "aria-hidden": "true", children: L }) : null
271
+ [l, s, i]
272
+ ), d = H(() => {
273
+ const h = (e == null ? void 0 : e.length) === 0 ? w || "No available options" : u || "No matches found";
274
+ return /* @__PURE__ */ r("div", { className: de("empty-list-message"), children: h });
275
+ }, [w, u, e == null ? void 0 : e.length]), c = n ? e : E(), g = a(e);
276
+ if (g)
277
+ return g;
278
+ const k = Ce(c);
279
+ return k && !y && l ? null : /* @__PURE__ */ B("div", { className: de({ container: e.length }), children: [
280
+ /* @__PURE__ */ B(Ye, { autoHeight: !0, autoHeightMax: 216, hideTracksWhenNotNeeded: !0, children: [
281
+ k ? y && d() : D(c),
282
+ (c == null ? void 0 : c.length) > L && L > 0 && R ? /* @__PURE__ */ r("li", { className: de("limitation-item"), "aria-hidden": "true", children: R }) : null
283
283
  ] }),
284
- !l && c(d)
284
+ !l && i(c)
285
285
  ] });
286
- }, gt = "_menu_f64z5_16", xt = "_opened_f64z5_34", Nt = "_dark_f64z5_37", Et = {
287
- menu: gt,
288
- opened: xt,
289
- dark: Nt
290
- }, St = Q.bind(Et), It = (t, e) => !t || t <= e.trim().length, $e = Te(
286
+ }, xt = "_menu_f64z5_16", Nt = "_opened_f64z5_34", Et = "_dark_f64z5_37", St = {
287
+ menu: xt,
288
+ opened: Nt,
289
+ dark: Et
290
+ }, It = J.bind(St), kt = (t, e) => !t || t <= e.trim().length, Te = je(
291
291
  ({
292
292
  isOpen: t = !1,
293
293
  style: e = {},
@@ -295,115 +295,115 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
295
295
  isDropdownMode: o,
296
296
  inputValue: s = "",
297
297
  className: l = "",
298
- portalMenuAttribute: h = null,
298
+ portalMenuAttribute: w = null,
299
299
  ...u
300
- }, v) => /* @__PURE__ */ r(
300
+ }, b) => /* @__PURE__ */ r(
301
301
  "ul",
302
302
  {
303
- ref: v,
304
- className: St(
303
+ ref: b,
304
+ className: It(
305
305
  "menu",
306
- { opened: t && (o || It(n, s)) },
306
+ { opened: t && (o || kt(n, s)) },
307
307
  l
308
308
  ),
309
309
  style: e,
310
- ...h ? { [h]: "" } : {},
311
- children: /* @__PURE__ */ r(yt, { inputValue: s, ...u })
310
+ ...w ? { [w]: "" } : {},
311
+ children: /* @__PURE__ */ r(gt, { inputValue: s, ...u })
312
312
  }
313
313
  )
314
- ), Le = (t, e) => typeof t == "string" ? t : e ? String(t[e(t)]) : "", _e = (t, e) => {
314
+ ), Pe = (t, e) => typeof t == "string" ? t : e ? String(t[e(t)]) : "", me = (t, e) => {
315
315
  var o;
316
- return t === e ? !0 : !!(t && e && typeof t == "object" && typeof e == "object" && Object.keys(t).length === Object.keys(e).length && ((o = Object.entries(t)) != null && o.every(([s, l]) => _e(l, e[s]))));
317
- }, kt = (t, e, n) => typeof t == "string" ? t === e : n ? (() => {
316
+ return t === e ? !0 : !!(t && e && typeof t == "object" && typeof e == "object" && Object.keys(t).length === Object.keys(e).length && ((o = Object.entries(t)) != null && o.every(([s, l]) => me(l, e[s]))));
317
+ }, Ct = (t, e, n) => typeof t == "string" ? t === e : n ? (() => {
318
318
  const o = n(t);
319
319
  return t[o] === e[o];
320
- })() : !1, Ct = ({
320
+ })() : !1, Mt = ({
321
321
  options: t = [],
322
322
  onChange: e,
323
323
  selectedItems: n = [],
324
324
  handleUnStoredItemCb: o = null,
325
325
  existingItemsMap: s = {},
326
326
  children: l,
327
- customizeNewSelectedValue: h = (p) => p,
327
+ customizeNewSelectedValue: w = (_) => _,
328
328
  getOptionUniqKey: u,
329
- getOptionUniqKeyValue: v,
330
- ...g
329
+ getOptionUniqKeyValue: b,
330
+ ...N
331
331
  }) => {
332
- const [p, z] = oe(s), k = (c, i) => {
333
- const a = {
334
- ...p
332
+ const [_, M] = oe(s), I = (i, a) => {
333
+ const d = {
334
+ ..._
335
335
  };
336
- c.forEach((d) => {
337
- if (t.find((y) => kt(y, d, u))) {
338
- const y = Le(d, u);
339
- a[y] = !0;
336
+ i.forEach((c) => {
337
+ if (t.find((g) => Ct(g, c, u))) {
338
+ const g = Pe(c, u);
339
+ d[g] = !0;
340
340
  }
341
- }), z(a), i(a);
342
- }, m = (c, i) => {
343
- const a = Le(c, u);
344
- if (a in p) {
345
- const d = { ...p };
346
- delete d[a], z(d), i(d);
341
+ }), M(d), a(d);
342
+ }, f = (i, a) => {
343
+ const d = Pe(i, u);
344
+ if (d in _) {
345
+ const c = { ..._ };
346
+ delete c[d], M(c), a(c);
347
347
  } else
348
- i(p);
349
- }, L = (c, i) => {
350
- const a = h(c), d = Array.isArray(a) ? a : [a], C = [...n.filter((N) => d.indexOf(N) < 0), ...d];
351
- e == null || e(C, i), k(d, (N) => o == null ? void 0 : o(C, N));
352
- }, P = (c, i) => {
353
- const a = n.indexOf(c), d = [...n];
354
- d.splice(a, 1, i), e == null || e(d, null);
355
- }, b = (c, i) => {
356
- const a = n.filter((y) => !_e(y, c));
357
- e == null || e(a, i), m(c, (y) => o == null ? void 0 : o(a, y));
358
- }, x = (c, i) => {
359
- c && L(c, i);
360
- }, A = (c) => ({
361
- removeItem: b,
362
- editItem: P,
348
+ a(_);
349
+ }, R = (i, a) => {
350
+ const d = w(i), c = Array.isArray(d) ? d : [d], k = [...n.filter((S) => c.indexOf(S) < 0), ...c];
351
+ e == null || e(k, a), I(c, (S) => o == null ? void 0 : o(k, S));
352
+ }, L = (i, a) => {
353
+ const d = n.indexOf(i), c = [...n];
354
+ c.splice(d, 1, a), e == null || e(c, null);
355
+ }, y = (i, a) => {
356
+ const d = n.filter((g) => !me(g, i));
357
+ e == null || e(d, a), f(i, (g) => o == null ? void 0 : o(d, g));
358
+ }, E = (i, a) => {
359
+ i && R(i, a);
360
+ }, z = (i) => ({
361
+ removeItem: y,
362
+ editItem: L,
363
363
  handleChange: e,
364
- getOptionUniqKeyValue: v,
365
- storedItemsMap: p,
366
- ...c
364
+ getOptionUniqKeyValue: b,
365
+ storedItemsMap: _,
366
+ ...i
367
367
  });
368
368
  return /* @__PURE__ */ r(
369
- pe,
369
+ ue,
370
370
  {
371
- ...g,
372
- stateReducer: (c, i) => {
373
- switch (i.type) {
374
- case pe.stateChangeTypes.keyDownEnter:
375
- case pe.stateChangeTypes.clickItem:
371
+ ...N,
372
+ stateReducer: (i, a) => {
373
+ switch (a.type) {
374
+ case ue.stateChangeTypes.keyDownEnter:
375
+ case ue.stateChangeTypes.clickItem:
376
376
  return {
377
- ...i,
378
- highlightedIndex: c.highlightedIndex,
377
+ ...a,
378
+ highlightedIndex: i.highlightedIndex,
379
379
  inputValue: ""
380
380
  };
381
381
  default:
382
- return i;
382
+ return a;
383
383
  }
384
384
  },
385
- onChange: x,
385
+ onChange: E,
386
386
  selectedItem: null,
387
- children: (c) => l == null ? void 0 : l(A(c))
387
+ children: (i) => l == null ? void 0 : l(z(i))
388
388
  }
389
389
  );
390
- }, Mt = "_autocomplete_1so4a_16", zt = "_disabled_1so4a_32", At = "_error_1so4a_35", Rt = "_touched_1so4a_35", Lt = "_input_1so4a_77", Pt = {
391
- autocomplete: Mt,
390
+ }, zt = "_autocomplete_1so4a_16", At = "_disabled_1so4a_32", Rt = "_error_1so4a_35", Lt = "_touched_1so4a_35", Pt = "_input_1so4a_77", Bt = {
391
+ autocomplete: zt,
392
392
  "autocomplete-wrapper": "_autocomplete-wrapper_1so4a_28",
393
- disabled: zt,
394
- error: At,
395
- touched: Rt,
393
+ disabled: At,
394
+ error: Rt,
395
+ touched: Lt,
396
396
  "clear-icon": "_clear-icon_1so4a_46",
397
397
  "clear-icon--disabled": "_clear-icon--disabled_1so4a_56",
398
398
  "autocomplete-input": "_autocomplete-input_1so4a_60",
399
399
  "single-line-mode": "_single-line-mode_1so4a_68",
400
400
  "mobile-disabled": "_mobile-disabled_1so4a_72",
401
- input: Lt,
401
+ input: Pt,
402
402
  "type-number": "_type-number_1so4a_101",
403
403
  "error-text": "_error-text_1so4a_112",
404
404
  "dropdown-button": "_dropdown-button_1so4a_121",
405
405
  "icon-reversed": "_icon-reversed_1so4a_129"
406
- }, J = Q.bind(Pt), ao = (t) => {
406
+ }, G = J.bind(Bt), uo = (t) => {
407
407
  const {
408
408
  options: e = [],
409
409
  loading: n = !1,
@@ -411,143 +411,141 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
411
411
  },
412
412
  value: s = [],
413
413
  placeholder: l = "",
414
- error: h = "",
414
+ error: w = "",
415
415
  touched: u = !1,
416
- creatable: v = !1,
417
- editable: g = !1,
418
- onChange: p = () => {
416
+ creatable: b = !1,
417
+ editable: N = !1,
418
+ onChange: _ = () => {
419
419
  },
420
- onFocus: z = () => {
420
+ onFocus: M = () => {
421
421
  },
422
- onBlur: k = () => {
422
+ onBlur: I = () => {
423
423
  },
424
- disabled: m = !1,
425
- isDropdownMode: L = !1,
426
- mobileDisabled: P = !1,
427
- inputProps: b = {},
428
- parseValueToString: x = (f) => f == null ? "" : String(f),
429
- maxLength: A = null,
430
- async: F = !1,
431
- customClass: c = "",
432
- createWithoutConfirmation: i = !1,
433
- getItemValidationErrorType: a = null,
434
- clearItemsError: d = () => {
424
+ disabled: f = !1,
425
+ isDropdownMode: R = !1,
426
+ mobileDisabled: L = !1,
427
+ inputProps: y = {},
428
+ parseValueToString: E = (m) => m == null ? "" : String(m),
429
+ maxLength: z = null,
430
+ async: D = !1,
431
+ customClass: i = "",
432
+ createWithoutConfirmation: a = !1,
433
+ getItemValidationErrorType: d = null,
434
+ clearItemsError: c = () => {
435
435
  },
436
- getAdditionalCreationCondition: y = () => !0,
437
- highlightUnStoredItem: C = !1,
438
- parseInputValueFn: _ = null,
439
- handleUnStoredItemCb: N = null,
440
- dataAutomationId: R = "",
441
- existingItemsMap: ee = {},
442
- customizeNewSelectedValue: $ = (f) => f,
443
- renderCustomSelectedItem: B,
444
- useFixedPositioning: j,
445
- newItemButtonText: ve = "",
446
- menuClassName: K = "",
436
+ getAdditionalCreationCondition: g = () => !0,
437
+ highlightUnStoredItem: k = !1,
438
+ parseInputValueFn: h = null,
439
+ handleUnStoredItemCb: S = null,
440
+ dataAutomationId: A = "",
441
+ existingItemsMap: V = {},
442
+ customizeNewSelectedValue: O = (m) => m,
443
+ renderCustomSelectedItem: P,
444
+ useFixedPositioning: $,
445
+ newItemButtonText: _e = "",
446
+ menuClassName: Y = "",
447
447
  selectedItemSingleLine: se,
448
448
  selectedItemClassName: ne,
449
449
  selectedItemTextClassName: re,
450
- ...be
451
- } = t, { refs: le, floatingStyles: Z } = Be({
450
+ ...he
451
+ } = t, { refs: le, floatingStyles: K } = De({
452
452
  placement: "bottom-start",
453
- strategy: j ? "fixed" : "absolute",
454
- whileElementsMounted: De
455
- }), ye = s.length === 0 && !m ? l : "", te = Me(null);
456
- we(() => {
457
- d();
458
- }, [d, s]);
459
- const ge = (f, E) => {
460
- p(f, E);
461
- }, xe = (f, E, I) => ({ item: S, index: G, ...H }) => f({
462
- item: S,
463
- index: G,
464
- isSelected: I.some((W) => _e(W, S)),
465
- ...H,
466
- isActive: E === G
467
- }), w = ({
468
- event: f,
469
- removeItem: E,
470
- inputValue: I
453
+ strategy: $ ? "fixed" : "absolute",
454
+ whileElementsMounted: Fe
455
+ }), we = s.length === 0 && !f ? l : "", ee = ke(null);
456
+ pe(() => {
457
+ c();
458
+ }, [c, s]);
459
+ const ve = (m, x) => {
460
+ _(m, x);
461
+ }, be = (m, x, C) => ({ item: v, index: j, ...W }) => m({
462
+ item: v,
463
+ index: j,
464
+ isSelected: C.some((te) => me(te, v)),
465
+ ...W,
466
+ isActive: x === j
467
+ }), ye = ({
468
+ event: m,
469
+ removeItem: x,
470
+ inputValue: C
471
471
  }) => {
472
- f.key === "Backspace" && !I && s.length && E(s[s.length - 1], null);
473
- }, T = ({
474
- inputValue: f,
475
- selectItem: E,
476
- clearSelection: I
472
+ m.key === "Backspace" && !C && s.length && x(s[s.length - 1], null);
473
+ }, p = ({
474
+ inputValue: m,
475
+ selectItem: x,
476
+ clearSelection: C
477
477
  }) => {
478
- if (_) {
479
- const S = _(f);
480
- (S.length ? S : [f]).forEach((H) => E(H)), I();
478
+ if (h) {
479
+ const v = h(m);
480
+ (v.length ? v : [m]).forEach((W) => x(W)), C();
481
481
  } else
482
- E(f), I();
483
- }, q = (f) => (E) => {
484
- f(E, null), te.current && te.current.focus();
485
- }, X = e.filter((f) => s.every((E) => !_e(E, f)));
482
+ x(m), C();
483
+ }, T = (m) => (x) => {
484
+ m(x, null), ee.current && ee.current.focus();
485
+ }, Q = e.filter((m) => s.every((x) => !me(x, m)));
486
486
  return /* @__PURE__ */ r(
487
- Ct,
487
+ Mt,
488
488
  {
489
- onChange: ge,
490
- itemToString: x,
489
+ onChange: ve,
490
+ itemToString: E,
491
491
  selectedItems: s,
492
492
  onStateChange: o,
493
493
  options: e,
494
- existingItemsMap: ee,
495
- handleUnStoredItemCb: N,
496
- customizeNewSelectedValue: $,
494
+ existingItemsMap: V,
495
+ handleUnStoredItemCb: S,
496
+ customizeNewSelectedValue: O,
497
497
  children: ({
498
- getInputProps: f,
499
- getItemProps: E,
500
- isOpen: I,
501
- inputValue: S = "",
502
- highlightedIndex: G,
503
- removeItem: H,
504
- editItem: W,
505
- openMenu: ce,
506
- selectItem: ie,
507
- clearSelection: ae,
508
- toggleMenu: U,
509
- storedItemsMap: Ne,
510
- getRootProps: Ee
498
+ getInputProps: m,
499
+ getItemProps: x,
500
+ isOpen: C,
501
+ inputValue: v = "",
502
+ highlightedIndex: j,
503
+ removeItem: W,
504
+ editItem: te,
505
+ openMenu: Z,
506
+ selectItem: ge,
507
+ clearSelection: ce,
508
+ toggleMenu: xe,
509
+ storedItemsMap: q,
510
+ getRootProps: Ne
511
511
  }) => {
512
- const Se = Ee(void 0, { suppressRefError: !0 }), de = {
513
- ...Se,
514
- ref: (M) => (le.setReference(M), Se.ref(M))
515
- }, Ie = S ?? "";
516
- return /* @__PURE__ */ D("div", { ...de, className: J("autocomplete-wrapper"), children: [
517
- /* @__PURE__ */ D(he, { children: [
518
- /* @__PURE__ */ D(
512
+ const Ee = Ne(void 0, { suppressRefError: !0 }), Me = v ?? "";
513
+ return /* @__PURE__ */ B("div", { ...Ee, className: G("autocomplete-wrapper"), children: [
514
+ /* @__PURE__ */ B(fe, { children: [
515
+ /* @__PURE__ */ B(
519
516
  "div",
520
517
  {
521
- className: J("autocomplete", c, {
522
- "mobile-disabled": P,
523
- error: h,
518
+ ref: le.setReference,
519
+ className: G("autocomplete", i, {
520
+ "mobile-disabled": L,
521
+ error: w,
524
522
  touched: u,
525
- disabled: m
523
+ disabled: f
526
524
  }),
527
525
  children: [
528
- /* @__PURE__ */ D(
526
+ /* @__PURE__ */ B(
529
527
  "div",
530
528
  {
531
- className: J("autocomplete-input", {
532
- "mobile-disabled": P,
529
+ className: G("autocomplete-input", {
530
+ "mobile-disabled": L,
533
531
  "single-line-mode": se
534
532
  }),
535
533
  children: [
536
534
  /* @__PURE__ */ r(
537
- lt,
535
+ ct,
538
536
  {
539
537
  items: s,
540
- onRemoveItem: q(H),
541
- disabled: m,
542
- mobileDisabled: P,
543
- parseValueToString: x,
544
- getItemValidationErrorType: a,
545
- renderCustomSelectedItem: B,
546
- editItem: W,
547
- editable: g,
548
- getAdditionalCreationCondition: y,
549
- storedItemsMap: Ne,
550
- highlightUnStoredItem: C,
538
+ onRemoveItem: T(W),
539
+ disabled: f,
540
+ mobileDisabled: L,
541
+ parseValueToString: E,
542
+ getItemValidationErrorType: d,
543
+ renderCustomSelectedItem: P,
544
+ editItem: te,
545
+ editable: N,
546
+ getAdditionalCreationCondition: g,
547
+ storedItemsMap: q,
548
+ highlightUnStoredItem: k,
551
549
  selectedItemSingleLine: se,
552
550
  selectedItemClassName: ne,
553
551
  selectedItemTextClassName: re
@@ -556,91 +554,91 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
556
554
  /* @__PURE__ */ r(
557
555
  "input",
558
556
  {
559
- ...f({
560
- ref: te,
561
- placeholder: ye,
562
- maxLength: A,
557
+ ...m({
558
+ ref: ee,
559
+ placeholder: we,
560
+ maxLength: z,
563
561
  onFocus: () => {
564
- L && ce(), z();
562
+ R && Z(), M();
565
563
  },
566
- onKeyDown: (M) => {
567
- M.key === Oe && S && v && y(S) && T({
568
- inputValue: S,
569
- selectItem: ie,
570
- clearSelection: ae
571
- }), w({ event: M, removeItem: H, inputValue: S });
564
+ onKeyDown: (F) => {
565
+ F.key === $e && v && b && g(v) && p({
566
+ inputValue: v,
567
+ selectItem: ge,
568
+ clearSelection: ce
569
+ }), ye({ event: F, removeItem: W, inputValue: v });
572
570
  },
573
571
  onBlur: () => {
574
- k(), S && v && y(S) && T({
575
- inputValue: S,
576
- selectItem: ie,
577
- clearSelection: ae
572
+ I(), v && b && g(v) && p({
573
+ inputValue: v,
574
+ selectItem: ge,
575
+ clearSelection: ce
578
576
  });
579
577
  },
580
- disabled: m,
581
- ...b
578
+ disabled: f,
579
+ ...y
582
580
  }),
583
- className: J("input", { disabled: m }, b.className),
584
- "data-automation-id": R
581
+ className: G("input", { disabled: f }, y.className),
582
+ "data-automation-id": A
585
583
  }
586
584
  )
587
585
  ]
588
586
  }
589
587
  ),
590
- (b == null ? void 0 : b.clearable) && !ze(s) && /* @__PURE__ */ r(
588
+ (y == null ? void 0 : y.clearable) && !Ce(s) && /* @__PURE__ */ r(
591
589
  "button",
592
590
  {
593
591
  type: "button",
594
- className: J("clear-icon", { "clear-icon--disabled": m }),
592
+ className: G("clear-icon", { "clear-icon--disabled": f }),
595
593
  onClick: () => {
596
- var M;
597
- return !m && ((M = b == null ? void 0 : b.onClear) == null ? void 0 : M.call(b));
594
+ var F;
595
+ return !f && ((F = y == null ? void 0 : y.onClear) == null ? void 0 : F.call(y));
598
596
  },
599
- onMouseDown: (M) => M.preventDefault(),
600
- children: /* @__PURE__ */ r(et, {})
597
+ onMouseDown: (F) => F.preventDefault(),
598
+ children: /* @__PURE__ */ r(tt, {})
601
599
  }
602
600
  ),
603
- L && /* @__PURE__ */ r(
601
+ R && /* @__PURE__ */ r(
604
602
  "button",
605
603
  {
606
604
  type: "button",
607
- className: J("dropdown-button", { "icon-reversed": I }),
608
- onClick: () => U(),
605
+ className: G("dropdown-button", { "icon-reversed": C }),
606
+ onClick: () => xe(),
609
607
  "aria-label": "Toggle dropdown",
610
- "aria-expanded": I,
611
- children: /* @__PURE__ */ r(Fe, {})
608
+ "aria-expanded": C,
609
+ children: /* @__PURE__ */ r(Oe, {})
612
610
  }
613
611
  )
614
612
  ]
615
613
  }
616
614
  ),
617
- h && u && /* @__PURE__ */ r("span", { className: J("error-text"), children: h })
615
+ w && u && /* @__PURE__ */ r("span", { className: G("error-text"), children: w })
618
616
  ] }),
619
617
  /* @__PURE__ */ r(
620
- $e,
618
+ Te,
621
619
  {
622
- isOpen: I,
620
+ isOpen: C,
623
621
  loading: n,
624
- async: F,
622
+ async: D,
625
623
  ref: le.setFloating,
626
- newItemButtonText: ve,
627
- isDropdownMode: L,
628
- style: Z,
629
- inputValue: Ie.trim(),
630
- getItemProps: xe(E, G, s),
631
- parseValueToString: x,
632
- createWithoutConfirmation: i,
633
- options: X,
634
- className: K,
635
- ...be
624
+ newItemButtonText: _e,
625
+ isDropdownMode: R,
626
+ style: K,
627
+ inputValue: Me.trim(),
628
+ getItemProps: be(x, j, s),
629
+ parseValueToString: E,
630
+ createWithoutConfirmation: a,
631
+ options: Q,
632
+ className: Y,
633
+ ...he
636
634
  }
637
635
  )
638
636
  ] });
639
637
  }
640
638
  }
641
639
  );
642
- }, Bt = ({ skip: t }) => {
643
- je(() => {
640
+ }, Dt = ({ skip: t }) => {
641
+ He(() => {
644
642
  if (t)
645
643
  return;
646
644
  let e = window.scrollY, n = !0;
@@ -654,15 +652,15 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
654
652
  e = window.scrollY, window.addEventListener("scroll", l, { passive: !1, capture: !0 }), requestAnimationFrame(() => {
655
653
  e = window.scrollY, s();
656
654
  });
657
- const h = setTimeout(() => {
655
+ const w = setTimeout(() => {
658
656
  n = !1;
659
657
  }, o);
660
658
  return () => {
661
- clearTimeout(h), window.removeEventListener("scroll", l, { capture: !0 });
659
+ clearTimeout(w), window.removeEventListener("scroll", l, { capture: !0 });
662
660
  };
663
661
  }, [t]);
664
- }, Dt = ({ skip: t, reference: e }) => {
665
- we(() => {
662
+ }, Ft = ({ skip: t, reference: e }) => {
663
+ pe(() => {
666
664
  if (t)
667
665
  return;
668
666
  const n = () => {
@@ -673,8 +671,8 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
673
671
  window.removeEventListener("resize", n);
674
672
  };
675
673
  }, [t, e]);
676
- }, Ft = ({ skip: t, onClose: e, menuRef: n }) => {
677
- we(() => {
674
+ }, Ot = ({ skip: t, onClose: e, menuRef: n }) => {
675
+ pe(() => {
678
676
  if (t)
679
677
  return;
680
678
  const o = (s) => {
@@ -685,21 +683,21 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
685
683
  window.removeEventListener("scroll", o, !0);
686
684
  };
687
685
  }, [t, e, n]);
688
- }, Ot = {
686
+ }, $t = {
689
687
  "input-wrapper": "_input-wrapper_d9vma_1",
690
688
  "dropdown-button": "_dropdown-button_d9vma_6",
691
689
  "icon-reversed": "_icon-reversed_d9vma_14"
692
- }, Pe = Q.bind(Ot), $t = 0, Tt = Je({
690
+ }, Be = J.bind($t), Tt = 0, jt = Qe({
693
691
  fallbackPlacements: ["bottom-start", "top-start", "bottom", "top"],
694
692
  boundary: document == null ? void 0 : document.documentElement,
695
693
  rootBoundary: "viewport"
696
- }), jt = Qe({
694
+ }), Ht = Ze({
697
695
  apply({ rects: t, elements: e }) {
698
696
  Object.assign(e.floating.style, {
699
697
  width: `${t.reference.width}px`
700
698
  });
701
699
  }
702
- }), uo = (t) => {
700
+ }), mo = (t) => {
703
701
  const {
704
702
  options: e = [],
705
703
  value: n,
@@ -708,174 +706,184 @@ const tt = "_disabled_1rpph_43", ot = "_input_1rpph_107", st = {
708
706
  },
709
707
  onFocus: l = () => {
710
708
  },
711
- onBlur: h = () => {
709
+ onBlur: w = () => {
712
710
  },
713
711
  disabled: u = !1,
714
- inputProps: v = {},
715
- parseValueToString: g = (w) => w === null ? "" : String(w),
716
- minLength: p = 1,
717
- skipOptionCreation: z = !1,
718
- maxLength: k = null,
719
- optionVariant: m = "",
720
- isRequired: L = !1,
721
- error: P = "",
722
- touched: b = !1,
723
- setTouch: x = () => {
712
+ inputProps: b = {},
713
+ parseValueToString: N = (p) => p === null ? "" : String(p),
714
+ minLength: _ = 1,
715
+ skipOptionCreation: M = !1,
716
+ maxLength: I = null,
717
+ optionVariant: f = "",
718
+ isRequired: R = !1,
719
+ error: L = "",
720
+ touched: y = !1,
721
+ setTouch: E = () => {
724
722
  },
725
- createWithoutConfirmation: A = !1,
726
- menuClassName: F = "",
727
- icon: c,
728
- isDropdownMode: i = !1,
729
- isOptionUnique: a,
730
- refFunction: d,
731
- stateReducer: y,
732
- onStateChange: C,
733
- useFixedPositioning: _,
734
- dropdownMatchInputWidth: N = !1,
735
- withMenuFlip: R = !1,
736
- newItemButtonText: ee = "",
737
- menuPortalRoot: $,
738
- ...B
739
- } = t, [j, ve] = oe(!1), K = Me(null), se = Y(() => {
740
- var w;
741
- return (w = K.current) == null ? void 0 : w.call(K);
742
- }, []), ne = !j || !$, re = $ || _ ? "fixed" : "absolute", be = !j || re === "absolute", le = He(
723
+ createWithoutConfirmation: z = !1,
724
+ menuClassName: D = "",
725
+ icon: i,
726
+ isDropdownMode: a = !1,
727
+ isOptionUnique: d,
728
+ refFunction: c,
729
+ stateReducer: g,
730
+ onStateChange: k,
731
+ useFixedPositioning: h,
732
+ dropdownMatchInputWidth: S = !1,
733
+ withMenuFlip: A = !1,
734
+ newItemButtonText: V = "",
735
+ menuPortalRoot: O,
736
+ ...P
737
+ } = t, [$, _e] = oe(!1), Y = ke(null), se = H(() => {
738
+ var p;
739
+ return (p = Y.current) == null ? void 0 : p.call(Y);
740
+ }, []), ne = !$ || !O, re = O || h ? "fixed" : "absolute", he = !$ || re === "absolute", le = We(
743
741
  () => [
744
- ...R ? [Tt] : [],
745
- ...N ? [jt] : []
742
+ ...A ? [jt] : [],
743
+ ...S ? [Ht] : []
746
744
  ],
747
- [R, N]
748
- ), { refs: Z, floatingStyles: ye } = Be({
745
+ [A, S]
746
+ ), { refs: K, floatingStyles: we } = De({
749
747
  placement: "bottom-start",
750
- whileElementsMounted: De,
748
+ whileElementsMounted: Fe,
751
749
  strategy: re,
752
750
  middleware: le
753
- });
754
- Bt({ skip: ne }), Dt({ skip: ne, reference: Z.reference }), Ft({
755
- skip: be,
751
+ }), ee = H(
752
+ (p) => {
753
+ if (K.setReference(p), !!c) {
754
+ if (typeof c == "function") {
755
+ c(p);
756
+ return;
757
+ }
758
+ c.current = p;
759
+ }
760
+ },
761
+ [K, c]
762
+ );
763
+ Dt({ skip: ne }), Ft({ skip: ne, reference: K.reference }), Ot({
764
+ skip: he,
756
765
  onClose: se,
757
- menuRef: Z.floating
766
+ menuRef: K.floating
758
767
  });
759
- const te = (w, T, q) => ({ item: X, index: f, ...E }) => w({
760
- item: X,
761
- index: f,
762
- isSelected: q !== null && q === X,
763
- ...E,
764
- isActive: T === f
765
- }), ge = (w, T) => {
766
- w.key === Ue && (w.preventDefault(), T(e.length));
767
- }, xe = Y(
768
- (w, ...T) => {
769
- (w == null ? void 0 : w.isOpen) !== void 0 && ve(w.isOpen), C == null || C(w, ...T);
768
+ const ve = (p, T, Q) => ({ item: m, index: x, ...C }) => p({
769
+ item: m,
770
+ index: x,
771
+ isSelected: Q !== null && Q === m,
772
+ ...C,
773
+ isActive: T === x
774
+ }), be = (p, T) => {
775
+ p.key === Ve && (p.preventDefault(), T(e.length));
776
+ }, ye = H(
777
+ (p, ...T) => {
778
+ (p == null ? void 0 : p.isOpen) !== void 0 && _e(p.isOpen), k == null || k(p, ...T);
770
779
  },
771
- [C]
780
+ [k]
772
781
  );
773
782
  return /* @__PURE__ */ r(
774
- pe,
783
+ ue,
775
784
  {
776
785
  onChange: s,
777
- itemToString: g,
786
+ itemToString: N,
778
787
  selectedItem: n,
779
- onStateChange: xe,
780
- defaultHighlightedIndex: $t,
781
- stateReducer: y,
788
+ onStateChange: ye,
789
+ defaultHighlightedIndex: Tt,
790
+ stateReducer: g,
782
791
  children: ({
783
- getInputProps: w,
792
+ getInputProps: p,
784
793
  getItemProps: T,
785
- setHighlightedIndex: q,
786
- toggleMenu: X,
787
- openMenu: f,
788
- closeMenu: E,
789
- isOpen: I,
790
- inputValue: S,
791
- highlightedIndex: G,
792
- getRootProps: H,
793
- selectItem: W
794
+ setHighlightedIndex: Q,
795
+ toggleMenu: m,
796
+ openMenu: x,
797
+ closeMenu: C,
798
+ isOpen: v,
799
+ inputValue: j,
800
+ highlightedIndex: W,
801
+ getRootProps: te,
802
+ selectItem: Z
794
803
  }) => {
795
- const ce = H(void 0, { suppressRefError: !0 }), ie = {
796
- ...ce,
797
- ref: (O) => (Z.setReference(O), ce.ref(O))
804
+ const ce = {
805
+ ...te(void 0, { suppressRefError: !0 })
798
806
  };
799
- K.current || (K.current = E);
800
- const ae = S ?? "", { onClear: U, clearable: Ne, ...Ee } = v, de = Ne && n !== null, Ie = (...O) => {
801
- W(null), U == null || U(...O);
802
- }, M = /* @__PURE__ */ r(
803
- $e,
807
+ Y.current || (Y.current = C);
808
+ const xe = j ?? "", { onClear: q, clearable: Ne, ...Ee } = b, F = Ne && n !== null, ze = (...X) => {
809
+ Z(null), q == null || q(...X);
810
+ }, Ae = /* @__PURE__ */ r(
811
+ Te,
804
812
  {
805
- isOpen: I,
806
- isDropdownMode: i,
807
- style: ye,
808
- ref: Z.setFloating,
809
- portalMenuAttribute: $ ? qe : null,
810
- minLength: p,
811
- inputValue: (S || "").trim(),
812
- getItemProps: te(T, G, n),
813
- parseValueToString: g,
814
- optionVariant: m,
815
- createWithoutConfirmation: A,
816
- className: F,
813
+ isOpen: v,
814
+ isDropdownMode: a,
815
+ style: we,
816
+ ref: K.setFloating,
817
+ portalMenuAttribute: O ? Ue : null,
818
+ minLength: _,
819
+ inputValue: (j || "").trim(),
820
+ getItemProps: ve(T, W, n),
821
+ parseValueToString: N,
822
+ optionVariant: f,
823
+ createWithoutConfirmation: z,
824
+ className: D,
817
825
  options: e,
818
- newItemButtonText: ee,
819
- ...B
826
+ newItemButtonText: V,
827
+ ...P
820
828
  }
821
829
  );
822
- return /* @__PURE__ */ D(he, { children: [
823
- /* @__PURE__ */ D("div", { className: Pe("input-wrapper"), ...ie, children: [
830
+ return /* @__PURE__ */ B(fe, { children: [
831
+ /* @__PURE__ */ B("div", { className: Be("input-wrapper"), ...ce, children: [
824
832
  /* @__PURE__ */ r(
825
- Ze,
833
+ qe,
826
834
  {
827
- ...w({
835
+ ...p({
828
836
  placeholder: u ? "" : o,
829
- maxLength: k || void 0,
837
+ maxLength: I || void 0,
830
838
  onFocus: () => {
831
- i && !I && (f(), x == null || x(!0)), l();
839
+ a && !v && (x(), E == null || E(!0)), l();
832
840
  },
833
- ref: d,
834
- onKeyDown: (O) => {
835
- O.key === Oe && O.preventDefault(), S && I && ge(O, q);
841
+ ref: ee,
842
+ onKeyDown: (X) => {
843
+ X.key === $e && X.preventDefault(), j && v && be(X, Q);
836
844
  },
837
- onBlur: (O) => {
838
- const ue = ae.trim(), ke = !ze(ue), Ae = ke ? e.find((Ce) => g(Ce) === ue) : void 0;
839
- W(Ae || (!z && A && ke ? ue : null)), h(O), a == null || a(
840
- ke ? !e.some((Ce) => g(Ce) === ue) : null
841
- ), i && I && X(), x == null || x(!0);
845
+ onBlur: (X) => {
846
+ const ie = xe.trim(), Se = !Ce(ie), Re = Se ? e.find((Ie) => N(Ie) === ie) : void 0;
847
+ Z(Re || (!M && z && Se ? ie : null)), w(X), d == null || d(
848
+ Se ? !e.some((Ie) => N(Ie) === ie) : null
849
+ ), a && v && m(), E == null || E(!0);
842
850
  },
843
851
  disabled: u,
844
852
  defaultWidth: !1,
845
- isRequired: L,
846
- touched: b,
847
- error: P,
853
+ isRequired: R,
854
+ touched: y,
855
+ error: L,
848
856
  ...Ee,
849
- clearable: de,
850
- onClear: de ? Ie : U,
851
- endIcon: i && !c ? /* @__PURE__ */ r(
857
+ clearable: F,
858
+ onClear: F ? ze : q,
859
+ endIcon: a && !i ? /* @__PURE__ */ r(
852
860
  "button",
853
861
  {
854
862
  type: "button",
855
- className: Pe("dropdown-button", { "icon-reversed": I }),
856
- onClick: () => X(),
863
+ className: Be("dropdown-button", { "icon-reversed": v }),
864
+ onClick: () => m(),
857
865
  "aria-label": "Toggle dropdown",
858
- "aria-expanded": I,
859
- children: /* @__PURE__ */ r(Fe, {})
866
+ "aria-expanded": v,
867
+ children: /* @__PURE__ */ r(Oe, {})
860
868
  }
861
- ) : c,
862
- minLength: i ? 0 : p
869
+ ) : i,
870
+ minLength: a ? 0 : _
863
871
  })
864
872
  }
865
873
  ),
866
- !$ && M
874
+ !O && Ae
867
875
  ] }),
868
- $ && Ge(M, $)
876
+ O && Je(Ae, O)
869
877
  ] });
870
878
  }
871
879
  }
872
880
  );
873
881
  };
874
882
  export {
875
- $e as AutocompleteMenu,
876
- Re as AutocompleteOption,
877
- yt as AutocompleteOptions,
878
- dt as AutocompletePrompt,
879
- ao as MultipleAutocomplete,
880
- uo as SingleAutocomplete
883
+ Te as AutocompleteMenu,
884
+ Le as AutocompleteOption,
885
+ gt as AutocompleteOptions,
886
+ ut as AutocompletePrompt,
887
+ uo as MultipleAutocomplete,
888
+ mo as SingleAutocomplete
881
889
  };