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