@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,69 @@
1
+ "use client";
2
+ import e from "../box.mjs";
3
+ import { a as t } from "../behavior.mjs";
4
+ import { t as n } from "../placement.mjs";
5
+ import r from "./overlay.mjs";
6
+ import { t as i } from "../layer.mjs";
7
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ //#region src/components/popover.tsx
9
+ function c(c) {
10
+ let { trigger: l, children: u, open: d, defaultOpen: f = !1, onOpenChange: p, label: m, labelledBy: h, side: g = "bottom", align: _ = "center", offset: v = 2, flip: y = !0, matchWidth: b = !1, autoFocus: x = !0, props: S, ...C } = c, w = t((e) => {
11
+ !x || e.contains(document.activeElement) || e.focus();
12
+ }), { platform: T, isOpen: E, id: D, trigger: O, triggerElement: k, setPanel: A } = i({
13
+ haspopup: "dialog",
14
+ idPrefix: "popover",
15
+ id: C.id,
16
+ open: d,
17
+ defaultOpen: f,
18
+ onOpenChange: p,
19
+ onOpened: w
20
+ }), j = n({
21
+ side: g,
22
+ align: _,
23
+ offset: v,
24
+ flip: y,
25
+ matchWidth: b,
26
+ anchor: k
27
+ }), M = {
28
+ "aria-label": m,
29
+ "aria-labelledby": h
30
+ }, N = C;
31
+ return T ? /* @__PURE__ */ s(a, { children: [l(O), /* @__PURE__ */ o(e, {
32
+ ref: A,
33
+ component: "popover",
34
+ ...N,
35
+ variant: [N.variant, { topLayer: !0 }],
36
+ ...j.layerProps,
37
+ id: D,
38
+ props: {
39
+ popover: "auto",
40
+ role: "dialog",
41
+ ...M,
42
+ tabIndex: -1,
43
+ ...S
44
+ },
45
+ children: u
46
+ })] }) : /* @__PURE__ */ s(a, { children: [l(O), E && /* @__PURE__ */ o(r, {
47
+ contentRef: A,
48
+ anchor: k,
49
+ side: g,
50
+ align: _,
51
+ offset: v,
52
+ flip: y,
53
+ matchWidth: b,
54
+ component: "popover",
55
+ ...N,
56
+ id: D,
57
+ props: {
58
+ role: "dialog",
59
+ ...M,
60
+ tabIndex: -1,
61
+ ...S
62
+ },
63
+ children: u
64
+ })] });
65
+ }
66
+ var l = c;
67
+ l.displayName = "Popover";
68
+ //#endregion
69
+ export { l as default };
@@ -0,0 +1 @@
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../motion.cjs");let t=require("react/jsx-runtime");function n(n){let r=e.t({present:n.present});return(0,t.jsx)(t.Fragment,{children:r.mounted?n.children(r):null})}n.displayName=`Presence`,exports.default=n;
@@ -0,0 +1,36 @@
1
+ import { Presence as PresenceHandle } from '../react/animation/usePresence';
2
+ interface Props {
3
+ /** Whether the child should be there. The exit starts the moment this goes false. */
4
+ present: boolean;
5
+ /** The subtree, told which way it is going. */
6
+ children: (presence: PresenceHandle) => React.ReactNode;
7
+ }
8
+ /**
9
+ * The exit half of the animation story: it keeps rendering its child with `present: false` until the
10
+ * child's own CSS says its transition is over, and only then lets React remove it. `startingStyle` is the
11
+ * entrance and needs no JavaScript at all — this is the ~1 KB the other direction costs, because React
12
+ * unmounts synchronously and there is nothing left to transition.
13
+ *
14
+ * ```tsx
15
+ * <Presence present={open}>
16
+ * {({ present, ref, props }) => (
17
+ * <Box ref={ref} props={props} opacity={present ? 1 : 0} startingStyle={{ opacity: 0 }} transitionDuration={200} />
18
+ * )}
19
+ * </Presence>
20
+ * ```
21
+ *
22
+ * A render prop rather than a cloned child, for the same reason `Tooltip`'s trigger is one: the child has
23
+ * to be told which way it is going, and cloning would have to guess where a `data-state` belongs — a Box
24
+ * takes DOM attributes in a `props` bag, a plain element takes them on top. The `ref` is not decoration
25
+ * either: whichever element it lands on is the one whose computed style the wait is measured from, so it
26
+ * belongs on the element that carries the transition.
27
+ *
28
+ * @a11y The exit is measured from the element's own `transition-duration`/`animation-duration`, so
29
+ * `prefers-reduced-motion` — which zeroes `--transitionTime` — removes the node in the same commit
30
+ * with no opt-in.
31
+ * @a11y `data-state` is `'open'` or `'closed'` on the child, which is what a CSS exit selects on. A
32
+ * node on its way out is still in the accessibility tree, so anything hiding it has to say so itself.
33
+ */
34
+ declare function Presence(props: Props): import("react").JSX.Element;
35
+ export default Presence;
36
+ export type { Presence as PresenceHandle, PresenceState } from '../react/animation/usePresence';
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { t as e } from "../motion.mjs";
3
+ import { Fragment as t, jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/presence.tsx
5
+ function r(r) {
6
+ let i = e({ present: r.present });
7
+ return /* @__PURE__ */ n(t, { children: i.mounted ? r.children(i) : null });
8
+ }
9
+ r.displayName = "Presence";
10
+ //#endregion
11
+ export { r 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/jsx-runtime"),n=require("@box-kite/react");n=e.t(n,1);function r(e){let{value:r,min:i=0,max:a=100,label:o,labelledBy:s,format:c,props:l,...u}=e,d=r===void 0,f=d?i:Math.min(Math.max(r,i),a),p=a<=i?0:Math.round((f-i)/(a-i)*1e4)/100;return(0,t.jsx)(n.default,{component:`progress`,...u,props:{role:`progressbar`,"aria-valuemin":i,"aria-valuemax":a,"aria-valuenow":d?void 0:f,"aria-valuetext":d?void 0:c?.(f),"aria-label":o,"aria-labelledby":s,...l},children:(0,t.jsx)(n.default,{component:`progress.fill`,variant:{indeterminate:d},style:d?void 0:{inlineSize:`${p}%`}})})}r.displayName=`Progress`,exports.default=r;
@@ -0,0 +1,47 @@
1
+ import { BoxProps } from '../box';
2
+ import { ComponentsAndVariants } from '@box-kite/core/types';
3
+ export interface ProgressProps<TKey extends keyof ComponentsAndVariants = 'progress'> extends BoxProps<'div', TKey> {
4
+ /** How far along it is. Leave it out for a task with no measurable end — the bar sweeps and reports nothing. */
5
+ value?: number;
6
+ /** The bottom of the range. Default `0`. */
7
+ min?: number;
8
+ /** The top of the range, and so what "full" means. Default `100`. */
9
+ max?: number;
10
+ /** What the bar is called. A progress bar has to be named — nothing about it is readable otherwise. */
11
+ label?: string;
12
+ /** The same, naming an element that already says it. */
13
+ labelledBy?: string;
14
+ /** The value as it should be read out: "3 of 10 files", "eleven minutes left". */
15
+ format?: (value: number) => string;
16
+ }
17
+ /**
18
+ * How far a task has got.
19
+ *
20
+ * ```tsx
21
+ * <Progress label="Upload" value={62} />
22
+ * <Progress label="Preparing" />
23
+ * ```
24
+ *
25
+ * **No `value` is the indeterminate bar**, which is a state and not a number: `aria-valuenow` is left off
26
+ * entirely — the one thing a reader must not be told is a progress that was never measured — and the bar
27
+ * sweeps instead, stopping under `prefers-reduced-motion` because a named duration is outside what
28
+ * `--transitionTime` zeroes.
29
+ *
30
+ * **The fill is an inline style and everything else is a class**, the exception `Slider` explains: a
31
+ * percentage that moves with a download is a rule per frame if it goes in a class name. Where the value
32
+ * is data rather than an animation, a `ProgressRing` from `components/chart` rounds it into a class
33
+ * instead and pays nothing.
34
+ *
35
+ * It renders on a server — no state, no effect, no measurement — so a page can paint a real figure
36
+ * before any JavaScript arrives.
37
+ *
38
+ * @a11y `role="progressbar"` with `aria-valuemin`, `aria-valuemax` and, when there is one, `aria-valuenow`.
39
+ * @a11y `label` or `labelledBy` is what names it. A bar with neither is a percentage nobody can attach
40
+ * to anything.
41
+ * @a11y `format` writes `aria-valuetext`, for a value the number alone does not read as.
42
+ */
43
+ declare function Progress<TKey extends keyof ComponentsAndVariants = 'progress'>(props: ProgressProps<TKey>): import("react").JSX.Element;
44
+ declare namespace Progress {
45
+ var displayName: string;
46
+ }
47
+ export default Progress;
@@ -0,0 +1,28 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import t from "@box-kite/react";
3
+ //#region src/components/progress.tsx
4
+ function n(n) {
5
+ let { value: r, min: i = 0, max: a = 100, label: o, labelledBy: s, format: c, props: l, ...u } = n, d = r === void 0, f = d ? i : Math.min(Math.max(r, i), a), p = a <= i ? 0 : Math.round((f - i) / (a - i) * 1e4) / 100;
6
+ return /* @__PURE__ */ e(t, {
7
+ component: "progress",
8
+ ...u,
9
+ props: {
10
+ role: "progressbar",
11
+ "aria-valuemin": i,
12
+ "aria-valuemax": a,
13
+ "aria-valuenow": d ? void 0 : f,
14
+ "aria-valuetext": d ? void 0 : c?.(f),
15
+ "aria-label": o,
16
+ "aria-labelledby": s,
17
+ ...l
18
+ },
19
+ children: /* @__PURE__ */ e(t, {
20
+ component: "progress.fill",
21
+ variant: { indeterminate: d },
22
+ style: d ? void 0 : { inlineSize: `${p}%` }
23
+ })
24
+ });
25
+ }
26
+ n.displayName = "Progress";
27
+ //#endregion
28
+ export { n as default };
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime.cjs"),t=require("../react-shared.cjs"),n=require("../forms.cjs");let r=require("react"),i=require("react/jsx-runtime"),a=require("@box-kite/react");a=e.t(a,1);var o=[`name`,`onInput`,`onChange`,`value`,`autoFocus`,`readOnly`,`defaultChecked`];function s(e,r){let{label:s,labelProps:c,...l}=e,u=t.i.buildProps(l,o,{type:`radio`});return(0,i.jsx)(n.n,{label:s,labelProps:c,children:(0,i.jsx)(a.default,{ref:r,tag:`input`,component:`radioButton`,...u})})}var c=(0,r.forwardRef)(s);c.displayName=`RadioButton`,exports.default=c;
@@ -0,0 +1,32 @@
1
+ import { RefAttributes } from 'react';
2
+ import { BoxProps, BoxTagProps } from '../box';
3
+ import { OmitTagProps } from '../react/boxProps';
4
+ import { ComponentsAndVariants } from '@box-kite/core/types';
5
+ declare const tagProps: readonly ["name", "onInput", "onChange", "value", "autoFocus", "readOnly", "defaultChecked"];
6
+ type TagPropsType = (typeof tagProps)[number];
7
+ type RadioButtonProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'input', TKey>, 'tag' | 'props'>;
8
+ type RadioButtonTagProps = OmitTagProps<BoxTagProps<'input'>, TagPropsType | 'type'>;
9
+ interface Props<TKey extends keyof ComponentsAndVariants> extends RadioButtonProps<TKey> {
10
+ /** The name the radios of one set share — it is what makes them one choice rather than several. */
11
+ name?: string;
12
+ /** Attributes for the `<input>` itself. `type` is the component's. */
13
+ props?: RadioButtonTagProps;
14
+ /** Fires on every click or keystroke. On a radio this is the same moment as `onChange`. */
15
+ onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
16
+ /** Fires when this radio becomes the chosen one. A radio never fires it on being cleared. */
17
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
18
+ /** What the set submits when this option is the chosen one. */
19
+ value?: string | number;
20
+ /** Focus it on mount. One per page at most — a stolen focus is a lost place in the document. */
21
+ autoFocus?: boolean;
22
+ /** Rendered and read, but not selectable. Unlike `disabled` it stays in the tab order and submits. */
23
+ readOnly?: boolean;
24
+ /** Makes this the chosen option to begin with, when the set is uncontrolled. */
25
+ defaultChecked?: boolean;
26
+ /** The text beside the radio, rendered inside a `<label>` that wraps the input. */
27
+ label?: React.ReactNode;
28
+ /** Styles for the wrapping `<label>`: the row's layout, not the radio's own appearance. */
29
+ labelProps?: BoxProps<'label'>;
30
+ }
31
+ declare const _default: <TKey extends keyof ComponentsAndVariants = "radioButton">(props: Props<TKey> & RefAttributes<HTMLInputElement>) => React.ReactNode;
32
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import { i as e } from "../react-shared.mjs";
2
+ import { n as t } from "../forms.mjs";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import i from "@box-kite/react";
6
+ //#region src/components/radioButton.tsx
7
+ var a = [
8
+ "name",
9
+ "onInput",
10
+ "onChange",
11
+ "value",
12
+ "autoFocus",
13
+ "readOnly",
14
+ "defaultChecked"
15
+ ];
16
+ function o(n, o) {
17
+ let { label: s, labelProps: c, ...l } = n, u = e.buildProps(l, a, { type: "radio" });
18
+ return /* @__PURE__ */ r(t, {
19
+ label: s,
20
+ labelProps: c,
21
+ children: /* @__PURE__ */ r(i, {
22
+ ref: o,
23
+ tag: "input",
24
+ component: "radioButton",
25
+ ...u
26
+ })
27
+ });
28
+ }
29
+ var s = n(o);
30
+ s.displayName = "RadioButton";
31
+ //#endregion
32
+ export { s as default };
@@ -0,0 +1 @@
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../behavior.cjs"),t=require("../identity.cjs"),n=require("./flex.cjs"),r=require("./semantics.cjs"),i=require("./radioButton.cjs");let a=require("react"),o=require("react/jsx-runtime");var s=(0,a.createContext)(null);function c(e){return[...e?.querySelectorAll(`input[type="radio"]`)??[]].filter(e=>!e.disabled)}function l(e){return e===`ArrowDown`||e===`ArrowRight`?1:e===`ArrowUp`||e===`ArrowLeft`?-1:0}function u(i){let{label:u,name:d,value:f,defaultValue:p,onValueChange:m,onChange:h,orientation:g=`vertical`,children:_,props:v,...y}=i,b=t.t(`radiogroup`),x=(0,a.useRef)(null),S=(0,a.useRef)(`click`),C=e.a((e,t)=>{m?.(e,t),h?.(e,t)}),[w,T]=e.i({value:f,defaultValue:p,onChange:C}),E=e.a(e=>{let t=l(e.key);if(t===0||e.defaultPrevented)return;let n=c(x.current),r=n.indexOf(document.activeElement);if(r===-1)return;e.preventDefault();let i=n[(r+t+n.length)%n.length];i!==n[r]&&(S.current=`keyboard`,i.focus(),i.click(),S.current=`click`)}),D=`${b}-label`,O=u!=null,k=(0,a.useMemo)(()=>({name:d??b,value:w,select:(e,t)=>T(e,{reason:S.current,event:t})}),[b,d,w,T]);return(0,o.jsx)(s.Provider,{value:k,children:(0,o.jsxs)(n.default,{ref:x,component:`radioGroup`,variant:{horizontal:g===`horizontal`},...y,props:{role:`radiogroup`,"aria-labelledby":O?D:void 0,...v,onKeyDown:E},children:[O&&(0,o.jsx)(r.Span,{component:`radioGroup.label`,id:D,children:u}),_]})})}function d(t){let n=(0,a.useContext)(s),{value:r,...c}=t,l=e.a(e=>n?.select(r,e));return n?(0,o.jsx)(i.default,{name:n.name,value:r,checked:n.value===r,onChange:l,...c}):(0,o.jsx)(i.default,{value:r,...c})}d.displayName=`RadioGroup.Item`;var f=u;f.Item=d,f.displayName=`RadioGroup`,exports.default=f;
@@ -0,0 +1,51 @@
1
+ import { Ref, RefAttributes } from 'react';
2
+ import { BoxProps, BoxTagProps } from '../box';
3
+ import { ChangeHandler } from '../react/a11y/useControllableState';
4
+ import { ComponentsAndVariants } from '@box-kite/core/types';
5
+ /** Why the selection changed — `onValueChange` gets this alongside the event that did it. */
6
+ export type RadioGroupReason = 'click' | 'keyboard';
7
+ type RadioGroupBoxProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'div', TKey>, 'tag' | 'onChange' | 'children'>;
8
+ interface Props<TKey extends keyof ComponentsAndVariants> extends RadioGroupBoxProps<TKey> {
9
+ /** The group's name, rendered above it and used as the group's accessible name. */
10
+ label?: React.ReactNode;
11
+ /** The `name` every radio in the group submits under. Generated when left out. */
12
+ name?: string;
13
+ /** Controlled selection. Leave it out and the group owns it. */
14
+ value?: string;
15
+ /** The option chosen to begin with, when the group owns its value. */
16
+ defaultValue?: string;
17
+ /** Fires with the new value and why it changed — `'click'` or `'keyboard'`. A group can also hold
18
+ * nothing, so the value is `string | undefined`. */
19
+ onValueChange?: ChangeHandler<string | undefined, RadioGroupReason>;
20
+ /**
21
+ * The same callback under its old name. Both fire, so either one can be passed.
22
+ * @deprecated `onValueChange` is what every other component reports a value change under, and a group
23
+ * is not an `<input>` — this spelling still works and means the same thing.
24
+ */
25
+ onChange?: ChangeHandler<string | undefined, RadioGroupReason>;
26
+ /** Which way the radios stack. Both arrow pairs navigate either way, as APG specifies. */
27
+ orientation?: 'vertical' | 'horizontal';
28
+ /** The options: `RadioGroup.Item` elements, or anything else the group should hold. */
29
+ children?: React.ReactNode;
30
+ }
31
+ interface ItemProps extends Omit<BoxProps<'input', 'radioButton'>, 'tag' | 'props' | 'onChange' | 'checked'> {
32
+ /** What this radio submits, and what the group reports when it is chosen. */
33
+ value: string;
34
+ /** Only for an item rendered outside a group — inside one, the group supplies the name. */
35
+ name?: string;
36
+ /** The text beside the radio, rendered inside a label that wraps the input. */
37
+ label?: React.ReactNode;
38
+ /** Styles for the wrapping `<label>`: the row's layout, not the radio's own appearance. */
39
+ labelProps?: BoxProps<'label'>;
40
+ /** Attributes for the `<input>` itself. `type`, `name` and `checked` are the group's. */
41
+ props?: BoxTagProps<'input'>;
42
+ /** The `<input>` element, for a caller that has to focus or measure this option. */
43
+ ref?: Ref<HTMLInputElement>;
44
+ }
45
+ interface RadioGroupType {
46
+ <TKey extends keyof ComponentsAndVariants = 'radioGroup'>(props: Props<TKey>): React.ReactNode;
47
+ Item: (props: ItemProps & RefAttributes<HTMLInputElement>) => React.ReactNode;
48
+ displayName?: string;
49
+ }
50
+ declare const RadioGroup: RadioGroupType;
51
+ export default RadioGroup;
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ import { a as e, i as t } from "../behavior.mjs";
3
+ import { t as n } from "../identity.mjs";
4
+ import r from "./flex.mjs";
5
+ import { Span as i } from "./semantics.mjs";
6
+ import a from "./radioButton.mjs";
7
+ import { createContext as o, useContext as s, useMemo as c, useRef as l } from "react";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ //#region src/components/radioGroup.tsx
10
+ var f = o(null);
11
+ function p(e) {
12
+ return [...e?.querySelectorAll("input[type=\"radio\"]") ?? []].filter((e) => !e.disabled);
13
+ }
14
+ function m(e) {
15
+ return e === "ArrowDown" || e === "ArrowRight" ? 1 : e === "ArrowUp" || e === "ArrowLeft" ? -1 : 0;
16
+ }
17
+ function h(a) {
18
+ let { label: o, name: s, value: h, defaultValue: g, onValueChange: _, onChange: v, orientation: y = "vertical", children: b, props: x, ...S } = a, C = n("radiogroup"), w = l(null), T = l("click"), E = e((e, t) => {
19
+ _?.(e, t), v?.(e, t);
20
+ }), [D, O] = t({
21
+ value: h,
22
+ defaultValue: g,
23
+ onChange: E
24
+ }), k = e((e) => {
25
+ let t = m(e.key);
26
+ if (t === 0 || e.defaultPrevented) return;
27
+ let n = p(w.current), r = n.indexOf(document.activeElement);
28
+ if (r === -1) return;
29
+ e.preventDefault();
30
+ let i = n[(r + t + n.length) % n.length];
31
+ i !== n[r] && (T.current = "keyboard", i.focus(), i.click(), T.current = "click");
32
+ }), A = `${C}-label`, j = o != null, M = c(() => ({
33
+ name: s ?? C,
34
+ value: D,
35
+ select: (e, t) => O(e, {
36
+ reason: T.current,
37
+ event: t
38
+ })
39
+ }), [
40
+ C,
41
+ s,
42
+ D,
43
+ O
44
+ ]);
45
+ return /* @__PURE__ */ u(f.Provider, {
46
+ value: M,
47
+ children: /* @__PURE__ */ d(r, {
48
+ ref: w,
49
+ component: "radioGroup",
50
+ variant: { horizontal: y === "horizontal" },
51
+ ...S,
52
+ props: {
53
+ role: "radiogroup",
54
+ "aria-labelledby": j ? A : void 0,
55
+ ...x,
56
+ onKeyDown: k
57
+ },
58
+ children: [j && /* @__PURE__ */ u(i, {
59
+ component: "radioGroup.label",
60
+ id: A,
61
+ children: o
62
+ }), b]
63
+ })
64
+ });
65
+ }
66
+ function g(t) {
67
+ let n = s(f), { value: r, ...i } = t, o = e((e) => n?.select(r, e));
68
+ return n ? /* @__PURE__ */ u(a, {
69
+ name: n.name,
70
+ value: r,
71
+ checked: n.value === r,
72
+ onChange: o,
73
+ ...i
74
+ }) : /* @__PURE__ */ u(a, {
75
+ value: r,
76
+ ...i
77
+ });
78
+ }
79
+ g.displayName = "RadioGroup.Item";
80
+ var _ = h;
81
+ _.Item = g, _.displayName = "RadioGroup";
82
+ //#endregion
83
+ export { _ as default };
@@ -0,0 +1 @@
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./dropdown.cjs");let t=require("react"),n=require("react/jsx-runtime");function r(r,i){let{data:a,def:o,...s}=r,{valueKey:c,displayKey:l,display:u,selectedDisplay:d,placeholder:f,selectAllText:p,emptyText:m}=o,h=(0,t.useMemo)(()=>{let e=new Map;for(let t of a)e.set(t[c],t);return e},[a,c]);return(0,n.jsxs)(e.default,{ref:i,...s,children:[f&&(0,n.jsx)(e.default.Unselect,{children:f}),p&&(0,n.jsx)(e.default.SelectAll,{children:p}),m&&(0,n.jsx)(e.default.EmptyItem,{children:m}),d&&(0,n.jsx)(e.default.Display,{children:(e,t)=>{let n=e.map(e=>h.get(e)).filter(Boolean);return d(n,t)}}),a.map(t=>{let r=t[c];return(0,n.jsx)(e.default.Item,{value:r,children:u?u(t):String(t[l??c])},r)})]})}var i=(0,t.forwardRef)(r);i.displayName=`Select`,exports.default=i;
@@ -0,0 +1,51 @@
1
+ import { RefAttributes } from 'react';
2
+ import { BoxProps } from '../box';
3
+ import { ChangeHandler } from '../react/a11y/useControllableState';
4
+ import { BoxStyleProps, ComponentsAndVariants } from '@box-kite/core/types';
5
+ import { DropdownValueReason } from './dropdown';
6
+ interface SelectDef<TRow> {
7
+ /** Key of TRow to use as the option value */
8
+ valueKey: keyof TRow & (string | number);
9
+ /** Key of TRow to display as option text (defaults to valueKey) */
10
+ displayKey?: keyof TRow;
11
+ /** Custom render function for each option */
12
+ display?: (row: TRow) => React.ReactNode;
13
+ /** Custom render function for the selected value display */
14
+ selectedDisplay?: (selectedRows: TRow[], isOpen: boolean) => React.ReactNode;
15
+ /** Placeholder text when nothing is selected */
16
+ placeholder?: string;
17
+ /** Text for "Select all" option in multiple mode */
18
+ selectAllText?: string;
19
+ /** Text shown when search yields no results */
20
+ emptyText?: string;
21
+ }
22
+ interface Props<TRow, TVal extends TRow[keyof TRow], TKey extends keyof ComponentsAndVariants = 'dropdown'> extends Omit<BoxProps<'button', TKey>, 'ref' | 'tag'> {
23
+ data: TRow[];
24
+ def: SelectDef<TRow>;
25
+ name?: string;
26
+ defaultValue?: TVal | TVal[];
27
+ value?: TVal | TVal[];
28
+ multiple?: boolean;
29
+ isSearchable?: boolean;
30
+ searchPlaceholder?: string;
31
+ hideIcon?: boolean;
32
+ showCheckbox?: boolean;
33
+ /** The select's name, rendered above it — see `label` on `Dropdown`. A combobox needs one. */
34
+ label?: React.ReactNode;
35
+ labelProps?: BoxProps<'div'>;
36
+ itemsProps?: BoxStyleProps;
37
+ iconProps?: BoxStyleProps;
38
+ /** Fires with the selection in whatever shape `value` takes, and why it changed — see `Dropdown`. */
39
+ onValueChange?: ChangeHandler<TVal | TVal[] | undefined, DropdownValueReason>;
40
+ /**
41
+ * The older callback, whose first argument is the option *acted on*. Both fire.
42
+ * @deprecated `onValueChange` is what every component reports a value change under, and it carries the
43
+ * reason. This spelling still works.
44
+ */
45
+ onChange?: (value: TVal | undefined, values: TVal[]) => void;
46
+ }
47
+ interface SelectType {
48
+ <TRow, TVal extends TRow[keyof TRow] = TRow[keyof TRow]>(props: Props<TRow, TVal> & RefAttributes<HTMLInputElement>): React.ReactNode;
49
+ }
50
+ declare const Select: SelectType;
51
+ export default Select;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import e from "./dropdown.mjs";
3
+ import { forwardRef as t, useMemo as n } from "react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/components/select.tsx
6
+ function a(t, a) {
7
+ let { data: o, def: s, ...c } = t, { valueKey: l, displayKey: u, display: d, selectedDisplay: f, placeholder: p, selectAllText: m, emptyText: h } = s, g = n(() => {
8
+ let e = /* @__PURE__ */ new Map();
9
+ for (let t of o) e.set(t[l], t);
10
+ return e;
11
+ }, [o, l]);
12
+ return /* @__PURE__ */ i(e, {
13
+ ref: a,
14
+ ...c,
15
+ children: [
16
+ p && /* @__PURE__ */ r(e.Unselect, { children: p }),
17
+ m && /* @__PURE__ */ r(e.SelectAll, { children: m }),
18
+ h && /* @__PURE__ */ r(e.EmptyItem, { children: h }),
19
+ f && /* @__PURE__ */ r(e.Display, { children: (e, t) => {
20
+ let n = e.map((e) => g.get(e)).filter(Boolean);
21
+ return f(n, t);
22
+ } }),
23
+ o.map((t) => {
24
+ let n = t[l];
25
+ return /* @__PURE__ */ r(e.Item, {
26
+ value: n,
27
+ children: d ? d(t) : String(t[u ?? l])
28
+ }, n);
29
+ })
30
+ ]
31
+ });
32
+ }
33
+ var o = t(a);
34
+ o.displayName = "Select";
35
+ //#endregion
36
+ export { o as default };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime.cjs"),t=require("../react-shared.cjs");let n=require("react"),r=require("react/jsx-runtime"),i=require("@box-kite/react");i=e.t(i,1);function a(e){let a=(0,n.forwardRef)((t,n)=>(0,r.jsx)(i.default,{tag:e,ref:n,component:e,...t}));return a.displayName=t.a.capitalize(e),a}var o=a(`label`),s=a(`span`),c=a(`article`),l=a(`aside`),u=a(`details`),d=a(`figcaption`),f=a(`figure`),p=a(`footer`),m=a(`header`),h=a(`main`),g=a(`mark`),_=a(`nav`),v=a(`menu`),y=v,b=a(`section`),x=a(`summary`),S=a(`time`),C=a(`p`),w=a(`ul`),T=a(`ol`),E=a(`li`),D=a(`h1`),O=a(`h2`),k=a(`h3`),A=a(`h4`),j=a(`h5`),M=a(`h6`),N=a(`a`),P=a(`img`);exports.Article=c,exports.Aside=l,exports.Details=u,exports.Figcaption=d,exports.Figure=f,exports.Footer=p,exports.H1=D,exports.H2=O,exports.H3=k,exports.H4=A,exports.H5=j,exports.H6=M,exports.Header=m,exports.Img=P,exports.Label=o,exports.Li=E,exports.Link=N,exports.Main=h,exports.Mark=g,exports.Menu=y,exports.MenuList=v,exports.Nav=_,exports.Ol=T,exports.P=C,exports.Section=b,exports.Span=s,exports.Summary=x,exports.Time=S,exports.Ul=w;