react-animated-select 0.2.7 → 0.2.9

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,24 +1,24 @@
1
- import ye, { createContext as Ae, useRef as oe, useState as Q, useEffect as H, useCallback as k, useMemo as Y, useId as xe, memo as Ne, forwardRef as Oe, useImperativeHandle as Ie, isValidElement as Pe, cloneElement as Ce, useContext as De } from "react";
1
+ import xe, { createContext as Ae, useRef as oe, useState as Q, useEffect as W, useCallback as k, useMemo as X, useId as Ee, memo as Ne, forwardRef as Ie, useImperativeHandle as Oe, isValidElement as Pe, cloneElement as Ce, useContext as De } from "react";
2
2
  import { CSSTransition as ve } from "react-transition-group";
3
- import './index.css';var se = { exports: {} }, te = {};
3
+ import './index.css';var le = { exports: {} }, te = {};
4
4
  var be;
5
5
  function Fe() {
6
6
  if (be) return te;
7
7
  be = 1;
8
- var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), o = /* @__PURE__ */ Symbol.for("react.fragment");
9
- function s(c, f, l) {
10
- var m = null;
11
- if (l !== void 0 && (m = "" + l), f.key !== void 0 && (m = "" + f.key), "key" in f) {
12
- l = {};
13
- for (var R in f)
14
- R !== "key" && (l[R] = f[R]);
15
- } else l = f;
16
- return f = l.ref, {
17
- $$typeof: r,
18
- type: c,
19
- key: m,
8
+ var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), o = /* @__PURE__ */ Symbol.for("react.fragment");
9
+ function s(l, f, a) {
10
+ var x = null;
11
+ if (a !== void 0 && (x = "" + a), f.key !== void 0 && (x = "" + f.key), "key" in f) {
12
+ a = {};
13
+ for (var S in f)
14
+ S !== "key" && (a[S] = f[S]);
15
+ } else a = f;
16
+ return f = a.ref, {
17
+ $$typeof: t,
18
+ type: l,
19
+ key: x,
20
20
  ref: f !== void 0 ? f : null,
21
- props: l
21
+ props: a
22
22
  };
23
23
  }
24
24
  return te.Fragment = o, te.jsx = s, te.jsxs = s, te;
@@ -27,44 +27,44 @@ var ne = {};
27
27
  var he;
28
28
  function Le() {
29
29
  return he || (he = 1, process.env.NODE_ENV !== "production" && (function() {
30
- function r(e) {
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 === n ? null : e.displayName || e.name || null;
34
34
  if (typeof e == "string") return e;
35
35
  switch (e) {
36
- case E:
36
+ case m:
37
37
  return "Fragment";
38
- case O:
38
+ case L:
39
39
  return "Profiler";
40
- case y:
40
+ case E:
41
41
  return "StrictMode";
42
- case L:
42
+ case _:
43
43
  return "Suspense";
44
- case V:
45
- return "SuspenseList";
46
44
  case z:
45
+ return "SuspenseList";
46
+ case q:
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 u:
54
- return "Portal";
55
53
  case d:
54
+ return "Portal";
55
+ case u:
56
56
  return e.displayName || "Context";
57
- case $:
57
+ case C:
58
58
  return (e._context.displayName || "Context") + ".Consumer";
59
59
  case U:
60
- var a = e.render;
61
- return e = e.displayName, e || (e = a.displayName || a.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
- case B:
63
- return a = e.displayName || null, a !== null ? a : r(e.type) || "Memo";
64
- case T:
65
- a = e._payload, e = e._init;
60
+ var c = e.render;
61
+ return e = e.displayName, e || (e = c.displayName || c.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
62
+ case ee:
63
+ return c = e.displayName || null, c !== null ? c : t(e.type) || "Memo";
64
+ case O:
65
+ c = e._payload, e = e._init;
66
66
  try {
67
- return r(e(a));
67
+ return t(e(c));
68
68
  } catch {
69
69
  }
70
70
  }
@@ -76,71 +76,71 @@ function Le() {
76
76
  function s(e) {
77
77
  try {
78
78
  o(e);
79
- var a = !1;
79
+ var c = !1;
80
80
  } catch {
81
- a = !0;
81
+ c = !0;
82
82
  }
83
- if (a) {
84
- a = console;
85
- var h = a.error, _ = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
- return h.call(
87
- a,
83
+ if (c) {
84
+ c = console;
85
+ var g = c.error, T = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
86
+ return g.call(
87
+ c,
88
88
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
- _
89
+ T
90
90
  ), o(e);
91
91
  }
92
92
  }
93
- function c(e) {
94
- if (e === E) return "<>";
95
- if (typeof e == "object" && e !== null && e.$$typeof === T)
93
+ function l(e) {
94
+ if (e === m) return "<>";
95
+ if (typeof e == "object" && e !== null && e.$$typeof === O)
96
96
  return "<...>";
97
97
  try {
98
- var a = r(e);
99
- return a ? "<" + a + ">" : "<...>";
98
+ var c = t(e);
99
+ return c ? "<" + c + ">" : "<...>";
100
100
  } catch {
101
101
  return "<...>";
102
102
  }
103
103
  }
104
104
  function f() {
105
- var e = S.A;
105
+ var e = b.A;
106
106
  return e === null ? null : e.getOwner();
107
107
  }
108
- function l() {
108
+ function a() {
109
109
  return Error("react-stack-top-frame");
110
110
  }
111
- function m(e) {
112
- if (q.call(e, "key")) {
113
- var a = Object.getOwnPropertyDescriptor(e, "key").get;
114
- if (a && a.isReactWarning) return !1;
111
+ function x(e) {
112
+ if ($.call(e, "key")) {
113
+ var c = Object.getOwnPropertyDescriptor(e, "key").get;
114
+ if (c && c.isReactWarning) return !1;
115
115
  }
116
116
  return e.key !== void 0;
117
117
  }
118
- function R(e, a) {
119
- function h() {
120
- t || (t = !0, console.error(
118
+ function S(e, c) {
119
+ function g() {
120
+ i || (i = !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
- a
122
+ c
123
123
  ));
124
124
  }
125
- h.isReactWarning = !0, Object.defineProperty(e, "key", {
126
- get: h,
125
+ g.isReactWarning = !0, Object.defineProperty(e, "key", {
126
+ get: g,
127
127
  configurable: !0
128
128
  });
129
129
  }
130
130
  function v() {
131
- var e = r(this.type);
132
- return b[e] || (b[e] = !0, console.error(
131
+ var e = t(this.type);
132
+ return h[e] || (h[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 j(e, a, h, _, J, K) {
137
- var w = h.ref;
136
+ function j(e, c, g, T, B, K) {
137
+ var w = g.ref;
138
138
  return e = {
139
- $$typeof: C,
139
+ $$typeof: I,
140
140
  type: e,
141
- key: a,
142
- props: h,
143
- _owner: _
141
+ key: c,
142
+ props: g,
143
+ _owner: T
144
144
  }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(e, "ref", {
145
145
  enumerable: !1,
146
146
  get: v
@@ -158,7 +158,7 @@ function Le() {
158
158
  configurable: !1,
159
159
  enumerable: !1,
160
160
  writable: !0,
161
- value: J
161
+ value: B
162
162
  }), Object.defineProperty(e, "_debugTask", {
163
163
  configurable: !1,
164
164
  enumerable: !1,
@@ -166,104 +166,104 @@ function Le() {
166
166
  value: K
167
167
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
168
168
  }
169
- function F(e, a, h, _, J, K) {
170
- var w = a.children;
169
+ function F(e, c, g, T, B, K) {
170
+ var w = c.children;
171
171
  if (w !== void 0)
172
- if (_)
173
- if (ee(w)) {
174
- for (_ = 0; _ < w.length; _++)
175
- P(w[_]);
172
+ if (T)
173
+ if (V(w)) {
174
+ for (T = 0; T < w.length; T++)
175
+ P(w[T]);
176
176
  Object.freeze && Object.freeze(w);
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
181
  else P(w);
182
- if (q.call(a, "key")) {
183
- w = r(e);
184
- var W = Object.keys(a).filter(function(ie) {
185
- return ie !== "key";
182
+ if ($.call(c, "key")) {
183
+ w = t(e);
184
+ var H = Object.keys(c).filter(function(se) {
185
+ return se !== "key";
186
186
  });
187
- _ = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", x[w + _] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ T = 0 < H.length ? "{key: someKey, " + H.join(": ..., ") + ": ...}" : "{key: someKey}", Y[w + T] || (H = 0 < H.length ? "{" + H.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} />
191
191
  React keys must be passed directly to JSX without using spread:
192
192
  let props = %s;
193
193
  <%s key={someKey} {...props} />`,
194
- _,
194
+ T,
195
195
  w,
196
- W,
196
+ H,
197
197
  w
198
- ), x[w + _] = !0);
198
+ ), Y[w + T] = !0);
199
199
  }
200
- if (w = null, h !== void 0 && (s(h), w = "" + h), m(a) && (s(a.key), w = "" + a.key), "key" in a) {
201
- h = {};
202
- for (var Z in a)
203
- Z !== "key" && (h[Z] = a[Z]);
204
- } else h = a;
205
- return w && R(
206
- h,
200
+ if (w = null, g !== void 0 && (s(g), w = "" + g), x(c) && (s(c.key), w = "" + c.key), "key" in c) {
201
+ g = {};
202
+ for (var Z in c)
203
+ Z !== "key" && (g[Z] = c[Z]);
204
+ } else g = c;
205
+ return w && S(
206
+ g,
207
207
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
208
208
  ), j(
209
209
  e,
210
210
  w,
211
- h,
211
+ g,
212
212
  f(),
213
- J,
213
+ B,
214
214
  K
215
215
  );
216
216
  }
217
217
  function P(e) {
218
- A(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === T && (e._payload.status === "fulfilled" ? A(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
+ N(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === O && (e._payload.status === "fulfilled" ? N(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
219
219
  }
220
- function A(e) {
221
- return typeof e == "object" && e !== null && e.$$typeof === C;
220
+ function N(e) {
221
+ return typeof e == "object" && e !== null && e.$$typeof === I;
222
222
  }
223
- var N = ye, C = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.portal"), E = /* @__PURE__ */ Symbol.for("react.fragment"), y = /* @__PURE__ */ Symbol.for("react.strict_mode"), O = /* @__PURE__ */ Symbol.for("react.profiler"), $ = /* @__PURE__ */ Symbol.for("react.consumer"), d = /* @__PURE__ */ Symbol.for("react.context"), U = /* @__PURE__ */ Symbol.for("react.forward_ref"), L = /* @__PURE__ */ Symbol.for("react.suspense"), V = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), T = /* @__PURE__ */ Symbol.for("react.lazy"), z = /* @__PURE__ */ Symbol.for("react.activity"), M = /* @__PURE__ */ Symbol.for("react.client.reference"), S = N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, ee = Array.isArray, I = console.createTask ? console.createTask : function() {
223
+ var A = xe, I = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.portal"), m = /* @__PURE__ */ Symbol.for("react.fragment"), E = /* @__PURE__ */ Symbol.for("react.strict_mode"), L = /* @__PURE__ */ Symbol.for("react.profiler"), C = /* @__PURE__ */ Symbol.for("react.consumer"), u = /* @__PURE__ */ Symbol.for("react.context"), U = /* @__PURE__ */ Symbol.for("react.forward_ref"), _ = /* @__PURE__ */ Symbol.for("react.suspense"), z = /* @__PURE__ */ Symbol.for("react.suspense_list"), ee = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), q = /* @__PURE__ */ Symbol.for("react.activity"), n = /* @__PURE__ */ Symbol.for("react.client.reference"), b = A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, V = Array.isArray, r = console.createTask ? console.createTask : function() {
224
224
  return null;
225
225
  };
226
- N = {
226
+ A = {
227
227
  react_stack_bottom_frame: function(e) {
228
228
  return e();
229
229
  }
230
230
  };
231
- var t, b = {}, n = N.react_stack_bottom_frame.bind(
232
- N,
233
- l
234
- )(), i = I(c(l)), x = {};
235
- ne.Fragment = E, ne.jsx = function(e, a, h) {
236
- var _ = 1e4 > S.recentlyCreatedOwnerStacks++;
231
+ var i, h = {}, R = A.react_stack_bottom_frame.bind(
232
+ A,
233
+ a
234
+ )(), M = r(l(a)), Y = {};
235
+ ne.Fragment = m, ne.jsx = function(e, c, g) {
236
+ var T = 1e4 > b.recentlyCreatedOwnerStacks++;
237
237
  return F(
238
238
  e,
239
- a,
240
- h,
239
+ c,
240
+ g,
241
241
  !1,
242
- _ ? Error("react-stack-top-frame") : n,
243
- _ ? I(c(e)) : i
242
+ T ? Error("react-stack-top-frame") : R,
243
+ T ? r(l(e)) : M
244
244
  );
245
- }, ne.jsxs = function(e, a, h) {
246
- var _ = 1e4 > S.recentlyCreatedOwnerStacks++;
245
+ }, ne.jsxs = function(e, c, g) {
246
+ var T = 1e4 > b.recentlyCreatedOwnerStacks++;
247
247
  return F(
248
248
  e,
249
- a,
250
- h,
249
+ c,
250
+ g,
251
251
  !0,
252
- _ ? Error("react-stack-top-frame") : n,
253
- _ ? I(c(e)) : i
252
+ T ? Error("react-stack-top-frame") : R,
253
+ T ? r(l(e)) : M
254
254
  );
255
255
  };
256
256
  })()), ne;
257
257
  }
258
258
  var ge;
259
- function Ye() {
260
- return ge || (ge = 1, process.env.NODE_ENV === "production" ? se.exports = Fe() : se.exports = Le()), se.exports;
259
+ function Me() {
260
+ return ge || (ge = 1, process.env.NODE_ENV === "production" ? le.exports = Fe() : le.exports = Le()), le.exports;
261
261
  }
262
- var g = Ye();
263
- const Me = ({ className: r = "", ...o }) => /* @__PURE__ */ g.jsx(
262
+ var y = Me();
263
+ const Ye = ({ className: t = "", ...o }) => /* @__PURE__ */ y.jsx(
264
264
  "svg",
265
265
  {
266
- className: r,
266
+ className: t,
267
267
  role: "button",
268
268
  "aria-label": "Clear selection",
269
269
  xmlns: "http://www.w3.org/2000/svg",
@@ -272,357 +272,365 @@ const Me = ({ className: r = "", ...o }) => /* @__PURE__ */ g.jsx(
272
272
  height: "1em",
273
273
  fill: "currentColor",
274
274
  ...o,
275
- children: /* @__PURE__ */ g.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
+ children: /* @__PURE__ */ y.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
- ), Ve = ({ className: r = "", ...o }) => /* @__PURE__ */ g.jsx(
277
+ ), Ve = ({ className: t = "", ...o }) => /* @__PURE__ */ y.jsx(
278
278
  "svg",
279
279
  {
280
- className: r,
280
+ className: t,
281
281
  xmlns: "http://www.w3.org/2000/svg",
282
282
  viewBox: "0 0 448 512",
283
283
  width: "1em",
284
284
  height: "1em",
285
285
  fill: "currentColor",
286
286
  ...o,
287
- children: /* @__PURE__ */ g.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
+ children: /* @__PURE__ */ y.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
- ), Ee = Ae(null);
290
- function ze({
291
- disabled: r,
289
+ ), me = Ae(null);
290
+ function We({
291
+ disabled: t,
292
292
  isOpen: o,
293
293
  setIsOpen: s,
294
- options: c,
294
+ options: l,
295
295
  selectOption: f,
296
- selected: l
296
+ selected: a
297
297
  }) {
298
- const m = oe(!1), R = oe(0), [v, j] = Q(-1);
299
- H(() => {
300
- const u = () => {
301
- R.current = Date.now();
298
+ const x = oe(!1), S = oe(0), [v, j] = Q(-1);
299
+ W(() => {
300
+ const d = () => {
301
+ S.current = Date.now();
302
302
  };
303
- return window.addEventListener("focus", u), () => window.removeEventListener("focus", u);
304
- }, []), H(() => {
303
+ return window.addEventListener("focus", d), () => window.removeEventListener("focus", d);
304
+ }, []), W(() => {
305
305
  if (o) {
306
- let u = -1;
307
- if (l) {
308
- const E = c.findIndex((y) => y.id === l.id && !y.disabled);
309
- E >= 0 && (u = E);
306
+ let d = -1;
307
+ if (a) {
308
+ const m = l.findIndex((E) => E.id === a.id && !E.disabled);
309
+ m >= 0 && (d = m);
310
310
  }
311
- u === -1 && (u = c.findIndex((E) => !E.disabled)), j(u);
311
+ d === -1 && (d = l.findIndex((m) => !m.disabled)), j(d);
312
312
  } else
313
313
  j(-1);
314
- }, [o, l, c]);
315
- const F = k((u) => {
316
- u.currentTarget.contains(u.relatedTarget) || s(!1);
314
+ }, [o, a, l]);
315
+ const F = k((d) => {
316
+ d.currentTarget.contains(d.relatedTarget) || s(!1);
317
317
  }, [s]), P = k(() => {
318
- r || document.hidden || Date.now() - R.current < 100 || o || (s(!0), m.current = !0, setTimeout(() => {
319
- m.current = !1;
318
+ t || document.hidden || Date.now() - S.current < 100 || o || (s(!0), x.current = !0, setTimeout(() => {
319
+ x.current = !1;
320
320
  }, 200));
321
- }, [r, o, s]), A = k((u) => {
322
- r || u.target.closest(".rac-select-cancel") || m.current || s(!o);
323
- }, [r, o, s]), N = (u, E) => {
324
- if (c.every(($) => $.disabled)) return -1;
325
- let y = u, O = 0;
321
+ }, [t, o, s]), N = k((d) => {
322
+ t || d.target.closest(".rac-select-cancel") || x.current || s(!o);
323
+ }, [t, o, s]), A = (d, m) => {
324
+ if (l.every((C) => C.disabled)) return -1;
325
+ let E = d, L = 0;
326
326
  do
327
- y += E, y < 0 && (y = c.length - 1), y >= c.length && (y = 0), O++;
328
- while (c[y]?.disabled && O <= c.length);
329
- return y;
330
- }, C = k((u) => {
331
- if (!r)
332
- switch (u.key) {
327
+ E += m, E < 0 && (E = l.length - 1), E >= l.length && (E = 0), L++;
328
+ while (l[E]?.disabled && L <= l.length);
329
+ return E;
330
+ }, I = k((d) => {
331
+ if (!t)
332
+ switch (d.key) {
333
333
  case "Enter":
334
334
  case " ":
335
- u.preventDefault(), o ? v !== -1 && c[v] && f(c[v], u) : s(!0);
335
+ d.preventDefault(), o ? v !== -1 && l[v] && f(l[v], d) : s(!0);
336
336
  break;
337
337
  case "Escape":
338
- u.preventDefault(), s(!1);
338
+ d.preventDefault(), s(!1);
339
339
  break;
340
340
  case "ArrowDown":
341
- u.preventDefault(), o ? j((E) => N(E, 1)) : s(!0);
341
+ d.preventDefault(), o ? j((m) => A(m, 1)) : s(!0);
342
342
  break;
343
343
  case "ArrowUp":
344
- u.preventDefault(), o ? j((E) => N(E, -1)) : s(!0);
344
+ d.preventDefault(), o ? j((m) => A(m, -1)) : s(!0);
345
345
  break;
346
346
  case "Tab":
347
347
  o && s(!1);
348
348
  break;
349
349
  }
350
- }, [r, o, s, v, c, f]);
351
- return Y(() => ({
350
+ }, [t, o, s, v, l, f]);
351
+ return X(() => ({
352
352
  handleBlur: F,
353
353
  handleFocus: P,
354
- handleToggle: A,
355
- handleKeyDown: C,
354
+ handleToggle: N,
355
+ handleKeyDown: I,
356
356
  highlightedIndex: v,
357
357
  setHighlightedIndex: j
358
- }), [F, P, A, C, v, j]);
358
+ }), [F, P, N, I, v, j]);
359
359
  }
360
- function We({
361
- options: r = [],
360
+ function ze({
361
+ options: t = [],
362
362
  jsxOptions: o = [],
363
363
  value: s,
364
- defaultValue: c = void 0,
364
+ defaultValue: l = void 0,
365
365
  onChange: f,
366
- disabled: l = !1,
367
- loading: m = !1,
368
- error: R = !1,
366
+ disabled: a = !1,
367
+ loading: x = !1,
368
+ error: S = !1,
369
369
  placeholder: v = "Choose option",
370
370
  emptyText: j = "No options",
371
371
  disabledText: F = "Disabled",
372
372
  loadingText: P = "Loading",
373
- errorText: A = "Failed to load",
374
- disabledOption: N = "Disabled option",
375
- emptyOption: C = "Empty option",
376
- invalidOption: u = "Invalid option",
377
- setVisibility: E
373
+ errorText: N = "Failed to load",
374
+ disabledOption: A = "Disabled option",
375
+ emptyOption: I = "Empty option",
376
+ invalidOption: d = "Invalid option",
377
+ setVisibility: m
378
378
  }) {
379
- const y = xe(), O = s !== void 0, [$, d] = Q(c), U = O ? s : $, L = (t) => !t || typeof t != "object" || Array.isArray(t) ? !1 : "id" in t || "value" in t || "name" in t || "label" in t || "disabled" in t, V = Y(() => {
380
- if (!r) return [];
381
- const t = [], b = (n, i, x) => {
382
- let e = x?.id ?? x?.value;
383
- if (e == null && (e = i ?? n), typeof i == "number" && i === 0) {
384
- t.push({
385
- key: "0",
386
- value: 0,
387
- userId: 0,
388
- label: "0",
389
- original: x
379
+ const E = Ee(), L = s !== void 0, [C, u] = Q(null), U = (n) => !n || typeof n != "object" || Array.isArray(n) ? !1 : "id" in n || "value" in n || "name" in n || "label" in n || "disabled" in n, _ = X(() => {
380
+ const n = [], b = (r, i, h) => {
381
+ let R = h?.id ?? h?.value ?? i ?? r;
382
+ if (typeof i == "function") {
383
+ n.push({
384
+ key: `invalid-${n.length}`,
385
+ value: i,
386
+ userId: null,
387
+ disabled: !0,
388
+ isInvalid: !0,
389
+ label: d,
390
+ original: h
390
391
  });
391
392
  return;
392
393
  }
393
- if (typeof i == "boolean") {
394
- t.push({
395
- key: `bool-${t.length}`,
396
- value: i,
397
- userId: e,
398
- label: String(i),
399
- type: "boolean",
400
- original: x
394
+ if (i === "") {
395
+ n.push({
396
+ key: `empty-str-${n.length}`,
397
+ value: "",
398
+ userId: null,
399
+ disabled: !0,
400
+ label: I,
401
+ original: h
401
402
  });
402
403
  return;
403
404
  }
404
- if (i === "" || i === null || i === void 0) {
405
- t.push({
406
- key: `empty-${t.length}`,
405
+ if (i == null) {
406
+ n.push({
407
+ key: `empty-${n.length}`,
407
408
  value: null,
408
- userId: e ?? `empty-${t.length}`,
409
+ userId: null,
409
410
  disabled: !0,
410
- label: C,
411
- original: x
411
+ label: I,
412
+ original: h
412
413
  });
413
414
  return;
414
415
  }
415
- if (typeof i == "function") {
416
- t.push({
417
- key: `invalid-${t.length}`,
418
- value: null,
419
- userId: e ?? `invalid-${t.length}`,
420
- disabled: !0,
421
- label: u,
422
- original: x
416
+ if (typeof i == "number" || typeof i == "boolean") {
417
+ n.push({
418
+ key: `${typeof i}-${i}-${n.length}`,
419
+ value: i,
420
+ userId: R,
421
+ label: String(i),
422
+ original: h
423
423
  });
424
424
  return;
425
425
  }
426
- i && typeof i == "object" && !Array.isArray(i) ? t.push({
427
- key: i.id ?? i.value ?? i.name ?? n,
426
+ i && typeof i == "object" && !Array.isArray(i) ? n.push({
427
+ key: i.id ?? i.value ?? i.name ?? r ?? `obj-${n.length}`,
428
428
  value: i,
429
- userId: e,
429
+ userId: R,
430
430
  disabled: !!i.disabled,
431
- label: i.name ?? i.label ?? n,
432
- original: x
433
- }) : t.push({
434
- key: n,
431
+ label: i.name ?? i.label ?? String(r),
432
+ original: h
433
+ }) : n.push({
434
+ key: r ?? `opt-${n.length}`,
435
435
  value: i,
436
- userId: e,
437
- label: String(i ?? n),
438
- original: x
436
+ userId: R,
437
+ label: String(i ?? r),
438
+ original: h
439
439
  });
440
440
  };
441
- if (Array.isArray(r))
442
- for (const n of r) {
443
- if (n && typeof n == "object" && !Array.isArray(n) && Object.keys(n).length == 1 && n.disabled == !0) {
444
- t.push({
445
- key: `disabled-${t.length}`,
446
- value: null,
447
- userId: null,
448
- disabled: !0,
449
- label: N,
450
- original: n
451
- });
452
- continue;
453
- }
454
- if (L(n)) {
455
- const i = n.id ?? (typeof n.value != "object" ? n.value : n.label ?? n.name ?? n.value);
456
- t.push({
457
- key: n.id ?? n.value ?? n.name ?? `opt-${t.length}`,
458
- value: n.value ?? n.id ?? n,
459
- userId: i,
460
- disabled: !!n.disabled,
461
- label: n.name ?? n.label ?? String(n.id ?? n.value),
462
- original: n
463
- });
464
- } else if (n && typeof n == "object")
465
- for (const [i, x] of Object.entries(n))
466
- b(i, x, x);
467
- else
468
- b(n, n, n);
469
- }
470
- else if (typeof r == "object")
471
- for (const [n, i] of Object.entries(r))
472
- b(n, i, i);
473
- return t.map((n, i) => ({
474
- id: `${y}-opt-${i}`,
475
- userId: n.userId,
476
- name: String(n.label),
477
- raw: n.value,
478
- original: n.original,
479
- disabled: n.disabled,
480
- type: typeof n.value == "boolean" ? "boolean" : "normal"
441
+ Array.isArray(t) ? t.forEach((r, i) => {
442
+ if (r && typeof r == "object" && Object.keys(r).length === 1 && r.disabled === !0)
443
+ n.push({ key: `dis-${i}`, value: null, userId: null, disabled: !0, label: A, original: r });
444
+ else if (U(r)) {
445
+ const h = r.id ?? (typeof r.value != "object" ? r.value : r.label ?? r.name ?? r.value);
446
+ n.push({
447
+ key: r.id ?? r.value ?? r.name ?? `opt-${i}`,
448
+ value: r.value !== void 0 ? r.value : r.id !== void 0 ? r.id : r,
449
+ userId: h,
450
+ disabled: !!r.disabled,
451
+ label: r.name ?? r.label ?? String(r.id ?? r.value),
452
+ original: r
453
+ });
454
+ } else r && typeof r == "object" && !Array.isArray(r) ? Object.entries(r).forEach(([h, R]) => b(h, R, R)) : b(r, r, r);
455
+ }) : typeof t == "object" && t !== null && Object.entries(t).forEach(([r, i]) => b(r, i, i));
456
+ const $ = n.map((r, i) => ({
457
+ id: `${E}-opt-${i}`,
458
+ userId: r.userId,
459
+ name: String(r.label),
460
+ raw: r.value,
461
+ original: r.original,
462
+ disabled: r.disabled,
463
+ isInvalid: r.isInvalid,
464
+ type: typeof r.value == "boolean" ? "boolean" : "normal"
465
+ })), V = o.map((r, i) => ({
466
+ ...r,
467
+ id: `jsx-${E.replace(/:/g, "")}-${r.id}-${i}`,
468
+ userId: r.id,
469
+ raw: r.value,
470
+ original: r.value,
471
+ name: r.label,
472
+ type: typeof r.value == "boolean" ? "boolean" : "normal"
481
473
  }));
482
- }, [r, y]), B = Y(() => o.map((t, b) => ({
483
- id: `jsx-${y.replace(/:/g, "")}-${t.id}-${b}`,
484
- userId: t.id,
485
- value: t.value,
486
- raw: t.value,
487
- original: t.value,
488
- name: t.label,
489
- jsx: t.jsx,
490
- disabled: t.disabled,
491
- className: t.className,
492
- type: typeof t.value == "boolean" ? "boolean" : "normal"
493
- })), [o, y]), T = Y(() => [...V, ...B], [V, B]), z = T.length > 0, M = Y(() => !R && !m && !l && z, [R, m, l, z]), S = Y(() => {
494
- if (!O) return null;
495
- if ($) {
496
- const t = T.find((b) => b.id === $);
497
- if (t && t.userId === s)
498
- return $;
499
- }
500
- return T.find((t) => t.userId === s)?.id ?? null;
501
- }, [O, s, T, $]), q = Y(() => {
502
- const t = O ? S : $;
503
- return t ? T.find((b) => b.id === t) ?? null : null;
504
- }, [O, S, $, T]), ee = k((t, b) => {
505
- if (t.disabled) {
506
- b.stopPropagation(), b.preventDefault();
474
+ return [...$, ...V];
475
+ }, [t, o, E, I, A]), z = k((n) => {
476
+ if (n == null) return null;
477
+ const b = _.find(($) => $.original === n || $.raw === n);
478
+ if (b) return b.id;
479
+ if (typeof n == "object")
480
+ try {
481
+ const $ = JSON.stringify(n), V = _.find(
482
+ (r) => r.original && typeof r.original == "object" && JSON.stringify(r.original) === $
483
+ );
484
+ if (V) return V.id;
485
+ } catch {
486
+ }
487
+ return _.find(($) => $.userId === n)?.id ?? null;
488
+ }, [_]);
489
+ W(() => {
490
+ const n = L ? s : l, b = _.find((V) => V.id === C);
491
+ b && (b.original === n || b.raw === n || b.userId === n) || u(z(n));
492
+ }, [s, l, L, _, z]);
493
+ const ee = X(() => _.find((n) => n.id === C) ?? null, [C, _]), O = k((n, b) => {
494
+ if (n.disabled) {
495
+ b?.stopPropagation(), b?.preventDefault();
507
496
  return;
508
497
  }
509
- d(t.id), f?.(t?.original, t?.userId), E(!1);
510
- }, [f, E]), I = k((t) => {
511
- t.preventDefault(), t.stopPropagation(), d(null), f?.(null, null);
498
+ u(n.id), f?.(n.original, n.userId), m(!1);
499
+ }, [f, m]), q = k((n) => {
500
+ n.preventDefault(), n.stopPropagation(), u(null), f?.(null, null);
512
501
  }, [f]);
513
- return { normalizedOptions: T, selected: q, selectOption: ee, clear: I, hasOptions: z, active: M, selectedValue: U, placeholder: v, emptyText: j, disabledText: F, loadingText: P, errorText: A, disabledOption: N, emptyOption: C, invalidOption: u, disabled: l, loading: m, error: R };
502
+ return {
503
+ normalizedOptions: _,
504
+ selected: ee,
505
+ selectOption: O,
506
+ clear: q,
507
+ hasOptions: _.length > 0,
508
+ active: !S && !x && !a && _.length > 0,
509
+ selectedValue: s ?? l,
510
+ placeholder: v,
511
+ emptyText: j,
512
+ disabledText: F,
513
+ loadingText: P,
514
+ errorText: N,
515
+ disabledOption: A,
516
+ emptyOption: I,
517
+ invalidOption: d,
518
+ disabled: a,
519
+ loading: x,
520
+ error: S
521
+ };
514
522
  }
515
- const ae = (r, o = "invalid-option", s = "") => {
516
- const c = s ? s.replace(/:/g, "") : "";
517
- if (typeof r != "string" || !r.trim())
518
- return c ? `${o}-${c}` : `${o}-${Math.random().toString(36).slice(2, 8)}`;
519
- const f = r.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
520
- return f ? f || `${o}-${Math.random().toString(36).slice(2, 8)}` : c ? `${o}-${c}` : `${o}-${Math.random().toString(36).slice(2, 8)}`;
523
+ const ae = (t, o = "invalid-option", s = "") => {
524
+ const l = s ? s.replace(/:/g, "") : "";
525
+ if (typeof t != "string" || !t.trim())
526
+ return l ? `${o}-${l}` : `${o}-${Math.random().toString(36).slice(2, 8)}`;
527
+ const f = t.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
528
+ return f ? f || `${o}-${Math.random().toString(36).slice(2, 8)}` : l ? `${o}-${l}` : `${o}-${Math.random().toString(36).slice(2, 8)}`;
521
529
  };
522
530
  function He({
523
- visibility: r,
531
+ visibility: t,
524
532
  children: o,
525
533
  selectRef: s,
526
- onAnimationDone: c,
534
+ onAnimationDone: l,
527
535
  unmount: f = !0,
528
- duration: l,
529
- easing: m,
530
- offset: R,
536
+ duration: a,
537
+ easing: x,
538
+ offset: S,
531
539
  animateOpacity: v
532
540
  }) {
533
541
  const j = oe(null), [F, P] = Q(0);
534
- H(() => {
542
+ W(() => {
535
543
  if (!s?.current) return;
536
544
  P(s.current.offsetHeight);
537
- const U = new ResizeObserver((L) => {
538
- for (let V of L) P(V.target.offsetHeight);
545
+ const U = new ResizeObserver((_) => {
546
+ for (let z of _) P(z.target.offsetHeight);
539
547
  });
540
548
  return U.observe(s.current), () => U.disconnect();
541
549
  }, [s]);
542
- const A = `height ${l}ms ${m}${v ? `, opacity ${l}ms ${m}` : ""}`, N = {
550
+ const N = `height ${a}ms ${x}${v ? `, opacity ${a}ms ${x}` : ""}`, A = {
543
551
  position: "absolute",
544
- top: `calc(100% + ${R}px)`,
552
+ top: `calc(100% + ${S}px)`,
545
553
  left: "0",
546
554
  width: "100%",
547
555
  overflow: "hidden",
548
556
  marginTop: "2px",
549
557
  zIndex: "1",
550
- height: r ? "auto" : "0px",
551
- opacity: r ? 1 : 0,
552
- pointerEvents: r ? "all" : "none",
558
+ height: t ? "auto" : "0px",
559
+ opacity: v ? t ? 1 : 0 : 1,
560
+ pointerEvents: t ? "all" : "none",
553
561
  visibility: F ? "visible" : "hidden"
554
- }, C = k(() => {
555
- const d = j.current;
556
- d && (d.style.height = "0px", v && (d.style.opacity = "0"), d.style.transition = "");
557
- }, [v]), u = k(() => {
558
- const d = j.current;
559
- d && (d.style.transition = A, d.style.height = `${d.scrollHeight}px`, v && (d.style.opacity = "1"));
560
- }, [A, v]), E = k(() => {
561
- const d = j.current;
562
- d && (d.style.height = "auto", d.style.transition = "", c && c());
563
- }, [c]), y = k(() => {
564
- const d = j.current;
565
- d && (d.style.height = `${d.scrollHeight}px`, v && (d.style.opacity = "1"), d.offsetHeight, d.style.transition = A);
566
- }, [A, v]), O = k(() => {
567
- const d = j.current;
568
- d && (d.style.height = "0px", v && (d.style.opacity = "0"));
569
- }, [v]), $ = k(() => {
570
- const d = j.current;
571
- d && (d.style.transition = "");
562
+ }, I = k(() => {
563
+ const u = j.current;
564
+ u && (u.style.height = "0px", v && (u.style.opacity = "0"), u.style.transition = "");
565
+ }, [v]), d = k(() => {
566
+ const u = j.current;
567
+ u && (u.style.transition = N, u.style.height = `${u.scrollHeight}px`, v && (u.style.opacity = "1"));
568
+ }, [N, v]), m = k(() => {
569
+ const u = j.current;
570
+ u && (u.style.height = "auto", u.style.transition = "", l && l());
571
+ }, [l]), E = k(() => {
572
+ const u = j.current;
573
+ u && (u.style.height = `${u.scrollHeight}px`, v && (u.style.opacity = "1"), u.offsetHeight, u.style.transition = N);
574
+ }, [N, v]), L = k(() => {
575
+ const u = j.current;
576
+ u && (u.style.height = "0px", v && (u.style.opacity = "0"));
577
+ }, [v]), C = k(() => {
578
+ const u = j.current;
579
+ u && (u.style.transition = "");
572
580
  }, []);
573
- return /* @__PURE__ */ g.jsx(
581
+ return /* @__PURE__ */ y.jsx(
574
582
  ve,
575
583
  {
576
- in: r,
577
- timeout: l,
584
+ in: t,
585
+ timeout: a,
578
586
  classNames: "rac-options",
579
587
  unmountOnExit: f,
580
588
  nodeRef: j,
581
- onEnter: C,
582
- onEntering: u,
583
- onEntered: E,
584
- onExit: y,
585
- onExiting: O,
586
- onExited: $,
587
- children: /* @__PURE__ */ g.jsx(
589
+ onEnter: I,
590
+ onEntering: d,
591
+ onEntered: m,
592
+ onExit: E,
593
+ onExiting: L,
594
+ onExited: C,
595
+ children: /* @__PURE__ */ y.jsx(
588
596
  "div",
589
597
  {
590
598
  ref: j,
591
599
  className: "rac-options",
592
- style: N,
600
+ style: A,
593
601
  children: o
594
602
  }
595
603
  )
596
604
  }
597
605
  );
598
606
  }
599
- const Ue = Ne(He, (r, o) => r.visibility === o.visibility && r.duration === o.duration && r.easing === o.easing && r.offset === o.offset && r.animateOpacity === o.animateOpacity && r.selectRef === o.selectRef && r.children === o.children);
600
- function le({
601
- visibility: r,
607
+ const Ue = Ne(He, (t, o) => t.visibility === o.visibility && t.duration === o.duration && t.easing === o.easing && t.offset === o.offset && t.animateOpacity === o.animateOpacity && t.selectRef === o.selectRef && t.children === o.children);
608
+ function ie({
609
+ visibility: t,
602
610
  children: o,
603
611
  duration: s = 300,
604
- unmount: c,
612
+ unmount: l,
605
613
  style: f
606
614
  }) {
607
- const l = oe(null);
608
- return /* @__PURE__ */ g.jsx(
615
+ const a = oe(null);
616
+ return /* @__PURE__ */ y.jsx(
609
617
  ve,
610
618
  {
611
- in: r,
619
+ in: t,
612
620
  timeout: s,
613
621
  classNames: "rac-slide-left",
614
622
  unmountOnExit: !0,
615
- nodeRef: l,
616
- onEnter: () => l.current.style.width = "0px",
617
- onEntering: () => l.current.style.width = l.current.scrollWidth + "px",
618
- onEntered: () => l.current.style.width = "auto",
619
- onExit: () => l.current.style.width = l.current.scrollWidth + "px",
620
- onExiting: () => l.current.style.width = "0px",
621
- onExited: () => c?.(),
622
- children: /* @__PURE__ */ g.jsx(
623
+ nodeRef: a,
624
+ onEnter: () => a.current.style.width = "0px",
625
+ onEntering: () => a.current.style.width = a.current.scrollWidth + "px",
626
+ onEntered: () => a.current.style.width = "auto",
627
+ onExit: () => a.current.style.width = a.current.scrollWidth + "px",
628
+ onExiting: () => a.current.style.width = "0px",
629
+ onExited: () => l?.(),
630
+ children: /* @__PURE__ */ y.jsx(
623
631
  "div",
624
632
  {
625
- ref: l,
633
+ ref: a,
626
634
  style: {
627
635
  ...f,
628
636
  overflow: "hidden",
@@ -634,97 +642,97 @@ function le({
634
642
  }
635
643
  );
636
644
  }
637
- const me = (r, o) => {
638
- if (!r) return null;
639
- if (typeof r == "string")
640
- return /* @__PURE__ */ g.jsx("img", { src: r, ...o, alt: "" });
641
- if (Pe(r))
642
- return Ce(r, o);
643
- if (typeof r == "function" || typeof r == "object" && r.$$typeof) {
644
- const s = r;
645
- return /* @__PURE__ */ g.jsx(s, { ...o });
645
+ const ye = (t, o) => {
646
+ if (!t) return null;
647
+ if (typeof t == "string")
648
+ return /* @__PURE__ */ y.jsx("img", { src: t, ...o, alt: "" });
649
+ if (Pe(t))
650
+ return Ce(t, o);
651
+ if (typeof t == "function" || typeof t == "object" && t.$$typeof) {
652
+ const s = t;
653
+ return /* @__PURE__ */ y.jsx(s, { ...o });
646
654
  }
647
655
  return null;
648
- }, Ge = Oe(({
649
- unmount: r,
656
+ }, Be = Ie(({
657
+ unmount: t,
650
658
  children: o,
651
659
  renderedDropdown: s,
652
- visibility: c,
660
+ visibility: l,
653
661
  ownBehavior: f = !1,
654
- alwaysOpen: l = !1,
655
- duration: m = 300,
656
- easing: R = "ease-out",
662
+ alwaysOpen: a = !1,
663
+ duration: x = 300,
664
+ easing: S = "ease-out",
657
665
  offset: v = 2,
658
666
  animateOpacity: j = !0,
659
667
  style: F = {},
660
668
  className: P = "",
661
- ArrowIcon: A = Ve,
662
- ClearIcon: N = Me,
663
- ...C
664
- }, u) => {
665
- const E = xe(), y = Y(() => E.replace(/:/g, ""), [E]), [O, $] = Q([]), d = k((p) => {
666
- $((D) => [...D, p]);
669
+ ArrowIcon: N = Ve,
670
+ ClearIcon: A = Ye,
671
+ ...I
672
+ }, d) => {
673
+ const m = Ee(), E = X(() => m.replace(/:/g, ""), [m]), [L, C] = Q([]), u = k((p) => {
674
+ C((D) => [...D, p]);
667
675
  }, []), U = k((p) => {
668
- $((D) => D.filter((G) => G.id !== p));
669
- }, []), L = oe(null);
670
- H(() => {
671
- u && (typeof u == "function" ? u(L.current) : u.current = L.current);
672
- }, [u]), Ie(u, () => L.current);
673
- const [V, B] = Q(!1), T = Y(() => l ? !0 : f ? !!c : V, [l, f, c, V]), z = k((p) => {
674
- l || f || B((D) => typeof p == "function" ? p(D) : p);
675
- }, [l, f]), { normalizedOptions: M, selected: S, selectOption: q, clear: ee, hasOptions: I, active: t, selectedValue: b, disabled: n, loading: i, error: x, placeholder: e, invalidOption: a, options: h, value: _, defaultValue: J, isControlled: K, emptyText: w, disabledText: W, loadingText: Z, errorText: ie } = We({ ...C, setVisibility: z, jsxOptions: O }), { handleBlur: we, handleFocus: je, handleToggle: _e, handleKeyDown: Te, highlightedIndex: re, setHighlightedIndex: Re } = ze({
676
- disabled: n,
677
- isOpen: T,
678
- setIsOpen: z,
679
- options: M,
680
- selectOption: q,
681
- selected: S
676
+ C((D) => D.filter((G) => G.id !== p));
677
+ }, []), _ = oe(null);
678
+ W(() => {
679
+ d && (typeof d == "function" ? d(_.current) : d.current = _.current);
680
+ }, [d]), Oe(d, () => _.current);
681
+ const [z, ee] = Q(!1), O = X(() => a ? !0 : f ? !!l : z, [a, f, l, z]), q = k((p) => {
682
+ a || f || ee((D) => typeof p == "function" ? p(D) : p);
683
+ }, [a, f]), { normalizedOptions: n, selected: b, selectOption: $, clear: V, hasOptions: r, active: i, selectedValue: h, disabled: R, loading: M, error: Y, placeholder: e, invalidOption: c, options: g, value: T, defaultValue: B, isControlled: K, emptyText: w, disabledText: H, loadingText: Z, errorText: se } = ze({ ...I, setVisibility: q, jsxOptions: L }), { handleBlur: we, handleFocus: je, handleToggle: _e, handleKeyDown: Te, highlightedIndex: re, setHighlightedIndex: Se } = We({
684
+ disabled: R,
685
+ isOpen: O,
686
+ setIsOpen: q,
687
+ options: n,
688
+ selectOption: $,
689
+ selected: b
682
690
  }), [ue, de] = Q(!1);
683
- H(() => {
684
- T || de(!1);
685
- }, [T]), H(() => {
686
- (x || n || i || !I) && z(!1);
687
- }, [x, n, i, I]), H(() => {
688
- if (T && ue && re !== -1) {
689
- const p = M[re];
691
+ W(() => {
692
+ O || de(!1);
693
+ }, [O]), W(() => {
694
+ (Y || R || M || !r) && q(!1);
695
+ }, [Y, R, M, r]), W(() => {
696
+ if (O && ue && re !== -1) {
697
+ const p = n[re];
690
698
  if (p) {
691
- const D = `opt-${y}-${ae(p.id)}`, G = document.getElementById(D);
699
+ const D = `opt-${E}-${ae(p.id)}`, G = document.getElementById(D);
692
700
  G && G.scrollIntoView({ block: "nearest" });
693
701
  }
694
702
  }
695
- }, [re, T, ue, M, y]);
696
- const fe = b != null && !(Array.isArray(b) && b.length === 0) && !(typeof b == "object" && Object.keys(b).length === 0), pe = Y(() => {
697
- if (x) return ie;
698
- if (i) return Z;
699
- if (n) return W;
700
- if (S) return S.jsx ?? S.name;
703
+ }, [re, O, ue, n, E]);
704
+ const fe = h != null && !(Array.isArray(h) && h.length === 0) && !(typeof h == "object" && Object.keys(h).length === 0), pe = X(() => {
705
+ if (Y) return se;
706
+ if (M) return Z;
707
+ if (R) return H;
708
+ if (b) return b.jsx ?? b.name;
701
709
  if (fe) {
702
- const p = M.find((D) => D.raw === b);
703
- return p ? p.name : typeof b == "object" && b !== null ? b.name ?? b.label ?? "Selected Object" : String(b);
710
+ const p = n.find((D) => D.raw === h);
711
+ return p ? p.name : typeof h == "object" && h !== null ? h.name ?? h.label ?? "Selected Object" : String(h);
704
712
  }
705
- return I ? e : w;
706
- }, [n, i, x, I, S, b, e, ie, Z, W, w]), Se = `${y}-listbox`, $e = Y(() => M?.map((p, D) => {
707
- const G = `opt-${y}-${ae(p.id)}`;
708
- let X = "rac-select-option";
709
- return p.className && (X += ` ${p.className}`), S?.id === p.id && (X += " rac-selected"), D === re && (X += " rac-highlighted"), p.disabled && (X += " rac-disabled-option"), typeof p.raw == "boolean" && (X += p.raw ? " rac-true-option" : " rac-false-option"), p.name == a && (X += " rac-invalid-option"), /* @__PURE__ */ g.jsx(
713
+ return r ? e : w;
714
+ }, [R, M, Y, r, b, h, e, se, Z, H, w]), Re = `${E}-listbox`, $e = X(() => n?.map((p, D) => {
715
+ const G = `opt-${E}-${ae(p.id)}`;
716
+ let J = "rac-select-option";
717
+ return p.className && (J += ` ${p.className}`), b?.id === p.id && (J += " rac-selected"), D === re && (J += " rac-highlighted"), p.disabled && (J += " rac-disabled-option"), p.isInvalid && (J += " rac-invalid-option"), typeof p.raw == "boolean" && (J += p.raw ? " rac-true-option" : " rac-false-option"), p.name == c && (J += " rac-invalid-option"), /* @__PURE__ */ y.jsx(
710
718
  "div",
711
719
  {
712
- className: X,
713
- onClick: (ke) => q(p, ke),
714
- onMouseEnter: () => !p.disabled && Re(D),
720
+ className: J,
721
+ onClick: (ke) => $(p, ke),
722
+ onMouseEnter: () => !p.disabled && Se(D),
715
723
  id: G,
716
724
  role: "option",
717
- "aria-selected": S?.id === p.id,
725
+ "aria-selected": b?.id === p.id,
718
726
  "aria-disabled": p.disabled,
719
727
  children: p.jsx ?? p.name
720
728
  },
721
729
  p.id
722
730
  );
723
- }), [M, q, y, S, re]);
724
- return H(() => {
725
- process.env.NODE_ENV !== "production" && (h && typeof h != "object" && console.error(
731
+ }), [n, $, E, b, re]);
732
+ return W(() => {
733
+ process.env.NODE_ENV !== "production" && (g && typeof g != "object" && console.error(
726
734
  `%c[Select Library]:%c Invalid prop %coptions%c.
727
- Expected %cArray%c or %cObject%c, but received %c${typeof h}%c.
735
+ Expected %cArray%c or %cObject%c, but received %c${typeof g}%c.
728
736
  `,
729
737
  "color: #ff4d4f; font-weight: bold;",
730
738
  "color: default;",
@@ -736,52 +744,52 @@ Expected %cArray%c or %cObject%c, but received %c${typeof h}%c.
736
744
  "color: default;",
737
745
  "color: #ff4d4f; font-weight: bold;",
738
746
  "color: default;"
739
- ), K && J !== void 0 && console.warn(
747
+ ), K && B !== void 0 && console.warn(
740
748
  `%c[Select Library]:%c .
741
749
  `,
742
750
  "color: #faad14; font-weight: bold;",
743
751
  "color: default;"
744
752
  ));
745
- }, [h, _, J, K]), /* @__PURE__ */ g.jsxs(
746
- Ee.Provider,
753
+ }, [g, T, B, K]), /* @__PURE__ */ y.jsxs(
754
+ me.Provider,
747
755
  {
748
- value: { registerOption: d, unregisterOption: U },
756
+ value: { registerOption: u, unregisterOption: U },
749
757
  children: [
750
758
  o,
751
759
  s,
752
- /* @__PURE__ */ g.jsxs(
760
+ /* @__PURE__ */ y.jsxs(
753
761
  "div",
754
762
  {
755
763
  style: {
756
- "--rac-duration": `${m}ms`,
764
+ "--rac-duration": `${x}ms`,
757
765
  ...F
758
766
  },
759
767
  className: `rac-select
760
768
  ${P}
761
- ${!I || n ? "rac-disabled-style" : ""}
762
- ${i ? "rac-loading-style" : ""}
763
- ${x ? "rac-error-style" : ""}`,
764
- tabIndex: t ? 0 : -1,
765
- ref: L,
769
+ ${!r || R ? "rac-disabled-style" : ""}
770
+ ${M ? "rac-loading-style" : ""}
771
+ ${Y ? "rac-error-style" : ""}`,
772
+ tabIndex: i ? 0 : -1,
773
+ ref: _,
766
774
  role: "combobox",
767
775
  "aria-haspopup": "listbox",
768
- "aria-expanded": T,
769
- "aria-controls": Se,
776
+ "aria-expanded": O,
777
+ "aria-controls": Re,
770
778
  "aria-label": e,
771
- "aria-disabled": n || !I,
772
- ...t && {
779
+ "aria-disabled": R || !r,
780
+ ...i && {
773
781
  onBlur: we,
774
782
  onFocus: je,
775
783
  onClick: _e,
776
784
  onKeyDown: Te
777
785
  },
778
786
  children: [
779
- /* @__PURE__ */ g.jsxs(
787
+ /* @__PURE__ */ y.jsxs(
780
788
  "div",
781
789
  {
782
- className: `rac-select-title ${!x && !i && S?.type == "boolean" ? S.raw ? "rac-true-option" : "rac-false-option" : ""}`,
790
+ className: `rac-select-title ${!Y && !M && b?.type == "boolean" ? b.raw ? "rac-true-option" : "rac-false-option" : ""}`,
783
791
  children: [
784
- /* @__PURE__ */ g.jsx(
792
+ /* @__PURE__ */ y.jsx(
785
793
  "span",
786
794
  {
787
795
  className: "rac-title-text",
@@ -789,49 +797,49 @@ Expected %cArray%c or %cObject%c, but received %c${typeof h}%c.
789
797
  },
790
798
  pe
791
799
  ),
792
- /* @__PURE__ */ g.jsx(
793
- le,
800
+ /* @__PURE__ */ y.jsx(
801
+ ie,
794
802
  {
795
- visibility: i && !x,
796
- duration: m,
797
- children: /* @__PURE__ */ g.jsxs("span", { className: "rac-loading-dots", children: [
798
- /* @__PURE__ */ g.jsx("i", {}),
799
- /* @__PURE__ */ g.jsx("i", {}),
800
- /* @__PURE__ */ g.jsx("i", {})
803
+ visibility: M && !Y,
804
+ duration: x,
805
+ children: /* @__PURE__ */ y.jsxs("span", { className: "rac-loading-dots", children: [
806
+ /* @__PURE__ */ y.jsx("i", {}),
807
+ /* @__PURE__ */ y.jsx("i", {}),
808
+ /* @__PURE__ */ y.jsx("i", {})
801
809
  ] })
802
810
  }
803
811
  )
804
812
  ]
805
813
  }
806
814
  ),
807
- /* @__PURE__ */ g.jsxs(
815
+ /* @__PURE__ */ y.jsxs(
808
816
  "div",
809
817
  {
810
818
  className: "rac-select-buttons",
811
819
  children: [
812
- /* @__PURE__ */ g.jsx(
813
- le,
820
+ /* @__PURE__ */ y.jsx(
821
+ ie,
814
822
  {
815
- visibility: fe && I && !n && !i && !x,
816
- duration: m,
823
+ visibility: fe && r && !R && !M && !Y,
824
+ duration: x,
817
825
  style: { display: "grid" },
818
- children: me(N, {
826
+ children: ye(A, {
819
827
  className: "rac-select-cancel",
820
- onClick: (p) => ee(p)
828
+ onClick: (p) => V(p)
821
829
  })
822
830
  }
823
831
  ),
824
- /* @__PURE__ */ g.jsx(
825
- le,
832
+ /* @__PURE__ */ y.jsx(
833
+ ie,
826
834
  {
827
- visibility: t,
828
- duration: m,
835
+ visibility: i,
836
+ duration: x,
829
837
  style: { display: "grid" },
830
- children: /* @__PURE__ */ g.jsx(
838
+ children: /* @__PURE__ */ y.jsx(
831
839
  "span",
832
840
  {
833
- className: `rac-select-arrow-wrapper ${T ? "--open" : ""}`,
834
- children: me(A, {
841
+ className: `rac-select-arrow-wrapper ${O ? "--open" : ""}`,
842
+ children: ye(N, {
835
843
  className: "rac-select-arrow-wrapper"
836
844
  })
837
845
  }
@@ -841,18 +849,18 @@ Expected %cArray%c or %cObject%c, but received %c${typeof h}%c.
841
849
  ]
842
850
  }
843
851
  ),
844
- /* @__PURE__ */ g.jsx(
852
+ /* @__PURE__ */ y.jsx(
845
853
  Ue,
846
854
  {
847
- visibility: T,
848
- selectRef: L,
855
+ visibility: O,
856
+ selectRef: _,
849
857
  onAnimationDone: () => de(!0),
850
- unmount: r,
851
- duration: m,
852
- easing: R,
858
+ unmount: t,
859
+ duration: x,
860
+ easing: S,
853
861
  offset: v,
854
862
  animateOpacity: j,
855
- children: /* @__PURE__ */ g.jsx(
863
+ children: /* @__PURE__ */ y.jsx(
856
864
  "div",
857
865
  {
858
866
  className: "rac-select-list",
@@ -869,23 +877,23 @@ Expected %cArray%c or %cObject%c, but received %c${typeof h}%c.
869
877
  ]
870
878
  }
871
879
  );
872
- }), ce = (r) => r ? typeof r == "string" || typeof r == "number" ? String(r) : Array.isArray(r) ? r.map(ce).join(" ").replace(/\s+/g, " ").trim() : ye.isValidElement(r) ? ce(r.props.children) : "" : "";
873
- function Xe({ value: r, id: o, className: s, children: c, disabled: f }) {
874
- const l = De(Ee);
875
- return H(() => {
876
- if (!l) return;
877
- const m = ce(c), R = {
878
- id: String(o ?? ae(String(m))),
879
- value: r !== void 0 ? r : m,
880
- label: typeof c == "string" ? c : String(r ?? o),
881
- jsx: c,
880
+ }), ce = (t) => t ? typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(ce).join(" ").replace(/\s+/g, " ").trim() : xe.isValidElement(t) ? ce(t.props.children) : "" : "";
881
+ function Ge({ value: t, id: o, className: s, children: l, disabled: f }) {
882
+ const a = De(me);
883
+ return W(() => {
884
+ if (!a) return;
885
+ const x = ce(l), S = {
886
+ id: String(o ?? ae(String(x))),
887
+ value: t !== void 0 ? t : x,
888
+ label: typeof l == "string" ? l : String(t ?? o),
889
+ jsx: l,
882
890
  className: s,
883
891
  disabled: !!f
884
892
  };
885
- return l.registerOption(R), () => l.unregisterOption(R.id);
886
- }, [o, r, c, s, f]), null;
893
+ return a.registerOption(S), () => a.unregisterOption(S.id);
894
+ }, [o, t, l, s, f]), null;
887
895
  }
888
896
  export {
889
- Xe as Option,
890
- Ge as Select
897
+ Ge as Option,
898
+ Be as Select
891
899
  };