@box-kite/react 2.3.1 → 2.4.1
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/.claude/rules/box-kite-rules.md +58 -94
- package/.claude/skills/box-kite/SKILL.md +69 -104
- package/.claude/skills/box-kite/references/components.md +8 -1
- package/.claude/skills/box-kite/references/patterns.md +1 -1
- package/.claude/skills/box-kite/references/rules.md +115 -0
- package/.claude/skills/box-kite/references/styling.md +5 -3
- package/.cursor/rules/box-kite.mdc +60 -96
- package/AGENTS.md +61 -97
- package/BOX_AI_CONTEXT.md +111 -40
- package/BOX_KITE_AI_CONTEXT.md +111 -40
- package/README.md +200 -721
- package/box.cjs +1 -1
- package/box.d.ts +5 -0
- package/box.mjs +5 -5
- package/catalog.cjs +1 -1
- package/catalog.mjs +53 -18
- package/client.cjs +1 -1
- package/client.mjs +85 -85
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +1 -1
- package/components/button.cjs +1 -1
- package/components/button.mjs +1 -1
- package/components/calendar.cjs +1 -1
- package/components/calendar.mjs +1 -1
- package/components/chart.cjs +1 -1
- package/components/chart.mjs +3 -3
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.mjs +1 -1
- package/components/combobox/comboboxListbox.d.ts +2 -1
- package/components/combobox.cjs +1 -1
- package/components/combobox.d.ts +1 -1
- package/components/combobox.mjs +200 -189
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +1 -1
- package/components/dataGrid/contracts/dataGridContract.d.ts +2 -1
- package/components/dataGrid/useListLayout.d.ts +1 -1
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +453 -453
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +16 -16
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +1 -1
- package/components/dateTime.cjs +1 -1
- package/components/dateTime.mjs +1 -1
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +1 -1
- package/components/flex.cjs +1 -1
- package/components/flex.mjs +1 -1
- package/components/flow.cjs +1 -0
- package/components/flow.d.ts +56 -0
- package/components/flow.mjs +98 -0
- package/components/form.cjs +1 -1
- package/components/form.mjs +1 -1
- package/components/grid.cjs +1 -1
- package/components/grid.mjs +1 -1
- package/components/icon.cjs +1 -1
- package/components/icon.mjs +1 -1
- package/components/list.cjs +1 -1
- package/components/list.mjs +1 -1
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +1 -1
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +1 -1
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.mjs +1 -1
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +2 -1
- package/components/semantics.cjs +1 -1
- package/components/semantics.d.ts +32 -30
- package/components/semantics.mjs +3 -3
- package/components/skeleton.cjs +1 -1
- package/components/skeleton.d.ts +1 -1
- package/components/skeleton.mjs +3 -1
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +1 -1
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +1 -1
- package/components/svg.cjs +1 -1
- package/components/svg.mjs +14 -14
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +1 -1
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +1 -1
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +1 -1
- package/components/textarea.mjs +1 -1
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +1 -1
- package/components/textbox.mjs +1 -1
- package/components/timeZoneSelect.d.ts +1 -1
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +14 -15
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.mjs +1 -1
- package/components/virtualList.cjs +1 -1
- package/components/virtualList.mjs +1 -1
- package/components/visuallyHidden.cjs +1 -1
- package/components/visuallyHidden.mjs +1 -1
- package/docs/a11y.md +1 -2
- package/docs/components.md +1 -0
- package/docs/index.md +1 -1
- package/docs/props.md +1 -1
- package/effects.cjs +1 -1
- package/effects.mjs +2 -2
- package/identity.cjs +1 -1
- package/identity.mjs +5 -7
- package/package.json +50 -36
- package/react/boxClassNames.d.ts +2 -2
- package/react/effects.d.ts +5 -6
- package/react/identity/useIdentifier.d.ts +0 -3
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +42 -3
- package/rsc.cjs +1 -1
- package/rsc.d.ts +1 -0
- package/rsc.mjs +2 -2
- package/utils/catalog/catalogContracts.d.ts +0 -10
- package/utils/flow/flowPalette.d.ts +17 -0
- package/utils/flow/flowUtils.d.ts +47 -0
package/components/combobox.mjs
CHANGED
|
@@ -83,7 +83,7 @@ var S;
|
|
|
83
83
|
var C = S;
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/components/combobox/comboboxChips.tsx
|
|
86
|
-
function
|
|
86
|
+
function w(e) {
|
|
87
87
|
let { selection: t, def: n, display: r, removeLabel: i, onRemove: a, disabled: o, variant: s } = e;
|
|
88
88
|
return /* @__PURE__ */ b(y, { children: t.map((e) => {
|
|
89
89
|
let t = C.labelOf(n, e);
|
|
@@ -124,7 +124,7 @@ function ee(e) {
|
|
|
124
124
|
}
|
|
125
125
|
//#endregion
|
|
126
126
|
//#region src/utils/virtual/virtualUtils.ts
|
|
127
|
-
var
|
|
127
|
+
var T;
|
|
128
128
|
(function(e) {
|
|
129
129
|
let t = e.DEFAULT_OVERSCAN = 4, n = e.DEFAULT_THRESHOLD = 100;
|
|
130
130
|
e.DEFAULT_ITEM_HEIGHT = 36, e.DEFAULT_VIEW_HEIGHT = 248;
|
|
@@ -152,11 +152,11 @@ var w;
|
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
154
|
e.windowFor = a;
|
|
155
|
-
})(
|
|
156
|
-
var
|
|
155
|
+
})(T ||= {});
|
|
156
|
+
var E = T;
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/react/hooks/useVirtualization.ts
|
|
159
|
-
function
|
|
159
|
+
function ee(e) {
|
|
160
160
|
let { count: n, scrollerRef: i, itemHeight: a, viewHeight: o, overscan: s, threshold: c, enabled: l, activeIndex: u } = e, [d, f] = v({
|
|
161
161
|
top: 0,
|
|
162
162
|
at: -1
|
|
@@ -165,7 +165,7 @@ function te(e) {
|
|
|
165
165
|
viewHeight: 0
|
|
166
166
|
}), g = _(null), y = h((e) => {
|
|
167
167
|
g.current = e;
|
|
168
|
-
}, []), b =
|
|
168
|
+
}, []), b = E.shouldVirtualize(n, l, c), x = r(() => {
|
|
169
169
|
let e = i.current, t = g.current;
|
|
170
170
|
if (!e || !t) return;
|
|
171
171
|
let n = t.children, r = n[0], a = n[1], o = a ? a.offsetTop - r.offsetTop : r?.offsetHeight ?? 0, s = e.clientHeight;
|
|
@@ -191,10 +191,10 @@ function te(e) {
|
|
|
191
191
|
top: e.currentTarget.scrollTop,
|
|
192
192
|
at: u ?? -1
|
|
193
193
|
});
|
|
194
|
-
}), C =
|
|
194
|
+
}), C = E.windowFor({
|
|
195
195
|
count: n,
|
|
196
|
-
itemHeight: a ?? (p.itemHeight > 0 ? p.itemHeight :
|
|
197
|
-
viewHeight: o ?? (p.viewHeight > 0 ? p.viewHeight :
|
|
196
|
+
itemHeight: a ?? (p.itemHeight > 0 ? p.itemHeight : E.DEFAULT_ITEM_HEIGHT),
|
|
197
|
+
viewHeight: o ?? (p.viewHeight > 0 ? p.viewHeight : E.DEFAULT_VIEW_HEIGHT),
|
|
198
198
|
scrollTop: d.top,
|
|
199
199
|
overscan: s,
|
|
200
200
|
activeIndex: u === d.at ? -1 : u
|
|
@@ -216,29 +216,29 @@ function te(e) {
|
|
|
216
216
|
}
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/components/combobox/comboboxListbox.tsx
|
|
219
|
-
function
|
|
219
|
+
function te(e, t, n, r) {
|
|
220
220
|
return e ? {
|
|
221
221
|
role: "listbox",
|
|
222
|
-
|
|
222
|
+
...r,
|
|
223
223
|
...t ? { "aria-multiselectable": !0 } : {},
|
|
224
224
|
...n ? { "aria-busy": !0 } : {}
|
|
225
225
|
} : { role: "status" };
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
let { presence: t, rows: r, def: i, display: a, selection: o, multiple: s, activeIndex: c, optionId: l, rowRef: u, onSelect: p } = e, { anchorRef: m, popupRef: g, listboxId: y,
|
|
229
|
-
|
|
230
|
-
}, [
|
|
227
|
+
function ne(e) {
|
|
228
|
+
let { presence: t, rows: r, def: i, display: a, selection: o, multiple: s, activeIndex: c, optionId: l, rowRef: u, onSelect: p } = e, { anchorRef: m, popupRef: g, listboxId: y, name: S, loading: w, loadingText: T, emptyText: E, createLabel: ne, variant: D, itemsProps: O } = e, { virtualize: k } = e, { present: A, ref: re, props: ie } = t, j = (e) => C.keyOf(i, e), [M, ae] = v(!1), N = h((e) => ae(e === "top"), []), P = _(null), oe = h((e) => {
|
|
229
|
+
P.current = e, re(e);
|
|
230
|
+
}, [re]), se = typeof k == "object" ? k : {}, { virtualized: F, startIndex: I, endIndex: ce, offsetY: le, totalHeight: ue, contentRef: de, onScroll: fe } = ee({
|
|
231
231
|
count: r.length,
|
|
232
|
-
scrollerRef:
|
|
233
|
-
enabled: typeof
|
|
232
|
+
scrollerRef: P,
|
|
233
|
+
enabled: typeof k == "boolean" ? k : void 0,
|
|
234
234
|
activeIndex: c,
|
|
235
|
-
...
|
|
236
|
-
}),
|
|
237
|
-
let n =
|
|
235
|
+
...se
|
|
236
|
+
}), L = F ? r.slice(I, ce) : r, R = (e, t) => {
|
|
237
|
+
let n = F ? I + t : t, s = e.kind === "option" && C.isSelected(o, e.row, j), f = C.isRowDisabled(i, e);
|
|
238
238
|
return /* @__PURE__ */ b(d, {
|
|
239
239
|
ref: u(n),
|
|
240
240
|
component: "combobox.item",
|
|
241
|
-
variant: [
|
|
241
|
+
variant: [D, {
|
|
242
242
|
create: e.kind === "create",
|
|
243
243
|
highlighted: n === c
|
|
244
244
|
}],
|
|
@@ -248,7 +248,7 @@ function re(e) {
|
|
|
248
248
|
id: l(n),
|
|
249
249
|
props: {
|
|
250
250
|
role: "option",
|
|
251
|
-
...
|
|
251
|
+
...F ? {
|
|
252
252
|
"aria-setsize": r.length,
|
|
253
253
|
"aria-posinset": n + 1
|
|
254
254
|
} : {},
|
|
@@ -256,8 +256,8 @@ function re(e) {
|
|
|
256
256
|
onMouseDown: (e) => e.preventDefault(),
|
|
257
257
|
onClick: (e) => !f && p(n, e)
|
|
258
258
|
},
|
|
259
|
-
children: e.kind === "create" ?
|
|
260
|
-
}, e.kind === "option" ?
|
|
259
|
+
children: e.kind === "create" ? ne(e.query) : a?.(e.row) ?? C.labelOf(i, e.row)
|
|
260
|
+
}, e.kind === "option" ? j(e.row) : "create");
|
|
261
261
|
};
|
|
262
262
|
return /* @__PURE__ */ b(f, {
|
|
263
263
|
ref: g,
|
|
@@ -266,222 +266,233 @@ function re(e) {
|
|
|
266
266
|
align: "start",
|
|
267
267
|
offset: .5,
|
|
268
268
|
matchWidth: !0,
|
|
269
|
-
onSideChange:
|
|
269
|
+
onSideChange: N,
|
|
270
270
|
children: /* @__PURE__ */ x(n, {
|
|
271
|
-
ref:
|
|
271
|
+
ref: oe,
|
|
272
272
|
component: "combobox.items",
|
|
273
|
-
...
|
|
274
|
-
variant: [
|
|
275
|
-
closed: !
|
|
276
|
-
closedUp: !
|
|
273
|
+
...O,
|
|
274
|
+
variant: [D, {
|
|
275
|
+
closed: !A && !M,
|
|
276
|
+
closedUp: !A && M
|
|
277
277
|
}],
|
|
278
278
|
id: y,
|
|
279
279
|
props: {
|
|
280
|
-
...
|
|
281
|
-
...
|
|
282
|
-
...
|
|
280
|
+
...te(r.length > 0, s, w === !0, S),
|
|
281
|
+
...ie,
|
|
282
|
+
...F ? { onScroll: fe } : {}
|
|
283
283
|
},
|
|
284
|
-
children: [
|
|
285
|
-
ref:
|
|
284
|
+
children: [F ? /* @__PURE__ */ b(n, {
|
|
285
|
+
ref: de,
|
|
286
286
|
component: "combobox.window",
|
|
287
|
-
variant:
|
|
287
|
+
variant: D,
|
|
288
288
|
style: {
|
|
289
|
-
height:
|
|
290
|
-
paddingTop:
|
|
289
|
+
height: ue,
|
|
290
|
+
paddingTop: le
|
|
291
291
|
},
|
|
292
|
-
children:
|
|
293
|
-
}) :
|
|
292
|
+
children: L.map(R)
|
|
293
|
+
}) : L.map(R), r.length === 0 && /* @__PURE__ */ b(n, {
|
|
294
294
|
component: "combobox.message",
|
|
295
|
-
variant:
|
|
296
|
-
children:
|
|
295
|
+
variant: D,
|
|
296
|
+
children: w ? T : E
|
|
297
297
|
})]
|
|
298
298
|
})
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
//#endregion
|
|
302
302
|
//#region src/components/combobox.tsx
|
|
303
|
-
var
|
|
303
|
+
var D = /* @__PURE__ */ new Set([
|
|
304
304
|
" ",
|
|
305
305
|
"Home",
|
|
306
306
|
"End",
|
|
307
307
|
"ArrowLeft",
|
|
308
308
|
"ArrowRight"
|
|
309
309
|
]);
|
|
310
|
-
function
|
|
311
|
-
let { data: S, def:
|
|
312
|
-
|
|
313
|
-
}, [m]),
|
|
314
|
-
|
|
315
|
-
}),
|
|
316
|
-
value:
|
|
317
|
-
defaultValue: () => C.toArray(
|
|
318
|
-
onChange:
|
|
310
|
+
function O(f, m) {
|
|
311
|
+
let { data: S, def: T, label: E, labelProps: ee, placeholder: te, name: O, disabled: k, props: A, itemsProps: re, hideIcon: ie, filter: j = C.filterRows, loading: M, loadingText: ae = "Loading...", emptyText: N = "No results", createRow: P, createLabel: oe = (e) => `Create "${e}"`, removeLabel: se = (e) => `Remove ${e}`, virtualize: F, query: I, defaultQuery: ce, onQueryChange: le, open: ue, defaultOpen: de, onOpenChange: fe, multiple: L = !1, value: R, defaultValue: pe, onValueChange: me, id: he, ...z } = f, B = s("combobox"), ge = he ?? A?.id ?? `${B}-field`, _e = `${B}-listbox`, ve = `${B}-label`, ye = E != null && E !== !1, be = h((e) => `${B}-option-${e}`, [B]), V = _(null), xe = _(null), H = _(null), Se = h((t) => {
|
|
312
|
+
H.current = t, e(m, t);
|
|
313
|
+
}, [m]), Ce = r((e, t) => {
|
|
314
|
+
me?.(L ? e : e[0] ?? null, t);
|
|
315
|
+
}), we = g(() => R === void 0 ? void 0 : C.toArray(R), [R]), [U, Te] = c({
|
|
316
|
+
value: we,
|
|
317
|
+
defaultValue: () => C.toArray(pe),
|
|
318
|
+
onChange: Ce,
|
|
319
319
|
interaction: {
|
|
320
320
|
component: "combobox",
|
|
321
321
|
type: "valueChange",
|
|
322
322
|
content: ["value"]
|
|
323
323
|
}
|
|
324
|
-
}), [
|
|
325
|
-
value:
|
|
326
|
-
defaultValue:
|
|
327
|
-
onChange:
|
|
324
|
+
}), [W, G] = c({
|
|
325
|
+
value: ue,
|
|
326
|
+
defaultValue: de ?? !1,
|
|
327
|
+
onChange: fe,
|
|
328
328
|
interaction: {
|
|
329
329
|
component: "combobox",
|
|
330
330
|
type: "openChange"
|
|
331
331
|
}
|
|
332
|
-
}), [
|
|
333
|
-
value:
|
|
334
|
-
defaultValue:
|
|
335
|
-
onChange:
|
|
336
|
-
}), [
|
|
332
|
+
}), [Ee, K] = i({
|
|
333
|
+
value: I,
|
|
334
|
+
defaultValue: ce ?? "",
|
|
335
|
+
onChange: le
|
|
336
|
+
}), [De, q] = v(!1), J = h((e) => C.keyOf(T, e), [T]), Oe = L || U[0] === void 0 ? "" : C.labelOf(T, U[0]), Y = De || Ee !== "" ? Ee : Oe, X = g(() => C.rowsFor({
|
|
337
337
|
data: S,
|
|
338
|
-
def:
|
|
339
|
-
query:
|
|
340
|
-
filter:
|
|
341
|
-
typed:
|
|
342
|
-
createRow:
|
|
338
|
+
def: T,
|
|
339
|
+
query: Y,
|
|
340
|
+
filter: j,
|
|
341
|
+
typed: De,
|
|
342
|
+
createRow: P
|
|
343
343
|
}), [
|
|
344
344
|
S,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
]),
|
|
351
|
-
|
|
345
|
+
T,
|
|
346
|
+
Y,
|
|
347
|
+
j,
|
|
348
|
+
De,
|
|
349
|
+
P
|
|
350
|
+
]), ke = h((e) => X[e] ? C.isRowDisabled(T, X[e]) : !1, [X, T]), Ae = r((e, t) => {
|
|
351
|
+
G(!1, {
|
|
352
352
|
reason: e,
|
|
353
353
|
event: t
|
|
354
|
-
}), e !== "escape" && (
|
|
354
|
+
}), e !== "escape" && (q(!1), K("", {
|
|
355
355
|
reason: "close",
|
|
356
356
|
event: t
|
|
357
357
|
}));
|
|
358
|
-
}),
|
|
359
|
-
let n =
|
|
360
|
-
if (!n ||
|
|
361
|
-
let r = n.kind === "create" ?
|
|
358
|
+
}), Z = r((e, t) => {
|
|
359
|
+
let n = X[e];
|
|
360
|
+
if (!n || ke(e)) return;
|
|
361
|
+
let r = n.kind === "create" ? P?.(n.query) : n.row;
|
|
362
362
|
if (r == null) return;
|
|
363
|
-
let i = C.isSelected(
|
|
364
|
-
|
|
363
|
+
let i = C.isSelected(U, r, J), a = n.kind === "create" ? "create" : i && L ? "deselect" : "select";
|
|
364
|
+
Te(C.toggle(U, r, L, J), {
|
|
365
365
|
reason: a,
|
|
366
366
|
event: t
|
|
367
|
-
}),
|
|
367
|
+
}), q(!1), K("", {
|
|
368
368
|
reason: "select",
|
|
369
369
|
event: t
|
|
370
|
-
}),
|
|
370
|
+
}), L || G(!1, {
|
|
371
371
|
reason: "select",
|
|
372
372
|
event: t
|
|
373
373
|
});
|
|
374
|
-
}),
|
|
375
|
-
count:
|
|
374
|
+
}), je = o({
|
|
375
|
+
count: X.length,
|
|
376
376
|
focusItems: !1,
|
|
377
377
|
defaultActiveIndex: -1,
|
|
378
|
-
isDisabled:
|
|
379
|
-
onSelect:
|
|
380
|
-
}), { activeIndex:
|
|
378
|
+
isDisabled: ke,
|
|
379
|
+
onSelect: Z
|
|
380
|
+
}), { activeIndex: Q, setActiveIndex: Me, activeItem: Ne } = je;
|
|
381
381
|
a({
|
|
382
|
-
enabled:
|
|
383
|
-
inside: [
|
|
384
|
-
onDismiss: (e, t) =>
|
|
382
|
+
enabled: W,
|
|
383
|
+
inside: [V, xe],
|
|
384
|
+
onDismiss: (e, t) => Ae(e === "escape" ? "escape" : "outside-pointer", t)
|
|
385
385
|
}), t(() => {
|
|
386
|
-
!
|
|
386
|
+
!W || Q === -1 || Ne()?.scrollIntoView?.({ block: "nearest" });
|
|
387
|
+
}, [
|
|
388
|
+
W,
|
|
389
|
+
Q,
|
|
390
|
+
Ne
|
|
391
|
+
]);
|
|
392
|
+
let $ = ye ? ve : A?.["aria-labelledby"], Pe = A?.["aria-label"], [Fe, Ie] = v();
|
|
393
|
+
t(() => {
|
|
394
|
+
if (!W || $ || Pe) return;
|
|
395
|
+
let e = Array.from(H.current?.labels ?? [], (e) => e.textContent?.trim() ?? "").filter(Boolean).join(" ") || void 0;
|
|
396
|
+
e !== Fe && Ie(e);
|
|
387
397
|
}, [
|
|
388
|
-
|
|
398
|
+
W,
|
|
389
399
|
$,
|
|
390
|
-
|
|
400
|
+
Pe,
|
|
401
|
+
Fe
|
|
391
402
|
]);
|
|
392
|
-
let
|
|
393
|
-
|
|
403
|
+
let Le = $ ? { "aria-labelledby": $ } : { "aria-label": Pe ?? Fe }, Re = (e, t, n) => {
|
|
404
|
+
G(!0, {
|
|
394
405
|
reason: n,
|
|
395
406
|
event: t
|
|
396
407
|
});
|
|
397
|
-
let r = e === "none" ? -1 : C.activeIndexFor(
|
|
398
|
-
|
|
408
|
+
let r = e === "none" ? -1 : C.activeIndexFor(X, U, T, e);
|
|
409
|
+
Me(r, {
|
|
399
410
|
reason: "programmatic",
|
|
400
411
|
event: t
|
|
401
412
|
});
|
|
402
|
-
},
|
|
403
|
-
|
|
413
|
+
}, ze = r((e) => {
|
|
414
|
+
q(!0), K(e.target.value, {
|
|
404
415
|
reason: "input",
|
|
405
416
|
event: e
|
|
406
|
-
}),
|
|
417
|
+
}), W || G(!0, {
|
|
407
418
|
reason: "input",
|
|
408
419
|
event: e
|
|
409
|
-
}),
|
|
420
|
+
}), Me(-1, {
|
|
410
421
|
reason: "programmatic",
|
|
411
422
|
event: e
|
|
412
423
|
});
|
|
413
|
-
}),
|
|
414
|
-
|
|
424
|
+
}), Be = r((e, t) => {
|
|
425
|
+
Te(U.filter((t) => J(t) !== J(e)), {
|
|
415
426
|
reason: "remove",
|
|
416
427
|
event: t
|
|
417
428
|
});
|
|
418
|
-
}),
|
|
429
|
+
}), Ve = (e) => {
|
|
419
430
|
let { key: t } = e;
|
|
420
431
|
if (t === "ArrowDown" || t === "ArrowUp") {
|
|
421
|
-
e.preventDefault(),
|
|
432
|
+
e.preventDefault(), Re(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first", e, "trigger");
|
|
422
433
|
return;
|
|
423
434
|
}
|
|
424
|
-
t === "Escape" &&
|
|
435
|
+
t === "Escape" && Y !== "" && (q(!0), K("", {
|
|
425
436
|
reason: "clear",
|
|
426
437
|
event: e
|
|
427
438
|
}));
|
|
428
|
-
},
|
|
429
|
-
if (
|
|
430
|
-
if (e.key === "Backspace" &&
|
|
431
|
-
|
|
439
|
+
}, He = r((e) => {
|
|
440
|
+
if (A?.onKeyDown?.(e), !(e.defaultPrevented || k)) {
|
|
441
|
+
if (e.key === "Backspace" && L && Y === "" && U.length > 0) {
|
|
442
|
+
Be(U[U.length - 1], e);
|
|
432
443
|
return;
|
|
433
444
|
}
|
|
434
|
-
if (!
|
|
435
|
-
|
|
445
|
+
if (!W) {
|
|
446
|
+
Ve(e);
|
|
436
447
|
return;
|
|
437
448
|
}
|
|
438
449
|
if (e.key === "Tab") {
|
|
439
|
-
|
|
450
|
+
Q !== -1 && Z(Q, e), Ae("tab", e);
|
|
440
451
|
return;
|
|
441
452
|
}
|
|
442
453
|
if (e.altKey && e.key === "ArrowUp") {
|
|
443
|
-
e.preventDefault(),
|
|
454
|
+
e.preventDefault(), Q === -1 ? Ae("trigger", e) : Z(Q, e);
|
|
444
455
|
return;
|
|
445
456
|
}
|
|
446
|
-
if (
|
|
447
|
-
|
|
457
|
+
if (D.has(e.key)) {
|
|
458
|
+
Me(-1, {
|
|
448
459
|
reason: "programmatic",
|
|
449
460
|
event: e
|
|
450
461
|
});
|
|
451
462
|
return;
|
|
452
463
|
}
|
|
453
|
-
|
|
464
|
+
je.onKeyDown(e);
|
|
454
465
|
}
|
|
455
|
-
}),
|
|
456
|
-
!
|
|
457
|
-
}),
|
|
458
|
-
|
|
459
|
-
}),
|
|
466
|
+
}), Ue = r((e) => {
|
|
467
|
+
!k && !W && Re("first", e, "trigger");
|
|
468
|
+
}), We = r((e) => {
|
|
469
|
+
k || e.target === H.current || (e.preventDefault(), H.current?.focus(), W || Re("first", e, "trigger"));
|
|
470
|
+
}), Ge = X.length > 0 || M === !0 || N !== null, Ke = W && Q !== -1 && X.length > 0 ? be(Q) : void 0, qe = /* @__PURE__ */ b(n, {
|
|
460
471
|
tag: "input",
|
|
461
472
|
component: "combobox.field",
|
|
462
|
-
ref:
|
|
463
|
-
id:
|
|
464
|
-
disabled:
|
|
473
|
+
ref: Se,
|
|
474
|
+
id: ge,
|
|
475
|
+
disabled: k,
|
|
465
476
|
props: {
|
|
466
|
-
...
|
|
477
|
+
...A,
|
|
467
478
|
role: "combobox",
|
|
468
479
|
"aria-autocomplete": "list",
|
|
469
|
-
"aria-expanded":
|
|
470
|
-
"aria-controls":
|
|
471
|
-
"aria-activedescendant":
|
|
472
|
-
"aria-labelledby":
|
|
480
|
+
"aria-expanded": W,
|
|
481
|
+
"aria-controls": W && Ge ? _e : void 0,
|
|
482
|
+
"aria-activedescendant": Ke,
|
|
483
|
+
"aria-labelledby": $,
|
|
473
484
|
autoComplete: "off",
|
|
474
485
|
spellCheck: !1,
|
|
475
486
|
type: "text",
|
|
476
|
-
value:
|
|
477
|
-
placeholder:
|
|
478
|
-
onChange:
|
|
479
|
-
onKeyDown:
|
|
480
|
-
onClick:
|
|
487
|
+
value: Y,
|
|
488
|
+
placeholder: te,
|
|
489
|
+
onChange: ze,
|
|
490
|
+
onKeyDown: He,
|
|
491
|
+
onClick: Ue
|
|
481
492
|
}
|
|
482
|
-
}),
|
|
493
|
+
}), Je = !ie && /* @__PURE__ */ b(d, {
|
|
483
494
|
component: "combobox.icon",
|
|
484
|
-
rotate:
|
|
495
|
+
rotate: W ? 180 : 0,
|
|
485
496
|
props: { "aria-hidden": !0 },
|
|
486
497
|
children: /* @__PURE__ */ b(u, {
|
|
487
498
|
viewBox: "0 0 10 6",
|
|
@@ -495,62 +506,62 @@ function D(f, m) {
|
|
|
495
506
|
strokeLinejoin: "round"
|
|
496
507
|
})
|
|
497
508
|
})
|
|
498
|
-
}),
|
|
509
|
+
}), Ye = O === void 0 ? null : U.map((e) => /* @__PURE__ */ b(n, {
|
|
499
510
|
tag: "input",
|
|
500
511
|
props: {
|
|
501
512
|
type: "hidden",
|
|
502
|
-
name:
|
|
503
|
-
value: String(
|
|
513
|
+
name: O,
|
|
514
|
+
value: String(J(e))
|
|
504
515
|
}
|
|
505
|
-
},
|
|
506
|
-
present:
|
|
507
|
-
children: (e) => /* @__PURE__ */ b(
|
|
516
|
+
}, J(e))), Xe = Ge && /* @__PURE__ */ b(p, {
|
|
517
|
+
present: W,
|
|
518
|
+
children: (e) => /* @__PURE__ */ b(ne, {
|
|
508
519
|
presence: e,
|
|
509
|
-
rows:
|
|
510
|
-
def:
|
|
511
|
-
display:
|
|
512
|
-
selection:
|
|
513
|
-
multiple:
|
|
514
|
-
activeIndex:
|
|
515
|
-
optionId:
|
|
516
|
-
rowRef: (e) =>
|
|
517
|
-
onSelect:
|
|
518
|
-
anchorRef:
|
|
519
|
-
popupRef:
|
|
520
|
-
listboxId:
|
|
521
|
-
|
|
522
|
-
loading:
|
|
523
|
-
loadingText:
|
|
524
|
-
emptyText:
|
|
525
|
-
createLabel:
|
|
526
|
-
virtualize:
|
|
527
|
-
variant:
|
|
528
|
-
itemsProps:
|
|
520
|
+
rows: X,
|
|
521
|
+
def: T,
|
|
522
|
+
display: T.display,
|
|
523
|
+
selection: U,
|
|
524
|
+
multiple: L,
|
|
525
|
+
activeIndex: Q,
|
|
526
|
+
optionId: be,
|
|
527
|
+
rowRef: (e) => je.itemProps(e).ref,
|
|
528
|
+
onSelect: Z,
|
|
529
|
+
anchorRef: V,
|
|
530
|
+
popupRef: xe,
|
|
531
|
+
listboxId: _e,
|
|
532
|
+
name: Le,
|
|
533
|
+
loading: M,
|
|
534
|
+
loadingText: ae,
|
|
535
|
+
emptyText: N,
|
|
536
|
+
createLabel: oe,
|
|
537
|
+
virtualize: F,
|
|
538
|
+
variant: z.variant,
|
|
539
|
+
itemsProps: re
|
|
529
540
|
})
|
|
530
|
-
}),
|
|
531
|
-
ref:
|
|
541
|
+
}), Ze = /* @__PURE__ */ x(d, {
|
|
542
|
+
ref: V,
|
|
532
543
|
component: "combobox",
|
|
533
544
|
ai: "center",
|
|
534
545
|
gap: 1,
|
|
535
546
|
flexWrap: "wrap",
|
|
536
|
-
...
|
|
537
|
-
props: { onPointerDown:
|
|
547
|
+
...z,
|
|
548
|
+
props: { onPointerDown: We },
|
|
538
549
|
children: [
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
selection:
|
|
542
|
-
def:
|
|
543
|
-
display:
|
|
544
|
-
removeLabel:
|
|
545
|
-
onRemove:
|
|
546
|
-
disabled:
|
|
547
|
-
variant:
|
|
550
|
+
Ye,
|
|
551
|
+
L && /* @__PURE__ */ b(w, {
|
|
552
|
+
selection: U,
|
|
553
|
+
def: T,
|
|
554
|
+
display: T.display,
|
|
555
|
+
removeLabel: se,
|
|
556
|
+
onRemove: Be,
|
|
557
|
+
disabled: k,
|
|
558
|
+
variant: z.variant
|
|
548
559
|
}),
|
|
549
|
-
|
|
550
|
-
|
|
560
|
+
qe,
|
|
561
|
+
Je
|
|
551
562
|
]
|
|
552
563
|
});
|
|
553
|
-
return
|
|
564
|
+
return ye ? /* @__PURE__ */ x(d, {
|
|
554
565
|
d: "column",
|
|
555
566
|
gap: 1,
|
|
556
567
|
width: "fit-content",
|
|
@@ -558,17 +569,17 @@ function D(f, m) {
|
|
|
558
569
|
/* @__PURE__ */ b(n, {
|
|
559
570
|
tag: "label",
|
|
560
571
|
component: "combobox.label",
|
|
561
|
-
id:
|
|
562
|
-
...
|
|
563
|
-
props: { htmlFor:
|
|
564
|
-
children:
|
|
572
|
+
id: ve,
|
|
573
|
+
...ee,
|
|
574
|
+
props: { htmlFor: ge },
|
|
575
|
+
children: E
|
|
565
576
|
}),
|
|
566
|
-
|
|
567
|
-
|
|
577
|
+
Ze,
|
|
578
|
+
Xe
|
|
568
579
|
]
|
|
569
|
-
}) : /* @__PURE__ */ x(y, { children: [
|
|
580
|
+
}) : /* @__PURE__ */ x(y, { children: [Ze, Xe] });
|
|
570
581
|
}
|
|
571
|
-
var
|
|
572
|
-
|
|
582
|
+
var k = m(O);
|
|
583
|
+
k.displayName = "Combobox";
|
|
573
584
|
//#endregion
|
|
574
|
-
export { C as ComboboxUtils,
|
|
585
|
+
export { C as ComboboxUtils, k as default };
|