@box-kite/react 2.2.7 → 2.2.8
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/BOX_AI_CONTEXT.md +76 -0
- package/BOX_KITE_AI_CONTEXT.md +76 -0
- package/analytics.cjs +1 -0
- package/analytics.d.ts +10 -0
- package/analytics.mjs +121 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +42 -38
- package/box.cjs +1 -1
- package/box.d.ts +9 -0
- package/box.mjs +17 -16
- package/catalog.cjs +1 -1
- package/catalog.mjs +8 -0
- package/client.cjs +1 -1
- package/client.mjs +120 -120
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +19 -10
- package/components/agent.cjs +1 -1
- package/components/agent.mjs +21 -8
- package/components/calendar.cjs +1 -1
- package/components/calendar.d.ts +3 -1
- package/components/calendar.mjs +154 -142
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +184 -174
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +183 -170
- package/components/dataGrid/models/columnModel.d.ts +1 -0
- package/components/dataGrid/models/gridModel.d.ts +18 -0
- package/components/dataGrid/models/rangeModel.d.ts +3 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +987 -896
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +165 -159
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +198 -183
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +38 -33
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +107 -93
- package/components/form.cjs +1 -1
- package/components/form.mjs +22 -18
- package/components/menu.cjs +1 -1
- package/components/menu.d.ts +2 -0
- package/components/menu.mjs +196 -175
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +7 -7
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +4 -0
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +10 -5
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +84 -83
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +158 -150
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +92 -84
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +10 -5
- package/components/timeZoneSelect.cjs +1 -1
- package/components/timeZoneSelect.mjs +40 -35
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +151 -113
- package/dataGridDateParts.cjs +1 -1
- package/dataGridDateParts.mjs +56 -55
- package/dataGridList.cjs +1 -1
- package/dataGridList.mjs +430 -429
- package/effects.cjs +1 -1
- package/effects.mjs +1 -1
- package/interactionListening.cjs +1 -0
- package/interactionListening.mjs +117 -0
- package/interactions.cjs +1 -0
- package/interactions.mjs +25 -0
- package/layer.cjs +1 -1
- package/layer.mjs +68 -66
- package/package.json +132 -68
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +44 -25
- package/react/interactions/interactions.d.ts +30 -0
- package/react/popover/usePopoverLayer.d.ts +3 -0
- package/react/useStyles.d.ts +8 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +49 -48
- package/reporting.cjs +1 -0
- package/reporting.mjs +51 -0
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/supabase/functions/collect/index.d.ts +30 -0
- package/supabase/functions/collect/index.test.d.ts +1 -0
- package/utils/analytics/analytics.d.ts +72 -0
- package/utils/analytics/analyticsIdentity.d.ts +13 -0
- package/utils/interactions/componentAttribute.d.ts +6 -0
- package/utils/interactions/interactionChannel.d.ts +35 -0
- package/utils/interactions/interactionJson.d.ts +6 -0
- package/utils/interactions/interactionListening.d.ts +6 -0
- package/utils/interactions/interactionTypes.d.ts +224 -0
package/components/combobox.mjs
CHANGED
|
@@ -3,14 +3,15 @@ import { n as e } from "../effects.mjs";
|
|
|
3
3
|
import t from "../box.mjs";
|
|
4
4
|
import { a as n, i as r, r as i, t as a } from "../behavior.mjs";
|
|
5
5
|
import { t as o } from "../identity.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import l from "./
|
|
8
|
-
import u from "./
|
|
9
|
-
import d from "./
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
6
|
+
import { a as s } from "../reporting.mjs";
|
|
7
|
+
import { Path as c, Svg as l } from "./svg.mjs";
|
|
8
|
+
import u from "./flex.mjs";
|
|
9
|
+
import d from "./overlay.mjs";
|
|
10
|
+
import f from "./presence.mjs";
|
|
11
|
+
import { forwardRef as p, useCallback as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
12
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
12
13
|
//#region src/utils/combobox/comboboxUtils.ts
|
|
13
|
-
var
|
|
14
|
+
var x;
|
|
14
15
|
(function(e) {
|
|
15
16
|
function t(e, t) {
|
|
16
17
|
return typeof e == "function" ? e(t) : t[e];
|
|
@@ -77,23 +78,23 @@ var b;
|
|
|
77
78
|
return (i === "last" ? s[s.length - 1] : s[0]) ?? -1;
|
|
78
79
|
}
|
|
79
80
|
e.activeIndexFor = m;
|
|
80
|
-
})(
|
|
81
|
-
var
|
|
81
|
+
})(x ||= {});
|
|
82
|
+
var S = x;
|
|
82
83
|
//#endregion
|
|
83
84
|
//#region src/components/combobox/comboboxChips.tsx
|
|
84
|
-
function
|
|
85
|
-
let { selection: t, def: n, display: r, removeLabel: i, onRemove: a, disabled: o, variant:
|
|
86
|
-
return /* @__PURE__ */ v
|
|
87
|
-
let t =
|
|
88
|
-
return /* @__PURE__ */
|
|
85
|
+
function C(e) {
|
|
86
|
+
let { selection: t, def: n, display: r, removeLabel: i, onRemove: a, disabled: o, variant: s } = e;
|
|
87
|
+
return /* @__PURE__ */ y(v, { children: t.map((e) => {
|
|
88
|
+
let t = S.labelOf(n, e);
|
|
89
|
+
return /* @__PURE__ */ b(u, {
|
|
89
90
|
component: "combobox.chip",
|
|
90
|
-
variant:
|
|
91
|
+
variant: s,
|
|
91
92
|
ai: "center",
|
|
92
93
|
gap: 1,
|
|
93
|
-
children: [r?.(e) ?? t, !o && /* @__PURE__ */
|
|
94
|
+
children: [r?.(e) ?? t, !o && /* @__PURE__ */ y(u, {
|
|
94
95
|
tag: "button",
|
|
95
96
|
component: "combobox.remove",
|
|
96
|
-
variant:
|
|
97
|
+
variant: s,
|
|
97
98
|
ai: "center",
|
|
98
99
|
jc: "center",
|
|
99
100
|
props: {
|
|
@@ -105,11 +106,11 @@ function S(e) {
|
|
|
105
106
|
t.stopPropagation(), a(e, t);
|
|
106
107
|
}
|
|
107
108
|
},
|
|
108
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ y(l, {
|
|
109
110
|
viewBox: "0 0 24 24",
|
|
110
111
|
width: "0.625rem",
|
|
111
112
|
props: { fill: "none" },
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ y(c, {
|
|
113
114
|
d: "M6 6 18 18M18 6 6 18",
|
|
114
115
|
stroke: "currentColor",
|
|
115
116
|
strokeWidth: 3,
|
|
@@ -117,12 +118,12 @@ function S(e) {
|
|
|
117
118
|
})
|
|
118
119
|
})
|
|
119
120
|
})]
|
|
120
|
-
},
|
|
121
|
+
}, S.keyOf(n, e));
|
|
121
122
|
}) });
|
|
122
123
|
}
|
|
123
124
|
//#endregion
|
|
124
125
|
//#region src/utils/virtual/virtualUtils.ts
|
|
125
|
-
var
|
|
126
|
+
var w;
|
|
126
127
|
(function(e) {
|
|
127
128
|
let t = e.DEFAULT_OVERSCAN = 4, n = e.DEFAULT_THRESHOLD = 100;
|
|
128
129
|
e.DEFAULT_ITEM_HEIGHT = 36, e.DEFAULT_VIEW_HEIGHT = 248;
|
|
@@ -150,24 +151,24 @@ var C;
|
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
153
|
e.windowFor = a;
|
|
153
|
-
})(
|
|
154
|
-
var
|
|
154
|
+
})(w ||= {});
|
|
155
|
+
var T = w;
|
|
155
156
|
//#endregion
|
|
156
157
|
//#region src/react/hooks/useVirtualization.ts
|
|
157
158
|
function ee(t) {
|
|
158
|
-
let { count: r, scrollerRef: i, itemHeight: a, viewHeight: o, overscan: s, threshold: c, enabled: l, activeIndex: u } = t, [d, f] =
|
|
159
|
+
let { count: r, scrollerRef: i, itemHeight: a, viewHeight: o, overscan: s, threshold: c, enabled: l, activeIndex: u } = t, [d, f] = _({
|
|
159
160
|
top: 0,
|
|
160
161
|
at: -1
|
|
161
|
-
}), [
|
|
162
|
+
}), [p, h] = _({
|
|
162
163
|
itemHeight: 0,
|
|
163
164
|
viewHeight: 0
|
|
164
|
-
}), v =
|
|
165
|
+
}), v = g(null), y = m((e) => {
|
|
165
166
|
v.current = e;
|
|
166
|
-
}, []), b =
|
|
167
|
+
}, []), b = T.shouldVirtualize(r, l, c), x = n(() => {
|
|
167
168
|
let e = i.current, t = v.current;
|
|
168
169
|
if (!e || !t) return;
|
|
169
170
|
let n = t.children, r = n[0], a = n[1], o = a ? a.offsetTop - r.offsetTop : r?.offsetHeight ?? 0, s = e.clientHeight;
|
|
170
|
-
|
|
171
|
+
h((e) => e.itemHeight === o && e.viewHeight === s ? e : {
|
|
171
172
|
itemHeight: o,
|
|
172
173
|
viewHeight: s
|
|
173
174
|
});
|
|
@@ -189,10 +190,10 @@ function ee(t) {
|
|
|
189
190
|
top: e.currentTarget.scrollTop,
|
|
190
191
|
at: u ?? -1
|
|
191
192
|
});
|
|
192
|
-
}), C =
|
|
193
|
+
}), C = T.windowFor({
|
|
193
194
|
count: r,
|
|
194
|
-
itemHeight: a ?? (
|
|
195
|
-
viewHeight: o ?? (
|
|
195
|
+
itemHeight: a ?? (p.itemHeight > 0 ? p.itemHeight : T.DEFAULT_ITEM_HEIGHT),
|
|
196
|
+
viewHeight: o ?? (p.viewHeight > 0 ? p.viewHeight : T.DEFAULT_VIEW_HEIGHT),
|
|
196
197
|
scrollTop: d.top,
|
|
197
198
|
overscan: s,
|
|
198
199
|
activeIndex: u === d.at ? -1 : u
|
|
@@ -223,17 +224,17 @@ function te(e, t, n, r) {
|
|
|
223
224
|
} : { role: "status" };
|
|
224
225
|
}
|
|
225
226
|
function ne(e) {
|
|
226
|
-
let { presence: n, rows: r, def: i, display: a, selection: o, multiple: s, activeIndex: c, optionId:
|
|
227
|
-
|
|
228
|
-
}, [
|
|
227
|
+
let { presence: n, rows: r, def: i, display: a, selection: o, multiple: s, activeIndex: c, optionId: l, rowRef: f, onSelect: p } = e, { anchorRef: h, popupRef: v, listboxId: x, labelledBy: C, loading: w, loadingText: T, emptyText: ne, createLabel: re, variant: E, itemsProps: D } = e, { virtualize: O } = e, { present: ie, ref: ae, props: k } = n, A = (e) => S.keyOf(i, e), [oe, j] = _(!1), M = m((e) => j(e === "top"), []), N = g(null), se = m((e) => {
|
|
228
|
+
N.current = e, ae(e);
|
|
229
|
+
}, [ae]), ce = typeof O == "object" ? O : {}, { virtualized: P, startIndex: le, endIndex: ue, offsetY: de, totalHeight: fe, contentRef: pe, onScroll: F } = ee({
|
|
229
230
|
count: r.length,
|
|
230
|
-
scrollerRef:
|
|
231
|
+
scrollerRef: N,
|
|
231
232
|
enabled: typeof O == "boolean" ? O : void 0,
|
|
232
233
|
activeIndex: c,
|
|
233
|
-
...
|
|
234
|
-
}), I =
|
|
235
|
-
let n =
|
|
236
|
-
return /* @__PURE__ */
|
|
234
|
+
...ce
|
|
235
|
+
}), I = P ? r.slice(le, ue) : r, L = (e, t) => {
|
|
236
|
+
let n = P ? le + t : t, s = e.kind === "option" && S.isSelected(o, e.row, A), d = S.isRowDisabled(i, e);
|
|
237
|
+
return /* @__PURE__ */ y(u, {
|
|
237
238
|
ref: f(n),
|
|
238
239
|
component: "combobox.item",
|
|
239
240
|
variant: [E, {
|
|
@@ -243,55 +244,55 @@ function ne(e) {
|
|
|
243
244
|
selected: s,
|
|
244
245
|
ai: "center",
|
|
245
246
|
gap: 2,
|
|
246
|
-
id:
|
|
247
|
+
id: l(n),
|
|
247
248
|
props: {
|
|
248
249
|
role: "option",
|
|
249
|
-
...
|
|
250
|
+
...P ? {
|
|
250
251
|
"aria-setsize": r.length,
|
|
251
252
|
"aria-posinset": n + 1
|
|
252
253
|
} : {},
|
|
253
|
-
...
|
|
254
|
+
...d ? { "aria-disabled": !0 } : {},
|
|
254
255
|
onMouseDown: (e) => e.preventDefault(),
|
|
255
|
-
onClick: (e) => !
|
|
256
|
+
onClick: (e) => !d && p(n, e)
|
|
256
257
|
},
|
|
257
|
-
children: e.kind === "create" ?
|
|
258
|
-
}, e.kind === "option" ?
|
|
258
|
+
children: e.kind === "create" ? re(e.query) : a?.(e.row) ?? S.labelOf(i, e.row)
|
|
259
|
+
}, e.kind === "option" ? A(e.row) : "create");
|
|
259
260
|
};
|
|
260
|
-
return /* @__PURE__ */
|
|
261
|
-
ref:
|
|
262
|
-
anchor:
|
|
261
|
+
return /* @__PURE__ */ y(d, {
|
|
262
|
+
ref: v,
|
|
263
|
+
anchor: h,
|
|
263
264
|
side: "bottom",
|
|
264
265
|
align: "start",
|
|
265
266
|
offset: .5,
|
|
266
267
|
matchWidth: !0,
|
|
267
|
-
onSideChange:
|
|
268
|
-
children: /* @__PURE__ */
|
|
269
|
-
ref:
|
|
268
|
+
onSideChange: M,
|
|
269
|
+
children: /* @__PURE__ */ b(t, {
|
|
270
|
+
ref: se,
|
|
270
271
|
component: "combobox.items",
|
|
271
272
|
...D,
|
|
272
273
|
variant: [E, {
|
|
273
|
-
closed: !ie && !
|
|
274
|
-
closedUp: !ie &&
|
|
274
|
+
closed: !ie && !oe,
|
|
275
|
+
closedUp: !ie && oe
|
|
275
276
|
}],
|
|
276
|
-
id:
|
|
277
|
+
id: x,
|
|
277
278
|
props: {
|
|
278
279
|
...te(r.length > 0, s, w === !0, C),
|
|
279
|
-
...
|
|
280
|
-
...
|
|
280
|
+
...k,
|
|
281
|
+
...P ? { onScroll: F } : {}
|
|
281
282
|
},
|
|
282
|
-
children: [
|
|
283
|
-
ref:
|
|
283
|
+
children: [P ? /* @__PURE__ */ y(t, {
|
|
284
|
+
ref: pe,
|
|
284
285
|
component: "combobox.window",
|
|
285
286
|
variant: E,
|
|
286
287
|
style: {
|
|
287
|
-
height:
|
|
288
|
-
paddingTop:
|
|
288
|
+
height: fe,
|
|
289
|
+
paddingTop: de
|
|
289
290
|
},
|
|
290
291
|
children: I.map(L)
|
|
291
|
-
}) : I.map(L), r.length === 0 && /* @__PURE__ */
|
|
292
|
+
}) : I.map(L), r.length === 0 && /* @__PURE__ */ y(t, {
|
|
292
293
|
component: "combobox.message",
|
|
293
294
|
variant: E,
|
|
294
|
-
children: w ?
|
|
295
|
+
children: w ? T : ne
|
|
295
296
|
})]
|
|
296
297
|
})
|
|
297
298
|
});
|
|
@@ -305,91 +306,100 @@ var re = /* @__PURE__ */ new Set([
|
|
|
305
306
|
"ArrowLeft",
|
|
306
307
|
"ArrowRight"
|
|
307
308
|
]);
|
|
308
|
-
function
|
|
309
|
-
let { data:
|
|
310
|
-
|
|
311
|
-
}, [
|
|
312
|
-
|
|
313
|
-
}),
|
|
314
|
-
value:
|
|
315
|
-
defaultValue: () =>
|
|
316
|
-
onChange:
|
|
317
|
-
|
|
309
|
+
function E(d, p) {
|
|
310
|
+
let { data: x, def: w, label: T, labelProps: ee, placeholder: te, name: E, disabled: D, props: O, itemsProps: ie, hideIcon: ae, filter: k = S.filterRows, loading: A, loadingText: oe = "Loading...", emptyText: j = "No results", createRow: M, createLabel: N = (e) => `Create "${e}"`, removeLabel: se = (e) => `Remove ${e}`, virtualize: ce, query: P, defaultQuery: le, onQueryChange: ue, open: de, defaultOpen: fe, onOpenChange: pe, multiple: F = !1, value: I, defaultValue: L, onValueChange: me, ...R } = d, z = o("combobox"), he = R.id ?? `${z}-field`, ge = `${z}-listbox`, _e = `${z}-label`, B = T != null && T !== !1, ve = m((e) => `${z}-option-${e}`, [z]), V = g(null), ye = g(null), H = g(null), be = m((e) => {
|
|
311
|
+
H.current = e, typeof p == "function" ? p(e) : p && (p.current = e);
|
|
312
|
+
}, [p]), xe = n((e, t) => {
|
|
313
|
+
me?.(F ? e : e[0] ?? null, t);
|
|
314
|
+
}), Se = h(() => I === void 0 ? void 0 : S.toArray(I), [I]), [U, Ce] = s({
|
|
315
|
+
value: Se,
|
|
316
|
+
defaultValue: () => S.toArray(L),
|
|
317
|
+
onChange: xe,
|
|
318
|
+
interaction: {
|
|
319
|
+
component: "combobox",
|
|
320
|
+
type: "valueChange",
|
|
321
|
+
content: ["value"]
|
|
322
|
+
}
|
|
323
|
+
}), [W, G] = s({
|
|
318
324
|
value: de,
|
|
319
325
|
defaultValue: fe ?? !1,
|
|
320
|
-
onChange: pe
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
326
|
+
onChange: pe,
|
|
327
|
+
interaction: {
|
|
328
|
+
component: "combobox",
|
|
329
|
+
type: "openChange"
|
|
330
|
+
}
|
|
331
|
+
}), [we, K] = r({
|
|
332
|
+
value: P,
|
|
333
|
+
defaultValue: le ?? "",
|
|
324
334
|
onChange: ue
|
|
325
|
-
}), [
|
|
326
|
-
data:
|
|
327
|
-
def:
|
|
328
|
-
query:
|
|
335
|
+
}), [q, J] = _(!1), Y = m((e) => S.keyOf(w, e), [w]), Te = F || U[0] === void 0 ? "" : S.labelOf(w, U[0]), X = q || we !== "" ? we : Te, Z = h(() => S.rowsFor({
|
|
336
|
+
data: x,
|
|
337
|
+
def: w,
|
|
338
|
+
query: X,
|
|
329
339
|
filter: k,
|
|
330
|
-
typed:
|
|
340
|
+
typed: q,
|
|
331
341
|
createRow: M
|
|
332
342
|
}), [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
343
|
+
x,
|
|
344
|
+
w,
|
|
345
|
+
X,
|
|
336
346
|
k,
|
|
337
|
-
|
|
347
|
+
q,
|
|
338
348
|
M
|
|
339
|
-
]), Ee =
|
|
349
|
+
]), Ee = m((e) => Z[e] ? S.isRowDisabled(w, Z[e]) : !1, [Z, w]), De = n((e, t) => {
|
|
340
350
|
G(!1, {
|
|
341
351
|
reason: e,
|
|
342
352
|
event: t
|
|
343
|
-
}), e !== "escape" && (
|
|
353
|
+
}), e !== "escape" && (J(!1), K("", {
|
|
344
354
|
reason: "close",
|
|
345
355
|
event: t
|
|
346
356
|
}));
|
|
347
|
-
}),
|
|
348
|
-
let n =
|
|
357
|
+
}), Q = n((e, t) => {
|
|
358
|
+
let n = Z[e];
|
|
349
359
|
if (!n || Ee(e)) return;
|
|
350
360
|
let r = n.kind === "create" ? M?.(n.query) : n.row;
|
|
351
361
|
if (r == null) return;
|
|
352
|
-
let i =
|
|
353
|
-
|
|
362
|
+
let i = S.isSelected(U, r, Y), a = n.kind === "create" ? "create" : i && F ? "deselect" : "select";
|
|
363
|
+
Ce(S.toggle(U, r, F, Y), {
|
|
354
364
|
reason: a,
|
|
355
365
|
event: t
|
|
356
|
-
}),
|
|
366
|
+
}), J(!1), K("", {
|
|
357
367
|
reason: "select",
|
|
358
368
|
event: t
|
|
359
|
-
}),
|
|
369
|
+
}), F || G(!1, {
|
|
360
370
|
reason: "select",
|
|
361
371
|
event: t
|
|
362
372
|
});
|
|
363
373
|
}), Oe = a({
|
|
364
|
-
count:
|
|
374
|
+
count: Z.length,
|
|
365
375
|
focusItems: !1,
|
|
366
376
|
defaultActiveIndex: -1,
|
|
367
377
|
isDisabled: Ee,
|
|
368
|
-
onSelect:
|
|
369
|
-
}), { activeIndex:
|
|
378
|
+
onSelect: Q
|
|
379
|
+
}), { activeIndex: $, setActiveIndex: ke, activeItem: Ae } = Oe;
|
|
370
380
|
i({
|
|
371
381
|
enabled: W,
|
|
372
|
-
inside: [
|
|
382
|
+
inside: [V, ye],
|
|
373
383
|
onDismiss: (e, t) => De(e === "escape" ? "escape" : "outside-pointer", t)
|
|
374
384
|
}), e(() => {
|
|
375
|
-
!W ||
|
|
385
|
+
!W || $ === -1 || Ae()?.scrollIntoView?.({ block: "nearest" });
|
|
376
386
|
}, [
|
|
377
387
|
W,
|
|
378
|
-
|
|
388
|
+
$,
|
|
379
389
|
Ae
|
|
380
390
|
]);
|
|
381
|
-
let
|
|
391
|
+
let je = (e, t, n) => {
|
|
382
392
|
G(!0, {
|
|
383
393
|
reason: n,
|
|
384
394
|
event: t
|
|
385
395
|
});
|
|
386
|
-
let r = e === "none" ? -1 :
|
|
396
|
+
let r = e === "none" ? -1 : S.activeIndexFor(Z, U, w, e);
|
|
387
397
|
ke(r, {
|
|
388
398
|
reason: "programmatic",
|
|
389
399
|
event: t
|
|
390
400
|
});
|
|
391
|
-
},
|
|
392
|
-
|
|
401
|
+
}, Me = n((e) => {
|
|
402
|
+
J(!0), K(e.target.value, {
|
|
393
403
|
reason: "input",
|
|
394
404
|
event: e
|
|
395
405
|
}), W || G(!0, {
|
|
@@ -399,37 +409,37 @@ function T(u, f) {
|
|
|
399
409
|
reason: "programmatic",
|
|
400
410
|
event: e
|
|
401
411
|
});
|
|
402
|
-
}),
|
|
403
|
-
|
|
412
|
+
}), Ne = n((e, t) => {
|
|
413
|
+
Ce(U.filter((t) => Y(t) !== Y(e)), {
|
|
404
414
|
reason: "remove",
|
|
405
415
|
event: t
|
|
406
416
|
});
|
|
407
|
-
}),
|
|
417
|
+
}), Pe = (e) => {
|
|
408
418
|
let { key: t } = e;
|
|
409
419
|
if (t === "ArrowDown" || t === "ArrowUp") {
|
|
410
|
-
e.preventDefault(),
|
|
420
|
+
e.preventDefault(), je(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first", e, "trigger");
|
|
411
421
|
return;
|
|
412
422
|
}
|
|
413
|
-
t === "Escape" &&
|
|
423
|
+
t === "Escape" && X !== "" && (J(!0), K("", {
|
|
414
424
|
reason: "clear",
|
|
415
425
|
event: e
|
|
416
426
|
}));
|
|
417
|
-
},
|
|
418
|
-
if (
|
|
419
|
-
if (e.key === "Backspace" &&
|
|
420
|
-
|
|
427
|
+
}, Fe = n((e) => {
|
|
428
|
+
if (O?.onKeyDown?.(e), !(e.defaultPrevented || D)) {
|
|
429
|
+
if (e.key === "Backspace" && F && X === "" && U.length > 0) {
|
|
430
|
+
Ne(U[U.length - 1], e);
|
|
421
431
|
return;
|
|
422
432
|
}
|
|
423
433
|
if (!W) {
|
|
424
|
-
|
|
434
|
+
Pe(e);
|
|
425
435
|
return;
|
|
426
436
|
}
|
|
427
437
|
if (e.key === "Tab") {
|
|
428
|
-
|
|
438
|
+
$ !== -1 && Q($, e), De("tab", e);
|
|
429
439
|
return;
|
|
430
440
|
}
|
|
431
441
|
if (e.altKey && e.key === "ArrowUp") {
|
|
432
|
-
e.preventDefault(),
|
|
442
|
+
e.preventDefault(), $ === -1 ? De("trigger", e) : Q($, e);
|
|
433
443
|
return;
|
|
434
444
|
}
|
|
435
445
|
if (re.has(e.key)) {
|
|
@@ -441,42 +451,42 @@ function T(u, f) {
|
|
|
441
451
|
}
|
|
442
452
|
Oe.onKeyDown(e);
|
|
443
453
|
}
|
|
444
|
-
}), Fe = n((e) => {
|
|
445
|
-
!E && !W && $("first", e, "trigger");
|
|
446
454
|
}), Ie = n((e) => {
|
|
447
|
-
|
|
448
|
-
}), Le =
|
|
455
|
+
!D && !W && je("first", e, "trigger");
|
|
456
|
+
}), Le = n((e) => {
|
|
457
|
+
D || e.target === H.current || (e.preventDefault(), H.current?.focus(), W || je("first", e, "trigger"));
|
|
458
|
+
}), Re = Z.length > 0 || A === !0 || j !== null, ze = W && $ !== -1 && Z.length > 0 ? ve($) : void 0, Be = /* @__PURE__ */ y(t, {
|
|
449
459
|
tag: "input",
|
|
450
460
|
component: "combobox.field",
|
|
451
|
-
ref:
|
|
452
|
-
id:
|
|
453
|
-
disabled:
|
|
461
|
+
ref: be,
|
|
462
|
+
id: he,
|
|
463
|
+
disabled: D,
|
|
454
464
|
props: {
|
|
455
|
-
...
|
|
465
|
+
...O,
|
|
456
466
|
role: "combobox",
|
|
457
467
|
"aria-autocomplete": "list",
|
|
458
468
|
"aria-expanded": W,
|
|
459
|
-
"aria-controls": W &&
|
|
460
|
-
"aria-activedescendant":
|
|
461
|
-
"aria-labelledby":
|
|
469
|
+
"aria-controls": W && Re ? ge : void 0,
|
|
470
|
+
"aria-activedescendant": ze,
|
|
471
|
+
"aria-labelledby": B ? _e : O?.["aria-labelledby"],
|
|
462
472
|
autoComplete: "off",
|
|
463
473
|
spellCheck: !1,
|
|
464
474
|
type: "text",
|
|
465
|
-
value:
|
|
475
|
+
value: X,
|
|
466
476
|
placeholder: te,
|
|
467
|
-
onChange:
|
|
468
|
-
onKeyDown:
|
|
469
|
-
onClick:
|
|
477
|
+
onChange: Me,
|
|
478
|
+
onKeyDown: Fe,
|
|
479
|
+
onClick: Ie
|
|
470
480
|
}
|
|
471
|
-
}),
|
|
481
|
+
}), Ve = !ae && /* @__PURE__ */ y(u, {
|
|
472
482
|
component: "combobox.icon",
|
|
473
483
|
rotate: W ? 180 : 0,
|
|
474
484
|
props: { "aria-hidden": !0 },
|
|
475
|
-
children: /* @__PURE__ */
|
|
485
|
+
children: /* @__PURE__ */ y(l, {
|
|
476
486
|
viewBox: "0 0 10 6",
|
|
477
487
|
width: "0.6rem",
|
|
478
488
|
props: { fill: "none" },
|
|
479
|
-
children: /* @__PURE__ */
|
|
489
|
+
children: /* @__PURE__ */ y(c, {
|
|
480
490
|
d: "m1 1 4 4 4-4",
|
|
481
491
|
stroke: "currentColor",
|
|
482
492
|
strokeWidth: 2,
|
|
@@ -484,80 +494,80 @@ function T(u, f) {
|
|
|
484
494
|
strokeLinejoin: "round"
|
|
485
495
|
})
|
|
486
496
|
})
|
|
487
|
-
}),
|
|
497
|
+
}), He = E === void 0 ? null : U.map((e) => /* @__PURE__ */ y(t, {
|
|
488
498
|
tag: "input",
|
|
489
499
|
props: {
|
|
490
500
|
type: "hidden",
|
|
491
|
-
name:
|
|
492
|
-
value: String(
|
|
501
|
+
name: E,
|
|
502
|
+
value: String(Y(e))
|
|
493
503
|
}
|
|
494
|
-
},
|
|
504
|
+
}, Y(e))), Ue = Re && /* @__PURE__ */ y(f, {
|
|
495
505
|
present: W,
|
|
496
|
-
children: (e) => /* @__PURE__ */
|
|
506
|
+
children: (e) => /* @__PURE__ */ y(ne, {
|
|
497
507
|
presence: e,
|
|
498
|
-
rows:
|
|
499
|
-
def:
|
|
500
|
-
display:
|
|
508
|
+
rows: Z,
|
|
509
|
+
def: w,
|
|
510
|
+
display: w.display,
|
|
501
511
|
selection: U,
|
|
502
|
-
multiple:
|
|
503
|
-
activeIndex:
|
|
504
|
-
optionId:
|
|
512
|
+
multiple: F,
|
|
513
|
+
activeIndex: $,
|
|
514
|
+
optionId: ve,
|
|
505
515
|
rowRef: (e) => Oe.itemProps(e).ref,
|
|
506
|
-
onSelect:
|
|
507
|
-
anchorRef:
|
|
508
|
-
popupRef:
|
|
509
|
-
listboxId:
|
|
510
|
-
labelledBy:
|
|
516
|
+
onSelect: Q,
|
|
517
|
+
anchorRef: V,
|
|
518
|
+
popupRef: ye,
|
|
519
|
+
listboxId: ge,
|
|
520
|
+
labelledBy: B ? _e : he,
|
|
511
521
|
loading: A,
|
|
512
|
-
loadingText:
|
|
522
|
+
loadingText: oe,
|
|
513
523
|
emptyText: j,
|
|
514
|
-
createLabel:
|
|
524
|
+
createLabel: N,
|
|
515
525
|
virtualize: ce,
|
|
516
526
|
variant: R.variant,
|
|
517
|
-
itemsProps:
|
|
527
|
+
itemsProps: ie
|
|
518
528
|
})
|
|
519
|
-
}),
|
|
520
|
-
ref:
|
|
529
|
+
}), We = /* @__PURE__ */ b(u, {
|
|
530
|
+
ref: V,
|
|
521
531
|
component: "combobox",
|
|
522
532
|
ai: "center",
|
|
523
533
|
gap: 1,
|
|
524
534
|
flexWrap: "wrap",
|
|
525
535
|
...R,
|
|
526
|
-
props: { onPointerDown:
|
|
536
|
+
props: { onPointerDown: Le },
|
|
527
537
|
children: [
|
|
528
|
-
|
|
529
|
-
|
|
538
|
+
He,
|
|
539
|
+
F && /* @__PURE__ */ y(C, {
|
|
530
540
|
selection: U,
|
|
531
|
-
def:
|
|
532
|
-
display:
|
|
541
|
+
def: w,
|
|
542
|
+
display: w.display,
|
|
533
543
|
removeLabel: se,
|
|
534
|
-
onRemove:
|
|
535
|
-
disabled:
|
|
544
|
+
onRemove: Ne,
|
|
545
|
+
disabled: D,
|
|
536
546
|
variant: R.variant
|
|
537
547
|
}),
|
|
538
|
-
|
|
539
|
-
|
|
548
|
+
Be,
|
|
549
|
+
Ve
|
|
540
550
|
]
|
|
541
551
|
});
|
|
542
|
-
return
|
|
552
|
+
return B ? /* @__PURE__ */ b(u, {
|
|
543
553
|
d: "column",
|
|
544
554
|
gap: 1,
|
|
545
555
|
width: "fit-content",
|
|
546
556
|
children: [
|
|
547
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ y(t, {
|
|
548
558
|
tag: "label",
|
|
549
559
|
component: "combobox.label",
|
|
550
|
-
id:
|
|
560
|
+
id: _e,
|
|
551
561
|
...ee,
|
|
552
|
-
props: { htmlFor:
|
|
553
|
-
children:
|
|
562
|
+
props: { htmlFor: he },
|
|
563
|
+
children: T
|
|
554
564
|
}),
|
|
555
|
-
|
|
556
|
-
|
|
565
|
+
We,
|
|
566
|
+
Ue
|
|
557
567
|
]
|
|
558
|
-
}) : /* @__PURE__ */
|
|
568
|
+
}) : /* @__PURE__ */ b(v, { children: [We, Ue] });
|
|
559
569
|
}
|
|
560
|
-
var
|
|
561
|
-
|
|
570
|
+
var D = p(E);
|
|
571
|
+
D.displayName = "Combobox";
|
|
562
572
|
//#endregion
|
|
563
|
-
export {
|
|
573
|
+
export { S as ComboboxUtils, D as default };
|