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/views/docs/install.md
CHANGED
|
@@ -1,106 +1,200 @@
|
|
|
1
1
|
# Install
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
3
|
+
A whole list (its toolbar, grid, saved views, edits and undo, on a computer and a phone) is the six steps below, and
|
|
4
|
+
nothing else. ViewKit's own test app runs exactly this at `/proof`: 115 lines in seven files (`test-app/app/proof/` and
|
|
5
|
+
its root layout, in the repository), which CI holds under 150 and installs into a fresh app from the packed package.
|
|
6
|
+
|
|
7
|
+
## 1. Pin it
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add viewkitjs zod @base-ui/react @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
One package holds the fields, the views and the server's part; `react` and `react-dom` 19 are peers your app has.
|
|
14
|
+
`@base-ui/react` (1.6 or later) is what `CONTROLS`, ViewKit's default controls, stand on. The dnd-kit packages draw
|
|
15
|
+
what drags; `viewkitjs/views/list` loads them with `import()`, so your bundler may want them even for `fetchSource`
|
|
16
|
+
alone. ESM only, Node 20 or later. The server's part reads Postgres through your own client (`pg` in the proof).
|
|
17
|
+
|
|
18
|
+
## 2. Import the stylesheet
|
|
19
|
+
|
|
20
|
+
```css
|
|
21
|
+
@import "viewkitjs/views/styles.css";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
In your root layout: the whole look, with no Tailwind. [Your theme](#your-theme) makes the colours yours.
|
|
25
|
+
|
|
26
|
+
## 3. Mount the provider
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
"use client";
|
|
30
|
+
import type { ReactNode } from "react";
|
|
31
|
+
import { CONTROLS } from "viewkitjs/views/controls";
|
|
32
|
+
import { ViewsProvider } from "viewkitjs/views/react";
|
|
33
|
+
|
|
34
|
+
export function Views({ children }: { children: ReactNode }) {
|
|
35
|
+
return <ViewsProvider components={CONTROLS}>{children}</ViewsProvider>;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Once, above every list. `CONTROLS` fills every control and carries its atoms (`CONTROL_ATOMS`); the icons, the ports
|
|
40
|
+
and the conventions (`en-US`, `UTC`) have defaults.
|
|
41
|
+
|
|
42
|
+
## 4. Define the fields
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { defineFields, defineIndex } from "viewkitjs/fields";
|
|
46
|
+
|
|
47
|
+
export const DEAL_FIELDS = defineFields({
|
|
48
|
+
entity: "deal",
|
|
49
|
+
identity: "name",
|
|
50
|
+
fields: {
|
|
51
|
+
name: { type: "text", label: "Name", required: true },
|
|
52
|
+
stage: { type: "status", label: "Stage", options: [{ value: "new", label: "New", slot: "pending" }, { value: "won", label: "Won", slot: "success" }] },
|
|
53
|
+
seats: { type: "number", label: "Seats", validation: { integer: true } },
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type Deal = { id: string; name: string; stage: string; seats: number };
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The browser and the server read the same fields. Every field is a column, in this order, bound by its key.
|
|
61
|
+
|
|
62
|
+
## 5. Draw the list
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { List, fetchSource, type ListChange } from "viewkitjs/views/list";
|
|
66
|
+
|
|
67
|
+
const deals = fetchSource<Deal>("/api/deals/list");
|
|
68
|
+
|
|
69
|
+
async function save({ id, values }: ListChange<Deal>) {
|
|
70
|
+
const answer = await fetch(`/api/deals/${id}`, { method: "PATCH", body: JSON.stringify(values) });
|
|
71
|
+
if (!answer.ok) throw new Error("The deal wasn't saved.");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function Deals() {
|
|
75
|
+
return <List id="deals" fields={DEAL_FIELDS} source={deals} save={save} />;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`source` asks your server a page at a time; `rows` takes rows you already hold. `save`, your own route, is one call per
|
|
80
|
+
record: a throw takes the edit back. Without it the list is read-only.
|
|
81
|
+
|
|
82
|
+
## 6. Answer it on the server
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { EVERY_FIELD, listHandler, sql, type Run } from "viewkitjs/postgres";
|
|
86
|
+
import { buildFieldMap, type AppStorage } from "viewkitjs/postgres/definitions";
|
|
87
|
+
|
|
88
|
+
// Your connection (`pg`'s Pool) and your session, where the proof reads a cookie.
|
|
89
|
+
declare const pool: { query(text: string, values: unknown[]): Promise<{ rows: Record<string, unknown>[] }> };
|
|
90
|
+
declare function workspaceOf(): Promise<string | null>;
|
|
91
|
+
|
|
92
|
+
const storage: AppStorage = { defaults: { keyStored: "text" }, kinds: { deal: { table: "deals", key: "id", softDelete: null } } };
|
|
93
|
+
const run: Run = async (query) => (await pool.query(query.text, [...query.values])).rows;
|
|
94
|
+
|
|
95
|
+
// app/api/deals/list/route.ts
|
|
96
|
+
export const POST = listHandler({
|
|
97
|
+
map: buildFieldMap({ index: defineIndex([{ entity: "deal", identity: "name", fields: DEAL_FIELDS }]), storage, kind: "deal" }).map,
|
|
98
|
+
run,
|
|
99
|
+
access: async () => {
|
|
100
|
+
const workspace = await workspaceOf();
|
|
101
|
+
if (!workspace) return null; // 401
|
|
102
|
+
return { access: { deal: (row) => sql`${row.column("workspace")} = ${workspace}` }, readable: EVERY_FIELD };
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
One route answers every request the list makes. `access` is read per request from your own session: which rows of each
|
|
108
|
+
table, and which fields, the reader may read ([Answering a list's requests](../../postgres/docs/guides/list-handler.md)).
|
|
109
|
+
|
|
110
|
+
## What an app writes
|
|
111
|
+
|
|
112
|
+
| What | Required | The rest, each optional |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `<ViewsProvider>` | `components`, `children` | [The provider](guides/the-provider.md) |
|
|
115
|
+
| `<List>` | `id`, `fields`, `rows` or `source` | [The ready List](reference/list.md#the-ready-list) |
|
|
116
|
+
| `listHandler` | `map`, `run`, `access` | [Answering a list's requests](../../postgres/docs/guides/list-handler.md) |
|
|
117
|
+
|
|
118
|
+
## The four things an app shapes
|
|
119
|
+
|
|
120
|
+
**Every size and colour.** Each is a `--vk-*` token with a default: the colours below, and each control's sizes, radii,
|
|
121
|
+
gaps, shadows and timings on its own page ([the controls' tokens](contract.md#the-controls-tokens)). The toolbar's line
|
|
122
|
+
reads `--vk-toolbar-line-py`, `--vk-toolbar-line-gap` and `--vk-toolbar-line-w`, and a phone list's foot
|
|
123
|
+
`--vk-toolbar-foot`. Each piece's options and looks are on [Looks](guides/looks.md). Every part ViewKit draws has a
|
|
124
|
+
public name, its `data-slot` (and a part's `data-key`), and every state a data attribute ([Slots](contract.md#slots),
|
|
125
|
+
[States](contract.md#states)): your stylesheet dresses any of them alone.
|
|
126
|
+
|
|
127
|
+
**Its own controls.** Hand your own over ViewKit's, keeping its atoms:
|
|
128
|
+
`components={{ ...CONTROLS, Button: YourButton }} atoms={CONTROL_ATOMS}`. A map spread from `CONTROLS` carries none
|
|
129
|
+
of its atoms (your own `atoms` lie over `CONTROL_ATOMS`), and in development the provider says so once. `panelControls`
|
|
130
|
+
names which of `Button`, `Select`, `Menu`, `Popover`, `Input` and `Calendar` the panels and the field editors draw with
|
|
131
|
+
yours ([your own controls inside the panels](guides/the-provider.md#your-own-controls-inside-the-panels)). A toolbar
|
|
132
|
+
part takes its own `button` or `className` through `toolbarParts`, and ⋯ its own through `overflow`
|
|
133
|
+
([Parts as data](reference/list.md#parts-as-data)).
|
|
134
|
+
|
|
135
|
+
**Each menu's and panel's content and order.** Every menu is data: `menus={{ column: (items, ctx) => items }}`, with
|
|
136
|
+
`menu.drop`, `menu.rename`, `menu.add` and `menu.move` over its items' public keys; the proof reshapes the column menu
|
|
137
|
+
that way ([Menus as data](reference/list.md#menus-as-data)). Each panel's body is a control of the map (`CustomizeBody`,
|
|
138
|
+
`SortBody`, `FilterBody`, …), yours to replace ([The components map](contract.md#the-components-map)).
|
|
139
|
+
|
|
140
|
+
**The layout.** `toolbarParts` places each toolbar part on its line and side, with its words, and its panel where you
|
|
141
|
+
want it. `customizeIn: "pane"` opens Customize in a pane at the list's right edge. For another arrangement, `ListRoot`
|
|
142
|
+
holds the list's state and ViewKit's parts (`ListToolbar`, `ListGrid`, `ListBulkBar`) stand where you put them;
|
|
143
|
+
`ListSlot` and `ListFill` draw one outside the list's tree, in your page's header ([A list's root](reference/list.md#a-lists-root)).
|
|
144
|
+
|
|
145
|
+
## Your theme
|
|
146
|
+
|
|
147
|
+
The stylesheet's rules sit in `components › viewkit`, a layer inside `components`, and the file declares Tailwind's
|
|
148
|
+
order (`theme, base, components, utilities`), so your components rules and utilities win over ViewKit's whatever the
|
|
149
|
+
order you import in. Its reset touches only ViewKit's elements and what your components draw inside them, in
|
|
150
|
+
`base › viewkit`, under your own base styles. The defaults are the Outright look, light, and dark under `.dark` or
|
|
151
|
+
`[data-theme="dark"]`. ViewKit's classes still carry Tailwind's names (`h-8`, `rounded-md`): where your own Tailwind
|
|
152
|
+
writes one, yours wins on ViewKit's element too, until each piece moves to its own `vk-*` classes.
|
|
153
|
+
|
|
154
|
+
An app whose reset or styles sit in no layer (Tailwind 3, a plain CSS reset) imports
|
|
155
|
+
`viewkitjs/views/styles.unlayered.css` instead: only ViewKit's classes sit outside any layer; its reset stays in
|
|
156
|
+
`base › viewkit`, its `--vk-*` defaults in `components › viewkit`, and Tailwind's fallbacks for browsers without
|
|
157
|
+
`@property` in `properties`, so your own reset and colours still win. It declares no layer order: a Tailwind 4 app takes
|
|
158
|
+
`styles.css`.
|
|
159
|
+
|
|
160
|
+
**Make the colours yours (optional).** Declare the colours in no layer, or in a layer above `components`. On stock shadcn
|
|
161
|
+
tokens:
|
|
162
|
+
|
|
163
|
+
```css
|
|
164
|
+
:root {
|
|
165
|
+
--vk-fg: var(--foreground);
|
|
166
|
+
--vk-fg-subtle: var(--muted-foreground);
|
|
167
|
+
--vk-fg-subtlest: var(--muted-foreground);
|
|
168
|
+
--vk-fg-brand: var(--primary);
|
|
169
|
+
--vk-fg-selected: var(--primary);
|
|
170
|
+
--vk-fg-on-brand: var(--primary-foreground);
|
|
171
|
+
--vk-ground: var(--background);
|
|
172
|
+
--vk-overlay: var(--popover);
|
|
173
|
+
--vk-hovered: var(--accent);
|
|
174
|
+
--vk-pressed: var(--accent);
|
|
175
|
+
--vk-neutral: var(--muted);
|
|
176
|
+
--vk-neutral-hovered: var(--accent);
|
|
177
|
+
--vk-brand: var(--primary);
|
|
178
|
+
--vk-brand-subtlest: color-mix(in oklab, var(--primary) 12%, var(--background));
|
|
179
|
+
--vk-danger: var(--destructive);
|
|
180
|
+
--vk-danger-subtlest: color-mix(in oklab, var(--destructive) 12%, var(--background));
|
|
181
|
+
--vk-border: var(--border);
|
|
182
|
+
--vk-border-subtle: var(--border);
|
|
183
|
+
--vk-border-bold: var(--ring);
|
|
184
|
+
--vk-border-brand: var(--primary);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`.dark` needs nothing more. The status and category hues (`--vk-success`, `--vk-label-blue`, …) are optional
|
|
189
|
+
([Tokens](contract.md#tokens)); `--vk-gutter`, onto your pages' side padding, lines the grid's rows up with them.
|
|
190
|
+
|
|
191
|
+
**Or let your Tailwind compile it.** A Tailwind 4 app can draw ViewKit on its own scale: leave the import out and add,
|
|
192
|
+
to the stylesheet that imports Tailwind, `@source "../../node_modules/viewkitjs/views";` (the path from where it sits),
|
|
193
|
+
then `@import "viewkitjs/views/grid.css";` after Tailwind for the grid's look. Every button, input and link ViewKit
|
|
194
|
+
draws resets itself, so no base reset is needed. Nothing then declares ViewKit's tokens for you: the colour block above
|
|
195
|
+
is required, the grid's look tokens (`VK_GRID_TOKENS`) and, with `CONTROLS`, every one of the controls' tokens
|
|
196
|
+
(`VK_CONTROL_TOKENS`: spacing, type, radii, motion, shadows, the status tints), which the controls read with no
|
|
197
|
+
fallback. Their defaults are the `:where(:root)` blocks of `viewkitjs/views/styles.css`: copy them, or the controls
|
|
198
|
+
draw unstyled.
|
|
199
|
+
|
|
200
|
+
From here, [getting started](getting-started.md) builds a grid by hand, from the provider up.
|
|
@@ -4,7 +4,7 @@ Import from `viewkitjs/views/controls` to draw ViewKit's default controls: the O
|
|
|
4
4
|
|
|
5
5
|
## The defaults
|
|
6
6
|
|
|
7
|
-
- `CONTROLS` — the components map's defaults, for each control an app leaves out: each control below that fills a slot of the map. An app spreads it first and its own controls after, `components={{ ...CONTROLS, ...own }}
|
|
7
|
+
- `CONTROLS` — the components map's defaults, for each control an app leaves out: each control below that fills a slot of the map. Handed as it stands, `components={CONTROLS}`, it brings `CONTROL_ATOMS` too, under the provider's `atoms`. An app spreads it first and its own controls after, and hands the atoms beside it, which a spread doesn't carry: `components={{ ...CONTROLS, ...own }} atoms={CONTROL_ATOMS}` (or `{{ ...CONTROL_ATOMS, ...yours }}`). Without them the toolbar draws ViewKit's plain button and the Toolbar's look options stop applying; in development the provider says so once, where a map spread from `CONTROLS` comes with no atoms of the kit's and no `ToolbarButton` of yours. Its `Button` draws ViewKit's buttons (`variant`, `size`) as the kit's Button's kinds and sizes, stands a glyph handed before the words as the Button's icon, and one handed after them as its end icon. Its `AppIcon` draws ViewKit's own glyph of each name (`CONTROL_ICONS`), and nothing for a name it doesn't draw; a provider handed no `icons` draws every meaning through it. Its `Markdown` draws the stored text as it stands, its line breaks kept, with no renderer. Its `Button`, `Select`, `Menu`, `Popover`, `Input` and `Calendar` are ViewKit's own: named in the provider's `panelControls`, they still draw the panels and the field editors exactly as without it.
|
|
8
8
|
- `CONTROL_ICONS` — ViewKit's default glyphs by meaning, a `ViewsIcons` over every `ICON_NAMES` meaning, each a Tabler icon as the Outright kit draws it (a line of 2 in the colour of its words; the carets filled; `loading` the Spinner): what `CONTROLS.AppIcon` draws, for an app with an `AppIcon` of its own that keeps ViewKit's glyphs, `icons={CONTROL_ICONS}`.
|
|
9
9
|
- `leadingGlyph` — `leadingGlyph(children, glyphs)`: a glyph before a button's words (an svg, or one of the app's icons or its `AppIcon` in `glyphs`) as `icon`, one after them as `iconEnd`, and the words as `label`; a glyph alone, or another component, stays `{ label }`.
|
|
10
10
|
|
|
@@ -83,7 +83,7 @@ Import from `viewkitjs/views/controls` to draw ViewKit's default controls: the O
|
|
|
83
83
|
|
|
84
84
|
## The bottom Sheet
|
|
85
85
|
|
|
86
|
-
- `Sheet` — what rises from the bottom of the phone, in a `form` (`full`, `floating`, `blend`, `edge`) and at `stops`, on Base UI's drawer: the drag, focus, Escape and the dim, and a settle on a spring that starts from the finger's speed. What it holds is poured in. `standing` keeps it in its `container`, a screen on a page. It says why it closed. `CONTROLS.Sheet` draws ViewKit's sheets with it, the editor's ✕ (or Back) and ✓ in its head; its height is the `snap` asked (`auto` the `edge` form, as tall as its content; `half` the `blend` form, opening at half; `peek` opening at the small stop; `full`, and none, to the top), a title that isn't words is drawn as handed (its name to screen readers still the label), `description` under the title and `className` on the sheet itself, a prop of the Sheet too; its own `data-slot` is drawn on its popup (a phone menu's sheet carries its menu's name).
|
|
86
|
+
- `Sheet` — what rises from the bottom of the phone, in a `form` (`full`, `floating`, `blend`, `edge`) and at `stops`, on Base UI's drawer: the drag, focus, Escape and the dim, and a settle on a spring that starts from the finger's speed. What it holds is poured in. `standing` keeps it in its `container`, a screen on a page. `risen`, mounted open, stands at its stop from its first frame with no rise, for an app drawing a sheet again where one already stood (a window redrawn in another form); closed and opened again, it rises as any does. It says why it closed. `CONTROLS.Sheet` draws ViewKit's sheets with it, the editor's ✕ (or Back) and ✓ in its head; its height is the `snap` asked (`auto` the `edge` form, as tall as its content; `half` the `blend` form, opening at half; `peek` opening at the small stop; `full`, and none, to the top), a title that isn't words is drawn as handed (its name to screen readers still the label), `description` under the title and `className` on the sheet itself, a prop of the Sheet too; its own `data-slot` is drawn on its popup (a phone menu's sheet carries its menu's name).
|
|
87
87
|
- `SheetProps` — its props.
|
|
88
88
|
- `SheetChangeDetails` — why it opened or closed.
|
|
89
89
|
- `SheetForm` — `full`, `floating`, `blend` or `edge`.
|
|
@@ -281,12 +281,12 @@ Their stylesheets are `input.css`, `inline-input.css`, `field.css`, `toggle.css`
|
|
|
281
281
|
|
|
282
282
|
## The Avatar
|
|
283
283
|
|
|
284
|
-
- `Avatar` — who or what a row is about: a person a circle on their tone, a thing, the workspace or an agent a square, which a `colour` stands on one of the label hues (on a phone an agent's bold, the hue under a white letter, as an app's tile); `size` 16 to 64, a photo or logo by `src`, its
|
|
284
|
+
- `Avatar` — who or what a row is about: a person a circle on their tone, a thing, the workspace or an agent a square, which a `colour` stands on one of the label hues (on a phone an agent's bold, the hue under a white letter, as an app's tile); `size` 16 to 64, a photo or logo by `src`, which always wins, its object's `icon` (on a person or a thing drawn by the frame's `mark`, `ground` and `icon-colour`, `AVATAR_LOOKS`; the workspace's and an agent's own mark), `presence` or a `badge` on its corner.
|
|
285
285
|
- `AvatarProps` — its props.
|
|
286
286
|
- `AvatarSize` — its sizes, 16, 20, 24, 32, 40, 56 and 64; a stack takes neither 16 nor 56.
|
|
287
287
|
- `AvatarColour` — a square's own colour: blue, green, amber, red, purple, pink, teal or grey, the Option's list; the square on the hue's fill, what it holds in its strong ink, with no edge.
|
|
288
288
|
- `AvatarPresence` — whether a person is here now: `here` or `away`.
|
|
289
|
-
- `AvatarStack` — several people on one thing, overlapping, the rest a count; with `onPick` one button opening everyone in a Menu (its card rows pinned on a phone), with `addButton` a dashed + after it.
|
|
289
|
+
- `AvatarStack` — several people on one thing, overlapping, the rest a count; with `onPick` one button opening everyone in a Menu (its card rows pinned on a phone), with `addButton` a dashed + after it, named `addLabel` ("Add someone" by default: no map draws the stack, so hand it in your words).
|
|
290
290
|
- `AvatarStackProps` — its props.
|
|
291
291
|
- `AvatarStackPerson` — one person on it.
|
|
292
292
|
- `initials` — a name's initials: the first letters of the first and last names.
|
|
@@ -307,7 +307,7 @@ Their stylesheets are `input.css`, `inline-input.css`, `field.css`, `toggle.css`
|
|
|
307
307
|
- `PickerLead` — the row that leads, where its field leads several.
|
|
308
308
|
- `PickerBoxSearch` — what a box that is its search is handed: its keys and what it holds.
|
|
309
309
|
- `PickerItem` — a row handed to it: its value, words, second line, group, level, menu, count, the words its search also finds (`also`), and its public name (`slot`, a `PartSlot`, VK-988).
|
|
310
|
-
- `PickerAs` — what a row is drawn as: an Option, a Status, an Avatar, a sign or a
|
|
310
|
+
- `PickerAs` — what a row is drawn as: an Option, a Status, an Avatar (its `kind` the record's kind as the app names it, handed to the app's Avatar atom, VK-1044), a sign, a mark, or a chip drawn in place of its words (`{ chip }`: a field's option as its cell draws it; with `removable`, a function of a remove, how it stands held among the search's chips under the look Chips, its × removing it, else the plain Option there).
|
|
311
311
|
- `PickerRow` — a row its list shows.
|
|
312
312
|
- `RowsInput` — what its rows are worked out from.
|
|
313
313
|
- `pickerRows` — what its list shows: the empty row, the headings, the matches, Create, loading more.
|
|
@@ -325,10 +325,10 @@ Their stylesheets are `input.css`, `inline-input.css`, `field.css`, `toggle.css`
|
|
|
325
325
|
## The Select
|
|
326
326
|
|
|
327
327
|
- `Select` — a field to pick one or several from a closed list: the Input's box, its list the Picker under it on a computer and in the full Sheet on a phone; typed into (`searchIn="field"`), with chips, a search, Create, a server search, a clear row; or alone (`opens`), owning no list; its label over the box, or inside it before its value on the outline Button (`labelAt`).
|
|
328
|
-
- `SelectProps` — its props.
|
|
328
|
+
- `SelectProps` — its props, `clearLabel` among them: the × that empties a typed Select, by default the kit's word, which inside ViewKit's panels is your `views.menus.clear` (its chips' × and its chevron likewise say `views.editors.tag-remove` or `views.picker.remove`, and `views.picker.show-every` or `views.picker.show-all`).
|
|
329
329
|
- `SelectListProps` — its props with a list of its own.
|
|
330
330
|
- `SelectAloneProps` — its props alone, owning no list.
|
|
331
|
-
- `SelectItem` — a choice.
|
|
331
|
+
- `SelectItem` — a choice; `avatar` says its mark is the app's own Avatar atom, which a typed field's chip draws again at `chip` (ViewKit's own Avatar is drawn again at 16 with no flag, VK-1044).
|
|
332
332
|
- `SelectShown` — the Select standing open in a page, its list under it.
|
|
333
333
|
- `SelectShownProps` — its props.
|
|
334
334
|
- `toPickerItems` — a Select's choices as the Picker's rows.
|
|
@@ -388,9 +388,9 @@ One of a few choices, all of them in sight, on Base UI's radio group: the arrow
|
|
|
388
388
|
What a list's sort opens, Attio's: the view's rules in order, the first sorting first, three at most, one per field (a place by one of its parts). Every change is handed on as it is made, so the list sorts again at once. Its stylesheet is `viewkitjs/views/controls/sort-editor.css`; its root marks a phone from the device (`data-vk-phone`).
|
|
389
389
|
|
|
390
390
|
- `SortEditor` — the body alone, for a shell that holds only a body (the Popover, Customize's Sort): its props are `SortEditorProps`.
|
|
391
|
-
- `useSortEditor` — the editor's state and its parts (`SortEditorParts`): the `body`, and on a phone the Sheet head's ✕ and ✓, or on a step its Back (`head.onBack`) and its `title`. Its props (`SortEditorProps`): `label`, the `fields` (Picker rows, each with its mark; one leading one level in holds its own), the `rules`, `onRulesChange` (the whole rules, and the set-aside sorts left when one of them is written), `max`, `form` (`computer`, `phone`, or `narrow`: the phone's structure at a computer's sizes, for a narrow place), `onDone`, the fields' `search` words, `aside` (the sorts set aside, `SortAside`s), `fieldOf` (the field a sort key sorts, so a place sorts once by one of its parts), `addSort` (Add sort at a computer's foot, true unless said), `words`, and for a page standing still `lifted`, `opens` (`SortEditorOpens`) and `level`. On a computer each rule is its grip, its field's and its direction's Select, and ×, with Add sort and Clear all sorts at the foot; the set-aside sorts follow, each its field's box dashed in the warning colour with why, its direction greyed, ⋯ holding why, Put back and Delete. On a phone each rule is a card row, its direction under its name; a press turns the body to its direction, Add sort to the fields, a set-aside sort's row to the fields to point it at one: steps of the same sheet, never a sheet on top. The body answers no Escape: its holder's sheet does. Its hook joins this door as `useSortEditor`, and the body alone as `SortEditor`, once VK-727 retires the panels' older sort editor of those names.
|
|
391
|
+
- `useSortEditor` — the editor's state and its parts (`SortEditorParts`): the `body`, and on a phone the Sheet head's ✕ and ✓, or on a step its Back (`head.onBack`) and its `title`. Its props (`SortEditorProps`): `label`, the `fields` (Picker rows, each with its mark; one leading one level in holds its own), the `rules`, `onRulesChange` (the whole rules, and the set-aside sorts left when one of them is written), `max`, `form` (`computer`, `phone`, or `narrow`: the phone's structure at a computer's sizes, for a narrow place), `onDone`, the fields' `search` words, `aside` (the sorts set aside, `SortAside`s), `fieldOf` (the field a sort key sorts, so a place sorts once by one of its parts), `addSort` (Add sort at a computer's foot, true unless said), `words`, and for a page standing still `lifted`, `opens` (`SortEditorOpens`) and `level`. On a computer each rule is its grip, its field's and its direction's Select, and ×, with Add sort and Clear all sorts at the foot; the set-aside sorts follow, each its field's box dashed in the warning colour with why, its direction greyed, ⋯ holding why, Put back and Delete. On a phone each rule is a card row, its direction under its name; a press turns the body to its direction, Add sort to the fields, a set-aside sort's row to the fields to point it at one: steps of the same sheet, never a sheet on top. The body answers no Escape: its holder's sheet does. Its hook joins this door as `useSortEditor`, and the body alone as `SortEditor`, once VK-727 retires the panels' older sort editor of those names. Its props take `items` (its menus as data, `menus.sortEditor`, VK-1063).
|
|
392
392
|
- `useSortEditorParts` — `useSortEditor`, under its name before the body took the plain one; kept.
|
|
393
|
-
- `SortEditorProps` — its props.
|
|
393
|
+
- `SortEditorProps` — its props; `clearAll` (default on) draws Clear all at its foot, off inside Customize.
|
|
394
394
|
- `SortEditorParts` — its parts: the body, the head's buttons, and on a phone's step its title and Back.
|
|
395
395
|
- `SortEditorOpens` — what a page shows standing open: a rule's field or direction, by its place.
|
|
396
396
|
- `sortableFields` — the fields as the list's Sort offers them to add a rule: those another rule sorts greyed with "Sorted", one level in too.
|
|
@@ -463,15 +463,15 @@ A view's menu and what it opens (VK-823), for an app that draws its own menu or
|
|
|
463
463
|
What an advanced filter opens on a computer and Filter on a phone, Attio's: the view's rules, each Where or its level's join, its field, how it compares and its value in its type's own box, joined by And or Or, in groups three deep; a relation rule's block (its relation, Any, None or Every where, its rules on that relation's fields inside, Add filter and Delete condition), which a rule on a related field's ⋮ makes with None or Every, Every waiting until a rule in it narrows; a group's ⋮ with Exclude matches (a group joined by And), an excluded group saying so; and the filter part, what a filter's way and value open on the bar. A body, as the sort editor is: the Popover holds it on a computer and the Sheet on a phone. Every word is handed (`words`). Its stylesheet is `viewkitjs/views/controls/filter-editor.css`; its root marks a phone from the device (`data-vk-phone`).
|
|
464
464
|
|
|
465
465
|
- `FilterEditor` — the body alone, for a shell that holds only a body (the Popover): its props are `FilterEditorProps`.
|
|
466
|
-
- `useFilterEditor` — the editor's state and its parts (`FilterEditorParts`): the `body`, and on a phone the Sheet head's ✕ and ✓, or on a step its Back (`head.onBack`) and its `title`. Its props (`FilterEditorProps`): `label`, the `fields` (each typed, a choice's values with it; one leading one level in holds its own), the `filter`, `onFilterChange`, `at`, `ids`, `levels`, `form` (`computer`, `phone`, or `narrow`), `onDone`, `standing`, `own` (ViewKit's own words and value body for a rule the kit has no box for), `excludable` (whether the filter itself may exclude its matches: an advanced filter's own group, its foot then holding a group's ⋮ too) and `words`. On a phone each box's list, a date, a value ViewKit draws, Add filter, a block's quantifier and a rule's or a group's ⋯ turn the body to a step of the same sheet, never a sheet on top; the body answers no Escape: its holder's sheet does. Its hook joins this door as `useFilterEditor`, and the body alone as `FilterEditor`, once VK-727 retires the panels' older filter editor of that name.
|
|
466
|
+
- `useFilterEditor` — the editor's state and its parts (`FilterEditorParts`): the `body`, and on a phone the Sheet head's ✕ and ✓, or on a step its Back (`head.onBack`) and its `title`. Its props (`FilterEditorProps`): `label`, the `fields` (each typed, a choice's values with it; one leading one level in holds its own), the `filter`, `onFilterChange`, `at`, `ids`, `levels`, `form` (`computer`, `phone`, or `narrow`), `onDone`, `standing`, `own` (ViewKit's own words and value body for a rule the kit has no box for), `excludable` (whether the filter itself may exclude its matches: an advanced filter's own group, its foot then holding a group's ⋮ too) and `words`. On a phone each box's list, a date, a value ViewKit draws, Add filter, a block's quantifier and a rule's or a group's ⋯ turn the body to a step of the same sheet, never a sheet on top; the body answers no Escape: its holder's sheet does. Its hook joins this door as `useFilterEditor`, and the body alone as `FilterEditor`, once VK-727 retires the panels' older filter editor of that name. Its props take `items` (its menus as data, by its own rule and group ids; its map hands the app public terms instead, VK-1063).
|
|
467
467
|
- `useFilterEditorParts` — deprecated: `useFilterEditor`, under its name before the body took the plain one.
|
|
468
|
-
- `FilterEditorProps` — its props.
|
|
468
|
+
- `FilterEditorProps` — its props; `clearAll` (default on) draws Clear all at its foot, off inside Customize.
|
|
469
469
|
- `FilterEditorParts` — its parts: the body, the head's buttons, and on a phone's step its title and Back.
|
|
470
470
|
- `FilterOwn` — ViewKit's own words and value body for a rule: its field's words, its way's word, its value's words, its value body.
|
|
471
471
|
- `FilterPartBody` — what a part of a filter on the bar opens: the fields, its type's ways, or its value in its type's own.
|
|
472
472
|
- `FilterPartProps` — its props: `part`, `rule`, `label`, `fields`, `filter`, `onFilterChange`, `onDone`, `own`, `form` and `words`.
|
|
473
473
|
- `FilterPart` — which part was pressed: `field`, `how` or `value`.
|
|
474
|
-
- `PairValue` — a range's From and To: two Number
|
|
474
|
+
- `PairValue` — a range's From and To: two number boxes (the Number field, or the app's Input under `panelControls`), an en dash between.
|
|
475
475
|
- `valuePlaceholder` — what a filter's value says while it has none, by its field's type.
|
|
476
476
|
- `FILTER_SEARCH` — the fields' search, in English.
|
|
477
477
|
- `HOW` — each type's ways, in the order they are offered, the first a new rule's.
|
|
@@ -522,7 +522,7 @@ What an advanced filter opens on a computer and Filter on a phone, Attio's: the
|
|
|
522
522
|
What Customize's Group opens: the list's group as the Menu list's rows. Group by, Order, Direction, a date field's Date step and Hide empty groups, each saying what it is and opening its choices in place; then the groups under their heading, each its grip, its name and its Switch, dragged into your own order, Hide all (Show all once none shows) at the heading; Remove grouping at its foot. A body: Customize holds it, a screen in its panel on a computer and a step of its sheet on a phone. A setting's choices stand in place of the settings, and the editor hands their name and the way back to its holder (`level`), whose head shows them. Every word is handed (`words`). Its stylesheet is `viewkitjs/views/controls/group-editor.css`; its root marks a phone from the device (`data-vk-phone`).
|
|
523
523
|
|
|
524
524
|
- `GroupEditor` — the body alone, for a shell that holds only a body: its props are `GroupEditorProps`.
|
|
525
|
-
- `useGroupEditor` — the editor's state and its parts (`GroupEditorParts`): the `body`, and the `level` it stands on. Its props (`GroupEditorProps`): `label`, the `fields` (Picker rows; one leading one level in holds its own), `ownOrders` (a field's own order, in its words), `orders` (the orders each field offers), `manualOrder` (whether Your own may be picked), `steps` (each date field's steps), the `group`, the groups as `values` (each with its count), `onGroupChange` (the whole group, null once taken off), `search`, `form`, `words`, and for a page standing still `opens` and `opensLevel`. The body alone, `GroupEditor`, joins this door with VK-727, beside the other panels' bodies.
|
|
525
|
+
- `useGroupEditor` — the editor's state and its parts (`GroupEditorParts`): the `body`, and the `level` it stands on. Its props (`GroupEditorProps`): `label`, the `fields` (Picker rows; one leading one level in holds its own), `ownOrders` (a field's own order, in its words), `orders` (the orders each field offers), `manualOrder` (whether Your own may be picked), `steps` (each date field's steps), the `group`, the groups as `values` (each with its count), `onGroupChange` (the whole group, null once taken off), `search`, `form`, `words`, and for a page standing still `opens` and `opensLevel`. The body alone, `GroupEditor`, joins this door with VK-727, beside the other panels' bodies. Its props take `items` (its rows as data, `menus.groupEditor`, VK-1063; its settings open and take the focus back by key).
|
|
526
526
|
- `GroupEditorProps` — its props.
|
|
527
527
|
- `GroupEditorParts` — its parts: the body, and the level it stands on (its name and the way back), null at the settings.
|
|
528
528
|
- `GroupEditorValue` — a group as the editor draws it: its value, its name, its mark, its count.
|
|
@@ -548,10 +548,10 @@ What Customize's Group opens: the list's group as the Menu list's rows. Group by
|
|
|
548
548
|
|
|
549
549
|
## Customize
|
|
550
550
|
|
|
551
|
-
What View settings opens: the view's sections as the Menu list's rows, Layout, Columns, then each of Filter, Sort and Group it is handed, each saying where it stands and opening its screen in place, then its toggles (Show counts among them). Layout is the layout cards and the layout's own settings: its pick-one settings (a density, a board's field) each opening its choices in place, its toggles under their sections with a
|
|
551
|
+
What View settings opens: the view's sections as the Menu list's rows, Layout, Columns, then each of Filter, Sort and Group it is handed, each saying where it stands and opening its screen in place, then its toggles (Show counts among them). Layout is the layout cards (none on a phone offered one layout) and the layout's own settings: its pick-one settings (a density, a board's field) each opening its choices in place, and its toggles under their sections, with nothing after them. A section that differs from the view as saved shows its value in the brand (`differs`, and the sections' own `inForce`), a section at rest in the normal colour. Each section's screen (Layout, Columns, Filter, Sort, Group) carries its own Reset while it is handed one (`resets`), in the first page's Reset's word and look and place, never on a level the screen opened in place; inside Customize the sort's and the filter's own Clear all give way to it. Columns is a search, the shown columns, each its grip, its mark, its name and its Switch, dragged into place, the first one locked, the hidden ones under Hidden, Hide all and Show all at the headings. A column with settings of its own or the app's rows for its field carries a › after its Switch, opening its level in Columns' place: Shown, its pick-one settings each opening in place, its toggles under their sections, then the app's rows; on a card layout each field carries its new-line Toggle, refused with its reason on the card's first field and a hidden one; and the app's rows under Columns' rows (Add field) stand at its foot. A list's per-field filters stand as rows after Columns and its time range and date ranges after Group, each saying what it holds and opening its screen (choices to pick one of, choices to check, or a body of its own with its level), or, folded, all behind one Filter row. Its head is the view's name renamed in place, or a title, as its options say; its footer, Copy link and Export CSV, each where handed; Reset and Save over it once something changed, with the shared view's stale note. A body: on a computer the Pane holds it where an app hands a Pane, and elsewhere (the toolbar's popover) it draws the same head, body and foot in a frame of its own; on a phone it hands the Sheet its head and foot, each section's step under that one head. Every word is handed (`words`). Its stylesheet is `viewkitjs/views/controls/customize.css`; its options are `CUSTOMIZE_LOOKS`; its root marks a phone from the device (`data-vk-phone`).
|
|
552
552
|
|
|
553
553
|
- `Customize` — the body alone, for a shell that holds only a body: its props are `CustomizeProps`.
|
|
554
|
-
- `useCustomize` — its state and its parts (`CustomizeParts`): the `body`, the `level` it stands on (a layout's choice, a column's settings, a section's level) or `null`, and on a phone the Sheet's `title`, `head` (Back and ✕) and `foot`. Its props (`CustomizeProps`): the `view`, `onViewChange` (the whole view, each change as it is made), the `layouts`, the `filter`, `sort` and `group` sections, `changed` with `onReset` and `onSave`, `pending`, `stale`, `exportCount` with `onCopyLink` and `onExport`, `toggles`, `layoutSettings`, `
|
|
554
|
+
- `useCustomize` — its state and its parts (`CustomizeParts`): the `body`, the `level` it stands on (a layout's choice, a column's settings, a section's level) or `null`, and on a phone the Sheet's `title`, `head` (Back and ✕) and `foot`. Its props (`CustomizeProps`): the `view`, `onViewChange` (the whole view, each change as it is made), the `layouts`, the `filter`, `sort` and `group` sections, `changed` with `onReset` and `onSave`, `pending`, `stale`, `exportCount` with `onCopyLink` and `onExport`, `toggles`, `layoutSettings`, `resets` (each section's own Reset), `differs` (a section that differs from the view as saved, its value in the brand: Layout and Columns marked only where handed, VK-1048), `items` (its rows as data, `ViewsCustomizeItems`: handed each page's default rows, its list's, Layout's and Columns', it hands back the rows drawn, VK-1062; a disabled row with no reason says `words.unavailable`, "Not available"), `columnsReset` (deprecated: read as `resets.columns`), `onLineChange` (a card's field starting a new line, turned on or off), `columnsFoot` (the app's rows under Columns' rows), `fields` and `foldFields` (a list's per-field filters, its time range and date ranges, `CustomizeField`), `onClose` (outside a Pane, the title head's ✕), `onScreenChange`, `words`, `form`, and for a page standing still `screen`. The body alone, `Customize`, joins this door with VK-727, beside the other panels' bodies.
|
|
555
555
|
- `useCustomizeWorn` — its options as the frame round it wears them, kept up to date as they change.
|
|
556
556
|
- `layoutMark` — a layout's mark by its id: table, board, list, calendar, timeline.
|
|
557
557
|
- `CustomizeProps` — its props.
|
|
@@ -676,7 +676,7 @@ What the quick filters' button opens, the Outright kit's (after Linear's): a str
|
|
|
676
676
|
- `QuickFiltersProps` — its props.
|
|
677
677
|
- `QuickField` — a field it offers: its id, its name in the strip, its values, what its search says.
|
|
678
678
|
- `QuickValue` — a value: its key, its words, its mark, its count.
|
|
679
|
-
- `QuickMark` — a value's mark: a status's place (a step between at its quarters), or a person's or a company's face.
|
|
679
|
+
- `QuickMark` — a value's mark: a status's place (a step between at its quarters), or a person's or a company's face, its `src` and `kind` handed only to the app's Avatar atom (VK-1044).
|
|
680
680
|
- `QuickHolds` — what is held: each field's held values by its id.
|
|
681
681
|
- `QuickHolding` — one at a time in all, or several.
|
|
682
682
|
- `QuickPress` — a press: the field and the value held or let go.
|
|
@@ -689,7 +689,7 @@ What the quick filters' button opens, the Outright kit's (after Linear's): a str
|
|
|
689
689
|
- `QUICK_FILTERS_ATTRS` — the attribute it watches, so an option changed while it is open reaches it.
|
|
690
690
|
- `QUICK_FILTERS_WORDS` — its English words.
|
|
691
691
|
- `quickFiltersWords` — the words handed, each left out the English.
|
|
692
|
-
- `QuickFiltersWords` — its words: the strip's name, a field's search, Clear filter,
|
|
692
|
+
- `QuickFiltersWords` — its words: the strip's name, a field's search, Clear filter, what a search that finds nothing says (`none`), and what a field with nothing to pick says (`nothing`).
|
|
693
693
|
|
|
694
694
|
### The reminder
|
|
695
695
|
|
|
@@ -703,12 +703,15 @@ On a phone, a pill at the list's foot naming what quick filters hold while they
|
|
|
703
703
|
|
|
704
704
|
## The Toolbar
|
|
705
705
|
|
|
706
|
-
The Outright kit's Toolbar, on Base UI's toolbar: the row and, under it, the filter bar, a step smaller; on a phone one line. Tab reaches the whole of it once, the arrows run through its lines and loop, Home and End reach its ends; in a text box the arrows move the caret and step out at its ends. Handed a list's places (`views`, `settings`, `search`, `add`, `sort`, `filter`, `filters`, `quick`, `save`), it stands each where its options pick (`TOOLBAR_LOOKS`, worn as `data-toolbar-*` on the frame round it): View settings beside the views or on the row's right, the sort and Filter on the bar or on the row's right, the filter bar always or once something is added (`added`), lines across or none, Clear and Save on the bar or in View settings, New in its form, the quick filters' button or none; on a phone the sort, Filter, the quick filters' icon and View settings beside the views or on the right, the search a button or its own line. A place may be a function of where it stands (`ToolbarAt`: `row`, `right`, `bar`, `phone`). Handed no places, it is its `children` (the row) and `bar` (the filter bar), as any row of controls. What doesn't fit gives way, each line on its own, from its end: words to icons, then the view tabs into "+N", the filters into "+N filters", then the rest into ⋯, a Menu; a line holds while a Menu holding what folded stands open, or while its holder says `holds`. What never folds: a toolbar button marked `stays`, and the Button (New).
|
|
706
|
+
The Outright kit's Toolbar, on Base UI's toolbar: the row and, under it, the filter bar, a step smaller; on a phone one line. Tab reaches the whole of it once, the arrows run through its lines and loop, Home and End reach its ends; in a text box the arrows move the caret and step out at its ends. Handed a list's places (`views`, `settings`, `search`, `add`, `sort`, `filter`, `filters`, `quick`, `save`), it stands each where its options pick (`TOOLBAR_LOOKS`, worn as `data-toolbar-*` on the frame round it): View settings beside the views or on the row's right, the sort and Filter on the bar or on the row's right, the filter bar always or once something is added (`added`), lines across or none, Clear and Save on the bar or in View settings, New in its form, the quick filters' button or none; on a phone the sort, Filter, the quick filters' icon and View settings beside the views or on the right, the search a button or its own line. A place may be a function of where it stands (`ToolbarAt`: `row`, `right`, `bar`, `phone`). Handed no places, it is its `children` (the row) and `bar` (the filter bar), as any row of controls. What doesn't fit gives way, each line on its own, from its end: words to icons, then the view tabs into "+N", the filters into "+N filters", then the rest into ⋯, a Menu; a line holds while a Menu holding what folded stands open, or while its holder says `holds`. What never folds: a toolbar button marked `stays`, and the Button (New). ⋯ is yours where you hand it (`overflow`): your glyph, your class, or your whole button, handed the props the Toolbar's own would get; so are "+N" (`moreViews`) and "+N filters" (`moreFilters`): your class, or your whole button. It is the bar above a list and nothing else: a row of a page's actions (a record's) is your own, on your Button. Each line's height is its toolbar buttons' (the toolbar button's Size, a phone's its own), given to the Buttons, the Toggle group and the text box in it. Every word it says of its own is handed (`words`). Its stylesheet is `viewkitjs/views/controls/toolbar.css` ([its tokens](../controls/toolbar.md)).
|
|
707
707
|
|
|
708
708
|
Its frame and its separator are `ToolbarControl` and `ToolbarSeparatorControl`: `viewkitjs/views/panels/react` already names the ready toolbar's frame `Toolbar` and its separator `ToolbarSeparator`, and one package holds no two public names alike. The ready toolbar keeps its own frame.
|
|
709
709
|
|
|
710
|
-
- `ToolbarControl` — the Toolbar. Its props, `ToolbarProps`: `label` (its name to a screen reader), `children` and `bar`, the places above, `added`, `picks` (its options over the frame's), `barLabel`, `size` and `barSize` (`28`, `32` or `36`), `spacing` (in spacing steps), `fold` (default on), `holds`, `
|
|
710
|
+
- `ToolbarControl` — the Toolbar. Its props, `ToolbarProps`: `label` (its name to a screen reader), `children` and `bar`, the places above, `added`, `picks` (its options over the frame's), `barLabel`, `size` and `barSize` (`28`, `32` or `36`), `spacing` (in spacing steps), `fold` (default on), `holds`, `overflow` (`ToolbarOverflowControl`: ⋯ as you draw it), `moreViews` and `moreFilters` (`ToolbarMoreControl`: "+N" and "+N filters" as you draw them), `form` (`computer` or `phone`; by default a phone's in a phone's window or a `PhoneHost`), `onMoreViews` and `moreViewsOpen` (where its holder opens what "+N" opens), `words`, `className`, `style`, and Base UI's toolbar's own. Its width is its holder's to give: sized from what it holds in a pill (the bulk bar, the quick filters' reminder), so a holder that draws it as a list's toolbar gives it its width (a flex item with `min-width: 0`), or its row never runs out of room to fold.
|
|
711
711
|
- `ToolbarProps` — its props.
|
|
712
|
+
- `ToolbarOverflowControl` — ⋯ as you draw it: `icon` (your glyph over ViewKit's dots), `className` (put on it) and `button` (your button, drawn in its place and handed the very props the Toolbar button would get, `ref` and what its Menu sets to open from it included: spread them on yours). Absent, ViewKit's own ⋯.
|
|
713
|
+
- `ToolbarMoreControl` — "+N" or "+N filters" as you draw it: `className` (put on it) and `button` (your button, drawn in its place and handed the very props the Toolbar button would get, `ref`, its words and what its Menu, or `onMoreViews`, sets to open from it included: spread them on yours). Absent, ViewKit's own.
|
|
714
|
+
- `ToolbarOwnButtonProps` — what the Toolbar hands your own ⋯, "+N" or "+N filters" button: a Toolbar button's props (`ToolbarButtonProps`), its `style` a plain one, never Base UI's state function. Type your button with it and spread what is left after the props you draw yourself onto a plain `<button>`, with no cast; a button typed with `ToolbarButtonProps` is still taken.
|
|
712
715
|
- `ToolbarPlace` — a place: what it draws, or a function of where it stands.
|
|
713
716
|
- `ToolbarAt` — where a place stands: `row`, `right`, `bar` or `phone`.
|
|
714
717
|
- `ToolbarSeparatorControl` — a line between what belongs together and what doesn't.
|
|
@@ -717,7 +720,7 @@ Its frame and its separator are `ToolbarControl` and `ToolbarSeparatorControl`:
|
|
|
717
720
|
- `ToolbarInputProps` — its props: the Input's, `icon`, and `words`: `"both"` shows "Search" beside the shut search's icon as the buttons on the right show their words (the Toolbar's "Buttons on the right"; on a phone its icon alone); absent or `"icon"`, its icon alone, as Mihai's look stands it.
|
|
718
721
|
- `ToolbarFolds` — filters or view tabs a holder draws itself, standing in a line: the line folds them one at a time among its own (`kind`, `filters` or `tabs`; `count`) and hands `children` how many are folded.
|
|
719
722
|
- `ToolbarFoldsProps` — its props.
|
|
720
|
-
- `toolbarSteps` — the steps a line takes as it narrows, in order
|
|
723
|
+
- `toolbarSteps` — the steps a line takes as it narrows, in order, for a holder's test.
|
|
721
724
|
- `useToolbarWorn` — its options as worn round an element, kept up to date as they change.
|
|
722
725
|
- `toolbarWornOf` — its options as the frame round an element wears them, each its default where nothing sets it.
|
|
723
726
|
- `TOOLBAR_ATTRS` — the attributes it watches.
|
|
@@ -778,7 +781,7 @@ What picked rows bring, the Outright kit's (after Attio's): on a computer a surf
|
|
|
778
781
|
- `TEXT_EDITOR_ATTRS` — the attributes it watches, so a look changed while it is open reaches it.
|
|
779
782
|
- `TextEditorWorn` — its options as worn.
|
|
780
783
|
- `TEXT_EDITOR_WORDS` — its words, in English: a phone's country button and its list's search. `CONTROLS.TextBody` hands the app's (`views.editors.place-country`, `views.editors.place-country-search` and the Picker's), and names a phone's countries in the conventions' `language`.
|
|
781
|
-
- `TextEditorWords` — those words, and its list's own (`picker`).
|
|
784
|
+
- `TextEditorWords` — those words, `close` and `save` (a phone's ✕ and ✓ where no holder keeps the draft; the map hands `views.panels.close` and `views.editors.save`), and its list's own (`picker`).
|
|
782
785
|
- `textWords` — the words handed, over the English.
|
|
783
786
|
|
|
784
787
|
Its stylesheet is `viewkitjs/views/controls/text-editor.css`, beside the inline input's, the Input's, the Field's, the Button's, the Popover's, the Picker's and the list's; its names are on [its page](../controls/text-editor.md).
|
|
@@ -787,7 +790,7 @@ Its stylesheet is `viewkitjs/views/controls/text-editor.css`, beside the inline
|
|
|
787
790
|
|
|
788
791
|
`CONTROLS` fills its `Picker` with the Picker: ViewKit's select, status, several-values, relation and set editors open it, handed their rows as data, the panel round it keeping the draft and, on a phone, its ✕ and ✓, so the Picker is told the shell keeps them and hands every change. Its words are ViewKit's `views.picker.*` messages, so an app's own words reach it. A status field's steps come as `steps`: an archived option held stands outside them, as its cell draws it. It fills its `FieldsBody` with the Picker too: the sort's and the filter's field lists, each field its column's glyph, one that can't be picked greyed with why, a relation under Related records with its far fields one level in. The Picker's stylesheet, `viewkitjs/views/controls/picker.css`, stands on the Avatar's, the Button's, the Checkbox's, the Glass button's, the Input's, the Kbd's, the Menu's, the Option's, the Spinner's, the Status's, the Sheet's, the scrollbar's, the list's and the popup line's.
|
|
789
792
|
|
|
790
|
-
- `pickerItemsOf` — ViewKit's rows (`ViewsPickerItem`) as the Picker's: an avatar, the record's glyph, a status at its place (its quarters among `steps` when handed), an option, or the app's icon (handed `AppIcon`). For an app's own list in the Picker; the editors' own `pickerItemOf` is another, internal one.
|
|
793
|
+
- `pickerItemsOf` — ViewKit's rows (`ViewsPickerItem`) as the Picker's: an avatar, the record's glyph, a status at its place (its quarters among `steps` when handed), an option, or the app's icon (handed `AppIcon`). Handed `cells: true`, as `CONTROLS.Picker` hands it, a status and an option are drawn as their cells draw them: your `StatusBadge` and `Tag` atoms, in the option's colour (a chip row, `as: { chip }`); an option in its colour stands held among the search's chips (the look Chips) as your `Tag` too, with its remove (`removable`). For an app's own list in the Picker; the editors' own `pickerItemOf` is another, internal one.
|
|
791
794
|
|
|
792
795
|
## The Date editor
|
|
793
796
|
|
|
@@ -879,7 +882,7 @@ Its stylesheet is `viewkitjs/views/controls/date-editor.css`, beside the Button'
|
|
|
879
882
|
- `regionFor` — a region typed, read against a country.
|
|
880
883
|
- `placeOf` — what a place's draft keeps: its country and its parts, trimmed; null when nothing is left.
|
|
881
884
|
- `COMPOUND_EDITOR_WORDS` — its words, in English: a name's boxes and what is said under the full name, a place's country, its lists' searches and empty rows, a range's ends and its number boxes' names. `CONTROLS.PartsBody` hands the app's (`views.editors.*`, listed in the contract) and, with no country held, each box's words for none.
|
|
882
|
-
- `CompoundEditorWords` — those words, a word naming a region taking the region's own word, and its lists' own (`picker`).
|
|
885
|
+
- `CompoundEditorWords` — those words, a word naming a region taking the region's own word, `close` and `save` (as the Text editor's), and its lists' own (`picker`).
|
|
883
886
|
- `compoundWords` — the words handed, over the English.
|
|
884
887
|
- `placeText` — what a cell shows of a place: an address its street and city, a person's place its city and country.
|
|
885
888
|
- `placeLine` — what a cell shows of a place in Attio's look: every part held, joined by commas.
|
|
@@ -913,7 +916,7 @@ A name's `NameValue` and `sameName`, and a range's `rangeText`, stay inside the
|
|
|
913
916
|
- `NumberEditorWorn` — its options as worn.
|
|
914
917
|
- `NUMBER_EDITOR_WORDS` — its words, in English: its lists' names and searches, the code button's name and the number field's steps. `CONTROLS.NumberBody` hands the app's (`views.menus.currency`, `views.editors.number-*`, listed in the contract).
|
|
915
918
|
- `numberWords` — the words handed over the English.
|
|
916
|
-
- `NumberEditorWords` — those words, and its lists' own (`picker`).
|
|
919
|
+
- `NumberEditorWords` — those words, `close` and `save` (as the Text editor's), and its lists' own (`picker`).
|
|
917
920
|
|
|
918
921
|
Its stylesheet is `viewkitjs/views/controls/number-editor.css`, beside those of the controls it draws with; its names are on [its page](../controls/number-editor.md).
|
|
919
922
|
## The Values editor
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
Import from `viewkitjs/views/editors/range` in a client component: the door opens with the client directive. It holds the editor of a `range` field, which opens your app's `PartsBody` as `kind: "range"` (`CONTROLS.PartsBody` is ViewKit's own, the Compound editor): two ends, low and high. An empty end is an open end. It owns the draft and what a close means; the body draws; its host owns the popover (the grid's and the field row's open it under the value), the write, and keeping the pair in its own columns. It commits a `RangeValue` of `viewkitjs/fields`, `{ low, high }`, each a number or null. Guide: [editors](../guides/editors.md).
|
|
4
4
|
|
|
5
|
-
- `RangeEditor` — the range panel; its ref is a `RangeEditorHandle`. It takes `initial` (the stored range, or null) and `onRequestClose`, and optionally `seed` (the character that opened the editor, replacing the low end), `decimals` (default 0), `allowEmpty`, `suffix` (a unit drawn after the high end, such as `%` or a currency code), `conventions` (how a typed seed is read; default: the provider's), `bands` (the field's `presets`)
|
|
5
|
+
- `RangeEditor` — the range panel; its ref is a `RangeEditorHandle`. It takes `initial` (the stored range, or null) and `onRequestClose`, and optionally `seed` (the character that opened the editor, replacing the low end), `decimals` (default 0), `allowEmpty`, `suffix` (a unit drawn after the high end, such as `%` or a currency code), `conventions` (how a typed seed is read; default: the provider's), `bands` (the field's `presets`), `label` (the field's name, for your `PartsBody`; default the two ends' words) and `min` and `max` (the field's limits, `numberBounds(field)`, which the grid's and a field row's range editors hand, VK-904). It hands the body the two ends, `decimals`, the `suffix` as `unit`, the `bands` for the body to draw as picks, and `min` and `max` where handed (a band picked closes as `pick`, so it is read and judged as typed ends are). It keeps the draft, rounds the ends to `decimals` as it closes, and draws no refusal of its own: your panel draws it. Escape, Tab and the close are the body's frame's: Escape is taken before the body hears it, and Tab walks the body and closes from either end.
|
|
6
6
|
- `RangeEditorHandle` — what the host's ref reads: `resolveClose(reason)`, synchronous and safe to ask twice. Escape cancels, and so does a seed that is not a number, left as typed. Both ends unchanged as the body showed them is a `noop`, so a stored 2.555 that opened as 2.56 writes nothing. Two empty ends cancel, or commit with `allowEmpty`. A low end above the high end commits as handed, for the host's acceptance to refuse in its own words.
|