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