@box-kite/react 0.0.1 → 1.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 (188) hide show
  1. package/.claude/rules/box-kite-rules.md +43 -0
  2. package/.claude/skills/box-kite/SKILL.md +431 -0
  3. package/BOX_AI_CONTEXT.md +1833 -0
  4. package/BOX_KITE_AI_CONTEXT.md +1833 -0
  5. package/LICENSE +21 -0
  6. package/README.md +710 -7
  7. package/a11y.cjs +1 -0
  8. package/a11y.d.ts +15 -0
  9. package/a11y.mjs +3 -0
  10. package/behavior.cjs +1 -0
  11. package/behavior.mjs +295 -0
  12. package/box.cjs +1 -0
  13. package/box.d.ts +46 -0
  14. package/box.mjs +23 -0
  15. package/client.cjs +1 -0
  16. package/client.mjs +163 -0
  17. package/components/baseSvg.cjs +1 -0
  18. package/components/baseSvg.d.ts +5 -0
  19. package/components/baseSvg.mjs +21 -0
  20. package/components/button.cjs +1 -0
  21. package/components/button.d.ts +16 -0
  22. package/components/button.mjs +19 -0
  23. package/components/chart.cjs +1 -0
  24. package/components/chart.d.ts +82 -0
  25. package/components/chart.mjs +261 -0
  26. package/components/checkbox.cjs +1 -0
  27. package/components/checkbox.d.ts +28 -0
  28. package/components/checkbox.mjs +38 -0
  29. package/components/dataGrid/components/dataGridBody.d.ts +7 -0
  30. package/components/dataGrid/components/dataGridBottomBar.d.ts +6 -0
  31. package/components/dataGrid/components/dataGridCell.d.ts +15 -0
  32. package/components/dataGrid/components/dataGridCellRowDetail.d.ts +6 -0
  33. package/components/dataGrid/components/dataGridCellRowSelection.d.ts +6 -0
  34. package/components/dataGrid/components/dataGridCellText.d.ts +6 -0
  35. package/components/dataGrid/components/dataGridColumnFilter.d.ts +9 -0
  36. package/components/dataGrid/components/dataGridColumnGroups.d.ts +7 -0
  37. package/components/dataGrid/components/dataGridContent.d.ts +6 -0
  38. package/components/dataGrid/components/dataGridDetailRow.d.ts +8 -0
  39. package/components/dataGrid/components/dataGridEmptyColumns.d.ts +6 -0
  40. package/components/dataGrid/components/dataGridFilterCell.d.ts +11 -0
  41. package/components/dataGrid/components/dataGridFilterRow.d.ts +6 -0
  42. package/components/dataGrid/components/dataGridGlobalFilter.d.ts +6 -0
  43. package/components/dataGrid/components/dataGridGroupRow.d.ts +8 -0
  44. package/components/dataGrid/components/dataGridHeader.d.ts +6 -0
  45. package/components/dataGrid/components/dataGridHeaderCell.d.ts +9 -0
  46. package/components/dataGrid/components/dataGridHeaderCellContextMenu.d.ts +11 -0
  47. package/components/dataGrid/components/dataGridHeaderCellResizer.d.ts +14 -0
  48. package/components/dataGrid/components/dataGridLoader.d.ts +11 -0
  49. package/components/dataGrid/components/dataGridPagination.d.ts +6 -0
  50. package/components/dataGrid/components/dataGridRow.d.ts +8 -0
  51. package/components/dataGrid/components/dataGridTopBar.d.ts +6 -0
  52. package/components/dataGrid/components/dataGridTopBarContextMenu.d.ts +6 -0
  53. package/components/dataGrid/contracts/dataGridContract.d.ts +213 -0
  54. package/components/dataGrid/gridNavigationContext.d.ts +24 -0
  55. package/components/dataGrid/models/cellModel.d.ts +18 -0
  56. package/components/dataGrid/models/columnModel.d.ts +150 -0
  57. package/components/dataGrid/models/columnVisibilityModel.d.ts +24 -0
  58. package/components/dataGrid/models/detailRowModel.d.ts +22 -0
  59. package/components/dataGrid/models/filterModel.d.ts +22 -0
  60. package/components/dataGrid/models/gridModel.d.ts +206 -0
  61. package/components/dataGrid/models/groupRowCellModel.d.ts +26 -0
  62. package/components/dataGrid/models/groupRowModel.d.ts +48 -0
  63. package/components/dataGrid/models/headerCellModel.d.ts +83 -0
  64. package/components/dataGrid/models/paginationModel.d.ts +32 -0
  65. package/components/dataGrid/models/rowModel.d.ts +34 -0
  66. package/components/dataGrid/models/viewportModel.d.ts +44 -0
  67. package/components/dataGrid/useGrid.d.ts +8 -0
  68. package/components/dataGrid/useGridNavigation.d.ts +21 -0
  69. package/components/dataGrid.cjs +1 -0
  70. package/components/dataGrid.d.ts +2 -0
  71. package/components/dataGrid.mjs +3178 -0
  72. package/components/dropdown/dropdownContext.d.ts +44 -0
  73. package/components/dropdown/dropdownItems.d.ts +22 -0
  74. package/components/dropdown/dropdownRowRenderer.d.ts +8 -0
  75. package/components/dropdown/dropdownSearch.d.ts +21 -0
  76. package/components/dropdown/utils.d.ts +1 -0
  77. package/components/dropdown.cjs +1 -0
  78. package/components/dropdown.d.ts +47 -0
  79. package/components/dropdown.mjs +479 -0
  80. package/components/flex.cjs +1 -0
  81. package/components/flex.d.ts +6 -0
  82. package/components/flex.mjs +16 -0
  83. package/components/form.cjs +1 -0
  84. package/components/form.d.ts +10 -0
  85. package/components/form.mjs +58 -0
  86. package/components/grid.cjs +1 -0
  87. package/components/grid.d.ts +6 -0
  88. package/components/grid.mjs +16 -0
  89. package/components/icon.cjs +1 -0
  90. package/components/icon.d.ts +36 -0
  91. package/components/icon.mjs +41 -0
  92. package/components/overlay.cjs +1 -0
  93. package/components/overlay.d.ts +43 -0
  94. package/components/overlay.mjs +82 -0
  95. package/components/presence.cjs +1 -0
  96. package/components/presence.d.ts +30 -0
  97. package/components/presence.mjs +11 -0
  98. package/components/radioButton.cjs +1 -0
  99. package/components/radioButton.d.ts +24 -0
  100. package/components/radioButton.mjs +32 -0
  101. package/components/radioGroup.cjs +1 -0
  102. package/components/radioGroup.d.ts +38 -0
  103. package/components/radioGroup.mjs +79 -0
  104. package/components/select.cjs +1 -0
  105. package/components/select.d.ts +42 -0
  106. package/components/select.mjs +36 -0
  107. package/components/semantics.cjs +1 -0
  108. package/components/semantics.d.ts +34 -0
  109. package/components/semantics.mjs +17 -0
  110. package/components/svg.cjs +1 -0
  111. package/components/svg.d.ts +63 -0
  112. package/components/svg.mjs +141 -0
  113. package/components/switch.cjs +1 -0
  114. package/components/switch.d.ts +20 -0
  115. package/components/switch.mjs +25 -0
  116. package/components/textarea.cjs +1 -0
  117. package/components/textarea.d.ts +27 -0
  118. package/components/textarea.mjs +33 -0
  119. package/components/textbox.cjs +1 -0
  120. package/components/textbox.d.ts +26 -0
  121. package/components/textbox.mjs +33 -0
  122. package/components/tooltip.cjs +1 -0
  123. package/components/tooltip.d.ts +63 -0
  124. package/components/tooltip.mjs +108 -0
  125. package/components/visuallyHidden.cjs +1 -0
  126. package/components/visuallyHidden.d.ts +6 -0
  127. package/components/visuallyHidden.mjs +23 -0
  128. package/effects.cjs +1 -0
  129. package/effects.mjs +6 -0
  130. package/forms.cjs +1 -0
  131. package/forms.mjs +21 -0
  132. package/icons/dotsIcon.d.ts +2 -0
  133. package/icons/expandIcon.d.ts +2 -0
  134. package/icons/groupingIcon.d.ts +2 -0
  135. package/icons/pinIcon.d.ts +2 -0
  136. package/icons/searchIcon.d.ts +2 -0
  137. package/icons/sortIcon.d.ts +2 -0
  138. package/motion.cjs +1 -0
  139. package/motion.mjs +66 -0
  140. package/package.json +203 -7
  141. package/platform.cjs +1 -0
  142. package/platform.mjs +32 -0
  143. package/react/a11y/callbacks.d.ts +12 -0
  144. package/react/a11y/useControllableState.d.ts +25 -0
  145. package/react/a11y/useDismiss.d.ts +25 -0
  146. package/react/a11y/useFocusReturn.d.ts +18 -0
  147. package/react/a11y/useIdentifier.d.ts +17 -0
  148. package/react/a11y/useRovingFocus.d.ts +84 -0
  149. package/react/animation/usePresence.d.ts +32 -0
  150. package/react/boxClassNames.d.ts +25 -0
  151. package/react/boxProps.d.ts +49 -0
  152. package/react/boxTagProps.d.ts +7 -0
  153. package/react/clientRuntime.d.ts +11 -0
  154. package/react/effects.d.ts +10 -0
  155. package/react/forms/labelledControl.d.ts +17 -0
  156. package/react/forms/placeholderProp.d.ts +13 -0
  157. package/react/hooks/usePortalContainer.d.ts +1 -0
  158. package/react/hooks/useVirtualization.d.ts +43 -0
  159. package/react/hooks/useVisibility.d.ts +9 -0
  160. package/react/reactTypes.d.ts +10 -0
  161. package/react/resolveStyles.d.ts +18 -0
  162. package/react/styleElements.d.ts +3 -0
  163. package/react/svg/attributesInProps.d.ts +4 -0
  164. package/react/svg/svgNaming.d.ts +15 -0
  165. package/react/theme/theme.d.ts +26 -0
  166. package/react/theme/themeContext.d.ts +7 -0
  167. package/react/useStyles.d.ts +22 -0
  168. package/react-shared.cjs +1 -0
  169. package/react-shared.mjs +105 -0
  170. package/rolldown-runtime.cjs +1 -0
  171. package/rsc.cjs +1 -0
  172. package/rsc.d.ts +27 -0
  173. package/rsc.mjs +18 -0
  174. package/ssg.cjs +1 -0
  175. package/ssg.d.ts +24 -0
  176. package/ssg.mjs +25 -0
  177. package/utils/animation/animationUtils.d.ts +29 -0
  178. package/utils/array/arrayUtils.d.ts +15 -0
  179. package/utils/box/boxUtils.d.ts +5 -0
  180. package/utils/chart/chartUtils.d.ts +98 -0
  181. package/utils/dom/domUtils.d.ts +26 -0
  182. package/utils/environment/environmentUtils.d.ts +18 -0
  183. package/utils/fn/fnUtils.d.ts +4 -0
  184. package/utils/form/formUtils.d.ts +8 -0
  185. package/utils/memo.d.ts +10 -0
  186. package/utils/object/objectUtils.d.ts +13 -0
  187. package/utils/string/fuzzySearch.d.ts +27 -0
  188. package/utils/string/stringUtils.d.ts +4 -0
@@ -0,0 +1,33 @@
1
+ import { t as e } from "../react-shared.mjs";
2
+ import { 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/textarea.tsx
7
+ var a = [
8
+ "name",
9
+ "onInput",
10
+ "onChange",
11
+ "value",
12
+ "defaultValue",
13
+ "rows",
14
+ "cols",
15
+ "autoFocus",
16
+ "maxLength",
17
+ "minLength",
18
+ "readOnly"
19
+ ];
20
+ function o(n, o) {
21
+ let { placeholder: s, ...c } = n, { text: l, styles: u } = t(s), d = e.buildProps(c, a, l === void 0 ? void 0 : { placeholder: l });
22
+ return /* @__PURE__ */ r(i, {
23
+ ref: o,
24
+ tag: "textarea",
25
+ component: "textarea",
26
+ ...d,
27
+ placeholder: u
28
+ });
29
+ }
30
+ var s = n(o);
31
+ s.displayName = "Textarea";
32
+ //#endregion
33
+ export { s 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`,`type`,`step`,`defaultValue`,`autoFocus`,`readOnly`,`required`,`value`,`pattern`];function s(e,r){let{placeholder:s,...c}=e,{text:l,styles:u}=n.t(s),d=t.t.buildProps(c,o,l===void 0?void 0:{placeholder:l});return(0,i.jsx)(a.default,{ref:r,tag:`input`,component:`textbox`,...d,placeholder:u})}var c=(0,r.forwardRef)(s);c.displayName=`Textbox`,exports.default=c;
@@ -0,0 +1,26 @@
1
+ import { RefAttributes } from 'react';
2
+ import { BoxProps, BoxTagProps } from '../box';
3
+ import { OmitTagProps } from '../react/boxProps';
4
+ import { PlaceholderProp } from '../react/forms/placeholderProp';
5
+ import { ComponentsAndVariants } from '@box-kite/core/types';
6
+ declare const tagProps: readonly ["name", "onInput", "onChange", "type", "step", "defaultValue", "autoFocus", "readOnly", "required", "value", "pattern"];
7
+ type TagPropsType = (typeof tagProps)[number];
8
+ type TextareaProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'input', TKey>, 'tag' | 'props' | 'placeholder'>;
9
+ type TextboxTagProps = OmitTagProps<BoxTagProps<'input'>, TagPropsType>;
10
+ type TextboxType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
11
+ interface Props<TKey extends keyof ComponentsAndVariants> extends TextareaProps<TKey> {
12
+ name?: string;
13
+ props?: TextboxTagProps;
14
+ onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
15
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
16
+ type?: TextboxType;
17
+ placeholder?: PlaceholderProp;
18
+ value?: string | number;
19
+ defaultValue?: string | number;
20
+ pattern?: string;
21
+ autoFocus?: boolean;
22
+ readOnly?: boolean;
23
+ step?: number | string;
24
+ }
25
+ declare const _default: <TKey extends keyof ComponentsAndVariants = "textbox">(props: Props<TKey> & RefAttributes<HTMLInputElement>) => React.ReactNode;
26
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { t as e } from "../react-shared.mjs";
2
+ import { 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/textbox.tsx
7
+ var a = [
8
+ "name",
9
+ "onInput",
10
+ "onChange",
11
+ "type",
12
+ "step",
13
+ "defaultValue",
14
+ "autoFocus",
15
+ "readOnly",
16
+ "required",
17
+ "value",
18
+ "pattern"
19
+ ];
20
+ function o(n, o) {
21
+ let { placeholder: s, ...c } = n, { text: l, styles: u } = t(s), d = e.buildProps(c, a, l === void 0 ? void 0 : { placeholder: l });
22
+ return /* @__PURE__ */ r(i, {
23
+ ref: o,
24
+ tag: "input",
25
+ component: "textbox",
26
+ ...d,
27
+ placeholder: u
28
+ });
29
+ }
30
+ var s = n(o);
31
+ s.displayName = "Textbox";
32
+ //#endregion
33
+ 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("./overlay.cjs"),n=require("./presence.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(a){let{content:o,children:s,open:c,defaultOpen:l=!1,onOpenChange:u,openDelay:d=300,closeDelay:f=150,adjustTranslateX:p,adjustTranslateY:m,props:h,...g}=a,_=e.n(`tooltip`),v=g.id??_,[y,b]=e.a({value:c,defaultValue:l,onChange:u}),[x,S]=(0,r.useState)(null),C=(0,r.useRef)(null),w=(0,r.useRef)(void 0),T=(0,r.useRef)(!1),E=(0,r.useRef)(!1),D=(0,r.useRef)(!1),O=(0,r.useRef)(!1),k=(0,r.useCallback)(()=>{clearTimeout(w.current),w.current=void 0},[]),A=(0,r.useCallback)((e,t)=>{if(k(),e<=0){t();return}w.current=setTimeout(()=>{w.current=void 0,t()},e)},[k]),j=(0,r.useCallback)((e,t)=>{A(f,()=>{T.current||E.current||D.current||b(!1,{reason:e,event:t})})},[f,A,b]);e.i({enabled:y,outsidePointer:!1,inside:[C],onDismiss:(e,t)=>{k(),O.current=!0,b(!1,{reason:e,event:t})}}),(0,r.useEffect)(()=>k,[k]);let M=y&&o!=null,N=e.o(e=>{T.current=!0,!O.current&&A(d,()=>b(!0,{reason:`hover`,event:e}))}),P=e.o(e=>{T.current=!1,O.current=!1,j(`pointer-leave`,e)}),F=e.o(e=>{D.current=!0,k(),b(!0,{reason:`focus`,event:e})}),I=e.o(e=>{D.current=!1,O.current=!1,j(`blur`,e)}),L=e.o(()=>{E.current=!0,k()}),R=e.o(e=>{E.current=!1,j(`pointer-leave`,e)}),z=(0,r.useMemo)(()=>({ref:S,props:{"aria-describedby":M?v:void 0,onPointerEnter:N,onPointerLeave:P,onFocus:F,onBlur:I}}),[I,N,F,P,M,v]);return(0,i.jsxs)(i.Fragment,{children:[s(z),(0,i.jsx)(n.default,{present:M,children:e=>(0,i.jsx)(t.default,{ref:C,contentRef:e.ref,anchor:x,anchorSide:`bottom`,matchWidth:!1,adjustTranslateX:p,adjustTranslateY:m??`4px`,component:`tooltip`,...g,variant:[g.variant,{closed:!e.present}],id:v,props:{role:`tooltip`,...e.props,...h,onPointerEnter:L,onPointerLeave:R},children:o})})]})}a.displayName=`Tooltip`,exports.default=a;
@@ -0,0 +1,63 @@
1
+ import { BoxProps } from '../box';
2
+ import { ChangeHandler } from '../react/a11y/useControllableState';
3
+ import { ComponentsAndVariants } from '@box-kite/core/types';
4
+ /** Why the tooltip opened or closed — `onOpenChange` gets this alongside the event that did it. */
5
+ export type TooltipReason = 'hover' | 'focus' | 'pointer-leave' | 'blur' | 'escape';
6
+ /** The DOM attributes and handlers the trigger has to carry. */
7
+ export interface TooltipTriggerAttributes {
8
+ 'aria-describedby'?: string;
9
+ onPointerEnter(event: React.PointerEvent): void;
10
+ onPointerLeave(event: React.PointerEvent): void;
11
+ onFocus(event: React.FocusEvent): void;
12
+ onBlur(event: React.FocusEvent): void;
13
+ }
14
+ /**
15
+ * What the trigger has to carry: spread it onto the control itself, not a wrapper, because
16
+ * `aria-describedby` only means something on the element the user lands on. The `ref` is what the
17
+ * tooltip is positioned against, so it is not optional decoration (see `anchor` on `Overlay`).
18
+ *
19
+ * ```tsx
20
+ * {(trigger) => <Button {...trigger}>Delete</Button>} // a Box component
21
+ * {(trigger) => <button ref={trigger.ref} {...trigger.props}>} // a plain element
22
+ * ```
23
+ */
24
+ export interface TooltipTrigger {
25
+ ref: React.RefCallback<HTMLElement>;
26
+ props: TooltipTriggerAttributes;
27
+ }
28
+ type TooltipBoxProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'div', TKey>, 'children' | 'content' | 'open'>;
29
+ interface Props<TKey extends keyof ComponentsAndVariants> extends TooltipBoxProps<TKey> {
30
+ /** The description itself. Nothing renders while this is empty. */
31
+ content?: React.ReactNode;
32
+ /** The trigger, handed the ref and props that wire it to the tooltip. */
33
+ children: (trigger: TooltipTrigger) => React.ReactNode;
34
+ /** Controlled open state. Leave it out and the tooltip owns it. */
35
+ open?: boolean;
36
+ defaultOpen?: boolean;
37
+ onOpenChange?: ChangeHandler<boolean, TooltipReason>;
38
+ /**
39
+ * How long the pointer has to rest on the trigger, in ms. Default 300 — sweeping across a toolbar should
40
+ * not light every control up. Focus ignores it: a keyboard user asked for the tooltip by arriving.
41
+ */
42
+ openDelay?: number;
43
+ /** The grace period after the pointer leaves, in ms. Default 150, so the pointer can reach the tooltip (WCAG 1.4.13). */
44
+ closeDelay?: number;
45
+ adjustTranslateX?: string;
46
+ adjustTranslateY?: string;
47
+ }
48
+ /**
49
+ * The APG tooltip: a description that appears on hover *and* on focus and stays until the user is done
50
+ * with it. Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
51
+ *
52
+ * ```tsx
53
+ * <Tooltip content="Deletes the row for good">{(trigger) => <Button {...trigger}>Delete</Button>}</Tooltip>
54
+ * ```
55
+ *
56
+ * The trigger is a render prop rather than a cloned child: cloning would have to guess where a child
57
+ * wants its DOM attributes (Box takes a `props` bag, a `<button>` takes them on top), and guessing wrong
58
+ * on `aria-describedby` costs the thing the pattern is for. The component owns `role="tooltip"`, the
59
+ * `aria-describedby`, and WCAG 1.4.13's three obligations — dismissible with Escape without moving focus,
60
+ * hoverable, and never closed on a timer. Focus never enters it: a focusable tooltip is a mislabelled dialog.
61
+ */
62
+ declare function Tooltip<TKey extends keyof ComponentsAndVariants = 'tooltip'>(props: Props<TKey>): import("react").JSX.Element;
63
+ export default Tooltip;
@@ -0,0 +1,108 @@
1
+ "use client";
2
+ import { a as e, i as t, n, o as r } from "../behavior.mjs";
3
+ import i from "./overlay.mjs";
4
+ import a from "./presence.mjs";
5
+ import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
6
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ //#region src/components/tooltip.tsx
8
+ function m(m) {
9
+ let { content: h, children: g, open: _, defaultOpen: v = !1, onOpenChange: y, openDelay: b = 300, closeDelay: x = 150, adjustTranslateX: S, adjustTranslateY: C, props: w, ...T } = m, E = n("tooltip"), D = T.id ?? E, [O, k] = e({
10
+ value: _,
11
+ defaultValue: v,
12
+ onChange: y
13
+ }), [A, j] = u(null), M = l(null), N = l(void 0), P = l(!1), F = l(!1), I = l(!1), L = l(!1), R = o(() => {
14
+ clearTimeout(N.current), N.current = void 0;
15
+ }, []), z = o((e, t) => {
16
+ if (R(), e <= 0) {
17
+ t();
18
+ return;
19
+ }
20
+ N.current = setTimeout(() => {
21
+ N.current = void 0, t();
22
+ }, e);
23
+ }, [R]), B = o((e, t) => {
24
+ z(x, () => {
25
+ P.current || F.current || I.current || k(!1, {
26
+ reason: e,
27
+ event: t
28
+ });
29
+ });
30
+ }, [
31
+ x,
32
+ z,
33
+ k
34
+ ]);
35
+ t({
36
+ enabled: O,
37
+ outsidePointer: !1,
38
+ inside: [M],
39
+ onDismiss: (e, t) => {
40
+ R(), L.current = !0, k(!1, {
41
+ reason: e,
42
+ event: t
43
+ });
44
+ }
45
+ }), s(() => R, [R]);
46
+ let V = O && h != null, H = r((e) => {
47
+ P.current = !0, !L.current && z(b, () => k(!0, {
48
+ reason: "hover",
49
+ event: e
50
+ }));
51
+ }), U = r((e) => {
52
+ P.current = !1, L.current = !1, B("pointer-leave", e);
53
+ }), W = r((e) => {
54
+ I.current = !0, R(), k(!0, {
55
+ reason: "focus",
56
+ event: e
57
+ });
58
+ }), G = r((e) => {
59
+ I.current = !1, L.current = !1, B("blur", e);
60
+ }), K = r(() => {
61
+ F.current = !0, R();
62
+ }), q = r((e) => {
63
+ F.current = !1, B("pointer-leave", e);
64
+ }), J = c(() => ({
65
+ ref: j,
66
+ props: {
67
+ "aria-describedby": V ? D : void 0,
68
+ onPointerEnter: H,
69
+ onPointerLeave: U,
70
+ onFocus: W,
71
+ onBlur: G
72
+ }
73
+ }), [
74
+ G,
75
+ H,
76
+ W,
77
+ U,
78
+ V,
79
+ D
80
+ ]);
81
+ return /* @__PURE__ */ p(d, { children: [g(J), /* @__PURE__ */ f(a, {
82
+ present: V,
83
+ children: (e) => /* @__PURE__ */ f(i, {
84
+ ref: M,
85
+ contentRef: e.ref,
86
+ anchor: A,
87
+ anchorSide: "bottom",
88
+ matchWidth: !1,
89
+ adjustTranslateX: S,
90
+ adjustTranslateY: C ?? "4px",
91
+ component: "tooltip",
92
+ ...T,
93
+ variant: [T.variant, { closed: !e.present }],
94
+ id: D,
95
+ props: {
96
+ role: "tooltip",
97
+ ...e.props,
98
+ ...w,
99
+ onPointerEnter: K,
100
+ onPointerLeave: q
101
+ },
102
+ children: h
103
+ })
104
+ })] });
105
+ }
106
+ m.displayName = "Tooltip";
107
+ //#endregion
108
+ export { m 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);var i=.25;function a(e,t){return(0,n.jsx)(r.default,{ref:t,position:`absolute`,width:i,height:i,p:0,b:0,overflow:`hidden`,whiteSpace:`nowrap`,clipPath:`inset(50%)`,...e})}var o=(0,t.forwardRef)(a);o.displayName=`VisuallyHidden`,exports.default=o;
@@ -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,23 @@
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/visuallyHidden.tsx
5
+ var r = .25;
6
+ function i(e, i) {
7
+ return /* @__PURE__ */ t(n, {
8
+ ref: i,
9
+ position: "absolute",
10
+ width: r,
11
+ height: r,
12
+ p: 0,
13
+ b: 0,
14
+ overflow: "hidden",
15
+ whiteSpace: "nowrap",
16
+ clipPath: "inset(50%)",
17
+ ...e
18
+ });
19
+ }
20
+ var a = e(i);
21
+ a.displayName = "VisuallyHidden";
22
+ //#endregion
23
+ export { a as default };
package/effects.cjs ADDED
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime.cjs"),t=require("./platform.cjs");let n=require("react");n=e.t(n,1);var r=t.n(),i=r?n.useLayoutEffect:n.useEffect,a=r?n.default.useInsertionEffect??n.useLayoutEffect:n.useEffect;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
package/effects.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { n as e } from "./platform.mjs";
2
+ import t, { useEffect as n, useLayoutEffect as r } from "react";
3
+ //#region src/react/effects.ts
4
+ var i = e(), a = i ? r : n, o = i ? t.useInsertionEffect ?? r : n;
5
+ //#endregion
6
+ export { a as n, o as t };
package/forms.cjs ADDED
@@ -0,0 +1 @@
1
+ const e=require("./components/flex.cjs");let t=require("react/jsx-runtime");function n({label:n,labelProps:r,children:i}){return n==null||n===!1?i:(0,t.jsxs)(e.default,{inline:!0,tag:`label`,ai:`center`,gap:2,cursor:`pointer`,...r,children:[i,n]})}function r(e){return e==null?{}:typeof e==`string`?{text:e}:{styles:e}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
package/forms.mjs ADDED
@@ -0,0 +1,21 @@
1
+ import e from "./components/flex.mjs";
2
+ import { jsxs as t } from "react/jsx-runtime";
3
+ //#region src/react/forms/labelledControl.tsx
4
+ function n({ label: n, labelProps: r, children: i }) {
5
+ return n == null || n === !1 ? i : /* @__PURE__ */ t(e, {
6
+ inline: !0,
7
+ tag: "label",
8
+ ai: "center",
9
+ gap: 2,
10
+ cursor: "pointer",
11
+ ...r,
12
+ children: [i, n]
13
+ });
14
+ }
15
+ //#endregion
16
+ //#region src/react/forms/placeholderProp.ts
17
+ function r(e) {
18
+ return e == null ? {} : typeof e == "string" ? { text: e } : { styles: e };
19
+ }
20
+ //#endregion
21
+ export { n, r as t };
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../components/svg';
2
+ export default function DotsIcon(props: SvgProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../components/svg';
2
+ export default function ExpandIcon(props: SvgProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../components/svg';
2
+ export default function GroupingIcon(props: SvgProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../components/svg';
2
+ export default function PinIcon(props: SvgProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../components/svg';
2
+ export default function SearchIcon(props: SvgProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../components/svg';
2
+ export default function SortIcon(props: SvgProps): import("react").JSX.Element;
package/motion.cjs ADDED
@@ -0,0 +1 @@
1
+ const e=require("./effects.cjs");let t=require("react");var n;(function(e){e.SETTLE_FRAME=16;function t(e){let t=parseFloat(e);return Number.isNaN(t)?0:e.endsWith(`ms`)?t:t*1e3}function n(e){return e.split(`,`).map(e=>e.trim())}function r(e,t){return e[t%e.length]}function i(e){return e===``?1:parseFloat(e)}function a(e){let i=n(e.transitionDuration),a=n(e.transitionDelay),o=0;for(let e=0;e<Math.max(i.length,a.length);e++)o=Math.max(o,t(r(i,e))+t(r(a,e)));return o}function o(e){let a=n(e.animationDuration),o=n(e.animationDelay),s=n(e.animationIterationCount);return n(e.animationName).reduce((e,n,c)=>{if(n===``||n===`none`)return e;let l=i(r(s,c));return Number.isFinite(l)?Math.max(e,t(r(a,c))*l+t(r(o,c))):e},0)}function s(e){return Math.max(a(e),o(e))}e.activeDuration=s})(n||={});var r=n;function i(n){let{present:i}=n,[a,o]=(0,t.useState)(i?`open`:`closed`),s=(0,t.useRef)(null),c=(0,t.useCallback)(e=>{s.current=e},[]),l=i?`open`:a===`closed`?`closed`:`leaving`;return l!==a&&o(l),e.n(()=>{if(l!==`leaving`)return;let e=s.current,t=e?r.activeDuration(getComputedStyle(e)):0;if(t<=0){o(`closed`);return}let n=setTimeout(()=>o(`closed`),t+r.SETTLE_FRAME);return()=>clearTimeout(n)},[l]),(0,t.useMemo)(()=>{let e=l===`open`?`open`:`closed`;return{mounted:l!==`closed`,present:l===`open`,state:e,ref:c,props:{"data-state":e}}},[l,c])}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
package/motion.mjs ADDED
@@ -0,0 +1,66 @@
1
+ import { n as e } from "./effects.mjs";
2
+ import { useCallback as t, useMemo as n, useRef as r, useState as i } from "react";
3
+ //#region src/utils/animation/animationUtils.ts
4
+ var a;
5
+ (function(e) {
6
+ e.SETTLE_FRAME = 16;
7
+ function t(e) {
8
+ let t = parseFloat(e);
9
+ return Number.isNaN(t) ? 0 : e.endsWith("ms") ? t : t * 1e3;
10
+ }
11
+ function n(e) {
12
+ return e.split(",").map((e) => e.trim());
13
+ }
14
+ function r(e, t) {
15
+ return e[t % e.length];
16
+ }
17
+ function i(e) {
18
+ return e === "" ? 1 : parseFloat(e);
19
+ }
20
+ function a(e) {
21
+ let i = n(e.transitionDuration), a = n(e.transitionDelay), o = 0;
22
+ for (let e = 0; e < Math.max(i.length, a.length); e++) o = Math.max(o, t(r(i, e)) + t(r(a, e)));
23
+ return o;
24
+ }
25
+ function o(e) {
26
+ let a = n(e.animationDuration), o = n(e.animationDelay), s = n(e.animationIterationCount);
27
+ return n(e.animationName).reduce((e, n, c) => {
28
+ if (n === "" || n === "none") return e;
29
+ let l = i(r(s, c));
30
+ return Number.isFinite(l) ? Math.max(e, t(r(a, c)) * l + t(r(o, c))) : e;
31
+ }, 0);
32
+ }
33
+ function s(e) {
34
+ return Math.max(a(e), o(e));
35
+ }
36
+ e.activeDuration = s;
37
+ })(a ||= {});
38
+ var o = a;
39
+ //#endregion
40
+ //#region src/react/animation/usePresence.ts
41
+ function s(a) {
42
+ let { present: s } = a, [c, l] = i(s ? "open" : "closed"), u = r(null), d = t((e) => {
43
+ u.current = e;
44
+ }, []), f = s ? "open" : c === "closed" ? "closed" : "leaving";
45
+ return f !== c && l(f), e(() => {
46
+ if (f !== "leaving") return;
47
+ let e = u.current, t = e ? o.activeDuration(getComputedStyle(e)) : 0;
48
+ if (t <= 0) {
49
+ l("closed");
50
+ return;
51
+ }
52
+ let n = setTimeout(() => l("closed"), t + o.SETTLE_FRAME);
53
+ return () => clearTimeout(n);
54
+ }, [f]), n(() => {
55
+ let e = f === "open" ? "open" : "closed";
56
+ return {
57
+ mounted: f !== "closed",
58
+ present: f === "open",
59
+ state: e,
60
+ ref: d,
61
+ props: { "data-state": e }
62
+ };
63
+ }, [f, d]);
64
+ }
65
+ //#endregion
66
+ export { s as t };
package/package.json CHANGED
@@ -1,15 +1,211 @@
1
1
  {
2
2
  "name": "@box-kite/react",
3
- "version": "0.0.1",
4
- "description": "Reserved for the boxkite project's React bindings. Not yet usable.",
5
- "license": "MIT",
6
- "author": "Maxim Procopenco",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "sideEffects": [
6
+ "pages/**"
7
+ ],
8
+ "main": "./box.cjs",
9
+ "module": "./box.mjs",
10
+ "types": "./box.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "react-server": {
14
+ "types": "./rsc.d.ts",
15
+ "import": "./rsc.mjs",
16
+ "require": "./rsc.cjs"
17
+ },
18
+ "types": "./box.d.ts",
19
+ "import": "./box.mjs",
20
+ "require": "./box.cjs"
21
+ },
22
+ "./rsc": {
23
+ "types": "./rsc.d.ts",
24
+ "import": "./rsc.mjs",
25
+ "require": "./rsc.cjs"
26
+ },
27
+ "./a11y": {
28
+ "types": "./a11y.d.ts",
29
+ "import": "./a11y.mjs",
30
+ "require": "./a11y.cjs"
31
+ },
32
+ "./ssg": {
33
+ "types": "./ssg.d.ts",
34
+ "import": "./ssg.mjs",
35
+ "require": "./ssg.cjs"
36
+ },
37
+ "./components/*": {
38
+ "types": "./components/*.d.ts",
39
+ "import": "./components/*.mjs",
40
+ "require": "./components/*.cjs"
41
+ }
42
+ },
43
+ "scripts": {
44
+ "dev": "vite ./pages --config ./pages.vite.config.ts --mode dev",
45
+ "dev:vanilla": "vite ./examples/vanilla --config ./examples/vanilla/vite.config.ts",
46
+ "build:vanilla": "vite build ./examples/vanilla --config ./examples/vanilla/vite.config.ts",
47
+ "pack:local": "node scripts/packLocal.mjs",
48
+ "install:next-app": "npm run pack:local && npm --prefix examples/next-app install --no-package-lock",
49
+ "dev:next-app": "npm run install:next-app && npm --prefix examples/next-app run dev",
50
+ "build:next-app": "npm run install:next-app && npm --prefix examples/next-app run build",
51
+ "smoke:next-app": "npm --prefix examples/next-app run smoke",
52
+ "build:pages": "vite build ./pages --config ./pages.vite.config.ts --outDir ../dist-pages --mode production && npm run prerender:pages",
53
+ "prerender:pages": "node scripts/prerender-pages.mjs",
54
+ "preview": "vite preview ./pages --config ./pages.vite.config.ts --outDir ../dist-pages",
55
+ "build": "npm run build:core && vite build",
56
+ "build:core": "vite build --config vite.core.config.ts && node scripts/postbuild-core.mjs",
57
+ "postbuild": "node scripts/postbuild.mjs",
58
+ "build:bridge": "node scripts/build-bridge.mjs",
59
+ "build:dev": "npm run build:core && vite build --mode dev",
60
+ "compile": "tsc --noEmit --skipLibCheck",
61
+ "test": "vitest run",
62
+ "test:coverage": "vitest run --coverage",
63
+ "test:watch": "vitest",
64
+ "test:a11y": "vitest run a11y",
65
+ "lint": "eslint .",
66
+ "check:boundaries": "node scripts/check-core-boundary.mjs && node scripts/check-rsc-boundary.mjs",
67
+ "check:brand": "node scripts/check-brand.mjs",
68
+ "check:docs": "node scripts/check-docs-snippets.mjs",
69
+ "check:props": "node scripts/check-props-api.mjs",
70
+ "docs:props": "node scripts/check-props-api.mjs --fix",
71
+ "check:package": "publint dist && attw --pack dist --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error && publint dist-core && attw --pack dist-core --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error",
72
+ "size": "size-limit"
73
+ },
74
+ "size-limit": [
75
+ {
76
+ "name": "Box core (main entry)",
77
+ "path": "dist/box.mjs",
78
+ "ignore": [
79
+ "react",
80
+ "react-dom"
81
+ ],
82
+ "gzip": true,
83
+ "limit": "26.20 KB"
84
+ },
85
+ {
86
+ "name": "Box in a Server Component (react-server entry)",
87
+ "path": "dist/rsc.mjs",
88
+ "ignore": [
89
+ "react",
90
+ "react-dom"
91
+ ],
92
+ "gzip": true,
93
+ "limit": "24.70 KB"
94
+ },
95
+ {
96
+ "name": "Behavior primitives (a11y entry)",
97
+ "path": "dist/a11y.mjs",
98
+ "ignore": [
99
+ "react",
100
+ "react-dom"
101
+ ],
102
+ "gzip": true,
103
+ "limit": "3.13 KB"
104
+ },
105
+ {
106
+ "name": "Core engine (@box-kite/core, no React)",
107
+ "path": "dist-core/core.mjs",
108
+ "gzip": true,
109
+ "limit": "24.10 KB"
110
+ },
111
+ {
112
+ "name": "DataGrid",
113
+ "path": "dist/components/dataGrid.mjs",
114
+ "ignore": [
115
+ "react",
116
+ "react-dom"
117
+ ],
118
+ "gzip": true,
119
+ "limit": "54.55 KB"
120
+ },
121
+ {
122
+ "name": "Full library (Box + ssg + every component)",
123
+ "path": "dev/size-full.mjs",
124
+ "ignore": [
125
+ "react",
126
+ "react-dom"
127
+ ],
128
+ "gzip": true,
129
+ "limit": "60.85 KB"
130
+ }
131
+ ],
7
132
  "repository": {
8
133
  "type": "git",
9
134
  "url": "git+https://github.com/box-kite/box-kite.git"
10
135
  },
11
- "homepage": "https://github.com/box-kite/box-kite#readme",
12
- "publishConfig": {
13
- "access": "public"
136
+ "keywords": [
137
+ "box-kite",
138
+ "boxkite",
139
+ "react",
140
+ "box",
141
+ "css-in-js",
142
+ "atomic-css",
143
+ "runtime-css",
144
+ "styling",
145
+ "design-system",
146
+ "react-server-components",
147
+ "rsc",
148
+ "accessibility",
149
+ "typescript"
150
+ ],
151
+ "author": "Maxim Procopenco",
152
+ "license": "MIT",
153
+ "bugs": {
154
+ "url": "https://github.com/box-kite/box-kite/issues"
155
+ },
156
+ "homepage": "https://www.box-kite.dev",
157
+ "description": "One React component with 212 typed CSS props that generates atomic CSS at runtime — no CSS files, no build step, renders in a Server Component.",
158
+ "peerDependencies": {
159
+ "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
160
+ "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
161
+ },
162
+ "dependencies": {
163
+ "@box-kite/core": "1.0.0",
164
+ "csstype": "^3.2.3",
165
+ "use-sync-external-store": "^1.6.0"
166
+ },
167
+ "devDependencies": {
168
+ "@arethetypeswrong/cli": "^0.18.5",
169
+ "@eslint/js": "^10.0.1",
170
+ "@iconify-json/simple-icons": "^1.2.94",
171
+ "@iconify/react": "^6.0.2",
172
+ "@size-limit/preset-small-lib": "^13.0.3",
173
+ "@svgr/core": "^8.1.0",
174
+ "@svgr/plugin-jsx": "^8.1.0",
175
+ "@testing-library/dom": "^10.4.1",
176
+ "@testing-library/jest-dom": "^7.0.0",
177
+ "@testing-library/react": "^16.3.2",
178
+ "@testing-library/user-event": "^14.6.6",
179
+ "@types/node": "^26.1.2",
180
+ "@types/prismjs": "^1.26.6",
181
+ "@types/react": "^19.2.18",
182
+ "@types/react-dom": "^19.2.4",
183
+ "@types/use-sync-external-store": "^1.5.0",
184
+ "@vitejs/plugin-react": "^6.0.5",
185
+ "@vitest/coverage-v8": "^4.1.11",
186
+ "axe-core": "^4.13.0",
187
+ "eslint": "^10.8.0",
188
+ "eslint-config-prettier": "^10.1.8",
189
+ "eslint-plugin-import-x": "^4.17.1",
190
+ "eslint-plugin-prettier": "^5.5.6",
191
+ "eslint-plugin-react-hooks": "^7.1.1",
192
+ "eslint-plugin-react-refresh": "^0.5.3",
193
+ "globals": "^17.9.0",
194
+ "happy-dom": "^20.11.1",
195
+ "lucide-react": "^1.28.0",
196
+ "prettier": "^3.9.6",
197
+ "prismjs": "^1.30.0",
198
+ "publint": "^0.3.24",
199
+ "react": "^19.2.8",
200
+ "react-dom": "^19.2.8",
201
+ "react-router-dom": "^7.18.2",
202
+ "recharts": "^3.10.1",
203
+ "size-limit": "^13.0.3",
204
+ "typescript": "^6.0.3",
205
+ "typescript-eslint": "^8.66.0",
206
+ "unplugin-icons": "^23.0.1",
207
+ "vite": "^8.2.0",
208
+ "vite-plugin-dts": "^5.0.3",
209
+ "vitest": "^4.1.10"
14
210
  }
15
211
  }