viewkitjs 0.32.0 → 0.34.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.
- package/CHANGELOG.md +98 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +46 -11
- package/views/dist/contract.js +157 -0
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +4 -0
- package/views/dist/controls/controls.js +4 -0
- package/views/dist/controls/customize/customize.js +43 -39
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +7 -2
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +27 -21
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +11 -4
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.d.ts +3 -1
- package/views/dist/controls/filter-editor/parts.js +8 -6
- package/views/dist/controls/group-editor/group-editor.js +17 -14
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +4 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +58 -0
- package/views/dist/controls/internal/panel-controls.js +240 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +3 -0
- package/views/dist/controls/menu/menu.js +5 -5
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +16 -16
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/map-fields-body.js +25 -1
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +7 -3
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +8 -2
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +8 -4
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +11 -10
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +7 -3
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +9 -10
- package/views/dist/controls/views-list/views-list.js +6 -6
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +74 -0
- package/views/dist/list/list.js +18 -0
- package/views/dist/list/parts.js +11 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +23 -5
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +21 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +20 -6
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +4 -3
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +4 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +8 -5
- package/views/dist/panels/react/toolbar/context.d.ts +31 -1
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +7 -4
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +7 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +90 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +107 -80
- package/views/dist/styles.unlayered.css +107 -80
- package/views/docs/contract.md +310 -7
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/bulk-bar.md +4 -0
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +8 -0
- package/views/docs/controls/date-editor.md +6 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +8 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +6 -0
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +6 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +8 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +6 -0
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +8 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +11 -7
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +143 -11
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +6 -5
- package/views/docs/reference/react.md +19 -12
- package/views/docs/reference/views.md +11 -5
- package/views/docs/reshaping.md +17 -1
- package/views/skills/views/SKILL.md +1 -1
|
@@ -23,9 +23,87 @@ Import from `viewkitjs/views/list` to give a list its rows from your server, and
|
|
|
23
23
|
- its own `rows` is `[]`, its `next` is `null`, and its `total` is the whole list's;
|
|
24
24
|
- a group that carries `rows` is loaded, and carries its own `next`;
|
|
25
25
|
- a group without rows is loaded by a `group` request for its key (`""` for the rows with no value).
|
|
26
|
-
- **A page that shows part of a list** (one company's deals) narrows it in its source, on the server: `source={(request) => loadDeals(companyId, request)}`. Your server adds that narrowing beside its access rules and never takes one from the request.
|
|
26
|
+
- **A page that shows part of a list** (one company's deals) narrows it in its source, on the server: `source={(request) => loadDeals(companyId, request)}`. Your server adds that narrowing beside its access rules and never takes one from the request. Where the narrowing can change while the list stays mounted (another company, the same page), hand the list `key={companyId}` too, so it starts again rather than paging one company's rows from another's source.
|
|
27
27
|
- **Request members are strict**, so when a request gains a key, update your servers before your clients.
|
|
28
28
|
|
|
29
|
+
## The ready List
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
"use client";
|
|
33
|
+
import { defineFields } from "viewkitjs/fields";
|
|
34
|
+
import { List, type ListChange } from "viewkitjs/views/list";
|
|
35
|
+
|
|
36
|
+
const ORDER_FIELDS = defineFields({
|
|
37
|
+
entity: "order",
|
|
38
|
+
identity: "name",
|
|
39
|
+
fields: {
|
|
40
|
+
name: { type: "text", label: "Name", required: true },
|
|
41
|
+
owner: { type: "text", label: "Owner" },
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
type Order = { id: string; name: string; owner: string };
|
|
46
|
+
|
|
47
|
+
async function save({ id, values }: ListChange<Order>) {
|
|
48
|
+
const answer = await fetch(`/api/orders/${id}`, { method: "PATCH", body: JSON.stringify(values) });
|
|
49
|
+
if (!answer.ok) throw new Error("The order wasn't saved.");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// The whole list: the toolbar, the grid, saved views, edits and undo, on a computer and a phone.
|
|
53
|
+
export function Orders({ orders }: { orders: readonly Order[] }) {
|
|
54
|
+
return <List id="orders" fields={ORDER_FIELDS} rows={orders} save={save} />;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
From your server, a page at a time, the list hands each part's request to a `source` in place of `rows`:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { fetchSource, type ListSource } from "viewkitjs/views/list";
|
|
62
|
+
|
|
63
|
+
// A route that answers list requests.
|
|
64
|
+
const ORDERS = fetchSource<Order>("/api/orders/list");
|
|
65
|
+
export function OrdersFromARoute() {
|
|
66
|
+
return <List id="orders" fields={ORDER_FIELDS} source={ORDERS} save={save} />;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Or your server action ("use server"), a source as it stands.
|
|
70
|
+
declare const loadOrders: ListSource<Order>;
|
|
71
|
+
export function OrdersFromAnAction() {
|
|
72
|
+
return <List id="orders" fields={ORDER_FIELDS} source={loadOrders} save={save} />;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- `List` — a whole list in one component: a `ListRoot` that keeps its saved views (the browser's store by default) around `ListToolbar`, `ListGrid` and `ListBulkBar`, in the Outright look. Below the provider's desktop query it draws the phone's form (the toolbar's one line, its panels in sheets, the grid's taps), with nothing more passed. Its props, each optional but the first three:
|
|
77
|
+
- `id`: the list's name; its saved views, the person's draft and layer, and its open view are kept under it.
|
|
78
|
+
- `fields`: a `defineFields` registry. Every field is a column, in the registry's order, bound by its key.
|
|
79
|
+
- `rows`: your rows, each your own flat `{ id, ...values }`; the list filters, sorts and groups them as its settings ask.
|
|
80
|
+
- `source`, in place of `rows`: where the rows come from (a `ListSource`: `fetchSource("/api/deals/list")`, or your server action as it stands, `source={loadDeals}`). Whether there is one is read as the list mounts; each request goes to the one handed last. Hand one or the other, never both.
|
|
81
|
+
- The list asks one request per part it draws, each through `answerFor`: the first page of `rows` as the settings or the quick filters' hold change (a width or a hidden column asks nothing), the next page as the grid's end comes near, a group's next page as that group's end does; every matching row's `ids` as your app calls `select("all")`; each saved view's `view-counts` while Show counts is on (each view's own filter, beside the search and the hold, not the open view's filter); the quick filters' `counts` while their panel is open; and the `values` of each text field while Filter or Customize is open.
|
|
82
|
+
- An answer a newer request has outrun is dropped, and no page is ever asked with a cursor from older settings. A part is asked again only as what a request carries changes.
|
|
83
|
+
- While a first page is out with no rows shown, the grid shows its wait, not its empty state; rows shown stay until the new ones land. A group the source sends unnamed (postgres leaves an option's so) takes its field's name for its key.
|
|
84
|
+
- A refusal shows in the grid's empty state, in your server's words; a refusal of a later page keeps the rows shown. A throw is said through the toast, and the rows shown stay.
|
|
85
|
+
- Picks from a paged list stay across its pages, and clear as the search, filter, group or the quick filters' hold changes; the grid's header box picks the rows in hand. A refused or failed `ids` is said through the toast, and the picks go back to the grid's.
|
|
86
|
+
- `pageSize`: with a `source`, how many rows each page asks for. Default 50, held between 1 and 1000.
|
|
87
|
+
- `save`: one save per record (`ListSave`). An edit, a paste, a fill, an undo or a redo of one record's cells is one call; it throws to refuse, in words the toast says. With none, the list is read-only.
|
|
88
|
+
- `columns`: columns changed by their field's key (`ListColumnsOverride`). Keep it stable (a module constant, or `useMemo`): a new object binds the fields and works out the rows again.
|
|
89
|
+
- `views`: a `ViewsStore`, or `{ seed }` (your own views, read-only), `{ records }` (what the delete question calls the rows), `{ store }`.
|
|
90
|
+
- `defaults`: what a list with no saved view shows; by default the fields' columns over `LIST_SETTINGS_DEFAULTS`.
|
|
91
|
+
- `sortFilter` and `bar`: the toolbar's form on a computer, as `ListRoot` takes them.
|
|
92
|
+
- `menus`: every menu as data ([Menus as data](#menus-as-data)): `column`, `row` and `group` reach the grid, `view`, `add` and `more` the toolbar.
|
|
93
|
+
- `toolbarParts`: where each of the toolbar's parts stands ([Parts as data](#parts-as-data)).
|
|
94
|
+
- `customizeIn`: where Customize opens on a computer (VK-1026). `"popover"`, the default, at its button. `"pane"`: in your map's `Pane` (`CONTROLS.Pane`), at the list's right edge under the toolbar and as tall as the grid, over its edge, the grid scrolling and taking presses beside it; the grid then stands in a box of its own, `data-slot="vk-list-box"` (positioned, a flex column that fills the list: give the list its height as a flex column), the Pane's. On a phone Customize keeps its Sheet. An app on `ListRoot` hands its own box to `ListToolbar` as `paneBox`.
|
|
95
|
+
- `link`: default `true`. The address carries the open view and what changed over it (`view`, `q`, `change`), written in place as it changes, your other parameters and history state kept; an opened link wins over the person's draft; back and forward open what the address says. A link it can't read is said through the toast. Two lists on one page share those parameters: hand the second `link={false}`.
|
|
96
|
+
- `can`: `{ edit: false }` leaves every cell read-only, as with no `save`; `{ share: false }` takes "Save for everyone" away even where the store lets the person share, read as the list mounts, as `defaults` is.
|
|
97
|
+
- `onOpenRow`, `rowHref` and `rowWritable` reach the grid, as `GridTable` takes them; `onAdd`, `addItems` and `quickFilters` the toolbar, as `ReadyToolbar` takes them; the quick filters' hold narrows the rows too.
|
|
98
|
+
- `toolbar`, `grid` and `bulk`: any other prop of `ListToolbar`, `ListGrid` and `ListBulkBar`. A prop handed at the top wins over the same one in these; one not handed leaves theirs. `menus` merges key by key. A `grid.children` of your own (your own bar) stands where `ListBulkBar` would, and wins.
|
|
99
|
+
- `className`: on the `div` around the parts (`data-slot="vk-list"`). With `customizeIn: "pane"` the grid stands in a `div` of its own inside it (`data-slot="vk-list-box"`).
|
|
100
|
+
- A field its key can't bind (a writable `datetime`, whose editor needs your time zone) throws, naming the field: hand its binding in `columns` (`bind`).
|
|
101
|
+
- For another arrangement, write `ListRoot` with the same data props and place the parts yourself.
|
|
102
|
+
- `ListProps` — what `List` takes.
|
|
103
|
+
- `ListColumnOverride` — one column's change by its field's key: `width`, `header`, `hidden` (the column starts hidden in the defaults), `editable: false` (an edit only ever taken away), and `bind`, the field's binding where its key doesn't say (a `bindFields` spec: `read`, and `write` handing back `{ body }` or `{ skip, reason }`).
|
|
104
|
+
- `ListColumnsOverride` — the columns changed, by field key.
|
|
105
|
+
- `ListFieldsRegistry` — a list's fields: what `defineFields` returns.
|
|
106
|
+
|
|
29
107
|
## A list's root
|
|
30
108
|
|
|
31
109
|
```tsx
|
|
@@ -47,11 +125,18 @@ export function DealsList({ children }: { children: ReactNode }) {
|
|
|
47
125
|
|
|
48
126
|
- `ListRoot` — holds one list's state in a store outside React, for every part inside it, wherever it stands. It has two modes, fixed by its first render:
|
|
49
127
|
- **Yours (memory mode):** it takes `id`, and the list's settings and layer as you hold them: `settings`, `layer`, `onChange` and `onLayerChange`, exactly as `useListSettingsState` returns them, or your own saved view's. Optionally `view` (the shared view this list shows, a `CollectionViewState`), `sortFilter` and `bar` (as `ReadyToolbar` takes them).
|
|
50
|
-
- **Kept by ViewKit:** handed no `settings`, it keeps the list's saved views, the person's draft and their layer itself, through a `ViewsStore`: below, "A list's saved views". It takes `id`, and optionally `views`, `defaults`, `link`, `sortFilter` and `bar`.
|
|
128
|
+
- **Kept by ViewKit:** handed no `settings`, it keeps the list's saved views, the person's draft and their layer itself, through a `ViewsStore`: below, "A list's saved views". It takes `id`, and optionally `views`, `defaults`, `link`, `sortFilter` and `bar`. `link={true}` carries the open view in the address, as `List`'s `link` does; a `readListLink` reading is opened and never written. Either way the open view is kept on the device (`ports.viewPrefs`), opened again where no link names one.
|
|
129
|
+
- **A list's data, in either mode** (`ListData`): `fields` (its columns, and in store mode its defaults), `rows` (worked out as the settings ask, into `answer`) or `source` and `pageSize` (answered a page at a time), `quickFilters` (their hold narrows the rows, in memory and from a source), `columns`, `save` and `can`, as `List` takes them. A grid under the root (`ListGrid`) saves through `save`, and hands the root its undo, redo and edits.
|
|
51
130
|
- A change a part makes goes to your `onChange` or `onLayerChange`; your next `settings` and `layer` are what every part reads. A change you refuse never shows.
|
|
52
131
|
- One panel is open per root, whichever frame opened it: every `Toolbar` inside it, every frame of your own under a `ToolbarRadioProvider` and every part standing in no frame share the root's radio. Outside a root, each frame keeps its own. Two roots never close each other's panels.
|
|
53
132
|
- It draws no element of its own.
|
|
54
133
|
- `ListRootProps` — what `ListRoot` takes.
|
|
134
|
+
- `ListData` — what `ListRoot` holds of a list's data, in either mode: `fields`, `rows` or `source` and `pageSize`, `quickFilters`, `columns`, `save` and `can`.
|
|
135
|
+
- `ListAnswerState` — the rows a list shows: `groups` and `grouped` (as `GridTable` takes them), `groupHeads` (every group's head, hidden ones too, for the group panel), `ids` (the rows in hand, in the order drawn), `total` (`{ count, exact }`, or `null`), `filterValues` (what the filter offers), `loading` (a source's first page is out) and `refused` (a source's), `more` (`rows`: the next page; `groups`: each group's), `paged` (the rows come a page at a time), `viewCounts` and `holdCounts` (each saved view's count and each quick filter's values counted, where a source answered them; `null` otherwise).
|
|
136
|
+
- `ListGrid` — `GridTable` reading the root around it: its rows from `answer`, its columns from `fields`, the widths, order, look and figures from the person's settings and layer, the header's sort and Group by from the settings, a band folded into the layer, an edit through the root's `save`, and its picks published to `selection`. Every `GridTable` prop is yours to hand, and wins. Its children stand where the grid keeps room for its selection bar (`ListBulkBar`). A `selection` handed is your own: the root then doesn't follow the grid's picks, and the children aren't drawn.
|
|
137
|
+
- `ListGridProps` — what `ListGrid` takes: `GridTableProps`, each optional, and `children`.
|
|
138
|
+
- `ListBulkBar` — ViewKit's selection bar over the root's picks: their count, and its clear picking none. Place it inside `ListGrid`. Your `verbs` (none by default), `onDelete` and the rest of `SelectionBar`'s props.
|
|
139
|
+
- `ListBulkBarProps` — what `ListBulkBar` takes: `SelectionBarProps` without `count` and `onClear`, `verbs` optional.
|
|
55
140
|
- `ListSlot` — a place for a list's parts outside its tree, where you put it (your page header): `<ListSlot name="header" />` draws a `div` (`data-slot="vk-list-slot"`, `data-name`), optionally with your `className`. One slot per name under a `ViewsProvider`: a later one takes the fills from an earlier.
|
|
56
141
|
- `ListSlotProps` — what `ListSlot` takes: `name`, and optionally `className`.
|
|
57
142
|
- `ListFill` — what goes into the slot of its `name`, from inside a `ListRoot`: `<ListFill name="header"><ListToolbar … /></ListFill>`. It draws through a portal, so what it holds keeps the root around the fill: a toolbar drawn in your header reads and changes the list, and its panels are the root's, open across a change of form. While no slot of its name stands, it draws nothing.
|
|
@@ -66,15 +151,19 @@ export function DealsList({ children }: { children: ReactNode }) {
|
|
|
66
151
|
- `view`: `settings` (the view as the person edits it), `layer` (their own layer over it) and `shared` (the shared view, or `null`; kept by ViewKit, the open view, the person's own included).
|
|
67
152
|
- `panels`: `open` (the one open panel's key, or `null`), `pages` (each panel's page by its key), `held` (the filter rule held until whole), `barShown` (the filter bar shows), `footHere` (Clear and Save stand in Customize's foot, not at the bar's end), `sortFilter` and `bar`. `ListToolbar` says `barShown` and `footHere` as it draws.
|
|
68
153
|
- `views`: the list's saved views where the root keeps them (a `ListViewsState`); `null` in memory mode.
|
|
69
|
-
- `
|
|
154
|
+
- `columns`: the list's columns from its `fields`; `null` with none.
|
|
155
|
+
- `answer`: the rows the list shows (a `ListAnswerState`); `null` with no `fields`, or with neither `rows` nor a `source`.
|
|
156
|
+
- `edits`: `saving` (a write is still out), `canUndo` and `canRedo`, from the grid under the root.
|
|
157
|
+
- `selection`: `ids` (the picked rows), `all` (every matching row is picked) and `count` (how many; `null` while every matching row is picked and the list doesn't know its total). With a `ListGrid` under the root, the picks are the grid's: they clear as the view's search, filter or group (or the quick filters' hold) changes, and `select("all")` picks every row shown, or from a source every matching row, kept across its pages.
|
|
70
158
|
- `setSettings(change)` and `setLayer(patch)`: hand a change to the root's `onChange` and `onLayerChange`.
|
|
71
159
|
- `openPanel(key, page?)`: opens a panel and closes any other, on `page` where handed, else on the page it holds. `closePanel(key)`: closes it if it is the one open, forgetting its page. `setPage(key, page)`: a panel's page; set on a panel that isn't open, it waits for it, until another opens.
|
|
72
160
|
- `hold(rule)`: holds a filter rule until whole, or `null`.
|
|
73
|
-
- `select(ids)`: picks these rows; `select("all")` picks every matching row; `select([])` picks none.
|
|
161
|
+
- `select(ids)`: picks these rows; `select("all")` picks every matching row (from a source, it asks for their `ids` first, `all` and the total's `count` while they come); `select([])` picks none.
|
|
74
162
|
- `saveView()` and `resetView()`: the shared view's Save for everyone and Reset (kept by ViewKit, the open view's Save and Reset); nothing without one.
|
|
75
|
-
- `undo()`:
|
|
76
|
-
- `
|
|
77
|
-
- `
|
|
163
|
+
- `undo()` and `redo()`: take back the list's last edit, and put back the last one taken back, as ⌘Z and ⌘⇧Z do; nothing until there is one.
|
|
164
|
+
- `loadMore()` and `loadGroup(key)`: from a source, the next page, and a group's; nothing in memory, or while a newer request is out.
|
|
165
|
+
- `ListToolbar` — the ready toolbar's parts in their arrangements, reading the root around it: every `ReadyToolbar` prop but those the root holds. `ReadyToolbar` is a `ListRoot` holding no data around it. Place one per root: two would draw the same panels. Handed no `views` in a root that keeps its views, it draws the views row from them, its menu included; a new view takes one of its `layouts` (a table where none are handed).
|
|
166
|
+
- `ListToolbarProps` — what `ListToolbar` takes: `ReadyToolbarProps` without `settings`, `layer`, `onChange`, `onLayerChange`, `view`, `sortFilter` and `bar`; `toolbarParts` among them ([Parts as data](#parts-as-data)). In a root that holds a list's `fields` and its `rows` or `source`, `columns`, `groupHeads` and `filterData` default to the root's; handed, yours win. With `customizeIn: "pane"`, hand `paneBox`, your box round the grid (positioned, never scrolling itself: a `div` your `ref` callback keeps in state), and Customize opens there in the Pane on a computer (VK-1026).
|
|
78
167
|
|
|
79
168
|
## A list's saved views
|
|
80
169
|
|
|
@@ -107,7 +196,7 @@ A `ListRoot` handed no `settings` keeps the list's saved views, a person's draft
|
|
|
107
196
|
- `defaults`: what a list with no saved view shows, and a new view's start; default `LIST_SETTINGS_DEFAULTS`.
|
|
108
197
|
- `link`: the address's reading as the list opened (`readListLink(location.search)` from `viewkitjs/fields/query`): its view opens, and its change (the search with it) shows over that view, in place of the person's draft. A link that names no view and no change beyond a search is no link: the draft shows, the search over it.
|
|
109
198
|
- `ListViewsOptions` — `views` as options: `store` (your own `ViewsStore`), or `seed` (your own views for this list, on the browser store: listed first, shared, read-only), and `records` (what the list holds, in the delete question's line: "deals"; default "records").
|
|
110
|
-
- `ListViewsState` — `ListState.views`: `list` (the views the row shows: shared first, then the person's own, each by position), `open` (the open view's id, or `null`), `ready` (the store has answered), `share` (this person may write shared views), `pending` (a write is under way) and `records`; and the verbs `openView(id)`, `save()`, `saveAs(name, { from?, layout? })`, `rename(id, name)`, `duplicate(id, name)`, `remove(id)`, `restore(id, open)`, `reorder(scope, ids)`, `reset()` and `canSave(view)`. The views row calls them; a part of your own can too.
|
|
199
|
+
- `ListViewsState` — `ListState.views`: `list` (the views the row shows: shared first, then the person's own, each by position), `open` (the open view's id, or `null`), `ready` (the store has answered), `share` (this person may write shared views), `pending` (a write is under way) and `records`; and the verbs `openView(id, change?)` (with `change`, laid over the view as the edited settings, its draft replaced: what an opened link does), `save()`, `saveAs(name, { from?, layout? })`, `rename(id, name)`, `duplicate(id, name)`, `remove(id)`, `restore(id, open)`, `reorder(scope, ids)`, `reset()` and `canSave(view)`. The views row calls them; a part of your own can too.
|
|
111
200
|
- `browserViewsStore(options?)` — the default store: one `localStorage` entry per list, `vk:views:<list id>`, holding the person's own views, their drafts and their layer. An entry that doesn't read (a hand edit, an older one) reads as empty, and the next write replaces it. Where storage refuses a write, the change lasts as long as the page.
|
|
112
201
|
- `BrowserViewsStoreOptions` — what `browserViewsStore` takes: `key` (the entries' prefix, default `"vk:views"`), `seed` (your own views, by list id) and `storage` (default `window.localStorage`; `null` keeps them for the page's life).
|
|
113
202
|
- `ViewsStore` — the one interface a root keeps its views through, the browser store's and your app's own: `list`, `save` (hands back the view as kept), `remove`, `reorder`, optionally `subscribe`, `draft.get`/`draft.set`, `layer.get`/`layer.set`, and optionally `can.share`. Every call names its list, so one store serves an app. Each answers at once or with a promise.
|
|
@@ -166,7 +255,7 @@ export function DealsGrid(grid: GridTableProps<Deal>) {
|
|
|
166
255
|
- `view(items, { view })`: a view's menu, handed the view (`ViewsViewsListItem`): the rows a view's option hands (`menu`, Edit view… among them) and the menu a views list draws from the axis's `verbs` (`ViewsViewVerbs.menu`).
|
|
167
256
|
- `add(items)`: New's items: your `addItems`, or with `onAdd` alone one row keyed `new` that runs it. New opens what it returns as a menu.
|
|
168
257
|
- `more(items, { line })`: ⋯, the folded parts' rows, each keyed by its part. Each line folds into its own ⋯, so it is handed which: `"row"` or `"bar"` (the filter bar). A press on any row closes ⋯ first.
|
|
169
|
-
-
|
|
258
|
+
- `List` takes `menus` whole and hands each part its own: `GridTable` (and `ListGrid`) takes `column`, `row` and `group` as `menus` ([`/grid`](./grid.md)), and `ReadyToolbar` and `ListToolbar` take `view`, `add` and `more` as `menus` ([`/panels/react`](./panels-react.md)).
|
|
170
259
|
- A menu ViewKit doesn't open stays closed: ⋯ stands only while a part has folded, whatever `more` adds, and New stays a button while `add` hands back its one `new` row. A menu ViewKit opens stays openable: a function that returns `[]` opens an empty menu, so drop what you don't want rather than everything.
|
|
171
260
|
- Each function is called as ViewKit draws (`view` on every toolbar render, the rest as their menus draw): keep it pure and cheap, and call no hooks in it. `row` alone may answer later, with a promise, asked once per opening.
|
|
172
261
|
- `menu` — the four changes a menu function makes, each pure: it returns a new list and never changes the one it is handed. A key is found at any depth, a group's rows too. `drop`, `add` and `move` take any list of keyed rows, so they reshape the toolbar's parts too ([Parts as data](#parts-as-data)).
|
|
@@ -190,6 +279,18 @@ Every default row's key is a public name: your function finds rows by it. A key
|
|
|
190
279
|
- New: your `addItems`' keys, or `new`.
|
|
191
280
|
- ⋯: the folded parts' keys: `options`, `sort`, `filter`, `filters`, `filter-add`, `quick`.
|
|
192
281
|
|
|
282
|
+
Every toolbar button names itself to your `ToolbarButton` by the same keys (`part`, VK-984): a button is named after the
|
|
283
|
+
place it stands in, and a place's second kind of button by a name of its own. Each place's buttons:
|
|
284
|
+
|
|
285
|
+
| Place (`key`) | Its buttons' `part` |
|
|
286
|
+
|---|---|
|
|
287
|
+
| `options`, `search`, `quick`, `new`, `filter`, `filter-add`, `advanced-filters` | the key itself (an advanced filter's pill, one each) |
|
|
288
|
+
| `sort` | `sort` (Sort, or the sort's pill where it stands in this place); `sort-add`, the + after the pill |
|
|
289
|
+
| `sort-pill` | `sort-pill`; `sort-add`, the + after it |
|
|
290
|
+
| `filters` | `filters` (each rule's four joined buttons, told apart by `joined`); `filter` (the bar's Filter while it holds none) or `filter-add` (its + after them); `more-filters` ("+N filters") |
|
|
291
|
+
| `views`, `views-stacked`, `save` | none outside your own frame: ViewKit's own pills and your `Button`. In your own frame, `views-chip`, `views-tab`, `views-more`, `views-add`, `clear` and `save` (`ViewsFramePart`) |
|
|
292
|
+
| ⋯ (no place) | `more` |
|
|
293
|
+
|
|
193
294
|
## Parts as data
|
|
194
295
|
|
|
195
296
|
The ready toolbar (`ReadyToolbar`, `ListToolbar`) hands you each form's parts as data, as its menus hand their items, and draws the parts your `toolbarParts` function hands back: each on its line and side, in your order, with its words. Hand nothing and each arrangement stands its parts as it always has. Atlas's layout, the views alone on the left and Search (with its word), Sort, Filter, Customize and New on the right:
|
|
@@ -215,13 +316,44 @@ export function DealsToolbar(props: ReadyToolbarProps<Deal>) {
|
|
|
215
316
|
```
|
|
216
317
|
|
|
217
318
|
- The function, `(parts, ctx) => parts` ([`ToolbarParts`, `ToolbarPartPlace` and `ToolbarPartsContext`, in `/panels/react`](./panels-react.md#the-toolbar)): handed the form's parts in the order they are placed (the row's start, its end, then the bar's start and end, as they draw on a computer; a kit phone's one line as it reads; in the `row` arrangement's narrow and phone forms the search still moves where the form puts it), it hands back the parts drawn, in their order. A part left out isn't drawn; a key the form doesn't hold is skipped, unless it brings its own `node`; a key handed twice counts once. Handed back as it came, the toolbar is exactly as with nothing handed. It is called as the toolbar draws: keep it pure and cheap, and call no hooks in it. Not `parts`, which is the builder's own (a field's part columns in Customize).
|
|
218
|
-
- A part's place: `{ key, line, side, words, node? }`.
|
|
319
|
+
- A part's place: `{ key, line, side, words, node?, className?, button?, panel? }`.
|
|
219
320
|
- `key`: the part's public name: `views` (and `views-stacked`, a second axis of views on the bar), `options` (Customize), `search`, `sort` (on the row, or the bar's sort in the old form), `sort-pill` (the bar's sort in Mihai's look with `bar: "always"`), `filter` and `filter-add` (Filter), `filters` (the filters on the bar), `advanced-filters`, `sep` (the bar's separator), `quick`, `new`, `save` (Clear and Save).
|
|
220
321
|
- `line`: `"row"`, `"bar"` (the filter bar; in the `row` arrangement, the line below the row) or `"foot"` (a kit phone list's foot, New's place; anywhere else it means the row). On a kit phone the row and the bar are one line, so `"bar"` stands a part on it too, and New stands on the line once you place it anywhere but `"foot"`.
|
|
221
322
|
- `side`: `"start"` or `"end"`.
|
|
222
323
|
- `words`: `"both"`, as the look's words say (icon and word where the buttons on the right show theirs), or `"icon"`, its icon alone whatever the look. It means something for a part whose button has an icon and a word: `search`, `quick`, `sort`, `filter`, `filter-add`, `options`, `new`. The search and, in Mihai's look, the quick filters' button are handed `"icon"`, as they always stood; placed `"both"`, they read their word and give it up first as the line narrows, as Sort and Filter do. A button with no icon (Clear, Save) keeps its words.
|
|
223
324
|
- `node`: a part of your own, under a key of your own, drawn where you place it (it doesn't fold into ⋯). `menu.add` places it. The keys above are the toolbar's, even while a part of theirs isn't handed: don't name your own part by one.
|
|
325
|
+
- `className`: put on every toolbar button the part draws (each handed its `part`, [Default keys](#default-keys)'s table), on the button itself, through your `ToolbarButton` (ViewKit's own puts it on its `<button>`, `CONTROL_ATOMS`' on the toolbar button or New's `Button`).
|
|
326
|
+
- `panel`: where what it opens hangs at its button, `{ side?, align?, offset? }` (`ToolbarPanelPlace`), your `Popover`'s `side`, `align` and `sideOffset`: `{ align: "start" }` opens Sort's panel from its button's start wherever Sort stands. Absent, a part on its line's end side opens its panel aligned to its button's end and one on its start side to its start, 8 px below it; a host of yours (`hosts`) or a phone's sheet takes none of it.
|
|
327
|
+
- `button`: your own button for the part, a component taking `ViewsToolbarButtonProps` ([`/react`](./react.md)), drawn for each of its toolbar buttons in place of your `ToolbarButton` and handed the very props it would get: `part`, `open`, `count`, `onClick`, `ref` and the rest. What it opens stays ViewKit's and hangs at your button through `ref`: put `ref` on the element you draw.
|
|
224
328
|
- Which form: `ctx` is `{ arrangement, phone }` (`"kit"` or `"row"`, and whether it is a phone's), so one function can place each form its own way.
|
|
225
329
|
- A part that comes and goes stays the toolbar's: the bar's `filters`, `save`, `sort-pill` and `sep` are handed only while the bar stands, so find them by key (a move by a key the list doesn't hold changes nothing). A part you place on the bar in Mihai's look at rest brings the bar with it; Clear and Save then still wait in Customize's foot.
|
|
226
|
-
-
|
|
330
|
+
- Dressing a place, New your own button, Sort a ghost and Customize outlined by your stylesheet:
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
import type { ViewsToolbarButtonProps } from "viewkitjs/views/react";
|
|
334
|
+
|
|
335
|
+
// Your own New: handed what ViewKit's button would be, `ref` on the element it draws.
|
|
336
|
+
function OutlinedNew({ icon, label, onClick, ref }: ViewsToolbarButtonProps) {
|
|
337
|
+
return (
|
|
338
|
+
<button ref={ref} type="button" className="deals-new" onClick={onClick}>
|
|
339
|
+
{icon}
|
|
340
|
+
{label}
|
|
341
|
+
</button>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const dressedParts: ToolbarParts = (parts) =>
|
|
346
|
+
parts.map((p) =>
|
|
347
|
+
p.key === "new" ? { ...p, button: OutlinedNew }
|
|
348
|
+
: p.key === "sort" ? { ...p, className: "deals-sort" }
|
|
349
|
+
: p.key === "options" ? { ...p, className: "deals-options" }
|
|
350
|
+
: p);
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
- What stays fixed:
|
|
354
|
+
- Clear and Save move as one part (`save`); a part's words are `both` or `icon`, never its word alone.
|
|
355
|
+
- The views row (its chip, tabs, "+N" and "+", and `views-stacked`) and Clear and Save draw ViewKit's own pills and your `Button` in the ready toolbar: they take no `part`, and their place's `className` and `button` don't reach them (in your own frame they draw through your `ToolbarButton`, [`/panels/react`](./panels-react.md#the-toolbar)).
|
|
356
|
+
- ⋯ is named (`more`) but has no place, so no class or button of yours: dress it in your `ToolbarButton` by its `part`.
|
|
357
|
+
- A place's second buttons (Sort's +, the bar's Filter and +, "+N filters", a rule's four) share their place's one `className` and one `button`; tell them apart by `part` and `joined`.
|
|
358
|
+
- The kit's own `Toolbar` control ([`/controls`](./controls.md)) still places its parts from its look options, `settings: "right"` included, while the ready toolbar never reads `settings`: Customize's side comes through `toolbarParts`.
|
|
227
359
|
|
|
@@ -88,7 +88,7 @@ on a frame round the controls as `data-<piece>-*`, which each control's styleshe
|
|
|
88
88
|
- `StatusLookOptionId` — the Status's option ids.
|
|
89
89
|
- `SWITCH_LOOKS` — the Switch's: 4 options (`shape` a computer's, `phone` a phone's, `mark`, `motion`) and five looks, `slim`, `capsule`, `thin`, `hairline` and `classic`.
|
|
90
90
|
- `SwitchLookOptionId` — the Switch's option ids.
|
|
91
|
-
- `SETTING_ROW_LOOKS` — the setting row's: 3 options, two a computer's (`card`, `outlined` (the default)
|
|
91
|
+
- `SETTING_ROW_LOOKS` — the setting row's: 3 options, two a computer's (`card`, `outlined` or `raised` (the default); `rows`, `snug` or `roomy` (the default), 64 tall) and one a phone's (`icon`, `line` (the default), the glyph alone, or `tile`, a white glyph on a tile of the row's `colour`), and two looks, `outright` (`outlined`, `snug`, `line`: the SwitchRows as they were) and `attio` (`raised`, `roomy`, `line`: every option's default).
|
|
92
92
|
- `SettingRowOptionId` — its option ids.
|
|
93
93
|
- `SettingRowPicks` — one value for each.
|
|
94
94
|
- `MENU_LIST_LOOKS` — the menu list's, each a phone's: 6 options (`rows`, what its rows stand on; `lines`; `height`, a scale from `48` to `56`; `corners`, a scale from `lg` to `2xl`; `close`, a Close row; `tiles`) and five looks, `stack`, `card`, `plain`, `joined` and `words`, which pick the first four and leave the Close row and the tiles to the app.
|
|
@@ -49,7 +49,7 @@ A panel's list keeps `--vk-panel-padding` from its edge ([Tokens](../contract.md
|
|
|
49
49
|
|
|
50
50
|
## Customize
|
|
51
51
|
|
|
52
|
-
The panel a list's Options button opens: your components map's `CustomizeBody` (`CONTROLS.CustomizeBody`, or your own), handed the view's settings as data, wherever the panel hangs ([the components map](../contract.md#the-components-map)). ViewKit draws no Customize of its own. Your app hosts it: in a popover, or in a drawer of its own.
|
|
52
|
+
The panel a list's Options button opens: your components map's `CustomizeBody` (`CONTROLS.CustomizeBody`, or your own), handed the view's settings as data, wherever the panel hangs ([the components map](../contract.md#the-components-map)). ViewKit draws no Customize of its own. Your app hosts it: in a popover, or in a drawer of its own; or, with the toolbar's `customizeIn: "pane"` (VK-1026), in your map's `Pane` (`CONTROLS.Pane`) at the right edge of the list's box under the toolbar, as tall as the list, the list in use beside it, with no host of your own. The Pane is a computer's shell: on a phone Customize keeps its Sheet.
|
|
53
53
|
|
|
54
54
|
- `ViewOptionsPanelContent` — the panel: your `CustomizeBody`, handed the view's settings as data. Takes the list's `filters`, `sort`, `group`, `timeScopeConfig`, `dateRangeConfigs`, `toggles` and `layout` (`ViewOptionInputs`; its `sorts` and `filterTree` reach the body as its sort and filter), `activePanel` and `onOpenPanel` (the body's `page` and `onPageChange`), `anyActive` and `clearAll`, and optionally `view` (`CollectionViewState`), `viewFoot` (the body's `foot`: `kit` for Clear and Save, `none` where they stand elsewhere), `footClear` (with no shared view, the foot's Clear), `foldFilters` (the body's `fields` folded behind one Filter row, on by default; off, each is a row of its own), `onClose` (the body's `onDone`), `closeButton` (whether a phone's body is handed its ✕, default true; false in a sheet whose head draws it), `fieldEditor` (`PanelFieldEditor`), and `viewName`, `onRenameView`, `onCopyLink`, `onExport` and `exportCount`, handed on to the body as `ToolbarOptions` hands them. `fill` is deprecated and read by nothing: the body sizes itself in its host.
|
|
55
55
|
- `ViewOptionsActions` — the actions row: Copy link and Share parked, Export CSV live when `exportCsv` (`CollectionExportCsv`) is handed in, its count on the row and one export at a time behind the `loading` glyph, which your app draws turning.
|
|
@@ -64,15 +64,16 @@ The panel a list's Options button opens: your components map's `CustomizeBody` (
|
|
|
64
64
|
|
|
65
65
|
The frame that holds a list's controls, and the parts that need no list settings. `Toolbar` takes the parts your app hands it, each placed at the start or the end, on the first line or the second, and draws them in one of three forms (`/panels`' [arrangement](panels.md#the-toolbars-arrangement)): `row`, `narrow` (its own box under 700px) or `phone` (your provider's `desktopQuery` says it is not a desktop). Pass `phone` or `narrow` to decide either yourself. A part is any node: the frame tells it where it stands through `useToolbarSlot`, and its buttons draw through the `ToolbarButton` atom at their line's size. A part that opens something (a menu, a panel, a pane your app holds) registers it with `useToolbarPanel`, and opening one closes every other, however it opened. A change of form draws the parts afresh, so keep what must last across it (a search's text, a panel's open state) in your app: a panel part left to hold its own state closes when the box crosses 700px, and one handed its state from `useToolbarPanelState`, held above the `Toolbar`, stays open on its page. The row's end controls float over the views on a fade of `--vk-ground` (`data-toolbar-cluster`), which the folding views row measures. Its look is plain; its pieces carry the `data-slot`s the [contract](../contract.md) lists.
|
|
66
66
|
|
|
67
|
-
- `Toolbar` — the frame (one radio for its parts, or, inside a `ListRoot`, the root's). Takes `parts` (`ToolbarPart[]`), and optionally `phone`, `narrow`, `narrowBelow` (700 by default), `fold`, `more` (`ToolbarMore`, ⋯ as data: handed the folded parts' rows, each keyed by its part, and `{ line }`, `"row"` or `"bar"`, since each line folds into its own ⋯, it returns the rows ⋯ shows; a press on any of them closes ⋯ first) and `className`. Each of its lines is a toolbar of its own (`role="toolbar"`): the filter bar (and the three forms' second line) named `views.panels.toolbar-bar` ("Sort and filters"), every other line `views.panels.toolbar-row` ("List tools"). With `fold` it draws the kit's arrangement (`/panels`' fold arrangement): the row and the filter bar under it, each a band with a line across under it, or a phone's one line, with no narrow form; each line measures itself and gives way as it narrows (it contains its own inline size, so its width comes from where it stands and never from what its lines hold: in a holder sized from its content, a main beside a sidebar, it still gives way, with no wrapper of yours), a part's words turning to its icon (the `ToolbarButton` atom's `iconAlone`), the views folding tabs into "+N", a part's filters folding into "+N filters", then what may fold going behind ⋯ (`data-slot="vk-toolbar-overflow"`, your `Menu`, each row the folded part's `menu`). A folded part keeps its state, and what it opens hangs under ⋯; while ⋯'s menu, a folded part's panel, the views' "+N" list, a filter with a part open (`data-slot="vk-toolbar-filter-rule"` marked `data-open`), an open advanced filter (`data-slot="vk-toolbar-advanced-filter"` marked `data-open`) or "+N filters"' menu (the button in `data-slot="vk-toolbar-more-filters"`, `aria-expanded`) is open, the line holds still. The frame holds the search's open state: open, the line gives way around it, and on a phone the search takes the line beside the views.
|
|
67
|
+
- `Toolbar` — the frame (one radio for its parts, or, inside a `ListRoot`, the root's). Takes `parts` (`ToolbarPart[]`), and optionally `phone`, `narrow`, `narrowBelow` (700 by default), `fold`, `more` (`ToolbarMore`, ⋯ as data: handed the folded parts' rows, each keyed by its part, and `{ line }`, `"row"` or `"bar"`, since each line folds into its own ⋯, it returns the rows ⋯ shows; a press on any of them closes ⋯ first) and `className`. Each of its lines is a toolbar of its own (`role="toolbar"`): the filter bar (and the three forms' second line) named `views.panels.toolbar-bar` ("Sort and filters"), every other line `views.panels.toolbar-row` ("List tools"). With `fold` it draws the kit's arrangement (`/panels`' fold arrangement): the row and the filter bar under it, each a band with a line across under it (on a computer its padding, the room between its tools and the line are `--vk-toolbar-line-py`, `--vk-toolbar-line-gap` and `--vk-toolbar-line-w`, [Tokens](../contract.md)), or a phone's one line, with no narrow form; each line measures itself and gives way as it narrows (it contains its own inline size, so its width comes from where it stands and never from what its lines hold: in a holder sized from its content, a main beside a sidebar, it still gives way, with no wrapper of yours), a part's words turning to its icon (the `ToolbarButton` atom's `iconAlone`), the views folding tabs into "+N", a part's filters folding into "+N filters", then what may fold going behind ⋯ (`data-slot="vk-toolbar-overflow"`, your `Menu`, each row the folded part's `menu`). A folded part keeps its state, and what it opens hangs under ⋯; while ⋯'s menu, a folded part's panel, the views' "+N" list, a filter with a part open (`data-slot="vk-toolbar-filter-rule"` marked `data-open`), an open advanced filter (`data-slot="vk-toolbar-advanced-filter"` marked `data-open`) or "+N filters"' menu (the button in `data-slot="vk-toolbar-more-filters"`, `aria-expanded`) is open, the line holds still. The frame holds the search's open state: open, the line gives way around it, and on a phone the search takes the line beside the views.
|
|
68
68
|
- `ToolbarPart` — a part as your app hands it: a `ToolbarPlacement` (its `key`, `side`, `line`, `role`, in the fold arrangement `shed`, `tabs`, `filters` and `fold`, and `words` and `foot`), its `node`, and for a part that may fold its `menu`: `{ label, icon?, onSelect }`, its row in ⋯. `words`: `"icon"` stands a `ToolbarButton` drawn in it as its icon alone, its words given up (a button with no icon keeps them); `"both"` gives the search's button, and the quick filters' button handed `word={null}`, their word, as the look's words say; absent, each its own. `foot: false` keeps New on a phone's folding line instead of at the list's foot.
|
|
69
69
|
- `ToolbarSeparator` — the line between the sort and the filters on a filter bar (or Filter while there is none), placed with `role: "separator"`: drawn only while a part stands drawn on each side of it, and never on a phone's line.
|
|
70
70
|
- `ToolbarViews` — the views row: `views` (`CollectionViewsInput`) and `viewsLayout`. On the row and in the narrow panel it draws `ViewAxes`, or with `as="picker"` and one axis alone its `ViewPicker`; placed again with `stacked` on the second line, it draws the axes a stacked layout pushes beneath, small. On the phone it draws a `ViewPicker` per axis, every axis, and nothing for `stacked`. With `showCounts` the toolbar owns Show counts (`withCounts`). Place it only when the list has views: the phone's search fills the row when nothing is placed at the start.
|
|
71
71
|
- `ToolbarSearch` — the search, placed with `role: "search"`: `value`, `onChange`, `placeholder` (`views.panels.search` by default) and `searching` (while true, a spinner, worded `views.panels.searching`, stands where its glass is, on the button and in the field, and the field, marked `aria-busy`, keeps its value and its typing; your app decides when it is true). On the row, and beside the phone's views, a button that opens an inline field; in the narrow panel, and on a phone with no views, a field that fills its line. A field that holds a value shows from the start. Escape and its ✕ clear it and close a field the button opened; a blur with nothing typed closes it. The field is your `Input`, or, handed `SearchField` in your components map, your whole search box: it stands in place of the glass, the field and the ✕, handed the value, the clear and its form, while the button, the open state, the caret on a press, Escape and a blur stay ViewKit's ([the components map](../contract.md#the-components-map)). Shut, its button is its glass alone, reading "Search" beside it only where its part is placed `words: "both"`, as the look's words say.
|
|
72
72
|
- `ToolbarNew` — the +: `onAdd` (one way to add, the button fires it) or `items` (several, opened through your `Menu`, one of the toolbar's panels), `label` (`views.panels.toolbar-new` by default) and `icon` (your `add` glyph by default); its word for a dress is its label. With neither, the row draws it disabled, so its place never moves; the narrow panel and the phone draw nothing. In a folding `Toolbar` on a phone it stands at the list's foot instead (`data-at="foot"`): a round + (the atom's `foot`) fixed at the screen's bottom-end corner, over the list, lifted by `--vk-toolbar-foot`, and drawn into the document's body so a page that scrolls inside a transformed box can't carry it away; with no verb, nothing there.
|
|
73
73
|
- `ToolbarButton` — the `ToolbarButton` atom at the size of the line it stands in, for a custom part's buttons.
|
|
74
|
-
- `useToolbarSlot` — where this part stands (`ToolbarSlotState`): `form`, `fill`, `size` and its line's kind; in the fold arrangement also `fold`, `iconAlone`, `tabsFolded`, `filtersFolded` (how many of its filters folded into "+N filters"), `folded`, `more` (⋯'s button) and, for the search, `search` (its open state, held by the frame); `words` and `foot`, as the part was placed (`ToolbarPlacement`, [`/panels`](./panels.md)), which your own frame may set too; and `appFrame`, true inside your own frame (`ToolbarSlotProvider`); outside a `Toolbar`, the row's main line at `md`, folding nothing.
|
|
74
|
+
- `useToolbarSlot` — where this part stands (`ToolbarSlotState`): `form`, `fill`, `size` and its line's kind; in the fold arrangement also `fold`, `iconAlone`, `tabsFolded`, `filtersFolded` (how many of its filters folded into "+N filters"), `folded`, `more` (⋯'s button) and, for the search, `search` (its open state, held by the frame); `words` and `foot`, as the part was placed (`ToolbarPlacement`, [`/panels`](./panels.md)), which your own frame may set too; `key`, `className` and `button`, its place's key and look (`ToolbarPartPlace`): a part names its buttons after `key`, and draws each with `button` in place of your `ToolbarButton` and with `className` on it, which your own frame may hand too; `side` and `panel`, its side of its line (folded into ⋯, ⋯'s side) and its place's `panel` (`ToolbarPanelPlace`): what it opens hangs toward `side` unless `panel` says, and your own frame may set either; and `appFrame`, true inside your own frame (`ToolbarSlotProvider`); outside a `Toolbar`, the row's main line at `md`, folding nothing.
|
|
75
75
|
- `ToolbarSlotState` — what `useToolbarSlot` returns.
|
|
76
|
+
- `ToolbarPanelPlace` — where a part's popover hangs at its button: `{ side?, align?, offset? }`, your `Popover`'s `side`, `align` and `sideOffset`. Absent, on a computer a part on its line's end side opens what it opens aligned to its button's end and one on the start side to its start, 8 px below it; a part outside a `Toolbar` with no `side` in its slot opens as it always did (Customize, Sort, Filter and the quick filters at their button's end, the sort pill and Filter on the bar at its start). Read from where the part stands, never from whether it is open, so a closing panel keeps its side.
|
|
76
77
|
- `useToolbarPanel` — a part's open state as one of the toolbar's panels, named by a key: `{ open, onOpenChange }`. Each call is its own panel, so two parts that name the same key still close each other. Hand it `{ open, onOpenChange }` for a panel your app holds; without, it holds its own. Inside a `ListRoot`, one of the root's panels; outside a `Toolbar` and a root, plain open state.
|
|
77
78
|
- `ToolbarSlotProvider` — for your own toolbar frame: tells the part inside it where it stands, as `Toolbar` tells each of its parts. Takes `slot`, a partial `ToolbarSlotState` laid over the outside default (the row's main line at `md`, folding nothing); its `form` defaults to your provider's `desktopQuery` (`"phone"` off a desktop). It sets `appFrame: true` (`slot.appFrame: false` opts out): inside it the Views part (`ToolbarViews`) draws its chip, its view tabs, its "+N" and its "+" through your `ToolbarButton`, and `ToolbarSave` its Clear and Save, each told what it is (`current`, `part`, `onContextMenu`); a tab's status colours (`activeClassName`, `hoverClassName`) stay with ViewKit's own pills and don't reach it, and a `PillGroup`, `ViewTabs`, `ViewPicker` or `ViewCreatePill` you place yourself stays as it is. It replaces any slot above it.
|
|
78
79
|
- `ToolbarRadioProvider` — for your own toolbar frame: the radio, held for its life, as `Toolbar` holds one. Placed around your frame, the parts inside it that open something close each other, and a part's panel opens in your `Sheet` when its slot's `form` is `"phone"`. Inside a `ListRoot` ([`/list`](./list.md)) it is the root's radio, so your frame's panels and every other frame's in that list close each other.
|
|
@@ -154,10 +155,10 @@ Options, Sort and Filter each open their panel from their own button, and each t
|
|
|
154
155
|
- `ToolbarPanelState` — what `useToolbarPanelState` returns.
|
|
155
156
|
- `FilterPanelContent` — the Filter panel standing alone, for a host of your own: the filter list at its root (titled `views.panels.filter`, no back arrow) and the pages it opens, with `filters`, `timeScopeConfig`, `dateRangeConfigs`, `page`, `onPageChange`, `onClose` and `fill`.
|
|
156
157
|
- `ToolbarSave` — Clear and Save, at the end of a filter bar while the list differs (`data-slot="vk-toolbar-save"`): takes `view` (a `CollectionViewState`: Clear is its `onReset`, Save its `onPublish`, shown only where `canPublish`, both waiting while `pending`, nothing while `changes` is 0), or with no shared view `onClear`, Clear alone taking the list back to its default; nothing when neither has anything to do. Clear has no ground and Save wears the field's look, each your `Button`.
|
|
157
|
-
- `ReadyToolbar` — the toolbar for an app that doesn't arrange its own (`ReadyToolbarProps`): the builder's input (`settings`, `layer`, `columns`, `onChange`, `onLayerChange` and the rest of `SettingsPanelsInput`), and optionally `views`, `viewsLayout`, `onAdd` or `addItems` and `addLabel`, `view`, `toggles`, `fieldEditor`, `searchPlaceholder`, `searching` (handed to its search), `hosts` (`{ options, sort, filter, quick }`), `quickFilters` (a `QuickFiltersConfig`: handed, the quick filters' button stands on the row's end before the search, in the row arrangement before Options, folding into ⋯ as the row narrows; its counts follow the toolbar's Show counts unless the config carries its own `showCounts`), `quickFiltersOpen` with `onQuickFiltersOpenChange` (the quick filters' panel open, held by you, so a `QuickFiltersReminder` at your list's foot can open it; absent, the toolbar holds it), `phone`, `narrow`, `severalSorts` (true by default: the sort holds up to 3 rules, the row's Sort opening the sort editor on them, or in the old form the sort pill on the bar; `false` keeps Sort's one rule, which opens its own list whether or not a sort stands), `addAfter` (true by default: the + after the sort pill; `false` draws none, and the pill's editor, or your `SortBody`, has Add sort at its foot, as `ToolbarSortPill`'s), `filterGroups` (true by default: and/or groups, each filter on the filter bar on a computer, in the row arrangement each advanced filter's pill after Filter and Convert to advanced filter on a filter's page, and on a phone Filter opening the filter editor on every rule; `false` keeps Filter, counting what is applied, in either arrangement), `arrangement` (`"kit"` by default, or `"row"`), `sortFilter` (`"right"` by default, or `"bar"`), `bar` (`"added"` by default, or `"always"`: with Sort and Filter on the row's right, the bar then always shows, its empty Sort and Filter included), `viewName`, `onRenameView`, `onCopyLink`, `onExport` and `exportCount` (handed on to Customize, as `ToolbarOptions` takes them), `menus` (`ToolbarMenus`: a view's menu, New's and ⋯ as data), `toolbarParts` (`ToolbarParts`: where each part stands, every form's parts handed as data and drawn as you hand them back, [`/list`'s Parts as data](./list.md#parts-as-data)) and `className`. It calls the builder and draws its parts in the kit's arrangement (`Toolbar`'s `fold`). By default, on a computer, one row at rest: the views with Customize beside them, then on its right Sort and Filter with their words, the quick filters' button and the search, each its icon alone, and New. Sort holds the sort (`ToolbarSortPill`'s `row`): lit while one stands (a view's saved sort included), counted from two, it opens the sort editor to change or remove the rules, Add sort at its foot; with none, the fields. Filter (`ToolbarFilterAdd`) adds a filter to the bar. Under the row the filter bar, a step smaller, is the filters' line: it comes only while a filter stands or is held (or one of its parts is open, or a second axis of views stands there), holding the filters (each as below, + after the last, no empty Filter) and Clear and Save at its end. While it doesn't stand, an unsaved change (a sort, a removed last filter) waits in Customize's foot, Clear and Save (on a shared view Customize also carries its dot), as on a phone. Each of the row's Sort and Filter is a panel of its own, apart from the bar's, so a press opens one list. `sortFilter: "bar"` with `bar: "always"` draws the kit arrangement's old form: the row, the views with Customize beside them and the search and New at its end, and under it the filter bar, always shown, a step smaller: the sort pill first, a separator, the filters (`ToolbarFilters`: each filter as its four joined parts, each advanced filter's pill, + after the last; while there is none, Filter, an empty place; the rule held until whole is held by the toolbar, so the bar counts it as it folds; with `filterGroups` false, Filter as before, with what is applied counted), and at its end Clear and Save (`ToolbarSave`) while the list differs: on a shared view (`view`) Clear takes it back and Save, where `canPublish`, keeps it for everyone; with no shared view, Clear alone takes the list back to its default (nothing filtered, the default sort, no group: so a list that starts grouped or filtered shows Clear at once); Customize's foot then draws neither. A row with no room folds as the kit's does (words to icons, the view tabs into "+N", the bar's last filters into "+N filters", then into ⋯: by default Customize and the row's Sort and Filter, whatever is set; in the old form Customize, and the sort and Filter while no filter stands), with no narrow form. On a phone one line in either form (the views, the sort, Filter, the quick filters' button when handed, Customize, then the search, which opens across the line), Clear and Save in Customize's foot (`views.panels.view-clear`, `views.panels.view-save`; with no shared view, Clear alone), and New a round + at the list's foot, lifted by `--vk-toolbar-foot`. `arrangement: "row"` draws the order of 12 Nov instead: the views on the left; search, sort, filter, options and new on the right, the narrow form under 700px, and Reset and Save for everyone in Customize's foot. Every change comes back as a `ListSettingsChange` or a layer patch: its search writes the settings' search, its ✕s clear in one change (`settingsCleared`), and the active view's menu gains "Edit view…" (`withEditView`), which opens Customize. It is a `ListRoot` around `ListToolbar` ([`/list`](./list.md)): its panels' state is held in that root, above its frame, so a change of form keeps a panel open on its page, in a sheet once the form is the phone's. Show counts is the view's: read from `settings.showCounts` for the views row and the quick filters, absent meaning on, it joins Customize's toggles where the views carry counts and is written back through `onChange`. Group steps aside on a board (`groupShown`).
|
|
158
|
+
- `ReadyToolbar` — the toolbar for an app that doesn't arrange its own (`ReadyToolbarProps`): the builder's input (`settings`, `layer`, `columns`, `onChange`, `onLayerChange` and the rest of `SettingsPanelsInput`), and optionally `views`, `viewsLayout`, `onAdd` or `addItems` and `addLabel`, `view`, `toggles`, `fieldEditor`, `searchPlaceholder`, `searching` (handed to its search), `hosts` (`{ options, sort, filter, quick }`), `customizeIn` (`"popover"` by default; `"pane"`: on a computer Customize opens in your map's `Pane`, `CONTROLS.Pane`, at the right edge of `paneBox`, under the toolbar and as tall as the list, the list in use beside it; on a phone its Sheet either way; a map with no `Pane`, or your own `hosts.options`, keeps theirs) and `paneBox` (the list's box the Pane stands in: positioned, holding the grid under the toolbar, never scrolling itself; null until it is on the page; not handed, the popover), `quickFilters` (a `QuickFiltersConfig`: handed, the quick filters' button stands on the row's end before the search, in the row arrangement before Options, folding into ⋯ as the row narrows; its counts follow the toolbar's Show counts unless the config carries its own `showCounts`), `quickFiltersOpen` with `onQuickFiltersOpenChange` (the quick filters' panel open, held by you, so a `QuickFiltersReminder` at your list's foot can open it; absent, the toolbar holds it), `phone`, `narrow`, `severalSorts` (true by default: the sort holds up to 3 rules, the row's Sort opening the sort editor on them, or in the old form the sort pill on the bar; `false` keeps Sort's one rule, which opens its own list whether or not a sort stands), `addAfter` (true by default: the + after the sort pill; `false` draws none, and the pill's editor, or your `SortBody`, has Add sort at its foot, as `ToolbarSortPill`'s), `filterGroups` (true by default: and/or groups, each filter on the filter bar on a computer, in the row arrangement each advanced filter's pill after Filter and Convert to advanced filter on a filter's page, and on a phone Filter opening the filter editor on every rule; `false` keeps Filter, counting what is applied, in either arrangement), `arrangement` (`"kit"` by default, or `"row"`), `sortFilter` (`"right"` by default, or `"bar"`), `bar` (`"added"` by default, or `"always"`: with Sort and Filter on the row's right, the bar then always shows, its empty Sort and Filter included), `viewName`, `onRenameView`, `onCopyLink`, `onExport` and `exportCount` (handed on to Customize, as `ToolbarOptions` takes them), `menus` (`ToolbarMenus`: a view's menu, New's and ⋯ as data), `toolbarParts` (`ToolbarParts`: where each part stands, every form's parts handed as data and drawn as you hand them back, [`/list`'s Parts as data](./list.md#parts-as-data)) and `className`. It calls the builder and draws its parts in the kit's arrangement (`Toolbar`'s `fold`). By default, on a computer, one row at rest: the views with Customize beside them, then on its right Sort and Filter with their words, the quick filters' button and the search, each its icon alone, and New. Sort holds the sort (`ToolbarSortPill`'s `row`): lit while one stands (a view's saved sort included), counted from two, it opens the sort editor to change or remove the rules, Add sort at its foot; with none, the fields. Filter (`ToolbarFilterAdd`) adds a filter to the bar. Under the row the filter bar, a step smaller, is the filters' line: it comes only while a filter stands or is held (or one of its parts is open, or a second axis of views stands there), holding the filters (each as below, + after the last, no empty Filter) and Clear and Save at its end. While it doesn't stand, an unsaved change (a sort, a removed last filter) waits in Customize's foot, Clear and Save (on a shared view Customize also carries its dot), as on a phone. Each of the row's Sort and Filter is a panel of its own, apart from the bar's, so a press opens one list. `sortFilter: "bar"` with `bar: "always"` draws the kit arrangement's old form: the row, the views with Customize beside them and the search and New at its end, and under it the filter bar, always shown, a step smaller: the sort pill first, a separator, the filters (`ToolbarFilters`: each filter as its four joined parts, each advanced filter's pill, + after the last; while there is none, Filter, an empty place; the rule held until whole is held by the toolbar, so the bar counts it as it folds; with `filterGroups` false, Filter as before, with what is applied counted), and at its end Clear and Save (`ToolbarSave`) while the list differs: on a shared view (`view`) Clear takes it back and Save, where `canPublish`, keeps it for everyone; with no shared view, Clear alone takes the list back to its default (nothing filtered, the default sort, no group: so a list that starts grouped or filtered shows Clear at once); Customize's foot then draws neither. A row with no room folds as the kit's does (words to icons, the view tabs into "+N", the bar's last filters into "+N filters", then into ⋯: by default Customize and the row's Sort and Filter, whatever is set; in the old form Customize, and the sort and Filter while no filter stands), with no narrow form. On a phone one line in either form (the views, the sort, Filter, the quick filters' button when handed, Customize, then the search, which opens across the line), Clear and Save in Customize's foot (`views.panels.view-clear`, `views.panels.view-save`; with no shared view, Clear alone), and New a round + at the list's foot, lifted by `--vk-toolbar-foot`. `arrangement: "row"` draws the order of 12 Nov instead: the views on the left; search, sort, filter, options and new on the right, the narrow form under 700px, and Reset and Save for everyone in Customize's foot. Every change comes back as a `ListSettingsChange` or a layer patch: its search writes the settings' search, its ✕s clear in one change (`settingsCleared`), and the active view's menu gains "Edit view…" (`withEditView`), which opens Customize. It is a `ListRoot` around `ListToolbar` ([`/list`](./list.md)): its panels' state is held in that root, above its frame, so a change of form keeps a panel open on its page, in a sheet once the form is the phone's. Show counts is the view's: read from `settings.showCounts` for the views row and the quick filters, absent meaning on, it joins Customize's toggles where the views carry counts and is written back through `onChange`. Group steps aside on a board (`groupShown`).
|
|
158
159
|
- `ReadyToolbarProps` — what `ReadyToolbar` takes.
|
|
159
160
|
- `ToolbarParts` — `ReadyToolbar`'s and `ListToolbar`'s `toolbarParts`: `(parts: ToolbarPartPlace[], ctx: ToolbarPartsContext) => ToolbarPartPlace[]`, handed the form's parts in the order they are placed and handing back the parts drawn, in their order. The rules and an example are [`/list`'s Parts as data](./list.md#parts-as-data).
|
|
160
|
-
- `ToolbarPartPlace` — a part's place: `{ key, line, side, words, node? }`: its public key, its line (`"row"`, `"bar"`, or `"foot"`, New's place at a kit phone list's foot), its side (`"start"` or `"end"`), its words (`"both"` or `"icon"`),
|
|
161
|
+
- `ToolbarPartPlace` — a part's place: `{ key, line, side, words, node?, className?, button?, panel? }`: its public key, its line (`"row"`, `"bar"`, or `"foot"`, New's place at a kit phone list's foot), its side (`"start"` or `"end"`), its words (`"both"` or `"icon"`), `node` for a part of your own under a key of your own, and its look: `className`, put on every toolbar button the part draws, and `button`, your own button drawn for each of them in place of your `ToolbarButton`, handed the same props (`ref` included: put it on your button); and `panel` (`ToolbarPanelPlace`), where what it opens hangs at its button. [`/list`'s Parts as data](./list.md#parts-as-data) lists each place's buttons and what stays fixed.
|
|
161
162
|
- `ToolbarPartsContext` — which form the parts are for: `{ arrangement, phone }` (`"kit"` or `"row"`, and whether it is a phone's).
|
|
162
163
|
- `ToolbarMore` — ⋯ as data, `Toolbar`'s `more` and `ToolbarMenus`' `more`: `(items, { line }) => items`.
|
|
163
164
|
- `ToolbarMenus` — the toolbar's menus as data, `ReadyToolbar`'s and `ListToolbar`'s `menus`: `view(items, { view })` (a view's menu: an option's own rows, Edit view… among them, and the menu a views list draws from the axis's verbs), `add(items)` (New's items: `addItems`, or with `onAdd` alone one row keyed `new`; New opens what it returns as a menu) and `more(items, { line })` (⋯'s rows, each keyed by its part, on the row's line or the filter bar's). The helpers, the keys and the rules are [`/list`'s Menus as data](./list.md#menus-as-data).
|
|
@@ -7,17 +7,20 @@ Import from `viewkitjs/views/react` in a client component: the door opens with t
|
|
|
7
7
|
Guide: [the provider](../guides/the-provider.md).
|
|
8
8
|
|
|
9
9
|
- `ViewsProvider` — the provider every view reads: mount it once at your app's client root, above every view: `<ViewsProvider components={CONTROLS}>` at the least, and whatever of its icons, ports and conventions your app draws its own. It lays your atoms over the defaults (handed `CONTROLS` as it stands, over `CONTROL_ATOMS`, which it carries), hands your `Menu` its items with every row under a disabled group already disabled, and fills in the browser's own confirm where your ports carry no `confirm`. It hands its views one context value per distinct set of inputs, so pass module-level objects: a new one on each render re-renders every view.
|
|
10
|
-
- `ViewsProviderProps` — what the provider takes. Its optional `desktopQuery` is the media query that means a desktop, so an editor opens as a popover there and as a sheet elsewhere, the default controls take their phone form below it (`PhoneLine`), as do the toolbar's panels and the views picker outside a `Toolbar`, and the grid's own chrome takes its desktop form there (the grid's frame carries `data-desktop`); hand in the one your own shell switches on. Default `DEFAULT_DESKTOP_QUERY`. Its optional `sheetActions` (`ViewsSheetActionsPlace`, default `bar`) says where an editor's ✕ and ✓, and a toolbar panel's ✕, stand in that sheet. Its optional `escape` (`ViewsEscapeRules`) says what Escape does in an editor of each field type on a desktop, `"keep"` or `"cancel"`, a type left out cancelling. Its optional `selectionBar` (`ViewsSelectionBarSettings`) says where the selection bar sits. Its optional `oneValue` (`ViewsOneValueEditors`) says whether a single email or domain opens the text box in its cell (the default) or the value list holding one value, in the grid and a field row alike. Its optional `datePicks` (`ViewsDatePicks`) names the quick days the date editors offer, in order; absent, today, tomorrow and next Monday. Its optional `now` (a `Date`) is the moment every date counts from; absent, the provider reads the clock after mount, then once a minute and when the tab comes back into view, never while rendering, and a date that needs it draws its full form until the first read.
|
|
10
|
+
- `ViewsProviderProps` — what the provider takes. Its optional `desktopQuery` is the media query that means a desktop, so an editor opens as a popover there and as a sheet elsewhere, the default controls take their phone form below it (`PhoneLine`), as do the toolbar's panels and the views picker outside a `Toolbar`, and the grid's own chrome takes its desktop form there (the grid's frame carries `data-desktop`); hand in the one your own shell switches on. Default `DEFAULT_DESKTOP_QUERY`. Its optional `sheetActions` (`ViewsSheetActionsPlace`, default `bar`) says where an editor's ✕ and ✓, and a toolbar panel's ✕, stand in that sheet. Its optional `escape` (`ViewsEscapeRules`) says what Escape does in an editor of each field type on a desktop, `"keep"` or `"cancel"`, a type left out cancelling. Its optional `selectionBar` (`ViewsSelectionBarSettings`) says where the selection bar sits. Its optional `oneValue` (`ViewsOneValueEditors`) says whether a single email or domain opens the text box in its cell (the default) or the value list holding one value, in the grid and a field row alike. Its optional `datePicks` (`ViewsDatePicks`) names the quick days the date editors offer, in order; absent, today, tomorrow and next Monday. Its optional `now` (a `Date`) is the moment every date counts from; absent, the provider reads the clock after mount, then once a minute and when the tab comes back into view, never while rendering, and a date that needs it draws its full form until the first read. Its optional `panelControls` (`true`, or the names among `Button`, `Select`, `Menu`, `Popover`, `Input` and `Calendar`, `PanelControlName`) says which of your own controls ViewKit's sort and filter panels (VK-1013) and its text, number and date editors (VK-1021; `Calendar` is the date editor's month) draw inside them, each handed the map's props and the part's `data-slot` and `data-key`; a control of `CONTROLS`' stays ViewKit's whatever it says, and without it they draw ViewKit's own, as before.
|
|
11
11
|
- `EditEscape` — `"cancel" | "keep"`: what Escape does in an edit session (`viewkitjs/views/editors/session` hands it on too).
|
|
12
12
|
- `ViewsEscapeRules` — the provider's `escape`: an `EditEscape` per field type, and for `email`, `phone`, `url` and `domain` either one `EditEscape`, which covers both of their editors, or an `EditEscapeByEditor`.
|
|
13
13
|
- `EditEscapeByEditor` — `{ box?: EditEscape; list?: EditEscape }`: what Escape does in an email, phone, link or domain field by the editor it opens, `box` its text box (a single value) and `list` the value list (several values, or a single one `oneValue` opens as a list of one). One left out throws the edit away.
|
|
14
14
|
- `ViewsOneValueEditors` — `Partial<Record<"email" | "domain", "text" | "list">>`, the provider's `oneValue`.
|
|
15
|
+
- `PANEL_CONTROL_NAMES` — `Button`, `Select`, `Menu`, `Popover`, `Input` and `Calendar`: the controls the provider's `panelControls` can name.
|
|
16
|
+
- `PanelControlName` — one member of `PANEL_CONTROL_NAMES`.
|
|
17
|
+
- `flatSelectItems` — a Select's rows (`ViewsSelectItem[]`) with every `level` flattened, each row one level in standing in its parent's place, named by its path ("Company › Region"), its value as handed: for a `Select` of yours that draws no levels.
|
|
15
18
|
- `DEFAULT_DESKTOP_QUERY` — `(min-width: 1024px)`: the width a desktop starts at when the provider is handed no `desktopQuery`, the default controls' phone line too (`PhoneLine`, in controls.md). Where the screen can't be asked (a server render, a browser with no `matchMedia`), it is a desktop.
|
|
16
19
|
- Required: `components` (your primitives, `ViewsComponents`: `CONTROLS`, or it with your own spread after it, or every one of your own) and `children`.
|
|
17
20
|
- Defaulted (VK-198): `icons` (your glyphs by meaning, `ViewsIcons`; absent, each meaning drawn through your `AppIcon` by its name, which `CONTROLS.AppIcon` draws with ViewKit's own glyphs); `ports` (your runtime services, `ViewsPorts`, each optional: absent, haptics that do nothing, the browser's clipboard, a store on `localStorage` at the package's `vk:` keys, and the toast and confirm `PortsHost` draws); `conventions` (the `FieldConventions` of `viewkitjs/fields` every value is read with; absent, `en-US` in `UTC`, the same on the server and in the browser). What you hand wins.
|
|
18
21
|
- Optional: `atoms`, any of your own atoms, each laid over the default of its name, or over `CONTROL_ATOMS`' where `components` is `CONTROLS` as it stands (a map spread from it carries none); `messages`, your wording for the package's own messages, defaulting to `resolveViewsMessage` (the package's English); `presentation`, `(defaults: FieldPresentation) => FieldPresentation`, how your numbers, dates and durations read: given the package's defaults in the conventions' locale, return yours. It is called where a value is drawn, so your provider imports none of the display.
|
|
19
22
|
- `useViews` — reads the nearest provider's value inside a view or an atom of your own. It throws an error that says where to mount one when no `ViewsProvider` is above it.
|
|
20
|
-
- `ViewsContextValue` — what `useViews` returns: the `components` (your `Menu` wrapped to settle disabled groups), the merged `atoms`, the `icons`, the `ports` as `ViewsResolvedPorts` (every port there, yours or its default), the `messages` resolver, the `conventions`, your `presentation` when you handed one, and the `desktopQuery` in force (yours or `DEFAULT_DESKTOP_QUERY`); `escape` and `oneValue` when you handed them; `selectionBar` and `datePicks` when you handed them. The provider's moment (`now`) isn't in it: what draws a date reads it, so a new moment redraws only those.
|
|
23
|
+
- `ViewsContextValue` — what `useViews` returns: the `components` (your `Menu` wrapped to settle disabled groups), the merged `atoms`, the `icons`, the `ports` as `ViewsResolvedPorts` (every port there, yours or its default), the `messages` resolver, the `conventions`, your `presentation` when you handed one, and the `desktopQuery` in force (yours or `DEFAULT_DESKTOP_QUERY`); `escape` and `oneValue` when you handed them; `selectionBar` and `datePicks` when you handed them; and `panelControls`, the set of names the panels draw as yours (opted in, and not one of `CONTROLS`'), empty unless you opt in. The provider's moment (`now`) isn't in it: what draws a date reads it, so a new moment redraws only those.
|
|
21
24
|
- `NOOP_PORTS` — ports that do nothing, for a server render, a test or an app without a device: the toasts and haptics are empty, the clipboard writes nothing (resolving `false`) and reads `null`, and the prefs store keeps nothing. It carries no `confirm`, so the provider falls back to `PortsHost`'s or the browser's.
|
|
22
25
|
- `NOOP_TOAST` — the toast that draws nothing, `NOOP_PORTS`' own: what `useViews().ports.toast` is where an app hands no toast and no `PortsHost` stands.
|
|
23
26
|
|
|
@@ -25,10 +28,10 @@ Guide: [the provider](../guides/the-provider.md).
|
|
|
25
28
|
|
|
26
29
|
The primitives your app hands in, modelled on Base UI's shapes: a controlled `open` with `onOpenChange(open, details)`, an `anchor` rather than a trigger child on the popover and the menu, and no `asChild`. An adapter on Base UI wraps its copies thinly; one on Radix absorbs the difference. The package ships none of them and depends on neither library. The [contract](../contract.md) says what each slot promises and how to write an adapter.
|
|
27
30
|
|
|
28
|
-
- `ViewsComponents` — the map itself, one key per name of the contract's components: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon`, `Markdown`, `TextBody` (a whole body for a text typed as one string: the text editors open it; `CONTROLS.TextBody` is ViewKit's), `NumberBody` (a whole body for a number, money or a percent: the number editors open it, a duration excepted; `CONTROLS.NumberBody` is ViewKit's), `Picker` (a whole pick list: the select, several-values and relation editors open it; `CONTROLS.Picker` is ViewKit's), `LinksBody` (a whole links body: the set editor of a relation whose field declares `links` opens it, handed each link's roles, the lead and the field's roles; `CONTROLS.LinksBody` is ViewKit's), `DateBody` (a whole date body: the date editors open it; `CONTROLS.DateBody` is ViewKit's), `PartsBody` (a whole body for a name, a place or a range: the name, place and range editors open it; `CONTROLS.PartsBody` is ViewKit's), `ValuesBody` (a whole body for several emails, phones, links or domains: the value list editors open it; `CONTROLS.ValuesBody` is ViewKit's), and the toolbar panels' bodies: `SortBody` (the sort editor's whole body: the sort pill opens it on a computer and in the phone's Sheet; `CONTROLS.SortBody` is ViewKit's), `FilterBody` (the filter editor's whole body: an advanced filter's pill opens it on a computer and Filter in the phone's Sheet; `CONTROLS.FilterBody` is ViewKit's), `FilterPartBody` (a filter rule's way and value: a filter on the bar opens it; `CONTROLS.FilterPartBody` is ViewKit's), `FieldsBody` (the field list's whole body: every sort and filter field list opens it; `CONTROLS.FieldsBody` is ViewKit's), `QuickFiltersBody` (the quick filters' whole body: the quick filters' button opens it on a computer and in the phone's Sheet; `CONTROLS.QuickFiltersBody` is ViewKit's), `ViewsListBody` (the views list's whole body: the view picker's chip opens it on a computer and in the phone's Sheet; `CONTROLS.ViewsListBody` is ViewKit's) and `CustomizeBody` (Customize's whole body: Options and everything else that draws Customize open it on a computer and in the phone's Sheet; `CONTROLS.CustomizeBody` is ViewKit's). `AppIcon` is your own icon component, taking `name` and `className`, for the glyphs a host declares (a row's icon, a binding's icon); it draws on the first paint, because rows are measured as they mount, so map its names from a static record. `Markdown` is your markdown renderer, handed the stored text whole as `source`; the package parses no markdown itself. Eight keys are optional: `Input` (leave it out and the editors draw a plain `<input>`), `Command` (deprecated: the command list's parts, read by nothing), `Calendar` (the filter panel's month; reached without one, it throws an error naming it; `CONTROLS.Calendar` is ViewKit's), `RowsWait` (wraps a grid's rows; handed one, a grid that already shows rows keeps them, inert, as its children while new ones load, its column names and footer outside; left out, the grid draws Loading in place of its body), `GroupBody` (deprecated: read by nothing; a `CustomizeBody` holds its own group editor), `SearchField` (the toolbar's search box; handed one, the search opens it in place of its own field on a computer and on a phone), `PortsHost` (what draws the `toast` and `confirm` ports an app leaves out)
|
|
31
|
+
- `ViewsComponents` — the map itself, one key per name of the contract's components: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon`, `Markdown`, `TextBody` (a whole body for a text typed as one string: the text editors open it; `CONTROLS.TextBody` is ViewKit's), `NumberBody` (a whole body for a number, money or a percent: the number editors open it, a duration excepted; `CONTROLS.NumberBody` is ViewKit's), `Picker` (a whole pick list: the select, several-values and relation editors open it; `CONTROLS.Picker` is ViewKit's), `LinksBody` (a whole links body: the set editor of a relation whose field declares `links` opens it, handed each link's roles, the lead and the field's roles; `CONTROLS.LinksBody` is ViewKit's), `DateBody` (a whole date body: the date editors open it; `CONTROLS.DateBody` is ViewKit's), `PartsBody` (a whole body for a name, a place or a range: the name, place and range editors open it; `CONTROLS.PartsBody` is ViewKit's), `ValuesBody` (a whole body for several emails, phones, links or domains: the value list editors open it; `CONTROLS.ValuesBody` is ViewKit's), and the toolbar panels' bodies: `SortBody` (the sort editor's whole body: the sort pill opens it on a computer and in the phone's Sheet; `CONTROLS.SortBody` is ViewKit's), `FilterBody` (the filter editor's whole body: an advanced filter's pill opens it on a computer and Filter in the phone's Sheet; `CONTROLS.FilterBody` is ViewKit's), `FilterPartBody` (a filter rule's way and value: a filter on the bar opens it; `CONTROLS.FilterPartBody` is ViewKit's), `FieldsBody` (the field list's whole body: every sort and filter field list opens it; `CONTROLS.FieldsBody` is ViewKit's), `QuickFiltersBody` (the quick filters' whole body: the quick filters' button opens it on a computer and in the phone's Sheet; `CONTROLS.QuickFiltersBody` is ViewKit's), `ViewsListBody` (the views list's whole body: the view picker's chip opens it on a computer and in the phone's Sheet; `CONTROLS.ViewsListBody` is ViewKit's) and `CustomizeBody` (Customize's whole body: Options and everything else that draws Customize open it on a computer and in the phone's Sheet; `CONTROLS.CustomizeBody` is ViewKit's). `AppIcon` is your own icon component, taking `name` and `className`, for the glyphs a host declares (a row's icon, a binding's icon); it draws on the first paint, because rows are measured as they mount, so map its names from a static record. `Markdown` is your markdown renderer, handed the stored text whole as `source`; the package parses no markdown itself. Eight keys are optional: `Input` (leave it out and the editors draw a plain `<input>`), `Command` (deprecated: the command list's parts, read by nothing), `Calendar` (the filter panel's month; reached without one, it throws an error naming it; `CONTROLS.Calendar` is ViewKit's), `RowsWait` (wraps a grid's rows; handed one, a grid that already shows rows keeps them, inert, as its children while new ones load, its column names and footer outside; left out, the grid draws Loading in place of its body), `GroupBody` (deprecated: read by nothing; a `CustomizeBody` holds its own group editor), `SearchField` (the toolbar's search box; handed one, the search opens it in place of its own field on a computer and on a phone), `PortsHost` (what draws the `toast` and `confirm` ports an app leaves out), `SelectionBar` (the selection bar; handed one, ViewKit draws it in its own place) and `Pane` (a toolbar panel at the right edge of the list's box: a toolbar with `customizeIn: "pane"` opens Customize in it on a computer; left out, the `Popover`; `CONTROLS.Pane` is ViewKit's).
|
|
29
32
|
- `ViewsResolvedComponents` — the map as `useViews()` hands it on: yours, with `Input` always there, your own or the plain one, and `Calendar` always there, yours or a stand-in that throws an error naming the slot when it is reached.
|
|
30
|
-
- `ViewsButtonProps` — a button: its `children`, `onClick`, `disabled`, a `variant` (`default`, `secondary`, `ghost`, `outline`, `destructive`; `secondary` only for the views picker's chip), a `size` (`default`, `sm`, `icon`), its `type`, a class, `aria-label` and `title`; and a `ref`, `tabIndex`, `aria-haspopup`, `aria-expanded`, `data-slot` and `data-open`, which the grid hands its own buttons: forward each to your element; and `aria-disabled`, which a field row's edit target is handed while its write is pending; and `aria-pressed`, `role`, `aria-selected`, `data-state` and `data-vs-row`, which the panels' own buttons are handed (the new-line mark, a view's row in the picker, the views row's chips and a view's ⋯, Export).
|
|
31
|
-
- `ViewsPopoverProps` — a popover opened at an `anchor`, controlled by `open` and `onOpenChange`, placed by `side`, `align`, `sideOffset` and `alignOffset`.
|
|
33
|
+
- `ViewsButtonProps` — a button: its `children`, `onClick`, `disabled`, a `variant` (`default`, `secondary`, `ghost`, `outline`, `destructive`; `secondary` only for the views picker's chip), a `size` (`default`, `sm`, `icon`), its `type`, a class, `aria-label` and `title`; and a `ref`, `tabIndex`, `aria-haspopup`, `aria-expanded`, `data-slot` and `data-open`, which the grid hands its own buttons: forward each to your element; and `aria-disabled`, which a field row's edit target is handed while its write is pending; and `aria-pressed`, `role`, `aria-selected`, `data-state` and `data-vs-row`, which the panels' own buttons are handed (the new-line mark, a view's row in the picker, the views row's chips and a view's ⋯, Export); and `data-key`, which one of a part that repeats, beside its `data-slot`, inside the sort and filter panels under `panelControls`. There a ViewKit part may hand it more props than these (a tooltip's handlers, a `data-*` the panel finds it by again): forward the rest to your element.
|
|
34
|
+
- `ViewsPopoverProps` — a popover opened at an `anchor`, controlled by `open` and `onOpenChange`, placed by `side`, `align`, `sideOffset` and `alignOffset`; its `label`, where ViewKit names it (a panel's popover under `panelControls`), is its name to a screen reader, your popup's `aria-label`.
|
|
32
35
|
- Focus: `initialFocus` false keeps focus where it was when the popup opens, for an editor that focuses its own input (with `preventScroll`). Default true.
|
|
33
36
|
- Vetoes: `onOutsidePress` is handed the pointer press, its `target` where it landed, and returns `false` to keep the popup open, also against the focus that press moves; focus leaving by keyboard closes without asking. `onEscape` does the same for Escape.
|
|
34
37
|
- Look: `chrome` is `panel` (your card popover, the default) or `menu` (your menu panel's surface, for a popover that holds a list: no inset, no card width). `onPanelClick` takes a click inside the popup, `panelData` sets `data-*` attributes on it, and `style` carries what a class cannot say, such as a width that follows a cell.
|
|
@@ -36,13 +39,13 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
36
39
|
- `ViewsSelectionBarProps` — what the components map's `SelectionBar` is handed: `SelectionBar`'s own props, at every count.
|
|
37
40
|
- `ViewsTooltipProps` — a tooltip around the element it wraps (`children`), showing `content`, with `side`, `align`, `delayMs` and a class. Your app mounts one tooltip provider above the views; a tooltip never mounts its own.
|
|
38
41
|
- `ViewsCheckboxProps` — a checkbox: `checked`, and `indeterminate` for a box ticked partly, whose press hands `true` while `checked` is false. `onCheckedChange` hands the new value and, where your library reports it, `{ event }`, the press that changed it (a list reads its shift key for a range). `partialTone` colours the partial mark, `muted` by default or `brand` for a select-all with a live selection; with `disabled`, `readOnly` (shown as it is and not pressable: a yes/no the grid or a field row can't write), a class, `tabIndex` and `aria-label`.
|
|
39
|
-
- `ViewsMenuProps` — a menu opened at an `anchor`, with no trigger child (a group opens beside it only where it asks to and your menu can), controlled by `open` and `onOpenChange`, drawing its `items`, placed by `side` and `align`, and named by `label`, its accessible name, which every menu the package opens hands. On Base UI it is the menu's root, positioner and popup, the anchor handed to the positioner.
|
|
40
|
-
- `ViewsMenuItem` — one row of a menu, as data your `Menu` draws: its `key`, `label` (always words), `icon`, `onSelect`, `disabled` with an optional `disabledReason` (why, for you to show), and `destructive`, a `separatorBefore`, a `shortcut` hint drawn at its end and never bound, and an `href` that makes it a link (with `onSelect` still firing). A `checked` row is checkable and closes the menu like any row, unless it carries `keepOpen`. A row with `children` is a group: its rows drawn in place under its label, unless it carries `beside` (open them one level in), its own `onSelect`, `href` and `checked` ignored; a disabled group's rows reach your `Menu` already `disabled`, with the group's reason where they give none. Any row may carry `detail`, its current value in words, for its end. A plain row may carry `render`, which draws its inside in place of its icon, words, keys and count (`label` still its name; called while the menu draws, so it may call no hooks). All three are hints: a menu that draws none of them keeps every group in place and every row closing.
|
|
42
|
+
- `ViewsMenuProps` — a menu opened at an `anchor`, with no trigger child (a group opens beside it only where it asks to and your menu can), controlled by `open` and `onOpenChange`, drawing its `items`, placed by `side` and `align`, and named by `label`, its accessible name, which every menu the package opens hands; `data-slot`, its public name where ViewKit names it (a view's menu, `vk-view-menu`, VK-988), for your menu to draw on its popup. On Base UI it is the menu's root, positioner and popup, the anchor handed to the positioner.
|
|
43
|
+
- `ViewsMenuItem` — one row of a menu, as data your `Menu` draws: its `key`, `label` (always words), `icon`, `onSelect`, `disabled` with an optional `disabledReason` (why, for you to show), and `destructive`, a `separatorBefore`, a `shortcut` hint drawn at its end and never bound, and an `href` that makes it a link (with `onSelect` still firing). A `checked` row is checkable and closes the menu like any row, unless it carries `keepOpen`. A row with `children` is a group: its rows drawn in place under its label, unless it carries `beside` (open them one level in), its own `onSelect`, `href` and `checked` ignored; a disabled group's rows reach your `Menu` already `disabled`, with the group's reason where they give none. Any row may carry `detail`, its current value in words, for its end. A plain row may carry `render`, which draws its inside in place of its icon, words, keys and count (`label` still its name; called while the menu draws, so it may call no hooks). All three are hints: a menu that draws none of them keeps every group in place and every row closing. A row's `slot`, where ViewKit names it (a panel's menu under `panelControls`: `vk-sort-rule-action`), is its public name, `key` saying which: draw them on your row as `data-slot` and `data-key`.
|
|
41
44
|
- `ViewsCommandParts` — the command list's parts, the shape cmdk-based copies already have: `Root` (taking `label`, `shouldFilter` false to hand filtering to the host, a scoring `filter`, `loop` to wrap the arrows, and `defaultValue`, the value of the item highlighted as the list opens, none while no item has it), `Input` (a controlled `value` with `onValueChange`, a `placeholder`, `autoFocus`, a `ref`, `onKeyDown`, and `chrome` `search` for your search row or `bare` for the input alone), `List`, `Empty`, `Group` (with a `heading`) and `Item` (a `value`, `onSelect`, `disabled`, and `chosen`, which you colour as your chosen row while the package's row inside draws the check).
|
|
42
45
|
- `ViewsPickerProps` — a whole pick list your app draws, its search, rows, empty row and create row: its `label` (the field's name), `items`, `multiple`, `value` (one value or `null`; several, a list), `onValueChange` (the pick, `null` for the empty row, or the whole new list on every change; nothing is saved until the editor closes), `onDone` (a pick of one is made), `empty` (the empty row's words; absent, a value of one can't be emptied), `search` (its words before anything is typed), `onCreate` (handed what was typed, returns the value it makes, which you then pick or add), `typed` (what was typed on what opened it: on a computer, light its first match, so Enter picks it), `autoFocus`, `keyed` (opened by a key: on a computer, light the held row as it opens and let ↓ go on from it to the next), `fromHeld` (opened by a press, before a row is lit: ↓ and ↑ go on from the held row, to the next or the one before, nothing drawn lit until then), `form`, `computer` or `phone` (on a phone, draw no ✕, ✓ or Cancel of your own and hand every change as it is made), and for a relation `onSearch` (the editor filters or fetches: hand it every typed query and draw `items` as handed), `doing` (`searching` or `failed`; `searching` from the keystroke until the typed query answers, its `items` meanwhile the held records that match it alone), `onRetry`, `onMore`, `actions` (`ViewsPickerAction` rows after the rows) and `lead` (which held value leads, `onLead`, `label` and `makeLabel`); and, where your app adds options to a select's or multiselect's list, `onAdd` (draw an add row after the matches and call it with the typed text; handed instead of `onCreate`), `adding` (the text being added: draw its row as waiting, not pressable) and `addRefused` (your app's refusal, or the failure's words, to show where the add row was). A body that draws none of them offers no add. A status field's `steps`: its active steps by value, in order, so a held archived option is placed nowhere, as its cell places it.
|
|
43
46
|
- `ViewsPickerItem` — one row of a picker body, as data: its `value` and `label`, a status `slot` (draw your status badge) or a category `color` (draw your option chip), an `icon` (your glyph's name, as `AppIcon` draws it), a quieter `line`, the `group` it stands under, `disabled`, and for a relation's record a `badge` (a word telling kinds apart), a `glyph` (the record's own, unsized), an `avatarUrl` and its `kind`.
|
|
44
47
|
- `ViewsPickerAction` — a row of a picker body that does something rather than pick (create a record with what was typed): its `key`, `label`, an optional `icon`, and `onSelect`; picking it closes the editor, then runs it.
|
|
45
|
-
- `ViewsCalendarProps` — a calendar over ISO days (`YYYY-MM-DD`): its `value` and `onChange`, `min` and `max`, a `month` (`YYYY-MM`) controlled with `onMonthChange`, a `captionLayout` of `label` or `dropdown`, the `startMonth` and `endMonth` its pickers offer, and `locale`, the conventions' locale, in which it draws its month and weekday names and starts its week (an adapter may keep its calendar's own). Your date library stays your own.
|
|
48
|
+
- `ViewsCalendarProps` — a calendar over ISO days (`YYYY-MM-DD`): its `value` and `onChange`, `min` and `max`, a `month` (`YYYY-MM`) controlled with `onMonthChange`, a `captionLayout` of `label` or `dropdown`, the `startMonth` and `endMonth` its pickers offer, and `locale`, the conventions' locale, in which it draws its month and weekday names and starts its week (an adapter may keep its calendar's own); and `data-slot`, its public name where ViewKit names it (`vk-calendar`, the date editor's month under `panelControls`), to draw on its root. Your date library stays your own.
|
|
46
49
|
- `ViewsDateBodyProps` — a whole date body your app draws, its typed line, days, quick picks and time: its `label` (the field's name), `value` (on the conventions' calendar and clock, the zone the cell shows, and a date-only field's stored instant on the browser's calendar, as its cell shows it: a day `YYYY-MM-DD`, a day and time `YYYY-MM-DDTHH:MM`, or `null`), `onValueChange` (every change as it is made, a typed day once it reads as one, `null` for the empty pick; nothing is saved until the editor closes), `onDone` (the edit is finished: a pick that finishes it, as a day on a field with no time or the empty pick, or an Enter that keeps; after a plain Enter the editor closes as Enter, so a grid's next key lands the write first), `time`, `empty`, `picks` (`ViewsDatePick`s, in order: the provider's `datePicks`, then `none` where it may be emptied), `today` (`YYYY-MM-DD`, today in the conventions' zone), `typed` (what was typed on what opened it), `autoFocus` and `form` (`phone`: draw no ✕, ✓ or Cancel of your own, and hand every change as it is made). The editor around it keeps the draft, Tab, Escape, the save and the phone's ✕ and ✓.
|
|
47
50
|
- `ViewsDatePick` — a quick pick a date body offers: `today`, `tomorrow`, `next-monday` (the Monday after today, a week on when today is one), `in-a-week` (today + 7 on the conventions' calendar) or `none`, which empties the field.
|
|
48
51
|
- `ViewsDatePicks` — the provider's `datePicks`: the quick days the date editors offer, in order, any `ViewsDatePick` but `none`. The date editor hands exactly these to your `DateBody` and its own panel draws the same; absent, `today`, `tomorrow` and `next-monday`.
|
|
@@ -58,7 +61,7 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
58
61
|
- `ViewsSortBodyProps` — the sort editor's whole body your app draws: `label`, `options` (the fields it sorts by, each its `value`, `label` and `defaultDir`, and, as the grid's header marks its column, its field's `type`, its `part` and the header's `glyph`), `rules` (in order, the first sorting first), `setAside` (the set-aside sorts, `[]` when none), `max`, `form`, `addSort` (on a computer, Add sort at its foot), `onStepChange` (on a phone: a step of your body's own, its title and Back, `null` once back), `onRulesChange` (the whole rules and, when handed, the set-aside sorts kept; every change as it is made; a list that breaks the rules writes nothing), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw them, `actions` (the ✕, taking the rules back to what they were as it opened, and ✓). ViewKit keeps the check, the latest rules between renders, the close on the last rule and what ✕ takes back to.
|
|
59
62
|
- `ViewsQuickFiltersBodyProps` — the quick filters' whole body your app draws: `label`, `fields` (each its `key`, `label`, `searchPlaceholder`, its `options` as the quick filter field hands them (each value's mark is its option's), and `values` in the order to show them, each value its key, its words, its `count` where counts show and whether it is `held`; a held value no count lists is among them, drawn from the hold and worded by the config's `heldLabels` else its key; after the fields offered, each other field holding a value, its held values alone), `hold` (each held field once, its values), `several`, `showCounts`, `form`, `onHoldChange` (the whole hold, every change as it is made; one that holds a field twice, more than one value where `several` is false, or a value added on a field the strip doesn't offer writes nothing), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw it, `actions` (the ✕, closing it).
|
|
60
63
|
- `ViewsFilterBodyProps` — the filter editor's whole body your app draws: `label`, `fields` (the fields a rule may name, `ViewsFilterBodyField`s, each column the list can't filter among them in its place, greyed by its `disabled`), `filter` (the level it is open on, a `FilterGroup`: an advanced filter's group on a computer, the whole filter on a phone), `levels` (how deep its rules may stand, its own the first), `excludable` (whether it may be `not`), `relation` (where the level is a relation's where edited in place: its field key, words and quantifier, and `gone`, why in words, where the list no longer lists the relation: there a level that adds or changes a rule writes nothing), `form`, `onFilterChange` (the whole level and, at a relation, its quantifier; every change as it is made; a level that breaks the rules writes nothing; an empty one on a computer takes its advanced filter away), `ruleValue` (a rule's value in ViewKit's own body for its type, each change handed back as the rule), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw them, `actions` (the ✕, taking the filter back to what it was as it opened, and ✓). ViewKit keeps the check, the Or top's wrap, the pills' keys and what ✕ takes back to.
|
|
61
|
-
- `ViewsFilterBodyField` — a field a filter body's rule may name: `key`, `label`, `fieldKey`, `part`, `type` (its value type, which says its ways), `far` (a relation's fields one level in) and `disabled` (on a column the list can't filter, why in words: draw it greyed and never name it in a rule).
|
|
64
|
+
- `ViewsFilterBodyField` — a field a filter body's rule may name: `key`, `label`, `fieldKey`, `part`, `type` (its value type, which says its ways), `far` (a relation's fields one level in), `integer` (`true` on a number field that holds whole numbers only: its box takes whole numbers) and `disabled` (on a column the list can't filter, why in words: draw it greyed and never name it in a rule).
|
|
62
65
|
- `ViewsFieldsBodyProps` — the field list's whole body your app draws: `purpose` (`sort` or `filter`), `label`, `search` (its search's words), `fields` (each a `ViewsFieldsBodyField`), `own` (the field being changed; absent where a pick adds), `form`, `onPick` (the key picked, and a far field's key for a far field; a key not handed, or handed `disabled`, writes nothing) and `onDone` (what holds it closes, or on a phone the page turns back).
|
|
63
66
|
- `ViewsFieldsBodyField` — a field as the field list's body is handed it: `key`, `label`, `type` and `part` (its field's type and the part it reads, as the grid's header reads them), `glyph` (its column's glyph, drawn as the header draws it), `disabled` (why it can't be picked) and, for a filter's relation, `far` (its far fields, one level in).
|
|
64
67
|
- `ViewsFilterPartBodyProps` — a filter rule's way or value your app draws: `part` (`way` or `value`), `label`, `rule` (the rule as data), `field` (the field it names, a `ViewsFilterBodyField` with no `far`), `ways` (each its operator and its words), `own` (ViewKit's own value body; null at `way`), `form`, `onRuleChange` (the rule with its new way, written as ViewKit's own writes one, or its new value; another field or part, a way its field doesn't offer or a value its way can't hold writes nothing) and `onDone` (what holds it closes).
|
|
@@ -66,6 +69,7 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
66
69
|
- `ViewsViewsListBodyProps` — the views list's whole body your app draws: `label`, `views` (each a `ViewsViewsListItem`), `value` (the view in use), `form`, `onViewChange` (a view picked; written when it is one of `views`; it closes nothing), `onCreate` and `createLabel` where the axis grows (what holds it closes first), `onReorder` and `canDrag` where the axis reorders (one whole block, shared or the reader's own, each once; any other order writes nothing), `onDone` (what holds it closes), on a phone where the sheet's head doesn't draw it `actions` (the ✕, and Back while the body stands on a step), on a computer `onHold` (while true, a press outside and Escape close nothing: the body asks outside the list), on a phone `onStepChange` (the body stands on a step of its own: the sheet shows its title and Back), and, where the axis hands them, `verbs` (a view's whole menu's data, `ViewsViewVerbs`).
|
|
67
70
|
- `ViewsViewsListItem` — one view as the views list's body is handed it: `value`, `label`, `icon`, `count` (absent while counts are hidden), `private`, `menu` (the view's own verbs), and for a view's whole menu `layout`, `changed`, `favorite` and `readOnly` (nothing that changes it).
|
|
68
71
|
- `ViewsViewMenuProps` — one view's whole menu your app may draw (`ViewMenu`, optional; `CONTROLS.ViewMenu` is ViewKit's own), opened on a computer by a views row's pill and a folded view's `⋮` where the axis hands `verbs`: `open`, `onOpenChange`, `anchor` and `align`, as `Menu` is; `view` (whose menu it is; left out, New view's Modal stands in place of a menu, as the row's + opens it, and `onOpenChange(false)` is told once it has closed), `views` (every view of the axis, each a `ViewsViewsListItem`), `value` (the view in use), `verbs`, `onDone` (what holds it closes) and `onHold` (while true, a press outside and Escape close nothing: the menu asks outside what holds it).
|
|
72
|
+
- `ViewsPaneProps` — what your map's `Pane` is handed (VK-1026; `CONTROLS.Pane` is ViewKit's own Pane): `open`, `onOpenChange` (it closes from inside: Escape, its ✕), `container` (the list's box it stands in: positioned, holding the grid, never scrolling itself; null until it is on the page, when it draws nothing), `opener` (the part's button, ⋯ while folded: give it the focus back as it closes from inside), `label` (its name to a screen reader) and `children` (the panel). A toolbar with `customizeIn: "pane"` opens Customize in it on a computer, in the box handed as `paneBox`.
|
|
69
73
|
- `ViewsViewVerbs` — a view's verbs, handed on the axis where your app lets ViewKit draw a view's whole menu: `layouts`, `records` (the noun in the delete question's line), a board's `columns`, and `onChange`, which takes each `ViewsViewChange` and opens the right view itself (ViewKit moves none: `viewsAfter` does it); optionally `menu`, the view's menu as data, handed its default items and the view and returning the items drawn ([`/list`'s Menus as data](./list.md#menus-as-data)).
|
|
70
74
|
- `ViewsViewChange` — a change a view's menu makes: rename, create (with its layout, name, a board's columns and the view it was made from), duplicate, delete, restore (Undo: the view, its place, whether it was open), save, reset, edit, link, favorite, private.
|
|
71
75
|
- `ViewsViewLayout` — a layout a new view can take: `id`, `name`, `icon` (your `AppIcon`'s name), `line`, and `columns` where it asks which field makes its columns.
|
|
@@ -88,13 +92,15 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
88
92
|
- `ViewsCollapseProps` — a box that opens and closes its `children` with `open`, over `durationMs`, with a class and a `clipClassName` on the box that crops the content.
|
|
89
93
|
- `ViewsSheetProps` — a phone sheet, controlled by `open` and `onOpenChange`, with a `title`, a `label` (the title in words whenever the title is words: its accessible name, and the title of a head that takes only text), a `description`, a class, its `children`, and `snap` (`full`, `half`, `peek`, `auto`), a hint a sheet with no snap points ignores. With the provider's `sheetActions` at `head` it is handed `actions` to draw in its own head: the editor panel's ✕ and ✓ (and Back, on a body's step), a toolbar panel's ✕ alone, or the sort editor's ✕ (which takes its rules back) and ✓.
|
|
90
94
|
- `ViewsSheetActions` — the editor panel's ✕ and ✓, handed to a sheet that draws them in its head: `close`, which throws the edit away as a swipe does, and `done`, which closes it as done, absent where the body saves on its pick. A toolbar panel's sheet is handed `close` alone, which closes it; the sort editor's is handed both, its `close` taking the rules back to what they were as the sheet opened and its `done` keeping them. While an editor's body stands on a step of its own it carries `back` too, to draw in `close`'s place: Back, returning the body to where it was; `close` stays handed, for a head that draws no Back.
|
|
91
|
-
- `ViewsSheetAction` — one of them: its `label` (the accessible name) and `onPress`. The glyph is yours.
|
|
95
|
+
- `ViewsSheetAction` — one of them: its `label` (the accessible name) and `onPress`, and its `slot`, its public name on an editor panel's ✕, ✓ and Back (`vk-editor-close`, `vk-editor-save`, `vk-editor-back`), to draw on your button as its `data-slot`. The glyph is yours.
|
|
92
96
|
- `ViewsBodyStep` — `{ title, onBack }`: a step of an editor body's own on a phone (a list of countries, a label's list), which a `TextBody`, `NumberBody`, `PartsBody`, `ValuesBody` or `LinksBody`, or the sort's `SortBody` (Add sort's fields, a rule's direction), hands the sheet through its `onStepChange`. The sheet's head shows `title` in place of the field's name, and Back and the sheet's Escape call `onBack`; the body hands `null` once it is back. A `GroupBody` hands its level the same way to ViewKit's Customize, on a computer and a phone: Customize's head shows its title and Back calls `onBack` (Escape there still closes the panel).
|
|
93
97
|
- `ViewsSeveralValues` — `"first" | "fit"`, the provider's `severalValues`: how a cell of several values draws on one line. `fit` (the default) draws as many whole values as fit its width, then the count, following a column resize; `first` draws its first value and a count at any width, as on 0.5.0.
|
|
94
98
|
- `ViewsSelectionBarSettings` — the provider's `selectionBar`: `phoneQuery` (the media query under which the bar is the phone's pill; without it, wherever `desktopQuery` does not match), and `desktop` and `phone`, each a `ViewsBarPlacement`.
|
|
95
99
|
- `ViewsBarPlacement` — where the selection bar's fixed box sits on one form: `bottom` (a CSS length, default `calc(1rem + env(safe-area-inset-bottom))`), `zIndex` (default 50) and `className` (your own classes on the box).
|
|
96
100
|
- `ViewsSheetActionsPlace` — where the ✕ and ✓ stand on a phone, the provider's `sheetActions`: `bar` (the default, the panel's own bar, or a toolbar panel's own ✕, inside your sheet) or `head` (handed to your sheet as `actions`, and none drawn inside; a toolbar panel hands `close` alone, but the sort editor hands `close`, which takes its rules back, and `done`).
|
|
97
101
|
- `ViewsInputProps` — a single-line text box: every prop of an `<input>`, `ref` included, which your element must receive, and `chrome`, `bare` (the default: a grid cell, a panel that frames the box) or `field` (your field's frame).
|
|
102
|
+
- `ViewsSelectItem` — one row of a `Select`'s list: its `value`, `label`, an `icon`, a second `line`, the `group` it stands under, `disabled`, and `level`, the rows one level in under a row never picked itself (draw them in place, or flatten them with `flatSelectItems`).
|
|
103
|
+
- `ViewsSelectProps` — the components map's `Select`, which ViewKit's panels draw under `panelControls` for their boxes that pick (the sort's and the filter's, and New view's columns): its `items`, its `value` (one, several with `multiple`, or none) and `onValueChange`, a `placeholder`, `disabled`, `open` and `onOpenChange` (on a phone a panel holds it shut and turns its sheet to a step of its own on `onOpenChange(true)`: honour both when handed), `search` (the words of the search ViewKit's own shows over a long list), `size` (`sm` or `default`), a class, `aria-label`, and the part's `data-slot` and `data-key`, to draw on the box a person presses. Forward any other prop to your box.
|
|
98
104
|
- `ViewsAnchor` — where a floating part attaches: an element, a ref to one, a point `{ x, y }` (a context menu), or `null`.
|
|
99
105
|
- `ViewsSide` — the side a floating part opens on: `top`, `right`, `bottom` or `left`.
|
|
100
106
|
- `ViewsAlign` — how a floating part lines up along that side: `start`, `center` or `end`.
|
|
@@ -139,8 +145,9 @@ The pieces the rendering is built from, and your app's own pieces it cannot draw
|
|
|
139
145
|
- `ViewsToggleRowProps` — a boolean flipped in place: `icon`, `label`, `active`, `disabled` and the `disabledReason` your `Tooltip` shows, `onClick`, and `reset` (`{ onReset }`), the way back to the reader's default.
|
|
140
146
|
- `ViewsPanelSearchProps` — a panel's text box: `value`, `onChange`, `onClear`, `placeholder`, `autoFocus`, `onKeyDown`, `onFocus`, `inputRef`, `leading` (`null` drops the magnifier), `suffix` and `inputMode`.
|
|
141
147
|
- `ViewsPillProps` — one option of a row of pills: `active`, `variant` (`solid` or `plain`), `size` (`default` or `sm`), `leading` and `leadingSlot`, your own `activeClassName` and `hoverClassName`, `onClick`, `onContextMenu`, `onPointerDown`, `menuOpen` (it opens a menu) and `ref`.
|
|
142
|
-
- `ViewsToolbarButtonProps` — a toolbar's button: its `icon`, its `label` (its name, and the word a dress shows unless `word` says another, or `null` for none), a `count` in its corner that becomes a ✕ badge clearing what it counts when handed `onClear`, a `dot` drawn instead of a count, `open`, `changed`, `edge` (the row's outermost button), `disabled`, `size` (`md` or `sm`), `popup` (`menu` or `dialog`, with `aria-expanded` from `open`), `joined` (`start`, `middle` or `end`: one of buttons joined as one, its outer corners alone rounded, `data-joined`), `waits` (its words say what it waits for, in the placeholder's colour, `data-waits`), `onClick`, `onPointerDown` and `ref`; its own words (`children`) keep to one line, cut with "…" where a holder caps its width.
|
|
143
|
-
- `ViewsToolbarButtonPart` — which of the toolbar's
|
|
148
|
+
- `ViewsToolbarButtonProps` — a toolbar's button: its `icon`, its `label` (its name, and the word a dress shows unless `word` says another, or `null` for none), a `count` in its corner that becomes a ✕ badge clearing what it counts when handed `onClear`, a `dot` drawn instead of a count, `open`, `changed`, `edge` (the row's outermost button), `disabled`, `size` (`md` or `sm`), `popup` (`menu` or `dialog`, with `aria-expanded` from `open`), `joined` (`start`, `middle` or `end`: one of buttons joined as one, its outer corners alone rounded, `data-joined`), `waits` (its words say what it waits for, in the placeholder's colour, `data-waits`), `part` (which button it is, below), `className` (its toolbar place's class: put it on the button), `onClick`, `onPointerDown` and `ref`; its own words (`children`) keep to one line, cut with "…" where a holder caps its width.
|
|
149
|
+
- `ViewsToolbarButtonPart` — which of the toolbar's buttons a `ToolbarButton` stands for, handed as `part` by every button the toolbar draws: named after the `toolbarParts` place it stands in (`options`, `search`, `quick`, `new`, `sort`, `filter`, `filter-add`, `filters`, `advanced-filters`, `sort-pill`), a place's second kind of button by a name of its own (`sort-add`, Sort's +; `more-filters`, "+N filters"), ⋯ `more`, and the frame's parts (`ViewsFramePart`). Which place draws which is [`/list`'s Default keys](./list.md#default-keys). An atom that spreads its leftover props onto its element takes `part` out first.
|
|
150
|
+
- `ViewsFramePart` — the six a `ToolbarButton` is handed only where your own toolbar frame draws them: `views-chip`, `views-tab`, `views-more`, `views-add`, `clear` or `save`, with `current` (a view tab; `true`, the open one) and `onContextMenu` (a tab's verbs); draw each as its `data-slot` (`vk-views-chip`, `vk-views-tab`, `vk-views-more`, `vk-views-add`, `vk-toolbar-clear`, `vk-toolbar-save-button`). Dress by these, not by any `part`: `if (part && FRAME.has(part))`.
|
|
144
151
|
- `ViewsListProps` — the rows' container, the inset a run of rows sits in inside a panel or a command list's group: its `children` and a class.
|
|
145
152
|
- `ViewsRowContentProps` — a row's inside, all the row is inside a command list's item, which owns the element, the highlight and the keyboard.
|
|
146
153
|
- What it says: a `label` (text truncates to one line, any other node is laid out in a row so it centres; `wrap` lets a long label break), a `description` line under it, a `leading` glyph (with `leadingLane` to keep its width when there is none), `trailing` content after the label, and a `detail` at its right edge in the subtle colour, such as a setting's current choice.
|