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