@box-kite/react 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/box-kite-rules.md +8 -2
- package/.claude/skills/box-kite/SKILL.md +11 -5
- package/.claude/skills/box-kite/references/components.md +2 -2
- package/.claude/skills/box-kite/references/patterns.md +1 -1
- package/.claude/skills/box-kite/references/styling.md +23 -0
- package/.cursor/rules/box-kite.mdc +9 -3
- package/AGENTS.md +9 -3
- package/BOX_AI_CONTEXT.md +250 -87
- package/BOX_KITE_AI_CONTEXT.md +250 -87
- package/README.md +3 -3
- package/box.cjs +1 -1
- package/box.d.ts +13 -2
- package/box.mjs +25 -18
- package/catalog.cjs +1 -1
- package/catalog.mjs +15 -1
- package/client.cjs +1 -1
- package/client.mjs +59 -51
- package/components/button.cjs +1 -1
- package/components/button.mjs +10 -14
- package/components/dataGrid/components/dataGridBottomBarSelection.d.ts +7 -0
- package/components/dataGrid/components/dataGridDetailRow.d.ts +3 -3
- package/components/dataGrid/components/dataGridGroupRow.d.ts +3 -3
- package/components/dataGrid/components/dataGridHeader.d.ts +6 -2
- package/components/dataGrid/components/dataGridRow.d.ts +3 -3
- package/components/dataGrid/contracts/dataGridContract.d.ts +13 -0
- package/components/dataGrid/gridNavigationContext.d.ts +7 -2
- package/components/dataGrid/models/editModel.d.ts +6 -4
- package/components/dataGrid/models/exportModel.d.ts +1 -1
- package/components/dataGrid/models/gridModel.d.ts +55 -2
- package/components/dataGrid/models/headerCellModel.d.ts +5 -0
- package/components/dataGrid/models/localeText.d.ts +102 -0
- package/components/dataGrid/models/rangeModel.d.ts +2 -0
- package/components/dataGrid/useFilterDraft.d.ts +9 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.d.ts +1 -0
- package/components/dataGrid.mjs +1394 -990
- package/components/flex.cjs +1 -1
- package/components/flex.mjs +10 -13
- package/components/form.cjs +1 -1
- package/components/form.mjs +7 -7
- package/components/grid.cjs +1 -1
- package/components/grid.mjs +10 -13
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +16 -16
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +35 -34
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +4 -4
- package/components/semantics.cjs +1 -1
- package/components/semantics.d.ts +29 -29
- package/components/semantics.mjs +9 -13
- package/components/svg.cjs +1 -1
- package/components/svg.mjs +38 -44
- package/components/textarea.cjs +1 -1
- package/components/textarea.mjs +12 -16
- package/components/textbox.cjs +1 -1
- package/components/textbox.mjs +12 -16
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +42 -43
- package/components/visuallyHidden.cjs +1 -1
- package/components/visuallyHidden.mjs +10 -13
- package/docs/components.md +1 -1
- package/docs/mcp.md +6 -5
- package/docs/props.md +132 -20
- package/layer.cjs +1 -1
- package/layer.mjs +61 -59
- package/mcp/src/data.d.ts +1 -1
- package/mcp/src/styles.d.ts +2 -2
- package/mcp/src/vocabulary.d.ts +1 -1
- package/package.json +81 -49
- package/react/boxComponent.d.ts +10 -0
- package/react/popover/useTopLayer.d.ts +17 -0
- package/react/theme/theme.d.ts +10 -0
- package/react/useStyles.d.ts +2 -0
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +44 -37
- package/rsc.cjs +1 -1
- package/rsc.d.ts +11 -1
- package/rsc.mjs +15 -12
- package/ssg.cjs +1 -1
- package/ssg.d.ts +8 -2
- package/ssg.mjs +13 -9
- package/utils/dataGrid/activeCellStore.d.ts +14 -0
- package/utils/dataGrid/filterDraftUtils.d.ts +19 -0
- package/utils/dataGrid/headerCellUtils.d.ts +50 -0
- package/utils/environment/environmentUtils.d.ts +5 -0
package/rsc.mjs
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { d as e,
|
|
1
|
+
import { d as e, l as t, p as n } from "./react-shared.mjs";
|
|
2
2
|
import r from "react";
|
|
3
|
-
import { BoxExtends as i, Springs as a, getDefaultEngine as o } from "@box-kite/core";
|
|
3
|
+
import { BoxExtends as i, Springs as a, getDefaultEngine as o, startViewTransition as s } from "@box-kite/core";
|
|
4
4
|
//#region src/rsc.ts
|
|
5
5
|
o().configure({ sink: "element" });
|
|
6
|
-
function
|
|
7
|
-
let { tag:
|
|
8
|
-
if (typeof
|
|
9
|
-
let { classNames:
|
|
10
|
-
return r.createElement(r.Fragment, null,
|
|
6
|
+
function c(n, i) {
|
|
7
|
+
let { tag: a = "div", children: o } = n;
|
|
8
|
+
if (typeof o == "function") throw Error("[box-kite] Box children as a function track hover state, which needs the client Box — render it from a 'use client' module.");
|
|
9
|
+
let { classNames: s, styleElements: c } = t(n, a === "svg");
|
|
10
|
+
return r.createElement(r.Fragment, null, c, r.createElement(a, e(n, s), o));
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
function l(e) {
|
|
13
|
+
return c(e);
|
|
14
|
+
}
|
|
15
|
+
var u = l;
|
|
16
|
+
u.extend = i.extend, u.components = i.components, u.keyframes = i.keyframes, u.spring = a.spring, u.getVariableValue = (e) => o().getVariableValue(e), u.configure = (e) => o().configure(e), u.viewTransition = s;
|
|
17
|
+
function d(e, r) {
|
|
18
|
+
return n(t(e, r?.svg === !0), e.className);
|
|
16
19
|
}
|
|
17
20
|
//#endregion
|
|
18
|
-
export {
|
|
21
|
+
export { u as default, c as useBoxElement, d as useClassNames };
|
package/ssg.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime.cjs"),t=require("./client.cjs");let n=require("react-dom/server");n=e.t(n,1);function r(){return t.r.getStyles()}function i(){t.r.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime.cjs"),t=require("./client.cjs");let n=require("react-dom/server");n=e.t(n,1);function r(){return t.r.getStyles()}function i(){return t.r.getStyleTag()}function a(){t.r.clear()}function o(e,t=!0){let o=n.default.renderToStaticMarkup(e),s=r(),c=i();if(t){let e=o.indexOf(`<head>`);if(e>-1){let t=e+6;o=o.substring(0,t)+c+o.substring(t)}}return a(),{html:o,styles:s,styleTag:c}}exports.getStyleTag=i,exports.getStyles=r,exports.renderToStaticMarkup=o,exports.resetStyles=a;
|
package/ssg.d.ts
CHANGED
|
@@ -5,9 +5,14 @@ import { default as React } from 'react';
|
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* The CSS for everything rendered since the last reset. Flushes first, so it is safe straight after
|
|
8
|
-
* `renderToString` — no effects have run at that point.
|
|
8
|
+
* `renderToString` — no effects have run at that point. `getStyleTag()` is the same CSS ready for the head.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getStyles(): string;
|
|
11
|
+
/**
|
|
12
|
+
* The CSS as `<style id="box-kite-styles" data-box-kite="…">`, for the head. The attribute is what lets the
|
|
13
|
+
* browser adopt the sheet on hydration instead of generating and inserting every rule in it a second time.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getStyleTag(): string;
|
|
11
16
|
/**
|
|
12
17
|
* Drop every rule, class name and variable the engine has emitted, so the next request starts blank.
|
|
13
18
|
* Registration (`Box.extend()`, `Box.components()`) survives. Call it once per request, after `getStyles()`.
|
|
@@ -15,10 +20,11 @@ export declare function getStyles(): string;
|
|
|
15
20
|
export declare function resetStyles(): void;
|
|
16
21
|
/**
|
|
17
22
|
* Render `element` to static HTML together with its CSS. With `addStylesToHead` (the default) and a
|
|
18
|
-
* `<head>` in the tree the
|
|
23
|
+
* `<head>` in the tree the style tag goes there; otherwise use the returned `styleTag`. The engine is reset
|
|
19
24
|
* before returning, so sequential calls are independent.
|
|
20
25
|
*/
|
|
21
26
|
export declare function renderToStaticMarkup(element: React.ReactElement, addStylesToHead?: boolean): {
|
|
22
27
|
html: string;
|
|
23
28
|
styles: string;
|
|
29
|
+
styleTag: string;
|
|
24
30
|
};
|
package/ssg.mjs
CHANGED
|
@@ -5,21 +5,25 @@ function n() {
|
|
|
5
5
|
return e.getStyles();
|
|
6
6
|
}
|
|
7
7
|
function r() {
|
|
8
|
+
return e.getStyleTag();
|
|
9
|
+
}
|
|
10
|
+
function i() {
|
|
8
11
|
e.clear();
|
|
9
12
|
}
|
|
10
|
-
function
|
|
11
|
-
let o = t.renderToStaticMarkup(
|
|
13
|
+
function a(e, a = !0) {
|
|
14
|
+
let o = t.renderToStaticMarkup(e), s = n(), c = r();
|
|
12
15
|
if (a) {
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
o = o.substring(0,
|
|
16
|
+
let e = o.indexOf("<head>");
|
|
17
|
+
if (e > -1) {
|
|
18
|
+
let t = e + 6;
|
|
19
|
+
o = o.substring(0, t) + c + o.substring(t);
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
|
-
return
|
|
22
|
+
return i(), {
|
|
20
23
|
html: o,
|
|
21
|
-
styles: s
|
|
24
|
+
styles: s,
|
|
25
|
+
styleTag: c
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
28
|
//#endregion
|
|
25
|
-
export { n as getStyles,
|
|
29
|
+
export { r as getStyleTag, n as getStyles, a as renderToStaticMarkup, i as resetStyles };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which cell holds the grid's tab stop, as a store each cell subscribes to by its own coordinates. Handed
|
|
3
|
+
* down as a value, a move changed it for every cell on screen; subscribed to, it re-renders the two cells
|
|
4
|
+
* whose answer changed.
|
|
5
|
+
*/
|
|
6
|
+
export default class ActiveCellStore {
|
|
7
|
+
private row;
|
|
8
|
+
private column;
|
|
9
|
+
private readonly listeners;
|
|
10
|
+
constructor(row: number, column: number);
|
|
11
|
+
subscribe: (listener: () => void) => (() => void);
|
|
12
|
+
isActive(row: number, column: number): boolean;
|
|
13
|
+
set(row: number, column: number): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FilterValue, NumberFilterValue } from '../../components/dataGrid/contracts/dataGridContract';
|
|
2
|
+
/** What a number filter's inputs hold while they are being typed into: text, since `1.` is on its way to a number. */
|
|
3
|
+
export interface NumberFilterDraft {
|
|
4
|
+
operator: NumberFilterValue['operator'];
|
|
5
|
+
value: string;
|
|
6
|
+
valueTo: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Whether a filter input's draft already says what the grid holds. When it does not, the grid's value
|
|
10
|
+
* came from somewhere else — "Clear filters", a controlled prop — and the input has to take it.
|
|
11
|
+
*/
|
|
12
|
+
declare namespace FilterDraftUtils {
|
|
13
|
+
/** A text filter stores what was typed, and a blank one is no filter at all. */
|
|
14
|
+
function textMatches(draft: string, filter: FilterValue | undefined): boolean;
|
|
15
|
+
function numberDraft(filter: FilterValue | undefined): NumberFilterDraft;
|
|
16
|
+
/** Read the way the model parses, so `1.` matches a stored `1` and a half-typed number is never rewritten. */
|
|
17
|
+
function numberMatches(draft: NumberFilterDraft, filter: FilterValue | undefined): boolean;
|
|
18
|
+
}
|
|
19
|
+
export default FilterDraftUtils;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Where the travelling header hover sits: each edge's distance from the same edge of the header, in px. */
|
|
2
|
+
export interface HeaderHoverBounds {
|
|
3
|
+
left: number;
|
|
4
|
+
right: number;
|
|
5
|
+
top: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
}
|
|
8
|
+
/** The travelling hover's whole state. Physical edges, because a measured pixel has no reading order. */
|
|
9
|
+
export interface HeaderHoverState {
|
|
10
|
+
bounds?: HeaderHoverBounds;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
/** Shown this update from nothing, so it appears where it is rather than travelling from where it last was. */
|
|
13
|
+
entering: boolean;
|
|
14
|
+
/** Which way it last travelled: the leading edge is the fast one, which is what makes it stretch and settle. */
|
|
15
|
+
backward: boolean;
|
|
16
|
+
/** Hidden by the resizer between two cells rather than by leaving: the next cell is travelled to, not entered. */
|
|
17
|
+
paused: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What a header cell does with the pointer: which press sorts, and the model behind `def.headerHover:
|
|
21
|
+
* 'sliding'` — one pill that flows from the cell it was on to the one under the pointer.
|
|
22
|
+
*/
|
|
23
|
+
declare namespace HeaderCellUtils {
|
|
24
|
+
/** A sortable header cell: the only kind a press does anything on, and so the only kind that hovers. */
|
|
25
|
+
const CELL_SELECTOR = "[role=\"columnheader\"][aria-sort]";
|
|
26
|
+
/**
|
|
27
|
+
* Whether a press sorts: anywhere in the cell but a control inside it. Judged on where the press *began*,
|
|
28
|
+
* since a resize drag released over the cell fires its click on the cell itself.
|
|
29
|
+
*/
|
|
30
|
+
function isSortPress(cell: Element, pressedOn: EventTarget | null): boolean;
|
|
31
|
+
const INITIAL: HeaderHoverState;
|
|
32
|
+
/** Whether the pointer is over a resizer, where a press resizes, so no cell hovers. */
|
|
33
|
+
function isOnResizer(target: EventTarget | null): boolean;
|
|
34
|
+
/** The hoverable cell an event landed in, if it belongs to this header. Over the resizer there is none. */
|
|
35
|
+
function cellAt(header: Element, target: EventTarget | null): HTMLElement | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The cell's box against the header's own, which is the hover's containing block — less the resizer's line
|
|
38
|
+
* where it stands inside the cell, so the pill keeps the same distance from it as the neighbour's does.
|
|
39
|
+
*/
|
|
40
|
+
function bounds(header: Element, cell: Element): HeaderHoverBounds;
|
|
41
|
+
function sameBounds(a: HeaderHoverBounds | undefined, b: HeaderHoverBounds | undefined): boolean;
|
|
42
|
+
/** The next state for a pointer over `next` — a cell's bounds, or `undefined` for anywhere that does not hover. */
|
|
43
|
+
function hover(state: HeaderHoverState, next: HeaderHoverBounds | undefined): HeaderHoverState;
|
|
44
|
+
/**
|
|
45
|
+
* Over the resizer: hidden, but still on its way between two cells. The handle sits on the boundary every
|
|
46
|
+
* move from cell to cell crosses, so treating it as a leave would turn each move into an entrance.
|
|
47
|
+
*/
|
|
48
|
+
function pause(state: HeaderHoverState): HeaderHoverState;
|
|
49
|
+
}
|
|
50
|
+
export default HeaderCellUtils;
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/** A browser: a window with a document. What an effect that touches layout needs to exist. */
|
|
8
8
|
export declare function isBrowser(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Development, unless the bundler or the process says production. Spelled out so a bundler replaces it;
|
|
11
|
+
* a page with no bundler has no `process` at all and counts as production.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isDevelopment(): boolean;
|
|
9
14
|
/** Whether there is a document at all — false during a server render. */
|
|
10
15
|
export declare function hasDocument(): boolean;
|
|
11
16
|
/** The document, or null when there is none, so a caller can `?.` instead of branching. */
|