viewkitjs 0.34.0 → 0.36.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 +173 -0
- package/MIGRATION.md +7 -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 -7
- package/views/dist/contract.js +25 -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 +10 -5
- package/views/dist/controls/avatar/avatar.js +12 -6
- 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 +4 -5
- 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 +8 -1
- package/views/dist/controls/compound-editor/name-parts.js +3 -2
- package/views/dist/controls/compound-editor/place-parts.js +3 -3
- package/views/dist/controls/compound-editor/range-parts.js +11 -10
- package/views/dist/controls/compound-editor/words.d.ts +3 -0
- package/views/dist/controls/compound-editor/words.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +22 -6
- package/views/dist/controls/customize/customize.js +154 -73
- package/views/dist/controls/customize/items.d.ts +49 -0
- package/views/dist/controls/customize/items.js +104 -0
- package/views/dist/controls/customize/map-customize-body.js +19 -15
- package/views/dist/controls/customize/words.d.ts +5 -3
- package/views/dist/controls/customize/words.js +1 -0
- package/views/dist/controls/filter-editor/block.js +5 -2
- package/views/dist/controls/filter-editor/filter-editor.d.ts +16 -1
- package/views/dist/controls/filter-editor/filter-editor.js +22 -16
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +16 -2
- package/views/dist/controls/filter-editor/map-rules.d.ts +9 -2
- package/views/dist/controls/filter-editor/map-rules.js +18 -13
- package/views/dist/controls/filter-editor/parts.d.ts +1 -1
- package/views/dist/controls/filter-editor/parts.js +16 -15
- package/views/dist/controls/filter-editor/rules.d.ts +4 -4
- package/views/dist/controls/filter-editor/rules.js +6 -3
- package/views/dist/controls/filter-editor/words.d.ts +2 -0
- package/views/dist/controls/filter-editor/words.js +1 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +3 -0
- package/views/dist/controls/group-editor/group-editor.js +21 -15
- package/views/dist/controls/group-editor/map-group-body.js +1 -0
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/internal/kit-words.d.ts +11 -0
- package/views/dist/controls/internal/kit-words.js +7 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +4 -1
- package/views/dist/controls/internal/map-panel-controls.js +23 -6
- package/views/dist/controls/internal/menu-items.d.ts +9 -0
- package/views/dist/controls/internal/menu-items.js +97 -0
- package/views/dist/controls/internal/panel-controls.d.ts +27 -3
- package/views/dist/controls/internal/panel-controls.js +142 -13
- 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 +4 -1
- package/views/dist/controls/menu/menu.js +3 -2
- package/views/dist/controls/number-editor/map-number-body.js +2 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/number-editor/words.d.ts +3 -0
- package/views/dist/controls/number-editor/words.js +2 -0
- package/views/dist/controls/picker/fields-frame.d.ts +5 -0
- package/views/dist/controls/picker/fields-frame.js +30 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +7 -26
- package/views/dist/controls/picker/map-picker.d.ts +9 -3
- package/views/dist/controls/picker/map-picker.js +16 -3
- package/views/dist/controls/picker/picker.js +20 -10
- package/views/dist/controls/picker/rows.d.ts +9 -2
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- 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/map-select.d.ts +1 -1
- package/views/dist/controls/select/map-select.js +4 -1
- package/views/dist/controls/select/select.d.ts +5 -0
- package/views/dist/controls/select/select.js +11 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +6 -1
- package/views/dist/controls/sheet/bottom-sheet.js +3 -3
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
- package/views/dist/controls/sort-editor/sort-editor.js +9 -8
- package/views/dist/controls/tag/tag.js +4 -2
- package/views/dist/controls/text-editor/map-text-body.js +4 -1
- package/views/dist/controls/text-editor/text-editor.js +2 -2
- package/views/dist/controls/text-editor/words.d.ts +3 -0
- package/views/dist/controls/text-editor/words.js +1 -1
- package/views/dist/controls/toolbar/toolbar.d.ts +31 -12
- package/views/dist/controls/toolbar/toolbar.js +15 -20
- 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-views-list-body.js +9 -1
- package/views/dist/controls/views-list/rules.d.ts +1 -0
- package/views/dist/controls/views-list/rules.js +2 -2
- package/views/dist/controls/views-list/view-menu.js +2 -2
- package/views/dist/controls/views-list/words.d.ts +4 -0
- package/views/dist/controls/views-list/words.js +2 -1
- package/views/dist/display/option-badges.d.ts +17 -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 +1 -1
- 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.d.ts +7 -2
- package/views/dist/grid/chrome/GridAddColumn.js +13 -9
- 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 +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +1 -1
- 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 +11 -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/GridTableSurface.js +2 -1
- 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-fitted-box.d.ts +5 -2
- package/views/dist/grid/chrome/grid-fitted-box.js +14 -4
- 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 +16 -4
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
- package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
- package/views/dist/grid/grid-format-props.d.ts +1 -1
- package/views/dist/grid/grid-format-props.js +18 -5
- package/views/dist/grid/grid.css +11 -1
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/views/dist/grid/useGridTableSettings.d.ts +1 -1
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.js +2 -2
- package/views/dist/list/menu.d.ts +5 -4
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +47 -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 +5 -1
- package/views/dist/panels/customize-body.js +21 -12
- package/views/dist/panels/model.d.ts +14 -4
- package/views/dist/panels/react/customize-body.js +15 -3
- package/views/dist/panels/react/customize.d.ts +8 -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/filter/FilterFieldList.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +2 -2
- package/views/dist/panels/react/filter/filter-body.js +3 -1
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-part-body.js +2 -2
- 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/sort/SortEditor.js +3 -1
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +11 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +16 -6
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +5 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +12 -5
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +18 -8
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +9 -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 +4 -4
- package/views/dist/panels/react/toolbar/editor-menus.d.ts +8 -0
- package/views/dist/panels/react/toolbar/editor-menus.js +3 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -5
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/HScrollRow.js +6 -2
- package/views/dist/panels/react/views-row/ViewAxes.js +6 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +8 -3
- package/views/dist/panels/react/views-row/new-view.d.ts +11 -0
- package/views/dist/panels/react/views-row/new-view.js +21 -0
- package/views/dist/panels/react.d.ts +1 -1
- 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 -4
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +109 -7
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +115 -27
- package/views/dist/styles.unlayered.css +115 -27
- package/views/docs/contract.md +55 -35
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +3 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +1 -1
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/links-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 +1 -1
- package/views/docs/controls/text-editor.md +1 -1
- package/views/docs/controls/values-editor.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 +2 -2
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +27 -24
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +6 -5
- package/views/docs/reference/list.md +27 -7
- package/views/docs/reference/looks.md +5 -5
- package/views/docs/reference/panels-react.md +15 -14
- package/views/docs/reference/panels.md +5 -5
- package/views/docs/reference/react.md +25 -11
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +22 -6
- package/views/skills/views/SKILL.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,179 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.36.0] — 2026-12-04
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `viewkitjs/views/controls`: the `Sheet` takes `risen`. Mounted open with it, it stands at its stop from its first frame and plays no rise, for an app drawing a sheet again where one already stood (a window redrawn in another form, its record still open); no entrance plays, so `onOpenChangeComplete` isn't called for that mount. Closed and opened again, it rises as any sheet does. Left out, a sheet mounted open rises, as before.
|
|
13
|
+
- `viewkitjs/views/controls`: the Picker's `PickerAs` chip row takes `removable`, a function of a remove that draws the chip as it stands held among the search's chips under the look Chips, its × removing it. Left out, a held chip there is the plain Option, as before. `pickerItemsOf(items, { cells: true })` hands it for an option in its colour.
|
|
14
|
+
- `viewkitjs/views/controls`: `ToolbarOwnButtonProps`, what the Toolbar hands your own ⋯, "+N" or "+N filters" button (`overflow.button`, `moreViews.button`, `moreFilters.button`): a Toolbar button's props with a plain `style`, never Base UI's state function. Type your button with it and spread what you are handed onto a plain `<button>` with no cast:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
// before
|
|
18
|
+
const Own = forwardRef<HTMLButtonElement, ToolbarButtonProps>(({ label, children, ...rest }, ref) =>
|
|
19
|
+
<button ref={ref} aria-label={label} {...(rest as ButtonHTMLAttributes<HTMLButtonElement>)}>{children}</button>);
|
|
20
|
+
// now
|
|
21
|
+
const Own = forwardRef<HTMLButtonElement, ToolbarOwnButtonProps>(({ label, children, ...rest }, ref) =>
|
|
22
|
+
<button ref={ref} aria-label={label} {...rest}>{children}</button>);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
A button typed with `ToolbarButtonProps`, cast as before, is still taken.
|
|
26
|
+
- `viewkitjs/views/list` and `viewkitjs/views/panels/react`: `menus.customize`, Customize's rows as data. Handed each page's default rows (its list's, Layout's and Columns'), every row keyed, it hands back the rows Customize draws, as the other menus do (`ListMenus`, `ToolbarMenus`). Drop a page or a row, move one, rename one, add a row of your own, or on the list a page of your own, without drawing your own `CustomizeBody`; `menu.drop`, `menu.rename`, `menu.add` and `menu.move` reshape them. A row keyed by one of Customize's own stays ViewKit's row with your words; the default keys are in `/list`'s reference, "Default keys".
|
|
27
|
+
- `viewkitjs/views/react`: `ViewsCustomizeItem`, `ViewsCustomizeItemsContext` and `ViewsCustomizeItems`; `ViewsCustomizeBodyProps.items`, the function handed to your body; the message key `views.panels.customize-unavailable` ("Not available", a disabled row's reason where you hand none).
|
|
28
|
+
- `viewkitjs/views/controls`: `CustomizeProps.items` and `CustomizeWords.unavailable`.
|
|
29
|
+
- `viewkitjs/views/list` and `viewkitjs/views/panels/react`: `menus.sortEditor`, `menus.filterEditor` and `menus.groupEditor`, the editors' menus as data, wherever the toolbar draws the editors (its Sort and Filter panels, Customize's pages). A sort rule's ⋯ and a set-aside rule's, a filter rule's ⋮ (its any/none/every as the `relation` item), a set-aside rule's and a group's actions, and the group editor's settings and Remove grouping: drop a row, rename one, add your own; `menu`'s helpers reshape them. `ctx.menu` says which menu, and a rule is named in public terms only, `field` across the three (the sort's key; the filter's `fieldKey` with its `part` and `relation`), and a filter rule or group by its `path` in the filter the body is handed (`[]` the whole filter). The default keys are in `/list`'s reference, "Default keys".
|
|
30
|
+
- `viewkitjs/views/react`: `ViewsSortEditorItems`, `ViewsFilterEditorItems`, `ViewsGroupEditorItems` and their contexts; the message key `views.panels.filter-relation-rows` ("Which related records", the any/none/every choice as one row of `menus.filterEditor`); `items` on `ViewsSortBodyProps`, `ViewsFilterBodyProps` and `ViewsGroupBodyProps`, for a body of your own.
|
|
31
|
+
- `viewkitjs/views`: `ViewsFilterPartBodyProps.relation`, handed for a filter on a related record's field (Company › Industry): the relation's field key it stands under (`"company"`), as `FilterBody`'s `ruleValue` hands it, so your part body can tell whose values to offer. Absent for a rule on the list's own field.
|
|
32
|
+
- `viewkitjs/views`: `ViewsFieldsBodyProps.ownRelation`, handed with `own` when the field list opens from such a rule: the relation's key, as `onPick` hands it back, so you tick the far field (Company › Name) and never the list's own field with the same key. `CONTROLS.FieldsBody` ticks it so.
|
|
33
|
+
- `viewkitjs/views/controls`: the last fixed English words in ViewKit's controls are yours (VK-997):
|
|
34
|
+
- A view's menu: a row that can't be used, giving no reason, says `views.menus.not-now`.
|
|
35
|
+
- The typed Select: its × says `views.menus.clear`; its chips' × says `views.editors.tag-remove` (or `views.picker.remove`, new, with no words); its chevron says `views.picker.show-every` (`{ label }`, new) or `views.picker.show-all` (new). This holds inside ViewKit's panels; drawn alone, the Select takes `clearLabel`.
|
|
36
|
+
- The text, number and compound editors' phone head, where no holder keeps the draft: `close` and `save` in their words, which ViewKit's map hands as `views.panels.close` and `views.editors.save`.
|
|
37
|
+
- `AvatarStack`'s +: `addLabel`.
|
|
38
|
+
- Each keeps today's English as its default.
|
|
39
|
+
- `viewkitjs/views/grid`, `viewkitjs/views/list`: `GridMenus` and `ListMenus` take `addColumn(items, { columns })`, the grid's "+ Add column" as data like every other menu: handed its default rows (`add:<id>` for each hidden column, `field:<id>` for a field with parts, `all-shown` when nothing is hidden) and every column of the list, it returns the rows drawn. Drop a column from the list, or add your own "New field…" row. `List` hands it to its grid.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- `viewkitjs/views/controls`: `CONTROLS.FilterBody`'s field lists (Add filter, the fields when nothing is filtered, a rule's field) stand as wide as their names, as `CONTROLS.FieldsBody` does: never narrower than their search's placeholder, their rows keeping no room for a check only a held row shows. Customize's Add filter list no longer takes the width of the whole-row button that opened it, so it stands the same width as the bar's field list with the same names.
|
|
44
|
+
- `ViewsCustomizePage`, `CustomizeScreen` and `ActivePanel` take a page of the app's own (`page:<key>`, `{ type: "page", key }`). Code that switches over them exhaustively meets a new case at type-check; nothing changes at run time.
|
|
45
|
+
- `menu.rename` keeps the type of the items it is handed.
|
|
46
|
+
- Customize's rows open, and take the focus back after ‹, by their public name and key, never their words: a renamed row still opens.
|
|
47
|
+
- The group editor's settings open, and take the focus back, by their key, never their words: a renamed setting still opens. Remove grouping carries `data-key="remove"`. On a phone, a filter menu step closes after a row under a heading of its own runs too.
|
|
48
|
+
- `viewkitjs/views/panels`: a filter's field part on the bar hands your `ToolbarButton` its field's column glyph as `icon`, as the grid's header, the field list and the sort mark the same field; a filter on a related record's field (Company › Industry), the far field's own glyph; a field with no mark, none. Before, it was always handed `icon: null`. A `ToolbarButton` of yours that draws `icon` now draws it there, and so does `CONTROL_ATOMS.ToolbarButton`.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- `viewkitjs/views/panels/react`: the + of several view axes on one row, and of the stacked row under the first (`ViewAxes`), opens New view through your `ViewMenu` where the axis hands `verbs`, as the folding row's + and the picker's do. It called the axis's own `onCreate`, which on a list whose root keeps its views does nothing. Every views + now takes this one rule.
|
|
53
|
+
- `viewkitjs/views/controls`: `CONTROLS.ViewsListBody` draws the ✕ it is handed: on a phone, in a Sheet of your own under `sheetActions: "bar"`, the views list has its own head with its name and ✕ at the list (Back on a step, as before), as every other panel body does. In ViewKit's own Sheet nothing changes. The contract says the rule beside the panels' body pattern.
|
|
54
|
+
- `viewkitjs/views/controls`: under the Picker's look Chips, a held option in its colour stands in the search as its cell draws it, your `Tag` atom in its colour with its own ×, no longer as a plain chip.
|
|
55
|
+
- `viewkitjs/views/controls`: Customize's stale note on a person's own view (`own` on the open view, `private` on the views axis's option) says "This view changed since you started." (`views.panels.view-stale-own`, new), never "Everyone's view": the view was saved again elsewhere, another tab of theirs, and nobody else uses it. A list whose root keeps its views in the browser store, where every saved view is a person's own, says it right. A shared view keeps "Everyone's view changed since you started." (`views.panels.view-stale`).
|
|
56
|
+
- A Customize screen whose section goes while it stands (its sort, group or columns no longer handed) is Customize's list again, never a blank screen.
|
|
57
|
+
- A per-field filter handed with an empty `disabled` reason draws as a disabled row saying "Not available", never a row that looks usable and opens nothing. The list draws no line before its first row, and one line, never two, after the filter fields' sections.
|
|
58
|
+
- `viewkitjs/views/controls`: ViewKit's own Menu, opened at an anchor (every grid menu: a column's, a group's ⋯, "+ Add column", a footer's figure picker), keeps a level one row in open beside it. Resting on a date's Format or on an option's colour, or pressing → on it, used to close the whole menu, so those choices couldn't be picked with ViewKit's own controls. An app's own Menu is unchanged.
|
|
59
|
+
- `viewkitjs/views/grid`: a row draws its ⋯ only where it opens something: where the grid is handed `selection`, `contextMenu`, `rowMenu`, `menus.row`, `rowHref`, `onRowDelete` or a name column's action. With none of them, every row drew a ⋯ that opened nothing; now none is drawn, on a computer or a phone, and the tail keeps its width so the columns don't move.
|
|
60
|
+
- `viewkitjs/views/grid`: a cell's in-place editor (a link, an email, a phone, plain text, an amount) grows to show its whole value as far as the grid's visible edge on the side it grows, no longer stopping at 320 px with room free beside it. Past that edge the value scrolls in its box, as before. On a phone the editor's sheet is unchanged.
|
|
61
|
+
- `viewkitjs/views/controls`: `CONTROLS.FilterBody` no longer offers a related record's field (Related records) where a rule stands at its deepest level. A related field's rule is written as a relation rule whose `where` is a level of its own, so there it would have been one level past ViewKit's and refused, silently: the rule showed in the editor and never reached the view. One level up, Related records are offered as before. `fieldsIn` takes the editor's `levels` for this.
|
|
62
|
+
- `viewkitjs/views/controls`: in `CONTROLS.FilterBody`, a rule on a relation your list hands whose far fields the kit's filter editor can't type (each a place whole, say) draws as its relation's block, named by the relation, its rules in ViewKit's own words, where it read "Its relation is no longer in this list". Such a relation still offers no row under Related records. Handed back unedited, the rule is written as it was.
|
|
63
|
+
- `CONTROLS.CustomizeBody` on a phone, in an app's own Sheet that takes no parts: its own head draws its ✕ only where it is handed `actions.close`, and the ✕ presses it. Under `sheetActions: "head"` the sheet's head holds the one ✕ (VK-903).
|
|
64
|
+
- On a phone, Back from any of Customize's screens (Sort, Group, Layout, a choice, a column's settings, a per-field filter) puts the focus on the row that opened it, not on the sheet's step (VK-856).
|
|
65
|
+
- In Customize's Columns, Enter on a column keeps the focus on it in its new block, so Enter again puts it back instead of ticking the column that took its place (VK-896).
|
|
66
|
+
- `viewkitjs/views/grid`: Automatic on an option's last custom colour, and Reset colors, now clear what they say. `useGridTableSettings` and `useGridTablePrefs` hand `setFormats` a format's whole map with the field it changes present: its new setting, or `null` where it has none left. A store that writes only the fields a patch names reads `null` as the clear; one that keeps each map as handed keeps the `null`, which the grid reads as no setting. Reset colors now clears every colour of the column, where it used to keep all but one.
|
|
67
|
+
- `viewkitjs/views/list`: picking Automatic for a number's decimals no longer clears every other field's decimals.
|
|
68
|
+
- `viewkitjs/views/controls`: deleting a person's own view (`private` on the views axis's option) says it goes for them alone: "The view goes only for you. The deals in it stay as they are." (`views.panels.view-delete-goes-own`, new). A shared view keeps "The view goes for everyone who uses it." It follows the view's own `private` whatever look the list wears, so a list whose root keeps its views in the browser store, where every saved view is a person's own, says it right. The look still decides whether the menu shows Private view.
|
|
69
|
+
- `viewkitjs/views/grid`: the grid's row, header, group band and footer heights (`--vk-row-h`, `--vk-head-h`, `--vk-label-h`, `--vk-footer-h`) are yours to set on its frame, as the contract says: a rule of your own stylesheet, outside a cascade layer, such as `[data-slot="vk-grid"] { --vk-row-h: 48px; }`, wins over ViewKit's, and the rows draw, scroll and window by it. They used to be written inline on the frame, where no stylesheet rule could reach them. With none set, the grid draws as before, the Words header's height included.
|
|
70
|
+
|
|
71
|
+
## [0.35.0] — 2026-12-04
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- `viewkitjs/views/react`: the provider's `panelControls` can name `Tooltip`. Your components map's `Tooltip` then draws the tooltips inside ViewKit's panels: Add sort at its most, a set-aside sort's and filter rule's why, and Add filter on a relation the list no longer lists. It is handed `content`, `side`, `align`, and `reason` where the words say why something can't be used. A tooltip ViewKit's own would never show (Add sort while it can be used) is no tooltip at all, its child drawn alone. `PANEL_CONTROL_NAMES` holds `Tooltip`.
|
|
76
|
+
- `viewkitjs/views/react`: `ViewsTooltipProps.reason`, a tooltip whose content says why what it names can't be used: a longer line to wrap. The kit's map Tooltip (`CONTROLS.Tooltip`) draws it as ViewKit's own reason does.
|
|
77
|
+
- `viewkitjs/views/react`: the provider's `panelControls` now draws your own `Button`, `Menu`, `Popover`, `Select` and `Input` inside the Picker (wherever a ViewKit body holds it: an editor's list, the text and number editors' country and currency lists, the filter's value Pickers, the sort's Add sort fields), the name and place parts, and the values and links editors, each handed its part's `data-slot` and `data-key`. Inside a ViewKit field your Input or Select is handed the `id` its label names (`ViewsSelectProps.id`). Nothing changes without it.
|
|
78
|
+
- `viewkitjs/views/panels/react`: the list's toolbar takes `overflow` (`ToolbarOverflow`, on `Toolbar`, `ReadyToolbar`, `ListToolbar` and `List`'s `toolbar`), the ⋯ it draws when its parts don't fit as you draw it: `icon` (your glyph over your `icons.more`), `className`, or `button`, your own button drawn in place of your `ToolbarButton` and handed the very props it would get (`part: "more"` and `ref` included). Handed nothing, ⋯ draws as before.
|
|
79
|
+
- `viewkitjs/views/controls`: `ToolbarControl` takes `overflow` (`ToolbarOverflowControl`), the same for the kit's Toolbar: your glyph over ViewKit's dots, your class, or your whole button, handed the Toolbar button's props (spread them on yours, `ref` included). Handed nothing, ViewKit's own ⋯ as before.
|
|
80
|
+
- `CollectionViewState.saved`: the view's settings as saved. Hand it in your view state and each Customize page gets its own Reset. ViewKit's own saved views fill it. Without it, the first page's Reset still works through `onReset`.
|
|
81
|
+
- Each Customize page (Layout, Columns, Filter, Sort, Group) has its own Reset while that page differs from the view as saved. With no saved view, the page goes back to what the first page's Clear gives: Filter, Sort and Group emptied, Columns back to its declared columns. A page's Reset also empties its own part of the reader's layer: Layout their look (and on a phone their phone's layout), Columns their widths, Group their folds. It says the first page's word, "Reset" on a shared view and "Clear" with none, and it looks the same and stands in the same place. A Customize body of your own is handed them as `resets`; the default Customize takes them as `CustomizeProps.resets`, drawn as `data-slot="vk-customize-action"` with `data-key="page-reset"`. Handed at all (even empty), they are the only page Resets; ViewKit's toolbar hands none where a shown view gives no `saved`.
|
|
82
|
+
- The sort and filter editors take `clearAll` (default on). Set it to `false` to hide their Clear all.
|
|
83
|
+
- `ToolbarOptions`, `ViewOptionsPanelContent` and `ToolbarSave` take `layered`: the reader's own layer holds something. The ready toolbar sets it.
|
|
84
|
+
- `viewkitjs/views/controls`: `ToolbarControl` takes `moreViews` and `moreFilters` (`ToolbarMoreControl`), the "+N" its view tabs fold into and the "+N filters" its filters fold into, as you draw them: your class, or your whole button, handed the Toolbar button's props (spread them on yours: `ref`, its words, and what its Menu or `onMoreViews` sets to open from it). Handed nothing, both draw as before, the same elements to the attribute.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
<ToolbarControl label="Deals" moreViews={{ button: MyPlus }} moreFilters={{ className: "my-more-filters" }}>
|
|
88
|
+
…
|
|
89
|
+
</ToolbarControl>
|
|
90
|
+
```
|
|
91
|
+
- `viewkitjs/views`: the Avatar draws a record's own icon, after Attio. Hand a person or a record its object's icon (`icon`) and, if you like, its object's colour (`colour`), and with no photo or logo it draws that icon on a ground that shows in dark too. Three new looks on `AVATAR_LOOKS`, set once on the frame, decide how: With no picture (`data-avatar-mark`: `icon`, the default, or `initials`, the name's letters as before), Ground (`data-avatar-ground`: `quiet` for Quiet grey, the default, `grey`, `outline` or `colour` for the object's colour's fill) and Icon colour (`data-avatar-icon-colour`: `grey`, the default, or `colour` for the object's colour's strong ink). A person keeps its circle; a photo or a logo (`src`) always wins. An Avatar handed no icon draws its letters exactly as before.
|
|
92
|
+
- `viewkitjs/views`: the Avatar reads three more tokens, `--vk-neutral-hovered` (Quiet grey), `--vk-neutral-bold` (Grey) and `--vk-border-input` (Outline's edge), each declared by the ready stylesheet.
|
|
93
|
+
- `viewkitjs/views/react`: the provider's `panelControls` can name `Avatar`. Your `atoms.Avatar` then draws every record's mark ViewKit's panels draw: the Picker's rows, the links editor's, the bulk bar's choices, the quick filters' values and their reminder's. It is handed data only: the record's `label`, its `avatarUrl`, its `kind` as your app names it (a deal stays a deal, where ViewKit's own draws every record as a person or a company), the panel's size in pixels and ViewKit's own Avatar as its `fallback`. ViewKit's own Avatar atom is never counted as yours. Left out, the panels draw ViewKit's Avatar exactly as before, even where you hand an `Avatar` atom for the chips.
|
|
94
|
+
- `viewkitjs/views/react`: `ViewsAvatarProps`' `size` takes 20, 24, 32 or 40 beside `chip` and `glyph`: the panels' sizes, handed only where `panelControls` names `Avatar`. `PANEL_CONTROL_NAMES` holds `Avatar`.
|
|
95
|
+
- `viewkitjs/views/controls`: a `SelectItem`'s `avatar` says its mark is your own Avatar atom; a typed Select's chip draws it again at `chip`. `PickerAs`' avatar and `QuickMark`'s face carry the record's `kind`, and `QuickMark` its `src`, for your atom.
|
|
96
|
+
- `ToolbarSortPill` takes `changed` and `ToolbarFilterAdd` takes `changed`: each is lit by it, whatever it would light by on its own.
|
|
97
|
+
- `ToolbarFilters` takes `saved`, the saved view's filter. Its own top-level filters stand in Customize, not on the bar. An edited one stands on the bar as edited, and every write is still the whole filter's. `foldableFilters(tree, held, saved?)` counts the same.
|
|
98
|
+
- `ToolbarFilterAdd` takes `opens`: `"fields"` (the default, as before) or `"filters"`. With `"filters"`, it opens the whole filter editor, your `FilterBody` on every rule of the view, edited as Customize's Filter edits it, with Add filter under the rules.
|
|
99
|
+
- `viewkitjs/views/controls`: `CustomizeProps.differs`, a section that differs from the view as saved: its value in the brand. Absent, Layout and Columns carry no mark.
|
|
100
|
+
- `viewkitjs/views/grid`: `GridTable` takes `rowHighlight`, which row the grid tints. `"hover"`, the default, tints the row under the pointer, as before. `"active"` tints the active row alone, which carries `data-active` (`GRID_STATES` gains `active`): the row a person last pressed, anywhere on it, or the picked cell's row, so the keyboard moves it too. It keeps its tint through a press outside the grid and Escape, until another row is pressed or picked, and no row tints under the pointer or as your `hoveredRow`; the row's box, ⋯ and the name's actions still show under the pointer.
|
|
101
|
+
- `viewkitjs/views/grid`: two options on `GRID_LOOKS`. Row highlight (`highlight`: `hover`, the default, or `active`), which `gridLookProps` hands `GridTable` as `rowHighlight`, so `GRID_LOOK_READ` and `GridLookWorn` gain `highlight` and `GridLookProps` gains `rowHighlight`. Add calculation (`offer`: `hover`, the default, or `always`), the look stylesheet's: under `always` every empty footer cell shows its offer ("+ Add calculation" under Figures `value`, "Calculate" otherwise) at rest, and opens the same picker. Wear it without looks as `data-grid-offer="always"` on a frame round the grid. Both looks, `attio` and `portal`, keep `hover` for both.
|
|
102
|
+
- `viewkitjs/views/panels/react`: `ToolbarSort` takes `bar` and `changed`. Handed `bar`, the one-rule sort reads on the filter bar as a several-sorts list's pill does: "Sorted by **Name**", in the bar's sort place (`data-slot="vk-toolbar-sort-pill"`), opening the same one-rule panel. `changed` lights it as you say, over its own rule (the list's default sort).
|
|
103
|
+
- `viewkitjs/views/react`: a new atom, `RelationChip`, a mentioned record. ViewKit places a mentioned record and hands its data; your app draws it. Where the provider's `panelControls` names `RelationChip`, your `atoms.RelationChip` draws every relation ViewKit draws: 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. It is handed `ViewsRelationChipProps`: `relation` (`id`, `label`, `entity`, `avatarUrl`), `roles` (a link's, each its `value` and `label`), `size` (`chip` in a cell or a highlight, `row` in a field row), `render`, the host's link where it has one (a cell whose host opens its relations, a bare button whose press is the host's; your `RelationLink` or a host's `relationWrap` around your chip; none for an inert fact or where the host's own element owns the click), and `fallback`, ViewKit's own chip. `ViewsRelationChipLinkProps` is what your chip hands that link. The default, `DEFAULT_VIEWS_ATOMS.RelationChip`, draws its `fallback`, and ViewKit's own atom is never counted as yours. Left out, or handed without naming it, every place draws 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.
|
|
104
|
+
- `viewkitjs/views/react`: `PANEL_CONTROL_NAMES` and `PanelControlName` hold `RelationChip`; `ATOM_NAMES` (`viewkitjs/views`) holds `RelationChip`.
|
|
105
|
+
- `viewkitjs/views`: the `RowMenu` atom takes `onOpenChange`, to call with `true` as its menu opens and `false` as it closes. While it is open, the grid draws the row it is aimed at as under the pointer, `data-hovered` with its tint and its ⋯. ViewKit's own `RowMenu` calls it; an atom of yours that doesn't behaves as before.
|
|
106
|
+
- `viewkitjs/views/controls`: `pickerItemsOf(items, { cells: true })` reads a coloured or slotted row as its cell draws it (the Picker's row `as: { chip }`); without `cells`, as before. The Picker's `PickerAs` takes `{ chip: ReactNode }`, drawn in place of the row's words.
|
|
107
|
+
- `viewkitjs/views/react`: a `PartsBody`'s `range` kind (`ViewsPartsBodyProps`) is handed the field's limits, `min` and `max`, where the field states them (`validation.min` and `.max`; a percent range 0 and 100 unless it says otherwise). Your body may step each end within them, as the number body's box does.
|
|
108
|
+
- `viewkitjs/views/editors/range`: `RangeEditor` takes `min` and `max` and hands them to the body. The grid's and a field row's range editors hand the field's own (`numberBounds(field)`). A host of your own (a card's range editor) can hand them the same way.
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
|
|
112
|
+
- `viewkitjs/views/react`: a components map spread from `CONTROLS` carries none of `CONTROL_ATOMS`, so its toolbar draws ViewKit's plain button and the Toolbar's look options don't apply. In development the provider now says so once, where the map holds ViewKit's own controls, carries no atoms and the app hands no `ToolbarButton` of its own. Hand them beside the map: `components={{ ...CONTROLS, ...own }} atoms={CONTROL_ATOMS}`. The kit's `ToolbarButton` atom draws a count as a count, never the ✕ that clears it.
|
|
113
|
+
- `viewkitjs/views/react`: `panelControls={true}` now names `Tooltip` too. With your own `Tooltip` in the map, `true` draws the panels' tooltips with it.
|
|
114
|
+
- `viewkitjs/views/controls`: where the provider's `panelControls` names `Input`, the filter's number and range boxes are your `Input` too: a rule's number, a range's From and To, and the filter bar's typed number. Your Input is handed `inputMode="decimal"` and the text typed. ViewKit reads it as a number by the provider's conventions, rounded where the field takes whole numbers, hands the number (or none) at each change, and steps it with ↑ and ↓ (Shift by 10). Before, these boxes stayed ViewKit's Number field whatever `panelControls` said. With `Input` not named, they draw as before.
|
|
115
|
+
- `viewkitjs/views`: under the provider's `panelControls` your `Menu` is now handed a menu's groups, its rows of actions and of choices one level in (`children` with `beside`) and its links (`href`), which it was left without (VK-1022).
|
|
116
|
+
- An app that opted in to `panelControls` on 0.33.0 for the sort and filter panels now sees its own `Button` inside their Pickers too (Add sort's fields, a filter's values): a level's Back, Retry and Clear all; their search box and rows stay ViewKit's.
|
|
117
|
+
- Under `panelControls`, a popover ViewKit opens from its own button (the links editor's field list) is opened by ViewKit at your Button and handed its `anchor`, whether or not `Popover` is named; a busy button (the Picker's Add while it adds) is handed `aria-busy` and `aria-disabled`; a button drawn as a link (the values editor's Open) stays ViewKit's.
|
|
118
|
+
- `viewkitjs/views/controls`: the bulk bar (`CONTROLS.SelectionBar`) draws your own controls under the provider's `panelControls`. Every verb, Delete, More, the phone pill's ✕ and Actions is your `Button`, each handed its part's `data-slot` (`vk-bulk-verb` with its place as `data-key`, `vk-bulk-delete`, `vk-bulk-more`, `vk-bulk-clear`, `vk-bulk-actions`), and the bar's Toolbar still holds it: one Tab stop, the arrows, Home and End. Forward the `ref` your Button is handed, or the arrows skip it. The bar measures how many verbs fit with your Button too. More's and a group's rows are your `Menu`, a group's verbs and a field's values one level in; a field's list stands in your `Popover` on a computer. The count, the Toast and a phone's field sheet stay ViewKit's, and so does Delete's question, its buttons yours. With nothing opted in, or with `components={CONTROLS}`, the bar draws exactly as before.
|
|
119
|
+
- `viewkitjs/views/controls`: `ToolbarControl` is the bar above a list and nothing else: `fill` (the row's worded buttons growing to share it) and `more` (entries ⋯ always holds at the row's end) are gone, and with them the `data-fill` rule in `toolbar.css`. A row of a page's actions is your own, on your Button, with a menu of yours for what doesn't show:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
// Before
|
|
123
|
+
<ToolbarControl label="Record" fill more={[{ icon: null, label: "Merge records" }]}>
|
|
124
|
+
<ToolbarButtonControl label="Compose email" icon={mail}>Compose email</ToolbarButtonControl>
|
|
125
|
+
</ToolbarControl>
|
|
126
|
+
|
|
127
|
+
// After
|
|
128
|
+
<div className="record-actions">
|
|
129
|
+
<Button icon={mail}>Compose email</Button>
|
|
130
|
+
<Menu label="More of the record" entries={[{ icon: null, label: "Merge records" }]} />
|
|
131
|
+
</div>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- `viewkitjs/views/controls`: `toolbarSteps(items, fill)` takes the items alone: `toolbarSteps(items)`.
|
|
135
|
+
- Customize's Layout page now ends at its toggles, in every app: the "For you" heading, "On your phone", "Use what the view says" and a toggle's own "Reset …" row are gone. `settingsPanels(…).layout` no longer builds a `personal` section, and Vertical borders no longer carries a `reset`. Customize's Reset is the way back. The `vk-customize-toggle-reset` part is no longer drawn.
|
|
136
|
+
- On a phone, Customize's Layout picker names and writes the phone's own layout: `mobileValue` through `onMobileChange`, among `mobileOptions` with `mobileRefused`, each the computer's where absent; a toggle marked `desktopOnly` is left out, and a Layout marked `desktopOnly` with no phone value stands nowhere. Layout's settings and Columns follow the layout the phone draws. A pick on the phone never changes the computer's layout, nor a pick on the computer the phone's. With one layout offered, a phone draws no cards to pick. `settingsPanels(…).layout` offers the phone the list's own `layouts`, never more: its `mobileValue` is the person's pick where the list still offers it, else a table read as rows where rows are offered, else the computer's layout. An app drawing its own layouts reads the phone's from the person's layer, `applyPersonalLayer(settings, layer, { phone: true }).settings.layout`.
|
|
137
|
+
- Deprecated, read by nothing and removed in a later release: `LayoutConfig.personal`, `LayoutPersonalConfig`, `resolvePersonalSection`, `ToggleConfig.reset`, a Customize body's `layout.personal` and toggle `reset`, the default Customize's `CustomizeLayoutSettings.personal` and `CustomizeToggle.reset`, and its words `personalReset` and `toggleReset`. Code that sets them still compiles and draws nothing; delete those lines.
|
|
138
|
+
- Customize's first-page Reset (and the bar's Clear, and the ✕ on the Customize button, which do the same) now puts back the view as saved and the reader's own layer too: their column widths, the groups they folded, their own look and their phone's layout. This happens in every app. When only that layer differs (a dragged width, a folded group), Reset stands alone, with no Save, on the bar's Clear too. A phone's own layout counts only on a phone.
|
|
139
|
+
- Inside Customize, the Sort and Filter pages no longer carry Clear all wherever Customize is handed its pages' Resets (ViewKit's toolbar, with no saved view or with a view that gives `saved`); their page's Reset stands in its place. Without them, Customize keeps Clear all. The toolbar's own Sort and Filter popovers keep theirs.
|
|
140
|
+
- Customize's Columns page no longer carries "Reset columns" at its heading; its page's Reset stands in its place. `CustomizeProps.columnsReset` and a Customize body's `columns.reset` are deprecated: they are read as Columns' page Reset only where no `resets` is handed at all. A column's figure, set from the grid's footer, is not part of Columns' Reset; the first page's Reset takes it back. The word `columnsReset` is deprecated and drawn nowhere.
|
|
141
|
+
- `viewkitjs/views`: a record's Avatar handed both an `icon` and a `colour` used to stand on its colour's fill; it now stands on Quiet grey with a grey icon unless the frame picks Ground `colour` and Icon colour `colour`. A person handed an `icon` now draws it on the same ground instead of on its tone.
|
|
142
|
+
- `viewkitjs/views/react`: `panelControls={true}` now names `Avatar` too. With your own `Avatar` atom handed, `true` draws the panels' record marks with it.
|
|
143
|
+
- `viewkitjs/views/controls`: a typed Select's chip finds a picture by a flag ViewKit's Avatar carries, not by which component it is, so it also holds across two copies of the package.
|
|
144
|
+
- `viewkitjs/views/controls`: a square Avatar at 16 and 20 rounds its corners one step more: Small 3px, Medium (the default) 6px, Large 9px, Extra large 12px, where Medium was Small's 3px. Every other size draws as before. A company's or a record's mark in a chip, a Picker's row or a typed Select now reads less square.
|
|
145
|
+
- In every app on ViewKit's toolbar (Mihai's look, the default on a computer), the toolbar shows only what differs from the saved view: the open view's `saved` settings, or with no saved view the list's defaults.
|
|
146
|
+
- At rest nothing is lit and no filter bar stands.
|
|
147
|
+
- Sort and Filter on the row light while they differ.
|
|
148
|
+
- A changed sort comes onto the filter bar ("Sorted by …") with Clear and Save.
|
|
149
|
+
- The bar holds only the filters that aren't the saved view's own.
|
|
150
|
+
- Something taken away (a saved filter removed) brings Clear and Save alone.
|
|
151
|
+
- Customize's foot now holds Reset and Save, with the stale note, while anything differs, even when the bar stands with its own Clear and Save.
|
|
152
|
+
- A shown view handed without `saved` keeps the older lighting.
|
|
153
|
+
- On a phone, Sort lights the same way; Filter's badge still counts the filters.
|
|
154
|
+
- In every app on ViewKit's toolbar (Mihai's look, on a computer), Filter on the row now opens the view's filters, editable, with Add filter under them, as Sort opens its rules. With no filter it opens the editor's fields. The bar's + still adds one filter from the fields. On a phone, Filter's sheet already opened the editor on every rule.
|
|
155
|
+
- `viewkitjs/views/react`: `CONTROLS.CustomizeBody` marks a section (its value in the brand) only while it differs from the view as saved: the same `resets` its pages' Reset stands for. A saved view's own filter and sort show in the normal colour at rest; a section changed, or one whose saved part was taken away, shows in the brand. Layout and Columns are marked too. With no `resets` handed (a view without its saved settings), a section is marked while something is set in it, as before.
|
|
156
|
+
- `viewkitjs/views/grid`: with the lines between the columns on (`verticalBorders`), the last column now draws the same line as the others, so the table is closed on its right: in the rows, in the header where you hand `headerVerticalBorders`, and in the footer. The footer, which drew no lines before, now draws the rows' column lines and a line under itself, pinned (`pinFooter`) or not. A grid with `verticalBorders` off draws exactly as before.
|
|
157
|
+
- `viewkitjs/views/react`: `panelControls={true}` now names `RelationChip` too. With your own `RelationChip` atom handed, `true` draws every mentioned record with it.
|
|
158
|
+
- `viewkitjs/views/controls`: `CONTROLS.Picker` draws a select's, a multiselect's and a status's options as their cells do, with your `Tag` and `StatusBadge` atoms: each option in its colour (one your field doesn't declare in the colour its cell derives for it), a status's words and mark in its slot's colour, a `pending` step the same in the list as in the cell. Before, the list drew every option as a plain chip and a status's words uncoloured. An app with its own `Tag` or `StatusBadge` atom now sees it in the list too.
|
|
159
|
+
- `viewkitjs/views`: an archived option a record still holds keeps the colour its field declares in the select editor's list, as in its cell.
|
|
160
|
+
- `viewkitjs/views/grid`: a multiselect cell's editor names a value no option names as its cell does, as stored (an open field's `north` stays `north`, a stray code stays its code), where it prettified it (`North`); an option it does name, by its label.
|
|
161
|
+
- `viewkitjs/views/controls`: `--vk-shadow-menu`'s dark default drops its 1px ring and is `0 8px 24px hsl(0 0% 0% / 0.5)`. The Pane, the bulk bar's tray and pill, the quick filters' reminder and the text editor's note each draw their own 1px edge, so in the dark they showed a 2px double edge; they now draw one. A pixel comparison of those surfaces in the dark moves by that ring. Light is unchanged. An app that sets `--vk-shadow-menu` itself sees no change.
|
|
162
|
+
- `viewkitjs/views`: a phone's text and values bodies are handed the region a number typed without its country code is read in: the record's (`region` on the column or the field row), else your conventions' `region`. Before, only the record's reached them, so ViewKit's Values editor started a new phone line on the country last kept or the browser's (an en-US browser's "US +1") though your conventions said otherwise. With neither, as before. An app's own `TextBody` or `ValuesBody` now sees `region` where only the conventions hand one.
|
|
163
|
+
- `viewkitjs/views`: the install page is now the six steps an app writes for a whole list (the package with its peers, the stylesheet, the provider with `CONTROLS`, the fields, `<List>` and `listHandler`), a table of what each requires, and where to change each of the four things an app shapes: sizes and colours, its own controls, each menu's and panel's content and order, and the layout. It no longer asks for an adapter: `CONTROLS` fills every control. An app that lets its own Tailwind compile ViewKit (`@source`) is told it declares the controls' tokens (`VK_CONTROL_TOKENS`) too, whose defaults are the ready stylesheet's.
|
|
164
|
+
- `viewkitjs/views`: on a phone at the default `sheetActions: "bar"`, an editor's sheet has one head: the editor's bar holds its ✕ (‹ on a step), its name (`data-slot="vk-editor-title"`) and its ✓ in one row, and your `Sheet` is handed the name in words alone (`label`, no `title`), so by its contract it heads nothing over it. Before, a sheet that drew its own head on a title stood a second row, with a second ✕, over the bar. Under `sheetActions: "head"` nothing changes. A `Sheet` of yours that draws a title from `label` alone now draws it over the bar's.
|
|
165
|
+
- Deprecated, read by nothing and removed in a later release: the message key `views.grid.edit-value` ("Edit value"). A writable long text edits in the text body, and the grid's read-only long-text panel names its box `views.grid.value`. A wording record that names the key still compiles, and ViewKit never shows it; delete that line.
|
|
166
|
+
|
|
167
|
+
### Fixed
|
|
168
|
+
|
|
169
|
+
- `viewkitjs/views/panels/react`, `viewkitjs/views/list`: a list built with `severalSorts={false}` shows its changed sort on the filter bar ("Sorted by Name") with Clear · Save, as a several-sorts list does, and Clear brings back the saved sort. Its row's Sort lights while the sort differs from the saved view, as the several-sorts row's has since VK-1046, not whenever the list sorts other than its default. With `bar: "always"` its sort stands on the bar at rest too. A list with nothing to sort by draws no sort and no separator on the bar.
|
|
170
|
+
- `viewkitjs/views/panels/react`: with no column a rule may name (every column one the list can't filter), the filter bar draws no + and no empty Filter, which opened a list of greyed fields alone; a set-aside filter still stands. The row's Filter and the phone's sheet already drew nothing then.
|
|
171
|
+
- `viewkitjs/views/grid`: a row's ⋯ no longer fades out under the row menu it opened. While the menu is open, from the ⋯, a right-click or the menu key, the row keeps its hover tint and its ⋯ wherever the pointer goes, and both go when the menu closes.
|
|
172
|
+
- `viewkitjs/views/field-row`: a Tab pressed at once after a pick by the keys in a field row moves on from that row. The pick's editor still fades out for a moment, and a Tab in that gap used to leave the focus back on the row the pick closed (a deal's Stage, where Outcome was next). The Tab is now taken from the row's button once the button is back, so the focus lands on the next control (Shift-Tab, the one before), as a later Tab does. With no Tab, the focus still comes back to the row, and a press on it while it saves still opens nothing.
|
|
173
|
+
- `viewkitjs/views/panels/react`: `ViewPicker` with no view yet opens ViewKit's New view form from its + where the axis hands `verbs` and the components map draws `ViewMenu`, as the views row's + does. On a phone, a ready List whose views store holds no view drew a New view button that did nothing.
|
|
174
|
+
- `viewkitjs/views/styles.unlayered.css`: 0.20.0 called it the same look outside any layer. Only ViewKit's classes sit outside any layer: its reset stays in `base › viewkit`, its `--vk-*` defaults in `components › viewkit` and Tailwind's `@property` fallbacks in `properties`, so an app's own reset and colours still win.
|
|
175
|
+
- `viewkitjs/views/controls`: `CONTROLS.QuickFiltersBody` says "Nothing to pick." (`views.panels.filter-no-options`, in your words) for a field with no value to pick, where it drew an empty list. A search that finds nothing still says "Nothing matches.". `QuickFiltersWords` takes `nothing` for those words.
|
|
176
|
+
- `viewkitjs/views/controls`: `CONTROLS.PartsBody`'s range ends now step within the field's limits with ↑ and ↓, on a computer's boxes, its pair and a phone's card. Before, a headcount range stepped below 0 and the save then refused it. An end typed outside the limits is drawn back to them as its box is left, as the number body's box does.
|
|
177
|
+
- `viewkitjs/views/panels`: the quick filters opened in your own host (`hosts.quick`, or `ToolbarQuickFilters`' `host`) on a computer stand under the panels' header again, their name and a ✕ that closes the host, as the plain panel drew them before `QuickFiltersBody` took over. ViewKit's own Popover is unchanged, and so is a phone. Your own `QuickFiltersBody` in such a host stands under that header too. `QuickFiltersPanel` takes `inHost` for a holder of your own.
|
|
178
|
+
- `viewkitjs/views/grid`: a column's menu, a group's ⋯ menu and "+ Add column" hand your `Menu` the rows they were closed on, no longer an empty list, so a `Menu` that plays an exit shows its rows on its way out, and a focus on one of them stays in it until it has gone, then comes back to the header cell, the ⋯ or the +.
|
|
179
|
+
- `viewkitjs/views/grid`: a group band's ⋯ menu stays where it opened while its Show toggles turn figures on and off. Each figure widens the band's label and moves the ⋯; the menu now opens at the ⋯ and holds that place. Your `Menu` is handed an element standing where the ⋯ stood as its `anchor`, no longer the ⋯ itself.
|
|
180
|
+
|
|
8
181
|
## [0.34.0] — 2026-12-03
|
|
9
182
|
|
|
10
183
|
### Added
|
package/MIGRATION.md
CHANGED
|
@@ -590,6 +590,9 @@ The Picker (`CONTROLS.Picker`, `CONTROLS.FieldsBody`):
|
|
|
590
590
|
| `views.picker.back` | Back to {label} |
|
|
591
591
|
| `views.picker.row-actions` | Actions for {label} |
|
|
592
592
|
| `views.picker.you` | you |
|
|
593
|
+
| `views.picker.remove` | Remove |
|
|
594
|
+
| `views.picker.show-every` | Show every {label} |
|
|
595
|
+
| `views.picker.show-all` | Show every choice |
|
|
593
596
|
|
|
594
597
|
The Values editor (`CONTROLS.ValuesBody`):
|
|
595
598
|
|
|
@@ -698,6 +701,7 @@ A view's menu and what it opens (`CONTROLS.ViewsListBody` where the axis hands `
|
|
|
698
701
|
| `views.panels.view-copy-name` | Copy of {name} |
|
|
699
702
|
| `views.panels.view-delete-stays` | The {records} in it stay as they are. |
|
|
700
703
|
| `views.panels.view-delete-goes` | The view goes for everyone who uses it. |
|
|
704
|
+
| `views.panels.view-delete-goes-own` | The view goes only for you. |
|
|
701
705
|
| `views.panels.view-columns` | {layout} columns |
|
|
702
706
|
|
|
703
707
|
The filter editor (`CONTROLS.FilterBody`, `CONTROLS.FilterPartBody`; its other words are ViewKit's own editor's keys, worded already):
|
|
@@ -715,6 +719,7 @@ The filter editor (`CONTROLS.FilterBody`, `CONTROLS.FilterPartBody`; its other w
|
|
|
715
719
|
| `views.panels.filter-checked` | Checked |
|
|
716
720
|
| `views.panels.filter-unchecked` | Unchecked |
|
|
717
721
|
| `views.panels.filter-kit-way` | the kit's way in its words, by its value: is any of, less than, any part between… |
|
|
722
|
+
| `views.panels.filter-relation-rows` | Which related records |
|
|
718
723
|
|
|
719
724
|
The group editor (`CONTROLS.GroupBody`; its other words are ViewKit's own group pages' and the sort editor's keys, worded already):
|
|
720
725
|
|
|
@@ -742,9 +747,11 @@ Customize (`CONTROLS.CustomizeBody`; its other words are ViewKit's own Customize
|
|
|
742
747
|
| `views.panels.customize-no-column` | No column is named “{words}” |
|
|
743
748
|
| `views.panels.customize-always-shown` | Always shown |
|
|
744
749
|
| `views.panels.customize-view-name` | The view's name |
|
|
750
|
+
| `views.panels.customize-unavailable` | Not available |
|
|
745
751
|
| `views.panels.customize-layout-button` | Layout: {name} |
|
|
746
752
|
| `views.panels.customize-layout-settings` | {name} settings |
|
|
747
753
|
| `views.panels.customize-share` | Share the view |
|
|
754
|
+
| `views.panels.view-stale-own` | This view changed since you started. |
|
|
748
755
|
| `views.panels.column-settings` | {label} settings |
|
|
749
756
|
|
|
750
757
|
The quick filters (`CONTROLS.QuickFiltersBody`; its other words are ViewKit's own quick filters' keys, worded already):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewkitjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "ViewKit — typed fields, the grid and its editors, and a list's SQL for record lists, in one package: viewkitjs/fields, viewkitjs/views and viewkitjs/postgres. By Sheaf.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
package/views/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Then mount `ViewsProvider` once with your primitives and draw `GridTable` from `
|
|
|
54
54
|
The package ships its documentation in `docs/`, starting at [docs/index.md](./docs/index.md). Every example in it is compiled and run against the packed package before each release.
|
|
55
55
|
|
|
56
56
|
- [Getting started](./docs/getting-started.md): install, fields bound to your rows, columns, your primitives, the provider and the grid.
|
|
57
|
-
- [Install](./docs/install.md): the
|
|
57
|
+
- [Install](./docs/install.md): the six steps an app writes for a whole list, the four things it shapes, and your theme.
|
|
58
58
|
|
|
59
59
|
Guides:
|
|
60
60
|
|
|
@@ -5,9 +5,10 @@ const SIZE = {
|
|
|
5
5
|
chip: "h-4 w-4 -my-0.5 shrink-0 rounded-full object-cover",
|
|
6
6
|
glyph: "h-(--vk-glyph,0.875rem) w-(--vk-glyph,0.875rem) shrink-0 rounded-full object-cover",
|
|
7
7
|
};
|
|
8
|
+
const PIXELS = "shrink-0 rounded-full object-cover";
|
|
8
9
|
export function DefaultAvatar({ avatarUrl, size, fallback }) {
|
|
9
10
|
const [broken, setBroken] = useState(false);
|
|
10
11
|
if (!avatarUrl || broken)
|
|
11
12
|
return _jsx(_Fragment, { children: fallback ?? null });
|
|
12
|
-
return (_jsx("img", { src: avatarUrl, alt: "", "data-slot": "vk-avatar", className: SIZE[size], draggable: false, onError: () => setBroken(true) }));
|
|
13
|
+
return (_jsx("img", { src: avatarUrl, alt: "", "data-slot": "vk-avatar", className: typeof size === "number" ? PIXELS : SIZE[size], style: typeof size === "number" ? { width: size, height: size } : undefined, draggable: false, onError: () => setBroken(true) }));
|
|
13
14
|
}
|
|
@@ -6,4 +6,4 @@ import type { ViewsRowMenuProps } from "./types.js";
|
|
|
6
6
|
* Delete, and the grid's `row-delete` under `menus.row`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function deleteAsking({ messages, ports }: Pick<ReturnType<typeof useViews>, "messages" | "ports">, onDelete: (rowId: string) => Promise<void>, rowId: string, deleteLabel?: string): void;
|
|
9
|
-
export declare function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }: ViewsRowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel, onOpenChange }: ViewsRowMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useState } from "react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useViews } from "../provider/context.js";
|
|
5
5
|
const OPEN_GRACE_MS = 300;
|
|
6
6
|
function inGraceSince(openedAt) {
|
|
@@ -50,7 +50,7 @@ export function deleteAsking({ messages, ports }, onDelete, rowId, deleteLabel)
|
|
|
50
50
|
return new Promise((resolve) => resolve(onDelete(rowId))).catch(() => ports.toast.error(messages({ key: "views.menus.row-delete-failed" })));
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel }) {
|
|
53
|
+
export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, deleteLabel, onOpenChange }) {
|
|
54
54
|
const views = useViews();
|
|
55
55
|
const { components, icons, messages } = views;
|
|
56
56
|
const { Menu } = components;
|
|
@@ -91,6 +91,18 @@ export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, del
|
|
|
91
91
|
const rows = toMenuItems(entries).map((row) => (row.onSelect ? { ...row, onSelect: guarded(row.onSelect) } : row));
|
|
92
92
|
if (point && rows.length === 0)
|
|
93
93
|
setPoint(null);
|
|
94
|
+
const open = point !== null && rows.length > 0;
|
|
95
|
+
const told = useRef(false);
|
|
96
|
+
const tell = useRef(onOpenChange);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
tell.current = onOpenChange;
|
|
99
|
+
});
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (told.current === open)
|
|
102
|
+
return;
|
|
103
|
+
told.current = open;
|
|
104
|
+
tell.current?.(open);
|
|
105
|
+
}, [open]);
|
|
94
106
|
return (_jsxs("div", { ref: wrapper, "data-slot": "vk-row-menu", onPointerDownCapture: (event) => {
|
|
95
107
|
lastPress.current = event.pointerType;
|
|
96
108
|
}, onKeyDownCapture: () => {
|
|
@@ -111,7 +123,7 @@ export function DefaultRowMenu({ children, rowId, items, openHref, onDelete, del
|
|
|
111
123
|
if (wrapper.current?.contains(event.target))
|
|
112
124
|
return;
|
|
113
125
|
event.stopPropagation();
|
|
114
|
-
}, children: [children, _jsx(Menu, { open:
|
|
126
|
+
}, children: [children, _jsx(Menu, { open: open, onOpenChange: (open) => {
|
|
115
127
|
if (!open)
|
|
116
128
|
setPoint(null);
|
|
117
129
|
}, anchor: point, items: rows, label: messages({ key: "views.menus.row-menu" }) })] }));
|
|
@@ -10,6 +10,7 @@ import { DefaultLoadMore } from "./LoadMore.js";
|
|
|
10
10
|
import { DefaultPlatformMark } from "./PlatformMark.js";
|
|
11
11
|
import { DefaultRangeCalendar } from "./RangeCalendar.js";
|
|
12
12
|
import { DefaultRelationLink } from "./RelationLink.js";
|
|
13
|
+
import { DefaultRelationChip } from "./RelationChip.js";
|
|
13
14
|
import { DefaultRelationRoles } from "./RelationRoles.js";
|
|
14
15
|
import { DefaultCellMore } from "./CellMore.js";
|
|
15
16
|
import { DefaultRow, DefaultRowContent } from "./Row.js";
|
|
@@ -32,6 +33,7 @@ export const DEFAULT_VIEWS_ATOMS = {
|
|
|
32
33
|
CommandMenu: DefaultCommandMenu,
|
|
33
34
|
RelationLink: DefaultRelationLink,
|
|
34
35
|
RelationRoles: DefaultRelationRoles,
|
|
36
|
+
RelationChip: DefaultRelationChip,
|
|
35
37
|
CellMore: DefaultCellMore,
|
|
36
38
|
Loading: DefaultLoading,
|
|
37
39
|
LoadMore: DefaultLoadMore,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType, KeyboardEvent, MouseEventHandler, MouseEvent as ReactMouseEvent, PointerEvent as ReactPointerEvent, ReactElement, ReactNode, Ref, RefObject } from "react";
|
|
1
|
+
import type { ComponentType, HTMLAttributes, KeyboardEvent, MouseEventHandler, MouseEvent as ReactMouseEvent, PointerEvent as ReactPointerEvent, ReactElement, ReactNode, Ref, RefObject } from "react";
|
|
2
2
|
import type { LinkPlatform, RelationValue } from "viewkitjs/fields";
|
|
3
3
|
import type { CategoryColor } from "viewkitjs/fields/design/category-colors";
|
|
4
4
|
import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
|
|
@@ -57,7 +57,8 @@ export type ViewsTickBoxProps = {
|
|
|
57
57
|
className?: string;
|
|
58
58
|
};
|
|
59
59
|
/** A person's or a record's picture: a user's, a relation's and an actor's chip, and the name's when the list
|
|
60
|
-
* hands the row's avatar
|
|
60
|
+
* hands the row's avatar; and, where the provider's `panelControls` names `Avatar`, every record's mark ViewKit's panels draw
|
|
61
|
+
* (VK-1044). Data only, never ViewKit's look. Paint only: whatever wraps it owns the click. */
|
|
61
62
|
export type ViewsAvatarProps = {
|
|
62
63
|
/** Whose picture: the name the chip or the row shows, for initials. */
|
|
63
64
|
label: string;
|
|
@@ -66,8 +67,10 @@ export type ViewsAvatarProps = {
|
|
|
66
67
|
/** The record's kind as your app names it, for the avatar's shape: a relation's `entity`, `user` for a member,
|
|
67
68
|
* an actor's type. */
|
|
68
69
|
kind?: string;
|
|
69
|
-
/** `chip`: inside a chip, 16px by default. `glyph`: before the name, at `--vk-glyph`.
|
|
70
|
-
|
|
70
|
+
/** `chip`: inside a chip, 16px by default. `glyph`: before the name, at `--vk-glyph`. A number: a record's mark inside
|
|
71
|
+
* ViewKit's panels (the Picker's rows, the links editor, the bulk bar, the quick filters), in pixels, where the provider's
|
|
72
|
+
* `panelControls` names `Avatar` (VK-1044): 20 on a computer's rows, 24 on a phone's, 40 in a phone's Picker. */
|
|
73
|
+
size: "chip" | "glyph" | 20 | 24 | 32 | 40;
|
|
71
74
|
/** The glyph the chip or the name draws with no picture. The default draws it when the picture is missing or
|
|
72
75
|
* fails to load; yours may draw it for a kind it doesn't dress (an automation, say). */
|
|
73
76
|
fallback?: ReactNode;
|
|
@@ -145,6 +148,34 @@ export type ViewsRelationLinkProps = {
|
|
|
145
148
|
relation: RelationValue;
|
|
146
149
|
children: ReactNode;
|
|
147
150
|
};
|
|
151
|
+
/** What a mentioned record's chip hands the host's link it draws itself as (`ViewsRelationChipProps.render`): its own element's
|
|
152
|
+
* props, its words and mark in `children`, its class, its `data-*`, its ref. The link spreads them on its own element. */
|
|
153
|
+
export type ViewsRelationChipLinkProps = HTMLAttributes<HTMLElement> & {
|
|
154
|
+
ref?: Ref<HTMLElement>;
|
|
155
|
+
children?: ReactNode;
|
|
156
|
+
[data: `data-${string}`]: unknown;
|
|
157
|
+
};
|
|
158
|
+
/** A mentioned record (VK-1053): every relation ViewKit draws, in a table's cell (one and many, and the +N list), a field
|
|
159
|
+
* row's value and `renderFieldValue` (a highlight), and a user field's chip, where the provider's `panelControls` names
|
|
160
|
+
* `RelationChip`. ViewKit places it and hands its data; your app draws it. Left out, ViewKit draws its own chip, as before. */
|
|
161
|
+
export type ViewsRelationChipProps = {
|
|
162
|
+
/** The record: its `id`, its `label`, its kind as your app names it (`entity`: a relation's kind, `user` for a member) and
|
|
163
|
+
* its picture (`avatarUrl`), as the value holds them. */
|
|
164
|
+
relation: RelationValue;
|
|
165
|
+
/** A link's roles, in order, each its stored value and its label: on a `many` relation that declares `links`; else none. */
|
|
166
|
+
roles: readonly {
|
|
167
|
+
value: string;
|
|
168
|
+
label: string;
|
|
169
|
+
}[];
|
|
170
|
+
/** `chip`: in a table's cell or a highlight. `row`: a field row's value (Record details). */
|
|
171
|
+
size: "chip" | "row";
|
|
172
|
+
/** 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
|
|
173
|
+
* element (a button that opens the record, the app's `RelationLink`, a host's own wrap) with them. Absent: an inert fact
|
|
174
|
+
* (no link, or a host whose own element owns the click). ViewKit never makes one up. */
|
|
175
|
+
render?: (props: ViewsRelationChipLinkProps) => ReactElement;
|
|
176
|
+
/** ViewKit's own chip, as it would draw it here, link included: for a kind your chip doesn't dress. */
|
|
177
|
+
fallback: ReactNode;
|
|
178
|
+
};
|
|
148
179
|
/** A link's roles, drawn inside its chip after the record's name: each role's stored value and its label (the
|
|
149
180
|
* field's `links.roles`, else the value itself). Handed only when the link holds one or more, on a many relation
|
|
150
181
|
* that declares `links`. The default draws their labels in the subtle colour after a middle dot; an app swaps in
|
|
@@ -243,6 +274,10 @@ export type ViewsRowMenuProps = {
|
|
|
243
274
|
* can't select, and there from the first render where it can, so a long-press is armed before any press.
|
|
244
275
|
* The default doesn't use it: on a phone the ⋯ is the way in. */
|
|
245
276
|
onToggleSelect?: () => void;
|
|
277
|
+
/** Tell it when the menu opens (`true`) and when it closes (`false`): while it is open, the grid draws the row it is
|
|
278
|
+
* aimed at as under the pointer (`data-hovered`, its tint and its ⋯), wherever the pointer goes. ViewKit's own
|
|
279
|
+
* calls it; an atom of yours that doesn't leaves the row to the real pointer, as before. */
|
|
280
|
+
onOpenChange?: (open: boolean) => void;
|
|
246
281
|
};
|
|
247
282
|
/** Picks one value: its label, a second line, a right-hand `meta` (a sample, a count), the check when chosen. */
|
|
248
283
|
export type ViewsChoiceRowProps = {
|
|
@@ -490,6 +525,7 @@ export type ViewsAtoms = {
|
|
|
490
525
|
CommandMenu: ComponentType<ViewsCommandMenuProps>;
|
|
491
526
|
RelationLink: ComponentType<ViewsRelationLinkProps>;
|
|
492
527
|
RelationRoles: ComponentType<ViewsRelationRolesProps>;
|
|
528
|
+
RelationChip: ComponentType<ViewsRelationChipProps>;
|
|
493
529
|
CellMore: ComponentType<ViewsCellMoreProps>;
|
|
494
530
|
Loading: ComponentType<ViewsLoadingProps>;
|
|
495
531
|
LoadMore: ComponentType<ViewsLoadMoreProps>;
|
|
@@ -3,18 +3,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { CHIP_INTERACTIVE } from "../internal/chip.js";
|
|
4
4
|
import { cx } from "../internal/cx.js";
|
|
5
5
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
6
|
+
import { withRelationLink } from "../display/relation-link.js";
|
|
6
7
|
import { useViews } from "../provider/context.js";
|
|
7
8
|
export function listRelationWrap(opts) {
|
|
8
9
|
if (opts?.slotOwnsClick)
|
|
9
10
|
return undefined;
|
|
10
11
|
const onOpenRelation = opts?.onOpenRelation;
|
|
11
12
|
if (onOpenRelation) {
|
|
12
|
-
return function openRelationWrap(relation, chip) {
|
|
13
|
+
return withRelationLink(function openRelationWrap(relation, chip) {
|
|
13
14
|
return (_jsx("button", { type: "button", "data-no-nav": true, "data-slot": "vk-relation-link", title: relation.label, onClick: (event) => {
|
|
14
15
|
event.stopPropagation();
|
|
15
16
|
onOpenRelation(relation);
|
|
16
17
|
}, className: cx(ELEMENT_RESET, CHIP_INTERACTIVE), children: chip }));
|
|
17
|
-
}
|
|
18
|
+
}, (relation) => function openRelationLink({ className, onClick, ref, ...props }) {
|
|
19
|
+
return (_jsx("button", { ref: ref, type: "button", "data-no-nav": true, "data-slot": "vk-relation-link", title: relation.label, ...props, className: cx(ELEMENT_RESET, className), onClick: (event) => {
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
onClick?.(event);
|
|
22
|
+
onOpenRelation(relation);
|
|
23
|
+
} }));
|
|
24
|
+
});
|
|
18
25
|
}
|
|
19
26
|
return function appRelationWrap(relation, chip) {
|
|
20
27
|
return _jsx(AppRelationLink, { relation: relation, children: chip });
|