react-animated-select 0.7.5 → 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 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +873 -670
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { flushSync as
|
|
5
|
-
import './index.css';const
|
|
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
6
|
const n = typeof t == "function" ? t(e) : t;
|
|
7
7
|
return n === e ? e : Object.keys(n).some((s) => !Object.is(n[s], e[s])) ? { ...e, ...n } : e;
|
|
8
|
-
},
|
|
8
|
+
}, xt = (e) => {
|
|
9
9
|
let t = e;
|
|
10
10
|
const n = /* @__PURE__ */ new Set();
|
|
11
11
|
return {
|
|
@@ -15,31 +15,31 @@ import './index.css';const Y = we(null), ce = we(null), de = we(null), kt = (e,
|
|
|
15
15
|
},
|
|
16
16
|
subscribe: (r) => (n.add(r), () => n.delete(r))
|
|
17
17
|
};
|
|
18
|
-
},
|
|
19
|
-
const t =
|
|
20
|
-
|
|
18
|
+
}, _e = (e) => {
|
|
19
|
+
const t = G(e);
|
|
20
|
+
Ft(() => {
|
|
21
21
|
t.current = e;
|
|
22
22
|
});
|
|
23
|
-
const [n] =
|
|
23
|
+
const [n] = Q(() => Object.fromEntries(
|
|
24
24
|
Object.keys(e).map((r) => [r, (...s) => t.current[r](...s)])
|
|
25
25
|
));
|
|
26
26
|
return n;
|
|
27
|
-
},
|
|
28
|
-
const [n, r] =
|
|
27
|
+
}, Ot = (e, t) => {
|
|
28
|
+
const [n, r] = Q(e);
|
|
29
29
|
return n === e || t(n, e) ? n : (r(e), e);
|
|
30
|
-
},
|
|
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
31
|
if (Object.is(e, t)) return !0;
|
|
32
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 &&
|
|
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
34
|
const r = Object.keys(e);
|
|
35
|
-
return r.length === Object.keys(t).length && r.every((s) => Object.hasOwn(t, s) &&
|
|
36
|
-
},
|
|
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
37
|
const n = Object.keys(t);
|
|
38
38
|
return n.length === Object.keys(e).length && n.every(
|
|
39
|
-
(r) =>
|
|
39
|
+
(r) => _t.has(r) ? Kt(e[r], t[r]) : Object.is(e[r], t[r])
|
|
40
40
|
);
|
|
41
|
-
},
|
|
42
|
-
XMark: ({ className: e = "", ...t }) => /* @__PURE__ */
|
|
41
|
+
}, Yt = (e) => Ot(e, Ut), ze = (e) => Ot(e, Te), Se = {
|
|
42
|
+
XMark: ({ className: e = "", ...t }) => /* @__PURE__ */ M(
|
|
43
43
|
"svg",
|
|
44
44
|
{
|
|
45
45
|
className: e,
|
|
@@ -49,10 +49,10 @@ import './index.css';const Y = we(null), ce = we(null), de = we(null), kt = (e,
|
|
|
49
49
|
height: "1em",
|
|
50
50
|
width: "1em",
|
|
51
51
|
...t,
|
|
52
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
53
53
|
}
|
|
54
54
|
),
|
|
55
|
-
ArrowUp: ({ className: e = "", ...t }) => /* @__PURE__ */
|
|
55
|
+
ArrowUp: ({ className: e = "", ...t }) => /* @__PURE__ */ M(
|
|
56
56
|
"svg",
|
|
57
57
|
{
|
|
58
58
|
className: e,
|
|
@@ -62,10 +62,10 @@ import './index.css';const Y = we(null), ce = we(null), de = we(null), kt = (e,
|
|
|
62
62
|
height: "1em",
|
|
63
63
|
width: "1em",
|
|
64
64
|
...t,
|
|
65
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
66
66
|
}
|
|
67
67
|
),
|
|
68
|
-
Checkmark: ({ className: e = "", ...t }) => /* @__PURE__ */
|
|
68
|
+
Checkmark: ({ className: e = "", ...t }) => /* @__PURE__ */ M(
|
|
69
69
|
"svg",
|
|
70
70
|
{
|
|
71
71
|
className: e,
|
|
@@ -75,10 +75,10 @@ import './index.css';const Y = we(null), ce = we(null), de = we(null), kt = (e,
|
|
|
75
75
|
height: "1em",
|
|
76
76
|
width: "1em",
|
|
77
77
|
...t,
|
|
78
|
-
children: /* @__PURE__ */
|
|
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" })
|
|
79
79
|
}
|
|
80
80
|
)
|
|
81
|
-
},
|
|
81
|
+
}, he = (e, t) => {
|
|
82
82
|
if (!e) return null;
|
|
83
83
|
const n = (r = {}) => ({
|
|
84
84
|
...t,
|
|
@@ -88,360 +88,378 @@ import './index.css';const Y = we(null), ce = we(null), de = we(null), kt = (e,
|
|
|
88
88
|
...r?.style
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
return typeof e == "string" ? /* @__PURE__ */
|
|
92
|
-
},
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
] }),
|
|
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
97
|
try {
|
|
98
98
|
return process.env.NODE_ENV !== "production";
|
|
99
99
|
} catch {
|
|
100
100
|
return !1;
|
|
101
101
|
}
|
|
102
|
-
})(),
|
|
103
|
-
!
|
|
104
|
-
},
|
|
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
105
|
e?.stopPropagation(), e?.preventDefault();
|
|
106
|
-
},
|
|
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(() => {
|
|
107
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));
|
|
108
|
-
return { reach: r, list: e.flatMap((s,
|
|
109
|
-
}, [e, t]),
|
|
110
|
+
return { reach: r, list: e.flatMap((s, o) => r(s) ? [o] : []) };
|
|
111
|
+
}, [e, t]), nn = (e, t, n, r) => {
|
|
110
112
|
const s = e.length - 1;
|
|
111
113
|
if (s < 0) return -1;
|
|
112
114
|
if (n === "Home") return e[0];
|
|
113
115
|
if (n === "End") return e[s];
|
|
114
|
-
const
|
|
115
|
-
if (i === -1) return e[
|
|
116
|
-
const a = i +
|
|
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);
|
|
117
119
|
return a >= 0 && a <= s ? e[a] : n.startsWith("Page") || r ? e[a < 0 ? 0 : s] : e[(a + e.length) % e.length];
|
|
118
|
-
},
|
|
119
|
-
const s = [...r].every((
|
|
120
|
-
for (let
|
|
121
|
-
const
|
|
122
|
-
if (String(e[
|
|
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;
|
|
123
125
|
}
|
|
124
126
|
return -1;
|
|
125
127
|
};
|
|
126
|
-
function
|
|
127
|
-
const { disabled:
|
|
128
|
-
const
|
|
129
|
-
return
|
|
130
|
-
}, [r,
|
|
131
|
-
!w && a &&
|
|
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();
|
|
132
134
|
};
|
|
133
|
-
|
|
134
|
-
const { index:
|
|
135
|
-
|
|
136
|
-
}),
|
|
137
|
-
const
|
|
138
|
-
return window.addEventListener("focus",
|
|
139
|
-
window.removeEventListener("focus",
|
|
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);
|
|
140
142
|
};
|
|
141
143
|
}, []);
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
const
|
|
146
|
-
clearTimeout(
|
|
147
|
-
const
|
|
148
|
-
|
|
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);
|
|
149
151
|
};
|
|
150
|
-
return
|
|
151
|
-
highlight:
|
|
152
|
-
handleListScroll: (
|
|
152
|
+
return _e({
|
|
153
|
+
highlight: S,
|
|
154
|
+
handleListScroll: (h) => {
|
|
153
155
|
if (w) return;
|
|
154
|
-
const { scrollTop:
|
|
155
|
-
|
|
156
|
+
const { scrollTop: O, scrollHeight: E, clientHeight: $ } = h.currentTarget;
|
|
157
|
+
E - O <= $ + p && u();
|
|
156
158
|
},
|
|
157
|
-
handleBlur: (
|
|
158
|
-
const
|
|
159
|
-
|
|
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));
|
|
160
162
|
},
|
|
161
163
|
// [DOC: select-behavior]
|
|
162
|
-
handleFocus: (
|
|
163
|
-
|
|
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));
|
|
164
167
|
},
|
|
165
|
-
toggleVisibility: (
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
+
toggleVisibility: (h) => {
|
|
169
|
+
if (D) {
|
|
170
|
+
oe(h), n({ deleting: !1 });
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
170
|
-
|
|
173
|
+
d || B.current.justFocused || l(!a);
|
|
171
174
|
},
|
|
172
|
-
handleKeyDown: (
|
|
173
|
-
if (
|
|
174
|
-
const { key:
|
|
175
|
-
if (
|
|
176
|
-
|
|
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);
|
|
177
182
|
return;
|
|
178
183
|
}
|
|
179
|
-
if (
|
|
180
|
-
|
|
184
|
+
if (en.has(O)) {
|
|
185
|
+
h.preventDefault(), (a || O === "Home" || O === "End") && S(nn(I, E, O, !w && y)), a || l(!0);
|
|
181
186
|
return;
|
|
182
187
|
}
|
|
183
|
-
switch (
|
|
188
|
+
switch (O) {
|
|
184
189
|
case "Enter":
|
|
185
190
|
case " ":
|
|
186
|
-
|
|
191
|
+
h.preventDefault(), a ? E !== -1 && r[E] && (S(E), C(r[E], h)) : l(!0);
|
|
187
192
|
break;
|
|
188
193
|
// [DOC: select-behavior]
|
|
189
194
|
case "Escape":
|
|
190
|
-
if (
|
|
191
|
-
else if (a)
|
|
195
|
+
if (D) n({ deleting: !1 });
|
|
196
|
+
else if (a) l(!1);
|
|
192
197
|
else break;
|
|
193
|
-
|
|
198
|
+
oe(h);
|
|
194
199
|
break;
|
|
195
200
|
case "Tab":
|
|
196
|
-
a &&
|
|
201
|
+
a && l(!1);
|
|
197
202
|
break;
|
|
198
203
|
// [DOC: select-behavior]
|
|
199
204
|
case "Backspace":
|
|
200
205
|
case "Delete": {
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
else if (
|
|
206
|
+
const $ = i.at(-1);
|
|
207
|
+
if (c && O === "Backspace" && v.remove && $) k($.id);
|
|
208
|
+
else if (v.clear && (o || $)) g();
|
|
204
209
|
else break;
|
|
205
|
-
|
|
210
|
+
h.preventDefault();
|
|
206
211
|
break;
|
|
207
212
|
}
|
|
208
213
|
}
|
|
209
214
|
}
|
|
210
215
|
});
|
|
211
216
|
}
|
|
212
|
-
const
|
|
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) => {
|
|
213
218
|
try {
|
|
214
219
|
const t = String(e);
|
|
215
220
|
return t.startsWith("[object ") ? null : t;
|
|
216
221
|
} catch {
|
|
217
222
|
return null;
|
|
218
223
|
}
|
|
219
|
-
},
|
|
224
|
+
}, Je = (e, t = !1) => {
|
|
220
225
|
if (t && typeof e.group == "string") return e.group;
|
|
221
|
-
const n =
|
|
226
|
+
const n = Xe.find((o) => Oe(e[o]));
|
|
222
227
|
if (n) return String(e[n]);
|
|
223
|
-
const r = !
|
|
228
|
+
const r = !Le(e) && an(e);
|
|
224
229
|
if (r) return r;
|
|
225
|
-
const s = Object.entries(e).find(([
|
|
230
|
+
const s = Object.entries(e).find(([o, i]) => !on.includes(o) && Oe(i));
|
|
226
231
|
return s ? String(s[1]) : null;
|
|
227
|
-
},
|
|
228
|
-
const
|
|
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}`;
|
|
229
234
|
if (e == null || e === "")
|
|
230
|
-
return { id:
|
|
235
|
+
return { id: l, userId: null, name: o, raw: e, disabled: !0, type: "normal", group: r, groupDisabled: s };
|
|
231
236
|
if (typeof e == "function")
|
|
232
|
-
return { id:
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
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);
|
|
235
240
|
return {
|
|
236
|
-
id:
|
|
241
|
+
id: l,
|
|
237
242
|
userId: e.id ?? e.value ?? e.name ?? e.label,
|
|
238
|
-
name:
|
|
239
|
-
raw:
|
|
243
|
+
name: x,
|
|
244
|
+
raw: u,
|
|
240
245
|
original: e,
|
|
241
|
-
disabled:
|
|
242
|
-
type: typeof
|
|
246
|
+
disabled: b || x === o,
|
|
247
|
+
type: typeof u == "boolean" ? "boolean" : "normal",
|
|
243
248
|
group: r || e.group || null,
|
|
244
249
|
groupDisabled: s
|
|
245
250
|
};
|
|
246
251
|
}
|
|
247
|
-
return { id:
|
|
248
|
-
},
|
|
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 = ({
|
|
249
254
|
options: e,
|
|
250
255
|
jsxOptions: t,
|
|
251
256
|
childrenFirst: n,
|
|
252
257
|
hasMore: r,
|
|
253
258
|
loadButton: s,
|
|
254
|
-
loadPending:
|
|
259
|
+
loadPending: o,
|
|
255
260
|
loadingTitle: i,
|
|
256
261
|
emptyOption: a,
|
|
257
|
-
invalidOption:
|
|
258
|
-
disabledOption:
|
|
259
|
-
emptyGroup:
|
|
262
|
+
invalidOption: l,
|
|
263
|
+
disabledOption: b,
|
|
264
|
+
emptyGroup: u
|
|
260
265
|
}) => {
|
|
261
|
-
const
|
|
262
|
-
let
|
|
263
|
-
for (let
|
|
264
|
-
return
|
|
265
|
-
},
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
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;
|
|
268
273
|
return {
|
|
269
|
-
...
|
|
270
|
-
id: w(`jsx-${
|
|
271
|
-
index:
|
|
272
|
-
userId:
|
|
273
|
-
raw:
|
|
274
|
-
original:
|
|
275
|
-
name:
|
|
276
|
-
disabled: !!
|
|
277
|
-
type: typeof
|
|
278
|
-
group:
|
|
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
|
|
279
284
|
};
|
|
280
285
|
});
|
|
281
|
-
let
|
|
282
|
-
const
|
|
283
|
-
Array.isArray(
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
} else
|
|
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++ });
|
|
289
294
|
});
|
|
290
295
|
};
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
if (!
|
|
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 });
|
|
296
301
|
return;
|
|
297
302
|
}
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
|
|
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);
|
|
301
306
|
});
|
|
302
|
-
const
|
|
303
|
-
return
|
|
304
|
-
if (
|
|
305
|
-
|
|
307
|
+
const C = [];
|
|
308
|
+
return T.forEach((g) => {
|
|
309
|
+
if (g.type === "item") {
|
|
310
|
+
C.push(g.data);
|
|
306
311
|
return;
|
|
307
312
|
}
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
className:
|
|
311
|
-
id: `group-header-${
|
|
312
|
-
disabled: !!
|
|
313
|
-
style:
|
|
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 || {},
|
|
314
319
|
groupHeader: !0,
|
|
315
|
-
name:
|
|
320
|
+
name: g.name,
|
|
316
321
|
type: "group"
|
|
317
|
-
}),
|
|
318
|
-
}), r && s &&
|
|
319
|
-
},
|
|
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) => {
|
|
320
325
|
const t = () => null;
|
|
321
326
|
return t.racKind = "define", t.racRender = e, t.displayName = `defineOption(${e.name || "anonymous"})`, t;
|
|
322
|
-
},
|
|
327
|
+
}, rt = { selected: null, selectedIDs: [] }, ye = (e) => {
|
|
323
328
|
try {
|
|
324
329
|
return JSON.stringify(e);
|
|
325
330
|
} catch {
|
|
326
331
|
return;
|
|
327
332
|
}
|
|
328
|
-
},
|
|
329
|
-
if (e == null || Array.isArray(e) && e.length === 0) return
|
|
330
|
-
const s = r.length ? new Map(t.map((
|
|
331
|
-
const
|
|
332
|
-
let
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
335
|
-
return i.add(
|
|
336
|
-
const
|
|
337
|
-
a.set(
|
|
338
|
-
const
|
|
339
|
-
return
|
|
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 };
|
|
340
345
|
};
|
|
341
|
-
return n ? { selected: null, selectedIDs: (Array.isArray(e) ? e : [e]).map(
|
|
342
|
-
},
|
|
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 = {
|
|
343
348
|
x: ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth"],
|
|
344
349
|
y: ["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom", "borderTopWidth", "borderBottomWidth"]
|
|
345
|
-
},
|
|
346
|
-
let
|
|
347
|
-
const
|
|
348
|
-
|
|
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;
|
|
349
354
|
}), {});
|
|
350
|
-
function
|
|
355
|
+
function de({
|
|
351
356
|
as: e = "div",
|
|
352
357
|
axis: t = "y",
|
|
353
358
|
fade: n = !1,
|
|
354
359
|
in: r,
|
|
355
360
|
unmountOnExit: s = !0,
|
|
356
|
-
easing:
|
|
361
|
+
easing: o,
|
|
357
362
|
duration: i,
|
|
358
363
|
group: a,
|
|
359
|
-
nodeRef:
|
|
360
|
-
onEntered:
|
|
361
|
-
onExited:
|
|
362
|
-
...
|
|
364
|
+
nodeRef: l,
|
|
365
|
+
onEntered: b,
|
|
366
|
+
onExited: u,
|
|
367
|
+
...x
|
|
363
368
|
}) {
|
|
364
|
-
const
|
|
365
|
-
} }), [
|
|
366
|
-
w &&
|
|
367
|
-
const
|
|
368
|
-
if (a?.delete(
|
|
369
|
-
|
|
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?.();
|
|
370
375
|
return;
|
|
371
376
|
}
|
|
372
|
-
|
|
377
|
+
u?.(), y && c.onExited(), s && (T.current = null, R(!0));
|
|
373
378
|
});
|
|
374
|
-
return
|
|
375
|
-
const
|
|
376
|
-
if (!
|
|
377
|
-
const
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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" });
|
|
382
389
|
if (z.onfinish = () => {
|
|
383
|
-
|
|
384
|
-
},
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
},
|
|
388
|
-
const [
|
|
389
|
-
return { ...Object.fromEntries(
|
|
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 };
|
|
390
397
|
};
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
},
|
|
397
|
-
!w && !
|
|
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" }));
|
|
398
405
|
return;
|
|
399
406
|
}
|
|
400
|
-
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
407
|
+
k.current = w;
|
|
408
|
+
const $ = T.current;
|
|
409
|
+
if ($?.playState === "running") {
|
|
403
410
|
if (!a) {
|
|
404
|
-
|
|
411
|
+
$.reverse();
|
|
405
412
|
return;
|
|
406
413
|
}
|
|
407
|
-
|
|
414
|
+
C.current.restart(!0);
|
|
408
415
|
} else {
|
|
409
|
-
if (
|
|
410
|
-
|
|
416
|
+
if ($?.cancel(), !m.animate) {
|
|
417
|
+
I();
|
|
411
418
|
return;
|
|
412
419
|
}
|
|
413
|
-
w ?
|
|
420
|
+
w ? O(F, h()) : O(h(), F);
|
|
414
421
|
}
|
|
415
|
-
a?.forEach((
|
|
416
|
-
}, [w, t, n,
|
|
417
|
-
const
|
|
418
|
-
return
|
|
419
|
-
|
|
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);
|
|
420
427
|
};
|
|
421
|
-
}, [a]),
|
|
428
|
+
}, [a]), D && s ? null : /* @__PURE__ */ M(e, { ref: A, ...x });
|
|
422
429
|
}
|
|
423
|
-
const
|
|
424
|
-
const
|
|
425
|
-
return /* @__PURE__ */
|
|
426
|
-
},
|
|
427
|
-
const
|
|
428
|
-
let
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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);
|
|
443
|
+
}
|
|
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
|
|
439
454
|
), []);
|
|
440
|
-
return
|
|
441
|
-
({ key:
|
|
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)
|
|
442
457
|
);
|
|
443
458
|
}
|
|
444
|
-
const
|
|
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) => {
|
|
445
463
|
const t = [];
|
|
446
464
|
let n = -1 / 0;
|
|
447
465
|
for (const r of e) {
|
|
@@ -449,138 +467,186 @@ const ft = "rac-chip-slot", Le = "rac-flip", Ge = [], Ut = 0.25, Yt = { hoverId:
|
|
|
449
467
|
s.top >= n - 1 && (t.push([]), n = s.bottom), t.at(-1).push(r), n = Math.max(n, s.bottom);
|
|
450
468
|
}
|
|
451
469
|
return t;
|
|
452
|
-
},
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
},
|
|
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) => {
|
|
468
492
|
if (!e.animate) return;
|
|
469
|
-
e.getAnimations().forEach((a) => a.id ===
|
|
470
|
-
const s = e.getBoundingClientRect(),
|
|
471
|
-
(Math.abs(
|
|
472
|
-
},
|
|
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) => {
|
|
473
513
|
if (!e || n === t.value) return;
|
|
474
|
-
const
|
|
475
|
-
t.anim?.cancel(), t.root =
|
|
476
|
-
const
|
|
477
|
-
if (t.value = n, t.anim = null,
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
t.anim ===
|
|
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);
|
|
481
521
|
};
|
|
482
|
-
};
|
|
483
|
-
function
|
|
484
|
-
const { selectRef: t, duration: n, easing: r, multiple: s, deleteInline:
|
|
485
|
-
const
|
|
486
|
-
|
|
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) });
|
|
487
532
|
});
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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);
|
|
495
542
|
};
|
|
496
543
|
}, []);
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
}, [
|
|
503
|
-
|
|
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));
|
|
504
551
|
}, []);
|
|
505
|
-
return
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
}, [
|
|
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 };
|
|
516
570
|
}
|
|
517
|
-
const
|
|
518
|
-
const { selectRef: i, deleteInline: a, deleteAlways:
|
|
519
|
-
const { hoverId:
|
|
520
|
-
return (
|
|
521
|
-
}, () => 0),
|
|
522
|
-
const { clientX:
|
|
523
|
-
Object.assign(
|
|
524
|
-
w(!0),
|
|
525
|
-
},
|
|
526
|
-
}, [
|
|
527
|
-
const { clientX:
|
|
528
|
-
Math.hypot(
|
|
529
|
-
}, [t.id,
|
|
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(() => {
|
|
530
586
|
s.get().hoverId === t.id && s.set({ hoverId: null });
|
|
531
587
|
}, [t.id, s]);
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
s.set({ swipedId: null }),
|
|
535
|
-
}, [t.id,
|
|
536
|
-
|
|
537
|
-
}, [n,
|
|
538
|
-
return /* @__PURE__ */
|
|
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(
|
|
539
595
|
"div",
|
|
540
596
|
{
|
|
541
|
-
className:
|
|
542
|
-
style:
|
|
543
|
-
...!r && { onTouchStart:
|
|
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 },
|
|
544
600
|
children: [
|
|
545
|
-
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
|
|
601
|
+
I,
|
|
602
|
+
/* @__PURE__ */ M(
|
|
603
|
+
de,
|
|
548
604
|
{
|
|
549
|
-
"aria-label": `${
|
|
550
|
-
group: a && !
|
|
551
|
-
onMouseDown:
|
|
552
|
-
onClick:
|
|
605
|
+
"aria-label": `${u.remove} ${t.name ?? ""}`.trim(),
|
|
606
|
+
group: a && !l && !n ? o : void 0,
|
|
607
|
+
onMouseDown: oe,
|
|
608
|
+
onClick: B,
|
|
553
609
|
className: "rac-chip-del",
|
|
554
610
|
disabled: r,
|
|
555
611
|
tabIndex: -1,
|
|
556
612
|
type: "button",
|
|
557
|
-
in:
|
|
613
|
+
in: L,
|
|
558
614
|
as: "button",
|
|
559
615
|
axis: "x",
|
|
560
|
-
children:
|
|
616
|
+
children: he(b.remove)
|
|
561
617
|
}
|
|
562
618
|
)
|
|
563
619
|
]
|
|
564
620
|
}
|
|
565
621
|
);
|
|
566
|
-
}),
|
|
567
|
-
const
|
|
568
|
-
return /* @__PURE__ */
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
|
|
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" })
|
|
571
627
|
] });
|
|
572
|
-
}),
|
|
573
|
-
},
|
|
574
|
-
const { selectRef: t, multiple: n, name: r,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
(
|
|
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)
|
|
579
644
|
);
|
|
580
645
|
});
|
|
581
|
-
class
|
|
646
|
+
class An extends Pt {
|
|
582
647
|
getSnapshotBeforeUpdate(t) {
|
|
583
|
-
|
|
648
|
+
const n = t.look !== this.props.look;
|
|
649
|
+
return (n || t.chips !== this.props.chips) && this.props.take(n), null;
|
|
584
650
|
}
|
|
585
651
|
componentDidUpdate() {
|
|
586
652
|
}
|
|
@@ -588,403 +654,529 @@ class cn extends vt {
|
|
|
588
654
|
return null;
|
|
589
655
|
}
|
|
590
656
|
}
|
|
591
|
-
const
|
|
592
|
-
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)),
|
|
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));
|
|
593
659
|
return e.map((i) => {
|
|
594
660
|
if (r.has(i.id)) return [r.get(i.id), i];
|
|
595
|
-
const a = s.findIndex(([,
|
|
661
|
+
const a = s.findIndex(([, b]) => dn(b.original, i.original));
|
|
596
662
|
if (a >= 0) return [s.splice(a, 1)[0][0], i];
|
|
597
|
-
let
|
|
598
|
-
for (;
|
|
599
|
-
return
|
|
663
|
+
let l = i.id;
|
|
664
|
+
for (; o.has(l); ) l += "~";
|
|
665
|
+
return o.add(l), [l, i];
|
|
600
666
|
});
|
|
601
|
-
},
|
|
602
|
-
const [t, n] =
|
|
667
|
+
}, Nn = (e) => {
|
|
668
|
+
const [t, n] = Q(() => ({ chips: e, keyed: gt(e, []) }));
|
|
603
669
|
if (t.chips === e) return t.keyed;
|
|
604
|
-
const r =
|
|
670
|
+
const r = gt(e, t.keyed);
|
|
605
671
|
return n({ chips: e, keyed: r }), r;
|
|
606
|
-
},
|
|
607
|
-
const { selectedText: t, icons: n, valueAsOption: r, renderOption: s } =
|
|
608
|
-
return /* @__PURE__ */
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
] },
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
([
|
|
616
|
-
|
|
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,
|
|
617
683
|
{
|
|
618
|
-
element:
|
|
619
|
-
deleting:
|
|
620
|
-
locked: !
|
|
684
|
+
element: F,
|
|
685
|
+
deleting: x,
|
|
686
|
+
locked: !d,
|
|
621
687
|
chipStore: w,
|
|
622
|
-
delGroup:
|
|
623
|
-
settle:
|
|
688
|
+
delGroup: p,
|
|
689
|
+
settle: T
|
|
624
690
|
},
|
|
625
|
-
|
|
691
|
+
S
|
|
626
692
|
)
|
|
627
693
|
) }),
|
|
628
|
-
|
|
694
|
+
A && /* @__PURE__ */ M("button", { type: "button", className: "rac-chip-del", tabIndex: -1, "aria-hidden": "true", ref: v, style: Tn, children: he(n.remove) })
|
|
629
695
|
] });
|
|
630
|
-
}),
|
|
631
|
-
const { selectRef: t, selectId: n, highlightStore: r,
|
|
632
|
-
const
|
|
633
|
-
return
|
|
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;
|
|
634
700
|
}, () => {
|
|
635
|
-
}),
|
|
636
|
-
return /* @__PURE__ */
|
|
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(
|
|
637
703
|
"div",
|
|
638
704
|
{
|
|
639
705
|
...w,
|
|
640
|
-
id:
|
|
706
|
+
id: d,
|
|
641
707
|
ref: t,
|
|
642
|
-
style: { "--rac-duration": `${
|
|
643
|
-
className:
|
|
644
|
-
...
|
|
645
|
-
onKeyDown:
|
|
646
|
-
onFocus:
|
|
647
|
-
onClick:
|
|
648
|
-
onBlur:
|
|
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
|
|
649
715
|
},
|
|
650
|
-
|
|
651
|
-
"aria-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
"aria-
|
|
655
|
-
"aria-
|
|
656
|
-
"aria-
|
|
657
|
-
"
|
|
658
|
-
"
|
|
659
|
-
|
|
660
|
-
"data-
|
|
661
|
-
"data-
|
|
662
|
-
"data-empty": X(!D),
|
|
663
|
-
"data-deleting": X(L),
|
|
664
|
-
"data-error": X(M),
|
|
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),
|
|
665
728
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
|
|
669
|
-
|
|
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")
|
|
670
735
|
] }),
|
|
671
|
-
/* @__PURE__ */
|
|
736
|
+
/* @__PURE__ */ M($n, {})
|
|
672
737
|
]
|
|
673
738
|
}
|
|
674
739
|
);
|
|
675
|
-
}),
|
|
676
|
-
const { highlightStore: t } =
|
|
740
|
+
}), Fe = 0, jn = 1, ht = 2, Rt = (e) => {
|
|
741
|
+
const { highlightStore: t } = V(ne), n = G(null), r = ce(t.subscribe, () => {
|
|
677
742
|
const s = t.get();
|
|
678
|
-
return
|
|
679
|
-
}, () =>
|
|
680
|
-
return
|
|
681
|
-
r ===
|
|
682
|
-
}, [r]), [n, r !==
|
|
683
|
-
},
|
|
684
|
-
const { selectId:
|
|
685
|
-
return /* @__PURE__ */
|
|
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(
|
|
686
751
|
"div",
|
|
687
752
|
{
|
|
688
|
-
className:
|
|
689
|
-
onMouseEnter: () =>
|
|
690
|
-
onClick: (
|
|
691
|
-
"
|
|
692
|
-
"
|
|
693
|
-
|
|
694
|
-
"data-
|
|
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",
|
|
695
763
|
style: t.style,
|
|
696
|
-
|
|
764
|
+
role: "option",
|
|
765
|
+
ref: u,
|
|
697
766
|
children: [
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
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) })
|
|
700
769
|
]
|
|
701
770
|
}
|
|
702
771
|
);
|
|
703
|
-
}),
|
|
704
|
-
const { selectId:
|
|
705
|
-
return /* @__PURE__ */
|
|
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(
|
|
706
775
|
"div",
|
|
707
776
|
{
|
|
708
|
-
className:
|
|
709
|
-
onMouseEnter: () =>
|
|
710
|
-
onClick: (
|
|
777
|
+
className: me("rac-option", t.className),
|
|
778
|
+
onMouseEnter: () => d && b(n),
|
|
779
|
+
onClick: (y) => !t.loading && l(t, y),
|
|
711
780
|
"aria-disabled": t.disabled || t.loading,
|
|
712
|
-
"data-invalid":
|
|
781
|
+
"data-invalid": re(t.invalid),
|
|
713
782
|
"data-bool": typeof t.raw == "boolean" ? String(t.raw) : void 0,
|
|
714
|
-
"data-highlighted":
|
|
715
|
-
"data-loading":
|
|
716
|
-
id:
|
|
783
|
+
"data-highlighted": re(x),
|
|
784
|
+
"data-loading": re(t.loading),
|
|
785
|
+
id: De(o, t.id),
|
|
717
786
|
"aria-selected": r,
|
|
718
787
|
style: t.style,
|
|
719
788
|
role: "option",
|
|
720
|
-
ref:
|
|
789
|
+
ref: u,
|
|
721
790
|
children: [
|
|
722
|
-
|
|
723
|
-
t.loading &&
|
|
724
|
-
s && /* @__PURE__ */
|
|
725
|
-
|
|
726
|
-
|
|
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" })
|
|
727
796
|
] })
|
|
728
797
|
]
|
|
729
798
|
}
|
|
730
799
|
);
|
|
731
|
-
}),
|
|
732
|
-
const { selectId: t, multiple: n } =
|
|
733
|
-
return
|
|
734
|
-
const
|
|
735
|
-
let
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
),
|
|
740
|
-
}, w = (
|
|
741
|
-
|
|
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,
|
|
742
811
|
{
|
|
743
|
-
isSelected:
|
|
744
|
-
showCheckbox: n && !
|
|
745
|
-
option:
|
|
746
|
-
index:
|
|
812
|
+
isSelected: l.has(p.id) || a === p.id,
|
|
813
|
+
showCheckbox: n && !p.disabled && "original" in p,
|
|
814
|
+
option: p,
|
|
815
|
+
index: f
|
|
747
816
|
},
|
|
748
|
-
|
|
817
|
+
p.id
|
|
749
818
|
);
|
|
750
|
-
return r.forEach((
|
|
751
|
-
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
|
|
819
|
+
return r.forEach((p, f) => {
|
|
820
|
+
p.groupHeader ? (y(), d = p.name, c = Bt(t, p), u.push(
|
|
821
|
+
/* @__PURE__ */ M(
|
|
822
|
+
Rn,
|
|
754
823
|
{
|
|
755
|
-
hasChildren: p
|
|
756
|
-
open: i.has(
|
|
757
|
-
option:
|
|
758
|
-
index:
|
|
824
|
+
hasChildren: b[p.name] > 0,
|
|
825
|
+
open: i.has(p.name),
|
|
826
|
+
option: p,
|
|
827
|
+
index: f
|
|
759
828
|
},
|
|
760
|
-
|
|
829
|
+
p.id
|
|
761
830
|
)
|
|
762
|
-
)) :
|
|
763
|
-
}),
|
|
764
|
-
}, [r, a,
|
|
765
|
-
}),
|
|
766
|
-
const s = e.getBoundingClientRect(),
|
|
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;
|
|
767
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`);
|
|
768
|
-
},
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
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);
|
|
895
|
+
};
|
|
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;
|
|
791
921
|
}
|
|
792
|
-
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
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,
|
|
800
929
|
{
|
|
801
930
|
axis: "y",
|
|
802
|
-
fade:
|
|
803
|
-
in:
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
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(
|
|
812
942
|
"div",
|
|
813
943
|
{
|
|
814
|
-
onScroll:
|
|
944
|
+
onScroll: T,
|
|
815
945
|
className: "rac-list",
|
|
816
|
-
"aria-multiselectable":
|
|
946
|
+
"aria-multiselectable": r,
|
|
817
947
|
id: `${n}-listbox`,
|
|
818
|
-
"aria-label":
|
|
948
|
+
"aria-label": y.list,
|
|
819
949
|
role: "listbox",
|
|
820
950
|
tabIndex: "-1",
|
|
821
|
-
ref:
|
|
951
|
+
ref: L,
|
|
822
952
|
children: [
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
|
|
825
|
-
/* @__PURE__ */
|
|
826
|
-
|
|
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
|
|
827
957
|
] })
|
|
828
958
|
]
|
|
829
959
|
}
|
|
830
960
|
)
|
|
831
961
|
}
|
|
832
962
|
),
|
|
833
|
-
|
|
834
|
-
)
|
|
835
|
-
}),
|
|
836
|
-
|
|
837
|
-
const
|
|
838
|
-
|
|
963
|
+
Wn(x)
|
|
964
|
+
);
|
|
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;
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
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);
|
|
994
|
+
};
|
|
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,
|
|
839
1003
|
jsxOptions: t,
|
|
840
|
-
childrenFirst:
|
|
841
|
-
hasMore:
|
|
842
|
-
loadButton:
|
|
843
|
-
loadPending:
|
|
844
|
-
loadingTitle:
|
|
845
|
-
emptyOption:
|
|
846
|
-
invalidOption:
|
|
847
|
-
disabledOption:
|
|
848
|
-
emptyGroup:
|
|
849
|
-
}), [
|
|
850
|
-
|
|
851
|
-
), [
|
|
852
|
-
const
|
|
853
|
-
return
|
|
854
|
-
}),
|
|
855
|
-
r(
|
|
856
|
-
},
|
|
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({
|
|
857
1021
|
toggleGroup: z,
|
|
858
|
-
selectOption: (
|
|
859
|
-
if (
|
|
860
|
-
|
|
1022
|
+
selectOption: (j, K) => {
|
|
1023
|
+
if (j.groupHeader) {
|
|
1024
|
+
oe(K), j.disabled || z(j.name);
|
|
861
1025
|
return;
|
|
862
1026
|
}
|
|
863
|
-
if (
|
|
864
|
-
|
|
1027
|
+
if (j.disabled || j.loadMore) {
|
|
1028
|
+
oe(K), j.loadMore && !j.loading && o();
|
|
865
1029
|
return;
|
|
866
1030
|
}
|
|
867
|
-
if (
|
|
868
|
-
|
|
869
|
-
const
|
|
870
|
-
|
|
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]);
|
|
871
1035
|
return;
|
|
872
1036
|
}
|
|
873
|
-
|
|
1037
|
+
h?.id !== j.id && W(j.original, j.userId, [j.id]), s(!1);
|
|
874
1038
|
},
|
|
875
|
-
clear: (
|
|
876
|
-
|
|
1039
|
+
clear: (j) => {
|
|
1040
|
+
oe(j), W(u ? [] : null, u ? [] : null, Ge);
|
|
877
1041
|
},
|
|
878
|
-
removeOption: (
|
|
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));
|
|
1048
|
+
}
|
|
879
1049
|
});
|
|
880
|
-
return { normalizedOptions:
|
|
1050
|
+
return { normalizedOptions: S, expandedGroups: F, selected: h, selectedIDs: O, hasOptions: E, active: $, hasActualValue: N, title: _, valueOption: P, actions: we };
|
|
881
1051
|
}
|
|
882
|
-
const
|
|
1052
|
+
const Qn = (e) => ({
|
|
883
1053
|
internalVisibility: !1,
|
|
884
1054
|
deleting: !1,
|
|
885
1055
|
loadPending: !1,
|
|
886
1056
|
toggledGroups: /* @__PURE__ */ new Set(),
|
|
887
1057
|
internalValue: e.defaultValue,
|
|
888
|
-
picked:
|
|
1058
|
+
picked: Ge,
|
|
1059
|
+
fieldsetDisabled: !1,
|
|
1060
|
+
invalid: !1
|
|
889
1061
|
});
|
|
890
|
-
function
|
|
891
|
-
const {
|
|
892
|
-
|
|
893
|
-
|
|
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({
|
|
894
1074
|
// [DOC: select-store]
|
|
895
|
-
setVisibility: (
|
|
896
|
-
R
|
|
1075
|
+
setVisibility: (q) => {
|
|
1076
|
+
q === R || q && !d || (D || r({ internalVisibility: q }), x?.(q));
|
|
897
1077
|
},
|
|
898
1078
|
// [DOC: select-store]
|
|
899
1079
|
loadMoreOnce: () => {
|
|
900
|
-
if (!c ||
|
|
901
|
-
if (!
|
|
902
|
-
|
|
903
|
-
const
|
|
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 });
|
|
904
1084
|
try {
|
|
905
|
-
|
|
906
|
-
} catch (
|
|
907
|
-
|
|
1085
|
+
y()?.then?.(q, q);
|
|
1086
|
+
} catch (te) {
|
|
1087
|
+
I.current = !1, q(), (globalThis.reportError ?? console.error)(te);
|
|
908
1088
|
}
|
|
909
1089
|
},
|
|
910
|
-
setListReady: (
|
|
911
|
-
setDeleting: (
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
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
|
|
925
1107
|
});
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
}, [
|
|
929
|
-
|
|
930
|
-
}, [
|
|
931
|
-
|
|
932
|
-
}, [
|
|
933
|
-
|
|
934
|
-
}, [
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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 };
|
|
953
1145
|
}
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
return i != null && !
|
|
957
|
-
id:
|
|
958
|
-
userId:
|
|
959
|
-
value:
|
|
960
|
-
label:
|
|
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) : ""),
|
|
961
1153
|
jsx: i,
|
|
962
1154
|
hasJsx: i != null,
|
|
963
1155
|
className: s,
|
|
964
|
-
style:
|
|
1156
|
+
style: o,
|
|
965
1157
|
disabled: !!a,
|
|
966
|
-
group:
|
|
1158
|
+
group: l || u || null
|
|
967
1159
|
};
|
|
968
|
-
},
|
|
969
|
-
const
|
|
970
|
-
return { disabled: !!s, isGroupMarker: !0, group:
|
|
971
|
-
},
|
|
972
|
-
if (!
|
|
973
|
-
le("text", `Text inside <Select> or <OptGroup> is ignored ("${String(
|
|
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>.`);
|
|
974
1166
|
return;
|
|
975
1167
|
}
|
|
976
|
-
const i = `${r}-${String(
|
|
977
|
-
if (
|
|
978
|
-
else if (a === "option") s.push(
|
|
979
|
-
else if (a === "define")
|
|
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);
|
|
980
1172
|
else if (a === "group") {
|
|
981
|
-
const
|
|
982
|
-
s.push(
|
|
1173
|
+
const l = rr(o.props, t);
|
|
1174
|
+
s.push(l), Ce(o.props.children, t, l.group, i, s);
|
|
983
1175
|
} else {
|
|
984
|
-
const
|
|
985
|
-
le(`child ${
|
|
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().`);
|
|
986
1178
|
}
|
|
987
|
-
}), s),
|
|
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 = {
|
|
988
1180
|
options: [],
|
|
989
1181
|
value: void 0,
|
|
990
1182
|
defaultValue: void 0,
|
|
@@ -997,10 +1189,13 @@ const Cn = {}, Z = (e) => e != null && e !== "", Pe = (e) => e ? typeof e == "st
|
|
|
997
1189
|
error: !1,
|
|
998
1190
|
open: void 0,
|
|
999
1191
|
onOpenChange: void 0,
|
|
1192
|
+
popup: !0,
|
|
1000
1193
|
onFocus: void 0,
|
|
1001
1194
|
onBlur: void 0,
|
|
1195
|
+
onKeyDown: void 0,
|
|
1002
1196
|
id: void 0,
|
|
1003
1197
|
name: void 0,
|
|
1198
|
+
form: void 0,
|
|
1004
1199
|
required: !1,
|
|
1005
1200
|
hasMore: !1,
|
|
1006
1201
|
loadMore: void 0,
|
|
@@ -1022,11 +1217,18 @@ const Cn = {}, Z = (e) => e != null && e !== "", Pe = (e) => e ? typeof e == "st
|
|
|
1022
1217
|
invalidOption: "Invalid option",
|
|
1023
1218
|
disabledOption: "Disabled option",
|
|
1024
1219
|
emptyGroup: "Empty group",
|
|
1025
|
-
|
|
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"
|
|
1026
1228
|
},
|
|
1027
1229
|
renderOption: void 0,
|
|
1028
1230
|
valueAsOption: !1,
|
|
1029
|
-
icons: { arrow:
|
|
1231
|
+
icons: { arrow: Se.ArrowUp, clear: Se.XMark, remove: Se.XMark, check: Se.Checkmark, checkbox: void 0 },
|
|
1030
1232
|
deleteInline: !1,
|
|
1031
1233
|
deleteAlways: !1,
|
|
1032
1234
|
className: "",
|
|
@@ -1038,7 +1240,7 @@ const Cn = {}, Z = (e) => e != null && e !== "", Pe = (e) => e ? typeof e == "st
|
|
|
1038
1240
|
offset: 1,
|
|
1039
1241
|
animateOpacity: !0,
|
|
1040
1242
|
keepMounted: !1
|
|
1041
|
-
},
|
|
1243
|
+
}, bt = {
|
|
1042
1244
|
visibility: "open",
|
|
1043
1245
|
setVisibility: "onOpenChange",
|
|
1044
1246
|
ownBehavior: "open without onOpenChange",
|
|
@@ -1062,35 +1264,36 @@ const Cn = {}, Z = (e) => e != null && e !== "", Pe = (e) => e ? typeof e == "st
|
|
|
1062
1264
|
emptyOption: "texts.emptyOption",
|
|
1063
1265
|
invalidOption: "texts.invalidOption",
|
|
1064
1266
|
disabledOption: "texts.disabledOption"
|
|
1065
|
-
},
|
|
1267
|
+
}, Ve = (e, t) => {
|
|
1066
1268
|
const n = { ...e };
|
|
1067
1269
|
for (const r in t) t[r] !== void 0 && (n[r] = t[r]);
|
|
1068
1270
|
return n;
|
|
1069
1271
|
};
|
|
1070
|
-
function
|
|
1071
|
-
for (const
|
|
1272
|
+
function pr(e) {
|
|
1273
|
+
for (const d in e) d in bt && le(`renamed ${d}`, `The \`${d}\` prop was removed. Use \`${bt[d]}\`.`);
|
|
1072
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`.");
|
|
1073
|
-
const t =
|
|
1074
|
-
t.texts =
|
|
1075
|
-
const n = t.texts.emptyGroup, r =
|
|
1076
|
-
for (const
|
|
1077
|
-
const
|
|
1078
|
-
return /* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
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, {})
|
|
1081
1284
|
] }) }) });
|
|
1082
1285
|
}
|
|
1083
|
-
function
|
|
1286
|
+
function ar() {
|
|
1084
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;
|
|
1085
1288
|
}
|
|
1086
|
-
|
|
1087
|
-
function
|
|
1289
|
+
ar.racKind = "option";
|
|
1290
|
+
function cr() {
|
|
1088
1291
|
return null;
|
|
1089
1292
|
}
|
|
1090
|
-
|
|
1293
|
+
cr.racKind = "group";
|
|
1091
1294
|
export {
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1295
|
+
cr as OptGroup,
|
|
1296
|
+
ar as Option,
|
|
1297
|
+
pr as Select,
|
|
1298
|
+
fr as defineOption
|
|
1096
1299
|
};
|