@box-kite/react 2.2.4 → 2.2.5
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 -0
- package/.claude/skills/box-kite/SKILL.md +8 -0
- package/.claude/skills/box-kite/references/components.md +49 -3
- package/.cursor/rules/box-kite.mdc +8 -0
- package/AGENTS.md +8 -0
- package/BOX_AI_CONTEXT.md +276 -20
- package/BOX_KITE_AI_CONTEXT.md +276 -20
- package/behavior.cjs +1 -1
- package/behavior.mjs +57 -57
- package/box.cjs +1 -1
- package/box.d.ts +5 -0
- package/box.mjs +17 -17
- package/catalog.cjs +1 -1
- package/catalog.mjs +385 -0
- package/client.cjs +1 -1
- package/client.mjs +113 -87
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +1 -1
- package/components/dataGrid/components/dataGridList.d.ts +12 -0
- package/components/dataGrid/components/dataGridListAggregate.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilter.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilterSheet.d.ts +11 -0
- package/components/dataGrid/components/dataGridListFooter.d.ts +13 -0
- package/components/dataGrid/components/dataGridListGroup.d.ts +13 -0
- package/components/dataGrid/components/dataGridListItem.d.ts +21 -0
- package/components/dataGrid/components/dataGridListLayout.d.ts +20 -0
- package/components/dataGrid/components/dataGridListRecord.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSelectionBar.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSheet.d.ts +30 -0
- package/components/dataGrid/components/dataGridListSortSheet.d.ts +10 -0
- package/components/dataGrid/components/dataGridListToolbar.d.ts +10 -0
- package/components/dataGrid/components/dataGridListValue.d.ts +12 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +32 -0
- package/components/dataGrid/models/gridModel.d.ts +3 -0
- package/components/dataGrid/models/listModel.d.ts +129 -0
- package/components/dataGrid/models/localeText.d.ts +32 -0
- package/components/dataGrid/models/viewportModel.d.ts +0 -2
- package/components/dataGrid/useListLayout.d.ts +13 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +1052 -788
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +85 -97
- package/components/list/listItemParts.d.ts +9 -0
- package/components/list.cjs +1 -0
- package/components/list.d.ts +118 -0
- package/components/list.mjs +391 -0
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +25 -25
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +12 -12
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +1 -1
- package/components/sortableList.cjs +1 -0
- package/components/sortableList.d.ts +49 -0
- package/components/sortableList.mjs +384 -0
- package/components/swipeItem.cjs +1 -0
- package/components/swipeItem.d.ts +52 -0
- package/components/swipeItem.mjs +321 -0
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +1 -1
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +24 -24
- package/components/virtualList.cjs +1 -0
- package/components/virtualList.d.ts +32 -0
- package/components/virtualList.mjs +188 -0
- package/dataGridList.cjs +1 -0
- package/dataGridList.mjs +1351 -0
- package/docs/components.md +5 -1
- package/icons/closeIcon.d.ts +2 -0
- package/icons/filterIcon.d.ts +2 -0
- package/layer.cjs +1 -1
- package/layer.mjs +1 -1
- package/mcp/src/data.d.ts +2 -0
- package/package.json +86 -22
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +4 -1
- package/react/a11y/useControllableState.d.ts +2 -1
- package/react/componentsContext.d.ts +4 -0
- package/react/componentsProvider.d.ts +10 -0
- package/react/resolveStyles.d.ts +2 -1
- package/react/theme/theme.d.ts +6 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +5 -5
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +3 -1
- package/registry/designs/store/address-form.d.ts +11 -0
- package/registry/designs/store/cart-items.d.ts +10 -0
- package/registry/designs/store/cart-page.d.ts +4 -0
- package/registry/designs/store/checkout-page.d.ts +7 -0
- package/registry/designs/store/credit-card-form.d.ts +10 -0
- package/registry/designs/store/form-field.d.ts +19 -0
- package/registry/designs/store/order-summary.d.ts +18 -0
- package/registry/designs/store/product-art.d.ts +26 -0
- package/registry/designs/store/product-card.d.ts +11 -0
- package/registry/designs/store/product-gallery.d.ts +11 -0
- package/registry/designs/store/product-grid.d.ts +10 -0
- package/registry/designs/store/product-page.d.ts +5 -0
- package/registry/designs/store/quantity-stepper.d.ts +13 -0
- package/registry/designs/store/shipping-method.d.ts +14 -0
- package/registry/designs/store/store-data.d.ts +53 -0
- package/registry/designs/store/store-design.d.ts +63 -0
- package/registry/designs/store/store-shell.d.ts +12 -0
- package/registry/designs/store/storefront-page.d.ts +4 -0
- package/registry/designs/store/variant-picker.d.ts +15 -0
- package/rsc.cjs +1 -1
- package/rsc.d.ts +2 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -0
- package/scrolling.mjs +22 -0
- package/ssg.cjs +1 -1
- package/ssg.mjs +1 -1
- package/utils/scroll/scrollUtils.d.ts +6 -0
- package/utils/sortable/sortableUtils.d.ts +25 -0
- package/utils/swipe/swipeUtils.d.ts +53 -0
- package/utils/virtual/measuredWindow.d.ts +28 -0
- package/utils/virtual/rowSearch.d.ts +11 -0
|
@@ -9,6 +9,7 @@ import { default as EditModel } from './editModel';
|
|
|
9
9
|
import { default as ExportModel } from './exportModel';
|
|
10
10
|
import { default as FilterModel } from './filterModel';
|
|
11
11
|
import { default as GroupRowModel } from './groupRowModel';
|
|
12
|
+
import { default as ListModel } from './listModel';
|
|
12
13
|
import { DataGridLocaleText } from './localeText';
|
|
13
14
|
import { default as PaginationModel } from './paginationModel';
|
|
14
15
|
import { default as RangeModel } from './rangeModel';
|
|
@@ -239,6 +240,8 @@ export default class GridModel<TRow> {
|
|
|
239
240
|
readonly edits: EditModel<TRow>;
|
|
240
241
|
/** The current cell, the block of cells marked around it, and what the clipboard is written from. */
|
|
241
242
|
readonly range: RangeModel<TRow>;
|
|
243
|
+
/** The grid drawn as a list, for a phone. */
|
|
244
|
+
readonly list: ListModel<TRow>;
|
|
242
245
|
/**
|
|
243
246
|
* Throw the fetched blocks away and ask for them again. The grid invalidates on its own whenever it
|
|
244
247
|
* changes the query; this is for the half it cannot see — a filter of the page's own, a row somebody
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { FilterValue, Key } from '../contracts/dataGridContract';
|
|
2
|
+
import { default as ColumnModel } from './columnModel';
|
|
3
|
+
import { default as GridModel } from './gridModel';
|
|
4
|
+
import { default as GroupRowModel } from './groupRowModel';
|
|
5
|
+
import { default as RowModel } from './rowModel';
|
|
6
|
+
/** 36rem: where Polaris, Roselli and the Scottish Government's tables all give up on columns. */
|
|
7
|
+
export declare const DEFAULT_LIST_BREAKPOINT = 576;
|
|
8
|
+
/** How many labelled values an item shows before the rest wait for the record view. */
|
|
9
|
+
export declare const DEFAULT_LIST_FIELDS = 4;
|
|
10
|
+
/** How many items one "Show more" adds — a couple of screens of phone. */
|
|
11
|
+
export declare const DEFAULT_LIST_BATCH = 20;
|
|
12
|
+
/** Which columns an item draws where. Every list is in column order. */
|
|
13
|
+
export interface ListItemLayout<TRow> {
|
|
14
|
+
title?: ColumnModel<TRow>;
|
|
15
|
+
kicker?: ColumnModel<TRow>;
|
|
16
|
+
subtitle: ColumnModel<TRow>[];
|
|
17
|
+
end?: ColumnModel<TRow>;
|
|
18
|
+
fields: ColumnModel<TRow>[];
|
|
19
|
+
/** The columns only the record view shows. */
|
|
20
|
+
detail: ColumnModel<TRow>[];
|
|
21
|
+
}
|
|
22
|
+
/** One column filter that is set, the way its chip says it. */
|
|
23
|
+
export interface ActiveFilterChip<TRow> {
|
|
24
|
+
column: ColumnModel<TRow>;
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
export type ListSheet = 'sort' | 'filter';
|
|
29
|
+
/** One entry of the list, and where it sits in the grid's own rows — which is what a record is opened at. */
|
|
30
|
+
export interface ListEntry<TRow> {
|
|
31
|
+
row: RowModel<TRow> | GroupRowModel<TRow>;
|
|
32
|
+
index: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The grid drawn for a phone: a list of items instead of a table. It decides when the grid switches, which
|
|
36
|
+
* column goes where in an item, how many items are drawn, which sheet is open, whether the list is selecting,
|
|
37
|
+
* and which row the record view is on. The rows, the filters and the sort stay the grid's — an item is another
|
|
38
|
+
* drawing of the same row, so whatever a table does to a row it does to an item.
|
|
39
|
+
*/
|
|
40
|
+
export default class ListModel<TRow> {
|
|
41
|
+
readonly grid: GridModel<TRow>;
|
|
42
|
+
constructor(grid: GridModel<TRow>);
|
|
43
|
+
private get config();
|
|
44
|
+
get breakpoint(): number;
|
|
45
|
+
private _width;
|
|
46
|
+
/** The grid's own width in px, 0 until something has measured it — which a server render never does. */
|
|
47
|
+
get width(): number;
|
|
48
|
+
/** Whether the grid draws a list. `auto` decides on the grid's own width rather than the viewport's. */
|
|
49
|
+
get active(): boolean;
|
|
50
|
+
/** Report the grid's width. Only crossing the breakpoint redraws anything. */
|
|
51
|
+
setWidth: (width: number) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Which column goes where. A column's `list` role wins; otherwise the first data column is the title, the
|
|
54
|
+
* first end-aligned one — a total, an amount — sits opposite it, the next few are fields and the rest wait
|
|
55
|
+
* for the record view. A grouped column is its group's header, so it is not repeated in every item.
|
|
56
|
+
*/
|
|
57
|
+
readonly layout: import('../../../utils/memo').Memo<{
|
|
58
|
+
title: ColumnModel<TRow> | undefined;
|
|
59
|
+
kicker: ColumnModel<TRow> | undefined;
|
|
60
|
+
subtitle: ColumnModel<TRow>[];
|
|
61
|
+
end: ColumnModel<TRow> | undefined;
|
|
62
|
+
fields: ColumnModel<TRow>[];
|
|
63
|
+
detail: ColumnModel<TRow>[];
|
|
64
|
+
}>;
|
|
65
|
+
/** Every column the record view lists, in column order. */
|
|
66
|
+
get recordColumns(): ColumnModel<TRow>[];
|
|
67
|
+
private get batch();
|
|
68
|
+
private _limit?;
|
|
69
|
+
/**
|
|
70
|
+
* What the list is a list of. A different answer is a different list, so "Show more" starts again from one
|
|
71
|
+
* batch — while opening a group or a detail panel changes the rows and not the question, and keeps what the
|
|
72
|
+
* reader has already scrolled through.
|
|
73
|
+
*/
|
|
74
|
+
private get query();
|
|
75
|
+
/** Where the list is cut: whole batches, or nowhere when the grid is paginated, since a page is the batch. */
|
|
76
|
+
private get count();
|
|
77
|
+
private _more;
|
|
78
|
+
/**
|
|
79
|
+
* The entries drawn now, up to the cut — a detail panel is drawn inside its own item. A walk from the top
|
|
80
|
+
* rather than a filter, because a datasource's list is lazy and walking all of it is a model per row.
|
|
81
|
+
*/
|
|
82
|
+
get visibleItems(): ListEntry<TRow>[];
|
|
83
|
+
/** Whether entries are left past the cut. Read after `visibleItems`, which is what measures it. */
|
|
84
|
+
get hasMore(): boolean;
|
|
85
|
+
/** How many entries the next "Show more" adds. Read after `visibleItems`. */
|
|
86
|
+
get nextBatch(): number;
|
|
87
|
+
showMore: () => void;
|
|
88
|
+
private _selecting;
|
|
89
|
+
/**
|
|
90
|
+
* Whether a press on an item ticks it rather than opening it. Selection is a mode on a phone — iOS's edit
|
|
91
|
+
* mode, Android's contextual bar — because a checkbox on every item is a target a thumb hits by accident.
|
|
92
|
+
*/
|
|
93
|
+
get selecting(): boolean;
|
|
94
|
+
setSelecting: (selecting: boolean) => void;
|
|
95
|
+
/** The id of a row's checkbox, which the item's title is the label of — so a press anywhere on the item ticks it. */
|
|
96
|
+
checkboxId(key: Key): string;
|
|
97
|
+
private _sheet;
|
|
98
|
+
/** Which bottom sheet is open — the sort or the filters — or `null`. */
|
|
99
|
+
get sheet(): ListSheet | null;
|
|
100
|
+
openSheet: (sheet: ListSheet | null) => void;
|
|
101
|
+
/** The columns the sort sheet offers. */
|
|
102
|
+
get sortableColumns(): ColumnModel<TRow>[];
|
|
103
|
+
/** The column the grid is sorted by, when it is one the sheet offers. */
|
|
104
|
+
get sortedColumn(): ColumnModel<TRow> | undefined;
|
|
105
|
+
/** The columns the filter sheet offers. */
|
|
106
|
+
get filterableColumns(): ColumnModel<TRow>[];
|
|
107
|
+
/** Every column filter that is set, the way a chip says it. */
|
|
108
|
+
get activeFilters(): ActiveFilterChip<TRow>[];
|
|
109
|
+
/** A filter in words: `“ali”`, `≥ 30`, `20–40`, `Japan, Spain +2`. */
|
|
110
|
+
describe(column: ColumnModel<TRow>, filter: FilterValue): string;
|
|
111
|
+
private _record;
|
|
112
|
+
/** The row the record view is showing, or `undefined` while it is shut. */
|
|
113
|
+
get record(): RowModel<TRow> | undefined;
|
|
114
|
+
/** Whether pressing an item opens its record. */
|
|
115
|
+
get recordViewEnabled(): boolean;
|
|
116
|
+
/** Open the record view on a row, at its index in the grid's rows. */
|
|
117
|
+
openRecord: (row: RowModel<TRow>, index: number) => void;
|
|
118
|
+
closeRecord: () => void;
|
|
119
|
+
private neighbour;
|
|
120
|
+
get hasPreviousRecord(): boolean;
|
|
121
|
+
get hasNextRecord(): boolean;
|
|
122
|
+
/** Step to the record before or after this one, past group headers and detail panels. */
|
|
123
|
+
stepRecord: (step: 1 | -1) => void;
|
|
124
|
+
/** Where the record sits among the rows — "3 of 40" — counting rows, not group headers. */
|
|
125
|
+
get recordPosition(): {
|
|
126
|
+
position: number;
|
|
127
|
+
total: number;
|
|
128
|
+
} | undefined;
|
|
129
|
+
}
|
|
@@ -101,6 +101,38 @@ export interface DataGridLocaleText {
|
|
|
101
101
|
previousPage: string;
|
|
102
102
|
nextPage: string;
|
|
103
103
|
lastPage: string;
|
|
104
|
+
/** The sort button before anything is sorted, and the sort sheet's title. */
|
|
105
|
+
sortBy: string;
|
|
106
|
+
/** The sort button once a column is sorted: the column and the direction. */
|
|
107
|
+
sortedBy: (column: string, descending: boolean) => string;
|
|
108
|
+
ascending: string;
|
|
109
|
+
descending: string;
|
|
110
|
+
/** The filters button and the filter sheet's title. */
|
|
111
|
+
filters: string;
|
|
112
|
+
/** The filters button's accessible name, with how many are set. */
|
|
113
|
+
filtersLabel: (count: number) => string;
|
|
114
|
+
/** The filter sheet's main button: it closes the sheet and says how many rows are left. */
|
|
115
|
+
showRows: (count: number) => string;
|
|
116
|
+
/** What closes a sheet or the record view. */
|
|
117
|
+
close: string;
|
|
118
|
+
/** The button under the cards: how many the next press adds. */
|
|
119
|
+
showMore: (count: number) => string;
|
|
120
|
+
/** Under the cards: how many of the rows are drawn. */
|
|
121
|
+
shownCount: (shown: number, total: number) => string;
|
|
122
|
+
/** The record view's pager: "3 of 40". */
|
|
123
|
+
recordPosition: (position: number, total: number) => string;
|
|
124
|
+
previousRow: string;
|
|
125
|
+
nextRow: string;
|
|
126
|
+
/** The heading over a `rowDetail` panel in the record view. */
|
|
127
|
+
details: string;
|
|
128
|
+
/** The toggle that puts the list into selecting, where a press ticks a row rather than opening it. */
|
|
129
|
+
selectRows: string;
|
|
130
|
+
clearSearch: string;
|
|
131
|
+
/** The record view's button beside an editable value; its name is `editCell`. */
|
|
132
|
+
edit: string;
|
|
133
|
+
/** The list's selection bar: how many rows are ticked, short enough for a phone's width. */
|
|
134
|
+
selectedRows: (count: number) => string;
|
|
135
|
+
selectAll: string;
|
|
104
136
|
/** What the live region says when the selection changes. */
|
|
105
137
|
selectionAnnouncement: (selected: number, total: number) => string;
|
|
106
138
|
}
|
|
@@ -59,7 +59,5 @@ export default class ViewportModel<TRow> {
|
|
|
59
59
|
get emptyHeight(): number;
|
|
60
60
|
/** Where a row sits inside the scrolled body — what a keyboard jump scrolls to. */
|
|
61
61
|
rowTop(index: number): number;
|
|
62
|
-
/** Binary search for the first row whose offset is <= scrollTop (variable-height rows). */
|
|
63
|
-
private findStartIndex;
|
|
64
62
|
window(scrollTop: number, direction?: ScrollDirection): ViewportWindow;
|
|
65
63
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as DataGridList } from './components/dataGridList';
|
|
2
|
+
type ListLayout = typeof DataGridList;
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the list layout. It is a chunk of its own — the sheets, the record view and the `<dialog>` under them
|
|
5
|
+
* are 10 KB gzipped a wide screen never draws — so it is asked for the first time a grid is narrow.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadListLayout(): Promise<ListLayout>;
|
|
8
|
+
/**
|
|
9
|
+
* The list layout's component once it has arrived, or `undefined` while the grid should go on drawing its
|
|
10
|
+
* table. No `React.lazy`: a Suspense boundary is the one thing a React 16 or 17 server cannot render.
|
|
11
|
+
*/
|
|
12
|
+
export default function useListLayout(active: boolean): ListLayout | undefined;
|
|
13
|
+
export {};
|