@slotted/react 0.1.0-beta.26 → 0.1.0-beta.27
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/{action-bar-DckD0Sug.js → action-bar-CAtXzym2.js} +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/{cascader-47GYpojH.js → cascader-CwwtJs3W.js} +189 -189
- package/dist/cascader.js +1 -1
- package/dist/{color-picker-BbyW5ALf.js → color-picker-2i3A60vD.js} +1 -1
- package/dist/color-picker.js +1 -1
- package/dist/{column-manager-Bz0bb4mq.js → column-manager-D4HIwXPi.js} +1 -1
- package/dist/column-manager.js +1 -1
- package/dist/{combobox-BA2nvbnA.js → combobox-BpZ8i-61.js} +86 -86
- package/dist/combobox.js +1 -1
- package/dist/{command-palette-DEKWsUFR.js → command-palette-BxbhO044.js} +11 -11
- package/dist/command-palette.js +1 -1
- package/dist/{context-menu-CfEEqDKr.js → context-menu-BJyDD17g.js} +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/{dashboard-grid-WinSY-q3.js → dashboard-grid-De6al1Mj.js} +1 -1
- package/dist/dashboard-grid.js +1 -1
- package/dist/{data-grid-BWWvixwB.js → data-grid-CuHnCT01.js} +33 -33
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-iw9K_oiz.js → data-list-CuzWmmGp.js} +5 -5
- package/dist/data-list.js +1 -1
- package/dist/docs/chart.json +2 -0
- package/dist/docs/chart.md +1 -1
- package/dist/docs/combobox.json +1 -0
- package/dist/docs/combobox.md +1 -1
- package/dist/docs/dialog.json +23 -4
- package/dist/docs/dialog.md +2 -60
- package/dist/docs/dialog.props.md +68 -0
- package/dist/docs/drawer.json +2 -0
- package/dist/docs/drawer.md +1 -1
- package/dist/docs/menu.json +1 -0
- package/dist/docs/menu.md +1 -1
- package/dist/docs/multi-select.json +1 -0
- package/dist/docs/multi-select.md +1 -1
- package/dist/docs/select.json +1 -0
- package/dist/docs/select.md +1 -1
- package/dist/docs/skills/theme-app/SKILL.md +4 -1
- package/dist/{entity-picker-WkBLvR2T.js → entity-picker-BYAlDJL-.js} +25 -25
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-BaPllnNk.js → event-calendar-BuZg4ghj.js} +2 -2
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-DRQEl4-J.js → filter-bar-DeBYLpbg.js} +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-C1t2tkzg.js → import-export-center-CTliNoT9.js} +1 -1
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +26 -26
- package/dist/{listbox-B9cBuitS.js → listbox-BSx90S2g.js} +10 -10
- package/dist/listbox.js +1 -1
- package/dist/{menu-parts-7F8syoFE.js → menu-parts-DNQDoJnd.js} +203 -204
- package/dist/menu.js +1 -1
- package/dist/{menubar-DzVGFn_I.js → menubar-CY8oxV0V.js} +1 -1
- package/dist/menubar.js +1 -1
- package/dist/{multi-select-DnOAXeuF.js → multi-select-Dh2gOp42.js} +68 -68
- package/dist/multi-select.js +1 -1
- package/dist/{saved-views-CsVRZTwK.js → saved-views-BKhAqvhI.js} +1 -1
- package/dist/saved-views.js +1 -1
- package/dist/{select-De77allF.js → select-BcTau8q3.js} +263 -263
- package/dist/select.js +1 -1
- package/dist/{split-button-DA1wcDJB.js → split-button-CgfY606Z.js} +1 -1
- package/dist/split-button.js +1 -1
- package/dist/styles/action-bar.css +1 -1
- package/dist/styles/action-sheet.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/cascader.css +1 -1
- package/dist/styles/chart.css +1 -1
- package/dist/styles/checkbox-group.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/color-picker.css +3 -3
- package/dist/styles/column-manager.css +4 -4
- package/dist/styles/combobox.css +2 -2
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/context-menu.css +1 -1
- package/dist/styles/currency-field.css +1 -1
- package/dist/styles/dashboard-grid.css +2 -2
- package/dist/styles/data-grid.css +5 -5
- package/dist/styles/data-list.css +2 -2
- package/dist/styles/date-field.css +1 -1
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/datetime-field.css +1 -1
- package/dist/styles/datetime-picker.css +1 -1
- package/dist/styles/datetime-range-picker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/entity-picker.css +2 -2
- package/dist/styles/event-calendar.css +4 -4
- package/dist/styles/field-group.css +1 -1
- package/dist/styles/field.css +1 -1
- package/dist/styles/filter-bar.css +6 -6
- package/dist/styles/hover-card.css +1 -1
- package/dist/styles/import-export-center.css +3 -3
- package/dist/styles/index.css +10 -10
- package/dist/styles/listbox.css +1 -1
- package/dist/styles/markdown.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -1
- package/dist/styles/multi-select.css +2 -2
- package/dist/styles/notification-center.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-input.css +1 -1
- package/dist/styles/popover.css +1 -1
- package/dist/styles/prompt-composer.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/saved-views.css +3 -3
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/select.css +2 -2
- package/dist/styles/side-navigation.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +3 -3
- package/dist/styles/tags-input.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/textarea.css +1 -1
- package/dist/styles/time-field.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/time-range-picker.css +1 -1
- package/dist/styles/toggle-group.css +1 -1
- package/dist/styles/toolbar.css +1 -1
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/top-navigation.css +1 -1
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/upload.css +2 -2
- package/dist/styles.css +1 -1
- package/dist/{table-C3cjkzps.js → table-Dx-RQ64i.js} +208 -208
- package/dist/table.js +1 -1
- package/dist/{tags-input-DEhtpizX.js → tags-input-hZs5oaT1.js} +9 -9
- package/dist/tags-input.js +1 -1
- package/dist/{toolbar-CtSZ88HI.js → toolbar-CSiDqC8L.js} +1 -1
- package/dist/toolbar.js +1 -1
- package/dist/{transfer-BMRyopEw.js → transfer-DHjPhRlH.js} +5 -5
- package/dist/transfer.js +1 -1
- package/dist/{tree-DBirM2v9.js → tree-D-y-0TrL.js} +14 -14
- package/dist/tree.js +1 -1
- package/dist/types/menu/menu-parts.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -12,14 +12,14 @@ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
|
12
12
|
import { createPresence as T } from "@slotted/core/presence";
|
|
13
13
|
import { selectMessages as E } from "@slotted/core/i18n";
|
|
14
14
|
import { createPortalRoot as te, setPortalContainer as D } from "@slotted/core/portal";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { matchRanges as
|
|
15
|
+
import { createFilter as O, moveIndex as k, revealWithin as A } from "@slotted/core/collection";
|
|
16
|
+
import { createDismissableLayer as j } from "@slotted/core/dismissable-layer";
|
|
17
|
+
import { createPositioner as ne } from "@slotted/core/positioner";
|
|
18
|
+
import { createTypeahead as M, isPrintable as N } from "@slotted/core/typeahead";
|
|
19
|
+
import { createPortal as re } from "react-dom";
|
|
20
|
+
import { matchRanges as ie } from "@slotted/core/highlight";
|
|
21
21
|
//#region src/select/select-defaults.tsx
|
|
22
|
-
var
|
|
22
|
+
var P = {
|
|
23
23
|
align: "start",
|
|
24
24
|
alignOffset: 0,
|
|
25
25
|
clearable: !1,
|
|
@@ -50,12 +50,12 @@ var F = {
|
|
|
50
50
|
typeaheadTimeout: 500,
|
|
51
51
|
variant: "outline",
|
|
52
52
|
width: "content"
|
|
53
|
-
},
|
|
54
|
-
function
|
|
55
|
-
return h(
|
|
53
|
+
}, F = p(P);
|
|
54
|
+
function I() {
|
|
55
|
+
return h(F);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
let r =
|
|
57
|
+
function L({ children: e, container: t, ...n }) {
|
|
58
|
+
let r = I();
|
|
59
59
|
g(() => {
|
|
60
60
|
if (t !== void 0) return D(t), () => D(null);
|
|
61
61
|
}, [t]);
|
|
@@ -91,59 +91,59 @@ function R({ children: e, container: t, ...n }) {
|
|
|
91
91
|
variant: n.variant ?? r.variant,
|
|
92
92
|
width: n.width ?? r.width
|
|
93
93
|
};
|
|
94
|
-
return /* @__PURE__ */ C(
|
|
94
|
+
return /* @__PURE__ */ C(F.Provider, {
|
|
95
95
|
value: i,
|
|
96
96
|
children: e
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
100
|
//#region src/select/select.tsx
|
|
101
|
-
var
|
|
102
|
-
function
|
|
103
|
-
let e = h(
|
|
101
|
+
var ae = p(void 0);
|
|
102
|
+
function R() {
|
|
103
|
+
let e = h(ae);
|
|
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 z(e) {
|
|
108
108
|
return e == null ? [] : typeof e == "string" ? [e] : e;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function oe(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 se = (e) => "options" in e;
|
|
114
|
+
function ce(e) {
|
|
115
|
+
return e === void 0 ? [] : e.flatMap((e) => se(e) ? e.options : [e]);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
let
|
|
119
|
-
|
|
117
|
+
function le({ 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: k, highlightMatch: j, invalid: ne, items: M, loading: N, locale: re, loop: ie, messages: P, mount: F, multiple: L, name: R, onHighlightedValueChange: se, onOpenChange: le, onSearchValueChange: B, onValueChange: V, open: H, portal: U, readOnly: ue, ref: de, required: W, search: fe, searchValue: pe, shift: G, side: K, sideOffset: me, size: q, strategy: he, total: ge, typeahead: _e, typeaheadTimeout: ve, value: ye, variant: be, width: xe }) {
|
|
118
|
+
let J = I(), Y = a(), Se = t(E, P), Ce = e(), we = re ?? Ce, X = _(), Te = `${X}listbox`, Ee = `${X}list`, De = `${X}search`, Oe = Y?.ids.control ?? `${X}trigger`, [ke, Ae] = x(p), [je] = x(() => z(g)), [Me, Ne] = x(je), [Pe, Fe] = x(d), [Ie, Le] = x(h), [Re, ze] = x(null), [Be, Ve] = x(null), [He, Ue] = x(null), We = L ?? J.multiple, Ge = v ?? Y?.disabled ?? J.disabled, Ke = ue ?? Y?.readOnly ?? J.readOnly, qe = (H ?? ke) && !Ge, Je = ye === void 0 ? Me : z(ye), Ye = k === void 0 ? Pe : k, Xe = fe ?? J.search, Z = Xe ? pe === void 0 ? Ie : pe : "", Ze = b(qe);
|
|
119
|
+
qe && (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 ce(M)) e.set(t.value, t.label);
|
|
123
123
|
return e;
|
|
124
|
-
}, [
|
|
124
|
+
}, [M]), 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(() => O({ locale: we }), [we]), ot = m((e) => Z === "" || S === null ? !0 : S === void 0 ? at.contains(e, Z) : S(e, Z), [
|
|
127
|
+
Z,
|
|
128
128
|
at,
|
|
129
129
|
S
|
|
130
|
-
]), st = m((e) => `${
|
|
131
|
-
currentHighlighted:
|
|
132
|
-
currentOpen:
|
|
133
|
-
currentQuery:
|
|
134
|
-
currentSelection:
|
|
135
|
-
highlightedValue:
|
|
136
|
-
onHighlightedValueChange:
|
|
137
|
-
onOpenChange:
|
|
138
|
-
onSearchValueChange:
|
|
139
|
-
onValueChange:
|
|
140
|
-
open:
|
|
141
|
-
resolvedMultiple:
|
|
142
|
-
resolvedSearch:
|
|
143
|
-
searchNode:
|
|
144
|
-
searchValue:
|
|
145
|
-
triggerNode:
|
|
146
|
-
value:
|
|
130
|
+
]), st = m((e) => `${X}option-${encodeURIComponent(e)}`, [X]), ct = {
|
|
131
|
+
currentHighlighted: Ye,
|
|
132
|
+
currentOpen: qe,
|
|
133
|
+
currentQuery: Z,
|
|
134
|
+
currentSelection: Je,
|
|
135
|
+
highlightedValue: k,
|
|
136
|
+
onHighlightedValueChange: se,
|
|
137
|
+
onOpenChange: le,
|
|
138
|
+
onSearchValueChange: B,
|
|
139
|
+
onValueChange: V,
|
|
140
|
+
open: H,
|
|
141
|
+
resolvedMultiple: We,
|
|
142
|
+
resolvedSearch: Xe,
|
|
143
|
+
searchNode: He,
|
|
144
|
+
searchValue: pe,
|
|
145
|
+
triggerNode: Re,
|
|
146
|
+
value: ye
|
|
147
147
|
}, Q = b(ct);
|
|
148
148
|
Q.current = ct;
|
|
149
149
|
let lt = m((e, t, n) => {
|
|
@@ -152,29 +152,29 @@ function ce({ 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) && Le(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) && (Ae(e), e || (Fe(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) && Fe(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: oe(r.currentSelection, r.resolvedMultiple),
|
|
175
175
|
equals: () => !1,
|
|
176
176
|
onRequest: (e) => r.onValueChange?.(e.value, e)
|
|
177
|
-
}).request(
|
|
177
|
+
}).request(oe(e, r.resolvedMultiple), t, n) && Ne(e);
|
|
178
178
|
}, []), ft = m((e, t, n) => {
|
|
179
179
|
let r = Q.current;
|
|
180
180
|
if (!r.resolvedMultiple) {
|
|
@@ -183,8 +183,8 @@ function ce({ 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) => $(je, "programmatic", e), [$, je]);
|
|
187
|
+
ee(de, () => ({
|
|
188
188
|
close: () => ut(!1, "programmatic"),
|
|
189
189
|
focus: () => Q.current.triggerNode?.focus({ preventScroll: !0 }),
|
|
190
190
|
focusSearch: () => {
|
|
@@ -193,133 +193,133 @@ function ce({ 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 = Be?.querySelector(`[data-part='item'][data-value="${CSS.escape(e)}"]`);
|
|
197
|
+
t != null && Be !== null && A(t, Be);
|
|
198
198
|
}
|
|
199
|
-
}), [
|
|
199
|
+
}), [Be, ut]);
|
|
200
200
|
let ht = {
|
|
201
|
-
align: n ??
|
|
202
|
-
alignOffset: r ??
|
|
201
|
+
align: n ?? J.align,
|
|
202
|
+
alignOffset: r ?? J.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 ?? J.clearable,
|
|
205
|
+
closeOnEscape: s ?? J.closeOnEscape,
|
|
206
|
+
closeOnOutsidePress: c ?? J.closeOnOutsidePress,
|
|
207
|
+
closeOnSelect: l ?? J.closeOnSelect,
|
|
208
|
+
collisionPadding: u ?? J.collisionPadding,
|
|
209
|
+
contentId: Te,
|
|
210
|
+
contentNode: Be,
|
|
211
|
+
disabled: Ge,
|
|
212
212
|
entry: Qe,
|
|
213
|
-
flip: w ??
|
|
213
|
+
flip: w ?? J.flip,
|
|
214
214
|
form: T,
|
|
215
|
-
fullWidth: te ??
|
|
216
|
-
hideWhenDetached: D ??
|
|
217
|
-
highlighted:
|
|
218
|
-
highlightMatch:
|
|
219
|
-
invalid:
|
|
215
|
+
fullWidth: te ?? J.fullWidth,
|
|
216
|
+
hideWhenDetached: D ?? J.hideWhenDetached,
|
|
217
|
+
highlighted: Ye,
|
|
218
|
+
highlightMatch: j ?? J.highlightMatch,
|
|
219
|
+
invalid: ne ?? Y?.invalid ?? J.invalid,
|
|
220
220
|
labelFor: it,
|
|
221
|
-
listId:
|
|
222
|
-
loading:
|
|
223
|
-
locale:
|
|
224
|
-
loop:
|
|
221
|
+
listId: Ee,
|
|
222
|
+
loading: N ?? J.loading,
|
|
223
|
+
locale: we,
|
|
224
|
+
loop: ie ?? J.loop,
|
|
225
225
|
matches: ot,
|
|
226
|
-
mount:
|
|
227
|
-
multiple:
|
|
228
|
-
name:
|
|
229
|
-
open:
|
|
226
|
+
mount: F ?? J.mount,
|
|
227
|
+
multiple: We,
|
|
228
|
+
name: R,
|
|
229
|
+
open: qe,
|
|
230
230
|
optionId: st,
|
|
231
|
-
portal:
|
|
232
|
-
query:
|
|
233
|
-
readOnly:
|
|
231
|
+
portal: U ?? J.portal,
|
|
232
|
+
query: Z,
|
|
233
|
+
readOnly: Ke,
|
|
234
234
|
registerLabel: rt,
|
|
235
|
-
required:
|
|
235
|
+
required: W ?? Y?.required ?? J.required,
|
|
236
236
|
restore: mt,
|
|
237
|
-
search:
|
|
238
|
-
searchId:
|
|
239
|
-
searchNode:
|
|
237
|
+
search: Xe,
|
|
238
|
+
searchId: De,
|
|
239
|
+
searchNode: He,
|
|
240
240
|
seen: Ze.current,
|
|
241
|
-
selection:
|
|
242
|
-
setContentNode:
|
|
241
|
+
selection: Je,
|
|
242
|
+
setContentNode: Ve,
|
|
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: Ue,
|
|
247
|
+
setTriggerNode: ze,
|
|
248
|
+
shift: G ?? J.shift,
|
|
249
|
+
side: K ?? J.side,
|
|
250
|
+
sideOffset: me ?? J.sideOffset,
|
|
251
|
+
size: q ?? Y?.size ?? J.size,
|
|
252
|
+
strategy: he ?? J.strategy,
|
|
253
|
+
t: Se,
|
|
254
254
|
toggle: ft,
|
|
255
|
-
total:
|
|
256
|
-
triggerId:
|
|
257
|
-
triggerNode:
|
|
258
|
-
typeahead:
|
|
259
|
-
typeaheadTimeout:
|
|
260
|
-
variant:
|
|
261
|
-
width:
|
|
255
|
+
total: ge,
|
|
256
|
+
triggerId: Oe,
|
|
257
|
+
triggerNode: Re,
|
|
258
|
+
typeahead: Xe ? !1 : _e ?? J.typeahead,
|
|
259
|
+
typeaheadTimeout: ve ?? J.typeaheadTimeout,
|
|
260
|
+
variant: be ?? J.variant,
|
|
261
|
+
width: xe ?? J.width
|
|
262
262
|
};
|
|
263
|
-
return /* @__PURE__ */ C(
|
|
263
|
+
return /* @__PURE__ */ C(ae.Provider, {
|
|
264
264
|
value: ht,
|
|
265
265
|
children: i
|
|
266
266
|
});
|
|
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 B = "[data-part='item']";
|
|
271
|
+
function V(e) {
|
|
272
|
+
return e === null ? [] : [...e.querySelectorAll(B)];
|
|
273
273
|
}
|
|
274
|
-
var
|
|
275
|
-
function
|
|
276
|
-
let t =
|
|
274
|
+
var H = (e) => e.dataset.value ?? "", U = (e) => e.dataset.disabled === void 0, ue = (e) => e.dataset.textValue ?? e.querySelector("[data-part='label']")?.textContent?.trim() ?? e.textContent?.trim() ?? "";
|
|
275
|
+
function de(e) {
|
|
276
|
+
let t = V(e).filter(U);
|
|
277
277
|
return {
|
|
278
278
|
elements: t,
|
|
279
|
-
labels: t.map(
|
|
279
|
+
labels: t.map(ue)
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
let i =
|
|
282
|
+
function W(e, t, n, r) {
|
|
283
|
+
let i = V(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 = k({
|
|
286
|
+
enabled: i.map(U),
|
|
287
|
+
from: t === null ? -1 : i.findIndex((e) => H(e) === t),
|
|
288
288
|
intent: n,
|
|
289
289
|
loop: r
|
|
290
290
|
});
|
|
291
|
-
return a === -1 ? null :
|
|
291
|
+
return a === -1 ? null : H(i[a]);
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function fe(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 = V(e).find((e) => t.includes(H(e)) && U(e));
|
|
297
|
+
return n === void 0 ? W(e, null, "first", r) : H(n);
|
|
298
298
|
}
|
|
299
|
-
return
|
|
299
|
+
return W(e, null, n, r);
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function pe(e, t) {
|
|
302
302
|
if (e === null || t === null) return;
|
|
303
|
-
let n =
|
|
304
|
-
n !== void 0 &&
|
|
303
|
+
let n = V(e).find((e) => H(e) === t);
|
|
304
|
+
n !== void 0 && A(n, e);
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/select/select-parts.tsx
|
|
308
|
-
function
|
|
308
|
+
function G(e, t) {
|
|
309
309
|
return (n) => {
|
|
310
310
|
e?.(n), n.defaultPrevented || t(n);
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function K(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 me(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 f =
|
|
321
|
+
function q({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
322
|
+
let f = R(), p = a(), h = p?.registerControl;
|
|
323
323
|
g(() => h?.(), [h]);
|
|
324
324
|
let [_, ee] = x(null), [v, y] = x(null), T = b(!1);
|
|
325
325
|
g(() => {
|
|
@@ -338,7 +338,7 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
338
338
|
f.setTriggerNode(_);
|
|
339
339
|
}, [_, f]), g(() => {
|
|
340
340
|
if (!f.typeahead) return;
|
|
341
|
-
let e =
|
|
341
|
+
let e = M({ timeout: f.typeaheadTimeout });
|
|
342
342
|
return O.current = e, () => {
|
|
343
343
|
e.destroy(), O.current = null;
|
|
344
344
|
};
|
|
@@ -346,8 +346,8 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
346
346
|
if (!f.open || f.contentNode === null) return;
|
|
347
347
|
let e = D.current;
|
|
348
348
|
if (D.current = null, e === null || O.current === null) return;
|
|
349
|
-
let { elements: t, labels: n } =
|
|
350
|
-
r !== -1 && f.setHighlighted(
|
|
349
|
+
let { elements: t, labels: n } = de(f.contentNode), r = O.current.match(e, n, -1);
|
|
350
|
+
r !== -1 && f.setHighlighted(H(t[r]), "keyboard");
|
|
351
351
|
}, [
|
|
352
352
|
f,
|
|
353
353
|
f.contentNode,
|
|
@@ -355,16 +355,16 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
355
355
|
]);
|
|
356
356
|
let k = (e, t) => {
|
|
357
357
|
f.entry.current = e, f.setOpen(!0, "keyboard", t);
|
|
358
|
-
},
|
|
359
|
-
let n =
|
|
358
|
+
}, A = (e, t) => {
|
|
359
|
+
let n = W(f.contentNode, f.highlighted, e, f.loop);
|
|
360
360
|
n !== null && f.setHighlighted(n, "keyboard", t);
|
|
361
|
-
},
|
|
361
|
+
}, j = (e, t) => {
|
|
362
362
|
if (f.highlighted === null) {
|
|
363
363
|
t && f.setOpen(!1, "select", e);
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
366
|
f.toggle(f.highlighted, "keyboard", e), t && f.setOpen(!1, "select", e);
|
|
367
|
-
},
|
|
367
|
+
}, ne = (e) => {
|
|
368
368
|
if (f.disabled || f.readOnly) return;
|
|
369
369
|
let t = e.altKey;
|
|
370
370
|
if (!f.open) {
|
|
@@ -386,7 +386,7 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
386
386
|
e.preventDefault(), k("last", e.nativeEvent);
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
|
-
if (!e.ctrlKey && !e.metaKey && !t &&
|
|
389
|
+
if (!e.ctrlKey && !e.metaKey && !t && N(e.key)) {
|
|
390
390
|
if (f.search) {
|
|
391
391
|
e.preventDefault(), f.setQuery(e.key, "keyboard", e.nativeEvent), k("first", e.nativeEvent);
|
|
392
392
|
return;
|
|
@@ -397,52 +397,52 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
397
397
|
}
|
|
398
398
|
switch (e.key) {
|
|
399
399
|
case "ArrowDown":
|
|
400
|
-
e.preventDefault(),
|
|
400
|
+
e.preventDefault(), A("next", e.nativeEvent);
|
|
401
401
|
return;
|
|
402
402
|
case "ArrowUp":
|
|
403
|
-
e.preventDefault(), t ?
|
|
403
|
+
e.preventDefault(), t ? j(e.nativeEvent, !0) : A("previous", e.nativeEvent);
|
|
404
404
|
return;
|
|
405
405
|
case "Home":
|
|
406
|
-
e.preventDefault(),
|
|
406
|
+
e.preventDefault(), A("first", e.nativeEvent);
|
|
407
407
|
return;
|
|
408
408
|
case "End":
|
|
409
|
-
e.preventDefault(),
|
|
409
|
+
e.preventDefault(), A("last", e.nativeEvent);
|
|
410
410
|
return;
|
|
411
411
|
case "PageDown":
|
|
412
|
-
e.preventDefault(),
|
|
412
|
+
e.preventDefault(), A("pageDown", e.nativeEvent);
|
|
413
413
|
return;
|
|
414
414
|
case "PageUp":
|
|
415
|
-
e.preventDefault(),
|
|
415
|
+
e.preventDefault(), A("pageUp", e.nativeEvent);
|
|
416
416
|
return;
|
|
417
417
|
case "Enter":
|
|
418
|
-
e.preventDefault(),
|
|
418
|
+
e.preventDefault(), j(e.nativeEvent, f.closeOnSelect);
|
|
419
419
|
return;
|
|
420
420
|
case " ":
|
|
421
|
-
e.preventDefault(),
|
|
421
|
+
e.preventDefault(), j(e.nativeEvent, !f.multiple && f.closeOnSelect);
|
|
422
422
|
return;
|
|
423
423
|
case "Escape":
|
|
424
424
|
e.preventDefault(), f.setOpen(!1, "escape", e.nativeEvent);
|
|
425
425
|
return;
|
|
426
426
|
case "Tab":
|
|
427
|
-
|
|
427
|
+
j(e.nativeEvent, !0);
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
430
|
-
if (!f.typeahead || O.current === null || e.ctrlKey || e.metaKey || t || !
|
|
430
|
+
if (!f.typeahead || O.current === null || e.ctrlKey || e.metaKey || t || !N(e.key, O.current.query.length > 0)) return;
|
|
431
431
|
e.preventDefault();
|
|
432
|
-
let { elements: n, labels: r } =
|
|
433
|
-
a !== -1 && f.setHighlighted(
|
|
434
|
-
},
|
|
432
|
+
let { elements: n, labels: r } = de(f.contentNode), i = n.findIndex((e) => H(e) === f.highlighted), a = O.current.match(e.key, r, i);
|
|
433
|
+
a !== -1 && f.setHighlighted(H(n[a]), "keyboard");
|
|
434
|
+
}, re = (e) => {
|
|
435
435
|
let t = T.current;
|
|
436
436
|
if (T.current = !1, e.detail > 0 && !t) {
|
|
437
437
|
e.currentTarget.focus({ preventScroll: !0 });
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
f.disabled || f.readOnly || (f.entry.current = "selected", f.setOpen(!f.open, "pointer", e.nativeEvent));
|
|
441
|
-
},
|
|
441
|
+
}, ie = (e) => {
|
|
442
442
|
f.clear("clear", e.nativeEvent), _?.focus({ preventScroll: !0 });
|
|
443
|
-
},
|
|
444
|
-
ee(e),
|
|
445
|
-
}, [s]),
|
|
443
|
+
}, P = m((e) => {
|
|
444
|
+
ee(e), me(e, s);
|
|
445
|
+
}, [s]), F = [d["aria-describedby"], p?.describedBy].filter(Boolean).join(" "), I = f.clearable && f.selection.length > 0 && !f.disabled && !f.readOnly, L = {
|
|
446
446
|
className: t,
|
|
447
447
|
style: u,
|
|
448
448
|
"data-part": "root",
|
|
@@ -460,7 +460,7 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
460
460
|
...f.required ? { "data-required": "" } : {},
|
|
461
461
|
...f.loading ? { "data-loading": "" } : {},
|
|
462
462
|
...E ? { "data-narrow": "" } : {}
|
|
463
|
-
},
|
|
463
|
+
}, ae = f.multiple && f.selection.length > 0 ? /* @__PURE__ */ C(o, {
|
|
464
464
|
disabled: f.disabled || f.readOnly,
|
|
465
465
|
frame: v,
|
|
466
466
|
labelFor: f.labelFor,
|
|
@@ -470,12 +470,12 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
470
470
|
},
|
|
471
471
|
removeLabel: (e) => f.t("remove", { label: e }),
|
|
472
472
|
values: f.selection
|
|
473
|
-
}) : null,
|
|
473
|
+
}) : null, z = /* @__PURE__ */ w(S, { children: [
|
|
474
474
|
/* @__PURE__ */ C("button", {
|
|
475
475
|
...d,
|
|
476
476
|
"aria-activedescendant": f.open && !f.search && f.highlighted !== null ? f.optionId(f.highlighted) : void 0,
|
|
477
477
|
"aria-controls": f.open ? f.contentId : void 0,
|
|
478
|
-
"aria-describedby":
|
|
478
|
+
"aria-describedby": F === "" ? void 0 : F,
|
|
479
479
|
"aria-expanded": f.open,
|
|
480
480
|
"aria-haspopup": f.search ? "dialog" : "listbox",
|
|
481
481
|
"aria-invalid": f.invalid ? !0 : void 0,
|
|
@@ -486,19 +486,19 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
486
486
|
"data-part-trigger": "",
|
|
487
487
|
disabled: f.disabled,
|
|
488
488
|
id: f.triggerId,
|
|
489
|
-
onClick:
|
|
490
|
-
onKeyDown:
|
|
491
|
-
ref:
|
|
489
|
+
onClick: G(d.onClick, re),
|
|
490
|
+
onKeyDown: G(d.onKeyDown, ne),
|
|
491
|
+
ref: P,
|
|
492
492
|
role: "combobox",
|
|
493
493
|
type: "button",
|
|
494
494
|
children: e
|
|
495
495
|
}),
|
|
496
|
-
|
|
497
|
-
|
|
496
|
+
ae,
|
|
497
|
+
I ? /* @__PURE__ */ C("button", {
|
|
498
498
|
"aria-label": f.t("clear"),
|
|
499
499
|
"data-part": "clear",
|
|
500
500
|
"data-part-clear": "",
|
|
501
|
-
onClick:
|
|
501
|
+
onClick: ie,
|
|
502
502
|
type: "button",
|
|
503
503
|
children: /* @__PURE__ */ C(r, { children: /* @__PURE__ */ C(n, { name: "x" }) })
|
|
504
504
|
}) : null,
|
|
@@ -514,19 +514,19 @@ function J({ children: e, className: t, ref: s, render: c, style: u, ...d }) {
|
|
|
514
514
|
"data-part-arrow": "",
|
|
515
515
|
children: /* @__PURE__ */ C(r, { children: /* @__PURE__ */ C(n, { name: "chevron-down" }) })
|
|
516
516
|
}),
|
|
517
|
-
/* @__PURE__ */ C(
|
|
517
|
+
/* @__PURE__ */ C(he, {})
|
|
518
518
|
] });
|
|
519
519
|
return c === void 0 ? /* @__PURE__ */ C("div", {
|
|
520
|
-
...
|
|
520
|
+
...L,
|
|
521
521
|
ref: y,
|
|
522
|
-
children:
|
|
522
|
+
children: z
|
|
523
523
|
}) : c({
|
|
524
|
-
...
|
|
525
|
-
children:
|
|
524
|
+
...L,
|
|
525
|
+
children: z
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
|
-
function
|
|
529
|
-
let e =
|
|
528
|
+
function he() {
|
|
529
|
+
let e = R(), [t, n] = x(null), { restore: r } = e;
|
|
530
530
|
return g(() => {
|
|
531
531
|
let e = t?.form;
|
|
532
532
|
if (e == null) return;
|
|
@@ -564,8 +564,8 @@ function me() {
|
|
|
564
564
|
}, t))]
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
let r =
|
|
567
|
+
function ge({ children: e, placeholder: t, ...n }) {
|
|
568
|
+
let r = R(), 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 = (() => {
|
|
569
569
|
if (e !== void 0) return e(r.selection, a);
|
|
570
570
|
if (r.selection.length === 0) return t;
|
|
571
571
|
let n = i[0] ?? r.selection[0];
|
|
@@ -582,9 +582,9 @@ function he({ children: e, placeholder: t, ...n }) {
|
|
|
582
582
|
children: s
|
|
583
583
|
});
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
let o =
|
|
587
|
-
let n =
|
|
585
|
+
function _e({ icon: e, ref: t, render: i, ...a }) {
|
|
586
|
+
let o = R(), s = (e, t) => {
|
|
587
|
+
let n = W(o.contentNode, o.highlighted, e, o.loop);
|
|
588
588
|
n !== null && o.setHighlighted(n, "keyboard", t);
|
|
589
589
|
}, c = (e, t) => {
|
|
590
590
|
if (o.highlighted !== null && o.toggle(o.highlighted, "keyboard", e), t) {
|
|
@@ -614,7 +614,7 @@ function ge({ icon: e, ref: t, render: i, ...a }) {
|
|
|
614
614
|
e.preventDefault(), o.query !== "" && o.setQuery("", "clear", e.nativeEvent);
|
|
615
615
|
return;
|
|
616
616
|
case "Tab":
|
|
617
|
-
e.preventDefault(), c(e.nativeEvent, !0),
|
|
617
|
+
e.preventDefault(), c(e.nativeEvent, !0), K(o.triggerNode, e.currentTarget.closest("[data-part='positioner']"), e.shiftKey);
|
|
618
618
|
return;
|
|
619
619
|
}
|
|
620
620
|
}, f = {
|
|
@@ -634,11 +634,11 @@ function ge({ icon: e, ref: t, render: i, ...a }) {
|
|
|
634
634
|
"aria-label": a["aria-label"] ?? o.t("search"),
|
|
635
635
|
autoComplete: "off",
|
|
636
636
|
id: a.id ?? o.searchId,
|
|
637
|
-
onChange:
|
|
638
|
-
onKeyDown:
|
|
637
|
+
onChange: G(a.onChange, (e) => o.setQuery(e.target.value, "keyboard", e.nativeEvent)),
|
|
638
|
+
onKeyDown: G(a.onKeyDown, d),
|
|
639
639
|
placeholder: a.placeholder ?? o.t("searchPlaceholder"),
|
|
640
640
|
ref: (e) => {
|
|
641
|
-
o.setSearchNode(e),
|
|
641
|
+
o.setSearchNode(e), me(e, t);
|
|
642
642
|
},
|
|
643
643
|
role: "combobox",
|
|
644
644
|
spellCheck: !1,
|
|
@@ -653,18 +653,18 @@ function ge({ icon: e, ref: t, render: i, ...a }) {
|
|
|
653
653
|
children: p
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
function
|
|
657
|
-
let s =
|
|
658
|
-
|
|
656
|
+
function ve({ children: e, empty: t, ref: n, render: r, searchProps: i, status: a, ...o }) {
|
|
657
|
+
let s = R(), [l, d] = x(null), [f, p] = x(null), [h, _] = x(null), [ee, y] = x("unmounted"), [E, D] = x(!1), [O, k] = x(0), A = b(null), M = b(s);
|
|
658
|
+
M.current = s, g(() => {
|
|
659
659
|
let e = T({
|
|
660
|
-
present:
|
|
660
|
+
present: M.current.open,
|
|
661
661
|
onStatusChange: y
|
|
662
662
|
});
|
|
663
|
-
return
|
|
664
|
-
e.destroy(),
|
|
663
|
+
return A.current = e, y(e.status), () => {
|
|
664
|
+
e.destroy(), A.current = null;
|
|
665
665
|
};
|
|
666
|
-
}, []), g(() =>
|
|
667
|
-
let
|
|
666
|
+
}, []), g(() => A.current?.sync(s.open), [s.open]), g(() => A.current?.setNode(l), [l]), g(() => s.setContentNode(f), [s, f]);
|
|
667
|
+
let N = s.mount === "eager" || s.mount === "lazy" && s.seen || s.open || ee !== "unmounted";
|
|
668
668
|
g(() => {
|
|
669
669
|
let e = s.triggerNode;
|
|
670
670
|
if (e === null || E) return;
|
|
@@ -673,9 +673,9 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
673
673
|
e.removeEventListener("focusin", t), e.removeEventListener("pointerdown", t);
|
|
674
674
|
};
|
|
675
675
|
}, [s.triggerNode, E]);
|
|
676
|
-
let
|
|
676
|
+
let ie = N || E;
|
|
677
677
|
v(() => {
|
|
678
|
-
if (!
|
|
678
|
+
if (!ie) {
|
|
679
679
|
_(null);
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
@@ -685,67 +685,67 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
685
685
|
});
|
|
686
686
|
return _(e.container), () => e.release();
|
|
687
687
|
}, [
|
|
688
|
-
|
|
688
|
+
ie,
|
|
689
689
|
s.portal,
|
|
690
690
|
s.triggerNode
|
|
691
691
|
]);
|
|
692
|
-
let { align:
|
|
692
|
+
let { align: P, alignOffset: F, collisionPadding: I, flip: L, hideWhenDetached: ae, shift: z, side: oe, sideOffset: se, strategy: ce, width: le } = s, B = b(null), H = b(0), U = m((e, t) => {
|
|
693
693
|
e.update().then(() => {
|
|
694
|
-
if (
|
|
694
|
+
if (B.current !== e || !M.current.open) return;
|
|
695
695
|
t.setAttribute("data-open", "");
|
|
696
696
|
let n = t.ownerDocument.defaultView;
|
|
697
|
-
n !== null &&
|
|
698
|
-
|
|
697
|
+
n !== null && H.current === 0 && (H.current = n.requestAnimationFrame(() => {
|
|
698
|
+
H.current = 0, pe(M.current.contentNode, M.current.highlighted);
|
|
699
699
|
}));
|
|
700
700
|
});
|
|
701
701
|
}, []);
|
|
702
702
|
v(() => {
|
|
703
703
|
if (l === null || s.triggerNode === null) return;
|
|
704
|
-
let e = s.triggerNode.closest("[data-part='root']") ?? s.triggerNode, t =
|
|
705
|
-
align:
|
|
706
|
-
alignOffset:
|
|
707
|
-
boundaryPadding:
|
|
708
|
-
flip:
|
|
709
|
-
hideWhenDetached:
|
|
710
|
-
matchWidth:
|
|
711
|
-
shift:
|
|
712
|
-
side:
|
|
713
|
-
sideOffset:
|
|
714
|
-
strategy:
|
|
704
|
+
let e = s.triggerNode.closest("[data-part='root']") ?? s.triggerNode, t = ne(e, l, {
|
|
705
|
+
align: P,
|
|
706
|
+
alignOffset: F,
|
|
707
|
+
boundaryPadding: I,
|
|
708
|
+
flip: L,
|
|
709
|
+
hideWhenDetached: ae,
|
|
710
|
+
matchWidth: le === "anchor",
|
|
711
|
+
shift: z,
|
|
712
|
+
side: oe,
|
|
713
|
+
sideOffset: se,
|
|
714
|
+
strategy: ce
|
|
715
715
|
});
|
|
716
|
-
return
|
|
717
|
-
t.destroy(),
|
|
716
|
+
return B.current = t, M.current.open && U(t, l), () => {
|
|
717
|
+
t.destroy(), B.current = null, l.removeAttribute("data-open");
|
|
718
718
|
};
|
|
719
719
|
}, [
|
|
720
|
+
P,
|
|
720
721
|
F,
|
|
721
722
|
I,
|
|
722
723
|
L,
|
|
723
|
-
|
|
724
|
-
ie,
|
|
724
|
+
ae,
|
|
725
725
|
l,
|
|
726
726
|
s.triggerNode,
|
|
727
|
-
|
|
728
|
-
ae,
|
|
727
|
+
z,
|
|
729
728
|
oe,
|
|
730
729
|
se,
|
|
731
730
|
ce,
|
|
732
|
-
|
|
731
|
+
le,
|
|
732
|
+
U
|
|
733
733
|
]), v(() => {
|
|
734
|
-
let e =
|
|
734
|
+
let e = B.current;
|
|
735
735
|
if (e !== null && l !== null) {
|
|
736
736
|
if (s.open) {
|
|
737
|
-
|
|
737
|
+
U(e, l);
|
|
738
738
|
return;
|
|
739
739
|
}
|
|
740
|
-
l.removeAttribute("data-open"),
|
|
740
|
+
l.removeAttribute("data-open"), H.current !== 0 && (l.ownerDocument.defaultView?.cancelAnimationFrame(H.current), H.current = 0);
|
|
741
741
|
}
|
|
742
742
|
}, [
|
|
743
743
|
l,
|
|
744
|
-
|
|
744
|
+
U,
|
|
745
745
|
s.open
|
|
746
746
|
]), g(() => {
|
|
747
747
|
if (l === null || !s.open) return;
|
|
748
|
-
let e = [s.triggerNode].filter((e) => e !== null), t =
|
|
748
|
+
let e = [s.triggerNode].filter((e) => e !== null), t = j(l, {
|
|
749
749
|
branches: e,
|
|
750
750
|
escape: s.closeOnEscape,
|
|
751
751
|
focusOutside: !1,
|
|
@@ -753,7 +753,7 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
753
753
|
outsidePress: s.closeOnOutsidePress,
|
|
754
754
|
scrollLock: !1,
|
|
755
755
|
onDismiss: (e) => {
|
|
756
|
-
let t =
|
|
756
|
+
let t = M.current;
|
|
757
757
|
if (e.reason === "escape" && t.search && t.query !== "") {
|
|
758
758
|
t.setQuery("", "clear", e.source);
|
|
759
759
|
return;
|
|
@@ -769,59 +769,59 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
769
769
|
s.open,
|
|
770
770
|
s.triggerNode
|
|
771
771
|
]), v(() => {
|
|
772
|
-
let e =
|
|
772
|
+
let e = M.current;
|
|
773
773
|
if (!e.open || f === null || e.entry.current === "none") return;
|
|
774
|
-
let t =
|
|
774
|
+
let t = fe(f, e.selection, e.entry.current, e.loop);
|
|
775
775
|
t !== null && e.setHighlighted(t, "keyboard");
|
|
776
776
|
}, [s.open, f]), v(() => {
|
|
777
|
-
let e =
|
|
778
|
-
|
|
777
|
+
let e = V(f).length;
|
|
778
|
+
k((t) => t === e ? t : e);
|
|
779
779
|
}), g(() => {
|
|
780
|
-
l?.hasAttribute("data-open") === !0 &&
|
|
780
|
+
l?.hasAttribute("data-open") === !0 && pe(f, s.highlighted);
|
|
781
781
|
}, [
|
|
782
782
|
l,
|
|
783
783
|
s.highlighted,
|
|
784
784
|
f
|
|
785
785
|
]);
|
|
786
|
-
let
|
|
786
|
+
let ue = s.searchNode;
|
|
787
787
|
g(() => {
|
|
788
|
-
s.open && s.search &&
|
|
788
|
+
s.open && s.search && ue !== null && ue.focus({ preventScroll: !0 });
|
|
789
789
|
}, [
|
|
790
|
-
|
|
790
|
+
ue,
|
|
791
791
|
s.open,
|
|
792
792
|
s.search
|
|
793
793
|
]);
|
|
794
|
-
let
|
|
794
|
+
let de = b(s.query);
|
|
795
795
|
g(() => {
|
|
796
|
-
s.open && s.search && f !== null &&
|
|
796
|
+
s.open && s.search && f !== null && de.current !== s.query && (de.current = s.query, M.current.setHighlighted(W(f, null, "first", !1), "keyboard"));
|
|
797
797
|
}, [
|
|
798
|
-
|
|
798
|
+
O,
|
|
799
799
|
s.open,
|
|
800
800
|
s.query,
|
|
801
801
|
s.search,
|
|
802
802
|
f
|
|
803
803
|
]);
|
|
804
|
-
let
|
|
804
|
+
let G = s.selection.filter((e) => s.labelFor(e) === void 0), K = G.length === 0 ? null : JSON.stringify(G), [q, he] = x(null), ge = b(null);
|
|
805
805
|
if (g(() => {
|
|
806
|
-
if (
|
|
807
|
-
|
|
806
|
+
if (q !== null) {
|
|
807
|
+
he(null);
|
|
808
808
|
return;
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
N || K === null || ge.current === K || (ge.current = K, he((s.triggerNode?.ownerDocument ?? document).createDocumentFragment()));
|
|
811
811
|
}, [
|
|
812
|
-
|
|
813
|
-
|
|
812
|
+
q,
|
|
813
|
+
N,
|
|
814
814
|
s.triggerNode,
|
|
815
|
-
|
|
816
|
-
]), !
|
|
817
|
-
let
|
|
818
|
-
"data-align":
|
|
815
|
+
K
|
|
816
|
+
]), !N) return q === null ? null : re(e, q);
|
|
817
|
+
let ve = c({
|
|
818
|
+
"data-align": P,
|
|
819
819
|
...s.open ? {} : { inert: !0 },
|
|
820
820
|
"data-part": "positioner",
|
|
821
821
|
"data-size": s.size,
|
|
822
822
|
"data-ui": "select",
|
|
823
823
|
"data-width": s.width
|
|
824
|
-
}),
|
|
824
|
+
}), ye = a === void 0 ? s.loading ? s.t("loading") : !s.search || O === 0 ? null : s.t("count", { count: O }) : a, be = s.multiple && s.selection.length > 0 ? /* @__PURE__ */ C("div", {
|
|
825
825
|
"aria-hidden": "true",
|
|
826
826
|
"data-part": "chosen",
|
|
827
827
|
"data-part-chosen": "",
|
|
@@ -842,8 +842,8 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
842
842
|
})
|
|
843
843
|
})
|
|
844
844
|
}, String(e)))
|
|
845
|
-
}) : null,
|
|
846
|
-
|
|
845
|
+
}) : null, xe = /* @__PURE__ */ w(S, { children: [
|
|
846
|
+
be,
|
|
847
847
|
e,
|
|
848
848
|
s.loading ? /* @__PURE__ */ C("div", {
|
|
849
849
|
"aria-hidden": "true",
|
|
@@ -862,7 +862,7 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
862
862
|
"data-loading": ""
|
|
863
863
|
}) }, e))
|
|
864
864
|
}) : null,
|
|
865
|
-
!s.loading &&
|
|
865
|
+
!s.loading && O === 0 ? /* @__PURE__ */ C("div", {
|
|
866
866
|
"data-part": "empty",
|
|
867
867
|
"data-part-empty": "",
|
|
868
868
|
children: t ?? s.t("empty")
|
|
@@ -873,43 +873,43 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
873
873
|
"data-part-status": "",
|
|
874
874
|
...s.loading ? { "data-loading": "" } : {},
|
|
875
875
|
role: "status",
|
|
876
|
-
children:
|
|
876
|
+
children: ye
|
|
877
877
|
}) : null
|
|
878
|
-
] }),
|
|
878
|
+
] }), J = {
|
|
879
879
|
"aria-busy": s.loading ? !0 : void 0,
|
|
880
880
|
"aria-multiselectable": s.multiple ? !0 : void 0
|
|
881
|
-
},
|
|
882
|
-
...
|
|
881
|
+
}, Y = /* @__PURE__ */ C("div", {
|
|
882
|
+
...ve,
|
|
883
883
|
ref: (e) => {
|
|
884
|
-
d(e),
|
|
884
|
+
d(e), me(e, n);
|
|
885
885
|
},
|
|
886
886
|
children: /* @__PURE__ */ C("div", {
|
|
887
887
|
...o,
|
|
888
|
-
...u(s.search ? {} :
|
|
888
|
+
...u(s.search ? {} : J, "part", "content"),
|
|
889
889
|
"aria-labelledby": o["aria-label"] === void 0 ? s.triggerId : void 0,
|
|
890
890
|
"data-loading": s.loading ? "" : void 0,
|
|
891
891
|
...s.search ? { "data-search": "" } : {},
|
|
892
892
|
id: s.contentId,
|
|
893
893
|
ref: p,
|
|
894
894
|
role: s.search ? "dialog" : "listbox",
|
|
895
|
-
children: s.search ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(
|
|
896
|
-
...u(
|
|
895
|
+
children: s.search ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(_e, { ...i }), /* @__PURE__ */ C("div", {
|
|
896
|
+
...u(J, "part", "list"),
|
|
897
897
|
"aria-labelledby": s.triggerId,
|
|
898
898
|
id: s.listId,
|
|
899
899
|
role: "listbox",
|
|
900
|
-
children:
|
|
901
|
-
})] }) :
|
|
900
|
+
children: xe
|
|
901
|
+
})] }) : xe
|
|
902
902
|
})
|
|
903
|
-
}),
|
|
904
|
-
...
|
|
903
|
+
}), Se = r === void 0 ? Y : r({
|
|
904
|
+
...ve,
|
|
905
905
|
children: e
|
|
906
906
|
});
|
|
907
|
-
return h === null ?
|
|
907
|
+
return h === null ? Se : re(Se, h);
|
|
908
908
|
}
|
|
909
909
|
//#endregion
|
|
910
910
|
//#region src/select/select-items.tsx
|
|
911
|
-
function
|
|
912
|
-
let p =
|
|
911
|
+
function ye({ children: e, description: t, disabled: i = !1, icon: a, position: o, ref: c, textValue: l, value: d, ...f }) {
|
|
912
|
+
let p = R(), m = b(null), h = b(null);
|
|
913
913
|
g(() => {
|
|
914
914
|
if (m.current === null) return;
|
|
915
915
|
let e = l ?? m.current.querySelector("[data-part='label']")?.textContent?.trim() ?? "";
|
|
@@ -922,7 +922,7 @@ function ve({ children: e, description: t, disabled: i = !1, icon: a, position:
|
|
|
922
922
|
]);
|
|
923
923
|
let _ = l ?? (typeof e == "string" ? e : void 0), ee = y(() => {
|
|
924
924
|
if (!p.search || !p.highlightMatch || p.query === "" || _ === void 0) return e;
|
|
925
|
-
let t =
|
|
925
|
+
let t = ie(_, p.query, { locale: p.locale });
|
|
926
926
|
return t.length === 0 ? e : /* @__PURE__ */ C(s, {
|
|
927
927
|
ranges: t,
|
|
928
928
|
text: _
|
|
@@ -992,8 +992,8 @@ function ve({ children: e, description: t, disabled: i = !1, icon: a, position:
|
|
|
992
992
|
]
|
|
993
993
|
});
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
let r = `${_()}group`, { query: i } =
|
|
995
|
+
function be({ children: e, label: t, ...n }) {
|
|
996
|
+
let r = `${_()}group`, { query: i } = R(), [a, o] = x(null), [s, c] = x(!1);
|
|
997
997
|
return g(() => {
|
|
998
998
|
a !== null && c(a.querySelector("[data-part='item']") === null);
|
|
999
999
|
}, [a, i]), /* @__PURE__ */ w("div", {
|
|
@@ -1010,7 +1010,7 @@ function ye({ children: e, label: t, ...n }) {
|
|
|
1010
1010
|
}), e]
|
|
1011
1011
|
});
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1013
|
+
function xe(e) {
|
|
1014
1014
|
return /* @__PURE__ */ C("div", {
|
|
1015
1015
|
"data-part": "separator",
|
|
1016
1016
|
"data-part-separator": "",
|
|
@@ -1019,4 +1019,4 @@ function be(e) {
|
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
1021
|
//#endregion
|
|
1022
|
-
export {
|
|
1022
|
+
export { _e as a, le as c, L as d, I as f, ve as i, R as l, ye as n, q as o, xe as r, ge as s, be as t, P as u };
|