@box-kite/react 1.0.0 → 2.0.0
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 +23 -1
- package/.claude/skills/box-kite/SKILL.md +134 -427
- package/.claude/skills/box-kite/references/components.md +235 -0
- package/.claude/skills/box-kite/references/extending.md +42 -0
- package/.claude/skills/box-kite/references/patterns.md +27 -0
- package/.claude/skills/box-kite/references/styling.md +222 -0
- package/.cursor/rules/box-kite.mdc +73 -0
- package/AGENTS.md +102 -0
- package/BOX_AI_CONTEXT.md +1124 -153
- package/BOX_KITE_AI_CONTEXT.md +1124 -153
- package/README.md +36 -2
- package/a11y.cjs +1 -1
- package/a11y.d.ts +1 -1
- package/a11y.mjs +3 -2
- package/anchor.cjs +1 -0
- package/anchor.d.ts +14 -0
- package/anchor.mjs +3 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +118 -136
- package/box.cjs +1 -1
- package/box.mjs +1 -1
- package/client.cjs +1 -1
- package/client.mjs +15 -14
- package/components/accordion.cjs +1 -0
- package/components/accordion.d.ts +114 -0
- package/components/accordion.mjs +251 -0
- package/components/button.cjs +1 -1
- package/components/button.d.ts +3 -0
- package/components/button.mjs +1 -1
- package/components/chart.cjs +1 -1
- package/components/chart.d.ts +2 -1
- package/components/chart.mjs +159 -184
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.d.ts +8 -0
- package/components/checkbox.mjs +1 -1
- package/components/combobox/comboboxChips.d.ts +21 -0
- package/components/combobox/comboboxListbox.d.ts +47 -0
- package/components/combobox.cjs +1 -0
- package/components/combobox.d.ts +121 -0
- package/components/combobox.mjs +563 -0
- package/components/dataGrid/components/dataGridAggregateValue.d.ts +10 -0
- package/components/dataGrid/components/dataGridCell.d.ts +2 -1
- package/components/dataGrid/components/dataGridCellEditor.d.ts +15 -0
- package/components/dataGrid/components/dataGridCellPlaceholder.d.ts +14 -0
- package/components/dataGrid/components/dataGridCellTree.d.ts +16 -0
- package/components/dataGrid/components/dataGridDataSourceError.d.ts +12 -0
- package/components/dataGrid/components/dataGridExport.d.ts +10 -0
- package/components/dataGrid/components/dataGridFooter.d.ts +11 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +474 -16
- package/components/dataGrid/export/gridExport.d.ts +10 -0
- package/components/dataGrid/gridNavigationContext.d.ts +9 -1
- package/components/dataGrid/models/aggregateCellModel.d.ts +34 -0
- package/components/dataGrid/models/aggregationModel.d.ts +32 -0
- package/components/dataGrid/models/cellKeys.d.ts +11 -0
- package/components/dataGrid/models/cellModel.d.ts +27 -1
- package/components/dataGrid/models/columnModel.d.ts +12 -2
- package/components/dataGrid/models/dataSourceModel.d.ts +177 -0
- package/components/dataGrid/models/editModel.d.ts +77 -0
- package/components/dataGrid/models/exportModel.d.ts +51 -0
- package/components/dataGrid/models/gridModel.d.ts +108 -21
- package/components/dataGrid/models/groupRowCellModel.d.ts +11 -3
- package/components/dataGrid/models/groupRowModel.d.ts +22 -2
- package/components/dataGrid/models/rowModel.d.ts +13 -1
- package/components/dataGrid/models/sourceGroupRowModel.d.ts +45 -0
- package/components/dataGrid/models/sourceLevel.d.ts +71 -0
- package/components/dataGrid/models/sourceRowModel.d.ts +29 -0
- package/components/dataGrid/models/sourceTreeRowModel.d.ts +23 -0
- package/components/dataGrid/models/treeModel.d.ts +94 -0
- package/components/dataGrid/models/treeRow.d.ts +22 -0
- package/components/dataGrid/models/treeRowModel.d.ts +50 -0
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.d.ts +4 -2
- package/components/dataGrid.mjs +4484 -2755
- package/components/dialog.cjs +1 -0
- package/components/dialog.d.ts +151 -0
- package/components/dialog.mjs +223 -0
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.d.ts +30 -0
- package/components/dropdown.mjs +256 -244
- package/components/icon.cjs +1 -1
- package/components/icon.d.ts +2 -1
- package/components/icon.mjs +3 -3
- package/components/menu.cjs +1 -0
- package/components/menu.d.ts +234 -0
- package/components/menu.mjs +422 -0
- package/components/overlay.cjs +1 -1
- package/components/overlay.d.ts +30 -26
- package/components/overlay.mjs +45 -75
- package/components/popover.cjs +1 -0
- package/components/popover.d.ts +100 -0
- package/components/popover.mjs +69 -0
- package/components/presence.d.ts +6 -0
- package/components/progress.cjs +1 -0
- package/components/progress.d.ts +47 -0
- package/components/progress.mjs +28 -0
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +8 -0
- package/components/radioButton.mjs +1 -1
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.d.ts +15 -2
- package/components/radioGroup.mjs +34 -30
- package/components/select.d.ts +9 -0
- package/components/semantics.cjs +1 -1
- package/components/semantics.d.ts +33 -28
- package/components/semantics.mjs +3 -3
- package/components/slider.cjs +1 -0
- package/components/slider.d.ts +98 -0
- package/components/slider.mjs +250 -0
- package/components/svg.cjs +1 -1
- package/components/svg.d.ts +25 -23
- package/components/svg.mjs +3 -3
- package/components/switch.cjs +1 -1
- package/components/switch.d.ts +9 -0
- package/components/switch.mjs +1 -1
- package/components/tabs.cjs +1 -0
- package/components/tabs.d.ts +87 -0
- package/components/tabs.mjs +324 -0
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +14 -0
- package/components/textarea.mjs +1 -1
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +12 -0
- package/components/textbox.mjs +1 -1
- package/components/toaster.cjs +1 -0
- package/components/toaster.d.ts +106 -0
- package/components/toaster.mjs +295 -0
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +39 -4
- package/components/tooltip.mjs +56 -54
- package/docs/a11y.md +199 -0
- package/docs/anchor.md +139 -0
- package/docs/components.md +48 -0
- package/docs/index.md +11 -0
- package/docs/props.md +1777 -0
- package/effects.cjs +1 -1
- package/effects.mjs +1 -1
- package/gridExport.cjs +2 -0
- package/gridExport.mjs +244 -0
- package/identity.cjs +1 -0
- package/identity.mjs +12 -0
- package/keyboard.cjs +1 -0
- package/keyboard.mjs +30 -0
- package/layer.cjs +1 -0
- package/layer.mjs +127 -0
- package/motion.cjs +1 -1
- package/motion.mjs +1 -1
- package/package.json +134 -10
- package/placement.cjs +1 -0
- package/placement.mjs +180 -0
- package/platform.cjs +1 -1
- package/platform.mjs +18 -5
- package/react/anchor/useAnchorPosition.d.ts +79 -0
- package/react/dialog/useScrollLock.d.ts +12 -0
- package/react/hooks/usePortalContainer.d.ts +6 -1
- package/react/hooks/useVirtualization.d.ts +24 -35
- package/react/popover/usePopoverLayer.d.ts +87 -0
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +19 -2
- package/rsc.cjs +1 -1
- package/rsc.mjs +1 -1
- package/utils/accordion/accordionUtils.d.ts +48 -0
- package/utils/anchor/anchorUtils.d.ts +79 -0
- package/utils/array/lazyList.d.ts +10 -0
- package/utils/chart/chartPalette.d.ts +15 -0
- package/utils/chart/chartUtils.d.ts +2 -8
- package/utils/combobox/comboboxUtils.d.ts +89 -0
- package/utils/dom/domUtils.d.ts +6 -0
- package/utils/environment/environmentUtils.d.ts +10 -0
- package/utils/export/csvUtils.d.ts +23 -0
- package/utils/export/downloadUtils.d.ts +12 -0
- package/utils/export/xlsxUtils.d.ts +56 -0
- package/utils/export/zipUtils.d.ts +26 -0
- package/utils/keyboard/typeaheadUtils.d.ts +31 -0
- package/utils/menu/menuUtils.d.ts +25 -0
- package/utils/slider/sliderUtils.d.ts +67 -0
- package/utils/tabs/tabsUtils.d.ts +75 -0
- package/utils/toast/toastStore.d.ts +73 -0
- package/utils/virtual/virtualUtils.d.ts +47 -0
- /package/react/{a11y → identity}/useIdentifier.d.ts +0 -0
package/components/dropdown.mjs
CHANGED
|
@@ -1,126 +1,121 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { n as e } from "../effects.mjs";
|
|
3
3
|
import t from "../box.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import s from "
|
|
6
|
-
import c from "./
|
|
4
|
+
import { a as n, i as r, n as i, r as a, t as o } from "../behavior.mjs";
|
|
5
|
+
import { t as s } from "../identity.mjs";
|
|
6
|
+
import c from "./baseSvg.mjs";
|
|
7
|
+
import ee from "./button.mjs";
|
|
7
8
|
import l from "./flex.mjs";
|
|
8
9
|
import u from "./checkbox.mjs";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import f from "./
|
|
12
|
-
import { createContext as p, forwardRef as m, memo as h, useCallback as g, useContext as _, useEffect as
|
|
13
|
-
import { Fragment as
|
|
10
|
+
import te from "./overlay.mjs";
|
|
11
|
+
import d from "./presence.mjs";
|
|
12
|
+
import f from "./textbox.mjs";
|
|
13
|
+
import { createContext as p, forwardRef as m, memo as h, useCallback as g, useContext as _, useEffect as ne, useMemo as v, useRef as y, useState as re } from "react";
|
|
14
|
+
import { Fragment as ie, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
14
15
|
//#region src/components/dropdown/dropdownContext.ts
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
let e = _(
|
|
16
|
+
var ae = p(null);
|
|
17
|
+
function S() {
|
|
18
|
+
let e = _(ae);
|
|
18
19
|
if (!e) throw Error("Dropdown sub-components must be used within Dropdown");
|
|
19
20
|
return e;
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
//#region src/components/dropdown/dropdownRowRenderer.tsx
|
|
23
|
-
var
|
|
24
|
+
var C = {
|
|
24
25
|
item: "dropdown.item",
|
|
25
26
|
unselect: "dropdown.unselect",
|
|
26
27
|
selectAll: "dropdown.selectAll"
|
|
27
28
|
};
|
|
28
|
-
function
|
|
29
|
-
let { valueToUse: r, multiple: i, variant: a, showCheckbox: o, selectRow: s, optionId: c, activeIndex:
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
ref:
|
|
32
|
-
component:
|
|
33
|
-
variant: [a,
|
|
29
|
+
function oe({ row: e, index: n }) {
|
|
30
|
+
let { valueToUse: r, multiple: i, variant: a, showCheckbox: o, selectRow: s, optionId: c, activeIndex: ee, rowRef: l, isRowDisabled: te } = S(), d = e.kind === "item", f = te(n), p = d ? r.includes(e.element.props.value) : e.kind === "unselect" && r.length === 0, { value: m, onClick: h, children: g, ..._ } = e.element.props, ne = o && i && d;
|
|
31
|
+
return /* @__PURE__ */ b(t, {
|
|
32
|
+
ref: l(n),
|
|
33
|
+
component: C[e.kind],
|
|
34
|
+
variant: [a, d ? {
|
|
34
35
|
multiple: i,
|
|
35
|
-
highlighted: n ===
|
|
36
|
-
} : { highlighted: n ===
|
|
37
|
-
selected:
|
|
38
|
-
...
|
|
36
|
+
highlighted: n === ee
|
|
37
|
+
} : { highlighted: n === ee }],
|
|
38
|
+
selected: p,
|
|
39
|
+
..._,
|
|
39
40
|
id: c(n),
|
|
40
|
-
children:
|
|
41
|
+
children: ne ? /* @__PURE__ */ x(ie, { children: [/* @__PURE__ */ b(u, {
|
|
41
42
|
readOnly: !0,
|
|
42
|
-
checked:
|
|
43
|
+
checked: p,
|
|
43
44
|
me: 2,
|
|
44
45
|
props: {
|
|
45
46
|
tabIndex: -1,
|
|
46
47
|
"aria-hidden": !0
|
|
47
48
|
}
|
|
48
|
-
}),
|
|
49
|
+
}), g] }) : g,
|
|
49
50
|
props: {
|
|
50
51
|
role: "option",
|
|
51
|
-
...
|
|
52
|
-
...
|
|
53
|
-
onClick:
|
|
54
|
-
|
|
52
|
+
...f ? { "aria-disabled": !0 } : {},
|
|
53
|
+
..._.props,
|
|
54
|
+
onClick: f ? void 0 : (e) => {
|
|
55
|
+
h?.(e), s(n, e);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
var
|
|
60
|
+
var w = h(oe, (e, t) => e.row.element === t.row.element && e.index === t.index);
|
|
60
61
|
//#endregion
|
|
61
62
|
//#region src/components/dropdown/dropdownItems.tsx
|
|
62
|
-
function
|
|
63
|
+
function T(e, t, n) {
|
|
63
64
|
return e ? {
|
|
64
65
|
role: "listbox",
|
|
65
66
|
"aria-labelledby": n,
|
|
66
67
|
...t ? { "aria-multiselectable": !0 } : {}
|
|
67
68
|
} : { role: "status" };
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
let { presence: n, rows: r, emptyItem: i, triggerRef: a, popupRef: o, listboxId: s, labelledBy: c, itemsProps:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}, ae(e, t))), r.length === 0 && i && /* @__PURE__ */ C(t, {
|
|
100
|
-
component: "dropdown.emptyItem",
|
|
101
|
-
variant: m,
|
|
102
|
-
...i.props
|
|
103
|
-
})]
|
|
104
|
-
})
|
|
70
|
+
function se(e) {
|
|
71
|
+
let { presence: n, rows: r, emptyItem: i, triggerRef: a, popupRef: o, listboxId: s, labelledBy: c, itemsProps: ee } = e, { present: l, ref: u, props: d } = n, { multiple: f, variant: p } = S(), [m, h] = re(!1), _ = g((e) => h(e === "top"), []);
|
|
72
|
+
return /* @__PURE__ */ b(te, {
|
|
73
|
+
ref: o,
|
|
74
|
+
anchor: a,
|
|
75
|
+
side: "bottom",
|
|
76
|
+
align: "start",
|
|
77
|
+
offset: .5,
|
|
78
|
+
onSideChange: _,
|
|
79
|
+
children: /* @__PURE__ */ x(t, {
|
|
80
|
+
ref: u,
|
|
81
|
+
component: "dropdown.items",
|
|
82
|
+
...ee,
|
|
83
|
+
variant: [p, {
|
|
84
|
+
closed: !l && !m,
|
|
85
|
+
closedUp: !l && m
|
|
86
|
+
}],
|
|
87
|
+
id: s,
|
|
88
|
+
props: {
|
|
89
|
+
...T(r.length > 0, f, c),
|
|
90
|
+
...d
|
|
91
|
+
},
|
|
92
|
+
children: [r.map((e, t) => /* @__PURE__ */ b(w, {
|
|
93
|
+
row: e,
|
|
94
|
+
index: t
|
|
95
|
+
}, ce(e, t))), r.length === 0 && i && /* @__PURE__ */ b(t, {
|
|
96
|
+
component: "dropdown.emptyItem",
|
|
97
|
+
variant: p,
|
|
98
|
+
...i.props
|
|
99
|
+
})]
|
|
105
100
|
})
|
|
106
101
|
});
|
|
107
102
|
}
|
|
108
|
-
function
|
|
103
|
+
function ce(e, t) {
|
|
109
104
|
return e.kind === "item" ? e.element.props.value : `${e.kind}-${t}`;
|
|
110
105
|
}
|
|
111
|
-
|
|
106
|
+
se.displayName = "DropdownItems";
|
|
112
107
|
//#endregion
|
|
113
108
|
//#region src/components/dropdown/dropdownSearch.tsx
|
|
114
|
-
function
|
|
109
|
+
function le({ id: e, value: t, onValueChange: n, placeholder: r, inputRef: i, comboboxProps: a, onOpen: o }) {
|
|
115
110
|
let s = g((e) => n(e.target.value), [n]), c = g((e) => {
|
|
116
111
|
e.stopPropagation(), o(e);
|
|
117
112
|
}, [o]);
|
|
118
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ b(l, {
|
|
119
114
|
ai: "center",
|
|
120
115
|
position: "absolute",
|
|
121
116
|
inset: 0,
|
|
122
117
|
p: 3,
|
|
123
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ b(f, {
|
|
124
119
|
clean: !0,
|
|
125
120
|
id: e,
|
|
126
121
|
value: t,
|
|
@@ -142,59 +137,64 @@ function oe({ id: e, value: t, onValueChange: n, placeholder: r, inputRef: i, co
|
|
|
142
137
|
}
|
|
143
138
|
//#endregion
|
|
144
139
|
//#region src/components/dropdown/utils.ts
|
|
145
|
-
function
|
|
140
|
+
function ue(e) {
|
|
146
141
|
if (e == null) return "";
|
|
147
142
|
if (typeof e == "object") {
|
|
148
143
|
let t = e.props?.children;
|
|
149
|
-
return t == null ? "" : typeof t == "object" ? (Array.isArray(t) ? t : [t]).map((e) =>
|
|
144
|
+
return t == null ? "" : typeof t == "object" ? (Array.isArray(t) ? t : [t]).map((e) => ue(e)).join("") : t.toString();
|
|
150
145
|
}
|
|
151
146
|
return e.toString();
|
|
152
147
|
}
|
|
153
148
|
//#endregion
|
|
154
149
|
//#region src/components/dropdown.tsx
|
|
155
|
-
function
|
|
150
|
+
function de(e) {
|
|
151
|
+
return e == null ? [] : Array.isArray(e) ? e : [e];
|
|
152
|
+
}
|
|
153
|
+
function fe(e) {
|
|
156
154
|
let t = e?.props?.disabled;
|
|
157
155
|
return (Array.isArray(t) ? t[0] : t) === !0;
|
|
158
156
|
}
|
|
159
|
-
function
|
|
157
|
+
function pe(e) {
|
|
160
158
|
return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
161
159
|
}
|
|
162
|
-
var
|
|
160
|
+
var me = /* @__PURE__ */ new Set([
|
|
163
161
|
" ",
|
|
164
162
|
"Home",
|
|
165
163
|
"End",
|
|
166
164
|
"ArrowLeft",
|
|
167
165
|
"ArrowRight"
|
|
168
166
|
]);
|
|
169
|
-
function
|
|
170
|
-
let { name: p, defaultValue: m, value: h,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
function E(u, te) {
|
|
168
|
+
let { name: p, defaultValue: m, value: h, defaultOpen: _, multiple: S = !1, isSearchable: C, searchPlaceholder: oe, children: w, hideIcon: T, showCheckbox: ce = !1, label: E, labelProps: D, itemsProps: O, iconProps: he, onValueChange: ge, onChange: _e, props: ve, ...k } = u, A = y(void 0), ye = n((e, t) => {
|
|
169
|
+
ge?.(S ? e : e[0], t), _e?.(A.current, e);
|
|
170
|
+
}), be = "value" in u, xe = v(() => be ? de(h) : void 0, [be, h]), [j, M] = r({
|
|
171
|
+
value: xe,
|
|
172
|
+
defaultValue: () => de(m),
|
|
173
|
+
onChange: ye
|
|
174
|
+
}), [Se, Ce] = re(null), [N, P] = re(!!_), F = y(null), we = g((e) => {
|
|
175
175
|
F.current = e;
|
|
176
|
-
}, []),
|
|
177
|
-
P(!1), e ||
|
|
178
|
-
}), z =
|
|
176
|
+
}, []), Te = y(null), I = y(null), L = s("dropdown"), Ee = k.id ?? `${L}-trigger`, De = `${L}-listbox`, Oe = `${L}-label`, ke = E != null && E !== !1, Ae = g((e) => `${L}-option-${e}`, [L]), R = n((e = !1) => {
|
|
177
|
+
P(!1), e || Ce(null);
|
|
178
|
+
}), z = v(() => (Array.isArray(w) ? w : [w]).flatMap((e) => e).filter(Boolean), [w]), B = v(() => z.filter((e) => e.type?.displayName === "DropdownItem"), [z]), je = v(() => {
|
|
179
179
|
let e = /* @__PURE__ */ new Map();
|
|
180
|
-
for (let t of B) e.set(t,
|
|
180
|
+
for (let t of B) e.set(t, ue(t));
|
|
181
181
|
return e;
|
|
182
|
-
}, [B]), V = g((e) =>
|
|
183
|
-
|
|
182
|
+
}, [B]), V = g((e) => je.get(e) ?? ue(e), [je]), Me = C ? Se ?? "" : "", H = v(() => Me ? B.filter((e) => V(e).toLowerCase().includes(Me.toLowerCase())) : B, [
|
|
183
|
+
Me,
|
|
184
184
|
B,
|
|
185
185
|
V
|
|
186
|
-
]), U =
|
|
187
|
-
|
|
186
|
+
]), U = v(() => z.find((e) => e.type?.displayName === "DropdownUnselect"), [z]), W = v(() => z.find((e) => e.type?.displayName === "DropdownSelectAll"), [z]), Ne = v(() => z.find((e) => e.type?.displayName === "DropdownEmptyItem"), [z]), G = v(() => z.find((e) => e.type?.displayName === "DropdownDisplay"), [z]), K = v(() => !C || G ? "" : B.filter((e) => j.includes(e.props.value)).map((e) => V(e)).join(", "), [
|
|
187
|
+
C,
|
|
188
188
|
G,
|
|
189
189
|
B,
|
|
190
|
-
|
|
190
|
+
j,
|
|
191
191
|
V
|
|
192
|
-
]),
|
|
192
|
+
]), Pe = !!(W && S && H.length > j.length), Fe = !!(U && H.length > 0 && !Pe), q = v(() => {
|
|
193
193
|
let e = [];
|
|
194
|
-
|
|
194
|
+
Fe && U && e.push({
|
|
195
195
|
kind: "unselect",
|
|
196
196
|
element: U
|
|
197
|
-
}),
|
|
197
|
+
}), Pe && W && e.push({
|
|
198
198
|
kind: "selectAll",
|
|
199
199
|
element: W
|
|
200
200
|
});
|
|
@@ -204,186 +204,196 @@ function de(u, ee) {
|
|
|
204
204
|
});
|
|
205
205
|
return e;
|
|
206
206
|
}, [
|
|
207
|
-
|
|
207
|
+
Fe,
|
|
208
208
|
U,
|
|
209
|
-
|
|
209
|
+
Pe,
|
|
210
210
|
W,
|
|
211
211
|
H
|
|
212
|
-
]), J = g((e) =>
|
|
212
|
+
]), J = g((e) => fe(q[e]?.element), [q]), Ie = g((e) => {
|
|
213
213
|
let t = q[e];
|
|
214
214
|
return t ? V(t.element) : "";
|
|
215
|
-
}, [q, V]),
|
|
216
|
-
if (
|
|
217
|
-
if (G) return typeof G.props.children == "function" ? G.props.children(
|
|
218
|
-
let e = H.filter((e) =>
|
|
219
|
-
if (
|
|
215
|
+
}, [q, V]), Le = v(() => {
|
|
216
|
+
if (C && (N || K !== "")) return null;
|
|
217
|
+
if (G) return typeof G.props.children == "function" ? G.props.children(j, N) : G.props.children;
|
|
218
|
+
let e = H.filter((e) => j.includes(e.props.value));
|
|
219
|
+
if (S && e.length > 1) return e.map((e) => V(e)).join(", ");
|
|
220
220
|
let t = e.at(0);
|
|
221
|
-
return t?.props.children ?? t?.props.value ?? (
|
|
221
|
+
return t?.props.children ?? t?.props.value ?? (S ? null : U?.props.children);
|
|
222
222
|
}, [
|
|
223
|
-
|
|
223
|
+
S,
|
|
224
224
|
H,
|
|
225
|
-
|
|
225
|
+
j,
|
|
226
226
|
U,
|
|
227
227
|
N,
|
|
228
|
-
|
|
228
|
+
C,
|
|
229
229
|
K,
|
|
230
230
|
G,
|
|
231
231
|
V
|
|
232
|
-
]),
|
|
233
|
-
if (t.length === 0)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
232
|
+
]), Re = g((e, ...t) => {
|
|
233
|
+
if (t.length === 0) A.current = void 0, M([], {
|
|
234
|
+
reason: "clear",
|
|
235
|
+
event: e
|
|
236
|
+
});
|
|
237
|
+
else if (S && t.length > 1) A.current = void 0, M(t.map((e) => e.props.value), {
|
|
238
|
+
reason: "select-all",
|
|
239
|
+
event: e
|
|
240
|
+
});
|
|
241
|
+
else if (t.length === 1) {
|
|
242
|
+
let n = t[0];
|
|
243
|
+
if (A.current = n.props.value, S) {
|
|
244
|
+
let t = j.filter((e) => e !== n.props.value), r = t.length !== j.length;
|
|
245
|
+
r || t.push(n.props.value), M(t, {
|
|
246
|
+
reason: r ? "deselect" : "select",
|
|
247
|
+
event: e
|
|
248
|
+
});
|
|
249
|
+
} else M([n.props.value], {
|
|
250
|
+
reason: "select",
|
|
251
|
+
event: e
|
|
252
|
+
});
|
|
243
253
|
}
|
|
244
|
-
e.stopPropagation(),
|
|
254
|
+
e.stopPropagation(), S ? C && setTimeout(() => I.current?.focus(), 0) : R();
|
|
245
255
|
}, [
|
|
246
|
-
_,
|
|
247
256
|
S,
|
|
257
|
+
C,
|
|
258
|
+
j,
|
|
248
259
|
M,
|
|
249
|
-
k,
|
|
250
260
|
R
|
|
251
|
-
]), Y =
|
|
261
|
+
]), Y = n((e, t) => {
|
|
252
262
|
let n = q[e];
|
|
253
|
-
!n || J(e) || (n.kind === "unselect" ?
|
|
254
|
-
}),
|
|
263
|
+
!n || J(e) || (n.kind === "unselect" ? Re(t) : n.kind === "selectAll" ? Re(t, ...B) : Re(t, n.element));
|
|
264
|
+
}), ze = (e) => {
|
|
265
|
+
let t = e === "first" ? 1 : -1;
|
|
266
|
+
for (let n = e === "first" ? 0 : q.length - 1; n >= 0 && n < q.length; n += t) if (!J(n)) return n;
|
|
267
|
+
return -1;
|
|
268
|
+
}, X = (e) => {
|
|
269
|
+
let t = q.findIndex((e) => e.kind === "item" && j.includes(e.element.props.value));
|
|
270
|
+
return t !== -1 && !J(t) ? t : e === "none" ? -1 : ze(e);
|
|
271
|
+
}, Z = o({
|
|
255
272
|
count: q.length,
|
|
256
273
|
focusItems: !1,
|
|
257
|
-
defaultActiveIndex: -1,
|
|
274
|
+
defaultActiveIndex: _ ? X("none") : -1,
|
|
258
275
|
isDisabled: J,
|
|
259
|
-
textOf:
|
|
276
|
+
textOf: C ? void 0 : Ie,
|
|
260
277
|
onSelect: Y
|
|
261
|
-
}),
|
|
278
|
+
}), Be = Z.setActiveIndex, Ve = g((e) => Be(-1, {
|
|
262
279
|
reason: "programmatic",
|
|
263
280
|
event: e
|
|
264
|
-
}), [
|
|
265
|
-
|
|
281
|
+
}), [Be]);
|
|
282
|
+
a({
|
|
266
283
|
enabled: N,
|
|
267
|
-
inside: [F,
|
|
284
|
+
inside: [F, Te],
|
|
268
285
|
onDismiss: (e) => R(e === "escape")
|
|
269
|
-
}),
|
|
286
|
+
}), i({
|
|
270
287
|
enabled: N,
|
|
271
|
-
returnTo:
|
|
272
|
-
}),
|
|
288
|
+
returnTo: C ? I : F
|
|
289
|
+
}), ne(() => {
|
|
273
290
|
N && I.current?.focus();
|
|
274
291
|
}, [N]);
|
|
275
|
-
let
|
|
292
|
+
let Q = Z.activeIndex, He = Z.activeItem;
|
|
276
293
|
e(() => {
|
|
277
|
-
!N ||
|
|
294
|
+
!N || Q === -1 || He()?.scrollIntoView?.({ block: "nearest" });
|
|
278
295
|
}, [
|
|
279
296
|
N,
|
|
280
|
-
|
|
281
|
-
|
|
297
|
+
Q,
|
|
298
|
+
He
|
|
282
299
|
]);
|
|
283
|
-
let
|
|
284
|
-
|
|
285
|
-
for (let n = e === "first" ? 0 : q.length - 1; n >= 0 && n < q.length; n += t) if (!J(n)) return n;
|
|
286
|
-
return -1;
|
|
287
|
-
}, Q = (e) => {
|
|
288
|
-
let t = q.findIndex((e) => e.kind === "item" && M.includes(e.element.props.value));
|
|
289
|
-
return t !== -1 && !J(t) ? t : e === "none" ? -1 : Fe(e);
|
|
290
|
-
}, $ = (e, t) => {
|
|
291
|
-
P(!0), X.setActiveIndex(e, {
|
|
300
|
+
let $ = (e, t) => {
|
|
301
|
+
P(!0), Z.setActiveIndex(e, {
|
|
292
302
|
reason: "programmatic",
|
|
293
303
|
event: t
|
|
294
304
|
});
|
|
295
|
-
},
|
|
296
|
-
N ? R() : $(
|
|
297
|
-
}),
|
|
298
|
-
N || $(
|
|
299
|
-
}),
|
|
300
|
-
|
|
301
|
-
}),
|
|
305
|
+
}, Ue = n((e) => {
|
|
306
|
+
N ? R() : $(X("none"), e);
|
|
307
|
+
}), We = n((e) => {
|
|
308
|
+
N || $(X("none"), e);
|
|
309
|
+
}), Ge = n((e) => {
|
|
310
|
+
Ce(e), N || P(!0), Ve();
|
|
311
|
+
}), Ke = (e) => {
|
|
302
312
|
let { key: t } = e;
|
|
303
|
-
if (
|
|
313
|
+
if (C) {
|
|
304
314
|
if (t === "ArrowDown" || t === "ArrowUp") {
|
|
305
|
-
e.preventDefault(), $(
|
|
315
|
+
e.preventDefault(), $(X(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first"), e);
|
|
306
316
|
return;
|
|
307
317
|
}
|
|
308
|
-
t === "Escape" &&
|
|
318
|
+
t === "Escape" && Ce("");
|
|
309
319
|
return;
|
|
310
320
|
}
|
|
311
321
|
if (t === "ArrowDown" || t === "Enter" || t === " ") {
|
|
312
|
-
e.preventDefault(), $(
|
|
322
|
+
e.preventDefault(), $(X(e.altKey ? "none" : "first"), e);
|
|
313
323
|
return;
|
|
314
324
|
}
|
|
315
325
|
if (t === "ArrowUp") {
|
|
316
|
-
e.preventDefault(), $(
|
|
326
|
+
e.preventDefault(), $(X("last"), e);
|
|
317
327
|
return;
|
|
318
328
|
}
|
|
319
329
|
if (t === "Home" || t === "End") {
|
|
320
|
-
e.preventDefault(), $(
|
|
330
|
+
e.preventDefault(), $(ze(t === "Home" ? "first" : "last"), e);
|
|
321
331
|
return;
|
|
322
332
|
}
|
|
323
|
-
|
|
324
|
-
},
|
|
325
|
-
if (
|
|
333
|
+
pe(e) && (P(!0), Z.onKeyDown(e));
|
|
334
|
+
}, qe = n((e) => {
|
|
335
|
+
if (ve?.onKeyDown?.(e), !e.defaultPrevented) {
|
|
326
336
|
if (!N) {
|
|
327
|
-
|
|
337
|
+
Ke(e);
|
|
328
338
|
return;
|
|
329
339
|
}
|
|
330
340
|
if (e.key === "Tab") {
|
|
331
|
-
!
|
|
341
|
+
!S && Z.activeIndex !== -1 && Y(Z.activeIndex, e), R();
|
|
332
342
|
return;
|
|
333
343
|
}
|
|
334
344
|
if (e.altKey && e.key === "ArrowUp") {
|
|
335
|
-
e.preventDefault(),
|
|
345
|
+
e.preventDefault(), Z.activeIndex !== -1 && Y(Z.activeIndex, e), R();
|
|
336
346
|
return;
|
|
337
347
|
}
|
|
338
|
-
if (
|
|
339
|
-
|
|
348
|
+
if (C && me.has(e.key)) {
|
|
349
|
+
Ve(e);
|
|
340
350
|
return;
|
|
341
351
|
}
|
|
342
|
-
|
|
352
|
+
Z.onKeyDown(e);
|
|
343
353
|
}
|
|
344
|
-
}),
|
|
345
|
-
valueToUse:
|
|
346
|
-
multiple:
|
|
347
|
-
variant:
|
|
348
|
-
showCheckbox:
|
|
354
|
+
}), Je = q.length > 0 || !!Ne, Ye = N && Q !== -1 && Je ? Ae(Q) : void 0, Xe = Z.itemProps, Ze = v(() => ({
|
|
355
|
+
valueToUse: j,
|
|
356
|
+
multiple: S,
|
|
357
|
+
variant: k.variant,
|
|
358
|
+
showCheckbox: ce,
|
|
349
359
|
selectRow: Y,
|
|
350
|
-
optionId:
|
|
351
|
-
activeIndex:
|
|
352
|
-
rowRef: (e) =>
|
|
360
|
+
optionId: Ae,
|
|
361
|
+
activeIndex: Q,
|
|
362
|
+
rowRef: (e) => Xe(e).ref,
|
|
353
363
|
isRowDisabled: J
|
|
354
364
|
}), [
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
365
|
+
j,
|
|
366
|
+
S,
|
|
367
|
+
k.variant,
|
|
368
|
+
ce,
|
|
359
369
|
Y,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
370
|
+
Ae,
|
|
371
|
+
Q,
|
|
372
|
+
Xe,
|
|
363
373
|
J
|
|
364
|
-
]),
|
|
374
|
+
]), Qe = {
|
|
365
375
|
"aria-expanded": N,
|
|
366
|
-
"aria-controls": N &&
|
|
367
|
-
"aria-activedescendant":
|
|
368
|
-
"aria-labelledby":
|
|
369
|
-
...
|
|
370
|
-
onKeyDown:
|
|
371
|
-
},
|
|
376
|
+
"aria-controls": N && Je ? De : void 0,
|
|
377
|
+
"aria-activedescendant": Ye,
|
|
378
|
+
"aria-labelledby": ke ? Oe : void 0,
|
|
379
|
+
...ve,
|
|
380
|
+
onKeyDown: qe
|
|
381
|
+
}, $e = j.map((e) => {
|
|
372
382
|
let t = JSON.stringify(e);
|
|
373
|
-
return /* @__PURE__ */
|
|
374
|
-
ref:
|
|
383
|
+
return /* @__PURE__ */ b(f, {
|
|
384
|
+
ref: te,
|
|
375
385
|
name: p,
|
|
376
386
|
type: "hidden",
|
|
377
387
|
value: t ?? ""
|
|
378
388
|
}, t);
|
|
379
|
-
}),
|
|
389
|
+
}), et = !T && /* @__PURE__ */ b(l, {
|
|
380
390
|
component: "dropdown.icon",
|
|
381
|
-
...
|
|
382
|
-
children: /* @__PURE__ */
|
|
391
|
+
...he,
|
|
392
|
+
children: /* @__PURE__ */ b(c, {
|
|
383
393
|
viewBox: "0 0 10 6",
|
|
384
394
|
width: "0.6rem",
|
|
385
395
|
rotate: N ? 180 : 0,
|
|
386
|
-
children: /* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ b("path", {
|
|
387
397
|
stroke: "currentColor",
|
|
388
398
|
strokeLinecap: "round",
|
|
389
399
|
strokeLinejoin: "round",
|
|
@@ -391,89 +401,91 @@ function de(u, ee) {
|
|
|
391
401
|
d: "m1 1 4 4 4-4"
|
|
392
402
|
})
|
|
393
403
|
})
|
|
394
|
-
}),
|
|
404
|
+
}), tt = Je && /* @__PURE__ */ b(d, {
|
|
395
405
|
present: N,
|
|
396
|
-
children: (e) => /* @__PURE__ */
|
|
406
|
+
children: (e) => /* @__PURE__ */ b(se, {
|
|
397
407
|
presence: e,
|
|
398
408
|
rows: q,
|
|
399
|
-
emptyItem:
|
|
409
|
+
emptyItem: Ne,
|
|
400
410
|
triggerRef: F,
|
|
401
|
-
popupRef:
|
|
402
|
-
listboxId:
|
|
403
|
-
labelledBy:
|
|
404
|
-
itemsProps:
|
|
411
|
+
popupRef: Te,
|
|
412
|
+
listboxId: De,
|
|
413
|
+
labelledBy: ke ? Oe : Ee,
|
|
414
|
+
itemsProps: O
|
|
405
415
|
})
|
|
406
|
-
}),
|
|
407
|
-
ref:
|
|
416
|
+
}), nt = C ? /* @__PURE__ */ x(t, {
|
|
417
|
+
ref: we,
|
|
408
418
|
component: "dropdown",
|
|
409
|
-
props: { onClick:
|
|
419
|
+
props: { onClick: Ue },
|
|
410
420
|
position: "relative",
|
|
411
|
-
pe:
|
|
421
|
+
pe: T ? void 0 : 6,
|
|
412
422
|
minWidth: N ? 36 : void 0,
|
|
413
423
|
width: "fit-content",
|
|
414
|
-
...
|
|
424
|
+
...k,
|
|
415
425
|
id: void 0,
|
|
416
426
|
children: [
|
|
417
|
-
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
id:
|
|
420
|
-
value:
|
|
421
|
-
onValueChange:
|
|
422
|
-
placeholder: N ?
|
|
427
|
+
$e,
|
|
428
|
+
/* @__PURE__ */ b(le, {
|
|
429
|
+
id: Ee,
|
|
430
|
+
value: Se ?? K,
|
|
431
|
+
onValueChange: Ge,
|
|
432
|
+
placeholder: N ? oe : void 0,
|
|
423
433
|
inputRef: I,
|
|
424
|
-
comboboxProps:
|
|
425
|
-
onOpen:
|
|
434
|
+
comboboxProps: Qe,
|
|
435
|
+
onOpen: We
|
|
426
436
|
}),
|
|
427
|
-
|
|
437
|
+
Le ?? /* @__PURE__ */ b(t, {
|
|
428
438
|
tag: "span",
|
|
429
439
|
visibility: "hidden",
|
|
430
440
|
children: K || "\xA0"
|
|
431
441
|
}),
|
|
432
|
-
|
|
433
|
-
Je
|
|
442
|
+
et
|
|
434
443
|
]
|
|
435
|
-
}) : /* @__PURE__ */
|
|
436
|
-
ref:
|
|
437
|
-
onClick:
|
|
444
|
+
}) : /* @__PURE__ */ x(ee, {
|
|
445
|
+
ref: we,
|
|
446
|
+
onClick: Ue,
|
|
438
447
|
component: "dropdown",
|
|
439
448
|
type: "button",
|
|
440
449
|
props: {
|
|
441
450
|
tabIndex: 0,
|
|
442
451
|
role: "combobox",
|
|
443
|
-
...
|
|
452
|
+
...Qe
|
|
444
453
|
},
|
|
445
454
|
position: "relative",
|
|
446
|
-
pe:
|
|
455
|
+
pe: T ? void 0 : 6,
|
|
447
456
|
width: "fit-content",
|
|
448
|
-
...
|
|
449
|
-
id:
|
|
457
|
+
...k,
|
|
458
|
+
id: Ee,
|
|
450
459
|
children: [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
Je
|
|
460
|
+
$e,
|
|
461
|
+
Le ?? "\xA0",
|
|
462
|
+
et
|
|
455
463
|
]
|
|
456
464
|
});
|
|
457
|
-
return /* @__PURE__ */
|
|
458
|
-
value:
|
|
459
|
-
children:
|
|
465
|
+
return /* @__PURE__ */ b(ae.Provider, {
|
|
466
|
+
value: Ze,
|
|
467
|
+
children: ke ? /* @__PURE__ */ x(l, {
|
|
460
468
|
d: "column",
|
|
461
469
|
gap: 1,
|
|
462
470
|
width: "fit-content",
|
|
463
|
-
...
|
|
464
|
-
children: [
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
471
|
+
...D,
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ b(t, {
|
|
474
|
+
tag: "span",
|
|
475
|
+
id: Oe,
|
|
476
|
+
children: E
|
|
477
|
+
}),
|
|
478
|
+
nt,
|
|
479
|
+
tt
|
|
480
|
+
]
|
|
481
|
+
}) : /* @__PURE__ */ x(ie, { children: [nt, tt] })
|
|
470
482
|
});
|
|
471
483
|
}
|
|
472
|
-
function
|
|
484
|
+
function D(e) {
|
|
473
485
|
let t = (e) => null;
|
|
474
486
|
return t.displayName = e, t;
|
|
475
487
|
}
|
|
476
|
-
var
|
|
477
|
-
|
|
488
|
+
var O = m(E);
|
|
489
|
+
O.Item = D("DropdownItem"), O.Unselect = D("DropdownUnselect"), O.SelectAll = D("DropdownSelectAll"), O.EmptyItem = D("DropdownEmptyItem"), O.Display = D("DropdownDisplay"), O.displayName = "Dropdown";
|
|
478
490
|
//#endregion
|
|
479
|
-
export {
|
|
491
|
+
export { O as default };
|