@slotted/react 0.1.0-beta.25 → 0.1.0-beta.26
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/{data-grid-Dh-oaGY7.js → data-grid-BWWvixwB.js} +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/docs/app-shell.json +1 -1
- package/dist/docs/app-shell.md +1 -1
- package/dist/docs/dialog.json +1 -1
- package/dist/docs/dialog.md +1 -1
- package/dist/docs/drawer.json +1 -1
- package/dist/docs/drawer.md +1 -1
- package/dist/{entity-picker-BFoKN50H.js → entity-picker-WkBLvR2T.js} +1 -1
- package/dist/entity-picker.js +1 -1
- package/dist/{filter-bar-CPBr_n2c.js → filter-bar-DRQEl4-J.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-CzyIlQB_.js → import-export-center-C1t2tkzg.js} +1 -1
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +6 -6
- package/dist/{select-BTncjDuM.js → select-De77allF.js} +316 -314
- package/dist/select.js +1 -1
- package/dist/{table-Boy-0cjy.js → table-C3cjkzps.js} +1 -1
- package/dist/table.js +1 -1
- package/dist/types/select/select-parts.d.ts +1 -1
- package/dist/types/select/select-parts.d.ts.map +1 -1
- package/dist/types/select/select.types.d.ts +5 -1
- package/dist/types/select/select.types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -9,15 +9,15 @@ import { tabbables as d } from "@slotted/core/focus";
|
|
|
9
9
|
import { createControllable as f } from "@slotted/core/state";
|
|
10
10
|
import { createContext as p, useCallback as m, useContext as h, useEffect as g, useId as _, useImperativeHandle as ee, useLayoutEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
11
11
|
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
12
|
-
import { createPresence as
|
|
13
|
-
import { selectMessages as
|
|
14
|
-
import { createPortalRoot as
|
|
12
|
+
import { createPresence as T } from "@slotted/core/presence";
|
|
13
|
+
import { selectMessages as E } from "@slotted/core/i18n";
|
|
14
|
+
import { createPortalRoot as te, setPortalContainer as D } from "@slotted/core/portal";
|
|
15
15
|
import { createDismissableLayer as O } from "@slotted/core/dismissable-layer";
|
|
16
16
|
import { createPositioner as k } from "@slotted/core/positioner";
|
|
17
17
|
import { createTypeahead as A, isPrintable as ne } from "@slotted/core/typeahead";
|
|
18
|
-
import { createPortal as
|
|
19
|
-
import { createFilter as
|
|
20
|
-
import { matchRanges as
|
|
18
|
+
import { createPortal as j } from "react-dom";
|
|
19
|
+
import { createFilter as M, moveIndex as N, revealWithin as P } from "@slotted/core/collection";
|
|
20
|
+
import { matchRanges as re } from "@slotted/core/highlight";
|
|
21
21
|
//#region src/select/select-defaults.tsx
|
|
22
22
|
var F = {
|
|
23
23
|
align: "start",
|
|
@@ -104,46 +104,46 @@ function z() {
|
|
|
104
104
|
if (e === void 0) throw Error("SelectTrigger, SelectContent and every option have to be inside a Select.");
|
|
105
105
|
return e;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function B(e) {
|
|
108
108
|
return e == null ? [] : typeof e == "string" ? [e] : e;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function ae(e, t) {
|
|
111
111
|
return t ? e : e[0] ?? null;
|
|
112
112
|
}
|
|
113
|
-
var
|
|
114
|
-
function
|
|
115
|
-
return e === void 0 ? [] : e.flatMap((e) =>
|
|
113
|
+
var oe = (e) => "options" in e;
|
|
114
|
+
function se(e) {
|
|
115
|
+
return e === void 0 ? [] : e.flatMap((e) => oe(e) ? e.options : [e]);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
let
|
|
119
|
-
|
|
117
|
+
function ce({ align: n, alignOffset: r, children: i, clearable: o, closeOnEscape: s, closeOnOutsidePress: c, closeOnSelect: l, collisionPadding: u, defaultHighlightedValue: d = null, defaultOpen: p = !1, defaultSearchValue: h = "", defaultValue: g, disabled: v, filter: S, flip: w, form: T, fullWidth: te, hideWhenDetached: D, highlightedValue: O, highlightMatch: k, invalid: A, items: ne, loading: j, locale: N, loop: re, messages: F, mount: I, multiple: R, name: z, onHighlightedValueChange: oe, onOpenChange: ce, onSearchValueChange: V, onValueChange: H, open: U, portal: W, readOnly: le, ref: ue, required: G, search: de, searchValue: fe, shift: K, side: q, sideOffset: pe, size: J, strategy: me, total: he, typeahead: ge, typeaheadTimeout: _e, value: ve, variant: ye, width: be }) {
|
|
118
|
+
let Y = L(), X = a(), xe = t(E, F), Se = e(), Ce = N ?? Se, Z = _(), we = `${Z}listbox`, Te = `${Z}list`, Ee = `${Z}search`, De = X?.ids.control ?? `${Z}trigger`, [Oe, ke] = x(p), [Ae] = x(() => B(g)), [je, Me] = x(Ae), [Ne, Pe] = x(d), [Fe, Ie] = x(h), [Le, Re] = x(null), [ze, Be] = x(null), [Ve, He] = x(null), Ue = R ?? Y.multiple, We = v ?? X?.disabled ?? Y.disabled, Ge = le ?? X?.readOnly ?? Y.readOnly, Ke = (U ?? Oe) && !We, qe = ve === void 0 ? je : B(ve), Je = O === void 0 ? Ne : O, Ye = de ?? Y.search, Xe = Ye ? fe === void 0 ? Fe : fe : "", Ze = b(Ke);
|
|
119
|
+
Ke && (Ze.current = !0);
|
|
120
120
|
let Qe = b("selected"), $e = b(/* @__PURE__ */ new Map()), [et, tt] = x(0), nt = y(() => {
|
|
121
121
|
let e = /* @__PURE__ */ new Map();
|
|
122
|
-
for (let t of
|
|
122
|
+
for (let t of se(ne)) e.set(t.value, t.label);
|
|
123
123
|
return e;
|
|
124
124
|
}, [ne]), rt = m((e, t) => {
|
|
125
125
|
$e.current.get(e) !== t && ($e.current.set(e, t), tt((e) => e + 1));
|
|
126
|
-
}, []), it = m((e) => nt.get(e) ?? $e.current.get(e), [nt, et]), at = y(() =>
|
|
127
|
-
|
|
126
|
+
}, []), it = m((e) => nt.get(e) ?? $e.current.get(e), [nt, et]), at = y(() => M({ locale: Ce }), [Ce]), ot = m((e) => Xe === "" || S === null ? !0 : S === void 0 ? at.contains(e, Xe) : S(e, Xe), [
|
|
127
|
+
Xe,
|
|
128
128
|
at,
|
|
129
129
|
S
|
|
130
|
-
]), st = m((e) => `${
|
|
131
|
-
currentHighlighted:
|
|
132
|
-
currentOpen:
|
|
133
|
-
currentQuery:
|
|
134
|
-
currentSelection:
|
|
130
|
+
]), st = m((e) => `${Z}option-${encodeURIComponent(e)}`, [Z]), ct = {
|
|
131
|
+
currentHighlighted: Je,
|
|
132
|
+
currentOpen: Ke,
|
|
133
|
+
currentQuery: Xe,
|
|
134
|
+
currentSelection: qe,
|
|
135
135
|
highlightedValue: O,
|
|
136
|
-
onHighlightedValueChange:
|
|
137
|
-
onOpenChange:
|
|
138
|
-
onSearchValueChange:
|
|
139
|
-
onValueChange:
|
|
140
|
-
open:
|
|
141
|
-
resolvedMultiple:
|
|
142
|
-
resolvedSearch:
|
|
143
|
-
searchNode:
|
|
144
|
-
searchValue:
|
|
145
|
-
triggerNode:
|
|
146
|
-
value:
|
|
136
|
+
onHighlightedValueChange: oe,
|
|
137
|
+
onOpenChange: ce,
|
|
138
|
+
onSearchValueChange: V,
|
|
139
|
+
onValueChange: H,
|
|
140
|
+
open: U,
|
|
141
|
+
resolvedMultiple: Ue,
|
|
142
|
+
resolvedSearch: Ye,
|
|
143
|
+
searchNode: Ve,
|
|
144
|
+
searchValue: fe,
|
|
145
|
+
triggerNode: Le,
|
|
146
|
+
value: ve
|
|
147
147
|
}, Q = b(ct);
|
|
148
148
|
Q.current = ct;
|
|
149
149
|
let lt = m((e, t, n) => {
|
|
@@ -152,29 +152,29 @@ function le({ align: n, alignOffset: r, children: i, clearable: o, closeOnEscape
|
|
|
152
152
|
controlled: r.searchValue,
|
|
153
153
|
initial: r.currentQuery,
|
|
154
154
|
onRequest: (e) => r.onSearchValueChange?.(e.value, e)
|
|
155
|
-
}).request(e, t, n) &&
|
|
155
|
+
}).request(e, t, n) && Ie(e);
|
|
156
156
|
}, []), ut = m((e, t, n) => {
|
|
157
157
|
let r = Q.current;
|
|
158
158
|
e !== r.currentOpen && f({
|
|
159
159
|
controlled: r.open,
|
|
160
160
|
initial: r.currentOpen,
|
|
161
161
|
onRequest: (e) => r.onOpenChange?.(e.value, e)
|
|
162
|
-
}).request(e, t, n) && (
|
|
162
|
+
}).request(e, t, n) && (ke(e), e || (Pe(null), Qe.current = "selected", lt("", "clear", n)));
|
|
163
163
|
}, [lt]), dt = m((e, t, n) => {
|
|
164
164
|
let r = Q.current;
|
|
165
165
|
e !== r.currentHighlighted && f({
|
|
166
166
|
controlled: r.highlightedValue,
|
|
167
167
|
initial: r.currentHighlighted,
|
|
168
168
|
onRequest: (e) => r.onHighlightedValueChange?.(e.value, e)
|
|
169
|
-
}).request(e, t, n) &&
|
|
169
|
+
}).request(e, t, n) && Pe(e);
|
|
170
170
|
}, []), $ = m((e, t, n) => {
|
|
171
171
|
let r = Q.current;
|
|
172
172
|
e.length === r.currentSelection.length && e.every((e, t) => e === r.currentSelection[t]) || f({
|
|
173
173
|
controlled: r.value,
|
|
174
|
-
initial:
|
|
174
|
+
initial: ae(r.currentSelection, r.resolvedMultiple),
|
|
175
175
|
equals: () => !1,
|
|
176
176
|
onRequest: (e) => r.onValueChange?.(e.value, e)
|
|
177
|
-
}).request(
|
|
177
|
+
}).request(ae(e, r.resolvedMultiple), t, n) && Me(e);
|
|
178
178
|
}, []), ft = m((e, t, n) => {
|
|
179
179
|
let r = Q.current;
|
|
180
180
|
if (!r.resolvedMultiple) {
|
|
@@ -183,8 +183,8 @@ function le({ align: n, alignOffset: r, children: i, clearable: o, closeOnEscape
|
|
|
183
183
|
}
|
|
184
184
|
let i = r.currentSelection.includes(e);
|
|
185
185
|
$(i ? r.currentSelection.filter((t) => t !== e) : [...r.currentSelection, e], t, n);
|
|
186
|
-
}, [$]), pt = m((e, t) => $([], e, t), [$]), mt = m((e) => $(
|
|
187
|
-
ee(
|
|
186
|
+
}, [$]), pt = m((e, t) => $([], e, t), [$]), mt = m((e) => $(Ae, "programmatic", e), [$, Ae]);
|
|
187
|
+
ee(ue, () => ({
|
|
188
188
|
close: () => ut(!1, "programmatic"),
|
|
189
189
|
focus: () => Q.current.triggerNode?.focus({ preventScroll: !0 }),
|
|
190
190
|
focusSearch: () => {
|
|
@@ -193,72 +193,72 @@ function le({ align: n, alignOffset: r, children: i, clearable: o, closeOnEscape
|
|
|
193
193
|
},
|
|
194
194
|
open: () => ut(!0, "programmatic"),
|
|
195
195
|
scrollToKey: (e) => {
|
|
196
|
-
let t =
|
|
197
|
-
t != null &&
|
|
196
|
+
let t = ze?.querySelector(`[data-part='item'][data-value="${CSS.escape(e)}"]`);
|
|
197
|
+
t != null && ze !== null && P(t, ze);
|
|
198
198
|
}
|
|
199
|
-
}), [
|
|
199
|
+
}), [ze, ut]);
|
|
200
200
|
let ht = {
|
|
201
|
-
align: n ??
|
|
202
|
-
alignOffset: r ??
|
|
201
|
+
align: n ?? Y.align,
|
|
202
|
+
alignOffset: r ?? Y.alignOffset,
|
|
203
203
|
clear: pt,
|
|
204
|
-
clearable: o ??
|
|
205
|
-
closeOnEscape: s ??
|
|
206
|
-
closeOnOutsidePress: c ??
|
|
207
|
-
closeOnSelect: l ??
|
|
208
|
-
collisionPadding: u ??
|
|
209
|
-
contentId:
|
|
210
|
-
contentNode:
|
|
211
|
-
disabled:
|
|
204
|
+
clearable: o ?? Y.clearable,
|
|
205
|
+
closeOnEscape: s ?? Y.closeOnEscape,
|
|
206
|
+
closeOnOutsidePress: c ?? Y.closeOnOutsidePress,
|
|
207
|
+
closeOnSelect: l ?? Y.closeOnSelect,
|
|
208
|
+
collisionPadding: u ?? Y.collisionPadding,
|
|
209
|
+
contentId: we,
|
|
210
|
+
contentNode: ze,
|
|
211
|
+
disabled: We,
|
|
212
212
|
entry: Qe,
|
|
213
|
-
flip: w ??
|
|
214
|
-
form:
|
|
215
|
-
fullWidth:
|
|
216
|
-
hideWhenDetached: D ??
|
|
217
|
-
highlighted:
|
|
218
|
-
highlightMatch: k ??
|
|
219
|
-
invalid: A ??
|
|
213
|
+
flip: w ?? Y.flip,
|
|
214
|
+
form: T,
|
|
215
|
+
fullWidth: te ?? Y.fullWidth,
|
|
216
|
+
hideWhenDetached: D ?? Y.hideWhenDetached,
|
|
217
|
+
highlighted: Je,
|
|
218
|
+
highlightMatch: k ?? Y.highlightMatch,
|
|
219
|
+
invalid: A ?? X?.invalid ?? Y.invalid,
|
|
220
220
|
labelFor: it,
|
|
221
|
-
listId:
|
|
222
|
-
loading:
|
|
223
|
-
locale:
|
|
224
|
-
loop:
|
|
221
|
+
listId: Te,
|
|
222
|
+
loading: j ?? Y.loading,
|
|
223
|
+
locale: Ce,
|
|
224
|
+
loop: re ?? Y.loop,
|
|
225
225
|
matches: ot,
|
|
226
|
-
mount: I ??
|
|
227
|
-
multiple:
|
|
226
|
+
mount: I ?? Y.mount,
|
|
227
|
+
multiple: Ue,
|
|
228
228
|
name: z,
|
|
229
|
-
open:
|
|
229
|
+
open: Ke,
|
|
230
230
|
optionId: st,
|
|
231
|
-
portal:
|
|
232
|
-
query:
|
|
233
|
-
readOnly:
|
|
231
|
+
portal: W ?? Y.portal,
|
|
232
|
+
query: Xe,
|
|
233
|
+
readOnly: Ge,
|
|
234
234
|
registerLabel: rt,
|
|
235
|
-
required:
|
|
235
|
+
required: G ?? X?.required ?? Y.required,
|
|
236
236
|
restore: mt,
|
|
237
|
-
search:
|
|
238
|
-
searchId:
|
|
239
|
-
searchNode:
|
|
237
|
+
search: Ye,
|
|
238
|
+
searchId: Ee,
|
|
239
|
+
searchNode: Ve,
|
|
240
240
|
seen: Ze.current,
|
|
241
|
-
selection:
|
|
242
|
-
setContentNode:
|
|
241
|
+
selection: qe,
|
|
242
|
+
setContentNode: Be,
|
|
243
243
|
setHighlighted: dt,
|
|
244
244
|
setOpen: ut,
|
|
245
245
|
setQuery: lt,
|
|
246
|
-
setSearchNode:
|
|
247
|
-
setTriggerNode:
|
|
248
|
-
shift:
|
|
249
|
-
side:
|
|
250
|
-
sideOffset:
|
|
251
|
-
size:
|
|
252
|
-
strategy:
|
|
253
|
-
t:
|
|
246
|
+
setSearchNode: He,
|
|
247
|
+
setTriggerNode: Re,
|
|
248
|
+
shift: K ?? Y.shift,
|
|
249
|
+
side: q ?? Y.side,
|
|
250
|
+
sideOffset: pe ?? Y.sideOffset,
|
|
251
|
+
size: J ?? X?.size ?? Y.size,
|
|
252
|
+
strategy: me ?? Y.strategy,
|
|
253
|
+
t: xe,
|
|
254
254
|
toggle: ft,
|
|
255
|
-
total:
|
|
256
|
-
triggerId:
|
|
257
|
-
triggerNode:
|
|
258
|
-
typeahead:
|
|
259
|
-
typeaheadTimeout:
|
|
260
|
-
variant:
|
|
261
|
-
width:
|
|
255
|
+
total: he,
|
|
256
|
+
triggerId: De,
|
|
257
|
+
triggerNode: Le,
|
|
258
|
+
typeahead: Ye ? !1 : ge ?? Y.typeahead,
|
|
259
|
+
typeaheadTimeout: _e ?? Y.typeaheadTimeout,
|
|
260
|
+
variant: ye ?? Y.variant,
|
|
261
|
+
width: be ?? Y.width
|
|
262
262
|
};
|
|
263
263
|
return /* @__PURE__ */ C(ie.Provider, {
|
|
264
264
|
value: ht,
|
|
@@ -267,240 +267,242 @@ function le({ align: n, alignOffset: r, children: i, clearable: o, closeOnEscape
|
|
|
267
267
|
}
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/select/select-collection.ts
|
|
270
|
-
var
|
|
271
|
-
function
|
|
272
|
-
return e === null ? [] : [...e.querySelectorAll(
|
|
270
|
+
var V = "[data-part='item']";
|
|
271
|
+
function H(e) {
|
|
272
|
+
return e === null ? [] : [...e.querySelectorAll(V)];
|
|
273
273
|
}
|
|
274
|
-
var
|
|
275
|
-
function
|
|
276
|
-
let t =
|
|
274
|
+
var U = (e) => e.dataset.value ?? "", W = (e) => e.dataset.disabled === void 0, le = (e) => e.dataset.textValue ?? e.querySelector("[data-part='label']")?.textContent?.trim() ?? e.textContent?.trim() ?? "";
|
|
275
|
+
function ue(e) {
|
|
276
|
+
let t = H(e).filter(W);
|
|
277
277
|
return {
|
|
278
278
|
elements: t,
|
|
279
|
-
labels: t.map(
|
|
279
|
+
labels: t.map(le)
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
let i =
|
|
282
|
+
function G(e, t, n, r) {
|
|
283
|
+
let i = H(e);
|
|
284
284
|
if (i.length === 0) return null;
|
|
285
|
-
let a =
|
|
286
|
-
enabled: i.map(
|
|
287
|
-
from: t === null ? -1 : i.findIndex((e) =>
|
|
285
|
+
let a = N({
|
|
286
|
+
enabled: i.map(W),
|
|
287
|
+
from: t === null ? -1 : i.findIndex((e) => U(e) === t),
|
|
288
288
|
intent: n,
|
|
289
289
|
loop: r
|
|
290
290
|
});
|
|
291
|
-
return a === -1 ? null :
|
|
291
|
+
return a === -1 ? null : U(i[a]);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function de(e, t, n, r) {
|
|
294
294
|
if (n === "none") return null;
|
|
295
295
|
if (n === "selected") {
|
|
296
|
-
let n =
|
|
297
|
-
return n === void 0 ?
|
|
296
|
+
let n = H(e).find((e) => t.includes(U(e)) && W(e));
|
|
297
|
+
return n === void 0 ? G(e, null, "first", r) : U(n);
|
|
298
298
|
}
|
|
299
|
-
return
|
|
299
|
+
return G(e, null, n, r);
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function fe(e, t) {
|
|
302
302
|
if (e === null || t === null) return;
|
|
303
|
-
let n =
|
|
304
|
-
n !== void 0 &&
|
|
303
|
+
let n = H(e).find((e) => U(e) === t);
|
|
304
|
+
n !== void 0 && P(n, e);
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/select/select-parts.tsx
|
|
308
|
-
function
|
|
308
|
+
function K(e, t) {
|
|
309
309
|
return (n) => {
|
|
310
310
|
e?.(n), n.defaultPrevented || t(n);
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function q(e, t, n) {
|
|
314
314
|
if (e === null) return;
|
|
315
315
|
let r = d(document.body).filter((e) => t === null || !t.contains(e)), i = r.indexOf(e);
|
|
316
316
|
((i === -1 ? void 0 : r[i + (n ? -1 : 1)]) ?? e).focus({ preventScroll: !0 });
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function pe(e, ...t) {
|
|
319
319
|
for (let n of t) typeof n == "function" ? n(e) : n != null && (n.current = e);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
let
|
|
323
|
-
g(() =>
|
|
324
|
-
let [
|
|
321
|
+
function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
322
|
+
let f = z(), p = a(), h = p?.registerControl;
|
|
323
|
+
g(() => h?.(), [h]);
|
|
324
|
+
let [_, ee] = x(null), [v, y] = x(null), T = b(!1);
|
|
325
325
|
g(() => {
|
|
326
|
-
if (
|
|
327
|
-
let e =
|
|
328
|
-
|
|
326
|
+
if (v === null) return;
|
|
327
|
+
let e = v.ownerDocument, t = () => {
|
|
328
|
+
T.current = !1;
|
|
329
329
|
}, n = () => {
|
|
330
|
-
|
|
330
|
+
T.current = !0;
|
|
331
331
|
};
|
|
332
|
-
return e.addEventListener("pointerdown", t, !0),
|
|
333
|
-
e.removeEventListener("pointerdown", t, !0),
|
|
332
|
+
return e.addEventListener("pointerdown", t, !0), v.addEventListener("pointerdown", n), () => {
|
|
333
|
+
e.removeEventListener("pointerdown", t, !0), v.removeEventListener("pointerdown", n);
|
|
334
334
|
};
|
|
335
|
-
}, [
|
|
336
|
-
let [
|
|
335
|
+
}, [v]);
|
|
336
|
+
let [E, te] = x(!1), D = b(null), O = b(null);
|
|
337
337
|
g(() => {
|
|
338
|
-
|
|
339
|
-
}, [
|
|
340
|
-
if (!
|
|
341
|
-
let e = A({ timeout:
|
|
342
|
-
return
|
|
343
|
-
e.destroy(),
|
|
338
|
+
f.setTriggerNode(_);
|
|
339
|
+
}, [_, f]), g(() => {
|
|
340
|
+
if (!f.typeahead) return;
|
|
341
|
+
let e = A({ timeout: f.typeaheadTimeout });
|
|
342
|
+
return O.current = e, () => {
|
|
343
|
+
e.destroy(), O.current = null;
|
|
344
344
|
};
|
|
345
|
-
}, [
|
|
346
|
-
if (!
|
|
347
|
-
let e =
|
|
348
|
-
if (
|
|
349
|
-
let { elements: t, labels: n } =
|
|
350
|
-
r !== -1 &&
|
|
345
|
+
}, [f.typeahead, f.typeaheadTimeout]), g(() => {
|
|
346
|
+
if (!f.open || f.contentNode === null) return;
|
|
347
|
+
let e = D.current;
|
|
348
|
+
if (D.current = null, e === null || O.current === null) return;
|
|
349
|
+
let { elements: t, labels: n } = ue(f.contentNode), r = O.current.match(e, n, -1);
|
|
350
|
+
r !== -1 && f.setHighlighted(U(t[r]), "keyboard");
|
|
351
351
|
}, [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
352
|
+
f,
|
|
353
|
+
f.contentNode,
|
|
354
|
+
f.open
|
|
355
355
|
]);
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
},
|
|
359
|
-
let n =
|
|
360
|
-
n !== null &&
|
|
361
|
-
},
|
|
362
|
-
if (
|
|
363
|
-
t &&
|
|
356
|
+
let k = (e, t) => {
|
|
357
|
+
f.entry.current = e, f.setOpen(!0, "keyboard", t);
|
|
358
|
+
}, j = (e, t) => {
|
|
359
|
+
let n = G(f.contentNode, f.highlighted, e, f.loop);
|
|
360
|
+
n !== null && f.setHighlighted(n, "keyboard", t);
|
|
361
|
+
}, M = (e, t) => {
|
|
362
|
+
if (f.highlighted === null) {
|
|
363
|
+
t && f.setOpen(!1, "select", e);
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
if (
|
|
366
|
+
f.toggle(f.highlighted, "keyboard", e), t && f.setOpen(!1, "select", e);
|
|
367
|
+
}, N = (e) => {
|
|
368
|
+
if (f.disabled || f.readOnly) return;
|
|
369
369
|
let t = e.altKey;
|
|
370
|
-
if (!
|
|
370
|
+
if (!f.open) {
|
|
371
371
|
switch (e.key) {
|
|
372
372
|
case "ArrowDown":
|
|
373
|
-
e.preventDefault(),
|
|
373
|
+
e.preventDefault(), k(t ? "none" : "selected", e.nativeEvent);
|
|
374
374
|
return;
|
|
375
375
|
case "ArrowUp":
|
|
376
|
-
e.preventDefault(),
|
|
376
|
+
e.preventDefault(), k("last", e.nativeEvent);
|
|
377
377
|
return;
|
|
378
378
|
case "Enter":
|
|
379
379
|
case " ":
|
|
380
|
-
e.preventDefault(),
|
|
380
|
+
e.preventDefault(), k("selected", e.nativeEvent);
|
|
381
381
|
return;
|
|
382
382
|
case "Home":
|
|
383
|
-
e.preventDefault(),
|
|
383
|
+
e.preventDefault(), k("first", e.nativeEvent);
|
|
384
384
|
return;
|
|
385
385
|
case "End":
|
|
386
|
-
e.preventDefault(),
|
|
386
|
+
e.preventDefault(), k("last", e.nativeEvent);
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
389
|
if (!e.ctrlKey && !e.metaKey && !t && ne(e.key)) {
|
|
390
|
-
if (
|
|
391
|
-
e.preventDefault(),
|
|
390
|
+
if (f.search) {
|
|
391
|
+
e.preventDefault(), f.setQuery(e.key, "keyboard", e.nativeEvent), k("first", e.nativeEvent);
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
|
-
|
|
394
|
+
f.typeahead && (e.preventDefault(), D.current = e.key, k("none", e.nativeEvent));
|
|
395
395
|
}
|
|
396
396
|
return;
|
|
397
397
|
}
|
|
398
398
|
switch (e.key) {
|
|
399
399
|
case "ArrowDown":
|
|
400
|
-
e.preventDefault(),
|
|
400
|
+
e.preventDefault(), j("next", e.nativeEvent);
|
|
401
401
|
return;
|
|
402
402
|
case "ArrowUp":
|
|
403
|
-
e.preventDefault(), t ?
|
|
403
|
+
e.preventDefault(), t ? M(e.nativeEvent, !0) : j("previous", e.nativeEvent);
|
|
404
404
|
return;
|
|
405
405
|
case "Home":
|
|
406
|
-
e.preventDefault(),
|
|
406
|
+
e.preventDefault(), j("first", e.nativeEvent);
|
|
407
407
|
return;
|
|
408
408
|
case "End":
|
|
409
|
-
e.preventDefault(),
|
|
409
|
+
e.preventDefault(), j("last", e.nativeEvent);
|
|
410
410
|
return;
|
|
411
411
|
case "PageDown":
|
|
412
|
-
e.preventDefault(),
|
|
412
|
+
e.preventDefault(), j("pageDown", e.nativeEvent);
|
|
413
413
|
return;
|
|
414
414
|
case "PageUp":
|
|
415
|
-
e.preventDefault(),
|
|
415
|
+
e.preventDefault(), j("pageUp", e.nativeEvent);
|
|
416
416
|
return;
|
|
417
417
|
case "Enter":
|
|
418
|
-
e.preventDefault(),
|
|
418
|
+
e.preventDefault(), M(e.nativeEvent, f.closeOnSelect);
|
|
419
419
|
return;
|
|
420
420
|
case " ":
|
|
421
|
-
e.preventDefault(),
|
|
421
|
+
e.preventDefault(), M(e.nativeEvent, !f.multiple && f.closeOnSelect);
|
|
422
422
|
return;
|
|
423
423
|
case "Escape":
|
|
424
|
-
e.preventDefault(),
|
|
424
|
+
e.preventDefault(), f.setOpen(!1, "escape", e.nativeEvent);
|
|
425
425
|
return;
|
|
426
426
|
case "Tab":
|
|
427
|
-
|
|
427
|
+
M(e.nativeEvent, !0);
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
430
|
-
if (!
|
|
430
|
+
if (!f.typeahead || O.current === null || e.ctrlKey || e.metaKey || t || !ne(e.key, O.current.query.length > 0)) return;
|
|
431
431
|
e.preventDefault();
|
|
432
|
-
let { elements: n, labels: r } =
|
|
433
|
-
a !== -1 &&
|
|
434
|
-
},
|
|
435
|
-
let t =
|
|
436
|
-
if (
|
|
432
|
+
let { elements: n, labels: r } = ue(f.contentNode), i = n.findIndex((e) => U(e) === f.highlighted), a = O.current.match(e.key, r, i);
|
|
433
|
+
a !== -1 && f.setHighlighted(U(n[a]), "keyboard");
|
|
434
|
+
}, P = (e) => {
|
|
435
|
+
let t = T.current;
|
|
436
|
+
if (T.current = !1, e.detail > 0 && !t) {
|
|
437
437
|
e.currentTarget.focus({ preventScroll: !0 });
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
|
-
|
|
441
|
-
},
|
|
442
|
-
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
}, [
|
|
440
|
+
f.disabled || f.readOnly || (f.entry.current = "selected", f.setOpen(!f.open, "pointer", e.nativeEvent));
|
|
441
|
+
}, re = (e) => {
|
|
442
|
+
f.clear("clear", e.nativeEvent), _?.focus({ preventScroll: !0 });
|
|
443
|
+
}, F = m((e) => {
|
|
444
|
+
ee(e), pe(e, s);
|
|
445
|
+
}, [s]), I = [d["aria-describedby"], p?.describedBy].filter(Boolean).join(" "), L = f.clearable && f.selection.length > 0 && !f.disabled && !f.readOnly, R = {
|
|
446
|
+
className: t,
|
|
447
|
+
style: u,
|
|
446
448
|
"data-part": "root",
|
|
447
449
|
...l("part", "root"),
|
|
448
|
-
"data-size":
|
|
450
|
+
"data-size": f.size,
|
|
449
451
|
"data-ui": "select",
|
|
450
452
|
...l("ui", "select"),
|
|
451
|
-
"data-variant":
|
|
452
|
-
...
|
|
453
|
-
...
|
|
454
|
-
...
|
|
455
|
-
...
|
|
456
|
-
...
|
|
457
|
-
...
|
|
458
|
-
...
|
|
459
|
-
...
|
|
460
|
-
...
|
|
461
|
-
},
|
|
462
|
-
disabled:
|
|
463
|
-
frame:
|
|
464
|
-
labelFor:
|
|
453
|
+
"data-variant": f.variant,
|
|
454
|
+
...f.fullWidth ? { "data-full-width": "" } : {},
|
|
455
|
+
...f.multiple ? { "data-multiple": "" } : {},
|
|
456
|
+
...f.open ? { "data-open": "" } : {},
|
|
457
|
+
...f.disabled ? { "data-disabled": "" } : {},
|
|
458
|
+
...f.readOnly ? { "data-readonly": "" } : {},
|
|
459
|
+
...f.invalid ? { "data-invalid": "" } : {},
|
|
460
|
+
...f.required ? { "data-required": "" } : {},
|
|
461
|
+
...f.loading ? { "data-loading": "" } : {},
|
|
462
|
+
...E ? { "data-narrow": "" } : {}
|
|
463
|
+
}, ie = f.multiple && f.selection.length > 0 ? /* @__PURE__ */ C(o, {
|
|
464
|
+
disabled: f.disabled || f.readOnly,
|
|
465
|
+
frame: v,
|
|
466
|
+
labelFor: f.labelFor,
|
|
465
467
|
onNarrow: te,
|
|
466
468
|
onRemove: (e, t) => {
|
|
467
|
-
|
|
469
|
+
f.toggle(e, "select", t.nativeEvent), _?.focus({ preventScroll: !0 });
|
|
468
470
|
},
|
|
469
|
-
removeLabel: (e) =>
|
|
470
|
-
values:
|
|
471
|
-
}) : null,
|
|
471
|
+
removeLabel: (e) => f.t("remove", { label: e }),
|
|
472
|
+
values: f.selection
|
|
473
|
+
}) : null, B = /* @__PURE__ */ w(S, { children: [
|
|
472
474
|
/* @__PURE__ */ C("button", {
|
|
473
|
-
...
|
|
474
|
-
"aria-activedescendant":
|
|
475
|
-
"aria-controls":
|
|
476
|
-
"aria-describedby":
|
|
477
|
-
"aria-expanded":
|
|
478
|
-
"aria-haspopup":
|
|
479
|
-
"aria-invalid":
|
|
480
|
-
"aria-labelledby":
|
|
481
|
-
"aria-readonly":
|
|
482
|
-
"aria-required":
|
|
475
|
+
...d,
|
|
476
|
+
"aria-activedescendant": f.open && !f.search && f.highlighted !== null ? f.optionId(f.highlighted) : void 0,
|
|
477
|
+
"aria-controls": f.open ? f.contentId : void 0,
|
|
478
|
+
"aria-describedby": I === "" ? void 0 : I,
|
|
479
|
+
"aria-expanded": f.open,
|
|
480
|
+
"aria-haspopup": f.search ? "dialog" : "listbox",
|
|
481
|
+
"aria-invalid": f.invalid ? !0 : void 0,
|
|
482
|
+
"aria-labelledby": d["aria-label"] === void 0 && d["aria-labelledby"] === void 0 ? p?.ids.label : d["aria-labelledby"],
|
|
483
|
+
"aria-readonly": f.readOnly ? !0 : void 0,
|
|
484
|
+
"aria-required": f.required ? !0 : void 0,
|
|
483
485
|
"data-part": "trigger",
|
|
484
486
|
"data-part-trigger": "",
|
|
485
|
-
disabled:
|
|
486
|
-
id:
|
|
487
|
-
onClick:
|
|
488
|
-
onKeyDown:
|
|
489
|
-
ref:
|
|
487
|
+
disabled: f.disabled,
|
|
488
|
+
id: f.triggerId,
|
|
489
|
+
onClick: K(d.onClick, P),
|
|
490
|
+
onKeyDown: K(d.onKeyDown, N),
|
|
491
|
+
ref: F,
|
|
490
492
|
role: "combobox",
|
|
491
493
|
type: "button",
|
|
492
494
|
children: e
|
|
493
495
|
}),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
"aria-label":
|
|
496
|
+
ie,
|
|
497
|
+
L ? /* @__PURE__ */ C("button", {
|
|
498
|
+
"aria-label": f.t("clear"),
|
|
497
499
|
"data-part": "clear",
|
|
498
500
|
"data-part-clear": "",
|
|
499
|
-
onClick:
|
|
501
|
+
onClick: re,
|
|
500
502
|
type: "button",
|
|
501
503
|
children: /* @__PURE__ */ C(r, { children: /* @__PURE__ */ C(n, { name: "x" }) })
|
|
502
504
|
}) : null,
|
|
503
|
-
|
|
505
|
+
f.loading ? /* @__PURE__ */ C("span", {
|
|
504
506
|
"aria-hidden": "true",
|
|
505
507
|
"data-part": "busy",
|
|
506
508
|
"data-part-busy": "",
|
|
@@ -512,18 +514,18 @@ function q({ children: e, ref: t, render: s, ...c }) {
|
|
|
512
514
|
"data-part-arrow": "",
|
|
513
515
|
children: /* @__PURE__ */ C(r, { children: /* @__PURE__ */ C(n, { name: "chevron-down" }) })
|
|
514
516
|
}),
|
|
515
|
-
/* @__PURE__ */ C(
|
|
517
|
+
/* @__PURE__ */ C(me, {})
|
|
516
518
|
] });
|
|
517
|
-
return
|
|
518
|
-
...
|
|
519
|
-
ref:
|
|
520
|
-
children:
|
|
521
|
-
}) :
|
|
522
|
-
...
|
|
523
|
-
children:
|
|
519
|
+
return c === void 0 ? /* @__PURE__ */ C("div", {
|
|
520
|
+
...R,
|
|
521
|
+
ref: y,
|
|
522
|
+
children: B
|
|
523
|
+
}) : c({
|
|
524
|
+
...R,
|
|
525
|
+
children: B
|
|
524
526
|
});
|
|
525
527
|
}
|
|
526
|
-
function
|
|
528
|
+
function me() {
|
|
527
529
|
let e = z(), [t, n] = x(null), { restore: r } = e;
|
|
528
530
|
return g(() => {
|
|
529
531
|
let e = t?.form;
|
|
@@ -562,7 +564,7 @@ function he() {
|
|
|
562
564
|
}, t))]
|
|
563
565
|
});
|
|
564
566
|
}
|
|
565
|
-
function
|
|
567
|
+
function he({ children: e, placeholder: t, ...n }) {
|
|
566
568
|
let r = z(), i = r.selection.map((e) => r.labelFor(e)), a = i.filter((e) => e !== void 0), o = r.selection.length > 0 && a.length < r.selection.length, s = (() => {
|
|
567
569
|
if (e !== void 0) return e(r.selection, a);
|
|
568
570
|
if (r.selection.length === 0) return t;
|
|
@@ -580,9 +582,9 @@ function ge({ children: e, placeholder: t, ...n }) {
|
|
|
580
582
|
children: s
|
|
581
583
|
});
|
|
582
584
|
}
|
|
583
|
-
function
|
|
585
|
+
function ge({ icon: e, ref: t, render: i, ...a }) {
|
|
584
586
|
let o = z(), s = (e, t) => {
|
|
585
|
-
let n =
|
|
587
|
+
let n = G(o.contentNode, o.highlighted, e, o.loop);
|
|
586
588
|
n !== null && o.setHighlighted(n, "keyboard", t);
|
|
587
589
|
}, c = (e, t) => {
|
|
588
590
|
if (o.highlighted !== null && o.toggle(o.highlighted, "keyboard", e), t) {
|
|
@@ -612,7 +614,7 @@ function _e({ icon: e, ref: t, render: i, ...a }) {
|
|
|
612
614
|
e.preventDefault(), o.query !== "" && o.setQuery("", "clear", e.nativeEvent);
|
|
613
615
|
return;
|
|
614
616
|
case "Tab":
|
|
615
|
-
e.preventDefault(), c(e.nativeEvent, !0),
|
|
617
|
+
e.preventDefault(), c(e.nativeEvent, !0), q(o.triggerNode, e.currentTarget.closest("[data-part='positioner']"), e.shiftKey);
|
|
616
618
|
return;
|
|
617
619
|
}
|
|
618
620
|
}, f = {
|
|
@@ -632,11 +634,11 @@ function _e({ icon: e, ref: t, render: i, ...a }) {
|
|
|
632
634
|
"aria-label": a["aria-label"] ?? o.t("search"),
|
|
633
635
|
autoComplete: "off",
|
|
634
636
|
id: a.id ?? o.searchId,
|
|
635
|
-
onChange:
|
|
636
|
-
onKeyDown:
|
|
637
|
+
onChange: K(a.onChange, (e) => o.setQuery(e.target.value, "keyboard", e.nativeEvent)),
|
|
638
|
+
onKeyDown: K(a.onKeyDown, d),
|
|
637
639
|
placeholder: a.placeholder ?? o.t("searchPlaceholder"),
|
|
638
640
|
ref: (e) => {
|
|
639
|
-
o.setSearchNode(e),
|
|
641
|
+
o.setSearchNode(e), pe(e, t);
|
|
640
642
|
},
|
|
641
643
|
role: "combobox",
|
|
642
644
|
spellCheck: !1,
|
|
@@ -651,49 +653,49 @@ function _e({ icon: e, ref: t, render: i, ...a }) {
|
|
|
651
653
|
children: p
|
|
652
654
|
});
|
|
653
655
|
}
|
|
654
|
-
function
|
|
655
|
-
let s = z(), [l, d] = x(null), [f, p] = x(null), [h, _] = x(null), [ee, y] = x("unmounted"), [
|
|
656
|
-
|
|
657
|
-
let e =
|
|
658
|
-
present:
|
|
656
|
+
function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status: a, ...o }) {
|
|
657
|
+
let s = z(), [l, d] = x(null), [f, p] = x(null), [h, _] = x(null), [ee, y] = x("unmounted"), [E, D] = x(!1), [A, ne] = x(0), M = b(null), N = b(s);
|
|
658
|
+
N.current = s, g(() => {
|
|
659
|
+
let e = T({
|
|
660
|
+
present: N.current.open,
|
|
659
661
|
onStatusChange: y
|
|
660
662
|
});
|
|
661
|
-
return
|
|
662
|
-
e.destroy(),
|
|
663
|
+
return M.current = e, y(e.status), () => {
|
|
664
|
+
e.destroy(), M.current = null;
|
|
663
665
|
};
|
|
664
|
-
}, []), g(() =>
|
|
665
|
-
let
|
|
666
|
+
}, []), g(() => M.current?.sync(s.open), [s.open]), g(() => M.current?.setNode(l), [l]), g(() => s.setContentNode(f), [s, f]);
|
|
667
|
+
let P = s.mount === "eager" || s.mount === "lazy" && s.seen || s.open || ee !== "unmounted";
|
|
666
668
|
g(() => {
|
|
667
669
|
let e = s.triggerNode;
|
|
668
|
-
if (e === null ||
|
|
670
|
+
if (e === null || E) return;
|
|
669
671
|
let t = () => D(!0);
|
|
670
672
|
return e.addEventListener("focusin", t), e.addEventListener("pointerdown", t), () => {
|
|
671
673
|
e.removeEventListener("focusin", t), e.removeEventListener("pointerdown", t);
|
|
672
674
|
};
|
|
673
|
-
}, [s.triggerNode,
|
|
674
|
-
let
|
|
675
|
+
}, [s.triggerNode, E]);
|
|
676
|
+
let re = P || E;
|
|
675
677
|
v(() => {
|
|
676
|
-
if (!
|
|
678
|
+
if (!re) {
|
|
677
679
|
_(null);
|
|
678
680
|
return;
|
|
679
681
|
}
|
|
680
|
-
let e =
|
|
682
|
+
let e = te({
|
|
681
683
|
origin: s.triggerNode,
|
|
682
684
|
disabled: !s.portal
|
|
683
685
|
});
|
|
684
686
|
return _(e.container), () => e.release();
|
|
685
687
|
}, [
|
|
686
|
-
|
|
688
|
+
re,
|
|
687
689
|
s.portal,
|
|
688
690
|
s.triggerNode
|
|
689
691
|
]);
|
|
690
|
-
let { align: F, alignOffset: I, collisionPadding: L, flip: R, hideWhenDetached: ie, shift:
|
|
692
|
+
let { align: F, alignOffset: I, collisionPadding: L, flip: R, hideWhenDetached: ie, shift: B, side: ae, sideOffset: oe, strategy: se, width: ce } = s, V = b(null), U = b(0), W = m((e, t) => {
|
|
691
693
|
e.update().then(() => {
|
|
692
|
-
if (
|
|
694
|
+
if (V.current !== e || !N.current.open) return;
|
|
693
695
|
t.setAttribute("data-open", "");
|
|
694
696
|
let n = t.ownerDocument.defaultView;
|
|
695
|
-
n !== null &&
|
|
696
|
-
|
|
697
|
+
n !== null && U.current === 0 && (U.current = n.requestAnimationFrame(() => {
|
|
698
|
+
U.current = 0, fe(N.current.contentNode, N.current.highlighted);
|
|
697
699
|
}));
|
|
698
700
|
});
|
|
699
701
|
}, []);
|
|
@@ -705,14 +707,14 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
705
707
|
boundaryPadding: L,
|
|
706
708
|
flip: R,
|
|
707
709
|
hideWhenDetached: ie,
|
|
708
|
-
matchWidth:
|
|
709
|
-
shift:
|
|
710
|
-
side:
|
|
711
|
-
sideOffset:
|
|
712
|
-
strategy:
|
|
710
|
+
matchWidth: ce === "anchor",
|
|
711
|
+
shift: B,
|
|
712
|
+
side: ae,
|
|
713
|
+
sideOffset: oe,
|
|
714
|
+
strategy: se
|
|
713
715
|
});
|
|
714
|
-
return
|
|
715
|
-
t.destroy(),
|
|
716
|
+
return V.current = t, N.current.open && W(t, l), () => {
|
|
717
|
+
t.destroy(), V.current = null, l.removeAttribute("data-open");
|
|
716
718
|
};
|
|
717
719
|
}, [
|
|
718
720
|
F,
|
|
@@ -722,24 +724,24 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
722
724
|
ie,
|
|
723
725
|
l,
|
|
724
726
|
s.triggerNode,
|
|
727
|
+
B,
|
|
725
728
|
ae,
|
|
726
729
|
oe,
|
|
727
730
|
se,
|
|
728
731
|
ce,
|
|
729
|
-
|
|
730
|
-
U
|
|
732
|
+
W
|
|
731
733
|
]), v(() => {
|
|
732
|
-
let e =
|
|
734
|
+
let e = V.current;
|
|
733
735
|
if (e !== null && l !== null) {
|
|
734
736
|
if (s.open) {
|
|
735
|
-
|
|
737
|
+
W(e, l);
|
|
736
738
|
return;
|
|
737
739
|
}
|
|
738
|
-
l.removeAttribute("data-open"),
|
|
740
|
+
l.removeAttribute("data-open"), U.current !== 0 && (l.ownerDocument.defaultView?.cancelAnimationFrame(U.current), U.current = 0);
|
|
739
741
|
}
|
|
740
742
|
}, [
|
|
741
743
|
l,
|
|
742
|
-
|
|
744
|
+
W,
|
|
743
745
|
s.open
|
|
744
746
|
]), g(() => {
|
|
745
747
|
if (l === null || !s.open) return;
|
|
@@ -751,7 +753,7 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
751
753
|
outsidePress: s.closeOnOutsidePress,
|
|
752
754
|
scrollLock: !1,
|
|
753
755
|
onDismiss: (e) => {
|
|
754
|
-
let t =
|
|
756
|
+
let t = N.current;
|
|
755
757
|
if (e.reason === "escape" && t.search && t.query !== "") {
|
|
756
758
|
t.setQuery("", "clear", e.source);
|
|
757
759
|
return;
|
|
@@ -767,31 +769,31 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
767
769
|
s.open,
|
|
768
770
|
s.triggerNode
|
|
769
771
|
]), v(() => {
|
|
770
|
-
let e =
|
|
772
|
+
let e = N.current;
|
|
771
773
|
if (!e.open || f === null || e.entry.current === "none") return;
|
|
772
|
-
let t =
|
|
774
|
+
let t = de(f, e.selection, e.entry.current, e.loop);
|
|
773
775
|
t !== null && e.setHighlighted(t, "keyboard");
|
|
774
776
|
}, [s.open, f]), v(() => {
|
|
775
|
-
let e =
|
|
777
|
+
let e = H(f).length;
|
|
776
778
|
ne((t) => t === e ? t : e);
|
|
777
779
|
}), g(() => {
|
|
778
|
-
l?.hasAttribute("data-open") === !0 &&
|
|
780
|
+
l?.hasAttribute("data-open") === !0 && fe(f, s.highlighted);
|
|
779
781
|
}, [
|
|
780
782
|
l,
|
|
781
783
|
s.highlighted,
|
|
782
784
|
f
|
|
783
785
|
]);
|
|
784
|
-
let
|
|
786
|
+
let le = s.searchNode;
|
|
785
787
|
g(() => {
|
|
786
|
-
s.open && s.search &&
|
|
788
|
+
s.open && s.search && le !== null && le.focus({ preventScroll: !0 });
|
|
787
789
|
}, [
|
|
788
|
-
|
|
790
|
+
le,
|
|
789
791
|
s.open,
|
|
790
792
|
s.search
|
|
791
793
|
]);
|
|
792
|
-
let
|
|
794
|
+
let ue = b(s.query);
|
|
793
795
|
g(() => {
|
|
794
|
-
s.open && s.search && f !== null &&
|
|
796
|
+
s.open && s.search && f !== null && ue.current !== s.query && (ue.current = s.query, N.current.setHighlighted(G(f, null, "first", !1), "keyboard"));
|
|
795
797
|
}, [
|
|
796
798
|
A,
|
|
797
799
|
s.open,
|
|
@@ -799,27 +801,27 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
799
801
|
s.search,
|
|
800
802
|
f
|
|
801
803
|
]);
|
|
802
|
-
let
|
|
804
|
+
let K = s.selection.filter((e) => s.labelFor(e) === void 0), q = K.length === 0 ? null : JSON.stringify(K), [J, me] = x(null), he = b(null);
|
|
803
805
|
if (g(() => {
|
|
804
|
-
if (
|
|
805
|
-
|
|
806
|
+
if (J !== null) {
|
|
807
|
+
me(null);
|
|
806
808
|
return;
|
|
807
809
|
}
|
|
808
|
-
|
|
810
|
+
P || q === null || he.current === q || (he.current = q, me((s.triggerNode?.ownerDocument ?? document).createDocumentFragment()));
|
|
809
811
|
}, [
|
|
810
|
-
|
|
811
|
-
|
|
812
|
+
J,
|
|
813
|
+
P,
|
|
812
814
|
s.triggerNode,
|
|
813
|
-
|
|
814
|
-
]), !
|
|
815
|
-
let
|
|
815
|
+
q
|
|
816
|
+
]), !P) return J === null ? null : j(e, J);
|
|
817
|
+
let _e = c({
|
|
816
818
|
"data-align": F,
|
|
817
819
|
...s.open ? {} : { inert: !0 },
|
|
818
820
|
"data-part": "positioner",
|
|
819
821
|
"data-size": s.size,
|
|
820
822
|
"data-ui": "select",
|
|
821
823
|
"data-width": s.width
|
|
822
|
-
}),
|
|
824
|
+
}), ve = a === void 0 ? s.loading ? s.t("loading") : !s.search || A === 0 ? null : s.t("count", { count: A }) : a, ye = s.multiple && s.selection.length > 0 ? /* @__PURE__ */ C("div", {
|
|
823
825
|
"aria-hidden": "true",
|
|
824
826
|
"data-part": "chosen",
|
|
825
827
|
"data-part-chosen": "",
|
|
@@ -840,8 +842,8 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
840
842
|
})
|
|
841
843
|
})
|
|
842
844
|
}, String(e)))
|
|
843
|
-
}) : null,
|
|
844
|
-
|
|
845
|
+
}) : null, be = /* @__PURE__ */ w(S, { children: [
|
|
846
|
+
ye,
|
|
845
847
|
e,
|
|
846
848
|
s.loading ? /* @__PURE__ */ C("div", {
|
|
847
849
|
"aria-hidden": "true",
|
|
@@ -871,42 +873,42 @@ function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
871
873
|
"data-part-status": "",
|
|
872
874
|
...s.loading ? { "data-loading": "" } : {},
|
|
873
875
|
role: "status",
|
|
874
|
-
children:
|
|
876
|
+
children: ve
|
|
875
877
|
}) : null
|
|
876
|
-
] }),
|
|
878
|
+
] }), Y = {
|
|
877
879
|
"aria-busy": s.loading ? !0 : void 0,
|
|
878
880
|
"aria-multiselectable": s.multiple ? !0 : void 0
|
|
879
|
-
},
|
|
880
|
-
...
|
|
881
|
+
}, X = /* @__PURE__ */ C("div", {
|
|
882
|
+
..._e,
|
|
881
883
|
ref: (e) => {
|
|
882
|
-
d(e),
|
|
884
|
+
d(e), pe(e, n);
|
|
883
885
|
},
|
|
884
886
|
children: /* @__PURE__ */ C("div", {
|
|
885
887
|
...o,
|
|
886
|
-
...u(s.search ? {} :
|
|
888
|
+
...u(s.search ? {} : Y, "part", "content"),
|
|
887
889
|
"aria-labelledby": o["aria-label"] === void 0 ? s.triggerId : void 0,
|
|
888
890
|
"data-loading": s.loading ? "" : void 0,
|
|
889
891
|
...s.search ? { "data-search": "" } : {},
|
|
890
892
|
id: s.contentId,
|
|
891
893
|
ref: p,
|
|
892
894
|
role: s.search ? "dialog" : "listbox",
|
|
893
|
-
children: s.search ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(
|
|
894
|
-
...u(
|
|
895
|
+
children: s.search ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(ge, { ...i }), /* @__PURE__ */ C("div", {
|
|
896
|
+
...u(Y, "part", "list"),
|
|
895
897
|
"aria-labelledby": s.triggerId,
|
|
896
898
|
id: s.listId,
|
|
897
899
|
role: "listbox",
|
|
898
|
-
children:
|
|
899
|
-
})] }) :
|
|
900
|
+
children: be
|
|
901
|
+
})] }) : be
|
|
900
902
|
})
|
|
901
|
-
}),
|
|
902
|
-
...
|
|
903
|
+
}), xe = r === void 0 ? X : r({
|
|
904
|
+
..._e,
|
|
903
905
|
children: e
|
|
904
906
|
});
|
|
905
|
-
return h === null ?
|
|
907
|
+
return h === null ? xe : j(xe, h);
|
|
906
908
|
}
|
|
907
909
|
//#endregion
|
|
908
910
|
//#region src/select/select-items.tsx
|
|
909
|
-
function
|
|
911
|
+
function ve({ children: e, description: t, disabled: i = !1, icon: a, position: o, ref: c, textValue: l, value: d, ...f }) {
|
|
910
912
|
let p = z(), m = b(null), h = b(null);
|
|
911
913
|
g(() => {
|
|
912
914
|
if (m.current === null) return;
|
|
@@ -920,7 +922,7 @@ function ye({ children: e, description: t, disabled: i = !1, icon: a, position:
|
|
|
920
922
|
]);
|
|
921
923
|
let _ = l ?? (typeof e == "string" ? e : void 0), ee = y(() => {
|
|
922
924
|
if (!p.search || !p.highlightMatch || p.query === "" || _ === void 0) return e;
|
|
923
|
-
let t =
|
|
925
|
+
let t = re(_, p.query, { locale: p.locale });
|
|
924
926
|
return t.length === 0 ? e : /* @__PURE__ */ C(s, {
|
|
925
927
|
ranges: t,
|
|
926
928
|
text: _
|
|
@@ -936,9 +938,9 @@ function ye({ children: e, description: t, disabled: i = !1, icon: a, position:
|
|
|
936
938
|
if (_ !== void 0 && !p.matches(_)) return null;
|
|
937
939
|
let v = p.selection.includes(d), x = p.highlighted === d, S = (e) => {
|
|
938
940
|
i || p.setHighlighted(d, "pointer", e.nativeEvent);
|
|
939
|
-
}, te = (e) => {
|
|
940
|
-
f.onPointerDown?.(e), !e.defaultPrevented && e.preventDefault();
|
|
941
941
|
}, T = (e) => {
|
|
942
|
+
f.onPointerDown?.(e), !e.defaultPrevented && e.preventDefault();
|
|
943
|
+
}, E = (e) => {
|
|
942
944
|
if (!i) {
|
|
943
945
|
if (p.toggle(d, "pointer", e.nativeEvent), p.closeOnSelect && !p.multiple) {
|
|
944
946
|
p.setOpen(!1, "select", e.nativeEvent);
|
|
@@ -959,8 +961,8 @@ function ye({ children: e, description: t, disabled: i = !1, icon: a, position:
|
|
|
959
961
|
...i ? { "data-disabled": "" } : {},
|
|
960
962
|
...v ? { "data-selected": "" } : {},
|
|
961
963
|
...x ? { "data-current": "" } : {},
|
|
962
|
-
onClick:
|
|
963
|
-
onPointerDown:
|
|
964
|
+
onClick: E,
|
|
965
|
+
onPointerDown: T,
|
|
964
966
|
onPointerEnter: S,
|
|
965
967
|
ref: (e) => {
|
|
966
968
|
m.current = e, typeof c == "function" ? c(e) : c != null && (c.current = e);
|
|
@@ -990,7 +992,7 @@ function ye({ children: e, description: t, disabled: i = !1, icon: a, position:
|
|
|
990
992
|
]
|
|
991
993
|
});
|
|
992
994
|
}
|
|
993
|
-
function
|
|
995
|
+
function ye({ children: e, label: t, ...n }) {
|
|
994
996
|
let r = `${_()}group`, { query: i } = z(), [a, o] = x(null), [s, c] = x(!1);
|
|
995
997
|
return g(() => {
|
|
996
998
|
a !== null && c(a.querySelector("[data-part='item']") === null);
|
|
@@ -1008,7 +1010,7 @@ function be({ children: e, label: t, ...n }) {
|
|
|
1008
1010
|
}), e]
|
|
1009
1011
|
});
|
|
1010
1012
|
}
|
|
1011
|
-
function
|
|
1013
|
+
function be(e) {
|
|
1012
1014
|
return /* @__PURE__ */ C("div", {
|
|
1013
1015
|
"data-part": "separator",
|
|
1014
1016
|
"data-part-separator": "",
|
|
@@ -1017,4 +1019,4 @@ function xe(e) {
|
|
|
1017
1019
|
});
|
|
1018
1020
|
}
|
|
1019
1021
|
//#endregion
|
|
1020
|
-
export {
|
|
1022
|
+
export { ge as a, ce as c, R as d, L as f, _e as i, z as l, ve as n, J as o, be as r, he as s, ye as t, F as u };
|