@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,491 @@
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, 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";
8
+ import l from "./flex.mjs";
9
+ import u from "./checkbox.mjs";
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";
15
+ //#region src/components/dropdown/dropdownContext.ts
16
+ var ae = p(null);
17
+ function S() {
18
+ let e = _(ae);
19
+ if (!e) throw Error("Dropdown sub-components must be used within Dropdown");
20
+ return e;
21
+ }
22
+ //#endregion
23
+ //#region src/components/dropdown/dropdownRowRenderer.tsx
24
+ var C = {
25
+ item: "dropdown.item",
26
+ unselect: "dropdown.unselect",
27
+ selectAll: "dropdown.selectAll"
28
+ };
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 ? {
35
+ multiple: i,
36
+ highlighted: n === ee
37
+ } : { highlighted: n === ee }],
38
+ selected: p,
39
+ ..._,
40
+ id: c(n),
41
+ children: ne ? /* @__PURE__ */ x(ie, { children: [/* @__PURE__ */ b(u, {
42
+ readOnly: !0,
43
+ checked: p,
44
+ me: 2,
45
+ props: {
46
+ tabIndex: -1,
47
+ "aria-hidden": !0
48
+ }
49
+ }), g] }) : g,
50
+ props: {
51
+ role: "option",
52
+ ...f ? { "aria-disabled": !0 } : {},
53
+ ..._.props,
54
+ onClick: f ? void 0 : (e) => {
55
+ h?.(e), s(n, e);
56
+ }
57
+ }
58
+ });
59
+ }
60
+ var w = h(oe, (e, t) => e.row.element === t.row.element && e.index === t.index);
61
+ //#endregion
62
+ //#region src/components/dropdown/dropdownItems.tsx
63
+ function T(e, t, n) {
64
+ return e ? {
65
+ role: "listbox",
66
+ "aria-labelledby": n,
67
+ ...t ? { "aria-multiselectable": !0 } : {}
68
+ } : { role: "status" };
69
+ }
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
+ })]
100
+ })
101
+ });
102
+ }
103
+ function ce(e, t) {
104
+ return e.kind === "item" ? e.element.props.value : `${e.kind}-${t}`;
105
+ }
106
+ se.displayName = "DropdownItems";
107
+ //#endregion
108
+ //#region src/components/dropdown/dropdownSearch.tsx
109
+ function le({ id: e, value: t, onValueChange: n, placeholder: r, inputRef: i, comboboxProps: a, onOpen: o }) {
110
+ let s = g((e) => n(e.target.value), [n]), c = g((e) => {
111
+ e.stopPropagation(), o(e);
112
+ }, [o]);
113
+ return /* @__PURE__ */ b(l, {
114
+ ai: "center",
115
+ position: "absolute",
116
+ inset: 0,
117
+ p: 3,
118
+ children: /* @__PURE__ */ b(f, {
119
+ clean: !0,
120
+ id: e,
121
+ value: t,
122
+ placeholder: r,
123
+ onChange: s,
124
+ ref: i,
125
+ color: "currentColor",
126
+ width: "fit",
127
+ props: {
128
+ role: "combobox",
129
+ "aria-autocomplete": "list",
130
+ autoComplete: "off",
131
+ spellCheck: !1,
132
+ ...a,
133
+ onClick: c
134
+ }
135
+ })
136
+ });
137
+ }
138
+ //#endregion
139
+ //#region src/components/dropdown/utils.ts
140
+ function ue(e) {
141
+ if (e == null) return "";
142
+ if (typeof e == "object") {
143
+ let t = e.props?.children;
144
+ return t == null ? "" : typeof t == "object" ? (Array.isArray(t) ? t : [t]).map((e) => ue(e)).join("") : t.toString();
145
+ }
146
+ return e.toString();
147
+ }
148
+ //#endregion
149
+ //#region src/components/dropdown.tsx
150
+ function de(e) {
151
+ return e == null ? [] : Array.isArray(e) ? e : [e];
152
+ }
153
+ function fe(e) {
154
+ let t = e?.props?.disabled;
155
+ return (Array.isArray(t) ? t[0] : t) === !0;
156
+ }
157
+ function pe(e) {
158
+ return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
159
+ }
160
+ var me = /* @__PURE__ */ new Set([
161
+ " ",
162
+ "Home",
163
+ "End",
164
+ "ArrowLeft",
165
+ "ArrowRight"
166
+ ]);
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
+ F.current = e;
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
+ let e = /* @__PURE__ */ new Map();
180
+ for (let t of B) e.set(t, ue(t));
181
+ return e;
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
+ B,
185
+ V
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
+ G,
189
+ B,
190
+ j,
191
+ V
192
+ ]), Pe = !!(W && S && H.length > j.length), Fe = !!(U && H.length > 0 && !Pe), q = v(() => {
193
+ let e = [];
194
+ Fe && U && e.push({
195
+ kind: "unselect",
196
+ element: U
197
+ }), Pe && W && e.push({
198
+ kind: "selectAll",
199
+ element: W
200
+ });
201
+ for (let t of H) e.push({
202
+ kind: "item",
203
+ element: t
204
+ });
205
+ return e;
206
+ }, [
207
+ Fe,
208
+ U,
209
+ Pe,
210
+ W,
211
+ H
212
+ ]), J = g((e) => fe(q[e]?.element), [q]), Ie = g((e) => {
213
+ let t = q[e];
214
+ return t ? V(t.element) : "";
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
+ let t = e.at(0);
221
+ return t?.props.children ?? t?.props.value ?? (S ? null : U?.props.children);
222
+ }, [
223
+ S,
224
+ H,
225
+ j,
226
+ U,
227
+ N,
228
+ C,
229
+ K,
230
+ G,
231
+ V
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
+ });
253
+ }
254
+ e.stopPropagation(), S ? C && setTimeout(() => I.current?.focus(), 0) : R();
255
+ }, [
256
+ S,
257
+ C,
258
+ j,
259
+ M,
260
+ R
261
+ ]), Y = n((e, t) => {
262
+ let n = q[e];
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({
272
+ count: q.length,
273
+ focusItems: !1,
274
+ defaultActiveIndex: _ ? X("none") : -1,
275
+ isDisabled: J,
276
+ textOf: C ? void 0 : Ie,
277
+ onSelect: Y
278
+ }), Be = Z.setActiveIndex, Ve = g((e) => Be(-1, {
279
+ reason: "programmatic",
280
+ event: e
281
+ }), [Be]);
282
+ a({
283
+ enabled: N,
284
+ inside: [F, Te],
285
+ onDismiss: (e) => R(e === "escape")
286
+ }), i({
287
+ enabled: N,
288
+ returnTo: C ? I : F
289
+ }), ne(() => {
290
+ N && I.current?.focus();
291
+ }, [N]);
292
+ let Q = Z.activeIndex, He = Z.activeItem;
293
+ e(() => {
294
+ !N || Q === -1 || He()?.scrollIntoView?.({ block: "nearest" });
295
+ }, [
296
+ N,
297
+ Q,
298
+ He
299
+ ]);
300
+ let $ = (e, t) => {
301
+ P(!0), Z.setActiveIndex(e, {
302
+ reason: "programmatic",
303
+ event: t
304
+ });
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) => {
312
+ let { key: t } = e;
313
+ if (C) {
314
+ if (t === "ArrowDown" || t === "ArrowUp") {
315
+ e.preventDefault(), $(X(t === "ArrowUp" ? "last" : e.altKey ? "none" : "first"), e);
316
+ return;
317
+ }
318
+ t === "Escape" && Ce("");
319
+ return;
320
+ }
321
+ if (t === "ArrowDown" || t === "Enter" || t === " ") {
322
+ e.preventDefault(), $(X(e.altKey ? "none" : "first"), e);
323
+ return;
324
+ }
325
+ if (t === "ArrowUp") {
326
+ e.preventDefault(), $(X("last"), e);
327
+ return;
328
+ }
329
+ if (t === "Home" || t === "End") {
330
+ e.preventDefault(), $(ze(t === "Home" ? "first" : "last"), e);
331
+ return;
332
+ }
333
+ pe(e) && (P(!0), Z.onKeyDown(e));
334
+ }, qe = n((e) => {
335
+ if (ve?.onKeyDown?.(e), !e.defaultPrevented) {
336
+ if (!N) {
337
+ Ke(e);
338
+ return;
339
+ }
340
+ if (e.key === "Tab") {
341
+ !S && Z.activeIndex !== -1 && Y(Z.activeIndex, e), R();
342
+ return;
343
+ }
344
+ if (e.altKey && e.key === "ArrowUp") {
345
+ e.preventDefault(), Z.activeIndex !== -1 && Y(Z.activeIndex, e), R();
346
+ return;
347
+ }
348
+ if (C && me.has(e.key)) {
349
+ Ve(e);
350
+ return;
351
+ }
352
+ Z.onKeyDown(e);
353
+ }
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,
359
+ selectRow: Y,
360
+ optionId: Ae,
361
+ activeIndex: Q,
362
+ rowRef: (e) => Xe(e).ref,
363
+ isRowDisabled: J
364
+ }), [
365
+ j,
366
+ S,
367
+ k.variant,
368
+ ce,
369
+ Y,
370
+ Ae,
371
+ Q,
372
+ Xe,
373
+ J
374
+ ]), Qe = {
375
+ "aria-expanded": N,
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) => {
382
+ let t = JSON.stringify(e);
383
+ return /* @__PURE__ */ b(f, {
384
+ ref: te,
385
+ name: p,
386
+ type: "hidden",
387
+ value: t ?? ""
388
+ }, t);
389
+ }), et = !T && /* @__PURE__ */ b(l, {
390
+ component: "dropdown.icon",
391
+ ...he,
392
+ children: /* @__PURE__ */ b(c, {
393
+ viewBox: "0 0 10 6",
394
+ width: "0.6rem",
395
+ rotate: N ? 180 : 0,
396
+ children: /* @__PURE__ */ b("path", {
397
+ stroke: "currentColor",
398
+ strokeLinecap: "round",
399
+ strokeLinejoin: "round",
400
+ strokeWidth: "2",
401
+ d: "m1 1 4 4 4-4"
402
+ })
403
+ })
404
+ }), tt = Je && /* @__PURE__ */ b(d, {
405
+ present: N,
406
+ children: (e) => /* @__PURE__ */ b(se, {
407
+ presence: e,
408
+ rows: q,
409
+ emptyItem: Ne,
410
+ triggerRef: F,
411
+ popupRef: Te,
412
+ listboxId: De,
413
+ labelledBy: ke ? Oe : Ee,
414
+ itemsProps: O
415
+ })
416
+ }), nt = C ? /* @__PURE__ */ x(t, {
417
+ ref: we,
418
+ component: "dropdown",
419
+ props: { onClick: Ue },
420
+ position: "relative",
421
+ pe: T ? void 0 : 6,
422
+ minWidth: N ? 36 : void 0,
423
+ width: "fit-content",
424
+ ...k,
425
+ id: void 0,
426
+ children: [
427
+ $e,
428
+ /* @__PURE__ */ b(le, {
429
+ id: Ee,
430
+ value: Se ?? K,
431
+ onValueChange: Ge,
432
+ placeholder: N ? oe : void 0,
433
+ inputRef: I,
434
+ comboboxProps: Qe,
435
+ onOpen: We
436
+ }),
437
+ Le ?? /* @__PURE__ */ b(t, {
438
+ tag: "span",
439
+ visibility: "hidden",
440
+ children: K || "\xA0"
441
+ }),
442
+ et
443
+ ]
444
+ }) : /* @__PURE__ */ x(ee, {
445
+ ref: we,
446
+ onClick: Ue,
447
+ component: "dropdown",
448
+ type: "button",
449
+ props: {
450
+ tabIndex: 0,
451
+ role: "combobox",
452
+ ...Qe
453
+ },
454
+ position: "relative",
455
+ pe: T ? void 0 : 6,
456
+ width: "fit-content",
457
+ ...k,
458
+ id: Ee,
459
+ children: [
460
+ $e,
461
+ Le ?? "\xA0",
462
+ et
463
+ ]
464
+ });
465
+ return /* @__PURE__ */ b(ae.Provider, {
466
+ value: Ze,
467
+ children: ke ? /* @__PURE__ */ x(l, {
468
+ d: "column",
469
+ gap: 1,
470
+ width: "fit-content",
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] })
482
+ });
483
+ }
484
+ function D(e) {
485
+ let t = (e) => null;
486
+ return t.displayName = e, t;
487
+ }
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";
490
+ //#endregion
491
+ export { O as default };
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@box-kite/react");r=e.t(r,1);function i(e,t){let{inline:i,...a}=e;return(0,n.jsx)(r.default,{ref:t,display:i?`inline-flex`:`flex`,...a})}var a=(0,t.forwardRef)(i);a.displayName=`Flex`,exports.default=a;
@@ -0,0 +1,6 @@
1
+ import { RefAttributes } from 'react';
2
+ import { BoxProps } from '../box';
3
+ import { ExtractElementFromTag } from '../react/reactTypes';
4
+ import { ComponentsAndVariants } from '@box-kite/core/types';
5
+ declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div", TKey extends keyof ComponentsAndVariants = never>(props: BoxProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
6
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { forwardRef as e } from "react";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import n from "@box-kite/react";
4
+ //#region src/components/flex.tsx
5
+ function r(e, r) {
6
+ let { inline: i, ...a } = e;
7
+ return /* @__PURE__ */ t(n, {
8
+ ref: r,
9
+ display: i ? "inline-flex" : "flex",
10
+ ...a
11
+ });
12
+ }
13
+ var i = e(r);
14
+ i.displayName = "Flex";
15
+ //#endregion
16
+ export { i as default };
@@ -0,0 +1 @@
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../box.cjs");let t=require("react"),n=require("react/jsx-runtime");var r;(function(e){function t(e){let t=Array.from(e.elements).reduce((e,t)=>{let n=t.name;return n?(e[n]||(e[n]=[]),e[n].push(t),e):e},{});return Object.entries(t).reduce((e,[t,r])=>{if(r.length===1){let i=r[0];n(e,t,i.type===`checkbox`||i.type===`radio`?i.checked:i.value)}else n(e,t,r.reduce((e,t)=>(t.type===`checkbox`||t.type===`radio`?t.checked&&e.push(t.value):e.push(t.value),e),[]));return e},{})}e.getFormEntries=t;function n(e,t,n){if(t.includes(`.`)){let r=t.split(`.`),i=e;r.forEach((e,t)=>{if(r.length>t+1){let t=e.match(/^(.+)\[(\d)\]$/);if(t){let[,e,n]=t;i[e]=i[e]||[],i[e][n]=i[e][n]||{},i=i[e][n]}else i[e]=i[e]||{},i=i[e]}else i[e]=n})}else e[t]=n}})(r||={});var i=r;function a(r){let{onSubmit:a,props:o}=r,s=(0,t.useRef)(null),c=(0,t.useCallback)(e=>{e.preventDefault();let t=i.getFormEntries(s.current);a(t,e)},[a]),l={...o,onSubmit:c,ref:s};return(0,n.jsx)(e.default,{tag:`form`,...r,props:l})}a.displayName=`Form`,exports.default=a;
@@ -0,0 +1,10 @@
1
+ import { BoxProps } from '../box';
2
+ import { OmitTagProps } from '../react/boxProps';
3
+ type BoxTagProps = Required<BoxProps<'form'>>['props'];
4
+ type FormTagProps = OmitTagProps<BoxTagProps, 'onSubmit' | 'ref'>;
5
+ interface Props<T> extends Omit<BoxProps<'form'>, 'props' | 'tag'> {
6
+ props?: FormTagProps;
7
+ onSubmit: (obj: T, e: React.ChangeEvent<HTMLFormElement>) => void;
8
+ }
9
+ export default function Form<T>(props: Props<T>): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import e from "../box.mjs";
3
+ import { useCallback as t, useRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/utils/form/formUtils.ts
6
+ var i;
7
+ (function(e) {
8
+ function t(e) {
9
+ let t = Array.from(e.elements).reduce((e, t) => {
10
+ let n = t.name;
11
+ return n ? (e[n] || (e[n] = []), e[n].push(t), e) : e;
12
+ }, {});
13
+ return Object.entries(t).reduce((e, [t, r]) => {
14
+ if (r.length === 1) {
15
+ let i = r[0];
16
+ n(e, t, i.type === "checkbox" || i.type === "radio" ? i.checked : i.value);
17
+ } else n(e, t, r.reduce((e, t) => (t.type === "checkbox" || t.type === "radio" ? t.checked && e.push(t.value) : e.push(t.value), e), []));
18
+ return e;
19
+ }, {});
20
+ }
21
+ e.getFormEntries = t;
22
+ function n(e, t, n) {
23
+ if (t.includes(".")) {
24
+ let r = t.split("."), i = e;
25
+ r.forEach((e, t) => {
26
+ if (r.length > t + 1) {
27
+ let t = e.match(/^(.+)\[(\d)\]$/);
28
+ if (t) {
29
+ let [, e, n] = t;
30
+ i[e] = i[e] || [], i[e][n] = i[e][n] || {}, i = i[e][n];
31
+ } else i[e] = i[e] || {}, i = i[e];
32
+ } else i[e] = n;
33
+ });
34
+ } else e[t] = n;
35
+ }
36
+ })(i ||= {});
37
+ var a = i;
38
+ //#endregion
39
+ //#region src/components/form.tsx
40
+ function o(i) {
41
+ let { onSubmit: o, props: s } = i, c = n(null), l = t((e) => {
42
+ e.preventDefault();
43
+ let t = a.getFormEntries(c.current);
44
+ o(t, e);
45
+ }, [o]), u = {
46
+ ...s,
47
+ onSubmit: l,
48
+ ref: c
49
+ };
50
+ return /* @__PURE__ */ r(e, {
51
+ tag: "form",
52
+ ...i,
53
+ props: u
54
+ });
55
+ }
56
+ o.displayName = "Form";
57
+ //#endregion
58
+ export { o as default };
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@box-kite/react");r=e.t(r,1);function i(e,t){let{inline:i,...a}=e;return(0,n.jsx)(r.default,{ref:t,display:i?`inline-grid`:`grid`,...a})}var a=(0,t.forwardRef)(i);a.displayName=`Grid`,exports.default=a;
@@ -0,0 +1,6 @@
1
+ import { RefAttributes } from 'react';
2
+ import { BoxProps } from '../box';
3
+ import { ExtractElementFromTag } from '../react/reactTypes';
4
+ import { ComponentsAndVariants } from '@box-kite/core/types';
5
+ declare const _default: <TTag extends keyof React.JSX.IntrinsicElements = "div", TKey extends keyof ComponentsAndVariants = never>(props: BoxProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>) => React.ReactNode;
6
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { forwardRef as e } from "react";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import n from "@box-kite/react";
4
+ //#region src/components/grid.tsx
5
+ function r(e, r) {
6
+ let { inline: i, ...a } = e;
7
+ return /* @__PURE__ */ t(n, {
8
+ ref: r,
9
+ display: i ? "inline-grid" : "grid",
10
+ ...a
11
+ });
12
+ }
13
+ var i = e(r);
14
+ i.displayName = "Grid";
15
+ //#endregion
16
+ export { i as default };
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@box-kite/react");var i=6;function a(a,o){let{children:s,label:c,size:l,props:u,style:d,...f}=a,p=l===void 0?void 0:{width:l,height:l},{className:m,styles:h}=(0,r.useClassNames)({width:i,height:i,...f,...p},{svg:!0});if(!(0,t.isValidElement)(s))throw Error(`[box-kite] <Icon> takes exactly one element — the icon to style. For SVG of your own, use <Svg> from components/svg.`);let g=e.s(s.type),_=s.props,v=(g?_.props:s.props)??{},y=g&&_.label!==void 0?{...v,"aria-label":_.label}:v,b={...u,...e.o(c,{...y,...u})},x={...g?{props:{...v,...b}}:b,...d?{style:d}:void 0,ref:o,className:s.props.className?`${s.props.className} ${m}`:m};return(0,n.jsxs)(n.Fragment,{children:[h,(0,t.cloneElement)(s,x)]})}var o=(0,t.forwardRef)(a);o.displayName=`Icon`,exports.default=o;
@@ -0,0 +1,37 @@
1
+ import { BoxClassNameProps } from '../box';
2
+ import { TagPropsType } from '../react/boxProps';
3
+ import { BoxStyleProps } from '@box-kite/core/types';
4
+ /**
5
+ * Box props for an icon this library did not draw. An icon set is somebody else's component, and the only
6
+ * styling channel it offers is the `className` it spreads onto its `<svg>`; `Icon` fills that channel
7
+ * with a class the engine generated, so an icon takes the props everything else here takes:
8
+ *
9
+ * ```tsx
10
+ * <Icon size={5} color="amber-400" hover={{ color: 'amber-300' }} label="Sunny"><Sun /></Icon>
11
+ * ```
12
+ *
13
+ * **Nothing is passed down as a prop.** The size is in the class, where a CSS declaration outranks the
14
+ * `width`/`height` attributes a set writes for itself — which is why one component fits every set
15
+ * without knowing any of their prop names, and why `strokeWidth` can differ on hover. The child must
16
+ * spread its props onto an `<svg>`. **For SVG you draw yourself, `Svg` and the `components/svg` elements
17
+ * are Boxes already** and need no adapter.
18
+ */
19
+ export interface IconProps extends BoxClassNameProps {
20
+ /** The icon: exactly one element, whose `<svg>` these props are styling. */
21
+ children: React.ReactElement;
22
+ /**
23
+ * Width and height at once, on the ÷4 scale: `size={6}` is the 24px an icon set defaults to, and is the
24
+ * default here too. It wins over `width`/`height`. Careful when porting — a set's own `size` is in pixels.
25
+ */
26
+ size?: BoxStyleProps['width'] & BoxStyleProps['height'];
27
+ /** Names the icon — `role="img"` and this text. Without one the icon is `aria-hidden`. */
28
+ label?: string;
29
+ /** Attributes forwarded to the icon's element, over anything the icon writes for itself. */
30
+ props?: TagPropsType<'svg'>;
31
+ /** Inline styles forwarded to the icon's element. Box props are the way to style it; this is for a
32
+ * value that has to be computed per render, which no class can hold. */
33
+ style?: React.CSSProperties;
34
+ }
35
+ /** Box props on an icon somebody else renders — see `IconProps`. */
36
+ declare const Icon: import('react').ForwardRefExoticComponent<IconProps & import('react').RefAttributes<SVGSVGElement>>;
37
+ export default Icon;