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