react-animated-select 0.4.1 → 0.5.6

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/index.es.js CHANGED
@@ -1,269 +1,270 @@
1
- import Xe, { createContext as Ke, memo as Ie, useRef as he, useState as ge, useEffect as oe, useCallback as N, useMemo as pe, useId as Le, forwardRef as ar, useImperativeHandle as or, isValidElement as cr, cloneElement as ur, useContext as Ye } from "react";
2
- import { CSSTransition as ke, TransitionGroup as dr } from "react-transition-group";
3
- import './index.css';var _e = { exports: {} }, je = {};
4
- var Ge;
5
- function fr() {
6
- if (Ge) return je;
7
- Ge = 1;
8
- var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.fragment");
9
- function a(n, d, c) {
10
- var v = null;
11
- if (c !== void 0 && (v = "" + c), d.key !== void 0 && (v = "" + d.key), "key" in d) {
12
- c = {};
13
- for (var m in d)
14
- m !== "key" && (c[m] = d[m]);
15
- } else c = d;
16
- return d = c.ref, {
17
- $$typeof: r,
18
- type: n,
19
- key: v,
20
- ref: d !== void 0 ? d : null,
21
- props: c
1
+ import Be, { createContext as Ze, memo as Ie, useRef as ue, useState as fe, useEffect as oe, useCallback as O, useLayoutEffect as Qe, useMemo as xe, useId as Ye, forwardRef as dr, useImperativeHandle as fr, isValidElement as gr, cloneElement as hr, useContext as Ge } from "react";
2
+ import { CSSTransition as Ae, TransitionGroup as pr } from "react-transition-group";
3
+ import { createPortal as xr } from "react-dom";
4
+ import './index.css';var Ne = { exports: {} }, Se = {};
5
+ var We;
6
+ function br() {
7
+ if (We) return Se;
8
+ We = 1;
9
+ var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.fragment");
10
+ function o(i, c, n) {
11
+ var w = null;
12
+ if (n !== void 0 && (w = "" + n), c.key !== void 0 && (w = "" + c.key), "key" in c) {
13
+ n = {};
14
+ for (var S in c)
15
+ S !== "key" && (n[S] = c[S]);
16
+ } else n = c;
17
+ return c = n.ref, {
18
+ $$typeof: e,
19
+ type: i,
20
+ key: w,
21
+ ref: c !== void 0 ? c : null,
22
+ props: n
22
23
  };
23
24
  }
24
- return je.Fragment = s, je.jsx = a, je.jsxs = a, je;
25
+ return Se.Fragment = s, Se.jsx = o, Se.jsxs = o, Se;
25
26
  }
26
- var we = {};
27
- var ze;
28
- function gr() {
29
- return ze || (ze = 1, process.env.NODE_ENV !== "production" && (function() {
30
- function r(e) {
31
- if (e == null) return null;
32
- if (typeof e == "function")
33
- return e.$$typeof === x ? null : e.displayName || e.name || null;
34
- if (typeof e == "string") return e;
35
- switch (e) {
36
- case H:
27
+ var $e = {};
28
+ var Je;
29
+ function yr() {
30
+ return Je || (Je = 1, process.env.NODE_ENV !== "production" && (function() {
31
+ function e(r) {
32
+ if (r == null) return null;
33
+ if (typeof r == "function")
34
+ return r.$$typeof === F ? null : r.displayName || r.name || null;
35
+ if (typeof r == "string") return r;
36
+ switch (r) {
37
+ case D:
37
38
  return "Fragment";
38
- case S:
39
+ case z:
39
40
  return "Profiler";
40
- case W:
41
+ case C:
41
42
  return "StrictMode";
42
- case M:
43
+ case ee:
43
44
  return "Suspense";
44
- case B:
45
+ case se:
45
46
  return "SuspenseList";
46
- case ee:
47
+ case d:
47
48
  return "Activity";
48
49
  }
49
- if (typeof e == "object")
50
- switch (typeof e.tag == "number" && console.error(
50
+ if (typeof r == "object")
51
+ switch (typeof r.tag == "number" && console.error(
51
52
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
52
- ), e.$$typeof) {
53
- case O:
53
+ ), r.$$typeof) {
54
+ case H:
54
55
  return "Portal";
55
- case u:
56
- return e.displayName || "Context";
57
- case F:
58
- return (e._context.displayName || "Context") + ".Consumer";
59
- case U:
60
- var f = e.render;
61
- return e = e.displayName, e || (e = f.displayName || f.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
- case ne:
63
- return f = e.displayName || null, f !== null ? f : r(e.type) || "Memo";
64
- case Q:
65
- f = e._payload, e = e._init;
56
+ case M:
57
+ return r.displayName || "Context";
58
+ case A:
59
+ return (r._context.displayName || "Context") + ".Consumer";
60
+ case Z:
61
+ var h = r.render;
62
+ return r = r.displayName, r || (r = h.displayName || h.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
63
+ case ie:
64
+ return h = r.displayName || null, h !== null ? h : e(r.type) || "Memo";
65
+ case q:
66
+ h = r._payload, r = r._init;
66
67
  try {
67
- return r(e(f));
68
+ return e(r(h));
68
69
  } catch {
69
70
  }
70
71
  }
71
72
  return null;
72
73
  }
73
- function s(e) {
74
- return "" + e;
74
+ function s(r) {
75
+ return "" + r;
75
76
  }
76
- function a(e) {
77
+ function o(r) {
77
78
  try {
78
- s(e);
79
- var f = !1;
79
+ s(r);
80
+ var h = !1;
80
81
  } catch {
81
- f = !0;
82
+ h = !0;
82
83
  }
83
- if (f) {
84
- f = console;
85
- var w = f.error, j = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
- return w.call(
87
- f,
84
+ if (h) {
85
+ h = console;
86
+ var j = h.error, P = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
87
+ return j.call(
88
+ h,
88
89
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
- j
90
- ), s(e);
90
+ P
91
+ ), s(r);
91
92
  }
92
93
  }
93
- function n(e) {
94
- if (e === H) return "<>";
95
- if (typeof e == "object" && e !== null && e.$$typeof === Q)
94
+ function i(r) {
95
+ if (r === D) return "<>";
96
+ if (typeof r == "object" && r !== null && r.$$typeof === q)
96
97
  return "<...>";
97
98
  try {
98
- var f = r(e);
99
- return f ? "<" + f + ">" : "<...>";
99
+ var h = e(r);
100
+ return h ? "<" + h + ">" : "<...>";
100
101
  } catch {
101
102
  return "<...>";
102
103
  }
103
104
  }
104
- function d() {
105
- var e = y.A;
106
- return e === null ? null : e.getOwner();
107
- }
108
105
  function c() {
106
+ var r = g.A;
107
+ return r === null ? null : r.getOwner();
108
+ }
109
+ function n() {
109
110
  return Error("react-stack-top-frame");
110
111
  }
111
- function v(e) {
112
- if (R.call(e, "key")) {
113
- var f = Object.getOwnPropertyDescriptor(e, "key").get;
114
- if (f && f.isReactWarning) return !1;
112
+ function w(r) {
113
+ if (x.call(r, "key")) {
114
+ var h = Object.getOwnPropertyDescriptor(r, "key").get;
115
+ if (h && h.isReactWarning) return !1;
115
116
  }
116
- return e.key !== void 0;
117
+ return r.key !== void 0;
117
118
  }
118
- function m(e, f) {
119
- function w() {
120
- A || (A = !0, console.error(
119
+ function S(r, h) {
120
+ function j() {
121
+ G || (G = !0, console.error(
121
122
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
122
- f
123
+ h
123
124
  ));
124
125
  }
125
- w.isReactWarning = !0, Object.defineProperty(e, "key", {
126
- get: w,
126
+ j.isReactWarning = !0, Object.defineProperty(r, "key", {
127
+ get: j,
127
128
  configurable: !0
128
129
  });
129
130
  }
130
- function h() {
131
- var e = r(this.type);
132
- return se[e] || (se[e] = !0, console.error(
131
+ function p() {
132
+ var r = e(this.type);
133
+ return W[r] || (W[r] = !0, console.error(
133
134
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
134
- )), e = this.props.ref, e !== void 0 ? e : null;
135
+ )), r = this.props.ref, r !== void 0 ? r : null;
135
136
  }
136
- function p(e, f, w, j, Z, t) {
137
- var i = w.ref;
138
- return e = {
139
- $$typeof: T,
140
- type: e,
141
- key: f,
142
- props: w,
143
- _owner: j
144
- }, (i !== void 0 ? i : null) !== null ? Object.defineProperty(e, "ref", {
137
+ function $(r, h, j, P, te, ne) {
138
+ var t = j.ref;
139
+ return r = {
140
+ $$typeof: k,
141
+ type: r,
142
+ key: h,
143
+ props: j,
144
+ _owner: P
145
+ }, (t !== void 0 ? t : null) !== null ? Object.defineProperty(r, "ref", {
145
146
  enumerable: !1,
146
- get: h
147
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
147
+ get: p
148
+ }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
148
149
  configurable: !1,
149
150
  enumerable: !1,
150
151
  writable: !0,
151
152
  value: 0
152
- }), Object.defineProperty(e, "_debugInfo", {
153
+ }), Object.defineProperty(r, "_debugInfo", {
153
154
  configurable: !1,
154
155
  enumerable: !1,
155
156
  writable: !0,
156
157
  value: null
157
- }), Object.defineProperty(e, "_debugStack", {
158
+ }), Object.defineProperty(r, "_debugStack", {
158
159
  configurable: !1,
159
160
  enumerable: !1,
160
161
  writable: !0,
161
- value: Z
162
- }), Object.defineProperty(e, "_debugTask", {
162
+ value: te
163
+ }), Object.defineProperty(r, "_debugTask", {
163
164
  configurable: !1,
164
165
  enumerable: !1,
165
166
  writable: !0,
166
- value: t
167
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
+ value: ne
168
+ }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
168
169
  }
169
- function I(e, f, w, j, Z, t) {
170
- var i = f.children;
171
- if (i !== void 0)
172
- if (j)
173
- if (J(i)) {
174
- for (j = 0; j < i.length; j++)
175
- L(i[j]);
176
- Object.freeze && Object.freeze(i);
170
+ function R(r, h, j, P, te, ne) {
171
+ var t = h.children;
172
+ if (t !== void 0)
173
+ if (P)
174
+ if (y(t)) {
175
+ for (P = 0; P < t.length; P++)
176
+ E(t[P]);
177
+ Object.freeze && Object.freeze(t);
177
178
  } else
178
179
  console.error(
179
180
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
180
181
  );
181
- else L(i);
182
- if (R.call(f, "key")) {
183
- i = r(e);
184
- var g = Object.keys(f).filter(function(q) {
185
- return q !== "key";
182
+ else E(t);
183
+ if (x.call(h, "key")) {
184
+ t = e(r);
185
+ var f = Object.keys(h).filter(function(b) {
186
+ return b !== "key";
186
187
  });
187
- j = 0 < g.length ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}", ie[i + j] || (g = 0 < g.length ? "{" + g.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ P = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", ae[t + P] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error(
188
189
  `A props object containing a "key" prop is being spread into JSX:
189
190
  let props = %s;
190
191
  <%s {...props} />
191
192
  React keys must be passed directly to JSX without using spread:
192
193
  let props = %s;
193
194
  <%s key={someKey} {...props} />`,
194
- j,
195
- i,
196
- g,
197
- i
198
- ), ie[i + j] = !0);
195
+ P,
196
+ t,
197
+ f,
198
+ t
199
+ ), ae[t + P] = !0);
199
200
  }
200
- if (i = null, w !== void 0 && (a(w), i = "" + w), v(f) && (a(f.key), i = "" + f.key), "key" in f) {
201
- w = {};
202
- for (var E in f)
203
- E !== "key" && (w[E] = f[E]);
204
- } else w = f;
205
- return i && m(
206
- w,
207
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
208
- ), p(
209
- e,
210
- i,
211
- w,
212
- d(),
213
- Z,
214
- t
201
+ if (t = null, j !== void 0 && (o(j), t = "" + j), w(h) && (o(h.key), t = "" + h.key), "key" in h) {
202
+ j = {};
203
+ for (var a in h)
204
+ a !== "key" && (j[a] = h[a]);
205
+ } else j = h;
206
+ return t && S(
207
+ j,
208
+ typeof r == "function" ? r.displayName || r.name || "Unknown" : r
209
+ ), $(
210
+ r,
211
+ t,
212
+ j,
213
+ c(),
214
+ te,
215
+ ne
215
216
  );
216
217
  }
217
- function L(e) {
218
- k(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === Q && (e._payload.status === "fulfilled" ? k(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
+ function E(r) {
219
+ K(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === q && (r._payload.status === "fulfilled" ? K(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
219
220
  }
220
- function k(e) {
221
- return typeof e == "object" && e !== null && e.$$typeof === T;
221
+ function K(r) {
222
+ return typeof r == "object" && r !== null && r.$$typeof === k;
222
223
  }
223
- var P = Xe, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), O = /* @__PURE__ */ Symbol.for("react.portal"), H = /* @__PURE__ */ Symbol.for("react.fragment"), W = /* @__PURE__ */ Symbol.for("react.strict_mode"), S = /* @__PURE__ */ Symbol.for("react.profiler"), F = /* @__PURE__ */ Symbol.for("react.consumer"), u = /* @__PURE__ */ Symbol.for("react.context"), U = /* @__PURE__ */ Symbol.for("react.forward_ref"), M = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), ne = /* @__PURE__ */ Symbol.for("react.memo"), Q = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), x = /* @__PURE__ */ Symbol.for("react.client.reference"), y = P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, J = Array.isArray, Y = console.createTask ? console.createTask : function() {
224
+ var U = Be, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), H = /* @__PURE__ */ Symbol.for("react.portal"), D = /* @__PURE__ */ Symbol.for("react.fragment"), C = /* @__PURE__ */ Symbol.for("react.strict_mode"), z = /* @__PURE__ */ Symbol.for("react.profiler"), A = /* @__PURE__ */ Symbol.for("react.consumer"), M = /* @__PURE__ */ Symbol.for("react.context"), Z = /* @__PURE__ */ Symbol.for("react.forward_ref"), ee = /* @__PURE__ */ Symbol.for("react.suspense"), se = /* @__PURE__ */ Symbol.for("react.suspense_list"), ie = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), d = /* @__PURE__ */ Symbol.for("react.activity"), F = /* @__PURE__ */ Symbol.for("react.client.reference"), g = U.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, y = Array.isArray, v = console.createTask ? console.createTask : function() {
224
225
  return null;
225
226
  };
226
- P = {
227
- react_stack_bottom_frame: function(e) {
228
- return e();
227
+ U = {
228
+ react_stack_bottom_frame: function(r) {
229
+ return r();
229
230
  }
230
231
  };
231
- var A, se = {}, K = P.react_stack_bottom_frame.bind(
232
- P,
233
- c
234
- )(), re = Y(n(c)), ie = {};
235
- we.Fragment = H, we.jsx = function(e, f, w) {
236
- var j = 1e4 > y.recentlyCreatedOwnerStacks++;
237
- return I(
238
- e,
239
- f,
240
- w,
232
+ var G, W = {}, re = U.react_stack_bottom_frame.bind(
233
+ U,
234
+ n
235
+ )(), de = v(i(n)), ae = {};
236
+ $e.Fragment = D, $e.jsx = function(r, h, j) {
237
+ var P = 1e4 > g.recentlyCreatedOwnerStacks++;
238
+ return R(
239
+ r,
240
+ h,
241
+ j,
241
242
  !1,
242
- j ? Error("react-stack-top-frame") : K,
243
- j ? Y(n(e)) : re
243
+ P ? Error("react-stack-top-frame") : re,
244
+ P ? v(i(r)) : de
244
245
  );
245
- }, we.jsxs = function(e, f, w) {
246
- var j = 1e4 > y.recentlyCreatedOwnerStacks++;
247
- return I(
248
- e,
249
- f,
250
- w,
246
+ }, $e.jsxs = function(r, h, j) {
247
+ var P = 1e4 > g.recentlyCreatedOwnerStacks++;
248
+ return R(
249
+ r,
250
+ h,
251
+ j,
251
252
  !0,
252
- j ? Error("react-stack-top-frame") : K,
253
- j ? Y(n(e)) : re
253
+ P ? Error("react-stack-top-frame") : re,
254
+ P ? v(i(r)) : de
254
255
  );
255
256
  };
256
- })()), we;
257
+ })()), $e;
257
258
  }
258
259
  var Ve;
259
- function hr() {
260
- return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? _e.exports = fr() : _e.exports = gr()), _e.exports;
260
+ function mr() {
261
+ return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? Ne.exports = br() : Ne.exports = yr()), Ne.exports;
261
262
  }
262
- var o = hr();
263
- const We = ({ className: r = "", ...s }) => /* @__PURE__ */ o.jsx(
263
+ var u = mr();
264
+ const Ue = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
264
265
  "svg",
265
266
  {
266
- className: r,
267
+ className: e,
267
268
  role: "button",
268
269
  "aria-label": "Clear selection",
269
270
  xmlns: "http://www.w3.org/2000/svg",
@@ -272,147 +273,202 @@ const We = ({ className: r = "", ...s }) => /* @__PURE__ */ o.jsx(
272
273
  height: "1em",
273
274
  fill: "currentColor",
274
275
  ...s,
275
- children: /* @__PURE__ */ o.jsx("path", { d: "M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z" })
276
+ children: /* @__PURE__ */ u.jsx("path", { d: "M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z" })
276
277
  }
277
- ), pr = ({ className: r = "", ...s }) => /* @__PURE__ */ o.jsx(
278
+ ), Er = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
278
279
  "svg",
279
280
  {
280
- className: r,
281
+ className: e,
281
282
  xmlns: "http://www.w3.org/2000/svg",
282
283
  viewBox: "0 0 448 512",
283
284
  width: "1em",
284
285
  height: "1em",
285
286
  fill: "currentColor",
286
287
  ...s,
287
- children: /* @__PURE__ */ o.jsx("path", { d: "M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z" })
288
+ children: /* @__PURE__ */ u.jsx("path", { d: "M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z" })
288
289
  }
289
- ), Me = ({ className: r = "", ...s }) => /* @__PURE__ */ o.jsx(
290
+ ), Me = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
290
291
  "svg",
291
292
  {
292
- className: r,
293
+ className: e,
293
294
  xmlns: "http://www.w3.org/2000/svg",
294
295
  viewBox: "0 0 24 24",
295
296
  width: "1em",
296
297
  height: "1em",
297
298
  fill: "currentColor",
298
299
  ...s,
299
- children: /* @__PURE__ */ o.jsx("path", { d: "M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z" })
300
+ children: /* @__PURE__ */ u.jsx("path", { d: "M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z" })
300
301
  }
301
- ), Je = (r, s = "invalid-option", a = "") => {
302
- const n = a ? a.replace(/:/g, "") : "";
303
- if (typeof r != "string" || !r.trim())
304
- return n ? `${s}-${n}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
305
- const d = r.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
306
- return d ? d || `${s}-${Math.random().toString(36).slice(2, 8)}` : n ? `${s}-${n}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
307
- }, Ze = Ke(null);
308
- function xr({
309
- visibility: r,
302
+ ), qe = (e, s = "invalid-option", o = "") => {
303
+ const i = o ? o.replace(/:/g, "") : "";
304
+ if (typeof e != "string" || !e.trim())
305
+ return i ? `${s}-${i}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
306
+ const c = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
307
+ return c ? c || `${s}-${Math.random().toString(36).slice(2, 8)}` : i ? `${s}-${i}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
308
+ }, er = Ze(null);
309
+ function wr({
310
+ visibility: e,
310
311
  children: s,
311
- selectRef: a,
312
- onAnimationDone: n,
313
- unmount: d = !0,
314
- duration: c,
315
- easing: v,
316
- offset: m,
317
- animateOpacity: h
312
+ selectRef: o,
313
+ onAnimationDone: i,
314
+ unmount: c = !0,
315
+ duration: n,
316
+ easing: w,
317
+ offset: S,
318
+ animateOpacity: p,
319
+ style: $,
320
+ className: R
318
321
  }) {
319
- const p = he(null), [I, L] = ge(0);
322
+ const E = ue(null), [K, U] = fe(0), [k, H] = fe({ top: 0, left: 0, width: 0 }), D = ue(k);
320
323
  oe(() => {
321
- if (!a?.current) return;
322
- L(a.current.offsetHeight);
323
- const U = new ResizeObserver((M) => {
324
- for (let B of M) L(B.target.offsetHeight);
324
+ D.current = k;
325
+ }, [k]);
326
+ const C = O(() => {
327
+ if (o?.current) {
328
+ const d = o.current.getBoundingClientRect(), F = window.innerHeight, g = E.current?.scrollHeight || 250, x = F - d.bottom, y = x < g && d.top > x;
329
+ H({
330
+ top: d.top,
331
+ bottom: d.bottom,
332
+ left: d.left,
333
+ width: d.width,
334
+ isUpward: y
335
+ });
336
+ }
337
+ }, [o]);
338
+ oe(() => {
339
+ if (e)
340
+ return C(), window.addEventListener("scroll", C, !0), window.addEventListener("resize", C), () => {
341
+ window.removeEventListener("scroll", C, !0), window.removeEventListener("resize", C);
342
+ };
343
+ }, [e, C]);
344
+ const z = `height var(--rac-duration) ${w}${p ? `, opacity var(--rac-duration) ${w}` : ""}`;
345
+ Qe(() => {
346
+ if (!o?.current) return;
347
+ U(o.current.offsetHeight);
348
+ const F = new ResizeObserver((g) => {
349
+ for (let x of g)
350
+ if (U(x.target.offsetHeight), e && E.current && o.current) {
351
+ const y = o.current.getBoundingClientRect(), { isUpward: v } = D.current;
352
+ E.current.style.width = `${y.width}px`, E.current.style.left = `${y.left}px`, v ? E.current.style.bottom = `${window.innerHeight - y.top + S}px` : E.current.style.top = `${y.bottom + S}px`;
353
+ }
325
354
  });
326
- return U.observe(a.current), () => U.disconnect();
327
- }, [a]);
328
- const k = `height ${c}ms ${v}${h ? `, opacity ${c}ms ${v}` : ""}`, P = {
329
- position: "absolute",
330
- top: `calc(100% + ${m}px)`,
331
- left: "0",
332
- width: "100%",
355
+ return F.observe(o.current), () => F.disconnect();
356
+ }, [o, e, S]);
357
+ const A = {
358
+ position: "fixed",
359
+ "--rac-duration": `${n}ms`,
360
+ "--rac-easing": w,
361
+ left: `${k.left}px`,
362
+ width: `${k.width}px`,
333
363
  overflow: "hidden",
334
- marginTop: "2px",
335
- zIndex: "1",
336
- height: r ? "auto" : "0px",
337
- opacity: h ? r ? 1 : 0 : 1,
338
- pointerEvents: r ? "all" : "none",
339
- visibility: I ? "visible" : "hidden"
340
- }, T = N(() => {
341
- const u = p.current;
342
- u && (u.style.height = "0px", h && (u.style.opacity = "0"), u.style.transition = "");
343
- }, [h]), O = N(() => {
344
- const u = p.current;
345
- u && (u.style.transition = k, u.style.height = `${u.scrollHeight}px`, h && (u.style.opacity = "1"));
346
- }, [k, h]), H = N(() => {
347
- const u = p.current;
348
- u && (u.style.height = "auto", u.style.transition = "", n && n());
349
- }, [n]), W = N(() => {
350
- const u = p.current;
351
- u && (u.style.height = `${u.scrollHeight}px`, h && (u.style.opacity = "1"), u.offsetHeight, u.style.transition = k);
352
- }, [k, h]), S = N(() => {
353
- const u = p.current;
354
- u && (u.style.height = "0px", h && (u.style.opacity = "0"));
355
- }, [h]), F = N(() => {
356
- const u = p.current;
357
- u && (u.style.transition = "");
364
+ zIndex: "2147483647",
365
+ height: e ? "auto" : "0px",
366
+ opacity: p ? e ? 1 : 0 : 1,
367
+ pointerEvents: e ? "all" : "none",
368
+ visibility: K ? "visible" : "hidden",
369
+ boxSizing: "border-box",
370
+ transformOrigin: k.isUpward ? "bottom" : "top",
371
+ ...k.isUpward ? {
372
+ bottom: `${window.innerHeight - k.top + S}px`,
373
+ top: "auto"
374
+ } : {
375
+ top: `${k.bottom + S}px`,
376
+ bottom: "auto"
377
+ },
378
+ ...Object.fromEntries(
379
+ Object.entries($ || {}).map(([d, F]) => [
380
+ d.startsWith("--") ? d : `--rac-${d.replace(/([A-Z])/g, "-$1").toLowerCase()}`,
381
+ F
382
+ ])
383
+ )
384
+ }, M = O(() => {
385
+ const d = E.current;
386
+ d && (d.style.height = "0px", p && (d.style.opacity = "0"), d.style.transition = "");
387
+ }, [p]), Z = O(() => {
388
+ const d = E.current;
389
+ d && (d.style.transition = z, d.style.height = `${d.scrollHeight}px`, p && (d.style.opacity = "1"));
390
+ }, [z, p]), ee = O(() => {
391
+ const d = E.current;
392
+ d && (d.style.height = "auto", d.style.transition = "", i && i());
393
+ }, [i]), se = O(() => {
394
+ const d = E.current;
395
+ d && (d.style.height = `${d.scrollHeight}px`, p && (d.style.opacity = "1"), d.offsetHeight, d.style.transition = z);
396
+ }, [z, p]), ie = O(() => {
397
+ const d = E.current;
398
+ d && (d.style.height = "0px", p && (d.style.opacity = "0"));
399
+ }, [p]), q = O(() => {
400
+ const d = E.current;
401
+ d && (d.style.transition = "");
358
402
  }, []);
359
- return /* @__PURE__ */ o.jsx(
360
- ke,
361
- {
362
- in: r,
363
- timeout: c,
364
- classNames: "rac-options",
365
- unmountOnExit: d,
366
- nodeRef: p,
367
- onEnter: T,
368
- onEntering: O,
369
- onEntered: H,
370
- onExit: W,
371
- onExiting: S,
372
- onExited: F,
373
- children: /* @__PURE__ */ o.jsx(
374
- "div",
375
- {
376
- ref: p,
377
- className: "rac-options",
378
- style: P,
379
- children: s
380
- }
381
- )
382
- }
403
+ return xr(
404
+ /* @__PURE__ */ u.jsx(
405
+ Ae,
406
+ {
407
+ in: e,
408
+ timeout: n,
409
+ classNames: "rac-options",
410
+ unmountOnExit: c,
411
+ nodeRef: E,
412
+ onEnter: M,
413
+ onEntering: Z,
414
+ onEntered: ee,
415
+ onExit: se,
416
+ onExiting: ie,
417
+ onExited: q,
418
+ children: /* @__PURE__ */ u.jsx(
419
+ "div",
420
+ {
421
+ ref: E,
422
+ className: `rac-options ${R || ""}`,
423
+ style: {
424
+ ...A,
425
+ "--rac-duration": `${n}ms`,
426
+ "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
427
+ "--rac-duration-base": "var(--rac-duration)",
428
+ "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)"
429
+ },
430
+ onMouseDown: (d) => {
431
+ d.preventDefault();
432
+ },
433
+ children: s
434
+ }
435
+ )
436
+ }
437
+ ),
438
+ document.body
383
439
  );
384
440
  }
385
- const br = Ie(xr, (r, s) => r.visibility === s.visibility && r.duration === s.duration && r.easing === s.easing && r.offset === s.offset && r.animateOpacity === s.animateOpacity && r.selectRef === s.selectRef && r.children === s.children);
386
- function Re({
387
- visibility: r,
441
+ const vr = Ie(wr, (e, s) => e.visibility === s.visibility && e.duration === s.duration && e.easing === s.easing && e.offset === s.offset && e.animateOpacity === s.animateOpacity && e.selectRef === s.selectRef && e.children === s.children && JSON.stringify(e.style) === JSON.stringify(s.style));
442
+ function ke({
443
+ visibility: e,
388
444
  children: s,
389
- duration: a = 300,
390
- unmount: n,
391
- style: d
445
+ duration: o = 300,
446
+ unmount: i,
447
+ style: c
392
448
  }) {
393
- const c = he(null);
394
- return /* @__PURE__ */ o.jsx(
395
- ke,
449
+ const n = ue(null);
450
+ return /* @__PURE__ */ u.jsx(
451
+ Ae,
396
452
  {
397
- in: r,
398
- timeout: a,
453
+ in: e,
454
+ timeout: o,
399
455
  classNames: "rac-slide-left",
400
456
  unmountOnExit: !0,
401
- nodeRef: c,
402
- onEnter: () => c.current.style.width = "0px",
403
- onEntering: () => c.current.style.width = c.current.scrollWidth + "px",
404
- onEntered: () => c.current.style.width = "auto",
405
- onExit: () => c.current.style.width = c.current.scrollWidth + "px",
406
- onExiting: () => c.current.style.width = "0px",
407
- onExited: () => n?.(),
408
- children: /* @__PURE__ */ o.jsx(
457
+ nodeRef: n,
458
+ onEnter: () => n.current.style.width = "0px",
459
+ onEntering: () => n.current.style.width = n.current.scrollWidth + "px",
460
+ onEntered: () => n.current.style.width = "auto",
461
+ onExit: () => n.current.style.width = n.current.scrollWidth + "px",
462
+ onExiting: () => n.current.style.width = "0px",
463
+ onExited: () => i?.(),
464
+ children: /* @__PURE__ */ u.jsx(
409
465
  "div",
410
466
  {
411
- ref: c,
467
+ ref: n,
412
468
  style: {
413
- ...d,
469
+ ...c,
414
470
  overflow: "hidden",
415
- transition: `width ${a}ms ease`
471
+ transition: `width ${o}ms ease`
416
472
  },
417
473
  children: s
418
474
  }
@@ -420,211 +476,258 @@ function Re({
420
476
  }
421
477
  );
422
478
  }
423
- const Ue = ({ children: r, duration: s, ...a }) => {
424
- const n = he(null);
425
- return /* @__PURE__ */ o.jsx(
426
- ke,
479
+ const Xe = ({ children: e, duration: s, widthMode: o = !1, ...i }) => {
480
+ const c = ue(null);
481
+ return /* @__PURE__ */ u.jsx(
482
+ Ae,
427
483
  {
428
- nodeRef: n,
484
+ nodeRef: c,
429
485
  timeout: s,
430
486
  classNames: "rac-slide-left",
431
- ...a,
487
+ ...i,
432
488
  onEnter: () => {
433
- n.current.style.width = "0px", n.current.style.opacity = "0";
489
+ const n = c.current;
490
+ o ? n.style.width = "0px" : (n.style.height = "0px", n.style.transform = "translateY(-10px)"), n.style.opacity = "0";
434
491
  },
435
492
  onEntering: () => {
436
- n.current.style.width = n.current.scrollWidth + "px", n.current.style.opacity = "1";
493
+ const n = c.current;
494
+ n.offsetHeight, o ? n.style.width = n.scrollWidth + "px" : (n.style.height = n.scrollHeight + "px", n.style.transform = "translateY(0)"), n.style.opacity = "1";
437
495
  },
438
496
  onEntered: () => {
439
- n.current.style.width = "auto", n.current.style.opacity = "1";
497
+ const n = c.current;
498
+ n.style.width = o ? "auto" : "", n.style.height = o ? "" : "auto", n.style.opacity = "1", n.style.transform = "";
440
499
  },
441
500
  onExit: () => {
442
- n.current.style.width = n.current.scrollWidth + "px", n.current.style.opacity = "1";
501
+ const n = c.current;
502
+ o ? n.style.width = n.offsetWidth + "px" : (n.style.height = n.offsetHeight + "px", n.style.position = "absolute"), n.style.opacity = "1";
443
503
  },
444
504
  onExiting: () => {
445
- n.current.style.width = "0px", n.current.style.opacity = "0", n.current.style.margin = "0";
505
+ const n = c.current;
506
+ o ? n.style.width = "0px" : (n.style.height = "0px", n.style.transform = "translateY(10px)"), n.style.opacity = "0";
446
507
  },
447
- children: /* @__PURE__ */ o.jsx(
508
+ children: /* @__PURE__ */ u.jsx(
448
509
  "div",
449
510
  {
450
- ref: n,
511
+ ref: c,
451
512
  style: {
452
513
  display: "flex",
453
514
  alignItems: "center",
454
515
  height: "100%",
455
516
  overflow: "hidden",
456
517
  whiteSpace: "nowrap",
457
- transition: `all ${s}ms ease`
518
+ transition: `all ${s}ms ease`,
519
+ top: 0,
520
+ left: 0
458
521
  },
459
- children: r
522
+ children: e
460
523
  }
461
524
  )
462
525
  }
463
526
  );
464
- }, yr = Ie(({ element: r, index: s, remove: a, renderIcon: n, DelIcon: d, normalizedOptions: c }) => {
465
- let v = null;
466
- if (r?.jsx)
467
- v = r.jsx;
468
- else if (r?.name)
469
- v = r.name;
470
- else if (r?.raw !== void 0) {
471
- const h = c.find(
472
- (p) => p.raw === r.raw || p.original === r.raw || p.userId === r.raw
527
+ }, jr = Ie(({ element: e, index: s, remove: o, renderIcon: i, DelIcon: c, normalizedOptions: n }) => {
528
+ let w = null;
529
+ if (e?.jsx)
530
+ w = e.jsx;
531
+ else if (e?.name)
532
+ w = e.name;
533
+ else if (e?.raw !== void 0) {
534
+ const $ = n.find(
535
+ (R) => R.raw === e.raw || R.original === e.raw || R.userId === e.raw
473
536
  );
474
- h && (v = h.jsx ?? h.name);
537
+ $ && (w = $.jsx ?? $.name);
475
538
  }
476
- v == null && (v = typeof r == "object" ? r.label ?? r.name ?? r.value ?? "Selected item" : String(r));
477
- const m = N((h) => {
478
- h.stopPropagation(), h.preventDefault(), a(r.id);
479
- }, [r.id, a]);
480
- return /* @__PURE__ */ o.jsxs("div", { className: "rac-multiple-selected-option", children: [
481
- v,
482
- n(d, { onClick: m })
539
+ w == null && (w = typeof e == "object" ? e.label ?? e.name ?? e.value ?? "Selected item" : String(e));
540
+ const S = O(($) => {
541
+ $.stopPropagation(), $.preventDefault(), o(e.id);
542
+ }, [e.id, o]), p = O(($) => {
543
+ $.stopPropagation(), $.preventDefault();
544
+ }, []);
545
+ return /* @__PURE__ */ u.jsxs("div", { className: "rac-multiple-selected-option", children: [
546
+ w,
547
+ i(c, { onClick: S, onMouseDown: p })
483
548
  ] });
484
- }), mr = Ie(({
485
- selectRef: r,
549
+ }), Sr = Ie(({
550
+ selectRef: e,
486
551
  selectId: s,
487
- renderOptions: a,
488
- selected: n,
489
- selectedIDs: d,
490
- setSelectedIds: c,
491
- normalizedOptions: v,
492
- title: m,
493
- visibility: h,
494
- active: p,
495
- hasOptions: I,
496
- hasActualValue: L,
497
- disabled: k,
498
- loading: P,
499
- error: T,
500
- registerOption: O,
501
- unregisterOption: H,
502
- handleBlur: W,
503
- handleFocus: S,
504
- handleToggle: F,
505
- handleKeyDown: u,
506
- handleListScroll: U,
507
- setAnimationFinished: M,
508
- clear: B,
509
- children: ne,
510
- renderedDropdown: Q,
511
- placeholder: ee,
552
+ removeOption: o,
553
+ renderOptions: i,
554
+ selected: c,
555
+ selectedIDs: n,
556
+ setSelectedIds: w,
557
+ normalizedOptions: S,
558
+ title: p,
559
+ visibility: $,
560
+ active: R,
561
+ hasOptions: E,
562
+ hasActualValue: K,
563
+ optionsClassName: U,
564
+ selectedText: k,
565
+ disabled: H,
566
+ loading: D,
567
+ error: C,
568
+ registerOption: z,
569
+ unregisterOption: A,
570
+ handleBlur: M,
571
+ handleFocus: Z,
572
+ handleToggle: ee,
573
+ handleKeyDown: se,
574
+ handleListScroll: ie,
575
+ setAnimationFinished: q,
576
+ clear: d,
577
+ children: F,
578
+ placeholder: g,
512
579
  className: x,
513
580
  style: y,
514
- duration: R,
515
- easing: J,
516
- offset: Y,
517
- animateOpacity: A,
518
- unmount: se,
519
- ArrowIcon: K,
520
- ClearIcon: re,
521
- DelIcon: ie,
522
- renderIcon: e,
523
- hasMore: f,
524
- loadButton: w
581
+ duration: v,
582
+ easing: G,
583
+ offset: W,
584
+ animateOpacity: re,
585
+ unmount: de,
586
+ ArrowIcon: ae,
587
+ ClearIcon: r,
588
+ DelIcon: h,
589
+ renderIcon: j,
590
+ hasMore: P,
591
+ loadButton: te
525
592
  }) => {
526
- const j = N((t) => {
527
- c((i) => i.filter((g) => g.id !== t));
528
- }, [c]), Z = d.map((t, i) => /* @__PURE__ */ o.jsx(
529
- Ue,
593
+ const ne = ue(null), [t, f] = fe(null), a = ue(null);
594
+ Qe(() => {
595
+ const N = a.current;
596
+ if (!N) return;
597
+ const Q = new ResizeObserver((J) => {
598
+ window.requestAnimationFrame(() => {
599
+ if (!Array.isArray(J) || !J.length) return;
600
+ const pe = J[0].contentRect.height;
601
+ f(pe);
602
+ });
603
+ });
604
+ return Q.observe(N), () => {
605
+ Q.disconnect();
606
+ };
607
+ }, []), oe(() => {
608
+ e && (typeof e == "function" ? e(ne.current) : e.current = ne.current);
609
+ }, [e]);
610
+ const b = O((N) => {
611
+ o ? o(N) : w((Q) => Q.filter((J) => J.id !== N));
612
+ }, [o, w]), _ = n?.map((N, Q) => /* @__PURE__ */ u.jsx(
613
+ Xe,
530
614
  {
531
- duration: R,
532
- children: /* @__PURE__ */ o.jsx(
533
- yr,
615
+ duration: v,
616
+ widthMode: !0,
617
+ children: /* @__PURE__ */ u.jsx(
618
+ jr,
534
619
  {
535
- element: t,
536
- index: i,
537
- remove: j,
538
- renderIcon: e,
539
- DelIcon: ie,
540
- normalizedOptions: v
620
+ element: N,
621
+ index: Q,
622
+ remove: b,
623
+ renderIcon: j,
624
+ DelIcon: h,
625
+ normalizedOptions: S
541
626
  },
542
- t.id ?? i
627
+ N.id ?? Q
543
628
  )
544
629
  },
545
- t.id ?? i
630
+ N.id ?? Q
546
631
  ));
547
- return /* @__PURE__ */ o.jsxs(
548
- Ze.Provider,
632
+ return /* @__PURE__ */ u.jsxs(
633
+ er.Provider,
549
634
  {
550
- value: { registerOption: O, unregisterOption: H },
635
+ value: { registerOption: z, unregisterOption: A },
551
636
  children: [
552
- ne,
553
- Q,
554
- /* @__PURE__ */ o.jsxs(
637
+ F,
638
+ /* @__PURE__ */ u.jsxs(
555
639
  "div",
556
640
  {
557
- ref: r,
558
- style: { "--rac-duration": `${R}ms`, ...y },
641
+ ref: ne,
642
+ style: {
643
+ ...y,
644
+ "--rac-duration": `${v}ms`,
645
+ "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
646
+ "--rac-duration-base": "var(--rac-duration)",
647
+ "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)"
648
+ },
559
649
  className: `rac-select
560
650
  ${x}
561
- ${!I || k ? "rac-disabled-style" : ""}
562
- ${P ? "rac-loading-style" : ""}
563
- ${T ? "rac-error-style" : ""}`,
564
- tabIndex: p ? 0 : -1,
651
+ ${!E || H ? "rac-disabled-style" : ""}
652
+ ${D ? "rac-loading-style" : ""}
653
+ ${C ? "rac-error-style" : ""}`,
654
+ tabIndex: R ? 0 : -1,
565
655
  role: "combobox",
566
656
  "aria-haspopup": "listbox",
567
- "aria-expanded": h,
657
+ "aria-expanded": $,
568
658
  "aria-controls": `${s}-listbox`,
569
- "aria-label": ee,
570
- "aria-disabled": k || !I,
571
- ...p && {
572
- onBlur: W,
573
- onFocus: S,
574
- onClick: F,
575
- onKeyDown: u
659
+ "aria-label": g,
660
+ "aria-disabled": H || !E,
661
+ ...R && {
662
+ onBlur: M,
663
+ onFocus: Z,
664
+ onClick: ee,
665
+ onKeyDown: se
576
666
  },
577
667
  children: [
578
- /* @__PURE__ */ o.jsx(
668
+ /* @__PURE__ */ u.jsx(
579
669
  "div",
580
670
  {
581
- className: `rac-select-title
582
- ${!T && !P && n?.type === "boolean" ? n.raw ? "rac-true-option" : "rac-false-option" : ""}
671
+ className: `rac-select-title-wrapper
672
+ ${!C && !D && c?.type === "boolean" ? c.raw ? "rac-true-option" : "rac-false-option" : ""}
583
673
  `,
584
- children: /* @__PURE__ */ o.jsx(dr, { component: null, children: d.length ? Z : /* @__PURE__ */ o.jsxs(
585
- Ue,
674
+ style: {
675
+ height: t ? `${t}px` : "auto",
676
+ boxSizing: "content-box",
677
+ overflow: "hidden"
678
+ },
679
+ children: /* @__PURE__ */ u.jsx(
680
+ "div",
586
681
  {
587
- duration: R,
588
- children: [
589
- /* @__PURE__ */ o.jsx("span", { className: "rac-title-text", children: m }, m),
590
- /* @__PURE__ */ o.jsx(Re, { visibility: P && !T, duration: R, children: /* @__PURE__ */ o.jsxs("span", { className: "rac-loading-dots", children: [
591
- /* @__PURE__ */ o.jsx("i", {}),
592
- /* @__PURE__ */ o.jsx("i", {}),
593
- /* @__PURE__ */ o.jsx("i", {})
594
- ] }) })
595
- ]
596
- },
597
- "placeholder-content"
598
- ) })
682
+ className: "rac-select-title",
683
+ ref: a,
684
+ children: /* @__PURE__ */ u.jsx(pr, { component: null, children: n?.length && !k ? _ : /* @__PURE__ */ u.jsxs(
685
+ Xe,
686
+ {
687
+ duration: v,
688
+ widthMode: !0,
689
+ children: [
690
+ /* @__PURE__ */ u.jsx("span", { className: "rac-title-text", children: p }),
691
+ /* @__PURE__ */ u.jsx(ke, { visibility: D && !C, duration: v, children: /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
692
+ /* @__PURE__ */ u.jsx("i", {}),
693
+ /* @__PURE__ */ u.jsx("i", {}),
694
+ /* @__PURE__ */ u.jsx("i", {})
695
+ ] }) })
696
+ ]
697
+ },
698
+ p
699
+ ) })
700
+ }
701
+ )
599
702
  }
600
703
  ),
601
- /* @__PURE__ */ o.jsxs("div", { className: "rac-select-buttons", children: [
602
- /* @__PURE__ */ o.jsx(
603
- Re,
704
+ /* @__PURE__ */ u.jsxs("div", { className: "rac-select-buttons", children: [
705
+ /* @__PURE__ */ u.jsx(
706
+ ke,
604
707
  {
605
- visibility: L && I && !k && !P && !T,
606
- duration: R,
708
+ visibility: K && E && !H && !D && !C,
709
+ duration: v,
607
710
  style: { display: "grid" },
608
- children: e(re, {
711
+ children: j(r, {
609
712
  className: "rac-select-cancel",
610
- onMouseDown: (t) => {
611
- t.preventDefault(), t.stopPropagation();
713
+ onMouseDown: (N) => {
714
+ N.preventDefault(), N.stopPropagation();
612
715
  },
613
- onClick: B
716
+ onClick: d
614
717
  })
615
718
  }
616
719
  ),
617
- /* @__PURE__ */ o.jsx(
618
- Re,
720
+ /* @__PURE__ */ u.jsx(
721
+ ke,
619
722
  {
620
- visibility: p,
621
- duration: R,
723
+ visibility: R,
724
+ duration: v,
622
725
  style: { display: "grid" },
623
- children: /* @__PURE__ */ o.jsx(
726
+ children: /* @__PURE__ */ u.jsx(
624
727
  "span",
625
728
  {
626
- className: `rac-select-arrow-wrapper ${h ? "--open" : ""}`,
627
- children: e(K, {
729
+ className: `rac-select-arrow-wrapper ${$ ? "--open" : ""}`,
730
+ children: j(ae, {
628
731
  className: "rac-select-arrow-wrapper"
629
732
  })
630
733
  }
@@ -632,38 +735,43 @@ const Ue = ({ children: r, duration: s, ...a }) => {
632
735
  }
633
736
  )
634
737
  ] }),
635
- /* @__PURE__ */ o.jsx(
636
- br,
738
+ /* @__PURE__ */ u.jsx(
739
+ vr,
637
740
  {
638
- visibility: h,
639
- selectRef: r,
640
- onAnimationDone: () => M(!0),
641
- unmount: se,
642
- duration: R,
643
- easing: J,
644
- offset: Y,
645
- animateOpacity: A,
646
- children: /* @__PURE__ */ o.jsxs(
741
+ className: U,
742
+ visibility: $,
743
+ selectRef: e,
744
+ onAnimationDone: () => q(!0),
745
+ unmount: de,
746
+ duration: v,
747
+ easing: G,
748
+ offset: W,
749
+ animateOpacity: re,
750
+ style: {
751
+ ...y,
752
+ "--rac-duration": `${v}ms`
753
+ },
754
+ children: /* @__PURE__ */ u.jsxs(
647
755
  "div",
648
756
  {
649
- onScroll: U,
757
+ onScroll: ie,
650
758
  tabIndex: "-1",
651
759
  className: "rac-select-list",
652
760
  role: "listbox",
653
761
  "aria-label": "Options",
654
762
  children: [
655
- a,
656
- !w && f && /* @__PURE__ */ o.jsxs(
763
+ i,
764
+ !te && P && /* @__PURE__ */ u.jsxs(
657
765
  "div",
658
766
  {
659
767
  className: "rac-select-option rac-disabled-option rac-loading-option",
660
- onClick: (t) => t.stopPropagation(),
768
+ onClick: (N) => N.stopPropagation(),
661
769
  children: [
662
- /* @__PURE__ */ o.jsx("span", { className: "rac-loading-option-title", children: "Loading" }),
663
- /* @__PURE__ */ o.jsxs("span", { className: "rac-loading-dots", children: [
664
- /* @__PURE__ */ o.jsx("i", {}),
665
- /* @__PURE__ */ o.jsx("i", {}),
666
- /* @__PURE__ */ o.jsx("i", {})
770
+ /* @__PURE__ */ u.jsx("span", { className: "rac-loading-option-title", children: "Loading" }),
771
+ /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
772
+ /* @__PURE__ */ u.jsx("i", {}),
773
+ /* @__PURE__ */ u.jsx("i", {}),
774
+ /* @__PURE__ */ u.jsx("i", {})
667
775
  ] })
668
776
  ]
669
777
  }
@@ -680,362 +788,417 @@ const Ue = ({ children: r, duration: s, ...a }) => {
680
788
  }
681
789
  );
682
790
  });
683
- function Er({
684
- disabled: r,
791
+ function $r({
792
+ disabled: e,
685
793
  open: s,
686
- setOpen: a,
687
- options: n = [],
688
- selectOption: d,
689
- selected: c,
690
- multiple: v,
691
- hasMore: m,
692
- loadMore: h,
693
- loadButton: p,
694
- loadButtonText: I,
695
- setLoadingTitle: L,
696
- loadOffset: k,
697
- loadAhead: P,
698
- expandedGroups: T
794
+ setOpen: o,
795
+ options: i = [],
796
+ selectOption: c,
797
+ selected: n,
798
+ selectedIDs: w,
799
+ multiple: S,
800
+ hasMore: p,
801
+ loadMore: $,
802
+ loadButton: R,
803
+ loadButtonText: E,
804
+ setLoadingTitle: K,
805
+ loadOffset: U,
806
+ loadAhead: k,
807
+ expandedGroups: H
699
808
  }) {
700
- const O = he(!1), H = he(0), W = he(!1), [S, F] = ge(-1);
809
+ const D = ue(!1), C = ue(0), z = ue(!1), [A, M] = fe(-1);
701
810
  oe(() => {
702
- W.current = !1, p && L(I);
703
- }, [n.length, m, p, I, L]);
704
- const u = N(() => {
705
- !m || W.current || (W.current = !0, h());
706
- }, [m, h]), U = N((x) => {
707
- if (p || !m || W.current) return;
708
- const { scrollTop: y, scrollHeight: R, clientHeight: J } = x.currentTarget;
709
- R - y <= J + k && u();
710
- }, [p, m, k, u]);
811
+ z.current = !1, R && K(E);
812
+ }, [i.length, p, R, E, K]);
813
+ const Z = O(() => {
814
+ !p || z.current || (z.current = !0, $());
815
+ }, [p, $]), ee = O((g) => {
816
+ if (R || !p || z.current) return;
817
+ const { scrollTop: x, scrollHeight: y, clientHeight: v } = g.currentTarget;
818
+ y - x <= v + U && Z();
819
+ }, [R, p, U, Z]);
711
820
  oe(() => {
712
- !p && s && m && S >= n.length - P && u();
713
- }, [S, s, m, n.length, P, p, u]), oe(() => {
714
- const x = () => {
715
- H.current = Date.now();
821
+ !R && s && p && A >= i.length - k && Z();
822
+ }, [A, s, p, i.length, k, R, Z]), oe(() => {
823
+ const g = () => {
824
+ C.current = Date.now();
716
825
  };
717
- return window.addEventListener("focus", x), () => window.removeEventListener("focus", x);
826
+ return window.addEventListener("focus", g), () => window.removeEventListener("focus", g);
718
827
  }, []), oe(() => {
719
828
  if (!s) {
720
- F(-1);
829
+ M(-1);
721
830
  return;
722
831
  }
723
- if (S >= 0 && S < n.length && !(!n[S] || n[S].hidden || n[S].groupHeader))
832
+ if (A >= 0 && A < i.length && !(!i[A] || i[A].hidden || i[A].groupHeader))
724
833
  return;
725
- let x = -1;
726
- if (c) {
727
- const y = v ? c[0] : c;
728
- y && (x = n.findIndex((R) => R.id === y.id && !R.disabled && !R.hidden && !R.groupHeader));
834
+ let g = -1;
835
+ if (n && !S) {
836
+ const x = S ? n[0] : n;
837
+ x && (g = i.findIndex((y) => y.id === x.id && !y.disabled && !y.hidden && !y.groupHeader));
729
838
  }
730
- x === -1 && (x = n.findIndex((y) => !y.disabled && !y.hidden && !y.groupHeader)), F(x);
731
- }, [s, n, c]);
732
- const M = N((x, y) => {
733
- const R = (A) => A && !A?.groupHeader && (!A?.group || T?.has(A?.group)) && !A?.disabled && !A?.loading, J = n.length;
734
- if (J === 0) return -1;
735
- let Y = x;
736
- for (let A = 0; A < J; A++) {
737
- if (Y = (Y + y + J) % J, !p && m && (y > 0 && Y === 0 || y < 0 && Y === J - 1))
738
- return x;
739
- if (R(n[Y])) return Y;
839
+ if (S && w.length) {
840
+ const x = new Set(w.map((y) => y.id));
841
+ g = i.findIndex(
842
+ (y) => x.has(y.id) && !y.disabled && !y.hidden && !y.groupHeader
843
+ );
740
844
  }
741
- return x;
742
- }, [n, m, p, T]), B = N((x) => {
743
- x.currentTarget.contains(x.relatedTarget) || a(!1);
744
- }, [a]), ne = N(() => {
745
- r || document.hidden || Date.now() - H.current < 100 || s || (a(!0), O.current = !0, setTimeout(() => {
746
- O.current = !1;
845
+ g === -1 && (g = i.findIndex((x) => !x.disabled && !x.hidden && !x.groupHeader)), M(g);
846
+ }, [s, i, n]);
847
+ const se = O((g, x) => {
848
+ const y = (W) => W && !W?.groupHeader && (!W?.group || H?.has(W?.group)) && !W?.disabled && !W?.loading, v = i.length;
849
+ if (v === 0) return -1;
850
+ let G = g;
851
+ for (let W = 0; W < v; W++) {
852
+ if (G = (G + x + v) % v, !R && p && (x > 0 && G === 0 || x < 0 && G === v - 1))
853
+ return g;
854
+ if (y(i[G])) return G;
855
+ }
856
+ return g;
857
+ }, [i, p, R, H]), ie = O((g) => {
858
+ const x = g.relatedTarget?.closest(".rac-options");
859
+ !g.currentTarget.contains(g.relatedTarget) && !x && o(!1);
860
+ }, [o]), q = O(() => {
861
+ e || document.hidden || Date.now() - C.current < 100 || s || (o(!0), D.current = !0, setTimeout(() => {
862
+ D.current = !1;
747
863
  }, 200));
748
- }, [r, s, a]), Q = N((x) => {
749
- r || x.target.closest(".rac-select-cancel") || O.current || a(!s);
750
- }, [r, s, a]), ee = N((x) => {
751
- if (!r)
752
- switch (x.key) {
864
+ }, [e, s, o]), d = O((g) => {
865
+ e || g.target.closest(".rac-select-cancel") || D.current || o(!s);
866
+ }, [e, s, o]), F = O((g) => {
867
+ if (!e)
868
+ switch (g.key) {
753
869
  case "Enter":
754
870
  case " ":
755
- x.preventDefault(), s ? S !== -1 && n[S] && d(n[S], x) : a(!0);
871
+ g.preventDefault(), s ? A !== -1 && i[A] && c(i[A], g) : o(!0);
756
872
  break;
757
873
  case "Escape":
758
- x.preventDefault(), a(!1);
874
+ g.preventDefault(), o(!1);
759
875
  break;
760
876
  case "ArrowDown":
761
- x.preventDefault(), s ? F((y) => M(y, 1)) : a(!0);
877
+ g.preventDefault(), s ? M((x) => se(x, 1)) : o(!0);
762
878
  break;
763
879
  case "ArrowUp":
764
- x.preventDefault(), s ? F((y) => M(y, -1)) : a(!0);
880
+ g.preventDefault(), s ? M((x) => se(x, -1)) : o(!0);
765
881
  break;
766
882
  case "Tab":
767
- s && a(!1);
883
+ s && o(!1);
768
884
  break;
769
885
  }
770
- }, [r, s, a, S, n, d, M]);
771
- return pe(() => ({
772
- handleBlur: B,
773
- handleFocus: ne,
774
- handleToggle: Q,
775
- handleKeyDown: ee,
776
- highlightedIndex: S,
777
- setHighlightedIndex: F,
778
- handleListScroll: U
779
- }), [B, ne, Q, ee, S, U]);
886
+ }, [e, s, o, A, i, c, se]);
887
+ return xe(() => ({
888
+ handleBlur: ie,
889
+ handleFocus: q,
890
+ handleToggle: d,
891
+ handleKeyDown: F,
892
+ highlightedIndex: A,
893
+ setHighlightedIndex: M,
894
+ handleListScroll: ee
895
+ }), [ie, q, d, F, A, ee]);
780
896
  }
781
- const vr = ["group", "disabled", "options", "items", "children"], Oe = ["name", "label", "id", "value"], qe = (r, s = !1) => {
782
- if (s && typeof r.group == "string") return r.group;
783
- const a = Oe.find((d) => r[d] != null && r[d] !== "");
784
- if (a) return String(r[a]);
785
- const n = Object.entries(r).find(([d, c]) => !vr.includes(d) && c != null && c !== "");
786
- return n ? String(n[1]) : null;
897
+ const _r = ["group", "disabled", "options", "items", "children"], Le = ["name", "label", "id", "value"], Ke = [], Re = (e, s = !1) => {
898
+ if (s && typeof e.group == "string") return e.group;
899
+ const o = Le.find((c) => e[c] != null && e[c] !== "");
900
+ if (o) return String(e[o]);
901
+ const i = Object.entries(e).find(([c, n]) => !_r.includes(c) && n != null && n !== "");
902
+ return i ? String(i[1]) : null;
787
903
  };
788
- function jr({
789
- options: r = [],
790
- jsxOptions: s = [],
791
- value: a,
792
- defaultValue: n,
793
- onChange: d,
794
- disabled: c = !1,
795
- loading: v = !1,
796
- error: m = !1,
797
- multiple: h = !1,
798
- placeholder: p = "Choose option",
799
- emptyText: I = "No options",
800
- disabledText: L = "Disabled",
801
- loadingText: k = "Loading",
802
- errorText: P = "Failed to load",
803
- disabledOption: T = "Disabled option",
804
- emptyOption: O = "Empty option",
805
- invalidOption: H = "Invalid option",
806
- setVisibility: W,
807
- hasMore: S,
808
- loadButton: F,
809
- setLoadingTitle: u,
810
- loadingTitle: U,
811
- loadMoreText: M,
812
- loadMore: B,
813
- childrenFirst: ne,
814
- groupsClosed: Q
904
+ function Nr({
905
+ options: e = Ke,
906
+ jsxOptions: s = Ke,
907
+ value: o,
908
+ defaultValue: i,
909
+ onChange: c,
910
+ disabled: n = !1,
911
+ loading: w = !1,
912
+ error: S = !1,
913
+ multiple: p = !1,
914
+ placeholder: $ = "Choose option",
915
+ emptyText: R = "No options",
916
+ disabledText: E = "Disabled",
917
+ loadingText: K = "Loading",
918
+ errorText: U = "Failed to load",
919
+ disabledOption: k = "Disabled option",
920
+ emptyOption: H = "Empty option",
921
+ invalidOption: D = "Invalid option",
922
+ setVisibility: C,
923
+ hasMore: z,
924
+ loadButton: A,
925
+ setLoadingTitle: M,
926
+ loadingTitle: Z,
927
+ loadMoreText: ee,
928
+ loadMore: se,
929
+ childrenFirst: ie,
930
+ groupsClosed: q
815
931
  }) {
816
- const ee = Le(), x = a !== void 0, [y, R] = ge(null), [J, Y] = ge([]), [A, se] = ge(/* @__PURE__ */ new Set()), K = he(null), re = N((t) => {
817
- se((i) => {
818
- const g = new Set(i);
819
- return g.has(t) ? g.delete(t) : g.add(t), g;
932
+ const d = Ye(), F = o !== void 0, [g, x] = fe(null), [y, v] = fe([]), [G, W] = fe(/* @__PURE__ */ new Set()), re = ue(null), de = O((t) => {
933
+ W((f) => {
934
+ const a = new Set(f);
935
+ return a.has(t) ? a.delete(t) : a.add(t), a;
820
936
  });
821
- }, []), ie = N((t, i, g = "n", E = null, q = !1) => {
822
- const le = `${ee}-${g}-${i}`;
937
+ }, []), ae = O((t, f, a = "n", b = null, _ = !1) => {
938
+ const N = `${d}-${a}-${f}`;
823
939
  if (t == null || t === "")
824
- return { id: le, userId: null, name: O, raw: null, disabled: !0, type: "normal", group: E, groupDisabled: q };
940
+ return { id: N, userId: null, name: H, raw: null, disabled: !0, type: "normal", group: b, groupDisabled: _ };
825
941
  if (typeof t == "function")
826
- return { id: le, userId: null, name: H, raw: t, disabled: !0, invalid: !0, type: "normal", group: E };
942
+ return { id: N, userId: null, name: D, raw: t, disabled: !0, invalid: !0, type: "normal", group: b };
827
943
  if (typeof t == "object" && !Array.isArray(t)) {
828
- const ue = E || t.group || null, de = q || t.disabled === !0, D = t.id ?? t.value ?? t.name ?? t.label, X = t.value !== void 0 ? t.value : t.id !== void 0 ? t.id : t;
829
- let l = qe(t) || (de ? T : O);
944
+ const Q = b || t.group || null, J = _ || t.disabled === !0, pe = t.id ?? t.value ?? t.name ?? t.label, L = t.value !== void 0 ? t.value : t.id !== void 0 ? t.id : t;
945
+ let l = Re(t) || (J ? k : H);
830
946
  return {
831
- id: le,
832
- userId: D,
947
+ id: N,
948
+ userId: pe,
833
949
  name: l,
834
- raw: X,
950
+ raw: L,
835
951
  original: t,
836
- disabled: de || l === O && !de,
837
- type: typeof X == "boolean" ? "boolean" : "normal",
838
- group: ue,
839
- groupDisabled: q
952
+ disabled: J || l === H && !J,
953
+ type: typeof L == "boolean" ? "boolean" : "normal",
954
+ group: Q,
955
+ groupDisabled: _
840
956
  };
841
957
  }
842
958
  return {
843
- id: le,
959
+ id: N,
844
960
  userId: t,
845
961
  name: String(t),
846
962
  raw: t,
847
963
  original: t,
848
- disabled: q,
964
+ disabled: _,
849
965
  type: typeof t == "boolean" ? "boolean" : "normal",
850
- group: E
966
+ group: b
851
967
  };
852
- }, [ee, O, H, T]), e = pe(() => {
853
- const t = /* @__PURE__ */ new Map(), i = [], g = s.map((l, _) => {
968
+ }, [d, H, D, k]), r = xe(() => {
969
+ const t = /* @__PURE__ */ new Map(), f = [], a = s.map((l, T) => {
854
970
  if (l.isGroupMarker) return { ...l, type: "group-marker" };
855
- const G = !l.label && !l.userId && !l.value && (l.value === void 0 || l.value === null || l.value === "") && !l.hasJsx;
971
+ const V = !l.label && !l.userId && !l.value && (l.value === void 0 || l.value === null || l.value === "") && !l.hasJsx;
856
972
  return {
857
973
  ...l,
858
974
  id: `jsx-${l.id}`,
859
- index: _,
975
+ index: T,
860
976
  userId: l.userId,
861
977
  raw: l.value,
862
978
  original: l.value,
863
- name: G ? O : l.label || l.userId || String(l.value || ""),
864
- disabled: !!l.disabled || G,
979
+ name: V ? H : l.label || l.userId || String(l.value || ""),
980
+ disabled: !!l.disabled || V,
865
981
  type: typeof l.value == "boolean" ? "boolean" : "normal",
866
982
  group: l.group || null
867
983
  };
868
984
  });
869
- let E = 0;
870
- const q = (l, _ = null, G = !1, ae = "0") => {
871
- Array.isArray(l) || (l = [l]), l.forEach((C, Se) => {
872
- if (!C) return;
873
- const xe = `${ae}-${Se}`, me = typeof C == "object" && !Array.isArray(C);
874
- if (me && ("options" in C || "group" in C && !Oe.some((z) => z in C))) {
875
- const z = qe(C, !0) || "Empty group";
876
- t.has(z) || t.set(z, { disabled: !!C.disabled, closedByDefault: !!C.disabled || Q, items: [] }), C.options ? q(C.options, z, G || !!C.disabled, xe) : i.push({ id: `empty-${z}-${xe}`, name: z, group: z, isPlaceholder: !0, type: "group-marker", index: E++ });
877
- } else if (me && !Oe.some((z) => z in C) && !C.group)
878
- Object.entries(C).forEach(([z, Te], Ne) => {
879
- const $e = ie(Te, `${xe}-${Ne}`, "normal", _, G);
880
- i.push({ ...$e, index: E++ });
985
+ let b = 0;
986
+ const _ = (l, T = null, V = !1, le = "0") => {
987
+ Array.isArray(l) || (l = [l]), l.forEach((Y, me) => {
988
+ if (!Y) return;
989
+ const be = `${le}-${me}`, ve = typeof Y == "object" && !Array.isArray(Y);
990
+ if (ve && ("options" in Y || "group" in Y && !Le.some((X) => X in Y))) {
991
+ const X = Re(Y, !0) || "Empty group";
992
+ t.has(X) || t.set(X, { disabled: !!Y.disabled, closedByDefault: !!Y.disabled || q, items: [] }), Y.options ? _(Y.options, X, V || !!Y.disabled, be) : f.push({ id: `empty-${X}-${be}`, name: X, group: X, isPlaceholder: !0, type: "group-marker", index: b++ });
993
+ } else if (ve && !Le.some((X) => X in Y) && !Y.group)
994
+ Object.entries(Y).forEach(([X, Ee], Oe) => {
995
+ const Pe = ae(Ee, `${be}-${Oe}`, "normal", T, V);
996
+ f.push({ ...Pe, index: b++ });
881
997
  });
882
998
  else {
883
- const z = ie(C, xe, "normal", _, G);
884
- i.push({ ...z, index: E++ });
999
+ const X = ae(Y, be, "normal", T, V);
1000
+ f.push({ ...X, index: b++ });
885
1001
  }
886
1002
  });
887
1003
  };
888
- q(r);
889
- const le = ne ? [...g, ...i] : [...i, ...g];
890
- if (!K.current)
891
- K.current = new Map(le.map((l, _) => [l.id, _]));
1004
+ _(e);
1005
+ const N = ie ? [...a, ...f] : [...f, ...a];
1006
+ if (!re.current)
1007
+ re.current = new Map(N.map((l, T) => [l.id, T]));
892
1008
  else {
893
1009
  let l = !1;
894
- if (le.forEach((_) => {
895
- K.current.has(_.id) || (l = !0);
1010
+ if (N.forEach((T) => {
1011
+ re.current.has(T.id) || (l = !0);
896
1012
  }), l) {
897
- const _ = /* @__PURE__ */ new Map();
898
- le.forEach((G, ae) => {
899
- _.set(G.id, ae);
900
- }), K.current = _;
1013
+ const T = /* @__PURE__ */ new Map();
1014
+ N.forEach((V, le) => {
1015
+ T.set(V.id, le);
1016
+ }), re.current = T;
901
1017
  }
902
1018
  }
903
- const ue = [...le].sort((l, _) => {
904
- const G = K.current.get(l.id) ?? 999999, ae = K.current.get(_.id) ?? 999999;
905
- return G - ae;
906
- }), de = [], D = /* @__PURE__ */ new Set();
907
- ue.forEach((l) => {
1019
+ const Q = [...N].sort((l, T) => {
1020
+ const V = re.current.get(l.id) ?? 999999, le = re.current.get(T.id) ?? 999999;
1021
+ return V - le;
1022
+ }), J = [], pe = /* @__PURE__ */ new Set();
1023
+ Q.forEach((l) => {
908
1024
  if (!l.group)
909
- de.push({ type: "item", data: l });
910
- else if (D.has(l.group) || (D.add(l.group), de.push({ type: "group", name: l.group })), !l.isPlaceholder && !l.isGroupMarker) {
911
- const _ = t.get(l.group) || { items: [] };
912
- t.has(l.group) || t.set(l.group, _), _.items.push(l);
1025
+ J.push({ type: "item", data: l });
1026
+ else if (pe.has(l.group) || (pe.add(l.group), J.push({ type: "group", name: l.group })), !l.isPlaceholder && !l.isGroupMarker) {
1027
+ const T = t.get(l.group) || { items: [] };
1028
+ t.has(l.group) || t.set(l.group, T), T.items.push(l);
913
1029
  }
914
1030
  });
915
- const X = [];
916
- return de.forEach((l) => {
1031
+ const L = [];
1032
+ return J.forEach((l) => {
917
1033
  if (l.type === "item")
918
- X.push(l.data);
1034
+ L.push(l.data);
919
1035
  else {
920
- const _ = l.name, G = t.get(_), ae = A.has(_);
921
- X.push({
922
- id: `group-header-${_}`,
923
- name: _,
924
- disabled: !!G?.disabled,
1036
+ const T = l.name, V = t.get(T), le = G.has(T);
1037
+ L.push({
1038
+ id: `group-header-${T}`,
1039
+ name: T,
1040
+ disabled: !!V?.disabled,
925
1041
  groupHeader: !0,
926
- expanded: ae,
1042
+ expanded: le,
927
1043
  type: "group",
928
1044
  hidden: !1
929
- }), G?.items.forEach((C) => {
930
- X.push({ ...C, hidden: !ae });
1045
+ }), V?.items.forEach((Y) => {
1046
+ const me = G.size > 0 ? !le : !!q;
1047
+ L.push({ ...Y, hidden: me });
931
1048
  });
932
1049
  }
933
- }), S && F && X.push({
1050
+ }), z && A && L.push({
934
1051
  id: "special-load-more-id",
935
- name: U,
1052
+ name: Z,
936
1053
  loadMore: !0,
937
- loading: U === M,
1054
+ loading: Z === ee,
938
1055
  type: "special"
939
- }), X;
940
- }, [r, s, ee, ie, ne, S, F, U, M, Q, A, O]);
1056
+ }), L;
1057
+ }, [e, s, d, ae, ie, z, A, Z, ee, q, G, H]);
941
1058
  oe(() => {
942
- if (A.size > 0) return;
1059
+ if (!r || r.length === 0 || G.size > 0 || q) return;
943
1060
  const t = /* @__PURE__ */ new Set();
944
- e.forEach((i) => {
945
- i.groupHeader && !i.disabled && i.expanded !== !1 && t.add(i.name);
946
- }), t.size > 0 && se(t);
947
- }, [e]);
948
- const f = N((t) => {
1061
+ r.forEach((f) => {
1062
+ f.groupHeader && !f.disabled && t.add(f.name);
1063
+ }), t.size > 0 && W(t);
1064
+ }, [r, q]);
1065
+ const h = O((t) => {
949
1066
  if (t == null) return null;
950
- const i = e.find((g) => g.original === t || g.raw === t || g.userId === t);
951
- if (i) return i.id;
1067
+ const f = r.find((a) => a.original === t);
1068
+ if (f) return f.id;
952
1069
  if (typeof t == "object")
953
1070
  try {
954
- const g = JSON.stringify(t);
955
- return e.find(
956
- (E) => E.original && typeof E.original == "object" && JSON.stringify(E.original) === g
1071
+ const a = JSON.stringify(t);
1072
+ return r.find(
1073
+ (b) => b.original && typeof b.original == "object" && JSON.stringify(b.original) === a
957
1074
  )?.id ?? null;
958
1075
  } catch {
959
1076
  return null;
960
1077
  }
961
1078
  return null;
962
- }, [e]);
1079
+ }, [r]);
963
1080
  oe(() => {
964
- const t = x ? a : n, i = e.find((E) => E.id === y);
965
- i && (i.original === t || i.raw === t || i.userId === t) || R(f(t));
966
- }, [a, n, x, e, f, y]);
967
- const w = pe(
968
- () => e.find((t) => t.id === y) ?? null,
969
- [y, e]
970
- ), j = N((t, i) => {
1081
+ const t = F ? o : i;
1082
+ if (t == null || Array.isArray(t) && t.length === 0) {
1083
+ x(null), v([]);
1084
+ return;
1085
+ }
1086
+ const f = (a) => {
1087
+ const b = h(a), _ = r.find((Q) => Q.id === b);
1088
+ if (_) return _;
1089
+ const N = typeof a == "object" ? a.id || a.value || JSON.stringify(a) : String(a);
1090
+ return typeof a == "object" && a !== null ? {
1091
+ id: `virtual-${N}`,
1092
+ name: Re(a) || String(a.id || "Selected Object"),
1093
+ raw: a.value ?? a.id ?? a,
1094
+ original: a,
1095
+ userId: a.id ?? a.value ?? null,
1096
+ virtual: !0
1097
+ } : {
1098
+ id: `virtual-${N}`,
1099
+ name: String(a),
1100
+ raw: a,
1101
+ original: a,
1102
+ userId: a,
1103
+ virtual: !0
1104
+ };
1105
+ };
1106
+ if (p) {
1107
+ const b = (Array.isArray(t) ? t : [t]).map(f);
1108
+ v(b);
1109
+ } else {
1110
+ const a = Array.isArray(t) ? t[0] : t, b = f(a);
1111
+ x((_) => _ === b.id ? _ : b.id);
1112
+ }
1113
+ }, []);
1114
+ const j = xe(() => {
1115
+ const t = r.find((f) => f.id === g);
1116
+ if (t) return t;
1117
+ if (!p && g?.startsWith("virtual-")) {
1118
+ const f = F ? o : i, a = Array.isArray(f) ? f[0] : f;
1119
+ if (a)
1120
+ return {
1121
+ id: g,
1122
+ name: typeof a == "object" ? Re(a) : String(a),
1123
+ original: a
1124
+ };
1125
+ }
1126
+ return null;
1127
+ }, [g, r, p, F, o, i]), P = O((t, f) => {
971
1128
  if (t.groupHeader) {
972
- i?.stopPropagation(), i?.preventDefault(), t.disabled || re(t.name);
1129
+ f?.stopPropagation(), f?.preventDefault(), t.disabled || de(t.name);
973
1130
  return;
974
1131
  }
975
1132
  if (t.disabled || t.loadMore) {
976
- i?.stopPropagation(), i?.preventDefault(), t.loadMore && !t.loading && (u(M), B());
1133
+ f?.stopPropagation(), f?.preventDefault(), t.loadMore && !t.loading && (M(ee), se());
977
1134
  return;
978
1135
  }
979
- if (h) {
1136
+ if (p) {
980
1137
  if (t.disabled || t.groupHeader || t.loadMore) {
981
- i?.stopPropagation(), i?.preventDefault();
1138
+ f?.stopPropagation(), f?.preventDefault();
982
1139
  return;
983
1140
  }
984
- i?.stopPropagation(), i?.preventDefault(), Y((g) => g.some((E) => E.id === t.id) ? g.filter((E) => E.id !== t.id) : [...g, t]);
1141
+ f?.stopPropagation(), f?.preventDefault();
1142
+ const b = y?.some((_) => _.id === t.id) ? y.filter((_) => _.id !== t.id) : [...y, t];
1143
+ v(b), c?.(b.map((_) => _.original), b.map((_) => _.userId));
985
1144
  return;
986
1145
  }
987
- R(t.id), d?.(t.original, t.userId), W(!1);
988
- }, [d, W, B, M, u, re]), Z = N(() => {
989
- R(null), d?.(null, null);
990
- }, [d]);
1146
+ x(t.id), c?.(t.original, t.userId), C(!1);
1147
+ }, [c, C, se, ee, M, de]), te = O(() => {
1148
+ x(null), v([]), c?.(null, null);
1149
+ }, [c]), ne = O((t) => {
1150
+ const f = y.filter((a) => a.id !== t);
1151
+ v(f), c?.(f.map((a) => a.original), f.map((a) => a.userId));
1152
+ }, [y, c]);
991
1153
  return {
992
- normalizedOptions: e,
993
- selected: w,
994
- selectOption: j,
995
- clear: Z,
996
- hasOptions: e.length > 0,
997
- active: !m && !v && !c && e.length > 0,
998
- selectedValue: a ?? n,
999
- placeholder: p,
1000
- emptyText: I,
1001
- disabledText: L,
1002
- loadingText: k,
1003
- errorText: P,
1004
- disabledOption: T,
1005
- emptyOption: O,
1006
- invalidOption: H,
1007
- disabled: c,
1008
- loading: v,
1009
- error: m,
1010
- expandedGroups: A,
1011
- toggleGroup: re,
1012
- selectedIDs: J,
1013
- multiple: h,
1014
- setSelectedIds: Y
1154
+ normalizedOptions: r,
1155
+ selected: j,
1156
+ selectOption: P,
1157
+ clear: te,
1158
+ removeOption: ne,
1159
+ hasOptions: r.length > 0,
1160
+ active: !S && !w && !n && r.length > 0,
1161
+ selectedValue: o ?? i,
1162
+ placeholder: $,
1163
+ emptyText: R,
1164
+ disabledText: E,
1165
+ loadingText: K,
1166
+ errorText: U,
1167
+ disabledOption: k,
1168
+ emptyOption: H,
1169
+ invalidOption: D,
1170
+ disabled: n,
1171
+ loading: w,
1172
+ error: S,
1173
+ expandedGroups: G,
1174
+ toggleGroup: de,
1175
+ selectedIDs: y,
1176
+ multiple: p,
1177
+ setSelectedIds: v
1015
1178
  };
1016
1179
  }
1017
- function wr({ visibility: r, children: s, duration: a = 300 }) {
1018
- const n = he(null);
1019
- return /* @__PURE__ */ o.jsx(
1020
- ke,
1180
+ function Rr({ visibility: e, children: s, duration: o = 300 }) {
1181
+ const i = ue(null);
1182
+ return /* @__PURE__ */ u.jsx(
1183
+ Ae,
1021
1184
  {
1022
- in: r,
1185
+ in: e,
1023
1186
  timeout: 300,
1024
1187
  classNames: "slideDown",
1025
1188
  unmountOnExit: !0,
1026
- nodeRef: n,
1027
- onEnter: () => n.current.style.height = "0px",
1028
- onEntering: () => n.current.style.height = n.current.scrollHeight + "px",
1029
- onEntered: () => n.current.style.height = "auto",
1030
- onExit: () => n.current.style.height = n.current.scrollHeight + "px",
1031
- onExiting: () => n.current.style.height = "0px",
1032
- children: /* @__PURE__ */ o.jsx(
1189
+ nodeRef: i,
1190
+ onEnter: () => i.current.style.height = "0px",
1191
+ onEntering: () => i.current.style.height = i.current.scrollHeight + "px",
1192
+ onEntered: () => i.current.style.height = "auto",
1193
+ onExit: () => i.current.style.height = i.current.scrollHeight + "px",
1194
+ onExiting: () => i.current.style.height = "0px",
1195
+ children: /* @__PURE__ */ u.jsx(
1033
1196
  "div",
1034
1197
  {
1035
- ref: n,
1198
+ ref: i,
1036
1199
  style: {
1037
1200
  overflow: "hidden",
1038
- transition: `height ${a}ms ease`,
1201
+ transition: `height ${o}ms ease`,
1039
1202
  paddingLeft: "1em"
1040
1203
  },
1041
1204
  className: "slideDown-enter-done",
@@ -1046,268 +1209,271 @@ function wr({ visibility: r, children: s, duration: a = 300 }) {
1046
1209
  }
1047
1210
  );
1048
1211
  }
1049
- const Pe = (r, s) => {
1050
- if (!r) return null;
1051
- if (typeof r == "string") return /* @__PURE__ */ o.jsx("img", { src: r, ...s, alt: "" });
1052
- if (cr(r)) return ur(r, s);
1053
- if (typeof r == "function" || typeof r == "object" && r.$$typeof) {
1054
- const a = r;
1055
- return /* @__PURE__ */ o.jsx(a, { ...s });
1212
+ const He = (e, s) => {
1213
+ if (!e) return null;
1214
+ if (typeof e == "string") return /* @__PURE__ */ u.jsx("img", { src: e, ...s, alt: "" });
1215
+ if (gr(e)) return hr(e, s);
1216
+ if (typeof e == "function" || typeof e == "object" && e.$$typeof) {
1217
+ const o = e;
1218
+ return /* @__PURE__ */ u.jsx(o, { ...s });
1056
1219
  }
1057
1220
  return null;
1058
- }, Sr = (r, s, a, n, d, c, v, m) => {
1059
- const h = m.some((p) => p.id === r.id);
1060
- return r.groupHeader ? "rac-select-option rac-group-option" : [
1221
+ }, kr = (e, s, o, i, c, n, w, S) => {
1222
+ const p = S?.some(($) => $.id === e.id);
1223
+ return e.groupHeader ? "rac-select-option rac-group-option" : [
1061
1224
  "rac-select-option",
1062
- r.className,
1063
- (h || n === r.id) && "rac-selected",
1064
- s === a && "rac-highlighted",
1065
- (r.disabled || r.loading) && "rac-disabled-option",
1066
- (r.invalid || r.name === v) && "rac-invalid-option",
1067
- r.loadMore && d === c && "rac-loading-option",
1068
- typeof r.raw == "boolean" && (r.raw ? "rac-true-option" : "rac-false-option")
1225
+ e.className,
1226
+ (p || i === e.id) && "rac-selected",
1227
+ s === o && "rac-highlighted",
1228
+ (e.disabled || e.loading) && "rac-disabled-option",
1229
+ (e.invalid || e.name === w) && "rac-invalid-option",
1230
+ e.loadMore && c === n && "rac-loading-option",
1231
+ typeof e.raw == "boolean" && (e.raw ? "rac-true-option" : "rac-false-option")
1069
1232
  ].filter(Boolean).join(" ");
1070
- }, Tr = ar(({
1071
- unmount: r,
1233
+ }, Cr = dr(({
1234
+ unmount: e,
1072
1235
  children: s,
1073
- renderedDropdown: a,
1074
- visibility: n,
1075
- ownBehavior: d = !1,
1236
+ visibility: o,
1237
+ ownBehavior: i = !1,
1076
1238
  alwaysOpen: c = !1,
1077
- duration: v = 300,
1078
- easing: m = "ease-out",
1079
- offset: h = 2,
1239
+ duration: n = 300,
1240
+ easing: w = "ease-out",
1241
+ offset: S = 0,
1080
1242
  animateOpacity: p = !0,
1081
- style: I = {},
1082
- className: L = "",
1083
- ArrowIcon: k = pr,
1084
- ClearIcon: P = We,
1085
- DelIcon: T = We,
1086
- CheckIcon: O = Me,
1243
+ style: $ = {},
1244
+ className: R = "",
1245
+ ArrowIcon: E = Er,
1246
+ ClearIcon: K = Ue,
1247
+ DelIcon: U = Ue,
1248
+ CheckIcon: k = Me,
1087
1249
  hasMore: H = !1,
1088
- loadMore: W = () => {
1250
+ loadMore: D = () => {
1089
1251
  console.warn("loadMore not implemented");
1090
1252
  },
1091
- loadButton: S = !1,
1092
- loadButtonText: F = "Load more",
1093
- loadMoreText: u = "Loading",
1094
- loadOffset: U = 100,
1095
- loadAhead: M = 3,
1096
- childrenFirst: B = !1,
1097
- groupsClosed: ne = !1,
1098
- ...Q
1099
- }, ee) => {
1100
- const x = Le(), y = pe(() => x.replace(/:/g, ""), [x]), [R, J] = ge([]), [Y, A] = ge(!1), [se, K] = ge(S ? F : u), [re, ie] = ge(!1), e = he(null), f = N(($) => {
1101
- J((V) => {
1102
- const te = V.findIndex((ce) => ce.id === $.id);
1103
- if (te !== -1) {
1104
- const ce = V[te];
1105
- if (ce.label === $.label && ce.value === $.value && ce.disabled === $.disabled && ce.group === $.group)
1106
- return V;
1107
- const ve = [...V];
1108
- return ve[te] = $, ve;
1253
+ loadButton: C = !1,
1254
+ loadButtonText: z = "Load more",
1255
+ loadMoreText: A = "Loading",
1256
+ selectedText: M = void 0,
1257
+ loadOffset: Z = 100,
1258
+ loadAhead: ee = 3,
1259
+ childrenFirst: se = !1,
1260
+ groupsClosed: ie = !1,
1261
+ optionsClassName: q = "",
1262
+ ...d
1263
+ }, F) => {
1264
+ const g = Ye(), x = xe(() => g.replace(/:/g, ""), [g]), [y, v] = fe([]), [G, W] = fe(!1), [re, de] = fe(C ? z : A), [ae, r] = fe(!1), h = ue(null), j = O((I) => {
1265
+ v((B) => {
1266
+ const ce = B.findIndex((ge) => ge.id === I.id);
1267
+ if (ce !== -1) {
1268
+ const ge = B[ce];
1269
+ if (ge.label === I.label && ge.value === I.value && ge.disabled === I.disabled && ge.group === I.group)
1270
+ return B;
1271
+ const je = [...B];
1272
+ return je[ce] = I, je;
1109
1273
  }
1110
- return [...V, $];
1274
+ return [...B, I];
1111
1275
  });
1112
- }, []), w = N(($) => {
1113
- J((V) => {
1114
- const te = V.filter((ce) => ce.id !== $);
1115
- return te.length === V.length ? V : te;
1276
+ }, []), P = O((I) => {
1277
+ v((B) => {
1278
+ const ce = B.filter((ge) => ge.id !== I);
1279
+ return ce.length === B.length ? B : ce;
1116
1280
  });
1117
- }, []), j = c ? !0 : d ? !!n : Y, Z = N(($) => {
1118
- c || d || A($);
1119
- }, [c, d]), t = jr({
1120
- ...Q,
1121
- setVisibility: Z,
1122
- jsxOptions: R,
1281
+ }, []), te = c ? !0 : i ? !!o : G, ne = O((I) => {
1282
+ c || i || W(I);
1283
+ }, [c, i]), t = Nr({
1284
+ ...d,
1285
+ setVisibility: ne,
1286
+ jsxOptions: y,
1123
1287
  hasMore: H,
1124
- loadButton: S,
1125
- loadingTitle: se,
1126
- loadMore: W,
1127
- loadMoreText: u,
1128
- setLoadingTitle: K,
1129
- childrenFirst: B,
1130
- groupsClosed: ne
1131
- }), { multiple: i, normalizedOptions: g, selected: E, selectOption: q, clear: le, hasOptions: ue, active: de, selectedValue: D, disabled: X, loading: l, error: _, placeholder: G, invalidOption: ae, emptyText: C, disabledText: Se, loadingText: xe, errorText: me, expandedGroups: Ee, selectedIDs: z, setSelectedIds: Te } = t, Ne = Er({ setLoadingTitle: K, loadButton: S, loadButtonText: F, hasMore: H, loadMore: W, disabled: X, multiple: i, open: j, setOpen: Z, options: g, selectOption: q, selected: E, loadOffset: U, loadAhead: M, expandedGroups: Ee }), { handleListScroll: $e, handleBlur: Be, handleFocus: Qe, handleToggle: er, handleKeyDown: rr, highlightedIndex: ye, setHighlightedIndex: Ae } = Ne;
1132
- or(ee, () => e.current), oe(() => {
1133
- j || ie(!1);
1134
- }, [j]), oe(() => {
1135
- (_ || X || l || !ue) && Z(!1);
1136
- }, [_, X, l, ue, Z]), oe(() => {
1137
- if (j && re && ye !== -1) {
1138
- const $ = g[ye];
1139
- $ && document.getElementById(`opt-${y}-${Je($.id)}`)?.scrollIntoView({ block: "nearest" });
1288
+ loadButton: C,
1289
+ loadingTitle: re,
1290
+ loadMore: D,
1291
+ loadMoreText: A,
1292
+ setLoadingTitle: de,
1293
+ childrenFirst: se,
1294
+ groupsClosed: ie
1295
+ }), { multiple: f, normalizedOptions: a, selected: b, selectOption: _, clear: N, removeOption: Q, hasOptions: J, active: pe, selectedValue: L, disabled: l, loading: T, error: V, placeholder: le, invalidOption: Y, emptyText: me, disabledText: be, loadingText: ve, errorText: Te, expandedGroups: X, selectedIDs: Ee, setSelectedIds: Oe } = t, Pe = $r({ setLoadingTitle: de, loadButton: C, loadButtonText: z, hasMore: H, loadMore: D, disabled: l, multiple: f, open: te, setOpen: ne, options: a, selectOption: _, selected: b, loadOffset: Z, loadAhead: ee, expandedGroups: X, selectedIDs: Ee }), { handleListScroll: rr, handleBlur: tr, handleFocus: nr, handleToggle: sr, handleKeyDown: ir, highlightedIndex: we, setHighlightedIndex: Ce } = Pe;
1296
+ fr(F, () => h.current), oe(() => {
1297
+ te || r(!1);
1298
+ }, [te]), oe(() => {
1299
+ (V || l || T || !J) && ne(!1);
1300
+ }, [V, l, T, J, ne]), oe(() => {
1301
+ if (te && ae && we !== -1) {
1302
+ const I = a[we];
1303
+ I && document.getElementById(`opt-${x}-${qe(I.id)}`)?.scrollIntoView({ block: "nearest" });
1140
1304
  }
1141
- }, [ye, j, re, g, y]);
1142
- const Ce = pe(() => D != null && !(Array.isArray(D) && D.length === 0) && !(typeof D == "object" && Object.keys(D).length === 0), [D]), tr = pe(() => {
1143
- if (_) return me;
1144
- if (l) return xe;
1145
- if (X) return Se;
1146
- if (E) return E.jsx ?? E.name;
1147
- if (Ce) {
1148
- const $ = g.find((V) => V.raw === D);
1149
- return $ ? $.name : typeof D == "object" && D !== null ? D.name ?? D.label ?? "Selected Object" : String(D);
1305
+ }, [we, te, ae, a, x]);
1306
+ const _e = xe(() => L != null && !(Array.isArray(L) && L.length === 0) && !(typeof L == "object" && Object.keys(L).length === 0), [L]), or = xe(() => {
1307
+ if (V) return Te;
1308
+ if (T) return ve;
1309
+ if (l) return be;
1310
+ if (_e && M) return M;
1311
+ if (b) return b.jsx ?? b.name;
1312
+ if (_e) {
1313
+ const I = a.find((B) => B.raw === L);
1314
+ return I ? I.name : typeof L == "object" && L !== null ? L.name ?? L.label ?? "Selected Object" : String(L);
1150
1315
  }
1151
- return ue ? G : C;
1152
- }, [X, l, _, ue, E, D, G, me, xe, Se, C, Ce, g]), nr = pe(() => {
1153
- const $ = [];
1154
- let V = [], te = null;
1155
- const ce = g.reduce((b, fe) => (fe.group && (b[fe.group] = (b[fe.group] || 0) + 1), b), {}), ve = (b) => {
1156
- b === null || V.length === 0 || ($.push(
1157
- /* @__PURE__ */ o.jsx(
1158
- wr,
1316
+ return J ? le : me;
1317
+ }, [l, T, V, J, b, L, le, Te, ve, be, me, _e, a]), ar = xe(() => {
1318
+ const I = [];
1319
+ let B = [], ce = null;
1320
+ const ge = a.reduce((m, he) => (he.group && (m[he.group] = (m[he.group] || 0) + 1), m), {}), je = (m) => {
1321
+ m === null || B.length === 0 || (I.push(
1322
+ /* @__PURE__ */ u.jsx(
1323
+ Rr,
1159
1324
  {
1160
- visibility: Ee.has(b),
1161
- children: V
1325
+ visibility: X.has(m),
1326
+ children: B
1162
1327
  },
1163
- `slide-${b}`
1328
+ `slide-${m}`
1164
1329
  )
1165
- ), V = []);
1166
- }, He = (b, fe) => /* @__PURE__ */ o.jsxs(
1330
+ ), B = []);
1331
+ }, ze = (m, he) => /* @__PURE__ */ u.jsxs(
1167
1332
  "div",
1168
1333
  {
1169
- id: `opt-${y}-${Je(b.id)}`,
1334
+ id: `opt-${x}-${qe(m.id)}`,
1170
1335
  role: "option",
1171
- "aria-selected": E?.id === b.id,
1172
- "aria-disabled": b.disabled || b.loading,
1173
- className: Sr(b, fe, ye, E?.id, se, u, ae, z),
1174
- onClick: (be) => !b.loading && q(b, be),
1175
- onMouseEnter: () => !b.disabled && !b.loading && Ae(fe),
1336
+ "aria-selected": b?.id === m.id,
1337
+ "aria-disabled": m.disabled || m.loading,
1338
+ className: kr(m, he, we, b?.id, re, A, Y, Ee),
1339
+ onClick: (ye) => !m.loading && _(m, ye),
1340
+ onMouseEnter: () => !m.disabled && !m.loading && Ce(he),
1176
1341
  children: [
1177
- b.jsx ?? b.name,
1178
- b.loading && /* @__PURE__ */ o.jsxs("span", { className: "rac-loading-dots", children: [
1179
- /* @__PURE__ */ o.jsx("i", {}),
1180
- /* @__PURE__ */ o.jsx("i", {}),
1181
- /* @__PURE__ */ o.jsx("i", {})
1342
+ m.jsx ?? /* @__PURE__ */ u.jsx("span", { className: "rac-option-title", children: m.name }),
1343
+ m.loading && /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
1344
+ /* @__PURE__ */ u.jsx("i", {}),
1345
+ /* @__PURE__ */ u.jsx("i", {}),
1346
+ /* @__PURE__ */ u.jsx("i", {})
1182
1347
  ] }),
1183
- i && !b.disabled ? /* @__PURE__ */ o.jsx("div", { className: "rac-checkbox", children: Pe(
1348
+ f && !m.disabled ? /* @__PURE__ */ u.jsx("div", { className: "rac-checkbox", children: He(
1184
1349
  Me,
1185
1350
  {
1186
1351
  className: `
1187
1352
  rac-checkmark
1188
- ${z.some((be) => be.id === b.id) ? "--checked" : ""}`
1353
+ ${Ee?.some((ye) => ye.id === m.id) ? "--checked" : ""}`
1189
1354
  }
1190
1355
  ) }) : null
1191
1356
  ]
1192
1357
  },
1193
- b.id
1358
+ m.id
1194
1359
  );
1195
- return g.forEach((b, fe) => {
1196
- const be = b.groupHeader, Fe = !!b.group;
1197
- if ((be || !Fe && te !== null) && (ve(te), be || (te = null)), be) {
1198
- te = b.name;
1199
- const sr = Ee.has(b.name), ir = ce[b.name] > 0;
1200
- $.push(
1201
- /* @__PURE__ */ o.jsxs(
1360
+ return a.forEach((m, he) => {
1361
+ const ye = m.groupHeader, Fe = !!m.group;
1362
+ if ((ye || !Fe && ce !== null) && (je(ce), ye || (ce = null)), ye) {
1363
+ ce = m.name;
1364
+ const lr = X.has(m.name), cr = ge[m.name] > 0;
1365
+ I.push(
1366
+ /* @__PURE__ */ u.jsxs(
1202
1367
  "div",
1203
1368
  {
1204
1369
  className: [
1205
1370
  "rac-group-header",
1206
- b.disabled && "rac-disabled-group"
1371
+ m.disabled && "rac-disabled-group"
1207
1372
  ].filter(Boolean).join(" "),
1208
- onClick: (lr) => q(b, lr),
1373
+ onClick: (ur) => _(m, ur),
1209
1374
  children: [
1210
- /* @__PURE__ */ o.jsx("span", { className: "rac-group-title-text", children: b.name }),
1211
- /* @__PURE__ */ o.jsx(
1212
- Re,
1375
+ /* @__PURE__ */ u.jsx("span", { className: "rac-group-title-text", children: m.name }),
1376
+ /* @__PURE__ */ u.jsx(
1377
+ ke,
1213
1378
  {
1214
- visibility: ir && !b.disabled,
1215
- duration: v,
1216
- style: { display: "grid" },
1217
- children: /* @__PURE__ */ o.jsx("span", { className: `rac-group-arrow-wrapper ${sr ? "--open" : ""}`, children: Pe(k, { className: "rac-select-arrow-wrapper" }) })
1379
+ visibility: cr && !m.disabled,
1380
+ duration: n,
1381
+ children: /* @__PURE__ */ u.jsx("span", { className: `rac-group-arrow-wrapper ${lr ? "--open" : ""}`, children: He(E, { className: "rac-select-arrow-wrapper" }) })
1218
1382
  }
1219
1383
  )
1220
1384
  ]
1221
1385
  },
1222
- b.id
1386
+ m.id
1223
1387
  )
1224
1388
  );
1225
- } else Fe ? V.push(He(b, fe)) : $.push(He(b, fe));
1226
- }), ve(te), $;
1389
+ } else Fe ? B.push(ze(m, he)) : I.push(ze(m, he));
1390
+ }), je(ce), I;
1227
1391
  }, [
1228
- g,
1229
- q,
1230
- y,
1231
- E,
1232
- ye,
1233
- se,
1234
- u,
1235
- ae,
1236
- Ae,
1237
- Ee,
1238
- k
1392
+ a,
1393
+ _,
1394
+ x,
1395
+ b,
1396
+ we,
1397
+ re,
1398
+ A,
1399
+ Y,
1400
+ Ce,
1401
+ X,
1402
+ E
1239
1403
  ]);
1240
- return /* @__PURE__ */ o.jsx(
1241
- mr,
1404
+ return /* @__PURE__ */ u.jsx(
1405
+ Sr,
1242
1406
  {
1243
- selectRef: e,
1244
- selectId: y,
1245
- selectedIDs: z,
1246
- setSelectedIds: Te,
1247
- multiple: i,
1248
- renderIcon: Pe,
1249
- normalizedOptions: g,
1250
- renderOptions: nr,
1251
- selected: E,
1252
- title: tr,
1253
- visibility: j,
1254
- active: de,
1255
- hasOptions: ue,
1256
- hasActualValue: Ce,
1257
- highlightedIndex: ye,
1258
- animationFinished: re,
1259
- disabled: X,
1260
- loading: l,
1261
- error: _,
1262
- setVisibility: Z,
1263
- setHighlightedIndex: Ae,
1264
- setAnimationFinished: ie,
1265
- handleBlur: Be,
1266
- handleFocus: Qe,
1267
- handleToggle: er,
1268
- handleKeyDown: rr,
1269
- handleListScroll: $e,
1270
- selectOption: q,
1271
- clear: le,
1272
- registerOption: f,
1273
- unregisterOption: w,
1407
+ selectedText: M,
1408
+ selectRef: h,
1409
+ selectId: x,
1410
+ selectedIDs: Ee,
1411
+ setSelectedIds: Oe,
1412
+ multiple: f,
1413
+ removeOption: Q,
1414
+ optionsClassName: q,
1415
+ renderIcon: He,
1416
+ normalizedOptions: a,
1417
+ renderOptions: ar,
1418
+ selected: b,
1419
+ title: or,
1420
+ visibility: te,
1421
+ active: pe,
1422
+ hasOptions: J,
1423
+ hasActualValue: _e,
1424
+ highlightedIndex: we,
1425
+ animationFinished: ae,
1426
+ disabled: l,
1427
+ loading: T,
1428
+ error: V,
1429
+ setVisibility: ne,
1430
+ setHighlightedIndex: Ce,
1431
+ setAnimationFinished: r,
1432
+ handleBlur: tr,
1433
+ handleFocus: nr,
1434
+ handleToggle: sr,
1435
+ handleKeyDown: ir,
1436
+ handleListScroll: rr,
1437
+ selectOption: _,
1438
+ clear: N,
1439
+ registerOption: j,
1440
+ unregisterOption: P,
1274
1441
  children: s,
1275
- renderedDropdown: a,
1276
- placeholder: G,
1277
- className: L,
1278
- style: I,
1279
- duration: v,
1280
- easing: m,
1281
- offset: h,
1442
+ placeholder: le,
1443
+ className: R,
1444
+ style: $,
1445
+ duration: n,
1446
+ easing: w,
1447
+ offset: S,
1282
1448
  animateOpacity: p,
1283
- unmount: r,
1284
- ArrowIcon: k,
1285
- ClearIcon: P,
1286
- DelIcon: T,
1449
+ unmount: e,
1450
+ ArrowIcon: E,
1451
+ ClearIcon: K,
1452
+ DelIcon: U,
1287
1453
  hasMore: H,
1288
- loadButton: S
1454
+ loadButton: C
1289
1455
  }
1290
1456
  );
1291
- }), _r = Ke(null), De = (r) => r ? typeof r == "string" || typeof r == "number" ? String(r) : Array.isArray(r) ? r.map(De).join(" ").replace(/\s+/g, " ").trim() : Xe.isValidElement(r) ? De(r.props.children) : "" : "";
1292
- function Nr({ value: r, id: s, className: a, children: n, disabled: d, group: c }) {
1293
- const v = Ye(Ze), m = Ye(_r), h = v?.registerOption, p = v?.unregisterOption, I = Le(), L = pe(() => s ? String(s) : I.replace(/:/g, ""), [s, I]);
1457
+ }), Ar = Ze(null), De = (e) => e ? typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(De).join(" ").replace(/\s+/g, " ").trim() : Be.isValidElement(e) ? De(e.props.children) : "" : "";
1458
+ function Hr({ value: e, id: s, className: o, children: i, disabled: c, group: n }) {
1459
+ const w = Ge(er), S = Ge(Ar), p = w?.registerOption, $ = w?.unregisterOption, R = Ye(), E = xe(() => s ? String(s) : R.replace(/:/g, ""), [s, R]);
1294
1460
  return oe(() => {
1295
- if (!h) return;
1296
- const k = De(n), P = n != null;
1297
- let T = "";
1298
- return k ? T = k : s != null && s !== "" ? T = String(s) : r != null && r !== "" && (T = String(r)), h({
1299
- id: L,
1300
- value: r !== void 0 ? r : k,
1301
- label: T,
1302
- jsx: n,
1303
- hasJsx: P,
1304
- className: a,
1305
- disabled: !!d,
1306
- group: c || m || null
1307
- }), () => p(L);
1308
- }, [L, r, n, a, d, c, m, h, p]), null;
1461
+ if (!p) return;
1462
+ const K = De(i), U = i != null;
1463
+ let k = "";
1464
+ return K ? k = K : s != null && s !== "" ? k = String(s) : e != null && e !== "" && (k = String(e)), p({
1465
+ id: E,
1466
+ value: e !== void 0 ? e : K,
1467
+ label: k,
1468
+ jsx: i,
1469
+ hasJsx: U,
1470
+ className: o,
1471
+ disabled: !!c,
1472
+ group: n || S || null
1473
+ }), () => $(E);
1474
+ }, [E, e, i, o, c, n, S, p, $]), null;
1309
1475
  }
1310
1476
  export {
1311
- Nr as Option,
1312
- Tr as Select
1477
+ Hr as Option,
1478
+ Cr as Select
1313
1479
  };