@slotted/react 0.1.0-beta.0 → 0.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/{action-sheet-D8Glxl7l.js → action-sheet-DgwzC3iY.js} +1 -1
- package/dist/action-sheet.js +1 -1
- package/dist/{chart-BNzfIfQe.js → chart-Gb_P3Kdq.js} +344 -333
- package/dist/chart.js +1 -1
- package/dist/{column-manager-CNZ7Xk5_.js → column-manager-B7_a_jDK.js} +1 -1
- package/dist/column-manager.js +1 -1
- package/dist/{combobox-C46GRqAA.js → combobox-C66dNlMR.js} +176 -172
- package/dist/combobox.js +1 -1
- package/dist/dashboard-grid-CKdyO4j6.js +1043 -0
- package/dist/dashboard-grid.js +1 -1
- package/dist/{data-grid-BUgOJuGp.js → data-grid-rWMDNl-6.js} +2 -2
- package/dist/data-grid.js +1 -1
- package/dist/docs/AGENTS.snippet.md +10 -0
- package/dist/docs/event-calendar.json +7 -0
- package/dist/docs/event-calendar.md +1 -0
- package/dist/docs/guidelines/README.md +27 -0
- package/dist/docs/guidelines/async-feedback.md +108 -0
- package/dist/docs/guidelines/browsing.md +74 -0
- package/dist/docs/guidelines/builders.md +97 -0
- package/dist/docs/guidelines/composition.md +129 -0
- package/dist/docs/guidelines/conversations.md +59 -0
- package/dist/docs/guidelines/errors-and-conflicts.md +71 -0
- package/dist/docs/guidelines/forms.md +192 -0
- package/dist/docs/guidelines/index.md +121 -0
- package/dist/docs/guidelines/layout-alignment.md +95 -0
- package/dist/docs/guidelines/ledgers.md +45 -0
- package/dist/docs/guidelines/list-pages.md +165 -0
- package/dist/docs/guidelines/overviews.md +66 -0
- package/dist/docs/guidelines/own-elements.md +115 -0
- package/dist/docs/guidelines/reading-permissions.md +55 -0
- package/dist/docs/guidelines/record-pages.md +178 -0
- package/dist/docs/guidelines/reports.md +123 -0
- package/dist/docs/guidelines/shell-composition.md +94 -0
- package/dist/docs/guidelines/workspaces.md +46 -0
- package/dist/docs/index.md +12 -0
- package/dist/docs/progress-indicator.json +1 -2
- package/dist/docs/progress-indicator.md +2 -2
- package/dist/docs/skills/build-own-element/SKILL.md +90 -0
- package/dist/docs/skills/compose-screen/SKILL.md +76 -0
- package/dist/docs/skills/index.md +9 -0
- package/dist/docs/skills/review-screen/SKILL.md +70 -0
- package/dist/docs/skills/theme-app/SKILL.md +74 -0
- package/dist/docs/skills/waiting-states/SKILL.md +139 -0
- package/dist/docs/stat-card.json +1 -0
- package/dist/docs/stat-card.md +1 -1
- package/dist/docs/tabs.json +1 -4
- package/dist/docs/tabs.md +1 -1
- package/dist/docs/tokens.md +424 -0
- package/dist/{drawer-Ci3wuCVa.js → drawer-Dtospdqk.js} +1 -1
- package/dist/drawer.js +1 -1
- package/dist/{entity-picker-UGhbVwkC.js → entity-picker-Dm-y0RNE.js} +1 -1
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-BFdeGfC-.js → event-calendar-DYjVwTI6.js} +387 -386
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-b2Q9BZHf.js → filter-bar-Bh7cbqDE.js} +3 -3
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-D8xbCLWs.js → import-export-center-CkZ_Ar9w.js} +1 -1
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +14 -14
- package/dist/{multi-select-CfzsvAeI.js → multi-select-B-tuIwAu.js} +226 -231
- package/dist/multi-select.js +1 -1
- package/dist/{select-UTwKjheK.js → select-hRFp8nCj.js} +128 -141
- package/dist/select.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/{table-CzBIw9ng.js → table-Bd79IwDC.js} +1 -1
- package/dist/table.js +1 -1
- package/dist/types/chart/chart.d.ts.map +1 -1
- package/dist/types/combobox/combobox-collection.d.ts +1 -0
- package/dist/types/combobox/combobox-collection.d.ts.map +1 -1
- package/dist/types/combobox/combobox-parts.d.ts.map +1 -1
- package/dist/types/combobox/combobox.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-widget.d.ts +1 -1
- package/dist/types/dashboard-grid/dashboard-widget.d.ts.map +1 -1
- package/dist/types/drawer/drawer-parts.d.ts.map +1 -1
- package/dist/types/event-calendar/event-calendar.d.ts +1 -1
- package/dist/types/event-calendar/event-calendar.d.ts.map +1 -1
- package/dist/types/event-calendar/event-calendar.types.d.ts +6 -0
- package/dist/types/event-calendar/event-calendar.types.d.ts.map +1 -1
- package/dist/types/menu/menu.types.d.ts +3 -1
- package/dist/types/menu/menu.types.d.ts.map +1 -1
- package/dist/types/multi-select/multi-select-collection.d.ts +0 -2
- package/dist/types/multi-select/multi-select-collection.d.ts.map +1 -1
- package/dist/types/multi-select/multi-select-parts.d.ts.map +1 -1
- package/dist/types/multi-select/multi-select.d.ts.map +1 -1
- package/dist/types/select/select-collection.d.ts +0 -2
- package/dist/types/select/select-collection.d.ts.map +1 -1
- package/dist/types/select/select.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/dashboard-grid-nfhEewA4.js +0 -1005
package/dist/multi-select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./multi-select-
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./multi-select-B-tuIwAu.js";
|
|
2
2
|
export { i as MULTI_SELECT_FALLBACK, c as MultiSelect, r as MultiSelectContent, e as MultiSelectControl, u as MultiSelectDefaultsProvider, l as MultiSelectGroup, a as MultiSelectItem, s as MultiSelectSeparator, o as NARROW_WIDTH, t as useMultiSelect, n as useMultiSelectDefaults };
|
|
@@ -14,60 +14,10 @@ import { createDismissableLayer as w } from "@slotted/core/dismissable-layer";
|
|
|
14
14
|
import { createPositioner as T } from "@slotted/core/positioner";
|
|
15
15
|
import { createTypeahead as E, isPrintable as D } from "@slotted/core/typeahead";
|
|
16
16
|
import { selectMessages as O } from "@slotted/core/i18n";
|
|
17
|
-
import { createFilter as k, moveIndex as A } from "@slotted/core/collection";
|
|
18
|
-
import { matchRanges as
|
|
19
|
-
//#region src/select/select-collection.ts
|
|
20
|
-
var M = "[data-part='item']";
|
|
21
|
-
function N(e) {
|
|
22
|
-
return e === null ? [] : [...e.querySelectorAll(M)];
|
|
23
|
-
}
|
|
24
|
-
var P = (e) => e.dataset.value ?? "", F = (e) => e.dataset.disabled === void 0, I = (e) => e.dataset.textValue ?? e.querySelector("[data-part='label']")?.textContent?.trim() ?? e.textContent?.trim() ?? "";
|
|
25
|
-
function L(e) {
|
|
26
|
-
let t = N(e).filter(F);
|
|
27
|
-
return {
|
|
28
|
-
elements: t,
|
|
29
|
-
labels: t.map(I)
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function R(e, t, n, r) {
|
|
33
|
-
let i = N(e);
|
|
34
|
-
if (i.length === 0) return null;
|
|
35
|
-
let a = A({
|
|
36
|
-
enabled: i.map(F),
|
|
37
|
-
from: t === null ? -1 : i.findIndex((e) => P(e) === t),
|
|
38
|
-
intent: n,
|
|
39
|
-
loop: r
|
|
40
|
-
});
|
|
41
|
-
return a === -1 ? null : P(i[a]);
|
|
42
|
-
}
|
|
43
|
-
function ne(e, t, n, r) {
|
|
44
|
-
if (n === "none") return null;
|
|
45
|
-
if (n === "selected") {
|
|
46
|
-
let n = N(e).find((e) => t.includes(P(e)) && F(e));
|
|
47
|
-
return n === void 0 ? R(e, null, "first", r) : P(n);
|
|
48
|
-
}
|
|
49
|
-
return R(e, null, n, r);
|
|
50
|
-
}
|
|
51
|
-
function re(e, t) {
|
|
52
|
-
if (e === null || t === null) return;
|
|
53
|
-
let n = N(e).find((e) => P(e) === t);
|
|
54
|
-
n !== void 0 && ie(n, e);
|
|
55
|
-
}
|
|
56
|
-
function ie(e, t) {
|
|
57
|
-
let n = t;
|
|
58
|
-
for (let r = e.parentElement; r !== null && r !== t; r = r.parentElement) {
|
|
59
|
-
let e = getComputedStyle(r).overflowY;
|
|
60
|
-
if (e === "auto" || e === "scroll") {
|
|
61
|
-
n = r;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
let r = e.getBoundingClientRect(), i = n.getBoundingClientRect().top + n.clientTop, a = i + n.clientHeight;
|
|
66
|
-
r.top < i ? n.scrollTop -= i - r.top : r.bottom > a && (n.scrollTop += Math.min(r.bottom - a, r.top - i));
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
17
|
+
import { createFilter as k, moveIndex as A, revealWithin as j } from "@slotted/core/collection";
|
|
18
|
+
import { matchRanges as M } from "@slotted/core/highlight";
|
|
69
19
|
//#region src/select/select-defaults.tsx
|
|
70
|
-
var
|
|
20
|
+
var N = {
|
|
71
21
|
align: "start",
|
|
72
22
|
alignOffset: 0,
|
|
73
23
|
clearable: !1,
|
|
@@ -98,12 +48,12 @@ var z = {
|
|
|
98
48
|
typeaheadTimeout: 500,
|
|
99
49
|
variant: "outline",
|
|
100
50
|
width: "content"
|
|
101
|
-
},
|
|
102
|
-
function
|
|
103
|
-
return f(
|
|
51
|
+
}, P = u(N);
|
|
52
|
+
function F() {
|
|
53
|
+
return f(P);
|
|
104
54
|
}
|
|
105
|
-
function
|
|
106
|
-
let r =
|
|
55
|
+
function I({ children: e, container: t, ...n }) {
|
|
56
|
+
let r = F();
|
|
107
57
|
p(() => {
|
|
108
58
|
if (t !== void 0) return C(t), () => C(null);
|
|
109
59
|
}, [t]);
|
|
@@ -139,37 +89,37 @@ function ae({ children: e, container: t, ...n }) {
|
|
|
139
89
|
variant: n.variant ?? r.variant,
|
|
140
90
|
width: n.width ?? r.width
|
|
141
91
|
};
|
|
142
|
-
return /* @__PURE__ */ b(
|
|
92
|
+
return /* @__PURE__ */ b(P.Provider, {
|
|
143
93
|
value: i,
|
|
144
94
|
children: e
|
|
145
95
|
});
|
|
146
96
|
}
|
|
147
97
|
//#endregion
|
|
148
98
|
//#region src/select/select.tsx
|
|
149
|
-
var
|
|
150
|
-
function
|
|
151
|
-
let e = f(
|
|
99
|
+
var L = u(void 0);
|
|
100
|
+
function R() {
|
|
101
|
+
let e = f(L);
|
|
152
102
|
if (e === void 0) throw Error("SelectTrigger, SelectContent and every option have to be inside a Select.");
|
|
153
103
|
return e;
|
|
154
104
|
}
|
|
155
|
-
function
|
|
105
|
+
function ne(e) {
|
|
156
106
|
return e == null ? [] : typeof e == "string" ? [e] : e;
|
|
157
107
|
}
|
|
158
|
-
function
|
|
108
|
+
function re(e, t) {
|
|
159
109
|
return t ? e : e[0] ?? null;
|
|
160
110
|
}
|
|
161
|
-
var
|
|
162
|
-
function
|
|
163
|
-
return e === void 0 ? [] : e.flatMap((e) =>
|
|
111
|
+
var ie = (e) => "options" in e;
|
|
112
|
+
function ae(e) {
|
|
113
|
+
return e === void 0 ? [] : e.flatMap((e) => ie(e) ? e.options : [e]);
|
|
164
114
|
}
|
|
165
|
-
function
|
|
166
|
-
let q =
|
|
115
|
+
function z({ align: e, alignOffset: t, children: n, clearable: o, closeOnEscape: s, closeOnOutsidePress: c, closeOnSelect: u, collisionPadding: f, defaultHighlightedValue: p = null, defaultOpen: h = !1, defaultSearchValue: y = "", defaultValue: x, disabled: te, filter: S, flip: C, form: w, fullWidth: T, hideWhenDetached: E, highlightedValue: D, highlightMatch: A, invalid: M, items: N, loading: P, locale: I, loop: R, messages: ie, mount: z, multiple: oe, name: se, onHighlightedValueChange: B, onOpenChange: V, onSearchValueChange: H, onValueChange: ce, open: U, portal: W, readOnly: le, ref: ue, required: G, search: de, searchValue: K, shift: fe, side: pe, sideOffset: me, size: he, strategy: ge, total: _e, typeahead: ve, typeaheadTimeout: ye, value: be, variant: xe, width: Se }) {
|
|
116
|
+
let q = F(), J = a(), Ce = i(O, ie), we = r(), Te = I ?? we, Y = m(), Ee = `${Y}listbox`, De = `${Y}list`, Oe = `${Y}search`, ke = J?.ids.control ?? `${Y}trigger`, [Ae, je] = v(h), [Me] = v(() => ne(x)), [Ne, Pe] = v(Me), [Fe, Ie] = v(p), [Le, Re] = v(y), [ze, Be] = v(null), [X, Ve] = v(null), [He, Ue] = v(null), We = oe ?? q.multiple, Ge = te ?? J?.disabled ?? q.disabled, Ke = le ?? J?.readOnly ?? q.readOnly, qe = (U ?? Ae) && !Ge, Je = be === void 0 ? Ne : ne(be), Ye = D === void 0 ? Fe : D, Xe = de ?? q.search, Z = Xe ? K === void 0 ? Le : K : "", Ze = _(qe);
|
|
167
117
|
qe && (Ze.current = !0);
|
|
168
118
|
let Qe = _("selected"), $e = _(/* @__PURE__ */ new Map()), [et, tt] = v(0), nt = g(() => {
|
|
169
119
|
let e = /* @__PURE__ */ new Map();
|
|
170
|
-
for (let t of
|
|
120
|
+
for (let t of ae(N)) e.set(t.value, t.label);
|
|
171
121
|
return e;
|
|
172
|
-
}, [
|
|
122
|
+
}, [N]), rt = d((e, t) => {
|
|
173
123
|
$e.current.get(e) !== t && ($e.current.set(e, t), tt((e) => e + 1));
|
|
174
124
|
}, []), it = d((e) => nt.get(e) ?? $e.current.get(e), [nt, et]), at = g(() => k({ locale: Te }), [Te]), ot = d((e) => Z === "" || S === null ? !0 : S === void 0 ? at.contains(e, Z) : S(e, Z), [
|
|
175
125
|
Z,
|
|
@@ -181,10 +131,10 @@ function W({ align: e, alignOffset: t, children: n, clearable: o, closeOnEscape:
|
|
|
181
131
|
currentQuery: Z,
|
|
182
132
|
currentSelection: Je,
|
|
183
133
|
highlightedValue: D,
|
|
184
|
-
onHighlightedValueChange:
|
|
185
|
-
onOpenChange:
|
|
186
|
-
onSearchValueChange:
|
|
187
|
-
onValueChange:
|
|
134
|
+
onHighlightedValueChange: B,
|
|
135
|
+
onOpenChange: V,
|
|
136
|
+
onSearchValueChange: H,
|
|
137
|
+
onValueChange: ce,
|
|
188
138
|
open: U,
|
|
189
139
|
resolvedMultiple: We,
|
|
190
140
|
resolvedSearch: Xe,
|
|
@@ -219,10 +169,10 @@ function W({ align: e, alignOffset: t, children: n, clearable: o, closeOnEscape:
|
|
|
219
169
|
let r = Q.current;
|
|
220
170
|
e.length === r.currentSelection.length && e.every((e, t) => e === r.currentSelection[t]) || l({
|
|
221
171
|
controlled: r.value,
|
|
222
|
-
initial:
|
|
172
|
+
initial: re(r.currentSelection, r.resolvedMultiple),
|
|
223
173
|
equals: () => !1,
|
|
224
174
|
onRequest: (e) => r.onValueChange?.(e.value, e)
|
|
225
|
-
}).request(
|
|
175
|
+
}).request(re(e, r.resolvedMultiple), t, n) && Pe(e);
|
|
226
176
|
}, []), ft = d((e, t, n) => {
|
|
227
177
|
let r = Q.current;
|
|
228
178
|
if (!r.resolvedMultiple) {
|
|
@@ -242,7 +192,7 @@ function W({ align: e, alignOffset: t, children: n, clearable: o, closeOnEscape:
|
|
|
242
192
|
open: () => ut(!0, "programmatic"),
|
|
243
193
|
scrollToKey: (e) => {
|
|
244
194
|
let t = X?.querySelector(`[data-part='item'][data-value="${CSS.escape(e)}"]`);
|
|
245
|
-
t != null && X !== null &&
|
|
195
|
+
t != null && X !== null && j(t, X);
|
|
246
196
|
}
|
|
247
197
|
}), [X, ut]);
|
|
248
198
|
let ht = {
|
|
@@ -264,19 +214,19 @@ function W({ align: e, alignOffset: t, children: n, clearable: o, closeOnEscape:
|
|
|
264
214
|
hideWhenDetached: E ?? q.hideWhenDetached,
|
|
265
215
|
highlighted: Ye,
|
|
266
216
|
highlightMatch: A ?? q.highlightMatch,
|
|
267
|
-
invalid:
|
|
217
|
+
invalid: M ?? J?.invalid ?? q.invalid,
|
|
268
218
|
labelFor: it,
|
|
269
219
|
listId: De,
|
|
270
|
-
loading:
|
|
220
|
+
loading: P ?? q.loading,
|
|
271
221
|
locale: Te,
|
|
272
|
-
loop:
|
|
222
|
+
loop: R ?? q.loop,
|
|
273
223
|
matches: ot,
|
|
274
|
-
mount:
|
|
224
|
+
mount: z ?? q.mount,
|
|
275
225
|
multiple: We,
|
|
276
|
-
name:
|
|
226
|
+
name: se,
|
|
277
227
|
open: qe,
|
|
278
228
|
optionId: st,
|
|
279
|
-
portal:
|
|
229
|
+
portal: W ?? q.portal,
|
|
280
230
|
query: Z,
|
|
281
231
|
readOnly: Ke,
|
|
282
232
|
registerLabel: rt,
|
|
@@ -308,14 +258,51 @@ function W({ align: e, alignOffset: t, children: n, clearable: o, closeOnEscape:
|
|
|
308
258
|
variant: xe ?? q.variant,
|
|
309
259
|
width: Se ?? q.width
|
|
310
260
|
};
|
|
311
|
-
return /* @__PURE__ */ b(
|
|
261
|
+
return /* @__PURE__ */ b(L.Provider, {
|
|
312
262
|
value: ht,
|
|
313
263
|
children: n
|
|
314
264
|
});
|
|
315
265
|
}
|
|
316
266
|
//#endregion
|
|
267
|
+
//#region src/select/select-collection.ts
|
|
268
|
+
var oe = e(), se = "[data-part='item']";
|
|
269
|
+
function B(e) {
|
|
270
|
+
return e === null ? [] : [...e.querySelectorAll(se)];
|
|
271
|
+
}
|
|
272
|
+
var V = (e) => e.dataset.value ?? "", H = (e) => e.dataset.disabled === void 0, ce = (e) => e.dataset.textValue ?? e.querySelector("[data-part='label']")?.textContent?.trim() ?? e.textContent?.trim() ?? "";
|
|
273
|
+
function U(e) {
|
|
274
|
+
let t = B(e).filter(H);
|
|
275
|
+
return {
|
|
276
|
+
elements: t,
|
|
277
|
+
labels: t.map(ce)
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function W(e, t, n, r) {
|
|
281
|
+
let i = B(e);
|
|
282
|
+
if (i.length === 0) return null;
|
|
283
|
+
let a = A({
|
|
284
|
+
enabled: i.map(H),
|
|
285
|
+
from: t === null ? -1 : i.findIndex((e) => V(e) === t),
|
|
286
|
+
intent: n,
|
|
287
|
+
loop: r
|
|
288
|
+
});
|
|
289
|
+
return a === -1 ? null : V(i[a]);
|
|
290
|
+
}
|
|
291
|
+
function le(e, t, n, r) {
|
|
292
|
+
if (n === "none") return null;
|
|
293
|
+
if (n === "selected") {
|
|
294
|
+
let n = B(e).find((e) => t.includes(V(e)) && H(e));
|
|
295
|
+
return n === void 0 ? W(e, null, "first", r) : V(n);
|
|
296
|
+
}
|
|
297
|
+
return W(e, null, n, r);
|
|
298
|
+
}
|
|
299
|
+
function ue(e, t) {
|
|
300
|
+
if (e === null || t === null) return;
|
|
301
|
+
let n = B(e).find((e) => V(e) === t);
|
|
302
|
+
n !== void 0 && j(n, e);
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
317
305
|
//#region src/select/select-parts.tsx
|
|
318
|
-
var ue = e();
|
|
319
306
|
function G(e, t) {
|
|
320
307
|
return (n) => {
|
|
321
308
|
e?.(n), n.defaultPrevented || t(n);
|
|
@@ -334,7 +321,7 @@ function fe(e, ...t) {
|
|
|
334
321
|
for (let n of t) typeof n == "function" ? n(e) : n != null && (n.current = e);
|
|
335
322
|
}
|
|
336
323
|
function pe({ children: e, ref: r, render: i, ...s }) {
|
|
337
|
-
let c =
|
|
324
|
+
let c = R(), l = a(), u = l?.registerControl;
|
|
338
325
|
p(() => u?.(), [u]);
|
|
339
326
|
let [f, m] = v(null), [ee, h] = v(null), [g, te] = v(!1), S = _(null), C = _(null);
|
|
340
327
|
p(() => {
|
|
@@ -349,8 +336,8 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
349
336
|
if (!c.open || c.contentNode === null) return;
|
|
350
337
|
let e = S.current;
|
|
351
338
|
if (S.current = null, e === null || C.current === null) return;
|
|
352
|
-
let { elements: t, labels: n } =
|
|
353
|
-
r !== -1 && c.setHighlighted(
|
|
339
|
+
let { elements: t, labels: n } = U(c.contentNode), r = C.current.match(e, n, -1);
|
|
340
|
+
r !== -1 && c.setHighlighted(V(t[r]), "keyboard");
|
|
354
341
|
}, [
|
|
355
342
|
c,
|
|
356
343
|
c.contentNode,
|
|
@@ -359,7 +346,7 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
359
346
|
let w = (e, t) => {
|
|
360
347
|
c.entry.current = e, c.setOpen(!0, "keyboard", t);
|
|
361
348
|
}, T = (e, t) => {
|
|
362
|
-
let n =
|
|
349
|
+
let n = W(c.contentNode, c.highlighted, e, c.loop);
|
|
363
350
|
n !== null && c.setHighlighted(n, "keyboard", t);
|
|
364
351
|
}, O = (e, t) => {
|
|
365
352
|
if (c.highlighted === null) {
|
|
@@ -432,8 +419,8 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
432
419
|
}
|
|
433
420
|
if (!c.typeahead || C.current === null || e.ctrlKey || e.metaKey || t || !D(e.key, C.current.query.length > 0)) return;
|
|
434
421
|
e.preventDefault();
|
|
435
|
-
let { elements: n, labels: r } =
|
|
436
|
-
a !== -1 && c.setHighlighted(
|
|
422
|
+
let { elements: n, labels: r } = U(c.contentNode), i = n.findIndex((e) => V(e) === c.highlighted), a = C.current.match(e.key, r, i);
|
|
423
|
+
a !== -1 && c.setHighlighted(V(n[a]), "keyboard");
|
|
437
424
|
}, A = (e) => {
|
|
438
425
|
if (e.detail > 0 && !K(e.currentTarget, e.clientX, e.clientY)) {
|
|
439
426
|
e.currentTarget.focus({ preventScroll: !0 });
|
|
@@ -444,7 +431,7 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
444
431
|
c.clear("clear", e.nativeEvent), f?.focus({ preventScroll: !0 });
|
|
445
432
|
}, M = d((e) => {
|
|
446
433
|
m(e), fe(e, r);
|
|
447
|
-
}, [r]), N = [s["aria-describedby"], l?.describedBy].filter(Boolean).join(" "),
|
|
434
|
+
}, [r]), N = [s["aria-describedby"], l?.describedBy].filter(Boolean).join(" "), P = c.clearable && c.selection.length > 0 && !c.disabled && !c.readOnly, F = {
|
|
448
435
|
"data-part": "root",
|
|
449
436
|
"data-size": c.size,
|
|
450
437
|
"data-ui": "select",
|
|
@@ -458,7 +445,7 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
458
445
|
...c.required ? { "data-required": "" } : {},
|
|
459
446
|
...c.loading ? { "data-loading": "" } : {},
|
|
460
447
|
...g ? { "data-narrow": "" } : {}
|
|
461
|
-
},
|
|
448
|
+
}, I = c.multiple && c.selection.length > 0 ? /* @__PURE__ */ b(o, {
|
|
462
449
|
disabled: c.disabled || c.readOnly,
|
|
463
450
|
frame: ee,
|
|
464
451
|
labelFor: c.labelFor,
|
|
@@ -468,7 +455,7 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
468
455
|
},
|
|
469
456
|
removeLabel: (e) => c.t("remove", { label: e }),
|
|
470
457
|
values: c.selection
|
|
471
|
-
}) : null,
|
|
458
|
+
}) : null, L = /* @__PURE__ */ x(y, { children: [
|
|
472
459
|
/* @__PURE__ */ b("button", {
|
|
473
460
|
...s,
|
|
474
461
|
"aria-activedescendant": c.open && !c.search && c.highlighted !== null ? c.optionId(c.highlighted) : void 0,
|
|
@@ -490,8 +477,8 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
490
477
|
type: "button",
|
|
491
478
|
children: e
|
|
492
479
|
}),
|
|
493
|
-
|
|
494
|
-
|
|
480
|
+
I,
|
|
481
|
+
P ? /* @__PURE__ */ b("button", {
|
|
495
482
|
"aria-label": c.t("clear"),
|
|
496
483
|
"data-part": "clear",
|
|
497
484
|
onClick: j,
|
|
@@ -509,16 +496,16 @@ function pe({ children: e, ref: r, render: i, ...s }) {
|
|
|
509
496
|
/* @__PURE__ */ b(me, {})
|
|
510
497
|
] });
|
|
511
498
|
return i === void 0 ? /* @__PURE__ */ b("div", {
|
|
512
|
-
...
|
|
499
|
+
...F,
|
|
513
500
|
ref: h,
|
|
514
|
-
children:
|
|
501
|
+
children: L
|
|
515
502
|
}) : i({
|
|
516
|
-
...
|
|
517
|
-
children:
|
|
503
|
+
...F,
|
|
504
|
+
children: L
|
|
518
505
|
});
|
|
519
506
|
}
|
|
520
507
|
function me() {
|
|
521
|
-
let e =
|
|
508
|
+
let e = R(), [t, n] = v(null), { restore: r } = e;
|
|
522
509
|
return p(() => {
|
|
523
510
|
let e = t?.form;
|
|
524
511
|
if (e == null) return;
|
|
@@ -557,7 +544,7 @@ function me() {
|
|
|
557
544
|
});
|
|
558
545
|
}
|
|
559
546
|
function he({ children: e, placeholder: t, ...n }) {
|
|
560
|
-
let r =
|
|
547
|
+
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 = (() => {
|
|
561
548
|
if (e !== void 0) return e(r.selection, a);
|
|
562
549
|
if (r.selection.length === 0) return t;
|
|
563
550
|
let n = i[0] ?? r.selection[0];
|
|
@@ -575,8 +562,8 @@ function he({ children: e, placeholder: t, ...n }) {
|
|
|
575
562
|
});
|
|
576
563
|
}
|
|
577
564
|
function ge({ icon: e, ref: r, render: i, ...a }) {
|
|
578
|
-
let o =
|
|
579
|
-
let n =
|
|
565
|
+
let o = R(), s = (e, t) => {
|
|
566
|
+
let n = W(o.contentNode, o.highlighted, e, o.loop);
|
|
580
567
|
n !== null && o.setHighlighted(n, "keyboard", t);
|
|
581
568
|
}, c = (e, t) => {
|
|
582
569
|
if (o.highlighted !== null && o.toggle(o.highlighted, "keyboard", e), t) {
|
|
@@ -643,7 +630,7 @@ function ge({ icon: e, ref: r, render: i, ...a }) {
|
|
|
643
630
|
});
|
|
644
631
|
}
|
|
645
632
|
function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status: a, ...o }) {
|
|
646
|
-
let s =
|
|
633
|
+
let s = R(), [c, l] = v(null), [u, d] = v(null), [f, m] = v(null), [ee, g] = v("unmounted"), [C, E] = v(!1), [D, O] = v(0), k = _(null), A = _(s);
|
|
647
634
|
A.current = s, p(() => {
|
|
648
635
|
let e = te({
|
|
649
636
|
present: A.current.open,
|
|
@@ -669,20 +656,20 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
669
656
|
s.portal,
|
|
670
657
|
s.triggerNode
|
|
671
658
|
]);
|
|
672
|
-
let { align: M, alignOffset:
|
|
659
|
+
let { align: M, alignOffset: N, collisionPadding: P, flip: F, hideWhenDetached: I, shift: L, side: ne, sideOffset: re, strategy: ie, width: ae } = s;
|
|
673
660
|
p(() => {
|
|
674
661
|
if (c === null || s.triggerNode === null) return;
|
|
675
662
|
let e = !0, t = s.triggerNode.closest("[data-part='root']") ?? s.triggerNode, n = T(t, c, {
|
|
676
663
|
align: M,
|
|
677
|
-
alignOffset:
|
|
678
|
-
boundaryPadding:
|
|
679
|
-
flip:
|
|
680
|
-
hideWhenDetached:
|
|
664
|
+
alignOffset: N,
|
|
665
|
+
boundaryPadding: P,
|
|
666
|
+
flip: F,
|
|
667
|
+
hideWhenDetached: I,
|
|
681
668
|
matchWidth: ae === "anchor",
|
|
682
|
-
shift:
|
|
683
|
-
side:
|
|
684
|
-
sideOffset:
|
|
685
|
-
strategy:
|
|
669
|
+
shift: L,
|
|
670
|
+
side: ne,
|
|
671
|
+
sideOffset: re,
|
|
672
|
+
strategy: ie
|
|
686
673
|
});
|
|
687
674
|
return n.update().then(() => {
|
|
688
675
|
e && E(!0);
|
|
@@ -691,16 +678,16 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
691
678
|
};
|
|
692
679
|
}, [
|
|
693
680
|
M,
|
|
681
|
+
N,
|
|
694
682
|
P,
|
|
695
683
|
F,
|
|
696
684
|
I,
|
|
697
|
-
L,
|
|
698
685
|
c,
|
|
699
686
|
s.triggerNode,
|
|
687
|
+
L,
|
|
688
|
+
ne,
|
|
689
|
+
re,
|
|
700
690
|
ie,
|
|
701
|
-
z,
|
|
702
|
-
B,
|
|
703
|
-
V,
|
|
704
691
|
ae
|
|
705
692
|
]), p(() => {
|
|
706
693
|
if (c === null || !s.open) return;
|
|
@@ -730,29 +717,29 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
730
717
|
]), h(() => {
|
|
731
718
|
let e = A.current;
|
|
732
719
|
if (!e.open || u === null || e.entry.current === "none") return;
|
|
733
|
-
let t =
|
|
720
|
+
let t = le(u, e.selection, e.entry.current, e.loop);
|
|
734
721
|
t !== null && e.setHighlighted(t, "keyboard");
|
|
735
722
|
}, [s.open, u]), h(() => {
|
|
736
|
-
let e =
|
|
723
|
+
let e = B(u).length;
|
|
737
724
|
O((t) => t === e ? t : e);
|
|
738
725
|
}), p(() => {
|
|
739
|
-
|
|
726
|
+
ue(u, s.highlighted);
|
|
740
727
|
}, [
|
|
741
728
|
C,
|
|
742
729
|
s.highlighted,
|
|
743
730
|
u
|
|
744
731
|
]);
|
|
745
|
-
let
|
|
732
|
+
let z = s.searchNode;
|
|
746
733
|
p(() => {
|
|
747
|
-
s.open && s.search &&
|
|
734
|
+
s.open && s.search && z !== null && z.focus({ preventScroll: !0 });
|
|
748
735
|
}, [
|
|
749
|
-
|
|
736
|
+
z,
|
|
750
737
|
s.open,
|
|
751
738
|
s.search
|
|
752
739
|
]);
|
|
753
|
-
let
|
|
740
|
+
let se = _(s.query);
|
|
754
741
|
if (p(() => {
|
|
755
|
-
s.open && s.search && u !== null &&
|
|
742
|
+
s.open && s.search && u !== null && se.current !== s.query && (se.current = s.query, A.current.setHighlighted(W(u, null, "first", !1), "keyboard"));
|
|
756
743
|
}, [
|
|
757
744
|
D,
|
|
758
745
|
s.open,
|
|
@@ -760,7 +747,7 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
760
747
|
s.search,
|
|
761
748
|
u
|
|
762
749
|
]), !j) return null;
|
|
763
|
-
let
|
|
750
|
+
let V = {
|
|
764
751
|
"data-align": M,
|
|
765
752
|
...s.open ? {} : { inert: !0 },
|
|
766
753
|
...s.open && C ? { "data-open": "" } : {},
|
|
@@ -768,7 +755,7 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
768
755
|
"data-size": s.size,
|
|
769
756
|
"data-ui": "select",
|
|
770
757
|
"data-width": s.width
|
|
771
|
-
},
|
|
758
|
+
}, H = a === void 0 ? s.loading ? s.t("loading") : !s.search || D === 0 ? null : s.t("count", { count: D }) : a, ce = s.multiple && s.selection.length > 0 ? /* @__PURE__ */ b("div", {
|
|
772
759
|
"aria-hidden": "true",
|
|
773
760
|
"data-part": "chosen",
|
|
774
761
|
children: s.selection.map((e) => /* @__PURE__ */ b("span", {
|
|
@@ -784,8 +771,8 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
784
771
|
})
|
|
785
772
|
})
|
|
786
773
|
}, String(e)))
|
|
787
|
-
}) : null,
|
|
788
|
-
|
|
774
|
+
}) : null, U = /* @__PURE__ */ x(y, { children: [
|
|
775
|
+
ce,
|
|
789
776
|
e,
|
|
790
777
|
s.loading ? /* @__PURE__ */ b("div", {
|
|
791
778
|
"aria-hidden": "true",
|
|
@@ -810,13 +797,13 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
810
797
|
"data-part": "status",
|
|
811
798
|
...s.loading ? { "data-loading": "" } : {},
|
|
812
799
|
role: "status",
|
|
813
|
-
children:
|
|
800
|
+
children: H
|
|
814
801
|
}) : null
|
|
815
802
|
] }), G = {
|
|
816
803
|
"aria-busy": s.loading ? !0 : void 0,
|
|
817
804
|
"aria-multiselectable": s.multiple ? !0 : void 0
|
|
818
805
|
}, de = /* @__PURE__ */ b("div", {
|
|
819
|
-
...
|
|
806
|
+
...V,
|
|
820
807
|
ref: (e) => {
|
|
821
808
|
l(e), fe(e, n);
|
|
822
809
|
},
|
|
@@ -836,19 +823,19 @@ function _e({ children: e, empty: t, ref: n, render: r, searchProps: i, status:
|
|
|
836
823
|
"data-part": "list",
|
|
837
824
|
id: s.listId,
|
|
838
825
|
role: "listbox",
|
|
839
|
-
children:
|
|
840
|
-
})] }) :
|
|
826
|
+
children: U
|
|
827
|
+
})] }) : U
|
|
841
828
|
})
|
|
842
829
|
}), K = r === void 0 ? de : r({
|
|
843
|
-
...
|
|
830
|
+
...V,
|
|
844
831
|
children: e
|
|
845
832
|
});
|
|
846
|
-
return f === null ? K : (0,
|
|
833
|
+
return f === null ? K : (0, oe.createPortal)(K, f);
|
|
847
834
|
}
|
|
848
835
|
//#endregion
|
|
849
836
|
//#region src/select/select-items.tsx
|
|
850
837
|
function ve({ children: e, description: r, disabled: i = !1, icon: a, position: o, ref: c, textValue: l, value: u, ...d }) {
|
|
851
|
-
let f =
|
|
838
|
+
let f = R(), [m, ee] = v(null), h = _(null);
|
|
852
839
|
p(() => {
|
|
853
840
|
if (m === null) return;
|
|
854
841
|
let e = l ?? m.querySelector("[data-part='label']")?.textContent?.trim() ?? "";
|
|
@@ -861,7 +848,7 @@ function ve({ children: e, description: r, disabled: i = !1, icon: a, position:
|
|
|
861
848
|
]);
|
|
862
849
|
let y = l ?? (typeof e == "string" ? e : void 0), te = g(() => {
|
|
863
850
|
if (!f.search || !f.highlightMatch || f.query === "" || y === void 0) return e;
|
|
864
|
-
let t =
|
|
851
|
+
let t = M(y, f.query, { locale: f.locale });
|
|
865
852
|
return t.length === 0 ? e : /* @__PURE__ */ b(s, {
|
|
866
853
|
ranges: t,
|
|
867
854
|
text: y
|
|
@@ -929,7 +916,7 @@ function ve({ children: e, description: r, disabled: i = !1, icon: a, position:
|
|
|
929
916
|
});
|
|
930
917
|
}
|
|
931
918
|
function ye({ children: e, label: t, ...n }) {
|
|
932
|
-
let r = `${m()}group`, { query: i } =
|
|
919
|
+
let r = `${m()}group`, { query: i } = R(), [a, o] = v(null), [s, c] = v(!1);
|
|
933
920
|
return p(() => {
|
|
934
921
|
a !== null && c(a.querySelector("[data-part='item']") === null);
|
|
935
922
|
}, [a, i]), /* @__PURE__ */ x("div", {
|
|
@@ -954,4 +941,4 @@ function be(e) {
|
|
|
954
941
|
});
|
|
955
942
|
}
|
|
956
943
|
//#endregion
|
|
957
|
-
export { ge as a,
|
|
944
|
+
export { ge as a, z as c, I as d, F as f, _e as i, R as l, ve as n, pe as o, be as r, he as s, ye as t, N as u };
|
package/dist/select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./select-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./select-hRFp8nCj.js";
|
|
2
2
|
export { d as SELECT_FALLBACK, t as Select, i as SelectContent, n as SelectDefaultsProvider, u as SelectGroup, o as SelectItem, e as SelectSearch, c as SelectSeparator, s as SelectTrigger, l as SelectValue, a as useSelect, r as useSelectDefaults };
|