@box-kite/react 0.0.1 → 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.
Files changed (280) hide show
  1. package/.claude/rules/box-kite-rules.md +65 -0
  2. package/.claude/skills/box-kite/SKILL.md +138 -0
  3. package/.claude/skills/box-kite/references/components.md +235 -0
  4. package/.claude/skills/box-kite/references/extending.md +42 -0
  5. package/.claude/skills/box-kite/references/patterns.md +27 -0
  6. package/.claude/skills/box-kite/references/styling.md +222 -0
  7. package/.cursor/rules/box-kite.mdc +73 -0
  8. package/AGENTS.md +102 -0
  9. package/BOX_AI_CONTEXT.md +2804 -0
  10. package/BOX_KITE_AI_CONTEXT.md +2804 -0
  11. package/LICENSE +21 -0
  12. package/README.md +744 -7
  13. package/a11y.cjs +1 -0
  14. package/a11y.d.ts +15 -0
  15. package/a11y.mjs +4 -0
  16. package/anchor.cjs +1 -0
  17. package/anchor.d.ts +14 -0
  18. package/anchor.mjs +3 -0
  19. package/behavior.cjs +1 -0
  20. package/behavior.mjs +277 -0
  21. package/box.cjs +1 -0
  22. package/box.d.ts +46 -0
  23. package/box.mjs +23 -0
  24. package/client.cjs +1 -0
  25. package/client.mjs +164 -0
  26. package/components/accordion.cjs +1 -0
  27. package/components/accordion.d.ts +114 -0
  28. package/components/accordion.mjs +251 -0
  29. package/components/baseSvg.cjs +1 -0
  30. package/components/baseSvg.d.ts +5 -0
  31. package/components/baseSvg.mjs +21 -0
  32. package/components/button.cjs +1 -0
  33. package/components/button.d.ts +19 -0
  34. package/components/button.mjs +19 -0
  35. package/components/chart.cjs +1 -0
  36. package/components/chart.d.ts +83 -0
  37. package/components/chart.mjs +236 -0
  38. package/components/checkbox.cjs +1 -0
  39. package/components/checkbox.d.ts +36 -0
  40. package/components/checkbox.mjs +38 -0
  41. package/components/combobox/comboboxChips.d.ts +21 -0
  42. package/components/combobox/comboboxListbox.d.ts +47 -0
  43. package/components/combobox.cjs +1 -0
  44. package/components/combobox.d.ts +121 -0
  45. package/components/combobox.mjs +563 -0
  46. package/components/dataGrid/components/dataGridAggregateValue.d.ts +10 -0
  47. package/components/dataGrid/components/dataGridBody.d.ts +7 -0
  48. package/components/dataGrid/components/dataGridBottomBar.d.ts +6 -0
  49. package/components/dataGrid/components/dataGridCell.d.ts +16 -0
  50. package/components/dataGrid/components/dataGridCellEditor.d.ts +15 -0
  51. package/components/dataGrid/components/dataGridCellPlaceholder.d.ts +14 -0
  52. package/components/dataGrid/components/dataGridCellRowDetail.d.ts +6 -0
  53. package/components/dataGrid/components/dataGridCellRowSelection.d.ts +6 -0
  54. package/components/dataGrid/components/dataGridCellText.d.ts +6 -0
  55. package/components/dataGrid/components/dataGridCellTree.d.ts +16 -0
  56. package/components/dataGrid/components/dataGridColumnFilter.d.ts +9 -0
  57. package/components/dataGrid/components/dataGridColumnGroups.d.ts +7 -0
  58. package/components/dataGrid/components/dataGridContent.d.ts +6 -0
  59. package/components/dataGrid/components/dataGridDataSourceError.d.ts +12 -0
  60. package/components/dataGrid/components/dataGridDetailRow.d.ts +8 -0
  61. package/components/dataGrid/components/dataGridEmptyColumns.d.ts +6 -0
  62. package/components/dataGrid/components/dataGridExport.d.ts +10 -0
  63. package/components/dataGrid/components/dataGridFilterCell.d.ts +11 -0
  64. package/components/dataGrid/components/dataGridFilterRow.d.ts +6 -0
  65. package/components/dataGrid/components/dataGridFooter.d.ts +11 -0
  66. package/components/dataGrid/components/dataGridGlobalFilter.d.ts +6 -0
  67. package/components/dataGrid/components/dataGridGroupRow.d.ts +8 -0
  68. package/components/dataGrid/components/dataGridHeader.d.ts +6 -0
  69. package/components/dataGrid/components/dataGridHeaderCell.d.ts +9 -0
  70. package/components/dataGrid/components/dataGridHeaderCellContextMenu.d.ts +11 -0
  71. package/components/dataGrid/components/dataGridHeaderCellResizer.d.ts +14 -0
  72. package/components/dataGrid/components/dataGridLoader.d.ts +11 -0
  73. package/components/dataGrid/components/dataGridPagination.d.ts +6 -0
  74. package/components/dataGrid/components/dataGridRow.d.ts +8 -0
  75. package/components/dataGrid/components/dataGridTopBar.d.ts +6 -0
  76. package/components/dataGrid/components/dataGridTopBarContextMenu.d.ts +6 -0
  77. package/components/dataGrid/contracts/dataGridContract.d.ts +671 -0
  78. package/components/dataGrid/export/gridExport.d.ts +10 -0
  79. package/components/dataGrid/gridNavigationContext.d.ts +32 -0
  80. package/components/dataGrid/models/aggregateCellModel.d.ts +34 -0
  81. package/components/dataGrid/models/aggregationModel.d.ts +32 -0
  82. package/components/dataGrid/models/cellKeys.d.ts +11 -0
  83. package/components/dataGrid/models/cellModel.d.ts +44 -0
  84. package/components/dataGrid/models/columnModel.d.ts +160 -0
  85. package/components/dataGrid/models/columnVisibilityModel.d.ts +24 -0
  86. package/components/dataGrid/models/dataSourceModel.d.ts +177 -0
  87. package/components/dataGrid/models/detailRowModel.d.ts +22 -0
  88. package/components/dataGrid/models/editModel.d.ts +77 -0
  89. package/components/dataGrid/models/exportModel.d.ts +51 -0
  90. package/components/dataGrid/models/filterModel.d.ts +22 -0
  91. package/components/dataGrid/models/gridModel.d.ts +293 -0
  92. package/components/dataGrid/models/groupRowCellModel.d.ts +34 -0
  93. package/components/dataGrid/models/groupRowModel.d.ts +68 -0
  94. package/components/dataGrid/models/headerCellModel.d.ts +83 -0
  95. package/components/dataGrid/models/paginationModel.d.ts +32 -0
  96. package/components/dataGrid/models/rowModel.d.ts +46 -0
  97. package/components/dataGrid/models/sourceGroupRowModel.d.ts +45 -0
  98. package/components/dataGrid/models/sourceLevel.d.ts +71 -0
  99. package/components/dataGrid/models/sourceRowModel.d.ts +29 -0
  100. package/components/dataGrid/models/sourceTreeRowModel.d.ts +23 -0
  101. package/components/dataGrid/models/treeModel.d.ts +94 -0
  102. package/components/dataGrid/models/treeRow.d.ts +22 -0
  103. package/components/dataGrid/models/treeRowModel.d.ts +50 -0
  104. package/components/dataGrid/models/viewportModel.d.ts +44 -0
  105. package/components/dataGrid/useGrid.d.ts +8 -0
  106. package/components/dataGrid/useGridNavigation.d.ts +21 -0
  107. package/components/dataGrid.cjs +1 -0
  108. package/components/dataGrid.d.ts +4 -0
  109. package/components/dataGrid.mjs +4907 -0
  110. package/components/dialog.cjs +1 -0
  111. package/components/dialog.d.ts +151 -0
  112. package/components/dialog.mjs +223 -0
  113. package/components/dropdown/dropdownContext.d.ts +44 -0
  114. package/components/dropdown/dropdownItems.d.ts +22 -0
  115. package/components/dropdown/dropdownRowRenderer.d.ts +8 -0
  116. package/components/dropdown/dropdownSearch.d.ts +21 -0
  117. package/components/dropdown/utils.d.ts +1 -0
  118. package/components/dropdown.cjs +1 -0
  119. package/components/dropdown.d.ts +77 -0
  120. package/components/dropdown.mjs +491 -0
  121. package/components/flex.cjs +1 -0
  122. package/components/flex.d.ts +6 -0
  123. package/components/flex.mjs +16 -0
  124. package/components/form.cjs +1 -0
  125. package/components/form.d.ts +10 -0
  126. package/components/form.mjs +58 -0
  127. package/components/grid.cjs +1 -0
  128. package/components/grid.d.ts +6 -0
  129. package/components/grid.mjs +16 -0
  130. package/components/icon.cjs +1 -0
  131. package/components/icon.d.ts +37 -0
  132. package/components/icon.mjs +41 -0
  133. package/components/menu.cjs +1 -0
  134. package/components/menu.d.ts +234 -0
  135. package/components/menu.mjs +422 -0
  136. package/components/overlay.cjs +1 -0
  137. package/components/overlay.d.ts +47 -0
  138. package/components/overlay.mjs +52 -0
  139. package/components/popover.cjs +1 -0
  140. package/components/popover.d.ts +100 -0
  141. package/components/popover.mjs +69 -0
  142. package/components/presence.cjs +1 -0
  143. package/components/presence.d.ts +36 -0
  144. package/components/presence.mjs +11 -0
  145. package/components/progress.cjs +1 -0
  146. package/components/progress.d.ts +47 -0
  147. package/components/progress.mjs +28 -0
  148. package/components/radioButton.cjs +1 -0
  149. package/components/radioButton.d.ts +32 -0
  150. package/components/radioButton.mjs +32 -0
  151. package/components/radioGroup.cjs +1 -0
  152. package/components/radioGroup.d.ts +51 -0
  153. package/components/radioGroup.mjs +83 -0
  154. package/components/select.cjs +1 -0
  155. package/components/select.d.ts +51 -0
  156. package/components/select.mjs +36 -0
  157. package/components/semantics.cjs +1 -0
  158. package/components/semantics.d.ts +39 -0
  159. package/components/semantics.mjs +17 -0
  160. package/components/slider.cjs +1 -0
  161. package/components/slider.d.ts +98 -0
  162. package/components/slider.mjs +250 -0
  163. package/components/svg.cjs +1 -0
  164. package/components/svg.d.ts +65 -0
  165. package/components/svg.mjs +141 -0
  166. package/components/switch.cjs +1 -0
  167. package/components/switch.d.ts +29 -0
  168. package/components/switch.mjs +25 -0
  169. package/components/tabs.cjs +1 -0
  170. package/components/tabs.d.ts +87 -0
  171. package/components/tabs.mjs +324 -0
  172. package/components/textarea.cjs +1 -0
  173. package/components/textarea.d.ts +41 -0
  174. package/components/textarea.mjs +33 -0
  175. package/components/textbox.cjs +1 -0
  176. package/components/textbox.d.ts +38 -0
  177. package/components/textbox.mjs +33 -0
  178. package/components/toaster.cjs +1 -0
  179. package/components/toaster.d.ts +106 -0
  180. package/components/toaster.mjs +295 -0
  181. package/components/tooltip.cjs +1 -0
  182. package/components/tooltip.d.ts +98 -0
  183. package/components/tooltip.mjs +110 -0
  184. package/components/visuallyHidden.cjs +1 -0
  185. package/components/visuallyHidden.d.ts +6 -0
  186. package/components/visuallyHidden.mjs +23 -0
  187. package/docs/a11y.md +199 -0
  188. package/docs/anchor.md +139 -0
  189. package/docs/components.md +48 -0
  190. package/docs/index.md +11 -0
  191. package/docs/props.md +1777 -0
  192. package/effects.cjs +1 -0
  193. package/effects.mjs +6 -0
  194. package/forms.cjs +1 -0
  195. package/forms.mjs +21 -0
  196. package/gridExport.cjs +2 -0
  197. package/gridExport.mjs +244 -0
  198. package/icons/dotsIcon.d.ts +2 -0
  199. package/icons/expandIcon.d.ts +2 -0
  200. package/icons/groupingIcon.d.ts +2 -0
  201. package/icons/pinIcon.d.ts +2 -0
  202. package/icons/searchIcon.d.ts +2 -0
  203. package/icons/sortIcon.d.ts +2 -0
  204. package/identity.cjs +1 -0
  205. package/identity.mjs +12 -0
  206. package/keyboard.cjs +1 -0
  207. package/keyboard.mjs +30 -0
  208. package/layer.cjs +1 -0
  209. package/layer.mjs +127 -0
  210. package/motion.cjs +1 -0
  211. package/motion.mjs +66 -0
  212. package/package.json +327 -7
  213. package/placement.cjs +1 -0
  214. package/placement.mjs +180 -0
  215. package/platform.cjs +1 -0
  216. package/platform.mjs +45 -0
  217. package/react/a11y/callbacks.d.ts +12 -0
  218. package/react/a11y/useControllableState.d.ts +25 -0
  219. package/react/a11y/useDismiss.d.ts +25 -0
  220. package/react/a11y/useFocusReturn.d.ts +18 -0
  221. package/react/a11y/useRovingFocus.d.ts +84 -0
  222. package/react/anchor/useAnchorPosition.d.ts +79 -0
  223. package/react/animation/usePresence.d.ts +32 -0
  224. package/react/boxClassNames.d.ts +25 -0
  225. package/react/boxProps.d.ts +49 -0
  226. package/react/boxTagProps.d.ts +7 -0
  227. package/react/clientRuntime.d.ts +11 -0
  228. package/react/dialog/useScrollLock.d.ts +12 -0
  229. package/react/effects.d.ts +10 -0
  230. package/react/forms/labelledControl.d.ts +17 -0
  231. package/react/forms/placeholderProp.d.ts +13 -0
  232. package/react/hooks/usePortalContainer.d.ts +6 -0
  233. package/react/hooks/useVirtualization.d.ts +32 -0
  234. package/react/hooks/useVisibility.d.ts +9 -0
  235. package/react/identity/useIdentifier.d.ts +17 -0
  236. package/react/popover/usePopoverLayer.d.ts +87 -0
  237. package/react/reactTypes.d.ts +10 -0
  238. package/react/resolveStyles.d.ts +18 -0
  239. package/react/styleElements.d.ts +3 -0
  240. package/react/svg/attributesInProps.d.ts +4 -0
  241. package/react/svg/svgNaming.d.ts +15 -0
  242. package/react/theme/theme.d.ts +26 -0
  243. package/react/theme/themeContext.d.ts +7 -0
  244. package/react/useStyles.d.ts +22 -0
  245. package/react-shared.cjs +1 -0
  246. package/react-shared.mjs +122 -0
  247. package/rolldown-runtime.cjs +1 -0
  248. package/rsc.cjs +1 -0
  249. package/rsc.d.ts +27 -0
  250. package/rsc.mjs +18 -0
  251. package/ssg.cjs +1 -0
  252. package/ssg.d.ts +24 -0
  253. package/ssg.mjs +25 -0
  254. package/utils/accordion/accordionUtils.d.ts +48 -0
  255. package/utils/anchor/anchorUtils.d.ts +79 -0
  256. package/utils/animation/animationUtils.d.ts +29 -0
  257. package/utils/array/arrayUtils.d.ts +15 -0
  258. package/utils/array/lazyList.d.ts +10 -0
  259. package/utils/box/boxUtils.d.ts +5 -0
  260. package/utils/chart/chartPalette.d.ts +15 -0
  261. package/utils/chart/chartUtils.d.ts +92 -0
  262. package/utils/combobox/comboboxUtils.d.ts +89 -0
  263. package/utils/dom/domUtils.d.ts +32 -0
  264. package/utils/environment/environmentUtils.d.ts +28 -0
  265. package/utils/export/csvUtils.d.ts +23 -0
  266. package/utils/export/downloadUtils.d.ts +12 -0
  267. package/utils/export/xlsxUtils.d.ts +56 -0
  268. package/utils/export/zipUtils.d.ts +26 -0
  269. package/utils/fn/fnUtils.d.ts +4 -0
  270. package/utils/form/formUtils.d.ts +8 -0
  271. package/utils/keyboard/typeaheadUtils.d.ts +31 -0
  272. package/utils/memo.d.ts +10 -0
  273. package/utils/menu/menuUtils.d.ts +25 -0
  274. package/utils/object/objectUtils.d.ts +13 -0
  275. package/utils/slider/sliderUtils.d.ts +67 -0
  276. package/utils/string/fuzzySearch.d.ts +27 -0
  277. package/utils/string/stringUtils.d.ts +4 -0
  278. package/utils/tabs/tabsUtils.d.ts +75 -0
  279. package/utils/toast/toastStore.d.ts +73 -0
  280. package/utils/virtual/virtualUtils.d.ts +47 -0
@@ -0,0 +1,563 @@
1
+ "use client";
2
+ import { n as e } from "../effects.mjs";
3
+ import t from "../box.mjs";
4
+ import { a as n, i as r, r as i, t as a } from "../behavior.mjs";
5
+ import { t as o } from "../identity.mjs";
6
+ import { Path as s, Svg as c } from "./svg.mjs";
7
+ import l from "./flex.mjs";
8
+ import u from "./overlay.mjs";
9
+ import d from "./presence.mjs";
10
+ import { forwardRef as f, useCallback as p, useMemo as m, useRef as h, useState as g } from "react";
11
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
12
+ //#region src/utils/combobox/comboboxUtils.ts
13
+ var b;
14
+ (function(e) {
15
+ function t(e, t) {
16
+ return typeof e == "function" ? e(t) : t[e];
17
+ }
18
+ e.read = t;
19
+ function n(e, n) {
20
+ let r = t(e.label, n);
21
+ return r == null ? "" : String(r);
22
+ }
23
+ e.labelOf = n;
24
+ function r(e, r) {
25
+ return e.key === void 0 ? n(e, r) : t(e.key, r);
26
+ }
27
+ e.keyOf = r;
28
+ function i(e, n) {
29
+ return e.disabled !== void 0 && t(e.disabled, n) === !0;
30
+ }
31
+ e.isDisabled = i;
32
+ let a = /\p{M}/gu;
33
+ function o(e) {
34
+ return e.normalize("NFD").replace(a, "").toLowerCase();
35
+ }
36
+ e.normalize = o;
37
+ function s(e, t) {
38
+ return o(e).includes(o(t));
39
+ }
40
+ e.matches = s;
41
+ function c(e, t, n) {
42
+ return t === "" ? e : e.filter((e) => s(n(e), t));
43
+ }
44
+ e.filterRows = c;
45
+ function l(e) {
46
+ return e == null ? [] : Array.isArray(e) ? e : [e];
47
+ }
48
+ e.toArray = l;
49
+ function u(e, t, n) {
50
+ let r = n(t);
51
+ return e.some((e) => n(e) === r);
52
+ }
53
+ e.isSelected = u;
54
+ function d(e, t, n, r) {
55
+ return n ? u(e, t, r) ? e.filter((e) => r(e) !== r(t)) : [...e, t] : [t];
56
+ }
57
+ e.toggle = d;
58
+ function f(e) {
59
+ let { data: t, def: r, query: i, filter: a, typed: s, createRow: c } = e, l = (e) => n(r, e), u = (!s || a === !1 ? t : a(t, i, l)).map((e) => ({
60
+ kind: "option",
61
+ row: e
62
+ }));
63
+ return c && i !== "" && !t.some((e) => o(l(e)) === o(i)) && c(i) !== null && u.push({
64
+ kind: "create",
65
+ query: i
66
+ }), u;
67
+ }
68
+ e.rowsFor = f;
69
+ function p(e, t) {
70
+ return t.kind === "option" && i(e, t.row);
71
+ }
72
+ e.isRowDisabled = p;
73
+ function m(e, t, n, i = "first") {
74
+ let a = (e) => r(n, e), o = e.findIndex((e) => e.kind === "option" && u(t, e.row, a));
75
+ if (o !== -1 && !p(n, e[o])) return o;
76
+ let s = e.map((e, t) => p(n, e) ? -1 : t).filter((e) => e !== -1);
77
+ return (i === "last" ? s[s.length - 1] : s[0]) ?? -1;
78
+ }
79
+ e.activeIndexFor = m;
80
+ })(b ||= {});
81
+ var x = b;
82
+ //#endregion
83
+ //#region src/components/combobox/comboboxChips.tsx
84
+ function S(e) {
85
+ let { selection: t, def: n, display: r, removeLabel: i, onRemove: a, disabled: o, variant: u } = e;
86
+ return /* @__PURE__ */ v(_, { children: t.map((e) => {
87
+ let t = x.labelOf(n, e);
88
+ return /* @__PURE__ */ y(l, {
89
+ component: "combobox.chip",
90
+ variant: u,
91
+ ai: "center",
92
+ gap: 1,
93
+ children: [r?.(e) ?? t, !o && /* @__PURE__ */ v(l, {
94
+ tag: "button",
95
+ component: "combobox.remove",
96
+ variant: u,
97
+ ai: "center",
98
+ jc: "center",
99
+ props: {
100
+ type: "button",
101
+ tabIndex: -1,
102
+ "aria-label": i(t),
103
+ onMouseDown: (e) => e.preventDefault(),
104
+ onClick: (t) => {
105
+ t.stopPropagation(), a(e, t);
106
+ }
107
+ },
108
+ children: /* @__PURE__ */ v(c, {
109
+ viewBox: "0 0 24 24",
110
+ width: "0.625rem",
111
+ props: { fill: "none" },
112
+ children: /* @__PURE__ */ v(s, {
113
+ d: "M6 6 18 18M18 6 6 18",
114
+ stroke: "currentColor",
115
+ strokeWidth: 3,
116
+ strokeLinecap: "round"
117
+ })
118
+ })
119
+ })]
120
+ }, x.keyOf(n, e));
121
+ }) });
122
+ }
123
+ //#endregion
124
+ //#region src/utils/virtual/virtualUtils.ts
125
+ var C;
126
+ (function(e) {
127
+ let t = e.DEFAULT_OVERSCAN = 4, n = e.DEFAULT_THRESHOLD = 100;
128
+ e.DEFAULT_ITEM_HEIGHT = 36, e.DEFAULT_VIEW_HEIGHT = 248;
129
+ function r(e, t, n) {
130
+ return Math.min(Math.max(e, t), n);
131
+ }
132
+ function i(e, t, r = n) {
133
+ return t ?? e > r;
134
+ }
135
+ e.shouldVirtualize = i;
136
+ function a(e) {
137
+ let { count: n, itemHeight: i, viewHeight: a, scrollTop: o, overscan: s = t, activeIndex: c = -1 } = e;
138
+ if (n <= 0 || i <= 0) return {
139
+ startIndex: 0,
140
+ endIndex: Math.max(0, n),
141
+ offsetY: 0,
142
+ totalHeight: 0
143
+ };
144
+ let l = Math.max(1, Math.ceil(a / i)), u = Math.min(n, l + s * 2), d = n - u, f = r(Math.floor(o / i) - s, 0, d);
145
+ return c >= 0 && c < n && (c < f ? f = r(c - s, 0, d) : c >= f + u && (f = r(c + 1 + s - u, 0, d))), {
146
+ startIndex: f,
147
+ endIndex: f + u,
148
+ offsetY: f * i,
149
+ totalHeight: n * i
150
+ };
151
+ }
152
+ e.windowFor = a;
153
+ })(C ||= {});
154
+ var w = C;
155
+ //#endregion
156
+ //#region src/react/hooks/useVirtualization.ts
157
+ function ee(t) {
158
+ let { count: r, scrollerRef: i, itemHeight: a, viewHeight: o, overscan: s, threshold: c, enabled: l, activeIndex: u } = t, [d, f] = g({
159
+ top: 0,
160
+ at: -1
161
+ }), [m, _] = g({
162
+ itemHeight: 0,
163
+ viewHeight: 0
164
+ }), v = h(null), y = p((e) => {
165
+ v.current = e;
166
+ }, []), b = w.shouldVirtualize(r, l, c), x = n(() => {
167
+ let e = i.current, t = v.current;
168
+ if (!e || !t) return;
169
+ let n = t.children, r = n[0], a = n[1], o = a ? a.offsetTop - r.offsetTop : r?.offsetHeight ?? 0, s = e.clientHeight;
170
+ _((e) => e.itemHeight === o && e.viewHeight === s ? e : {
171
+ itemHeight: o,
172
+ viewHeight: s
173
+ });
174
+ });
175
+ e(() => {
176
+ if (!b || (x(), typeof ResizeObserver > "u")) return;
177
+ let e = i.current;
178
+ if (!e) return;
179
+ let t = new ResizeObserver(x);
180
+ return t.observe(e), () => t.disconnect();
181
+ }, [
182
+ b,
183
+ r,
184
+ x,
185
+ i
186
+ ]);
187
+ let S = n((e) => {
188
+ f({
189
+ top: e.currentTarget.scrollTop,
190
+ at: u ?? -1
191
+ });
192
+ }), C = w.windowFor({
193
+ count: r,
194
+ itemHeight: a ?? (m.itemHeight > 0 ? m.itemHeight : w.DEFAULT_ITEM_HEIGHT),
195
+ viewHeight: o ?? (m.viewHeight > 0 ? m.viewHeight : w.DEFAULT_VIEW_HEIGHT),
196
+ scrollTop: d.top,
197
+ overscan: s,
198
+ activeIndex: u === d.at ? -1 : u
199
+ });
200
+ return b ? {
201
+ ...C,
202
+ virtualized: b,
203
+ contentRef: y,
204
+ onScroll: S
205
+ } : {
206
+ startIndex: 0,
207
+ endIndex: r,
208
+ offsetY: 0,
209
+ totalHeight: 0,
210
+ virtualized: b,
211
+ contentRef: y,
212
+ onScroll: S
213
+ };
214
+ }
215
+ //#endregion
216
+ //#region src/components/combobox/comboboxListbox.tsx
217
+ function te(e, t, n, r) {
218
+ return e ? {
219
+ role: "listbox",
220
+ "aria-labelledby": r,
221
+ ...t ? { "aria-multiselectable": !0 } : {},
222
+ ...n ? { "aria-busy": !0 } : {}
223
+ } : { role: "status" };
224
+ }
225
+ function ne(e) {
226
+ let { presence: n, rows: r, def: i, display: a, selection: o, multiple: s, activeIndex: c, optionId: d, rowRef: f, onSelect: m } = e, { anchorRef: _, popupRef: b, listboxId: S, labelledBy: C, loading: w, loadingText: ne, emptyText: re, createLabel: T, variant: E, itemsProps: D } = e, { virtualize: O } = e, { present: ie, ref: k, props: A } = n, ae = (e) => x.keyOf(i, e), [j, M] = g(!1), oe = p((e) => M(e === "top"), []), se = h(null), ce = p((e) => {
227
+ se.current = e, k(e);
228
+ }, [k]), le = typeof O == "object" ? O : {}, { virtualized: N, startIndex: ue, endIndex: de, offsetY: fe, totalHeight: pe, contentRef: P, onScroll: F } = ee({
229
+ count: r.length,
230
+ scrollerRef: se,
231
+ enabled: typeof O == "boolean" ? O : void 0,
232
+ activeIndex: c,
233
+ ...le
234
+ }), I = N ? r.slice(ue, de) : r, L = (e, t) => {
235
+ let n = N ? ue + t : t, s = e.kind === "option" && x.isSelected(o, e.row, ae), u = x.isRowDisabled(i, e);
236
+ return /* @__PURE__ */ v(l, {
237
+ ref: f(n),
238
+ component: "combobox.item",
239
+ variant: [E, {
240
+ create: e.kind === "create",
241
+ highlighted: n === c
242
+ }],
243
+ selected: s,
244
+ ai: "center",
245
+ gap: 2,
246
+ id: d(n),
247
+ props: {
248
+ role: "option",
249
+ ...N ? {
250
+ "aria-setsize": r.length,
251
+ "aria-posinset": n + 1
252
+ } : {},
253
+ ...u ? { "aria-disabled": !0 } : {},
254
+ onMouseDown: (e) => e.preventDefault(),
255
+ onClick: (e) => !u && m(n, e)
256
+ },
257
+ children: e.kind === "create" ? T(e.query) : a?.(e.row) ?? x.labelOf(i, e.row)
258
+ }, e.kind === "option" ? ae(e.row) : "create");
259
+ };
260
+ return /* @__PURE__ */ v(u, {
261
+ ref: b,
262
+ anchor: _,
263
+ side: "bottom",
264
+ align: "start",
265
+ offset: .5,
266
+ matchWidth: !0,
267
+ onSideChange: oe,
268
+ children: /* @__PURE__ */ y(t, {
269
+ ref: ce,
270
+ component: "combobox.items",
271
+ ...D,
272
+ variant: [E, {
273
+ closed: !ie && !j,
274
+ closedUp: !ie && j
275
+ }],
276
+ id: S,
277
+ props: {
278
+ ...te(r.length > 0, s, w === !0, C),
279
+ ...A,
280
+ ...N ? { onScroll: F } : {}
281
+ },
282
+ children: [N ? /* @__PURE__ */ v(t, {
283
+ ref: P,
284
+ component: "combobox.window",
285
+ variant: E,
286
+ style: {
287
+ height: pe,
288
+ paddingTop: fe
289
+ },
290
+ children: I.map(L)
291
+ }) : I.map(L), r.length === 0 && /* @__PURE__ */ v(t, {
292
+ component: "combobox.message",
293
+ variant: E,
294
+ children: w ? ne : re
295
+ })]
296
+ })
297
+ });
298
+ }
299
+ //#endregion
300
+ //#region src/components/combobox.tsx
301
+ var re = /* @__PURE__ */ new Set([
302
+ " ",
303
+ "Home",
304
+ "End",
305
+ "ArrowLeft",
306
+ "ArrowRight"
307
+ ]);
308
+ function T(u, f) {
309
+ let { data: b, def: C, label: w, labelProps: ee, placeholder: te, name: T, disabled: E, props: D, itemsProps: O, hideIcon: ie, filter: k = x.filterRows, loading: A, loadingText: ae = "Loading...", emptyText: j = "No results", createRow: M, createLabel: oe = (e) => `Create "${e}"`, removeLabel: se = (e) => `Remove ${e}`, virtualize: ce, query: le, defaultQuery: N, onQueryChange: ue, open: de, defaultOpen: fe, onOpenChange: pe, multiple: P = !1, value: F, defaultValue: I, onValueChange: L, ...R } = u, z = o("combobox"), B = R.id ?? `${z}-field`, me = `${z}-listbox`, V = `${z}-label`, H = w != null && w !== !1, he = p((e) => `${z}-option-${e}`, [z]), ge = h(null), _e = h(null), ve = h(null), ye = p((e) => {
310
+ ve.current = e, typeof f == "function" ? f(e) : f && (f.current = e);
311
+ }, [f]), be = n((e, t) => {
312
+ L?.(P ? e : e[0] ?? null, t);
313
+ }), xe = m(() => F === void 0 ? void 0 : x.toArray(F), [F]), [U, Se] = r({
314
+ value: xe,
315
+ defaultValue: () => x.toArray(I),
316
+ onChange: be
317
+ }), [W, G] = r({
318
+ value: de,
319
+ defaultValue: fe ?? !1,
320
+ onChange: pe
321
+ }), [Ce, K] = r({
322
+ value: le,
323
+ defaultValue: N ?? "",
324
+ onChange: ue
325
+ }), [we, q] = g(!1), J = p((e) => x.keyOf(C, e), [C]), Te = P || U[0] === void 0 ? "" : x.labelOf(C, U[0]), Y = we || Ce !== "" ? Ce : Te, X = m(() => x.rowsFor({
326
+ data: b,
327
+ def: C,
328
+ query: Y,
329
+ filter: k,
330
+ typed: we,
331
+ createRow: M
332
+ }), [
333
+ b,
334
+ C,
335
+ Y,
336
+ k,
337
+ we,
338
+ M
339
+ ]), Ee = p((e) => X[e] ? x.isRowDisabled(C, X[e]) : !1, [X, C]), De = n((e, t) => {
340
+ G(!1, {
341
+ reason: e,
342
+ event: t
343
+ }), e !== "escape" && (q(!1), K("", {
344
+ reason: "close",
345
+ event: t
346
+ }));
347
+ }), Z = n((e, t) => {
348
+ let n = X[e];
349
+ if (!n || Ee(e)) return;
350
+ let r = n.kind === "create" ? M?.(n.query) : n.row;
351
+ if (r == null) return;
352
+ let i = x.isSelected(U, r, J), a = n.kind === "create" ? "create" : i && P ? "deselect" : "select";
353
+ Se(x.toggle(U, r, P, J), {
354
+ reason: a,
355
+ event: t
356
+ }), q(!1), K("", {
357
+ reason: "select",
358
+ event: t
359
+ }), P || G(!1, {
360
+ reason: "select",
361
+ event: t
362
+ });
363
+ }), Oe = a({
364
+ count: X.length,
365
+ focusItems: !1,
366
+ defaultActiveIndex: -1,
367
+ isDisabled: Ee,
368
+ onSelect: Z
369
+ }), { activeIndex: Q, setActiveIndex: ke, activeItem: Ae } = Oe;
370
+ i({
371
+ enabled: W,
372
+ inside: [ge, _e],
373
+ onDismiss: (e, t) => De(e === "escape" ? "escape" : "outside-pointer", t)
374
+ }), e(() => {
375
+ !W || Q === -1 || Ae()?.scrollIntoView?.({ block: "nearest" });
376
+ }, [
377
+ W,
378
+ Q,
379
+ Ae
380
+ ]);
381
+ let $ = (e, t, n) => {
382
+ G(!0, {
383
+ reason: n,
384
+ event: t
385
+ });
386
+ let r = e === "none" ? -1 : x.activeIndexFor(X, U, C, e);
387
+ ke(r, {
388
+ reason: "programmatic",
389
+ event: t
390
+ });
391
+ }, je = n((e) => {
392
+ q(!0), K(e.target.value, {
393
+ reason: "input",
394
+ event: e
395
+ }), W || G(!0, {
396
+ reason: "input",
397
+ event: e
398
+ }), ke(-1, {
399
+ reason: "programmatic",
400
+ event: e
401
+ });
402
+ }), Me = n((e, t) => {
403
+ Se(U.filter((t) => J(t) !== J(e)), {
404
+ reason: "remove",
405
+ event: t
406
+ });
407
+ }), Ne = (e) => {
408
+ let { key: t } = e;
409
+ if (t === "ArrowDown" || t === "ArrowUp") {
410
+ e.preventDefault(), $(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first", e, "trigger");
411
+ return;
412
+ }
413
+ t === "Escape" && Y !== "" && (q(!0), K("", {
414
+ reason: "clear",
415
+ event: e
416
+ }));
417
+ }, Pe = n((e) => {
418
+ if (D?.onKeyDown?.(e), !(e.defaultPrevented || E)) {
419
+ if (e.key === "Backspace" && P && Y === "" && U.length > 0) {
420
+ Me(U[U.length - 1], e);
421
+ return;
422
+ }
423
+ if (!W) {
424
+ Ne(e);
425
+ return;
426
+ }
427
+ if (e.key === "Tab") {
428
+ Q !== -1 && Z(Q, e), De("tab", e);
429
+ return;
430
+ }
431
+ if (e.altKey && e.key === "ArrowUp") {
432
+ e.preventDefault(), Q === -1 ? De("trigger", e) : Z(Q, e);
433
+ return;
434
+ }
435
+ if (re.has(e.key)) {
436
+ ke(-1, {
437
+ reason: "programmatic",
438
+ event: e
439
+ });
440
+ return;
441
+ }
442
+ Oe.onKeyDown(e);
443
+ }
444
+ }), Fe = n((e) => {
445
+ !E && !W && $("first", e, "trigger");
446
+ }), Ie = n((e) => {
447
+ E || e.target === ve.current || (e.preventDefault(), ve.current?.focus(), W || $("first", e, "trigger"));
448
+ }), Le = X.length > 0 || A === !0 || j !== null, Re = W && Q !== -1 && X.length > 0 ? he(Q) : void 0, ze = /* @__PURE__ */ v(t, {
449
+ tag: "input",
450
+ component: "combobox.field",
451
+ ref: ye,
452
+ id: B,
453
+ disabled: E,
454
+ props: {
455
+ ...D,
456
+ role: "combobox",
457
+ "aria-autocomplete": "list",
458
+ "aria-expanded": W,
459
+ "aria-controls": W && Le ? me : void 0,
460
+ "aria-activedescendant": Re,
461
+ "aria-labelledby": H ? V : D?.["aria-labelledby"],
462
+ autoComplete: "off",
463
+ spellCheck: !1,
464
+ type: "text",
465
+ value: Y,
466
+ placeholder: te,
467
+ onChange: je,
468
+ onKeyDown: Pe,
469
+ onClick: Fe
470
+ }
471
+ }), Be = !ie && /* @__PURE__ */ v(l, {
472
+ component: "combobox.icon",
473
+ rotate: W ? 180 : 0,
474
+ props: { "aria-hidden": !0 },
475
+ children: /* @__PURE__ */ v(c, {
476
+ viewBox: "0 0 10 6",
477
+ width: "0.6rem",
478
+ props: { fill: "none" },
479
+ children: /* @__PURE__ */ v(s, {
480
+ d: "m1 1 4 4 4-4",
481
+ stroke: "currentColor",
482
+ strokeWidth: 2,
483
+ strokeLinecap: "round",
484
+ strokeLinejoin: "round"
485
+ })
486
+ })
487
+ }), Ve = T === void 0 ? null : U.map((e) => /* @__PURE__ */ v(t, {
488
+ tag: "input",
489
+ props: {
490
+ type: "hidden",
491
+ name: T,
492
+ value: String(J(e))
493
+ }
494
+ }, J(e))), He = Le && /* @__PURE__ */ v(d, {
495
+ present: W,
496
+ children: (e) => /* @__PURE__ */ v(ne, {
497
+ presence: e,
498
+ rows: X,
499
+ def: C,
500
+ display: C.display,
501
+ selection: U,
502
+ multiple: P,
503
+ activeIndex: Q,
504
+ optionId: he,
505
+ rowRef: (e) => Oe.itemProps(e).ref,
506
+ onSelect: Z,
507
+ anchorRef: ge,
508
+ popupRef: _e,
509
+ listboxId: me,
510
+ labelledBy: H ? V : B,
511
+ loading: A,
512
+ loadingText: ae,
513
+ emptyText: j,
514
+ createLabel: oe,
515
+ virtualize: ce,
516
+ variant: R.variant,
517
+ itemsProps: O
518
+ })
519
+ }), Ue = /* @__PURE__ */ y(l, {
520
+ ref: ge,
521
+ component: "combobox",
522
+ ai: "center",
523
+ gap: 1,
524
+ flexWrap: "wrap",
525
+ ...R,
526
+ props: { onPointerDown: Ie },
527
+ children: [
528
+ Ve,
529
+ P && /* @__PURE__ */ v(S, {
530
+ selection: U,
531
+ def: C,
532
+ display: C.display,
533
+ removeLabel: se,
534
+ onRemove: Me,
535
+ disabled: E,
536
+ variant: R.variant
537
+ }),
538
+ ze,
539
+ Be
540
+ ]
541
+ });
542
+ return H ? /* @__PURE__ */ y(l, {
543
+ d: "column",
544
+ gap: 1,
545
+ width: "fit-content",
546
+ children: [
547
+ /* @__PURE__ */ v(t, {
548
+ tag: "label",
549
+ component: "combobox.label",
550
+ id: V,
551
+ ...ee,
552
+ props: { htmlFor: B },
553
+ children: w
554
+ }),
555
+ Ue,
556
+ He
557
+ ]
558
+ }) : /* @__PURE__ */ y(_, { children: [Ue, He] });
559
+ }
560
+ var E = f(T);
561
+ E.displayName = "Combobox";
562
+ //#endregion
563
+ export { x as ComboboxUtils, E as default };
@@ -0,0 +1,10 @@
1
+ import { default as AggregateCellModel } from '../models/aggregateCellModel';
2
+ interface Props<TRow> {
3
+ cell: AggregateCellModel<TRow>;
4
+ }
5
+ /**
6
+ * What an aggregated cell draws when the column supplies no `AggregateCell` of its own. The scope picks the
7
+ * style node, so a group row's totals and the footer's are themed apart without two components.
8
+ */
9
+ export default function DataGridAggregateValue<TRow>(props: Props<TRow>): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as GridModel } from '../models/gridModel';
2
+ interface Props<TRow> {
3
+ grid: GridModel<TRow>;
4
+ scrollTop: number;
5
+ }
6
+ export default function DataGridBody<TRow>(props: Props<TRow>): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import { default as GridModel } from '../models/gridModel';
2
+ interface Props<TRow> {
3
+ grid: GridModel<TRow>;
4
+ }
5
+ export default function DataGridBottomBar<TRow>(props: Props<TRow>): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,16 @@
1
+ import { BoxProps } from '../../../box';
2
+ import { default as AggregateCellModel } from '../models/aggregateCellModel';
3
+ import { default as CellModel } from '../models/cellModel';
4
+ import { default as GroupRowCellModel } from '../models/groupRowCellModel';
5
+ interface Props<TRow> extends BoxProps {
6
+ children: React.ReactNode;
7
+ cell: CellModel<TRow> | GroupRowCellModel<TRow> | AggregateCellModel<TRow>;
8
+ /** Navigation coordinates. `columnIndex` counts rendered cells, which a group row has fewer of. */
9
+ row: number;
10
+ columnIndex: number;
11
+ /** 1-based `aria-colindex`, when the cell does not sit at `columnIndex`. */
12
+ ariaColIndex?: number;
13
+ ariaColSpan?: number;
14
+ }
15
+ export default function DataGridCell<TRow>(props: Props<TRow>): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ import { default as CellModel } from '../models/cellModel';
2
+ interface Props<TRow> {
3
+ cell: CellModel<TRow>;
4
+ /** The cell's navigation coordinates — where Tab steps from. */
5
+ row: number;
6
+ columnIndex: number;
7
+ }
8
+ /**
9
+ * The editor open on one cell. Everything it does is three calls on the model — read `draft`, `setDraft`,
10
+ * then `commitEdit` or `cancelEdit` — so the four built-in controls and one of your own differ only in
11
+ * what they draw. The commit rules live in `EditModel`, and the keys are here because they are the ones
12
+ * the grid's own navigation would otherwise take.
13
+ */
14
+ export default function DataGridCellEditor<TRow>(props: Props<TRow>): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,14 @@
1
+ import { default as GridModel } from '../models/gridModel';
2
+ interface Props<TRow> {
3
+ /** A body cell or a group row cell: both draw the same skeleton off the same two things. */
4
+ cell: {
5
+ grid: GridModel<TRow>;
6
+ row: {
7
+ rowIndex: number;
8
+ };
9
+ };
10
+ /** Position among the rendered cells, which is half of what picks this bar’s width. */
11
+ columnIndex: number;
12
+ }
13
+ export default function DataGridCellPlaceholder<TRow>(props: Props<TRow>): import("react").JSX.Element;
14
+ export {};
@@ -0,0 +1,6 @@
1
+ import { default as CellModel } from '../models/cellModel';
2
+ interface Props<TRow> {
3
+ cell: CellModel<TRow>;
4
+ }
5
+ export default function DataGridCellRowDetail<TRow>(props: Props<TRow>): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { default as CellModel } from '../models/cellModel';
2
+ interface Props<TRow> {
3
+ cell: CellModel<TRow>;
4
+ }
5
+ export default function DataGridCellRowSelection<TRow>(props: Props<TRow>): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { default as CellModel } from '../models/cellModel';
2
+ interface Props<TRow> {
3
+ cell: CellModel<TRow>;
4
+ }
5
+ export default function DataGridCellText<TRow>(props: Props<TRow>): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,16 @@
1
+ import { default as CellModel } from '../models/cellModel';
2
+ import { default as RowModel } from '../models/rowModel';
3
+ import { TreeRow } from '../models/treeRow';
4
+ interface Props<TRow> {
5
+ cell: CellModel<TRow>;
6
+ row: RowModel<TRow> & TreeRow;
7
+ /** Whatever the column would have rendered — the value, or a `Cell` of the caller's own. */
8
+ children: React.ReactNode;
9
+ }
10
+ /**
11
+ * The tree column's cell: an indent for the level, a chevron where there is something under the row, and
12
+ * the column's own content beside it. A leaf keeps the chevron's width so a column of values stays a
13
+ * column rather than stepping in and out by one control's width.
14
+ */
15
+ export default function DataGridCellTree<TRow>(props: Props<TRow>): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,9 @@
1
+ import { default as ColumnModel } from '../models/columnModel';
2
+ interface Props<TRow> {
3
+ column: ColumnModel<TRow>;
4
+ }
5
+ /**
6
+ * Renders the appropriate filter input for the column's resolved filter type.
7
+ */
8
+ export default function DataGridColumnFilter<TRow>(props: Props<TRow>): import("react").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ import { default as GridModel } from '../models/gridModel';
3
+ interface Props<TRow> {
4
+ grid: GridModel<TRow>;
5
+ }
6
+ export default function DataGridColumnGroups<TRow>(props: Props<TRow>): React.JSX.Element | null;
7
+ export {};