react-animated-select 0.3.1 → 0.3.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,149 +1,149 @@
1
- import _e, { createContext as De, useRef as re, useState as te, useEffect as z, useCallback as R, useMemo as ne, useId as Se, memo as Fe, forwardRef as Ye, useImperativeHandle as Ve, isValidElement as He, cloneElement as We, useContext as ze } from "react";
2
- import { CSSTransition as Re } from "react-transition-group";
3
- import './index.css';var ae = { exports: {} }, ie = {};
4
- var Ee;
5
- function Ue() {
6
- if (Ee) return ie;
7
- Ee = 1;
8
- var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.fragment");
9
- function c(i, b, d) {
1
+ import Fe, { createContext as He, memo as Ye, useRef as ce, useState as ae, useEffect as B, useCallback as T, useMemo as se, useId as Re, forwardRef as Qe, useImperativeHandle as Be, isValidElement as er, cloneElement as rr, useContext as we } from "react";
2
+ import { CSSTransition as ke } from "react-transition-group";
3
+ import './index.css';var ye = { exports: {} }, be = {};
4
+ var Oe;
5
+ function tr() {
6
+ if (Oe) return be;
7
+ Oe = 1;
8
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), n = /* @__PURE__ */ Symbol.for("react.fragment");
9
+ function o(s, f, c) {
10
10
  var p = null;
11
- if (d !== void 0 && (p = "" + d), b.key !== void 0 && (p = "" + b.key), "key" in b) {
12
- d = {};
13
- for (var $ in b)
14
- $ !== "key" && (d[$] = b[$]);
15
- } else d = b;
16
- return b = d.ref, {
11
+ if (c !== void 0 && (p = "" + c), f.key !== void 0 && (p = "" + f.key), "key" in f) {
12
+ c = {};
13
+ for (var v in f)
14
+ v !== "key" && (c[v] = f[v]);
15
+ } else c = f;
16
+ return f = c.ref, {
17
17
  $$typeof: t,
18
- type: i,
18
+ type: s,
19
19
  key: p,
20
- ref: b !== void 0 ? b : null,
21
- props: d
20
+ ref: f !== void 0 ? f : null,
21
+ props: c
22
22
  };
23
23
  }
24
- return ie.Fragment = s, ie.jsx = c, ie.jsxs = c, ie;
24
+ return be.Fragment = n, be.jsx = o, be.jsxs = o, be;
25
25
  }
26
- var le = {};
27
- var me;
28
- function Je() {
29
- return me || (me = 1, process.env.NODE_ENV !== "production" && (function() {
26
+ var me = {};
27
+ var Ce;
28
+ function nr() {
29
+ return Ce || (Ce = 1, process.env.NODE_ENV !== "production" && (function() {
30
30
  function t(e) {
31
31
  if (e == null) return null;
32
32
  if (typeof e == "function")
33
- return e.$$typeof === m ? null : e.displayName || e.name || null;
33
+ return e.$$typeof === M ? null : e.displayName || e.name || null;
34
34
  if (typeof e == "string") return e;
35
35
  switch (e) {
36
- case w:
36
+ case S:
37
37
  return "Fragment";
38
- case C:
38
+ case D:
39
39
  return "Profiler";
40
- case P:
40
+ case H:
41
41
  return "StrictMode";
42
- case X:
42
+ case J:
43
43
  return "Suspense";
44
- case I:
44
+ case U:
45
45
  return "SuspenseList";
46
- case g:
46
+ case E:
47
47
  return "Activity";
48
48
  }
49
49
  if (typeof e == "object")
50
50
  switch (typeof e.tag == "number" && console.error(
51
51
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
52
52
  ), e.$$typeof) {
53
- case _:
53
+ case F:
54
54
  return "Portal";
55
- case u:
55
+ case d:
56
56
  return e.displayName || "Context";
57
- case V:
57
+ case W:
58
58
  return (e._context.displayName || "Context") + ".Consumer";
59
- case D:
60
- var n = e.render;
61
- return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
- case J:
63
- return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
64
- case Y:
65
- n = e._payload, e = e._init;
59
+ case I:
60
+ var r = e.render;
61
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
+ case z:
63
+ return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
64
+ case g:
65
+ r = e._payload, e = e._init;
66
66
  try {
67
- return t(e(n));
67
+ return t(e(r));
68
68
  } catch {
69
69
  }
70
70
  }
71
71
  return null;
72
72
  }
73
- function s(e) {
73
+ function n(e) {
74
74
  return "" + e;
75
75
  }
76
- function c(e) {
76
+ function o(e) {
77
77
  try {
78
- s(e);
79
- var n = !1;
78
+ n(e);
79
+ var r = !1;
80
80
  } catch {
81
- n = !0;
81
+ r = !0;
82
82
  }
83
- if (n) {
84
- n = console;
85
- var r = n.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
- return r.call(
87
- n,
83
+ if (r) {
84
+ r = console;
85
+ var l = r.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
+ return l.call(
87
+ r,
88
88
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
89
  a
90
- ), s(e);
90
+ ), n(e);
91
91
  }
92
92
  }
93
- function i(e) {
94
- if (e === w) return "<>";
95
- if (typeof e == "object" && e !== null && e.$$typeof === Y)
93
+ function s(e) {
94
+ if (e === S) return "<>";
95
+ if (typeof e == "object" && e !== null && e.$$typeof === g)
96
96
  return "<...>";
97
97
  try {
98
- var n = t(e);
99
- return n ? "<" + n + ">" : "<...>";
98
+ var r = t(e);
99
+ return r ? "<" + r + ">" : "<...>";
100
100
  } catch {
101
101
  return "<...>";
102
102
  }
103
103
  }
104
- function b() {
105
- var e = L.A;
104
+ function f() {
105
+ var e = O.A;
106
106
  return e === null ? null : e.getOwner();
107
107
  }
108
- function d() {
108
+ function c() {
109
109
  return Error("react-stack-top-frame");
110
110
  }
111
111
  function p(e) {
112
- if (x.call(e, "key")) {
113
- var n = Object.getOwnPropertyDescriptor(e, "key").get;
114
- if (n && n.isReactWarning) return !1;
112
+ if (Y.call(e, "key")) {
113
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
114
+ if (r && r.isReactWarning) return !1;
115
115
  }
116
116
  return e.key !== void 0;
117
117
  }
118
- function $(e, n) {
119
- function r() {
120
- K || (K = !0, console.error(
118
+ function v(e, r) {
119
+ function l() {
120
+ q || (q = !0, console.error(
121
121
  "%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
- n
122
+ r
123
123
  ));
124
124
  }
125
- r.isReactWarning = !0, Object.defineProperty(e, "key", {
126
- get: r,
125
+ l.isReactWarning = !0, Object.defineProperty(e, "key", {
126
+ get: l,
127
127
  configurable: !0
128
128
  });
129
129
  }
130
- function y() {
130
+ function h() {
131
131
  var e = t(this.type);
132
- return Q[e] || (Q[e] = !0, console.error(
132
+ return C[e] || (C[e] = !0, console.error(
133
133
  "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
134
  )), e = this.props.ref, e !== void 0 ? e : null;
135
135
  }
136
- function N(e, n, r, a, E, j) {
137
- var f = r.ref;
136
+ function x(e, r, l, a, j, _) {
137
+ var m = l.ref;
138
138
  return e = {
139
- $$typeof: S,
139
+ $$typeof: R,
140
140
  type: e,
141
- key: n,
142
- props: r,
141
+ key: r,
142
+ props: l,
143
143
  _owner: a
144
- }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
144
+ }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(e, "ref", {
145
145
  enumerable: !1,
146
- get: y
146
+ get: h
147
147
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
148
148
  configurable: !1,
149
149
  enumerable: !1,
@@ -158,33 +158,33 @@ function Je() {
158
158
  configurable: !1,
159
159
  enumerable: !1,
160
160
  writable: !0,
161
- value: E
161
+ value: j
162
162
  }), Object.defineProperty(e, "_debugTask", {
163
163
  configurable: !1,
164
164
  enumerable: !1,
165
165
  writable: !0,
166
- value: j
166
+ value: _
167
167
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
168
168
  }
169
- function G(e, n, r, a, E, j) {
170
- var f = n.children;
171
- if (f !== void 0)
169
+ function P(e, r, l, a, j, _) {
170
+ var m = r.children;
171
+ if (m !== void 0)
172
172
  if (a)
173
- if (q(f)) {
174
- for (a = 0; a < f.length; a++)
175
- U(f[a]);
176
- Object.freeze && Object.freeze(f);
173
+ if (L(m)) {
174
+ for (a = 0; a < m.length; a++)
175
+ N(m[a]);
176
+ Object.freeze && Object.freeze(m);
177
177
  } else
178
178
  console.error(
179
179
  "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
180
  );
181
- else U(f);
182
- if (x.call(n, "key")) {
183
- f = t(e);
184
- var T = Object.keys(n).filter(function(H) {
185
- return H !== "key";
181
+ else N(m);
182
+ if (Y.call(r, "key")) {
183
+ m = t(e);
184
+ var A = Object.keys(r).filter(function(b) {
185
+ return b !== "key";
186
186
  });
187
- a = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", k[f + a] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ a = 0 < A.length ? "{key: someKey, " + A.join(": ..., ") + ": ...}" : "{key: someKey}", K[m + a] || (A = 0 < A.length ? "{" + A.join(": ..., ") + ": ...}" : "{}", console.error(
188
188
  `A props object containing a "key" prop is being spread into JSX:
189
189
  let props = %s;
190
190
  <%s {...props} />
@@ -192,75 +192,75 @@ React keys must be passed directly to JSX without using spread:
192
192
  let props = %s;
193
193
  <%s key={someKey} {...props} />`,
194
194
  a,
195
- f,
196
- T,
197
- f
198
- ), k[f + a] = !0);
195
+ m,
196
+ A,
197
+ m
198
+ ), K[m + a] = !0);
199
199
  }
200
- if (f = null, r !== void 0 && (c(r), f = "" + r), p(n) && (c(n.key), f = "" + n.key), "key" in n) {
201
- r = {};
202
- for (var O in n)
203
- O !== "key" && (r[O] = n[O]);
204
- } else r = n;
205
- return f && $(
206
- r,
200
+ if (m = null, l !== void 0 && (o(l), m = "" + l), p(r) && (o(r.key), m = "" + r.key), "key" in r) {
201
+ l = {};
202
+ for (var i in r)
203
+ i !== "key" && (l[i] = r[i]);
204
+ } else l = r;
205
+ return m && v(
206
+ l,
207
207
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
208
- ), N(
208
+ ), x(
209
209
  e,
210
- f,
211
- r,
212
- b(),
213
- E,
214
- j
210
+ m,
211
+ l,
212
+ f(),
213
+ j,
214
+ _
215
215
  );
216
216
  }
217
- function U(e) {
218
- F(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === Y && (e._payload.status === "fulfilled" ? F(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
217
+ function N(e) {
218
+ $(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === g && (e._payload.status === "fulfilled" ? $(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
219
219
  }
220
- function F(e) {
221
- return typeof e == "object" && e !== null && e.$$typeof === S;
220
+ function $(e) {
221
+ return typeof e == "object" && e !== null && e.$$typeof === R;
222
222
  }
223
- var A = _e, S = /* @__PURE__ */ Symbol.for("react.transitional.element"), _ = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), P = /* @__PURE__ */ Symbol.for("react.strict_mode"), C = /* @__PURE__ */ Symbol.for("react.profiler"), V = /* @__PURE__ */ Symbol.for("react.consumer"), u = /* @__PURE__ */ Symbol.for("react.context"), D = /* @__PURE__ */ Symbol.for("react.forward_ref"), X = /* @__PURE__ */ Symbol.for("react.suspense"), I = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), g = /* @__PURE__ */ Symbol.for("react.activity"), m = /* @__PURE__ */ Symbol.for("react.client.reference"), L = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, q = Array.isArray, M = console.createTask ? console.createTask : function() {
223
+ var w = Fe, R = /* @__PURE__ */ Symbol.for("react.transitional.element"), F = /* @__PURE__ */ Symbol.for("react.portal"), S = /* @__PURE__ */ Symbol.for("react.fragment"), H = /* @__PURE__ */ Symbol.for("react.strict_mode"), D = /* @__PURE__ */ Symbol.for("react.profiler"), W = /* @__PURE__ */ Symbol.for("react.consumer"), d = /* @__PURE__ */ Symbol.for("react.context"), I = /* @__PURE__ */ Symbol.for("react.forward_ref"), J = /* @__PURE__ */ Symbol.for("react.suspense"), U = /* @__PURE__ */ Symbol.for("react.suspense_list"), z = /* @__PURE__ */ Symbol.for("react.memo"), g = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.activity"), M = /* @__PURE__ */ Symbol.for("react.client.reference"), O = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, L = Array.isArray, ee = console.createTask ? console.createTask : function() {
224
224
  return null;
225
225
  };
226
- A = {
226
+ w = {
227
227
  react_stack_bottom_frame: function(e) {
228
228
  return e();
229
229
  }
230
230
  };
231
- var K, Q = {}, l = A.react_stack_bottom_frame.bind(
232
- A,
233
- d
234
- )(), v = M(i(d)), k = {};
235
- le.Fragment = w, le.jsx = function(e, n, r) {
236
- var a = 1e4 > L.recentlyCreatedOwnerStacks++;
237
- return G(
231
+ var q, C = {}, re = w.react_stack_bottom_frame.bind(
232
+ w,
233
+ c
234
+ )(), oe = ee(s(c)), K = {};
235
+ me.Fragment = S, me.jsx = function(e, r, l) {
236
+ var a = 1e4 > O.recentlyCreatedOwnerStacks++;
237
+ return P(
238
238
  e,
239
- n,
240
239
  r,
240
+ l,
241
241
  !1,
242
- a ? Error("react-stack-top-frame") : l,
243
- a ? M(i(e)) : v
242
+ a ? Error("react-stack-top-frame") : re,
243
+ a ? ee(s(e)) : oe
244
244
  );
245
- }, le.jsxs = function(e, n, r) {
246
- var a = 1e4 > L.recentlyCreatedOwnerStacks++;
247
- return G(
245
+ }, me.jsxs = function(e, r, l) {
246
+ var a = 1e4 > O.recentlyCreatedOwnerStacks++;
247
+ return P(
248
248
  e,
249
- n,
250
249
  r,
250
+ l,
251
251
  !0,
252
- a ? Error("react-stack-top-frame") : l,
253
- a ? M(i(e)) : v
252
+ a ? Error("react-stack-top-frame") : re,
253
+ a ? ee(s(e)) : oe
254
254
  );
255
255
  };
256
- })()), le;
256
+ })()), me;
257
257
  }
258
- var je;
259
- function qe() {
260
- return je || (je = 1, process.env.NODE_ENV === "production" ? ae.exports = Ue() : ae.exports = Je()), ae.exports;
258
+ var Pe;
259
+ function sr() {
260
+ return Pe || (Pe = 1, process.env.NODE_ENV === "production" ? ye.exports = tr() : ye.exports = nr()), ye.exports;
261
261
  }
262
- var h = qe();
263
- const Me = ({ className: t = "", ...s }) => /* @__PURE__ */ h.jsx(
262
+ var u = sr();
263
+ const ir = ({ className: t = "", ...n }) => /* @__PURE__ */ u.jsx(
264
264
  "svg",
265
265
  {
266
266
  className: t,
@@ -271,10 +271,10 @@ const Me = ({ className: t = "", ...s }) => /* @__PURE__ */ h.jsx(
271
271
  width: "1em",
272
272
  height: "1em",
273
273
  fill: "currentColor",
274
- ...s,
275
- children: /* @__PURE__ */ h.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" })
274
+ ...n,
275
+ 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
276
  }
277
- ), Ge = ({ className: t = "", ...s }) => /* @__PURE__ */ h.jsx(
277
+ ), or = ({ className: t = "", ...n }) => /* @__PURE__ */ u.jsx(
278
278
  "svg",
279
279
  {
280
280
  className: t,
@@ -283,714 +283,856 @@ const Me = ({ className: t = "", ...s }) => /* @__PURE__ */ h.jsx(
283
283
  width: "1em",
284
284
  height: "1em",
285
285
  fill: "currentColor",
286
- ...s,
287
- children: /* @__PURE__ */ h.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" })
286
+ ...n,
287
+ 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
288
  }
289
- ), $e = De(null), ce = (t, s = "invalid-option", c = "") => {
290
- const i = c ? c.replace(/:/g, "") : "";
289
+ ), _e = (t, n = "invalid-option", o = "") => {
290
+ const s = o ? o.replace(/:/g, "") : "";
291
291
  if (typeof t != "string" || !t.trim())
292
- return i ? `${s}-${i}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
293
- const b = t.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
294
- return b ? b || `${s}-${Math.random().toString(36).slice(2, 8)}` : i ? `${s}-${i}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
295
- };
296
- function Xe({
292
+ return s ? `${n}-${s}` : `${n}-${Math.random().toString(36).slice(2, 8)}`;
293
+ const f = t.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
294
+ return f ? f || `${n}-${Math.random().toString(36).slice(2, 8)}` : s ? `${n}-${s}` : `${n}-${Math.random().toString(36).slice(2, 8)}`;
295
+ }, Te = He(null);
296
+ function lr({
297
+ visibility: t,
298
+ children: n,
299
+ selectRef: o,
300
+ onAnimationDone: s,
301
+ unmount: f = !0,
302
+ duration: c,
303
+ easing: p,
304
+ offset: v,
305
+ animateOpacity: h
306
+ }) {
307
+ const x = ce(null), [P, N] = ae(0);
308
+ B(() => {
309
+ if (!o?.current) return;
310
+ N(o.current.offsetHeight);
311
+ const I = new ResizeObserver((J) => {
312
+ for (let U of J) N(U.target.offsetHeight);
313
+ });
314
+ return I.observe(o.current), () => I.disconnect();
315
+ }, [o]);
316
+ const $ = `height ${c}ms ${p}${h ? `, opacity ${c}ms ${p}` : ""}`, w = {
317
+ position: "absolute",
318
+ top: `calc(100% + ${v}px)`,
319
+ left: "0",
320
+ width: "100%",
321
+ overflow: "hidden",
322
+ marginTop: "2px",
323
+ zIndex: "1",
324
+ height: t ? "auto" : "0px",
325
+ opacity: h ? t ? 1 : 0 : 1,
326
+ pointerEvents: t ? "all" : "none",
327
+ visibility: P ? "visible" : "hidden"
328
+ }, R = T(() => {
329
+ const d = x.current;
330
+ d && (d.style.height = "0px", h && (d.style.opacity = "0"), d.style.transition = "");
331
+ }, [h]), F = T(() => {
332
+ const d = x.current;
333
+ d && (d.style.transition = $, d.style.height = `${d.scrollHeight}px`, h && (d.style.opacity = "1"));
334
+ }, [$, h]), S = T(() => {
335
+ const d = x.current;
336
+ d && (d.style.height = "auto", d.style.transition = "", s && s());
337
+ }, [s]), H = T(() => {
338
+ const d = x.current;
339
+ d && (d.style.height = `${d.scrollHeight}px`, h && (d.style.opacity = "1"), d.offsetHeight, d.style.transition = $);
340
+ }, [$, h]), D = T(() => {
341
+ const d = x.current;
342
+ d && (d.style.height = "0px", h && (d.style.opacity = "0"));
343
+ }, [h]), W = T(() => {
344
+ const d = x.current;
345
+ d && (d.style.transition = "");
346
+ }, []);
347
+ return /* @__PURE__ */ u.jsx(
348
+ ke,
349
+ {
350
+ in: t,
351
+ timeout: c,
352
+ classNames: "rac-options",
353
+ unmountOnExit: f,
354
+ nodeRef: x,
355
+ onEnter: R,
356
+ onEntering: F,
357
+ onEntered: S,
358
+ onExit: H,
359
+ onExiting: D,
360
+ onExited: W,
361
+ children: /* @__PURE__ */ u.jsx(
362
+ "div",
363
+ {
364
+ ref: x,
365
+ className: "rac-options",
366
+ style: w,
367
+ children: n
368
+ }
369
+ )
370
+ }
371
+ );
372
+ }
373
+ const ar = Ye(lr, (t, n) => t.visibility === n.visibility && t.duration === n.duration && t.easing === n.easing && t.offset === n.offset && t.animateOpacity === n.animateOpacity && t.selectRef === n.selectRef && t.children === n.children);
374
+ function Ee({
375
+ visibility: t,
376
+ children: n,
377
+ duration: o = 300,
378
+ unmount: s,
379
+ style: f
380
+ }) {
381
+ const c = ce(null);
382
+ return /* @__PURE__ */ u.jsx(
383
+ ke,
384
+ {
385
+ in: t,
386
+ timeout: o,
387
+ classNames: "rac-slide-left",
388
+ unmountOnExit: !0,
389
+ nodeRef: c,
390
+ onEnter: () => c.current.style.width = "0px",
391
+ onEntering: () => c.current.style.width = c.current.scrollWidth + "px",
392
+ onEntered: () => c.current.style.width = "auto",
393
+ onExit: () => c.current.style.width = c.current.scrollWidth + "px",
394
+ onExiting: () => c.current.style.width = "0px",
395
+ onExited: () => s?.(),
396
+ children: /* @__PURE__ */ u.jsx(
397
+ "div",
398
+ {
399
+ ref: c,
400
+ style: {
401
+ ...f,
402
+ overflow: "hidden",
403
+ transition: `width ${o}ms ease`
404
+ },
405
+ children: n
406
+ }
407
+ )
408
+ }
409
+ );
410
+ }
411
+ const cr = Ye(({
412
+ selectRef: t,
413
+ selectId: n,
414
+ renderOptions: o,
415
+ selected: s,
416
+ title: f,
417
+ visibility: c,
418
+ active: p,
419
+ hasOptions: v,
420
+ hasActualValue: h,
421
+ disabled: x,
422
+ loading: P,
423
+ error: N,
424
+ registerOption: $,
425
+ unregisterOption: w,
426
+ handleBlur: R,
427
+ handleFocus: F,
428
+ handleToggle: S,
429
+ handleKeyDown: H,
430
+ handleListScroll: D,
431
+ setAnimationFinished: W,
432
+ clear: d,
433
+ children: I,
434
+ renderedDropdown: J,
435
+ placeholder: U,
436
+ className: z,
437
+ style: g,
438
+ duration: E,
439
+ easing: M,
440
+ offset: O,
441
+ animateOpacity: Y,
442
+ unmount: L,
443
+ ArrowIcon: ee,
444
+ ClearIcon: q,
445
+ renderIcon: C,
446
+ hasMore: re,
447
+ loadButton: oe
448
+ }) => /* @__PURE__ */ u.jsxs(
449
+ Te.Provider,
450
+ {
451
+ value: { registerOption: $, unregisterOption: w },
452
+ children: [
453
+ I,
454
+ J,
455
+ /* @__PURE__ */ u.jsxs(
456
+ "div",
457
+ {
458
+ ref: t,
459
+ style: { "--rac-duration": `${E}ms`, ...g },
460
+ className: `rac-select
461
+ ${z}
462
+ ${!v || x ? "rac-disabled-style" : ""}
463
+ ${P ? "rac-loading-style" : ""}
464
+ ${N ? "rac-error-style" : ""}`,
465
+ tabIndex: p ? 0 : -1,
466
+ role: "combobox",
467
+ "aria-haspopup": "listbox",
468
+ "aria-expanded": c,
469
+ "aria-controls": `${n}-listbox`,
470
+ "aria-label": U,
471
+ "aria-disabled": x || !v,
472
+ ...p && {
473
+ onBlur: R,
474
+ onFocus: F,
475
+ onClick: S,
476
+ onKeyDown: H
477
+ },
478
+ children: [
479
+ /* @__PURE__ */ u.jsxs("div", { className: `rac-select-title ${!N && !P && s?.type === "boolean" ? s.raw ? "rac-true-option" : "rac-false-option" : ""}`, children: [
480
+ /* @__PURE__ */ u.jsx("span", { className: "rac-title-text", children: f }, f),
481
+ /* @__PURE__ */ u.jsx(Ee, { visibility: P && !N, duration: E, children: /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
482
+ /* @__PURE__ */ u.jsx("i", {}),
483
+ /* @__PURE__ */ u.jsx("i", {}),
484
+ /* @__PURE__ */ u.jsx("i", {})
485
+ ] }) })
486
+ ] }),
487
+ /* @__PURE__ */ u.jsxs("div", { className: "rac-select-buttons", children: [
488
+ /* @__PURE__ */ u.jsx(
489
+ Ee,
490
+ {
491
+ visibility: h && v && !x && !P && !N,
492
+ duration: E,
493
+ style: { display: "grid" },
494
+ children: C(q, {
495
+ className: "rac-select-cancel",
496
+ onMouseDown: (K) => {
497
+ K.preventDefault(), K.stopPropagation();
498
+ },
499
+ onClick: d
500
+ })
501
+ }
502
+ ),
503
+ /* @__PURE__ */ u.jsx(
504
+ Ee,
505
+ {
506
+ visibility: p,
507
+ duration: E,
508
+ style: { display: "grid" },
509
+ children: /* @__PURE__ */ u.jsx(
510
+ "span",
511
+ {
512
+ className: `rac-select-arrow-wrapper ${c ? "--open" : ""}`,
513
+ children: C(ee, {
514
+ className: "rac-select-arrow-wrapper"
515
+ })
516
+ }
517
+ )
518
+ }
519
+ )
520
+ ] }),
521
+ /* @__PURE__ */ u.jsx(
522
+ ar,
523
+ {
524
+ visibility: c,
525
+ selectRef: t,
526
+ onAnimationDone: () => W(!0),
527
+ unmount: L,
528
+ duration: E,
529
+ easing: M,
530
+ offset: O,
531
+ animateOpacity: Y,
532
+ children: /* @__PURE__ */ u.jsxs(
533
+ "div",
534
+ {
535
+ onScroll: D,
536
+ tabIndex: "-1",
537
+ className: "rac-select-list",
538
+ role: "listbox",
539
+ "aria-label": "Options",
540
+ children: [
541
+ o,
542
+ !oe && re && /* @__PURE__ */ u.jsxs(
543
+ "div",
544
+ {
545
+ className: "rac-select-option rac-disabled-option rac-loading-option",
546
+ onClick: (K) => K.stopPropagation(),
547
+ children: [
548
+ /* @__PURE__ */ u.jsx("span", { className: "rac-loading-option-title", children: "Loading" }),
549
+ /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
550
+ /* @__PURE__ */ u.jsx("i", {}),
551
+ /* @__PURE__ */ u.jsx("i", {}),
552
+ /* @__PURE__ */ u.jsx("i", {})
553
+ ] })
554
+ ]
555
+ }
556
+ )
557
+ ]
558
+ }
559
+ )
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ )
565
+ ]
566
+ }
567
+ ));
568
+ function ur({
297
569
  disabled: t,
298
- isOpen: s,
299
- setIsOpen: c,
300
- options: i,
301
- selectOption: b,
302
- selected: d,
570
+ open: n,
571
+ setOpen: o,
572
+ options: s = [],
573
+ selectOption: f,
574
+ selected: c,
303
575
  hasMore: p,
304
- loadMore: $,
305
- loadButton: y,
306
- loadButtonText: N,
307
- setLoadingTitle: G,
308
- loadOffset: U,
309
- loadAhead: F
576
+ loadMore: v,
577
+ loadButton: h,
578
+ loadButtonText: x,
579
+ setLoadingTitle: P,
580
+ loadOffset: N,
581
+ loadAhead: $
310
582
  }) {
311
- const A = re(!1), S = re(0), [_, w] = te(-1), P = re(!1), C = re(i?.length || 0);
312
- z(() => {
313
- i && i.length !== C.current && (P.current = !1, C.current = i.length, y && G(N));
314
- }, [i]);
315
- const V = R(() => {
316
- !p || P.current || (P.current = !0, $());
317
- }, [p, $]), u = R((g) => {
318
- if (y || !p || P.current) return;
319
- const { scrollTop: m, scrollHeight: L, clientHeight: x } = g.currentTarget, q = U;
320
- L - m <= x + q && V();
321
- }, [y, p, V]);
322
- z(() => {
323
- if (!y && s && p && _ >= 0) {
324
- const g = F;
325
- _ >= i.length - g && V();
326
- }
327
- }, [y, _, s, p, i.length, V]), z(() => {
583
+ const w = ce(!1), R = ce(0), F = ce(!1), [S, H] = ae(-1);
584
+ B(() => {
585
+ F.current = !1, h && P(x);
586
+ }, [s.length, p, h, x, P]);
587
+ const D = T(() => {
588
+ !p || F.current || (F.current = !0, v());
589
+ }, [p, v]), W = T((g) => {
590
+ if (h || !p || F.current) return;
591
+ const { scrollTop: E, scrollHeight: M, clientHeight: O } = g.currentTarget;
592
+ M - E <= O + N && D();
593
+ }, [h, p, N, D]);
594
+ B(() => {
595
+ !h && n && p && S >= s.length - $ && D();
596
+ }, [S, n, p, s.length, $, h, D]), B(() => {
328
597
  const g = () => {
329
- S.current = Date.now();
598
+ R.current = Date.now();
330
599
  };
331
600
  return window.addEventListener("focus", g), () => window.removeEventListener("focus", g);
332
- }, []), z(() => {
333
- if (s) {
334
- if (_ >= 0 && _ < i.length)
335
- return;
336
- let g = -1;
337
- if (d) {
338
- const m = i.findIndex((L) => L.id === d.id && !L.disabled);
339
- m >= 0 && (g = m);
340
- }
341
- g === -1 && (g = i.findIndex((m) => !m.disabled)), w(g);
342
- } else
343
- w(-1);
344
- }, [s, i]);
345
- const D = R((g) => {
346
- g.currentTarget.contains(g.relatedTarget) || c(!1);
347
- }, [c]), X = R(() => {
348
- t || document.hidden || Date.now() - S.current < 100 || s || (c(!0), A.current = !0, setTimeout(() => {
349
- A.current = !1;
601
+ }, []), B(() => {
602
+ if (!n) {
603
+ H(-1);
604
+ return;
605
+ }
606
+ if (S >= 0 && S < s.length) return;
607
+ let g = -1;
608
+ c && (g = s.findIndex((E) => E.id === c.id && !E.disabled)), g === -1 && (g = s.findIndex((E) => !E.disabled)), H(g);
609
+ }, [n, s, c]);
610
+ const d = T((g, E) => {
611
+ const M = (L) => L && !L.disabled && !L.loading, O = s.length;
612
+ if (O === 0) return -1;
613
+ let Y = g;
614
+ for (let L = 0; L < O; L++) {
615
+ if (Y = (Y + E + O) % O, !h && p && (E > 0 && Y === 0 || E < 0 && Y === O - 1))
616
+ return g;
617
+ if (M(s[Y])) return Y;
618
+ }
619
+ return g;
620
+ }, [s, p, h]), I = T((g) => {
621
+ g.currentTarget.contains(g.relatedTarget) || o(!1);
622
+ }, [o]), J = T(() => {
623
+ t || document.hidden || Date.now() - R.current < 100 || n || (o(!0), w.current = !0, setTimeout(() => {
624
+ w.current = !1;
350
625
  }, 200));
351
- }, [t, s, c]), I = R((g) => {
352
- t || g.target.closest && g.target.closest(".rac-select-cancel") || A.current || c(!s);
353
- }, [t, s, c]), J = (g, m) => {
354
- const L = (M) => M && !M.disabled && !M.loading;
355
- if (!i.some(L)) return -1;
356
- let x = g, q = 0;
357
- do {
358
- if (x += m, x >= i.length) {
359
- if (p && !y) return g;
360
- x = 0;
361
- }
362
- if (x < 0) {
363
- if (p && !y) return g;
364
- x = i.length - 1;
365
- }
366
- q++;
367
- } while (!L(i[x]) && q <= i.length);
368
- return x;
369
- }, Y = R((g) => {
626
+ }, [t, n, o]), U = T((g) => {
627
+ t || g.target.closest(".rac-select-cancel") || w.current || o(!n);
628
+ }, [t, n, o]), z = T((g) => {
370
629
  if (!t)
371
630
  switch (g.key) {
372
631
  case "Enter":
373
632
  case " ":
374
- g.preventDefault(), s ? _ !== -1 && i[_] && b(i[_], g) : c(!0);
633
+ g.preventDefault(), n ? S !== -1 && s[S] && f(s[S], g) : o(!0);
375
634
  break;
376
635
  case "Escape":
377
- g.preventDefault(), c(!1);
636
+ g.preventDefault(), o(!1);
378
637
  break;
379
638
  case "ArrowDown":
380
- g.preventDefault(), s ? w((m) => J(m, 1)) : c(!0);
639
+ g.preventDefault(), n ? H((E) => d(E, 1)) : o(!0);
381
640
  break;
382
641
  case "ArrowUp":
383
- g.preventDefault(), s ? w((m) => J(m, -1)) : c(!0);
642
+ g.preventDefault(), n ? H((E) => d(E, -1)) : o(!0);
384
643
  break;
385
644
  case "Tab":
386
- s && c(!1);
645
+ n && o(!1);
387
646
  break;
388
647
  }
389
- }, [t, s, c, _, i, b]);
390
- return ne(() => ({
391
- handleBlur: D,
392
- handleFocus: X,
393
- handleToggle: I,
394
- handleKeyDown: Y,
395
- highlightedIndex: _,
396
- setHighlightedIndex: w,
397
- handleListScroll: u
398
- }), [D, X, I, Y, _, w]);
648
+ }, [t, n, o, S, s, f, d]);
649
+ return se(() => ({
650
+ handleBlur: I,
651
+ handleFocus: J,
652
+ handleToggle: U,
653
+ handleKeyDown: z,
654
+ highlightedIndex: S,
655
+ setHighlightedIndex: H,
656
+ handleListScroll: W
657
+ }), [I, J, U, z, S, W]);
399
658
  }
400
- function Ke({
659
+ const dr = ["group", "disabled", "options", "items", "children"], De = ["name", "label", "id", "value"];
660
+ function fr({
401
661
  options: t = [],
402
- jsxOptions: s = [],
403
- value: c,
404
- defaultValue: i = void 0,
405
- onChange: b,
406
- disabled: d = !1,
662
+ jsxOptions: n = [],
663
+ value: o,
664
+ defaultValue: s = void 0,
665
+ onChange: f,
666
+ disabled: c = !1,
407
667
  loading: p = !1,
408
- error: $ = !1,
409
- placeholder: y = "Choose option",
410
- emptyText: N = "No options",
411
- disabledText: G = "Disabled",
412
- loadingText: U = "Loading",
413
- errorText: F = "Failed to load",
414
- disabledOption: A = "Disabled option",
415
- emptyOption: S = "Empty option",
416
- invalidOption: _ = "Invalid option",
417
- setVisibility: w,
418
- hasMore: P,
419
- loadButton: C,
420
- setLoadingTitle: V,
421
- loadingTitle: u,
422
- loadMoreText: D,
423
- loadMore: X,
424
- childrenFirst: I
668
+ error: v = !1,
669
+ placeholder: h = "Choose option",
670
+ emptyText: x = "No options",
671
+ disabledText: P = "Disabled",
672
+ loadingText: N = "Loading",
673
+ errorText: $ = "Failed to load",
674
+ disabledOption: w = "Disabled option",
675
+ emptyOption: R = "Empty option",
676
+ invalidOption: F = "Invalid option",
677
+ setVisibility: S,
678
+ hasMore: H,
679
+ loadButton: D,
680
+ setLoadingTitle: W,
681
+ loadingTitle: d,
682
+ loadMoreText: I,
683
+ loadMore: J,
684
+ childrenFirst: U
425
685
  }) {
426
- const J = Se(), Y = c !== void 0, [g, m] = te(null), L = (l) => !l || typeof l != "object" || Array.isArray(l) ? !1 : "id" in l || "value" in l || "name" in l || "label" in l || "disabled" in l, x = ne(() => {
427
- const l = [], v = (r, a, E) => {
428
- let j = E?.id ?? E?.value ?? a ?? r;
429
- if (typeof a == "function") {
430
- l.push({
431
- key: `invalid-${l.length}`,
432
- value: a,
433
- userId: null,
434
- disabled: !0,
435
- invalid: !0,
436
- label: _,
437
- original: E
438
- });
439
- return;
440
- }
441
- if (a === "") {
442
- l.push({
443
- key: `empty-str-${l.length}`,
444
- value: "",
445
- userId: null,
446
- disabled: !0,
447
- label: S,
448
- original: E
449
- });
686
+ const z = Re(), g = o !== void 0, [E, M] = ae(null), O = T((r, l = !1) => {
687
+ const a = De.find((_) => r[_] !== void 0 && r[_] !== null && r[_] !== "");
688
+ if (a) return String(r[a]);
689
+ const j = Object.entries(r).find(
690
+ ([_, m]) => !dr.includes(_) && m != null && m !== ""
691
+ );
692
+ return j ? String(j[1]) : l;
693
+ }, []), Y = T((r, l, a = "normal", j = null, _ = !1) => {
694
+ let m = "", A = r, i = _, b = null, V = j;
695
+ return r == null || r === "" ? {
696
+ id: `${z}-${a}-${l}`,
697
+ userId: null,
698
+ name: R,
699
+ raw: null,
700
+ disabled: !0,
701
+ type: "normal",
702
+ group: V
703
+ } : typeof r == "function" ? {
704
+ id: `${z}-inv-${l}`,
705
+ userId: null,
706
+ name: F,
707
+ raw: r,
708
+ disabled: !0,
709
+ invalid: !0,
710
+ type: "normal",
711
+ group: V
712
+ } : (typeof r == "object" && !Array.isArray(r) ? (V || (V = r.group || null), i = i || !!r.disabled, b = r.id ?? r.value ?? r.name ?? r.label, A = r.value !== void 0 ? r.value : r.id !== void 0 ? r.id : r, m = O(r, i ? w : R), m === R && !i && (i = !0)) : (m = String(r), b = r, A = r), {
713
+ id: `${z}-${a}-${l}`,
714
+ userId: b,
715
+ name: m,
716
+ raw: A,
717
+ original: r,
718
+ disabled: i,
719
+ type: typeof A == "boolean" ? "boolean" : "normal",
720
+ group: V
721
+ });
722
+ }, [z, R, F, w, O]), [L, ee] = ae(/* @__PURE__ */ new Set()), q = T((r) => {
723
+ ee((l) => {
724
+ const a = new Set(l);
725
+ return a.has(r) ? a.delete(r) : a.add(r), a;
726
+ });
727
+ }, []), C = se(() => {
728
+ const r = [], l = (i, b, V = null, Z = !1) => {
729
+ if (i && typeof i == "object" && !Array.isArray(i) && "options" in i) {
730
+ const te = O(i, "Empty group", !0), le = Z || !!i.disabled, Q = i.options;
731
+ Array.isArray(Q) ? Q.forEach((ge, de) => l(ge, `${b}-${de}`, te, le)) : Q && typeof Q == "object" ? Object.entries(Q).forEach(([ge, de], xe) => l(de, `${b}-${xe}`, te, le)) : l(Q, `${b}-0`, te, le);
450
732
  return;
451
733
  }
452
- if (a == null) {
453
- l.push({
454
- key: `empty-${l.length}`,
455
- value: null,
456
- userId: null,
457
- disabled: !0,
458
- label: S,
459
- original: E
734
+ if (i && typeof i == "object" && !Array.isArray(i) && !De.some((te) => te in i) && !("group" in i)) {
735
+ Object.entries(i).forEach(([te, le], Q) => {
736
+ r.push(Y(le, `${b}-${Q}`, "normal", V, Z));
460
737
  });
461
738
  return;
462
739
  }
463
- if (typeof a == "number" || typeof a == "boolean") {
464
- l.push({
465
- key: `${typeof a}-${a}-${l.length}`,
466
- value: a,
467
- userId: j,
468
- label: String(a),
469
- original: E
470
- });
471
- return;
472
- } else
473
- l.push({
474
- key: r ?? `opt-${l.length}`,
475
- value: a,
476
- userId: j,
477
- label: String(a ?? r),
478
- original: E
479
- });
740
+ r.push(Y(i, b, "normal", V, Z));
480
741
  };
481
- Array.isArray(t) ? t.forEach((r, a) => {
482
- if (r && typeof r == "object" && Object.keys(r).length === 1 && r.disabled === !0)
483
- l.push({ key: `dis-${a}`, value: null, userId: null, disabled: !0, label: A, original: r });
484
- else if (L(r)) {
485
- const E = r.id ?? (typeof r.value != "object" ? r.value : r.label ?? r.name ?? r.value);
486
- let j = r.name || r.label || r.id || r.value;
487
- if (j == null || j === "") {
488
- const O = Object.entries(r).find(
489
- ([H, B]) => H !== "disabled" && B !== null && B !== void 0 && B !== ""
490
- );
491
- O && (j = O[1]);
492
- }
493
- const f = j == null || j === "", T = f ? S : String(j);
494
- l.push({
495
- key: r.id ?? r.value ?? r.name ?? `opt-${a}`,
496
- value: r.value !== void 0 ? r.value : r.id !== void 0 ? r.id : r,
497
- userId: E,
498
- disabled: f || !!r.disabled,
499
- label: T,
500
- original: r
501
- });
502
- } else r && typeof r == "object" && !Array.isArray(r) ? Object.entries(r).forEach(([E, j]) => v(E, j, j)) : v(r, r, r);
503
- }) : typeof t == "object" && t !== null && Object.entries(t).forEach(([r, a]) => v(r, a, a));
504
- const k = l.map((r, a) => ({
505
- id: `${J}-opt-${a}`,
506
- userId: r.userId,
507
- name: String(r.label),
508
- raw: r.value,
509
- original: r.original,
510
- disabled: r.disabled,
511
- invalid: r.invalid,
512
- type: typeof r.value == "boolean" ? "boolean" : "normal"
513
- })), e = s.map((r, a) => {
514
- const E = r.value === null || r.value === void 0, j = r.label === null || r.label === void 0 || r.label === "", f = E && j;
742
+ Array.isArray(t) && t.forEach((i, b) => l(i, b));
743
+ const a = n.map((i) => {
744
+ if (i.isGroupMarker) return { ...i, type: "group-marker" };
745
+ const b = (i.value == null || i.value === "") && !i.label;
515
746
  return {
516
- ...r,
517
- id: `jsx-${J.replace(/:/g, "")}-${r.id}-${a}`,
518
- userId: r.id,
519
- raw: r.value,
520
- original: r.value,
521
- name: f ? S : r.label,
522
- disabled: r.disabled || f,
523
- type: typeof r.value == "boolean" ? "boolean" : "normal"
747
+ ...i,
748
+ id: `jsx-${i.id}`,
749
+ userId: i.id,
750
+ raw: i.value,
751
+ original: i.value,
752
+ name: b ? R : i.label,
753
+ disabled: !!i.disabled || b,
754
+ type: typeof i.value == "boolean" ? "boolean" : "normal",
755
+ group: i.group || null
524
756
  };
525
- }), n = I ? [...e, ...k] : [...k, ...e];
526
- if (P && C) {
527
- const r = u === D;
528
- n.push({
529
- id: "special-load-more-id",
530
- name: u,
531
- loadMore: !0,
532
- loading: r,
533
- type: "special"
534
- });
535
- }
536
- return n;
537
- }, [t, s, J, S, A, P, C, u, D]), q = R((l) => {
538
- if (l == null) return null;
539
- const v = x.find((k) => k.original === l || k.raw === l);
540
- if (v) return v.id;
541
- if (typeof l == "object")
757
+ }), j = U ? [...a, ...r] : [...r, ...a], _ = [], m = /* @__PURE__ */ new Map(), A = [];
758
+ return j.forEach((i) => {
759
+ if (!i.group)
760
+ A.push({ type: "item", data: i });
761
+ else if (m.has(i.group) || (m.set(i.group, []), A.push({ type: "group", name: i.group })), !i.isGroupMarker) {
762
+ const b = L.has(i.group);
763
+ m.get(i.group).push({ ...i, hidden: !b });
764
+ }
765
+ }), A.forEach((i, b) => {
766
+ if (i.type === "item")
767
+ _.push(i.data);
768
+ else {
769
+ const V = L.has(i.name);
770
+ _.push({
771
+ id: `group-header-${i.name}-${b}`,
772
+ name: i.name,
773
+ disabled: !1,
774
+ groupHeader: !0,
775
+ expanded: V,
776
+ type: "group"
777
+ });
778
+ const Z = m.get(i.name);
779
+ _.push(...Z);
780
+ }
781
+ }), H && D && _.push({
782
+ id: "special-load-more-id",
783
+ name: d,
784
+ loadMore: !0,
785
+ loading: d === I,
786
+ type: "special"
787
+ }), _;
788
+ }, [t, n, z, Y, U, H, D, d, I, x, R, O]), re = T((r) => {
789
+ if (r == null) return null;
790
+ const l = C.find((a) => a.original === r || a.raw === r || a.userId === r);
791
+ if (l) return l.id;
792
+ if (typeof r == "object")
542
793
  try {
543
- const k = JSON.stringify(l), e = x.find(
544
- (n) => n.original && typeof n.original == "object" && JSON.stringify(n.original) === k
545
- );
546
- if (e) return e.id;
794
+ const a = JSON.stringify(r);
795
+ return C.find(
796
+ (j) => j.original && typeof j.original == "object" && JSON.stringify(j.original) === a
797
+ )?.id ?? null;
547
798
  } catch {
799
+ return null;
548
800
  }
549
- return x.find((k) => k.userId === l)?.id ?? null;
550
- }, [x]);
551
- z(() => {
552
- const l = Y ? c : i, v = x.find((e) => e.id === g);
553
- v && (v.original === l || v.raw === l || v.userId === l) || m(q(l));
554
- }, [c, i, Y, x, q]);
555
- const M = ne(() => x.find((l) => l.id === g) ?? null, [g, x]), K = R((l, v) => {
556
- if (l.disabled || l.loadMore) {
557
- v?.stopPropagation(), v?.preventDefault(), u !== D && (V(D), X());
801
+ return null;
802
+ }, [C]);
803
+ B(() => {
804
+ const r = g ? o : s, l = C.find((j) => j.id === E);
805
+ l && (l.original === r || l.raw === r || l.userId === r) || M(re(r));
806
+ }, [o, s, g, C, re, E]);
807
+ const oe = se(
808
+ () => C.find((r) => r.id === E) ?? null,
809
+ [E, C]
810
+ ), K = T((r, l) => {
811
+ if (r.groupHeader) {
812
+ l?.stopPropagation(), l?.preventDefault(), q(r.name);
558
813
  return;
559
814
  }
560
- m(l.id), b?.(l.original, l.userId), w(!1);
561
- }, [b, w]), Q = R(() => {
562
- m(null), b?.(null, null);
563
- }, [b]);
815
+ if (r.disabled || r.loadMore) {
816
+ l?.stopPropagation(), l?.preventDefault(), r.loadMore && (W(I), J());
817
+ return;
818
+ }
819
+ M(r.id), f?.(r.original, r.userId), S(!1);
820
+ }, [f, S, J, I, W]), e = T(() => {
821
+ M(null), f?.(null, null);
822
+ }, [f]);
564
823
  return {
565
- normalizedOptions: x,
566
- selected: M,
824
+ normalizedOptions: C,
825
+ selected: oe,
567
826
  selectOption: K,
568
- clear: Q,
569
- hasOptions: x.length > 0,
570
- active: !$ && !p && !d && x.length > 0,
571
- selectedValue: c ?? i,
572
- placeholder: y,
573
- emptyText: N,
574
- disabledText: G,
575
- loadingText: U,
576
- errorText: F,
577
- disabledOption: A,
578
- emptyOption: S,
579
- invalidOption: _,
580
- disabled: d,
827
+ clear: e,
828
+ hasOptions: C.length > 0,
829
+ active: !v && !p && !c && C.length > 0,
830
+ selectedValue: o ?? s,
831
+ placeholder: h,
832
+ emptyText: x,
833
+ disabledText: P,
834
+ loadingText: N,
835
+ errorText: $,
836
+ disabledOption: w,
837
+ emptyOption: R,
838
+ invalidOption: F,
839
+ disabled: c,
581
840
  loading: p,
582
- error: $
841
+ error: v,
842
+ expandedGroups: L,
843
+ toggleGroup: q,
844
+ visibleOptions: C.filter((r) => !r.hidden)
583
845
  };
584
846
  }
585
- function Ze({
586
- visibility: t,
587
- children: s,
588
- selectRef: c,
589
- onAnimationDone: i,
590
- unmount: b = !0,
591
- duration: d,
592
- easing: p,
593
- offset: $,
594
- animateOpacity: y
595
- }) {
596
- const N = re(null), [G, U] = te(0);
597
- z(() => {
598
- if (!c?.current) return;
599
- U(c.current.offsetHeight);
600
- const D = new ResizeObserver((X) => {
601
- for (let I of X) U(I.target.offsetHeight);
602
- });
603
- return D.observe(c.current), () => D.disconnect();
604
- }, [c]);
605
- const F = `height ${d}ms ${p}${y ? `, opacity ${d}ms ${p}` : ""}`, A = {
606
- position: "absolute",
607
- top: `calc(100% + ${$}px)`,
608
- left: "0",
609
- width: "100%",
610
- overflow: "hidden",
611
- marginTop: "2px",
612
- zIndex: "1",
613
- height: t ? "auto" : "0px",
614
- opacity: y ? t ? 1 : 0 : 1,
615
- pointerEvents: t ? "all" : "none",
616
- visibility: G ? "visible" : "hidden"
617
- }, S = R(() => {
618
- const u = N.current;
619
- u && (u.style.height = "0px", y && (u.style.opacity = "0"), u.style.transition = "");
620
- }, [y]), _ = R(() => {
621
- const u = N.current;
622
- u && (u.style.transition = F, u.style.height = `${u.scrollHeight}px`, y && (u.style.opacity = "1"));
623
- }, [F, y]), w = R(() => {
624
- const u = N.current;
625
- u && (u.style.height = "auto", u.style.transition = "", i && i());
626
- }, [i]), P = R(() => {
627
- const u = N.current;
628
- u && (u.style.height = `${u.scrollHeight}px`, y && (u.style.opacity = "1"), u.offsetHeight, u.style.transition = F);
629
- }, [F, y]), C = R(() => {
630
- const u = N.current;
631
- u && (u.style.height = "0px", y && (u.style.opacity = "0"));
632
- }, [y]), V = R(() => {
633
- const u = N.current;
634
- u && (u.style.transition = "");
635
- }, []);
636
- return /* @__PURE__ */ h.jsx(
637
- Re,
638
- {
639
- in: t,
640
- timeout: d,
641
- classNames: "rac-options",
642
- unmountOnExit: b,
643
- nodeRef: N,
644
- onEnter: S,
645
- onEntering: _,
646
- onEntered: w,
647
- onExit: P,
648
- onExiting: C,
649
- onExited: V,
650
- children: /* @__PURE__ */ h.jsx(
651
- "div",
652
- {
653
- ref: N,
654
- className: "rac-options",
655
- style: A,
656
- children: s
657
- }
658
- )
659
- }
660
- );
661
- }
662
- const Qe = Fe(Ze, (t, s) => t.visibility === s.visibility && t.duration === s.duration && t.easing === s.easing && t.offset === s.offset && t.animateOpacity === s.animateOpacity && t.selectRef === s.selectRef && t.children === s.children);
663
- function oe({
664
- visibility: t,
665
- children: s,
666
- duration: c = 300,
667
- unmount: i,
668
- style: b
669
- }) {
670
- const d = re(null);
671
- return /* @__PURE__ */ h.jsx(
672
- Re,
847
+ function gr({ visibility: t, children: n, duration: o = 300 }) {
848
+ const s = ce(null);
849
+ return /* @__PURE__ */ u.jsx(
850
+ ke,
673
851
  {
674
852
  in: t,
675
- timeout: c,
676
- classNames: "rac-slide-left",
853
+ timeout: 300,
854
+ classNames: "slideDown",
677
855
  unmountOnExit: !0,
678
- nodeRef: d,
679
- onEnter: () => d.current.style.width = "0px",
680
- onEntering: () => d.current.style.width = d.current.scrollWidth + "px",
681
- onEntered: () => d.current.style.width = "auto",
682
- onExit: () => d.current.style.width = d.current.scrollWidth + "px",
683
- onExiting: () => d.current.style.width = "0px",
684
- onExited: () => i?.(),
685
- children: /* @__PURE__ */ h.jsx(
856
+ nodeRef: s,
857
+ onEnter: () => s.current.style.height = "0px",
858
+ onEntering: () => s.current.style.height = s.current.scrollHeight + "px",
859
+ onEntered: () => s.current.style.height = "auto",
860
+ onExit: () => s.current.style.height = s.current.scrollHeight + "px",
861
+ onExiting: () => s.current.style.height = "0px",
862
+ children: /* @__PURE__ */ u.jsx(
686
863
  "div",
687
864
  {
688
- ref: d,
865
+ ref: s,
689
866
  style: {
690
- ...b,
691
867
  overflow: "hidden",
692
- transition: `width ${c}ms ease`
868
+ transition: `height ${o}ms ease`,
869
+ paddingLeft: "1em"
693
870
  },
694
- children: s
871
+ className: "slideDown-enter-done",
872
+ tabIndex: -1,
873
+ children: n
695
874
  }
696
875
  )
697
876
  }
698
877
  );
699
878
  }
700
- const we = (t, s) => {
879
+ const Le = (t, n) => {
701
880
  if (!t) return null;
702
- if (typeof t == "string")
703
- return /* @__PURE__ */ h.jsx("img", { src: t, ...s, alt: "" });
704
- if (He(t))
705
- return We(t, s);
881
+ if (typeof t == "string") return /* @__PURE__ */ u.jsx("img", { src: t, ...n, alt: "" });
882
+ if (er(t)) return rr(t, n);
706
883
  if (typeof t == "function" || typeof t == "object" && t.$$typeof) {
707
- const c = t;
708
- return /* @__PURE__ */ h.jsx(c, { ...s });
884
+ const o = t;
885
+ return /* @__PURE__ */ u.jsx(o, { ...n });
709
886
  }
710
887
  return null;
711
- }, rr = Ye(({
888
+ }, pr = (t, n, o, s, f, c, p) => t.groupHeader ? "rac-select-option rac-group-option" : [
889
+ "rac-select-option",
890
+ t.className,
891
+ s === t.id && "rac-selected",
892
+ n === o && "rac-highlighted",
893
+ (t.disabled || t.loading) && "rac-disabled-option",
894
+ (t.invalid || t.name === p) && "rac-invalid-option",
895
+ t.loadMore && f === c && "rac-loading-option",
896
+ typeof t.raw == "boolean" && (t.raw ? "rac-true-option" : "rac-false-option")
897
+ ].filter(Boolean).join(" "), mr = Qe(({
712
898
  unmount: t,
713
- children: s,
714
- renderedDropdown: c,
715
- visibility: i,
716
- ownBehavior: b = !1,
717
- alwaysOpen: d = !1,
899
+ children: n,
900
+ renderedDropdown: o,
901
+ visibility: s,
902
+ ownBehavior: f = !1,
903
+ alwaysOpen: c = !1,
718
904
  duration: p = 300,
719
- easing: $ = "ease-out",
720
- offset: y = 2,
721
- animateOpacity: N = !0,
722
- style: G = {},
723
- className: U = "",
724
- ArrowIcon: F = Ge,
725
- ClearIcon: A = Me,
726
- hasMore: S = !1,
727
- loadMore: _ = () => {
905
+ easing: v = "ease-out",
906
+ offset: h = 2,
907
+ animateOpacity: x = !0,
908
+ style: P = {},
909
+ className: N = "",
910
+ ArrowIcon: $ = or,
911
+ ClearIcon: w = ir,
912
+ hasMore: R = !1,
913
+ loadMore: F = () => {
914
+ console.warn("loadMore not implemented");
728
915
  },
729
- loadButton: w = !1,
730
- loadButtonText: P = "Load more",
731
- loadMoreText: C = "Loading",
732
- loadOffset: V = 100,
733
- loadAhead: u = 3,
734
- childrenFirst: D = !1,
735
- ...X
736
- }, I) => {
737
- const [J, Y] = te(w ? P : C);
738
- z(() => {
739
- Y(w ? P : C);
740
- }, [w, P, C]);
741
- const g = Se(), m = ne(() => g.replace(/:/g, ""), [g]), [L, x] = te([]), q = R((o) => {
742
- x((W) => [...W, o]);
743
- }, []), M = R((o) => {
744
- x((W) => W.filter((ee) => ee.id !== o));
745
- }, []), K = re(null);
746
- z(() => {
747
- I && (typeof I == "function" ? I(K.current) : I.current = K.current);
748
- }, [I]), Ve(I, () => K.current);
749
- const [Q, l] = te(!1), v = ne(() => d ? !0 : b ? !!i : Q, [d, b, i, Q]), k = R((o) => {
750
- d || b || l((W) => typeof o == "function" ? o(W) : o);
751
- }, [d, b]), { normalizedOptions: e, selected: n, selectOption: r, clear: a, hasOptions: E, active: j, selectedValue: f, disabled: T, loading: O, error: H, placeholder: B, invalidOption: ke, emptyText: de, disabledText: fe, loadingText: ge, errorText: he } = Ke({ ...X, setVisibility: k, jsxOptions: L, hasMore: S, loadButton: w, loadingTitle: J, loadMore: _, loadMoreText: C, setLoadingTitle: Y, childrenFirst: D }), { handleListScroll: Te, handleBlur: Ne, handleFocus: Ae, handleToggle: Pe, handleKeyDown: Ce, highlightedIndex: se, setHighlightedIndex: Ie } = Xe({
752
- setLoadingTitle: Y,
753
- loadButton: w,
754
- loadButtonText: P,
755
- hasMore: S,
756
- loadMore: _,
757
- disabled: T,
758
- isOpen: v,
759
- setIsOpen: k,
760
- options: e,
761
- selectOption: r,
762
- selected: n,
763
- loadOffset: V,
764
- loadAhead: u
765
- }), [be, pe] = te(!1);
766
- z(() => {
767
- v || pe(!1);
768
- }, [v]), z(() => {
769
- (H || T || O || !E) && k(!1);
770
- }, [H, T, O, E]), z(() => {
771
- if (v && be && se !== -1) {
772
- const o = e[se];
773
- if (o) {
774
- const W = `opt-${m}-${ce(o.id)}`, ee = document.getElementById(W);
775
- ee && ee.scrollIntoView({ block: "nearest" });
916
+ loadButton: S = !1,
917
+ loadButtonText: H = "Load more",
918
+ loadMoreText: D = "Loading",
919
+ loadOffset: W = 100,
920
+ loadAhead: d = 3,
921
+ childrenFirst: I = !1,
922
+ ...J
923
+ }, U) => {
924
+ const z = Re(), g = se(() => z.replace(/:/g, ""), [z]), [E, M] = ae([]), [O, Y] = ae(!1), [L, ee] = ae(S ? H : D), [q, C] = ae(!1), re = ce(null), oe = T((k) => {
925
+ M((G) => {
926
+ const X = G.findIndex((ne) => ne.id === k.id);
927
+ if (X !== -1) {
928
+ const ne = G[X];
929
+ if (ne.label === k.label && ne.value === k.value && ne.disabled === k.disabled && ne.group === k.group)
930
+ return G;
931
+ const pe = [...G];
932
+ return pe[X] = k, pe;
776
933
  }
934
+ return [...G, k];
935
+ });
936
+ }, []), K = T((k) => {
937
+ M((G) => {
938
+ const X = G.filter((ne) => ne.id !== k);
939
+ return X.length === G.length ? G : X;
940
+ });
941
+ }, []), e = c ? !0 : f ? !!s : O, r = T((k) => {
942
+ c || f || Y(k);
943
+ }, [c, f]), l = fr({
944
+ ...J,
945
+ setVisibility: r,
946
+ jsxOptions: E,
947
+ hasMore: R,
948
+ loadButton: S,
949
+ loadingTitle: L,
950
+ loadMore: F,
951
+ loadMoreText: D,
952
+ setLoadingTitle: ee,
953
+ childrenFirst: I
954
+ }), { normalizedOptions: a, selected: j, selectOption: _, clear: m, hasOptions: A, active: i, selectedValue: b, disabled: V, loading: Z, error: ue, placeholder: te, invalidOption: le, emptyText: Q, disabledText: ge, loadingText: de, errorText: xe, expandedGroups: ve } = l, Ge = ur({ setLoadingTitle: ee, loadButton: S, loadButtonText: H, hasMore: R, loadMore: F, disabled: V, open: e, setOpen: r, options: a, selectOption: _, selected: j, loadOffset: W, loadAhead: d }), { handleListScroll: Ie, handleBlur: ze, handleFocus: Me, handleToggle: We, handleKeyDown: Je, highlightedIndex: fe, setHighlightedIndex: je } = Ge;
955
+ Be(U, () => re.current), B(() => {
956
+ e || C(!1);
957
+ }, [e]), B(() => {
958
+ (ue || V || Z || !A) && r(!1);
959
+ }, [ue, V, Z, A, r]), B(() => {
960
+ if (e && q && fe !== -1) {
961
+ const k = a[fe];
962
+ k && document.getElementById(`opt-${g}-${_e(k.id)}`)?.scrollIntoView({ block: "nearest" });
777
963
  }
778
- }, [se, v, be, e, m]);
779
- const ye = f != null && !(Array.isArray(f) && f.length === 0) && !(typeof f == "object" && Object.keys(f).length === 0), xe = ne(() => {
780
- if (H) return he;
781
- if (O) return ge;
782
- if (T) return fe;
783
- if (n) return n.jsx ?? n.name;
784
- if (ye) {
785
- const o = e.find((W) => W.raw === f);
786
- return o ? o.name : typeof f == "object" && f !== null ? f.name ?? f.label ?? "Selected Object" : String(f);
964
+ }, [fe, e, q, a, g]);
965
+ const Se = se(() => b != null && !(Array.isArray(b) && b.length === 0) && !(typeof b == "object" && Object.keys(b).length === 0), [b]), Ue = se(() => {
966
+ if (ue) return xe;
967
+ if (Z) return de;
968
+ if (V) return ge;
969
+ if (j) return j.jsx ?? j.name;
970
+ if (Se) {
971
+ const k = a.find((G) => G.raw === b);
972
+ return k ? k.name : typeof b == "object" && b !== null ? b.name ?? b.label ?? "Selected Object" : String(b);
787
973
  }
788
- return E ? B : de;
789
- }, [T, O, H, E, n, f, B, he, ge, fe, de]), Le = `${m}-listbox`, Oe = ne(() => e?.map((o, W) => {
790
- const ee = `opt-${m}-${ce(o.id)}`;
791
- let Z = "rac-select-option";
792
- return o.className && (Z += ` ${o.className}`), n?.id === o.id && (Z += " rac-selected"), W === se && (Z += " rac-highlighted"), (o.disabled || o.loading) && (Z += " rac-disabled-option"), o.invalid && (Z += " rac-invalid-option"), o.loadMore && J == C && (Z += " rac-loading-option"), typeof o.raw == "boolean" && (Z += o.raw ? " rac-true-option" : " rac-false-option"), o.name == ke && (Z += " rac-invalid-option"), /* @__PURE__ */ h.jsxs(
974
+ return A ? te : Q;
975
+ }, [V, Z, ue, A, j, b, te, xe, de, ge, Q, Se, a]), Xe = se(() => {
976
+ const k = [];
977
+ let G = [], X = null;
978
+ const ne = a.reduce((y, ie) => (ie.group && (y[ie.group] = (y[ie.group] || 0) + 1), y), {}), pe = (y) => {
979
+ y === null || G.length === 0 || (k.push(
980
+ /* @__PURE__ */ u.jsx(
981
+ gr,
982
+ {
983
+ visibility: ve.has(y),
984
+ children: G
985
+ },
986
+ `slide-${y}`
987
+ )
988
+ ), G = []);
989
+ }, Ne = (y, ie) => /* @__PURE__ */ u.jsxs(
793
990
  "div",
794
991
  {
795
- className: Z,
796
- onClick: (ve) => {
797
- if (o.loading) {
798
- ve.stopPropagation();
799
- return;
800
- }
801
- r(o, ve);
802
- },
803
- onMouseEnter: () => !o.disabled && !o.loading && Ie(W),
804
- id: ee,
992
+ id: `opt-${g}-${_e(y.id)}`,
805
993
  role: "option",
806
- "aria-selected": n?.id === o.id,
807
- "aria-disabled": o.disabled || o.loading,
808
- "data-loading": o.loading,
994
+ "aria-selected": j?.id === y.id,
995
+ "aria-disabled": y.disabled || y.loading,
996
+ className: pr(y, ie, fe, j?.id, L, D, le),
997
+ onClick: (he) => !y.loading && _(y, he),
998
+ onMouseEnter: () => !y.disabled && !y.loading && je(ie),
809
999
  children: [
810
- o.jsx ?? o.name,
811
- o.loading && /* @__PURE__ */ h.jsxs("span", { className: "rac-loading-dots", children: [
812
- /* @__PURE__ */ h.jsx("i", {}),
813
- /* @__PURE__ */ h.jsx("i", {}),
814
- /* @__PURE__ */ h.jsx("i", {})
1000
+ y.jsx ?? y.name,
1001
+ y.loading && /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
1002
+ /* @__PURE__ */ u.jsx("i", {}),
1003
+ /* @__PURE__ */ u.jsx("i", {}),
1004
+ /* @__PURE__ */ u.jsx("i", {})
815
1005
  ] })
816
1006
  ]
817
1007
  },
818
- o.id
1008
+ y.id
819
1009
  );
820
- }), [e, r, m, n, se]);
821
- return /* @__PURE__ */ h.jsxs(
822
- $e.Provider,
823
- {
824
- value: { registerOption: q, unregisterOption: M },
825
- children: [
826
- s,
827
- c,
828
- /* @__PURE__ */ h.jsxs(
829
- "div",
830
- {
831
- style: {
832
- "--rac-duration": `${p}ms`,
833
- ...G
834
- },
835
- className: `rac-select
836
- ${U}
837
- ${!E || T ? "rac-disabled-style" : ""}
838
- ${O ? "rac-loading-style" : ""}
839
- ${H ? "rac-error-style" : ""}`,
840
- tabIndex: j ? 0 : -1,
841
- ref: K,
842
- role: "combobox",
843
- "aria-haspopup": "listbox",
844
- "aria-expanded": v,
845
- "aria-controls": Le,
846
- "aria-label": B,
847
- "aria-disabled": T || !E,
848
- ...j && {
849
- onBlur: Ne,
850
- onFocus: Ae,
851
- onClick: Pe,
852
- onKeyDown: Ce
1010
+ return a.forEach((y, ie) => {
1011
+ const he = y.groupHeader, Ae = !!y.group;
1012
+ if ((he || !Ae && X !== null) && (pe(X), he || (X = null)), he) {
1013
+ X = y.name;
1014
+ const qe = ve.has(y.name), Ke = ne[y.name] > 0;
1015
+ k.push(
1016
+ /* @__PURE__ */ u.jsxs(
1017
+ "div",
1018
+ {
1019
+ className: "rac-group-header",
1020
+ onClick: (Ze) => _(y, Ze),
1021
+ children: [
1022
+ /* @__PURE__ */ u.jsx("span", { className: "rac-group-title-text", children: y.name }),
1023
+ /* @__PURE__ */ u.jsx(
1024
+ Ee,
1025
+ {
1026
+ visibility: Ke,
1027
+ duration: p,
1028
+ style: { display: "grid" },
1029
+ children: /* @__PURE__ */ u.jsx("span", { className: `rac-group-arrow-wrapper ${qe ? "--open" : ""}`, children: Le($, { className: "rac-select-arrow-wrapper" }) })
1030
+ }
1031
+ )
1032
+ ]
853
1033
  },
854
- children: [
855
- /* @__PURE__ */ h.jsxs(
856
- "div",
857
- {
858
- className: `rac-select-title ${!H && !O && n?.type == "boolean" ? n.raw ? "rac-true-option" : "rac-false-option" : ""}`,
859
- children: [
860
- /* @__PURE__ */ h.jsx(
861
- "span",
862
- {
863
- className: "rac-title-text",
864
- children: xe
865
- },
866
- xe
867
- ),
868
- /* @__PURE__ */ h.jsx(
869
- oe,
870
- {
871
- visibility: O && !H,
872
- duration: p,
873
- children: /* @__PURE__ */ h.jsxs("span", { className: "rac-loading-dots", children: [
874
- /* @__PURE__ */ h.jsx("i", {}),
875
- /* @__PURE__ */ h.jsx("i", {}),
876
- /* @__PURE__ */ h.jsx("i", {})
877
- ] })
878
- }
879
- )
880
- ]
881
- }
882
- ),
883
- /* @__PURE__ */ h.jsxs(
884
- "div",
885
- {
886
- className: "rac-select-buttons",
887
- children: [
888
- /* @__PURE__ */ h.jsx(
889
- oe,
890
- {
891
- visibility: ye && E && !T && !O && !H,
892
- duration: p,
893
- style: { display: "grid" },
894
- children: we(A, {
895
- className: "rac-select-cancel",
896
- onMouseDown: (o) => {
897
- o.preventDefault(), o.stopPropagation();
898
- },
899
- onClick: a
900
- })
901
- }
902
- ),
903
- /* @__PURE__ */ h.jsx(
904
- oe,
905
- {
906
- visibility: j,
907
- duration: p,
908
- style: { display: "grid" },
909
- children: /* @__PURE__ */ h.jsx(
910
- "span",
911
- {
912
- className: `rac-select-arrow-wrapper ${v ? "--open" : ""}`,
913
- children: we(F, {
914
- className: "rac-select-arrow-wrapper"
915
- })
916
- }
917
- )
918
- }
919
- )
920
- ]
921
- }
922
- ),
923
- /* @__PURE__ */ h.jsx(
924
- Qe,
925
- {
926
- visibility: v,
927
- selectRef: K,
928
- onAnimationDone: () => pe(!0),
929
- unmount: t,
930
- duration: p,
931
- easing: $,
932
- offset: y,
933
- animateOpacity: N,
934
- children: /* @__PURE__ */ h.jsxs(
935
- "div",
936
- {
937
- onScroll: Te,
938
- tabIndex: "-1",
939
- className: "rac-select-list",
940
- role: "listbox",
941
- "aria-label": "Options",
942
- children: [
943
- Oe,
944
- !w && S ? /* @__PURE__ */ h.jsxs(
945
- "div",
946
- {
947
- onClick: (o) => o.stopPropagation(),
948
- onMouseEnter: (o) => o.preventDefault(),
949
- className: "rac-select-option rac-disabled-option rac-loading-option",
950
- children: [
951
- /* @__PURE__ */ h.jsx(
952
- "span",
953
- {
954
- className: "rac-loading-option-title",
955
- children: "Loading"
956
- }
957
- ),
958
- /* @__PURE__ */ h.jsxs("span", { className: "rac-loading-dots", children: [
959
- /* @__PURE__ */ h.jsx("i", {}),
960
- /* @__PURE__ */ h.jsx("i", {}),
961
- /* @__PURE__ */ h.jsx("i", {})
962
- ] })
963
- ]
964
- }
965
- ) : null
966
- ]
967
- }
968
- )
969
- }
970
- )
971
- ]
972
- }
973
- )
974
- ]
1034
+ y.id
1035
+ )
1036
+ );
1037
+ } else Ae ? G.push(Ne(y, ie)) : k.push(Ne(y, ie));
1038
+ }), pe(X), k;
1039
+ }, [
1040
+ a,
1041
+ _,
1042
+ g,
1043
+ j,
1044
+ fe,
1045
+ L,
1046
+ D,
1047
+ le,
1048
+ je,
1049
+ ve,
1050
+ $
1051
+ ]);
1052
+ return /* @__PURE__ */ u.jsx(
1053
+ cr,
1054
+ {
1055
+ selectRef: re,
1056
+ selectId: g,
1057
+ renderIcon: Le,
1058
+ normalizedOptions: a,
1059
+ renderOptions: Xe,
1060
+ selected: j,
1061
+ title: Ue,
1062
+ visibility: e,
1063
+ active: i,
1064
+ hasOptions: A,
1065
+ hasActualValue: Se,
1066
+ highlightedIndex: fe,
1067
+ animationFinished: q,
1068
+ disabled: V,
1069
+ loading: Z,
1070
+ error: ue,
1071
+ setVisibility: r,
1072
+ setHighlightedIndex: je,
1073
+ setAnimationFinished: C,
1074
+ handleBlur: ze,
1075
+ handleFocus: Me,
1076
+ handleToggle: We,
1077
+ handleKeyDown: Je,
1078
+ handleListScroll: Ie,
1079
+ selectOption: _,
1080
+ clear: m,
1081
+ registerOption: oe,
1082
+ unregisterOption: K,
1083
+ children: n,
1084
+ renderedDropdown: o,
1085
+ placeholder: te,
1086
+ className: N,
1087
+ style: P,
1088
+ duration: p,
1089
+ easing: v,
1090
+ offset: h,
1091
+ animateOpacity: x,
1092
+ unmount: t,
1093
+ ArrowIcon: $,
1094
+ ClearIcon: w,
1095
+ hasMore: R,
1096
+ loadButton: S
975
1097
  }
976
1098
  );
977
- }), ue = (t) => t ? typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(ue).join(" ").replace(/\s+/g, " ").trim() : _e.isValidElement(t) ? ue(t.props.children) : "" : "";
978
- function tr({ value: t, id: s, className: c, children: i, disabled: b }) {
979
- const d = ze($e);
980
- return z(() => {
981
- if (!d) return;
982
- const p = ue(i), $ = typeof i == "string" && i !== "" ? i : p || String(t ?? s ?? ""), y = {
983
- id: String(s ?? ce(String(p))),
984
- value: t !== void 0 ? t : p,
985
- label: $,
986
- jsx: i,
987
- className: c,
988
- disabled: !!b
1099
+ }), Ve = He(null);
1100
+ function xr({ children: t, name: n, label: o, value: s, id: f, emptyGroupText: c = "Empty group" }) {
1101
+ const p = we(Te), v = se(() => {
1102
+ const x = n ?? o ?? s ?? f;
1103
+ return x != null && x !== "" ? String(x) : c;
1104
+ }, [n, o, s, f, c]), h = se(() => `group-marker-${_e(v)}`, [v]);
1105
+ return B(() => {
1106
+ if (!p) return;
1107
+ const x = {
1108
+ id: h,
1109
+ group: v,
1110
+ isGroupMarker: !0,
1111
+ disabled: !0
989
1112
  };
990
- return d.registerOption(y), () => d.unregisterOption(y.id);
991
- }, [s, t, i, c, b]), null;
1113
+ return p.registerOption(x), () => p.unregisterOption(h);
1114
+ }, [p.registerOption, p.unregisterOption, h, v]), /* @__PURE__ */ u.jsx(Ve.Provider, { value: v, children: t });
1115
+ }
1116
+ const $e = (t) => t ? typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map($e).join(" ").replace(/\s+/g, " ").trim() : Fe.isValidElement(t) ? $e(t.props.children) : "" : "";
1117
+ function yr({ value: t, id: n, className: o, children: s, disabled: f, group: c }) {
1118
+ const p = we(Te), v = we(Ve), h = p?.registerOption, x = p?.unregisterOption, P = Re(), N = se(() => n ? String(n) : P.replace(/:/g, ""), [n, P]);
1119
+ return B(() => {
1120
+ if (!h) return;
1121
+ const $ = $e(s);
1122
+ let w = "";
1123
+ return typeof s == "string" && s !== "" ? w = s : $ ? w = $ : t != null && (w = String(t)), h({
1124
+ id: N,
1125
+ value: t !== void 0 ? t : $,
1126
+ label: w,
1127
+ jsx: s,
1128
+ className: o,
1129
+ disabled: !!f,
1130
+ group: c || v || null
1131
+ }), () => x(N);
1132
+ }, [N, t, s, o, f, c, v, h, x]), null;
992
1133
  }
993
1134
  export {
994
- tr as Option,
995
- rr as Select
1135
+ xr as OptGroup,
1136
+ yr as Option,
1137
+ mr as Select
996
1138
  };