viewkitjs 0.33.0 → 0.35.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 +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- 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/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- 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 +1 -1
- package/views/dist/controls/input/input.js +2 -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.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- 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/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- 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 +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -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 +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- 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 +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- 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.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
|
@@ -27,3 +27,5 @@ Its own machinery (`--links-room`, `--links-under`, the room a phone's full Shee
|
|
|
27
27
|
## Its parts
|
|
28
28
|
|
|
29
29
|
The Links editor names every part it draws with a public `data-slot`, the same in the grid, the field row and a phone's sheet, on the box a person sees: `vk-links`, `vk-links-search`, `vk-links-list`, `vk-links-head`, `vk-links-rows`, `vk-links-row`, `vk-links-name`, `vk-links-field`, `vk-links-value`, `vk-links-control`, `vk-links-pop`, `vk-links-lead`, `vk-links-remove`, `vk-links-config`, `vk-links-more`, `vk-links-step`, `vk-links-back`, `vk-links-unlink`, `vk-links-offers`, `vk-links-offer`, `vk-links-offer-action`, `vk-links-note`, `vk-links-retry`. A link says its record, and a field its id, by `data-key`. Its ✕, ✓ and a step's ‹ are `vk-editor-close`, `vk-editor-save` and `vk-editor-back`. Dress a part by its name, never by a class: [the field editors' parts](../contract.md#the-field-editors-parts-vk-989).
|
|
30
|
+
|
|
31
|
+
Under the provider's `panelControls` its buttons, ⋯ menu, popover, boxes that pick and one-line boxes are the app's own, handed each part's name (VK-1022). What stays ViewKit's: [reshaping](../reshaping.md).
|
|
@@ -12,4 +12,6 @@ Every name the Menu's stylesheet (`menu.css`) reads, each optional: the ready st
|
|
|
12
12
|
|
|
13
13
|
## Its name in a panel
|
|
14
14
|
|
|
15
|
-
A menu a
|
|
15
|
+
A menu a part names takes `data-slot` (VK-988: `vk-view-menu`; VK-1023: the bulk bar's `vk-bulk-menu`), drawn on its popup on a computer and on its sheet on a phone; its rows take theirs from each entry's `slot` (`PartSlot`). ViewKit's own map Menu (`ViewsMenuProps`) names a named menu's rows `<name>-row`, each by its item's `data-key`; a menu nobody names draws as before.
|
|
16
|
+
|
|
17
|
+
Name a menu under the panels' prefixes (`vk-view-menu`, `vk-bulk-menu`): any other `vk-` name would make its phone sheet a reset root, and ViewKit's reset would reach inside it (VK-1003).
|
|
@@ -53,3 +53,7 @@ Every name `modal.css` reads, each optional: the ready stylesheet declares it at
|
|
|
53
53
|
| `--vk-fg-subtlest` | colour | `text-subtlest` | `hsl(210 1% 53.5%)` · dark `hsl(210 3% 53%)` |
|
|
54
54
|
| `--vk-radius-full` | size | `radius-full` | `9999px` |
|
|
55
55
|
| `--vk-overlay-card` | colour | `surface-overlay-card` | `hsl(0 0% 94%)` · dark `hsl(225 7% 15%)` |
|
|
56
|
+
|
|
57
|
+
## Inside a panel
|
|
58
|
+
|
|
59
|
+
Inside a panel under the provider's `panelControls` (the view menu's Rename and New view, and its Delete on a phone) its buttons are the app's own Button, ViewKit's anywhere else (VK-1014). On a computer the view menu's Delete is asked through the `confirm` port: ViewKit's own (`PortsHost`) stays ViewKit's, so hand your own `confirm` to draw that question yourself.
|
|
@@ -14,3 +14,5 @@ Every name `number-editor.css` reads (beside the stylesheets of the controls it
|
|
|
14
14
|
## Its parts
|
|
15
15
|
|
|
16
16
|
The Number editor names every part it draws with a public `data-slot`, the same in the grid, the field row and a phone's sheet, on the box a person sees: `vk-number`, `vk-number-box`, `vk-number-currency`, `vk-number-unit`. Its ✕, ✓ and a step's ‹ are `vk-editor-close`, `vk-editor-save` and `vk-editor-back`. Dress a part by its name, never by a class: [the field editors' parts](../contract.md#the-field-editors-parts-vk-989).
|
|
17
|
+
|
|
18
|
+
Under the provider's `panelControls` its buttons and popover are the app's own, handed each part's name (VK-1021). What stays ViewKit's: [reshaping](../reshaping.md).
|
|
@@ -5,7 +5,7 @@ Every name `pane.css` reads, each optional: the ready stylesheet declares it at
|
|
|
5
5
|
| name | kind | the Outright token | default |
|
|
6
6
|
| ---- | ---- | ------------------ | ------- |
|
|
7
7
|
| `--vk-radius-xl` | size | `radius-xl` | `15px` |
|
|
8
|
-
| `--vk-shadow-menu` | shadow | `shadow-menu` | `0 6px 18px hsl(0 0% 0% / 0.06), 0 3px 9px hsl(0 0% 0% / 0.05), 0 1px 1px hsl(0 0% 0% / 0.04)` · dark `0 8px 24px hsl(0 0% 0% / 0.5)
|
|
8
|
+
| `--vk-shadow-menu` | shadow | `shadow-menu` | `0 6px 18px hsl(0 0% 0% / 0.06), 0 3px 9px hsl(0 0% 0% / 0.05), 0 1px 1px hsl(0 0% 0% / 0.04)` · dark `0 8px 24px hsl(0 0% 0% / 0.5)` |
|
|
9
9
|
| `--vk-border` | colour | `border` | `hsl(220 7% 90%)` · dark `hsl(225 7% 15%)` |
|
|
10
10
|
| `--vk-spacing` | size | `spacing` | `4px` |
|
|
11
11
|
| `--vk-layer-drawer` | size | `layer-drawer` | `40` |
|
|
@@ -48,3 +48,5 @@ An item that carries `slot` (`PartSlot`, VK-988) draws it on its row as `data-sl
|
|
|
48
48
|
## Its parts
|
|
49
49
|
|
|
50
50
|
The Picker names every part it draws with a public `data-slot`, in every field editor, a Select's list and a panel alike: `vk-picker`, `vk-picker-search`, `vk-picker-list`, `vk-picker-chips`, `vk-picker-chip`, `vk-picker-option`, `vk-picker-parent`, `vk-picker-empty`, `vk-picker-add`, `vk-picker-create`, `vk-picker-action`, `vk-picker-group`, `vk-picker-heading`, `vk-picker-card`, `vk-picker-selected`, `vk-picker-tick`, `vk-picker-row-more`, `vk-picker-more`, `vk-picker-back`, `vk-picker-count`, `vk-picker-clear`, `vk-picker-lead`, `vk-picker-lead-make`, `vk-picker-message`, `vk-picker-retry`, `vk-picker-loading`, `vk-picker-foot`. A row says which one it is by `data-key`, its item's value, and wears `vk-picker-option` unless its item hands a `slot` of its own (a panel's row: the views list's `vk-views-list-row`), which wins. + Add is `vk-picker-add` where the Picker adds through `onAdd`, Create `vk-picker-create`; each action is `vk-picker-action`, keyed by its `id`. Its Cancel and ✓ on a phone are `vk-editor-cancel` and `vk-editor-save`. Dress a part by its name, never by a class: [the field editors' parts](../contract.md#the-field-editors-parts-vk-989).
|
|
51
|
+
|
|
52
|
+
Under the provider's `panelControls`, wherever a ViewKit body holds it, its buttons and menus are the app's own, handed each part's name; its search box and its rows, a computer's actions, + Add and Create among them, stay ViewKit's (VK-1022). What else stays ViewKit's: [reshaping](../reshaping.md).
|
|
@@ -31,11 +31,13 @@ The Toggle group, the Input, the Avatar, the Status and the Scrollbar it draws w
|
|
|
31
31
|
| `--vk-overlay-pressed` | colour | `surface-overlay-pressed` | `hsl(0 0% 94%)` · dark `hsl(225 7% 15%)` |
|
|
32
32
|
| `--vk-radius-full` | size | `radius-full` | `9999px` |
|
|
33
33
|
| `--vk-radius-lg` | size | `radius-lg` | `10px` |
|
|
34
|
-
| `--vk-shadow-menu` | shadow | `shadow-menu` | `0 6px 18px hsl(0 0% 0% / 0.06), 0 3px 9px hsl(0 0% 0% / 0.05), 0 1px 1px hsl(0 0% 0% / 0.04)` · dark `0 8px 24px hsl(0 0% 0% / 0.5)
|
|
34
|
+
| `--vk-shadow-menu` | shadow | `shadow-menu` | `0 6px 18px hsl(0 0% 0% / 0.06), 0 3px 9px hsl(0 0% 0% / 0.05), 0 1px 1px hsl(0 0% 0% / 0.04)` · dark `0 8px 24px hsl(0 0% 0% / 0.5)` |
|
|
35
35
|
| `--vk-spacing` | size | `spacing` | `4px` |
|
|
36
36
|
|
|
37
37
|
## Its parts by name
|
|
38
38
|
|
|
39
39
|
Each part inside it carries a public `data-slot` (VK-988), so your stylesheet dresses one part apart from the rest; a part that repeats also says which one it is (`data-key`, and a rule its place, `data-index`). What each names, and its keys: [the panels' parts](../contract.md#the-atoms).
|
|
40
40
|
|
|
41
|
-
`vk-quick`, `vk-quick-field`, `vk-quick-search`, `vk-quick-value`, `vk-quick-count`, `vk-quick-clear`, `vk-quick-none`, `vk-quick-head`.
|
|
41
|
+
`vk-quick`, `vk-quick-field`, `vk-quick-search`, `vk-quick-value`, `vk-quick-count`, `vk-quick-clear`, `vk-quick-none`, `vk-quick-head`, `vk-quick-strip`, `vk-quick-values`.
|
|
42
|
+
|
|
43
|
+
Under the provider's `panelControls` its search is the app's own Input and its own phone head's ✕ (`vk-editor-close`) the app's Button (VK-1014); its strip of fields (ViewKit's Toggle) and its values stay ViewKit's.
|
|
@@ -42,4 +42,4 @@ Every name the bottom Sheet's stylesheet (`sheet.css`) reads, each optional: the
|
|
|
42
42
|
|
|
43
43
|
## Its buttons' names
|
|
44
44
|
|
|
45
|
-
`SheetButton` draws a handed `data-slot` on both its forms. `SheetHead` draws its `backSlot` on its ‹ (`data-slot`): a field editor's step hands `vk-editor-back`. ViewKit's own Sheet names the ✕, ✓ and ‹ it draws from its `actions` (`sheetActions: "head"`) `vk-editor-close`, `vk-editor-save` and `vk-editor-back`.
|
|
45
|
+
`Sheet` draws a handed `data-slot` on the sheet itself (VK-1023: the bulk bar's field sheet, `vk-bulk-field-sheet`, and a named Menu's sheet on a phone). `SheetButton` draws a handed `data-slot` on both its forms. `SheetHead` draws its `backSlot` on its ‹ (`data-slot`): a field editor's step hands `vk-editor-back`. ViewKit's own Sheet names the ✕, ✓ and ‹ it draws from its `actions` (`sheetActions: "head"`) `vk-editor-close`, `vk-editor-save` and `vk-editor-back`.
|
|
@@ -19,9 +19,11 @@ It also reads the inline input's own `--inline-input-ring` and `--inline-input-c
|
|
|
19
19
|
| `--vk-overlay` | colour | `surface-overlay` | `hsl(0 0% 100%)` · dark `hsl(226 10% 10%)` |
|
|
20
20
|
| `--vk-radius-md` | size | `radius-md` | `7.5px` |
|
|
21
21
|
| `--vk-shadow-lg` | shadow | `shadow-lg` | `0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)` |
|
|
22
|
-
| `--vk-shadow-menu` | shadow | `shadow-menu` | `0 6px 18px hsl(0 0% 0% / 0.06), 0 3px 9px hsl(0 0% 0% / 0.05), 0 1px 1px hsl(0 0% 0% / 0.04)` · dark `0 8px 24px hsl(0 0% 0% / 0.5)
|
|
22
|
+
| `--vk-shadow-menu` | shadow | `shadow-menu` | `0 6px 18px hsl(0 0% 0% / 0.06), 0 3px 9px hsl(0 0% 0% / 0.05), 0 1px 1px hsl(0 0% 0% / 0.04)` · dark `0 8px 24px hsl(0 0% 0% / 0.5)` |
|
|
23
23
|
| `--vk-spacing` | size | `spacing` | `4px` |
|
|
24
24
|
|
|
25
25
|
## Its parts
|
|
26
26
|
|
|
27
27
|
The Text editor names every part it draws with a public `data-slot`, the same in the grid, the field row and a phone's sheet, on the box a person sees: `vk-text`, `vk-text-box`, `vk-text-country`, `vk-text-dial`, `vk-text-note`. Its ✕, ✓ and a step's ‹ are `vk-editor-close`, `vk-editor-save` and `vk-editor-back`. Dress a part by its name, never by a class: [the field editors' parts](../contract.md#the-field-editors-parts-vk-989).
|
|
28
|
+
|
|
29
|
+
Under the provider's `panelControls` its buttons, popover and one-line boxes are the app's own, handed each part's name (VK-1021). What stays ViewKit's: [reshaping](../reshaping.md).
|
|
@@ -12,3 +12,7 @@ The Toolbar draws nothing of its own but its lines, the room between what each h
|
|
|
12
12
|
| `--vk-duration-base` | motion | `duration-base` | `200ms` |
|
|
13
13
|
| `--vk-ease-out` | motion | `ease-out` | `cubic-bezier(0, 0, 0.2, 1)` |
|
|
14
14
|
| `--vk-spacing` | size | `spacing` | `4px` |
|
|
15
|
+
|
|
16
|
+
## A separator's name
|
|
17
|
+
|
|
18
|
+
`ToolbarSeparatorControl` draws a handed `data-slot` on its line, in a toolbar and outside one (VK-1023: the bulk bar's `vk-bulk-separator`).
|
|
@@ -42,3 +42,5 @@ It also reads the Popover's corners (`--popover-corners`), the popup line's reac
|
|
|
42
42
|
## Its parts
|
|
43
43
|
|
|
44
44
|
The Values editor names every part it draws with a public `data-slot`, the same in the grid, the field row and a phone's sheet, on the box a person sees: `vk-values`, `vk-values-rows`, `vk-values-row`, `vk-values-value`, `vk-values-edit`, `vk-values-label`, `vk-values-main`, `vk-values-pill`, `vk-values-acts`, `vk-values-grip`, `vk-values-copy`, `vk-values-open`, `vk-values-remove`, `vk-values-line`, `vk-values-code`, `vk-values-prefix`, `vk-values-add`, `vk-values-back`, `vk-values-error`. Each row says its place by `data-index`, from 0. Its ✕, ✓ and a step's ‹ are `vk-editor-close`, `vk-editor-save` and `vk-editor-back`. Dress a part by its name, never by a class: [the field editors' parts](../contract.md#the-field-editors-parts-vk-989).
|
|
45
|
+
|
|
46
|
+
Under the provider's `panelControls` its buttons, popover and one-line boxes are the app's own, handed each part's name (VK-1022). What stays ViewKit's: [reshaping](../reshaping.md).
|
|
@@ -12,3 +12,5 @@ Every name `views-list.css` reads (beside the stylesheets of the controls it dra
|
|
|
12
12
|
Each part inside it carries a public `data-slot` (VK-988), so your stylesheet dresses one part apart from the rest; a part that repeats also says which one it is (`data-key`, and a rule its place, `data-index`). What each names, and its keys: [the panels' parts](../contract.md#the-atoms).
|
|
13
13
|
|
|
14
14
|
`vk-views-list`, `vk-views-list-row`, `vk-views-list-head`, `vk-view-menu`, `vk-view-menu-row`, `vk-view-menu-name`, `vk-view-menu-layout`, `vk-view-menu-columns`, `vk-view-menu-act`.
|
|
15
|
+
|
|
16
|
+
Under the provider's `panelControls` its buttons, boxes that pick and text boxes are the app's own, each handed its part's name (VK-1014). A phone step's own head names its ‹ `vk-editor-back`. The views list's rows, and their ⋯, are the Picker's.
|
|
@@ -16,16 +16,17 @@ The components map hands the package your primitives: a button, a popover, a men
|
|
|
16
16
|
- `CommandMenu`: a `command` cell's verbs.
|
|
17
17
|
- `RelationLink`: where a relation chip goes.
|
|
18
18
|
- `RelationRoles`: a link's roles, inside its chip after the record's name.
|
|
19
|
+
- `RelationChip`: a mentioned record, every relation ViewKit draws, where the provider's `panelControls` names `RelationChip`. The default draws ViewKit's own chip.
|
|
19
20
|
- `CellMore`: the "+N" after a cell's shown values, inside `data-slot="vk-cell-more"`. ViewKit's own keeps its frame; yours draws inside a bare button, so your count tag stands there alone.
|
|
20
21
|
- `Loading`: a wait, the whole list reloading or more rows arriving.
|
|
21
22
|
- `LoadMore`: how a list asks for its next page.
|
|
22
23
|
- `PlatformMark`: a link's platform mark, drawn before the link.
|
|
23
24
|
- `RowMenu`: the row's right-click menu.
|
|
24
|
-
- `Avatar`: a person's or a record's picture, in a user's, a relation's and an actor's chip, and before the name when the list hands a row's picture
|
|
25
|
+
- `Avatar`: a person's or a record's picture, in a user's, a relation's and an actor's chip, and before the name when the list hands a row's picture; and every record's mark ViewKit's panels draw, where the provider's `panelControls` names `Avatar`. The default draws the picture, else the glyph the chip would draw.
|
|
25
26
|
- `ChoiceRow`, `CheckRow`, `RadioRow`, `DirectionButton`, `MenuRow`, `ToggleRow` and `PanelSearch`: the rows the panels (`/panels`) draw with, a value row, a tick row, a one-of-a-set row, a sort's direction arrow, a drill-in row, a switch row and a panel's text box.
|
|
26
27
|
- `Pill`: one option of a row of pills, the views row's (`/panels/react`) and any tab row's.
|
|
27
28
|
- `RangeCalendar`: the filter panel's month, a day or a range in ISO days. The default is your components map's one-day `Calendar` on the end being picked, and paints no range; hand your own to paint one.
|
|
28
|
-
- `ToolbarButton`: the toolbar's button (`/panels/react`), a glyph in a circle with its word for a dress that shows words, a count that becomes a ✕ badge when it can clear what it counts, and a dot. Hand your own to give the toolbar your buttons' look.
|
|
29
|
+
- `ToolbarButton`: the toolbar's button (`/panels/react`), a glyph in a circle with its word for a dress that shows words, a count that becomes a ✕ badge when it can clear what it counts, and a dot. Hand your own to give the toolbar your buttons' look. `CONTROL_ATOMS.ToolbarButton`, the kit's, draws the count as a count, never that ✕: under it, a part's filters clear from their own panel.
|
|
29
30
|
|
|
30
31
|
The names are `ATOM_NAMES` from `viewkitjs/views`, and the defaults hold exactly those.
|
|
31
32
|
|
|
@@ -146,6 +147,42 @@ const roleTags = renderToStaticMarkup(
|
|
|
146
147
|
assert.ok(roleTags.includes("<em>Champion</em>"));
|
|
147
148
|
```
|
|
148
149
|
|
|
150
|
+
## A mentioned record
|
|
151
|
+
|
|
152
|
+
The rule: ViewKit places a mentioned record and hands its data; your app draws it (VK-1053). Every relation ViewKit draws is one: a table's cell (one and many, and the +N list), a field row's value (Record details), `renderFieldValue` (a highlight) and a user field's chip. Name `RelationChip` in the provider's `panelControls`, beside your own `RelationChip` atom, and each is yours, handed `ViewsRelationChipProps`:
|
|
153
|
+
|
|
154
|
+
- `relation`: the record, its `id`, `label`, `entity` (its kind as your app names it, `user` for a member) and `avatarUrl`.
|
|
155
|
+
- `roles`: a link's roles in order, each its `value` and `label`, on a `many` relation that declares `links`; else none.
|
|
156
|
+
- `size`: `chip` in a table's cell or a highlight, `row` in a field row.
|
|
157
|
+
- `render`: the host's link, where it has one. Draw your chip through it, handing it your element's props, and it draws the host's element with them: a cell whose host opens its relations a bare `<button data-slot="vk-relation-link" data-no-nav>` whose press opens the record, your `RelationLink` or a host's `relationWrap` around a `<span>` holding them. Absent for an inert fact, and where the host's own element owns the click. ViewKit never makes one up.
|
|
158
|
+
- `fallback`: ViewKit's own chip as it would draw it there, link included, for a kind yours doesn't dress.
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import type { ViewsRelationChipProps } from "viewkitjs/views/react";
|
|
162
|
+
|
|
163
|
+
function AppRelationChip({ relation, roles, size, render, fallback }: ViewsRelationChipProps) {
|
|
164
|
+
// A kind with no chip of yours: ViewKit's own, as it would have drawn it.
|
|
165
|
+
if (relation.entity === "automation") return <>{fallback}</>;
|
|
166
|
+
const props = {
|
|
167
|
+
className: size === "row" ? "record-chip record-chip-lg" : "record-chip",
|
|
168
|
+
children: (
|
|
169
|
+
<>
|
|
170
|
+
{relation.label}
|
|
171
|
+
{roles.length > 0 ? <em> · {roles.map((role) => role.label).join(", ")}</em> : null}
|
|
172
|
+
</>
|
|
173
|
+
),
|
|
174
|
+
};
|
|
175
|
+
return render ? render(props) : <span {...props} />;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const acmeMention = renderToStaticMarkup(
|
|
179
|
+
<AppRelationChip relation={{ id: "c1", label: "Acme", entity: "company" }} roles={[]} size="chip" fallback={null} />
|
|
180
|
+
);
|
|
181
|
+
assert.ok(acmeMention.includes('class="record-chip"'));
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Hand it with `atoms={{ RelationChip: AppRelationChip }}` and `panelControls={["RelationChip"]}`. Handed without that name, it draws nowhere, so an app that hands its atoms and names nothing sees no change; without it, or with ViewKit's own atom (which draws its `fallback`), every place draws ViewKit's chip exactly as before. A typed Select's chip is not one of them: a control stands without the provider, and your own Select draws your own mark ([A person's or a record's picture](#a-persons-or-a-records-picture)).
|
|
185
|
+
|
|
149
186
|
## A link's platform mark
|
|
150
187
|
|
|
151
188
|
A `url` value is drawn as a link, its scheme left off the label. When the link's address names a platform (LinkedIn, GitHub and the rest fields knows, plus any your conventions add with `defineConventions({ platforms })`), the display draws `PlatformMark` before it with that `LinkPlatform`: its `key` says which, its `name` what to call it. A link no platform claims is a website (`key: "website"`). The default draws nothing, so a link looks plain, and the package ships no brand art: a mark is yours to draw.
|
|
@@ -196,6 +233,20 @@ function AppAvatar({ label, avatarUrl, kind, size, fallback }: ViewsAvatarProps)
|
|
|
196
233
|
|
|
197
234
|
In your app it is your own Avatar component, its tone read from the label. What wraps the chip still owns its click (`RelationLink`), so an avatar only paints. A picture that fails to load is yours to catch: the default falls back to the glyph.
|
|
198
235
|
|
|
236
|
+
### Inside ViewKit's panels
|
|
237
|
+
|
|
238
|
+
The rule: anything ViewKit draws on screen by itself takes your own where you hand it, and ViewKit hands it data only (VK-1044). The panels draw a record's mark too: the Picker's rows, the links editor's, the bulk bar's choices, the quick filters' values and their reminder's. Name `Avatar` in the provider's `panelControls` and each is your `Avatar`, handed the record's `label`, its `avatarUrl`, its `kind` as your app names it (a deal stays a deal, not a person) and the panel's size in pixels: 20 on a computer's rows, 24 on a phone's, 40 in a phone's Picker. Its `fallback` is ViewKit's own Avatar, which a kind your atom doesn't dress can hand back.
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
declare const CONTROLS_MAP: ViewsComponents; // CONTROLS, from viewkitjs/views/controls
|
|
242
|
+
|
|
243
|
+
export function ViewsWithYourAvatar({ children }: { children: ReactNode }) {
|
|
244
|
+
return <ViewsProvider components={CONTROLS_MAP} atoms={{ Avatar: AppAvatar }} panelControls={["Avatar"]}>{children}</ViewsProvider>;
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
An `Avatar` handed without that name keeps to the chips and names above, so an atom built for `chip` and `glyph` alone never meets a number. Without it, or with ViewKit's own atom, the panels draw ViewKit's designed Avatar exactly as before. A typed Select's chip draws a mark again at its own size: ViewKit's Avatar at 16 by itself, yours at `chip` where its item says `avatar: true`.
|
|
249
|
+
|
|
199
250
|
## A command cell's verbs
|
|
200
251
|
|
|
201
252
|
A `command` field offers verbs instead of an editor: moving a deal to Lost asks for a reason, so the cell opens your verbs rather than a picker. The cell draws the trigger (the value with a chevron, a chevron alone where the value is empty, or a chevron beside a value that is already a control, such as a record's chip or a link; a member's chip is drawn inside the trigger) and hands it to `CommandMenu` with `trigger`, `items`, `align` and `label`, the field's name. Each item has a `label`, an optional `icon`, its `onClick`, `destructive` and `disabled` flags, and a `disabledReason` for a disabled one; while the record loads, every verb arrives disabled, with your reason or else "Wait for current data before editing" (`views.menus.loading`). The default names your components map's `Menu` after the field ("Actions for Stage"), anchors it on the trigger and keeps the click off the row, so opening the verbs neither selects the cell nor opens the row. Swap it when your app has its own action menu, or a sheet on a phone. [The contract](../contract.md#a-command-field) says how a command field is declared.
|
|
@@ -206,7 +257,7 @@ A `command` field offers verbs instead of an editor: moving a deal to Lost asks
|
|
|
206
257
|
|
|
207
258
|
The default opens your `Menu` at the pointer on a right-click, or from the row's ⋯ (`data-slot="vk-grid-row-more"`). On a touch screen a long-press opens nothing: the ⋯ is the way in there. Its Delete asks first, through the `confirm` port, with the message `views.menus.row-delete-confirm` and the row's `deleteLabel` as the `subject`; an app that hands no `confirm` gets the browser's own where your components map holds no `PortsHost`, ViewKit's alert dialog where it does (`CONTROLS`), and a confirm that rejects or throws counts as no. A delete that then rejects leaves the row where it was and says so through the toast port's `error`, with `views.menus.row-delete-failed`. [Ports](ports.md) covers `confirm` and the toast.
|
|
208
259
|
|
|
209
|
-
Swap it for a menu of your own, or for a long-press that selects: `onToggleSelect`, there from the first render wherever rows can be selected, flips the selection of the row last pressed. With `GridTable`'s `phonePicking` on, a call that answers a long press still held ticks the pressed row once with the grid's own, never flipping it back; with no press held it flips the row last pressed, as without the option. The default doesn't use it. The default opens your `Menu` at the pointer, so make your `Menu` a popover: one drawn in the page flow would draw after the section's rows.
|
|
260
|
+
Swap it for a menu of your own, or for a long-press that selects: `onToggleSelect`, there from the first render wherever rows can be selected, flips the selection of the row last pressed. With `GridTable`'s `phonePicking` on, a call that answers a long press still held ticks the pressed row once with the grid's own, never flipping it back; with no press held it flips the row last pressed, as without the option. The default doesn't use it. Call `onOpenChange(true)` as your menu opens and `onOpenChange(false)` as it closes, as the default does, and the grid keeps the row it opened on lit meanwhile, its tint and its ⋯ shown though the pointer has moved onto the menu. The default opens your `Menu` at the pointer, so make your `Menu` a popover: one drawn in the page flow would draw after the section's rows.
|
|
210
261
|
|
|
211
262
|
## Waits
|
|
212
263
|
|
|
@@ -76,7 +76,7 @@ assert.equal(DISPLAY_CORES.date, DISPLAY_CORES.datetime);
|
|
|
76
76
|
- **date** and **datetime**: in the reader's `dateStyle`, else the field's, else `short`; an instant shows its time unless `withTime` says `false`, the options' answer winning over the field's (`timeShown`), and only an instant has a time. Hovering for a second shows the full date (and time, for an instant) through your components map's `Tooltip`, so a relative "3d ago" can be pinned to a moment. A value that doesn't parse draws as its own text.
|
|
77
77
|
- **boolean**: four looks, the field's `format.style`. `checkbox` (the default) draws the `TickBox` atom, and `icon` your `booleanIcon(on)`; either becomes a real switch only when you hand `onToggle`, and is a plain glyph otherwise. `text` draws the option's label for the value, or the package's words. `marker` draws only when true, as the `StatusMarker` atom with your `marker` words, `markerReason` and `onResolve`.
|
|
78
78
|
- **select**, **status** and **multiselect**: a select is a category and draws the `Tag` atom in its colour (a reader's `optionColors` first, then the option's declared colour, then one derived from the value). A status is a state and draws the `StatusBadge` atom in its option's slot. A multiselect draws a tag per value, through the several-values layout. A value no option names draws as the raw value, muted, with a hover saying it is not an option, unless you hand a `labelFallback`; an open (`custom-values`) vocabulary's values are their own labels. An option's `icon` is drawn through your `AppIcon`.
|
|
79
|
-
- **relation** and **user**: a chip, the record's avatar when it has one, else your `entityIcon(kind)`, else the relation glyph, then its label, then, on a `many` relation that declares `links`, the link's roles, drawn by the `RelationRoles` atom ([atoms](atoms.md)). Where it goes is yours (`relationWrap`); without one the chip is inert. Several draw through the several-values layout, the lead link first. A user is drawn as a relation to a member, so the two never differ.
|
|
79
|
+
- **relation** and **user**: a chip, the record's avatar when it has one, else your `entityIcon(kind)`, else the relation glyph, then its label, then, on a `many` relation that declares `links`, the link's roles, drawn by the `RelationRoles` atom ([atoms](atoms.md)). Where it goes is yours (`relationWrap`); without one the chip is inert. Several draw through the several-values layout, the lead link first. A user is drawn as a relation to a member, so the two never differ. Where the provider's `panelControls` names `RelationChip`, your own atom draws the chip, handed its data, its size and the host's link ([atoms](atoms.md), A mentioned record).
|
|
80
80
|
- **url**, **domain**, **email** and **phone**: a url is a link with its scheme off the label, its platform's mark before it (the [`PlatformMark` atom](atoms.md)); a value that is no safe web address draws as text. A domain links to its site and reads no platform from it. An email is a `mailto:` link to the address alone: text stored after it (`?cc=…`, a second address) is never part of the link, and a value that holds no address draws as text. A phone is written in its international form, as its country writes it for a viewer in that country (the conventions' `region`) and internationally for anyone else, its extension after it, and dialled through a `tel:` link; a phone stored as typed draws as its text and is marked `data-as-typed`, still a link to its digits, and as text alone when it holds no digit to dial. Every phone's value is the part `data-slot="vk-phone"`, its link or its text. Several values of one of these draw the main one first, as many as fit, then a count.
|
|
81
81
|
- **location**: in a cell, its city and its country; with `wrap: "full"`, the whole place. The country is named in the viewer's language.
|
|
82
82
|
- **name**: the full name as written, else the given and family names, else `nameFallback`, else nothing.
|
|
@@ -22,7 +22,7 @@ console.log(frame["data-grid-columns"], props.verticalBorders, props.fillWidth);
|
|
|
22
22
|
|
|
23
23
|
A pick its option doesn't have (one saved by an older version, say) wears the option's default, so saved picks never break a grid. Where the picks live on the page rather than in your state, `gridLookWornOf(element)` reads them back from the closest frame.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Fifteen of the grid's options are read by its code. Twelve become its props through `gridLookProps`; three you wire yourself, as the Showcase does: `more` (`"pages"`: hand `GridTable` its `pages`), `figures` (`"value"`: the footer's figure words through your provider's messages) and `wait` (`"kept"`: hand the components map a `RowsWait`). The other twelve (the header's words, the rows' lines, the pinned edge, picked rows and cells, the cells' frames, names and phones, and `offer`, the footer's "+ Add calculation" under the pointer or at rest) are its look stylesheet's alone: `viewkitjs/views/grid.css`, already inside the ready stylesheet (`viewkitjs/views/styles.css`). An app that imports ViewKit's stylesheets one by one adds it after ViewKit's own classes:
|
|
26
26
|
|
|
27
27
|
```css
|
|
28
28
|
@import "viewkitjs/views/grid.css";
|
|
@@ -398,13 +398,15 @@ The columns' widths, order and visibility travel as `columnState`, a `ListColumn
|
|
|
398
398
|
|
|
399
399
|
With `parts`, a name, a place or a range offers a column per part beside its whole column: a place's country, region, city and postal code, a name's given and family names, a range's low and high ends. Each starts hidden; "+ Add column" lists a field with parts as one group beside your `Menu`, holding the field (when hidden) and its hidden parts, its count as `detail`, as Attio's does, on a phone too. A part column's id is `partKey(columnId, part)`, the key its Filter row has when your panels pass `parts: true`, so that row filters what the column shows; its sort value is `partKey(fieldKey, part)`, which `parsePartKey` turns into a sort's `fieldKey` and `by`. It reads and copies its part, and it edits and pastes as its part, in a box of its own: text for a name's part and a place's region, city and postal code, a number for a range's end, and the select over every country by name, searchable, for a place's country. A paste or a fill into a country cell takes a country's name, in the app's names language (the conventions' `language`), its locale or English, or its code. A part is locked, refused and read-only as its whole is, and it may be emptied unless its whole declares `clearable: false`; emptying the last part is judged by the field. A box refuses a value the whole field would refuse, such as a range's low end above its high end, and stays open with the field's reason. Your `onCellCommit` and `onCellsCommit` receive the whole column's id and the whole value with that part replaced, so a place keeps its other parts, a range its other end and a name its other part. A name's full name follows its given or family name only when it was empty or exactly the two joined by a space; "Nagy Imre" is kept. A place's other country clears its region and its code, and another region clears its code. A paste over two parts of one field in one row lands as one edit of the whole, and a part edit made while the field's earlier ones are still in flight builds on them. Like every composite value's, the commit goes without a pending overlay; the refetch repaints. Escape in a part's box follows the box's own type, text or number, not the field's, so `escape={{ name: "keep" }}` on the provider does not reach a given name's box. A place field limited to some `parts` offers part columns only for those. Its menu offers no Group row. Keep part columns out of your panels: they belong to the grid, and your panels take the columns you declare.
|
|
400
400
|
|
|
401
|
-
`gridProps` also carries the per-person switches: `verticalBorders
|
|
401
|
+
`gridProps` also carries the per-person switches: `verticalBorders` (the lines between the columns: the last column's closes the table, the footer draws them too and a line under itself, and the header draws them where you hand `headerVerticalBorders`), `showRowIcon` (the `rowIcon` you declare, in the title cell), `freezeIdentity` (every column through the title pinned at the left edge; on by default, on the bare grid and in `LIST_VIEW_PREF_DEFAULTS` alike, so start your prefs with `gridFreezeIdentity: false` to open it unpinned), `alwaysCheckboxes` and `scale`, the density. Every row is one height, and a cell's text stays on one line.
|
|
402
|
+
|
|
403
|
+
A row tints under the pointer. `rowHighlight="active"` tints the active row instead, alone: the row a person last pressed, or the picked cell's row, so the keyboard moves it too. It carries `data-active`, keeps its tint through a press outside the grid, and no row tints under the pointer; the row's box, ⋯ and the name's actions still show there. The grid's look picks it as Row highlight (`highlight`).
|
|
402
404
|
|
|
403
405
|
`fillWidth` is your app's choice, not a preference `gridProps` carries. On, the columns share the grid's whole width: each grows in proportion to its own width and never gets narrower than it, the header, the rows, the footer and a group's head alike, and while any column grows "+ Add column" stands right after the last one. A table already wider than the grid draws and scrolls sideways as it does without it. A column with a width set, by the person's resize or by the view, keeps it while the others take the rest, and a double-click on its edge clears a width the person set, giving it back its share; a column that declares `grid.maxWidth` keeps its own width. When no column can grow, the space after the last one stays empty, as without the option.
|
|
404
406
|
|
|
405
407
|
## Figures
|
|
406
408
|
|
|
407
|
-
Each column's footer shows one figure: the person's pick from what the column offers (sum, average, min, max and count for a number, count, filled and unique for the rest), else the column's `defaultAggregate`. Pass `aggregates`, the picks by column id, and `onAggregateChange`, which makes each footer cell a picker. On a `viewBacked` list only a column with a field can change its pick. With neither `onAggregateChange` nor a `renderAggregate` of your own, the grid draws no footer. `renderAggregate(columnId, group)` draws a footer cell yourself, with no label.
|
|
409
|
+
Each column's footer shows one figure: the person's pick from what the column offers (sum, average, min, max and count for a number, count, filled and unique for the rest), else the column's `defaultAggregate`. Pass `aggregates`, the picks by column id, and `onAggregateChange`, which makes each footer cell a picker. On a `viewBacked` list only a column with a field can change its pick. With neither `onAggregateChange` nor a `renderAggregate` of your own, the grid draws no footer. An empty cell that can pick a figure offers one ("Calculate", `views.grid.figure-pick`) under the pointer; the grid's look shows it in every empty cell at rest under Add calculation (`offer`), or wear `data-grid-offer="always"` on a frame round the grid. `renderAggregate(columnId, group)` draws a footer cell yourself, with no label.
|
|
408
410
|
|
|
409
411
|
The footer stands after the last row and scrolls with the rows. `pinFooter` pins it at the foot of the grid's scroll area instead, as a phone's table keeps its count in sight: the rows pass under it, it paints `--vk-ground` while they do (and carries `data-stuck` then; at rest it shows what the grid stands on), it stands `--vk-scroll-inset-bottom` above the edge (so what your app floats there doesn't cover it) and, while rows are selected, a step above the bar your `renderBar` draws, measured where it stands (on a phone the rows then end at the footer's bottom, so nothing of them shows in that step or round the bar): on the foot when it draws none, and the last row clears the bar the same way, pinned footer or not. The grid finds the bar in its frame, where it places what `renderBar` returns, or ViewKit's own `SelectionBar` wherever it is portalled; a bar of yours portalled out of the frame isn't seen. An ungrouped grid's footer stands at the foot even when its rows don't fill the area, and in pages it stands just above the pager. A grouped grid's footers each pin while their group's rows run past the foot, and close their group otherwise. Arrowing to a row never leaves it under the footer.
|
|
410
412
|
|
|
@@ -4,7 +4,7 @@ Every view reads what it takes from its app, other than its own props, from one
|
|
|
4
4
|
|
|
5
5
|
## Mount it once
|
|
6
6
|
|
|
7
|
-
`ViewsProvider` sits once at your app's client root, above every view. It needs one thing and the children: `components` (your primitives; `components={CONTROLS}` is ViewKit's own, every slot filled). Three more have defaults, so you hand them only to draw your own: `icons` (your glyphs by meaning; absent, each drawn through your `AppIcon` by its name, which `CONTROLS.AppIcon` draws with ViewKit's own glyphs), `ports` (your haptics, clipboard, per-device store, toast and confirm dialog, each optional; [ports](ports.md)) and `conventions` (absent, `en-US` in `UTC`). Eleven more are optional: `atoms`, `messages`, `presentation`, `desktopQuery`, `sheetActions`, `escape`, `oneValue`, `severalValues`, `selectionBar`, `datePicks` and `panelControls` (your own controls inside ViewKit's panels, below).
|
|
7
|
+
`ViewsProvider` sits once at your app's client root, above every view. It needs one thing and the children: `components` (your primitives; `components={CONTROLS}` is ViewKit's own, every slot filled). Three more have defaults, so you hand them only to draw your own: `icons` (your glyphs by meaning; absent, each drawn through your `AppIcon` by its name, which `CONTROLS.AppIcon` draws with ViewKit's own glyphs), `ports` (your haptics, clipboard, per-device store, toast and confirm dialog, each optional; [ports](ports.md)) and `conventions` (absent, `en-US` in `UTC`). Eleven more are optional: `atoms`, `messages`, `presentation`, `desktopQuery`, `sheetActions`, `escape`, `oneValue`, `severalValues`, `selectionBar`, `datePicks` and `panelControls` (your own controls inside ViewKit's panels and field editors, below).
|
|
8
8
|
|
|
9
9
|
`desktopQuery` says which screens are desktops: there an editor opens as a popover, and elsewhere as a sheet; so do the toolbar's panels and the views picker outside a `Toolbar` (inside one, the toolbar's phone form decides), and the grid's own chrome: a row's and a group's ⋯ and the row actions show on hover on a desktop, and a row's and a group's ⋯ always elsewhere, where the row actions don't show. It defaults to `DEFAULT_DESKTOP_QUERY`, `(min-width: 1024px)`; hand in the query your own shell switches on, so the editors and your layout change at the same width. A server render counts as a desktop.
|
|
10
10
|
|
|
@@ -73,7 +73,7 @@ assert.equal(conventions.locale, "en-GB"); // the app's own, untouched
|
|
|
73
73
|
|
|
74
74
|
## The components map
|
|
75
75
|
|
|
76
|
-
The package draws nothing with a UI library of its own. `ViewsComponents`, from `viewkitjs/views/react`, is the map you hand it: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon`, `Markdown`, `TextBody` (a whole body for a text typed as one string), `NumberBody` (a whole body for a number, money or a percent), `Picker` (a whole pick list), `LinksBody` (a whole links body: each link's roles and its lead), `DateBody` (a whole date body), `PartsBody` (a whole body for a name, a place or a range) and `ValuesBody` (a whole body for several emails, phones, links or domains), `SortBody` (the sort editor's whole body), `FilterBody` (the filter editor's whole body), `FilterPartBody` (a filter rule's way and value), `FieldsBody` (the field list's whole body), `QuickFiltersBody` (the quick filters' whole body), `ViewsListBody` (the views list's whole body) and `CustomizeBody` (Customize's whole body), and ten you may leave out: `Input`, `Select` (the panels' boxes that pick, drawn only under `panelControls`), `Command` (the command list's parts, for the grid's menus on the popover route), `Calendar` (the filter panel's month), `RowsWait` (what a grid's rows wait in while new ones load), `GroupBody` (deprecated: read by nothing), `SearchField` (the toolbar's search box), `PortsHost` (what draws the `toast` and `confirm` ports you leave out), `SelectionBar` (the selection bar) and `ViewMenu` (a view's whole menu). The [contract](../contract.md#the-components-map) says what each slot must accept; the [`viewkitjs/views/react` reference](../reference/react.md) lists every prop.
|
|
76
|
+
The package draws nothing with a UI library of its own. `ViewsComponents`, from `viewkitjs/views/react`, is the map you hand it: `Button`, `Popover`, `Tooltip`, `Checkbox`, `Menu`, `Collapse`, `Sheet`, `AppIcon`, `Markdown`, `TextBody` (a whole body for a text typed as one string), `NumberBody` (a whole body for a number, money or a percent), `Picker` (a whole pick list), `LinksBody` (a whole links body: each link's roles and its lead), `DateBody` (a whole date body), `PartsBody` (a whole body for a name, a place or a range) and `ValuesBody` (a whole body for several emails, phones, links or domains), `SortBody` (the sort editor's whole body), `FilterBody` (the filter editor's whole body), `FilterPartBody` (a filter rule's way and value), `FieldsBody` (the field list's whole body), `QuickFiltersBody` (the quick filters' whole body), `ViewsListBody` (the views list's whole body) and `CustomizeBody` (Customize's whole body), and ten you may leave out: `Input`, `Select` (the panels' boxes that pick, drawn only under `panelControls`), `Command` (the command list's parts, for the grid's menus on the popover route), `Calendar` (the filter panel's month, and the date editor's under `panelControls`), `RowsWait` (what a grid's rows wait in while new ones load), `GroupBody` (deprecated: read by nothing), `SearchField` (the toolbar's search box), `PortsHost` (what draws the `toast` and `confirm` ports you leave out), `SelectionBar` (the selection bar) and `ViewMenu` (a view's whole menu). The [contract](../contract.md#the-components-map) says what each slot must accept; the [`viewkitjs/views/react` reference](../reference/react.md) lists every prop.
|
|
77
77
|
|
|
78
78
|
The shapes are Base UI's, and the types promise three things:
|
|
79
79
|
|
|
@@ -96,9 +96,9 @@ export function ViewsWithYourControls({ children }: { children: ReactNode }) {
|
|
|
96
96
|
}
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
`panelControls` takes `true` (all
|
|
99
|
+
`panelControls` takes `true` (all nine) or the names you want (`["Button", "Select"]`). The sort and filter panels then draw every button, box that picks, menu, popover and text box with yours (VK-1013), and so do the group editor, Customize, the views list and view menu (with the Modal they open, and on a phone the Delete question: on a computer it goes to your `confirm` port), the quick filters' search, the filter bar's typed value and date and every head a panel draws itself on a phone, its ✕, ‹ and ✓ (VK-1014), and the text, number and date editors, each button, popover and one-line box, with `Calendar` their date's month in place of its own head and days (VK-1021), and so do the Picker wherever a ViewKit body holds it, the name and place parts and the values and links editors (VK-1022), and the bulk bar (`CONTROLS.SelectionBar`): its verbs, Delete, More, the pill's ✕ and Actions your Button, still the stops of its Toolbar (forward the `ref` your Button is handed, or the arrows skip it), More's and a group's rows your Menu, a field's list in your Popover on a computer; its count, its Toast, a phone's field sheet and Delete's question stay ViewKit's, the question's buttons yours (VK-1023). Inside a box group of ViewKit's (a date's line, a phone number's digits, Customize's and the quick filters' searches) your Input is handed `chrome="bare"`, the group drawing the frame; a box that grows over lines, a search list's box, the Number field and a duration's box stay ViewKit's ([reshaping](../reshaping.md)). Each is handed the map's props, never ViewKit's own look: your Button a `variant` from what it is (an outlined Add sort `outline`, a quiet × `ghost` at `size="icon"`), its icon and words as its children, `aria-disabled` where it can't be used but keeps its focus; your Select its rows, value and pick, `open` and `onOpenChange`, the search's words; your Menu its rows as data, opened at the button that opens it; your Popover its anchor, its close and its `label`; your Input its typing as `onChange`, in your field's frame (`chrome="field"`). Inside a ViewKit field (the name and place parts) your Input or Select is handed the `id` its label names; your Menu is handed a menu's groups, its actions and choices one level in, and its links; a popover ViewKit opens from its own button it opens itself, at your Button, and a button that is busy (the Picker's Add while it adds) comes with `aria-busy`. Each part's name rides with it as `data-slot` and `data-key`, so your control and your stylesheet meet on one name. Name `Avatar` and every record's mark the panels draw (the Picker's rows, the links editor's, the bulk bar's choices, the quick filters' values and their reminder's) is your `atoms.Avatar`, handed its data and a size in pixels ([atoms](atoms.md#a-persons-or-a-records-picture), VK-1044); an `Avatar` atom you hand without naming it draws only the chips and names it always drew. Name `RelationChip` and every mentioned record ViewKit draws (a table's cell, a field row's value, `renderFieldValue`) is your `atoms.RelationChip`, handed its data, its size and the host's link ([atoms](atoms.md#a-mentioned-record), VK-1053); handed without naming it, it draws nowhere. A control of `CONTROLS`' stays ViewKit's whatever `panelControls` says. A `Select` of your own that `panelControls` doesn't name is never drawn, and ViewKit says so once in development.
|
|
100
100
|
|
|
101
|
-
Still ViewKit's inside the panels: the
|
|
101
|
+
Name `Tooltip` and the panels' tooltips are yours, handed their words, side and, for a reason something can't be used, `reason` (VK-1015); under `Input`, the filter's number and range boxes are your Input too, a decimal box whose typing ViewKit reads as a number by your conventions (VK-1018). Still ViewKit's inside the panels: the Picker's search box and its rows (the field lists, the views list's rows; its buttons and menus are yours, VK-1022), the menu rows of ViewKit's own menus, Radio, Toggle, the quick filters' values, the sort's grip, and the head ViewKit's own `Sheet` draws (Customize's and the views list's on a phone): hand your own `Sheet` and the panels draw their heads with your Button. A filter rule's value box is named by what holds it (`vk-filter-value`), not on the box your Select or Input draws. A button's busy state (`loading`: a Save, a Delete, the Picker's Add) comes as `aria-busy` and `aria-disabled` (VK-1022); ViewKit takes no second press.
|
|
102
102
|
|
|
103
103
|
### An adapter over Radix
|
|
104
104
|
|
package/views/docs/index.md
CHANGED
|
@@ -6,8 +6,8 @@ Every example on these pages is compiled and run against the packed package befo
|
|
|
6
6
|
|
|
7
7
|
## Start here
|
|
8
8
|
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
9
|
+
- [Install](install.md): the six steps an app writes for a whole list, the four things it shapes, and your theme
|
|
10
|
+
- [Getting started](getting-started.md): a grid by hand: fields bound to your rows, columns, your primitives, the provider and the grid
|
|
11
11
|
|
|
12
12
|
## Guides
|
|
13
13
|
|