react-animated-select 0.4.1 → 0.5.2

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