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