@viewkitjs/views 0.5.0 → 0.6.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 +620 -0
- package/README.md +4 -2
- package/dist/atoms/Avatar.d.ts +2 -0
- package/dist/atoms/Avatar.js +13 -0
- package/dist/atoms/CellMore.d.ts +2 -0
- package/dist/atoms/CellMore.js +4 -0
- package/dist/atoms/DisabledReason.d.ts +11 -0
- package/dist/atoms/DisabledReason.js +10 -0
- package/dist/atoms/DrillRows.d.ts +2 -2
- package/dist/atoms/DrillRows.js +7 -5
- package/dist/atoms/Loading.d.ts +6 -0
- package/dist/atoms/Loading.js +4 -1
- package/dist/atoms/PanelRows.js +3 -5
- package/dist/atoms/Pill.d.ts +2 -0
- package/dist/atoms/Pill.js +25 -0
- package/dist/atoms/RangeCalendar.d.ts +8 -0
- package/dist/atoms/RangeCalendar.js +30 -0
- package/dist/atoms/RelationRoles.js +2 -2
- package/dist/atoms/SelectionSheet.js +5 -4
- package/dist/atoms/ToolbarButton.d.ts +2 -0
- package/dist/atoms/ToolbarButton.js +18 -0
- package/dist/atoms/defaults.js +10 -0
- package/dist/atoms/types.d.ts +141 -1
- package/dist/cells/cell-format.d.ts +10 -1
- package/dist/cells/cell-title.d.ts +5 -1
- package/dist/cells/cell-title.js +2 -2
- package/dist/cells/cell-values.js +22 -7
- package/dist/cells/relation-wrap.js +1 -1
- package/dist/contract.d.ts +351 -15
- package/dist/contract.js +482 -4
- package/dist/display/actor.js +1 -1
- package/dist/display/boolean.js +5 -0
- package/dist/display/entity-chip.d.ts +12 -9
- package/dist/display/entity-chip.js +4 -5
- package/dist/display/fit-values.d.ts +34 -0
- package/dist/display/fit-values.js +45 -0
- package/dist/display/location.js +1 -1
- package/dist/display/multi-value.js +72 -8
- package/dist/display/options.d.ts +9 -1
- package/dist/display/relation.js +1 -1
- package/dist/display/rich-text.js +17 -6
- package/dist/display/select.js +6 -4
- package/dist/display/status-steps.d.ts +8 -0
- package/dist/display/status-steps.js +18 -0
- package/dist/display/viewer.js +1 -0
- package/dist/editors/BodyFrame.d.ts +29 -0
- package/dist/editors/BodyFrame.js +80 -0
- package/dist/editors/DateEditor.js +13 -17
- package/dist/editors/LocationEditor.d.ts +2 -0
- package/dist/editors/LocationEditor.js +29 -5
- package/dist/editors/NameEditor.d.ts +2 -0
- package/dist/editors/NameEditor.js +27 -7
- package/dist/editors/NumberEditor.d.ts +18 -0
- package/dist/editors/NumberEditor.js +29 -2
- package/dist/editors/RangeEditor.d.ts +2 -0
- package/dist/editors/RangeEditor.js +29 -4
- package/dist/editors/SelectEditor.d.ts +5 -0
- package/dist/editors/SelectEditor.js +3 -2
- package/dist/editors/TextEditor.d.ts +11 -1
- package/dist/editors/TextEditor.js +25 -8
- package/dist/editors/ValueListEditor.d.ts +7 -0
- package/dist/editors/ValueListEditor.js +60 -48
- package/dist/editors/body-panel.d.ts +7 -0
- package/dist/editors/body-panel.js +8 -0
- package/dist/editors/edit-session.d.ts +20 -3
- package/dist/editors/edit-session.js +43 -3
- package/dist/editors/leave-scope.d.ts +23 -0
- package/dist/editors/leave-scope.js +28 -0
- package/dist/editors/number-body.d.ts +29 -0
- package/dist/editors/number-body.js +37 -0
- package/dist/editors/parts-body.d.ts +66 -0
- package/dist/editors/parts-body.js +114 -0
- package/dist/editors/tab-ends.d.ts +5 -0
- package/dist/editors/tab-ends.js +7 -0
- package/dist/editors/text-body.d.ts +16 -0
- package/dist/editors/text-body.js +30 -0
- package/dist/editors/values-body.d.ts +47 -0
- package/dist/editors/values-body.js +140 -0
- package/dist/field-row/FieldRow.d.ts +7 -0
- package/dist/field-row/FieldRow.js +44 -24
- package/dist/field-row/FieldRowLane.js +12 -4
- package/dist/field-row/editors/RowChipsEditor.js +3 -1
- package/dist/field-row/editors/RowEditor.js +2 -1
- package/dist/field-row/editors/RowNameEditor.d.ts +5 -2
- package/dist/field-row/editors/RowNameEditor.js +12 -5
- package/dist/field-row/editors/RowNumberEditor.js +18 -2
- package/dist/field-row/editors/RowPlaceEditor.js +4 -2
- package/dist/field-row/editors/RowRangeEditor.d.ts +5 -2
- package/dist/field-row/editors/RowRangeEditor.js +13 -6
- package/dist/field-row/editors/RowRelationEditor.js +5 -2
- package/dist/field-row/editors/RowSelectEditor.js +4 -1
- package/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/dist/field-row/editors/RowTextEditor.js +12 -3
- package/dist/field-row/editors/RowValueListEditor.d.ts +2 -1
- package/dist/field-row/editors/RowValueListEditor.js +17 -4
- package/dist/field-row/editors/host.d.ts +3 -0
- package/dist/field-row/editors/row-session.d.ts +12 -1
- package/dist/field-row/editors/row-session.js +52 -2
- package/dist/field-row/field-row-button.d.ts +40 -0
- package/dist/field-row/field-row-button.js +18 -0
- package/dist/field-row/field-row-checkbox.d.ts +9 -0
- package/dist/field-row/field-row-checkbox.js +7 -0
- package/dist/filters/filter-model.d.ts +2 -0
- package/dist/grid/chrome/GridAddColumn.js +17 -3
- package/dist/grid/chrome/GridAggregateMenu.d.ts +2 -0
- package/dist/grid/chrome/GridAggregateMenu.js +2 -0
- package/dist/grid/chrome/GridCellEditors.js +16 -6
- package/dist/grid/chrome/GridCellOutline.d.ts +7 -4
- package/dist/grid/chrome/GridCellOutline.js +4 -2
- package/dist/grid/chrome/GridChipsEditor.js +3 -1
- package/dist/grid/chrome/GridColumnMenu.d.ts +4 -1
- package/dist/grid/chrome/GridColumnMenu.js +5 -3
- package/dist/grid/chrome/GridColumnSortSection.d.ts +20 -0
- package/dist/grid/chrome/GridColumnSortSection.js +18 -1
- package/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/dist/grid/chrome/GridFooter.js +6 -4
- package/dist/grid/chrome/GridGroupMenu.d.ts +5 -1
- package/dist/grid/chrome/GridGroupMenu.js +30 -8
- package/dist/grid/chrome/GridHeader.d.ts +5 -1
- package/dist/grid/chrome/GridHeader.js +9 -5
- package/dist/grid/chrome/GridLongTextEditor.js +15 -11
- package/dist/grid/chrome/GridNameEditor.js +4 -2
- package/dist/grid/chrome/GridNumberEditor.d.ts +8 -1
- package/dist/grid/chrome/GridNumberEditor.js +15 -3
- package/dist/grid/chrome/GridPager.d.ts +7 -0
- package/dist/grid/chrome/GridPager.js +34 -0
- package/dist/grid/chrome/GridPlaceEditor.js +4 -2
- package/dist/grid/chrome/GridRangeEditor.js +12 -4
- package/dist/grid/chrome/GridRelationEditor.js +5 -2
- package/dist/grid/chrome/GridRow.js +18 -6
- package/dist/grid/chrome/GridRowActions.d.ts +8 -3
- package/dist/grid/chrome/GridRowActions.js +16 -6
- package/dist/grid/chrome/GridRowCells.js +23 -7
- package/dist/grid/chrome/GridRowGlyph.d.ts +3 -1
- package/dist/grid/chrome/GridRowGlyph.js +7 -2
- package/dist/grid/chrome/GridSelectEditor.js +6 -3
- package/dist/grid/chrome/GridStructure.d.ts +6 -1
- package/dist/grid/chrome/GridStructure.js +32 -8
- package/dist/grid/chrome/GridTable.js +36 -24
- package/dist/grid/chrome/GridTableSurface.d.ts +5 -1
- package/dist/grid/chrome/GridTableSurface.js +5 -2
- package/dist/grid/chrome/GridTextEditor.d.ts +5 -1
- package/dist/grid/chrome/GridTextEditor.js +13 -3
- package/dist/grid/chrome/GridValueListEditor.d.ts +12 -4
- package/dist/grid/chrome/GridValueListEditor.js +11 -3
- package/dist/grid/chrome/StuckMarker.d.ts +3 -1
- package/dist/grid/chrome/StuckMarker.js +6 -2
- package/dist/grid/chrome/cells.d.ts +4 -2
- package/dist/grid/chrome/cells.js +2 -2
- package/dist/grid/chrome/grid-add-column-items.d.ts +1 -1
- package/dist/grid/chrome/grid-add-column-items.js +8 -1
- package/dist/grid/chrome/grid-button.d.ts +32 -0
- package/dist/grid/chrome/grid-button.js +12 -0
- package/dist/grid/chrome/grid-cell-classes.d.ts +38 -0
- package/dist/grid/chrome/grid-cell-classes.js +30 -0
- package/dist/grid/chrome/grid-column-menu-items.d.ts +3 -0
- package/dist/grid/chrome/grid-column-menu-items.js +32 -3
- package/dist/grid/chrome/grid-columns-template.d.ts +27 -0
- package/dist/grid/chrome/grid-columns-template.js +13 -0
- package/dist/grid/chrome/grid-edit-session.d.ts +4 -1
- package/dist/grid/chrome/grid-edit-session.js +11 -1
- package/dist/grid/chrome/grid-group-menu-items.d.ts +8 -1
- package/dist/grid/chrome/grid-group-menu-items.js +17 -0
- package/dist/grid/chrome/grid-group-menu-parts.d.ts +10 -6
- package/dist/grid/chrome/grid-group-menu-parts.js +4 -2
- package/dist/grid/chrome/grid-hover.d.ts +4 -1
- package/dist/grid/chrome/grid-hover.js +16 -6
- package/dist/grid/chrome/grid-pages.d.ts +15 -0
- package/dist/grid/chrome/grid-pages.js +9 -0
- package/dist/grid/chrome/grid-row-menu-items.js +18 -10
- package/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/dist/grid/chrome/grid-row-window.d.ts +7 -0
- package/dist/grid/chrome/grid-row-window.js +35 -1
- package/dist/grid/chrome/grid-table-props.d.ts +38 -4
- package/dist/grid/chrome/useGridColumnLayout.d.ts +3 -1
- package/dist/grid/chrome/useGridColumnLayout.js +29 -9
- package/dist/grid/chrome/useGridPartColumns.js +1 -1
- package/dist/grid/chrome/useGridScrollArea.js +2 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +5 -3
- package/dist/grid/chrome/useGridTableSelection.d.ts +3 -1
- package/dist/grid/chrome/useGridTableSelection.js +2 -2
- package/dist/grid/chrome/useHeaderDragReorder.js +2 -0
- package/dist/grid/core/editing-controller.d.ts +36 -11
- package/dist/grid/core/editing-controller.js +92 -25
- package/dist/grid/core/grid-aria.d.ts +4 -0
- package/dist/grid/core/grid-aria.js +6 -4
- package/dist/grid/core/grid-focus.d.ts +6 -0
- package/dist/grid/core/grid-focus.js +28 -5
- package/dist/grid/core/useGridEditing.d.ts +11 -2
- package/dist/grid/core/useGridEditing.js +9 -5
- package/dist/grid/core/write-states.d.ts +20 -0
- package/dist/grid/core/write-states.js +21 -0
- package/dist/grid/grid-format-props.d.ts +26 -0
- package/dist/grid/grid-format-props.js +65 -0
- package/dist/grid/index.d.ts +3 -1
- package/dist/grid/index.js +1 -0
- package/dist/grid/useGridTablePrefs.d.ts +19 -20
- package/dist/grid/useGridTablePrefs.js +6 -58
- package/dist/grid/useGridTableSettings.d.ts +60 -0
- package/dist/grid/useGridTableSettings.js +61 -0
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +3 -0
- package/dist/model/body-frame.d.ts +16 -0
- package/dist/model/body-frame.js +5 -0
- package/dist/model/column-capabilities.d.ts +4 -1
- package/dist/model/column-capabilities.js +4 -1
- package/dist/model/column-filters.d.ts +7 -4
- package/dist/model/column-filters.js +26 -18
- package/dist/model/column-inspect.d.ts +3 -2
- package/dist/model/column-inspect.js +3 -1
- package/dist/model/column-sort.d.ts +11 -0
- package/dist/model/column-sort.js +14 -0
- package/dist/model/one-value.d.ts +6 -0
- package/dist/model/one-value.js +5 -0
- package/dist/model/part-write.js +1 -1
- package/dist/model/place-parts.d.ts +6 -0
- package/dist/model/place-parts.js +14 -0
- package/dist/model/relation-filters.d.ts +13 -2
- package/dist/model/relation-filters.js +9 -4
- package/dist/model/row-icon.d.ts +16 -6
- package/dist/model/settings-columns.d.ts +34 -0
- package/dist/model/settings-columns.js +146 -0
- package/dist/model/settings-look.d.ts +17 -0
- package/dist/model/settings-look.js +23 -0
- package/dist/model/view-rules.js +6 -2
- package/dist/panels/availability.d.ts +26 -0
- package/dist/panels/availability.js +28 -0
- package/dist/panels/filter/DateFilterBody.d.ts +42 -0
- package/dist/panels/filter/DateFilterBody.js +64 -0
- package/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
- package/dist/panels/filter/DateFilterCalendar.js +37 -0
- package/dist/panels/filter/DateFilterInput.d.ts +16 -0
- package/dist/panels/filter/DateFilterInput.js +37 -0
- package/dist/panels/filter/FilterIcon.d.ts +7 -0
- package/dist/panels/filter/FilterIcon.js +15 -0
- package/dist/panels/filter/MenuSelect.d.ts +12 -0
- package/dist/panels/filter/MenuSelect.js +34 -0
- package/dist/panels/filter/NumberFilterBody.d.ts +21 -0
- package/dist/panels/filter/NumberFilterBody.js +76 -0
- package/dist/panels/filter/RangeFilterBody.d.ts +19 -0
- package/dist/panels/filter/RangeFilterBody.js +71 -0
- package/dist/panels/filter/RelationFilterBody.d.ts +17 -0
- package/dist/panels/filter/RelationFilterBody.js +20 -0
- package/dist/panels/filter/TextFilterBody.d.ts +31 -0
- package/dist/panels/filter/TextFilterBody.js +44 -0
- package/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
- package/dist/panels/filter/TimeScopeDetail.js +47 -0
- package/dist/panels/filter/details.d.ts +17 -0
- package/dist/panels/filter/details.js +73 -0
- package/dist/panels/filter/filter-list.d.ts +23 -0
- package/dist/panels/filter/filter-list.js +38 -0
- package/dist/panels/group-sort.d.ts +24 -0
- package/dist/panels/group-sort.js +58 -0
- package/dist/panels/index.d.ts +24 -0
- package/dist/panels/index.js +17 -0
- package/dist/panels/labels.d.ts +37 -0
- package/dist/panels/labels.js +166 -0
- package/dist/panels/model.d.ts +343 -0
- package/dist/panels/model.js +77 -0
- package/dist/panels/react/GroupBucketsList.d.ts +16 -0
- package/dist/panels/react/GroupBucketsList.js +38 -0
- package/dist/panels/react/LayoutColumnsList.d.ts +24 -0
- package/dist/panels/react/LayoutColumnsList.js +71 -0
- package/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
- package/dist/panels/react/PopoverColumnDetail.js +24 -0
- package/dist/panels/react/chrome.d.ts +17 -0
- package/dist/panels/react/chrome.js +8 -0
- package/dist/panels/react/column-refusals.d.ts +7 -0
- package/dist/panels/react/column-refusals.js +14 -0
- package/dist/panels/react/customize.d.ts +26 -0
- package/dist/panels/react/customize.js +98 -0
- package/dist/panels/react/drag.d.ts +2 -0
- package/dist/panels/react/drag.js +6 -0
- package/dist/panels/react/field-editor.d.ts +10 -0
- package/dist/panels/react/field-editor.js +1 -0
- package/dist/panels/react/filter-panel.d.ts +15 -0
- package/dist/panels/react/filter-panel.js +48 -0
- package/dist/panels/react/layout-detail.d.ts +4 -0
- package/dist/panels/react/layout-detail.js +21 -0
- package/dist/panels/react/order-details.d.ts +32 -0
- package/dist/panels/react/order-details.js +81 -0
- package/dist/panels/react/panel-header.d.ts +10 -0
- package/dist/panels/react/panel-header.js +12 -0
- package/dist/panels/react/panel-sheet.d.ts +19 -0
- package/dist/panels/react/panel-sheet.js +22 -0
- package/dist/panels/react/popover.d.ts +71 -0
- package/dist/panels/react/popover.js +47 -0
- package/dist/panels/react/root-list.d.ts +6 -0
- package/dist/panels/react/root-list.js +31 -0
- package/dist/panels/react/toolbar/ReadyToolbar.d.ts +42 -0
- package/dist/panels/react/toolbar/ReadyToolbar.js +92 -0
- package/dist/panels/react/toolbar/Toolbar.d.ts +16 -0
- package/dist/panels/react/toolbar/Toolbar.js +34 -0
- package/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
- package/dist/panels/react/toolbar/ToolbarButton.js +9 -0
- package/dist/panels/react/toolbar/ToolbarFilter.d.ts +19 -0
- package/dist/panels/react/toolbar/ToolbarFilter.js +32 -0
- package/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
- package/dist/panels/react/toolbar/ToolbarNew.js +21 -0
- package/dist/panels/react/toolbar/ToolbarOptions.d.ts +25 -0
- package/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
- package/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
- package/dist/panels/react/toolbar/ToolbarSearch.js +41 -0
- package/dist/panels/react/toolbar/ToolbarSort.d.ts +12 -0
- package/dist/panels/react/toolbar/ToolbarSort.js +16 -0
- package/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
- package/dist/panels/react/toolbar/ToolbarViews.js +24 -0
- package/dist/panels/react/toolbar/context.d.ts +29 -0
- package/dist/panels/react/toolbar/context.js +49 -0
- package/dist/panels/react/toolbar/panel-part.d.ts +37 -0
- package/dist/panels/react/toolbar/panel-part.js +37 -0
- package/dist/panels/react/toolbar/panel-state.d.ts +9 -0
- package/dist/panels/react/toolbar/panel-state.js +12 -0
- package/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
- package/dist/panels/react/toolbar/use-box-narrow.js +18 -0
- package/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
- package/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
- package/dist/panels/react/view-actions.d.ts +4 -0
- package/dist/panels/react/view-actions.js +37 -0
- package/dist/panels/react/view-footer.d.ts +16 -0
- package/dist/panels/react/view-footer.js +11 -0
- package/dist/panels/react/views-row/FoldingViewRow.d.ts +4 -0
- package/dist/panels/react/views-row/FoldingViewRow.js +105 -0
- package/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
- package/dist/panels/react/views-row/HScrollRow.js +42 -0
- package/dist/panels/react/views-row/PillGroup.d.ts +30 -0
- package/dist/panels/react/views-row/PillGroup.js +86 -0
- package/dist/panels/react/views-row/ViewAxes.d.ts +6 -0
- package/dist/panels/react/views-row/ViewAxes.js +16 -0
- package/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
- package/dist/panels/react/views-row/ViewCreatePill.js +11 -0
- package/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
- package/dist/panels/react/views-row/ViewPicker.js +65 -0
- package/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
- package/dist/panels/react/views-row/ViewPickerRow.js +18 -0
- package/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
- package/dist/panels/react/views-row/ViewTabs.js +29 -0
- package/dist/panels/react/views-row/menu-classes.d.ts +6 -0
- package/dist/panels/react/views-row/menu-classes.js +3 -0
- package/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
- package/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
- package/dist/panels/react.d.ts +51 -0
- package/dist/panels/react.js +43 -0
- package/dist/panels/settings/axes.d.ts +28 -0
- package/dist/panels/settings/axes.js +71 -0
- package/dist/panels/settings/filters.d.ts +5 -0
- package/dist/panels/settings/filters.js +62 -0
- package/dist/panels/settings/group-buckets.d.ts +23 -0
- package/dist/panels/settings/group-buckets.js +73 -0
- package/dist/panels/settings/input.d.ts +69 -0
- package/dist/panels/settings/input.js +1 -0
- package/dist/panels/settings/layout.d.ts +5 -0
- package/dist/panels/settings/layout.js +244 -0
- package/dist/panels/settings/order.d.ts +19 -0
- package/dist/panels/settings/order.js +271 -0
- package/dist/panels/settings/settings-panels.d.ts +17 -0
- package/dist/panels/settings/settings-panels.js +28 -0
- package/dist/panels/toolbar/clear.d.ts +9 -0
- package/dist/panels/toolbar/clear.js +26 -0
- package/dist/panels/toolbar/counts.d.ts +15 -0
- package/dist/panels/toolbar/counts.js +21 -0
- package/dist/panels/toolbar/edit-view.d.ts +5 -0
- package/dist/panels/toolbar/edit-view.js +18 -0
- package/dist/panels/toolbar/model.d.ts +34 -0
- package/dist/panels/toolbar/model.js +52 -0
- package/dist/panels/use-filter-opened.d.ts +8 -0
- package/dist/panels/use-filter-opened.js +11 -0
- package/dist/panels/view-state.d.ts +38 -0
- package/dist/panels/view-state.js +1 -0
- package/dist/panels/views-row/model.d.ts +131 -0
- package/dist/panels/views-row/model.js +14 -0
- package/dist/provider/ViewsProvider.d.ts +46 -6
- package/dist/provider/ViewsProvider.js +32 -2
- package/dist/provider/components.d.ts +258 -11
- package/dist/provider/context.d.ts +21 -2
- package/dist/react.d.ts +5 -2
- package/dist/selection/SelectionBar.js +13 -7
- package/dist/selection/bar-overflow.js +14 -1
- package/dist/selection/bar-parts.d.ts +4 -2
- package/dist/selection/bar-parts.js +5 -3
- package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.js +1 -1
- package/dist/selection/verbs.d.ts +7 -0
- package/docs/contract.md +307 -41
- package/docs/getting-started.md +1 -1
- package/docs/guides/atoms.md +37 -5
- package/docs/guides/columns.md +1 -1
- package/docs/guides/display.md +3 -2
- package/docs/guides/editors.md +4 -3
- package/docs/guides/selection.md +4 -2
- package/docs/guides/the-grid.md +21 -11
- package/docs/guides/the-provider.md +22 -6
- package/docs/index.md +2 -2
- package/docs/install.md +2 -3
- package/docs/reference/cells.md +1 -1
- package/docs/reference/display.md +5 -4
- package/docs/reference/editors-location.md +3 -1
- package/docs/reference/editors-name.md +3 -1
- package/docs/reference/editors-number.md +1 -0
- package/docs/reference/editors-range.md +3 -1
- package/docs/reference/editors-session.md +1 -0
- package/docs/reference/editors-text.md +2 -2
- package/docs/reference/editors-value-list.md +1 -1
- package/docs/reference/field-row.md +2 -2
- package/docs/reference/grid.md +8 -5
- package/docs/reference/panels-react.md +101 -0
- package/docs/reference/panels.md +123 -0
- package/docs/reference/react.md +39 -16
- package/docs/reference/selection.md +5 -5
- package/docs/reference/views.md +17 -12
- package/package.json +16 -6
- package/skills/views/SKILL.md +4 -3
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ Guides:
|
|
|
69
69
|
- [The grid](./docs/guides/the-grid.md): grouping, sorting, writes, preferences, figures and the editing rules.
|
|
70
70
|
- [The rendering contract](./docs/contract.md): every public name and what each door holds; [reshaping a view](./docs/reshaping.md): the cheapest change first.
|
|
71
71
|
|
|
72
|
-
References, one per door, each naming every export: [`@viewkitjs/views`](./docs/reference/views.md), [`/react`](./docs/reference/react.md), [`/display`](./docs/reference/display.md), [`/editors`](./docs/reference/editors.md), [`/editors/select`](./docs/reference/editors-select.md), [`/editors/text`](./docs/reference/editors-text.md), [`/editors/relation`](./docs/reference/editors-relation.md), [`/editors/number`](./docs/reference/editors-number.md), [`/editors/range`](./docs/reference/editors-range.md), [`/editors/name`](./docs/reference/editors-name.md), [`/editors/location`](./docs/reference/editors-location.md), [`/editors/value-list`](./docs/reference/editors-value-list.md), [`/editors/date`](./docs/reference/editors-date.md), [`/editors/chips`](./docs/reference/editors-chips.md), [`/editors/session`](./docs/reference/editors-session.md), [`/editors/panel`](./docs/reference/editors-panel.md), [`/editors/open-values`](./docs/reference/editors-open-values.md), [`/field-row`](./docs/reference/field-row.md), [`/cells`](./docs/reference/cells.md), [`/selection`](./docs/reference/selection.md)
|
|
72
|
+
References, one per door, each naming every export: [`@viewkitjs/views`](./docs/reference/views.md), [`/react`](./docs/reference/react.md), [`/display`](./docs/reference/display.md), [`/editors`](./docs/reference/editors.md), [`/editors/select`](./docs/reference/editors-select.md), [`/editors/text`](./docs/reference/editors-text.md), [`/editors/relation`](./docs/reference/editors-relation.md), [`/editors/number`](./docs/reference/editors-number.md), [`/editors/range`](./docs/reference/editors-range.md), [`/editors/name`](./docs/reference/editors-name.md), [`/editors/location`](./docs/reference/editors-location.md), [`/editors/value-list`](./docs/reference/editors-value-list.md), [`/editors/date`](./docs/reference/editors-date.md), [`/editors/chips`](./docs/reference/editors-chips.md), [`/editors/session`](./docs/reference/editors-session.md), [`/editors/panel`](./docs/reference/editors-panel.md), [`/editors/open-values`](./docs/reference/editors-open-values.md), [`/field-row`](./docs/reference/field-row.md), [`/cells`](./docs/reference/cells.md), [`/selection`](./docs/reference/selection.md), [`/grid`](./docs/reference/grid.md), [`/panels`](./docs/reference/panels.md) and [`/panels/react`](./docs/reference/panels-react.md).
|
|
73
73
|
|
|
74
74
|
## Doors
|
|
75
75
|
|
|
@@ -86,8 +86,10 @@ References, one per door, each naming every export: [`@viewkitjs/views`](./docs/
|
|
|
86
86
|
| `@viewkitjs/views/cells` | a column's typed cell, and its column-shaped string formatters |
|
|
87
87
|
| `@viewkitjs/views/selection` | a list's selection: the model, the hook, the row checkbox, drag-select and the row-click rules |
|
|
88
88
|
| `@viewkitjs/views/grid` | the grid: the table, its props, its preferences, and the helpers a host shares with it |
|
|
89
|
+
| `@viewkitjs/views/panels` | what a list's panels read and say, built from its settings, and the toolbar's arrangement; no React |
|
|
90
|
+
| `@viewkitjs/views/panels/react` | the panels as they draw, the toolbar's frame, its parts and the ready toolbar |
|
|
89
91
|
|
|
90
|
-
Twenty-
|
|
92
|
+
Twenty-three doors; there are no other subpaths.
|
|
91
93
|
|
|
92
94
|
## For coding agents
|
|
93
95
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
const SIZE = {
|
|
5
|
+
chip: "h-4 w-4 -my-0.5 shrink-0 rounded-full object-cover",
|
|
6
|
+
glyph: "h-(--vk-glyph,0.875rem) w-(--vk-glyph,0.875rem) shrink-0 rounded-full object-cover",
|
|
7
|
+
};
|
|
8
|
+
export function DefaultAvatar({ avatarUrl, size, fallback }) {
|
|
9
|
+
const [broken, setBroken] = useState(false);
|
|
10
|
+
if (!avatarUrl || broken)
|
|
11
|
+
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
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { ViewsSide } from "../provider/components.js";
|
|
3
|
+
/** How long the pointer rests on a disabled control before its reason shows. */
|
|
4
|
+
export declare const DISABLED_REASON_DELAY_MS = 1000;
|
|
5
|
+
export declare function DisabledReason({ reason, side, className, children, }: {
|
|
6
|
+
reason?: string | null;
|
|
7
|
+
side?: ViewsSide;
|
|
8
|
+
/** The wrapper's layout: `block` for a row, `inline-flex` for a button in a line. */
|
|
9
|
+
className?: string;
|
|
10
|
+
children: ReactElement;
|
|
11
|
+
}): ReactNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useViews } from "../provider/context.js";
|
|
4
|
+
export const DISABLED_REASON_DELAY_MS = 1000;
|
|
5
|
+
export function DisabledReason({ reason, side = "right", className = "block", children, }) {
|
|
6
|
+
const { Tooltip } = useViews().components;
|
|
7
|
+
if (!reason)
|
|
8
|
+
return children;
|
|
9
|
+
return (_jsx(Tooltip, { content: reason, side: side, delayMs: DISABLED_REASON_DELAY_MS, children: _jsx("span", { className: className, children: children }) }));
|
|
10
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViewsMenuRowProps, ViewsToggleRowProps } from "./types.js";
|
|
2
|
-
export declare function DefaultMenuRow({ icon, label, value, active, disabled, onClick }: ViewsMenuRowProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare function DefaultToggleRow({ icon, label, active, disabled, onClick, reset }: ViewsToggleRowProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function DefaultMenuRow({ icon, label, value, active, disabled, disabledReason, onClick }: ViewsMenuRowProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DefaultToggleRow({ icon, label, active, disabled, disabledReason, onClick, reset }: ViewsToggleRowProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/atoms/DrillRows.js
CHANGED
|
@@ -3,23 +3,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { cx } from "../internal/cx.js";
|
|
4
4
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
5
5
|
import { useViews } from "../provider/context.js";
|
|
6
|
+
import { DisabledReason } from "./DisabledReason.js";
|
|
6
7
|
const ROW = "flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-(color:--vk-hovered)";
|
|
7
8
|
function Glyph({ active, children }) {
|
|
8
9
|
return (_jsx("span", { className: cx("flex size-4 shrink-0 items-center justify-center", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), children: children }));
|
|
9
10
|
}
|
|
10
|
-
export function DefaultMenuRow({ icon, label, value, active, disabled, onClick }) {
|
|
11
|
+
export function DefaultMenuRow({ icon, label, value, active, disabled, disabledReason, onClick }) {
|
|
11
12
|
const Chevron = useViews().icons.chevronRight;
|
|
12
|
-
return (_jsxs("button", { type: "button", "data-slot": "vk-menu-row", "data-chosen": active || undefined, "data-disabled": disabled || undefined, onClick: onClick, disabled: disabled, className: cx(ELEMENT_RESET, ROW, disabled && "cursor-default opacity-50 hover:bg-transparent"), children: [_jsx(Glyph, { active: active, children: icon }), _jsx("span", { className: cx("flex-1 whitespace-nowrap text-sm font-medium", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg)"), children: label }), _jsx("span", { className: cx("max-w-[120px] shrink-0 truncate whitespace-nowrap text-xs", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), children: value }), disabled ? null : _jsx(Chevron, { className: "size-3.5 shrink-0 text-(color:--vk-fg-subtlest)" })] }));
|
|
13
|
+
return (_jsx(DisabledReason, { reason: disabled ? disabledReason : undefined, children: _jsxs("button", { type: "button", "data-slot": "vk-menu-row", "data-chosen": active || undefined, "data-disabled": disabled || undefined, onClick: onClick, disabled: disabled, className: cx(ELEMENT_RESET, ROW, disabled && "cursor-default opacity-50 hover:bg-transparent"), children: [_jsx(Glyph, { active: active, children: icon }), _jsx("span", { className: cx("flex-1 whitespace-nowrap text-sm font-medium", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg)"), children: label }), _jsx("span", { className: cx("max-w-[120px] shrink-0 truncate whitespace-nowrap text-xs", active ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), children: value }), disabled ? null : _jsx(Chevron, { className: "size-3.5 shrink-0 text-(color:--vk-fg-subtlest)" })] }) }));
|
|
13
14
|
}
|
|
14
15
|
function SwitchMark({ on }) {
|
|
15
16
|
return (_jsx("span", { "aria-hidden": "true", className: cx("inline-flex h-4 w-7 shrink-0 items-center rounded-full border-2 transition-colors", on ? "border-transparent bg-(color:--vk-brand)" : "border-(color:--vk-border) bg-transparent"), children: _jsx("span", { className: cx("block size-3 rounded-full transition-transform", on ? "translate-x-3 bg-(color:--vk-fg-on-brand)" : "translate-x-0 bg-(color:--vk-border)") }) }));
|
|
16
17
|
}
|
|
17
|
-
export function DefaultToggleRow({ icon, label, active, disabled, onClick, reset }) {
|
|
18
|
+
export function DefaultToggleRow({ icon, label, active, disabled, disabledReason, onClick, reset }) {
|
|
19
|
+
const reason = disabled ? disabledReason : undefined;
|
|
18
20
|
const { icons, messages } = useViews();
|
|
19
21
|
const Reset = icons.reset;
|
|
20
22
|
const labelText = _jsx("span", { className: "flex-1 whitespace-nowrap text-sm font-medium text-(color:--vk-fg)", children: label });
|
|
21
23
|
if (reset) {
|
|
22
|
-
return (_jsxs("div", { "data-slot": "vk-toggle-row", "data-checked": active || undefined, className: ROW, children: [_jsxs("button", { type: "button", onClick: onClick, disabled: disabled, "aria-pressed": active, className: cx(ELEMENT_RESET, "flex min-w-0 flex-1 items-center gap-2.5 text-left"), children: [_jsx(Glyph, { active: active, children: icon }), labelText] }), _jsx("button", { type: "button", onClick: reset.onReset, "aria-label": messages({ key: "views.panels.toggle-reset", values: { label } }), title: messages({ key: "views.panels.toggle-reset-hint" }), className: cx(ELEMENT_RESET, "flex size-5 shrink-0 items-center justify-center rounded-full text-(color:--vk-fg-subtle) transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)"), children: _jsx(Reset, { className: "size-3" }) }), _jsx("button", { type: "button", onClick: onClick, disabled: disabled, "aria-pressed": active, className: cx(ELEMENT_RESET, "flex h-5 shrink-0 items-center"), children: _jsx(SwitchMark, { on: active }) })] }));
|
|
24
|
+
return (_jsxs("div", { "data-slot": "vk-toggle-row", "data-checked": active || undefined, className: ROW, children: [_jsx(DisabledReason, { reason: reason, className: "flex min-w-0 flex-1", children: _jsxs("button", { type: "button", onClick: onClick, disabled: disabled, "aria-pressed": active, className: cx(ELEMENT_RESET, "flex min-w-0 flex-1 items-center gap-2.5 text-left"), children: [_jsx(Glyph, { active: active, children: icon }), labelText] }) }), _jsx("button", { type: "button", onClick: reset.onReset, "aria-label": messages({ key: "views.panels.toggle-reset", values: { label } }), title: messages({ key: "views.panels.toggle-reset-hint" }), className: cx(ELEMENT_RESET, "flex size-5 shrink-0 items-center justify-center rounded-full text-(color:--vk-fg-subtle) transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)"), children: _jsx(Reset, { className: "size-3" }) }), _jsx("button", { type: "button", onClick: onClick, disabled: disabled, "aria-pressed": active, className: cx(ELEMENT_RESET, "flex h-5 shrink-0 items-center"), children: _jsx(SwitchMark, { on: active }) })] }));
|
|
23
25
|
}
|
|
24
|
-
return (_jsxs("button", { type: "button", "data-slot": "vk-toggle-row", "data-checked": active || undefined, onClick: onClick, disabled: disabled, "aria-pressed": active, className: cx(ELEMENT_RESET, ROW, disabled && "cursor-default opacity-50 hover:bg-transparent"), children: [_jsx(Glyph, { active: active, children: icon }), labelText, _jsx(SwitchMark, { on: active })] }));
|
|
26
|
+
return (_jsx(DisabledReason, { reason: reason, children: _jsxs("button", { type: "button", "data-slot": "vk-toggle-row", "data-checked": active || undefined, onClick: onClick, disabled: disabled, "aria-pressed": active, className: cx(ELEMENT_RESET, ROW, disabled && "cursor-default opacity-50 hover:bg-transparent"), children: [_jsx(Glyph, { active: active, children: icon }), labelText, _jsx(SwitchMark, { on: active })] }) }));
|
|
25
27
|
}
|
package/dist/atoms/Loading.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { ViewsLoadingProps } from "./types.js";
|
|
2
2
|
export declare function DefaultLoading({ placement, label }: ViewsLoadingProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
/** The ring alone, named for a screen reader by `label`; its size and place are the caller's. */
|
|
4
|
+
export declare function LoadingRing({ label, className, slot }: {
|
|
5
|
+
label: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
slot?: string;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/atoms/Loading.js
CHANGED
|
@@ -3,5 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { cx } from "../internal/cx.js";
|
|
4
4
|
export function DefaultLoading({ placement, label }) {
|
|
5
5
|
const body = placement === "body";
|
|
6
|
-
return (_jsx("div", { "data-slot": "vk-loading", className: cx("flex w-full items-center justify-center", body ? "min-h-40 py-10" : "min-h-12 py-6"), children: _jsx(
|
|
6
|
+
return (_jsx("div", { "data-slot": "vk-loading", className: cx("flex w-full items-center justify-center", body ? "min-h-40 py-10" : "min-h-12 py-6"), children: _jsx(LoadingRing, { label: label, className: body ? "size-7" : "size-5" }) }));
|
|
7
|
+
}
|
|
8
|
+
export function LoadingRing({ label, className, slot }) {
|
|
9
|
+
return (_jsx("span", { role: "status", "aria-label": label, "data-slot": slot, className: cx("inline-block shrink-0 animate-spin rounded-full border-2 border-(color:--vk-border) border-t-(color:--vk-brand)", className), children: _jsx("span", { className: "sr-only", children: label }) }));
|
|
7
10
|
}
|
package/dist/atoms/PanelRows.js
CHANGED
|
@@ -3,10 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { cx } from "../internal/cx.js";
|
|
4
4
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
5
5
|
import { useViews } from "../provider/context.js";
|
|
6
|
+
import { DisabledReason } from "./DisabledReason.js";
|
|
6
7
|
const ROW = "flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-(color:--vk-hovered)";
|
|
7
8
|
const CHOSEN = "font-medium text-(color:--vk-fg-selected)";
|
|
8
9
|
const DISABLED = "pointer-events-none opacity-50";
|
|
9
|
-
const DISABLED_REASON_DELAY_MS = 1000;
|
|
10
10
|
function ChosenCheck({ className }) {
|
|
11
11
|
const Check = useViews().icons.check;
|
|
12
12
|
return (_jsx("span", { className: "ml-auto flex size-4 shrink-0 items-center justify-center text-(color:--vk-fg-selected)", children: _jsx(Check, { className: cx("size-3.5", className) }) }));
|
|
@@ -22,12 +22,10 @@ export function DefaultCheckRow({ checked, onClick, children, leading, trailing,
|
|
|
22
22
|
return (_jsxs("button", { type: "button", "data-slot": "vk-check-row", "data-checked": checked || undefined, "aria-pressed": checked, onClick: onClick, disabled: disabled, className: cx(ELEMENT_RESET, ROW, "text-(color:--vk-fg)", disabled && DISABLED, className), children: [_jsx(TickBox, { checked: checked }), leading ? _jsx(Slot, { children: leading }) : null, _jsx("span", { className: "inline-flex min-w-0 flex-1 items-center", children: children }), trailing ? _jsx(Slot, { children: trailing }) : null] }));
|
|
23
23
|
}
|
|
24
24
|
export function DefaultRadioRow({ selected, label, onClick, leading, trailing, className, checkClassName, labelClassName, mark = "check", disabled, disabledReason, }) {
|
|
25
|
-
const { atoms
|
|
25
|
+
const { atoms } = useViews();
|
|
26
26
|
const box = mark === "box";
|
|
27
27
|
const row = (_jsxs("div", { "data-slot": "vk-radio-row", "data-chosen": selected || undefined, "data-disabled": disabled || undefined, className: cx(ROW, disabled && DISABLED, className), children: [_jsxs("button", { type: "button", "aria-pressed": selected, disabled: disabled, "aria-disabled": disabled || undefined, onClick: disabled ? undefined : onClick, className: cx(ELEMENT_RESET, "flex min-w-0 flex-1 items-center gap-2.5 text-left", !box && selected ? CHOSEN : "text-(color:--vk-fg)"), children: [box ? _jsx(atoms.TickBox, { checked: selected }) : null, leading ? _jsx(Slot, { children: leading }) : null, _jsx("span", { className: cx("flex-1 truncate text-sm", labelClassName), children: label }), !box && selected ? _jsx(ChosenCheck, { className: checkClassName }) : null] }), trailing] }));
|
|
28
|
-
|
|
29
|
-
return row;
|
|
30
|
-
return (_jsx(components.Tooltip, { content: disabledReason, side: "right", delayMs: DISABLED_REASON_DELAY_MS, children: _jsx("span", { className: "block", children: row }) }));
|
|
28
|
+
return _jsx(DisabledReason, { reason: disabled ? disabledReason : undefined, children: row });
|
|
31
29
|
}
|
|
32
30
|
export function DefaultDirectionButton({ dir, onClick, className, iconClassName }) {
|
|
33
31
|
const { icons, messages } = useViews();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
5
|
+
function sizeClass(plain, small) {
|
|
6
|
+
if (plain)
|
|
7
|
+
return small ? "px-2.5 py-1 text-[12px] leading-4 font-medium" : "h-8 px-3.5 text-[14px] leading-5 font-medium";
|
|
8
|
+
return small ? "px-2.5 py-0.5 text-[12px] font-medium" : "px-3 py-1 text-[14px] font-semibold";
|
|
9
|
+
}
|
|
10
|
+
function colourClass({ active, variant, activeClassName, hoverClassName }) {
|
|
11
|
+
if (variant === "plain") {
|
|
12
|
+
if (active)
|
|
13
|
+
return activeClassName ?? "bg-(color:--vk-selected,var(--vk-neutral)) text-(color:--vk-fg)";
|
|
14
|
+
return cx("text-(color:--vk-fg-subtle)", hoverClassName ?? "hover:bg-(color:--vk-hovered)");
|
|
15
|
+
}
|
|
16
|
+
if (active)
|
|
17
|
+
return activeClassName ?? "bg-(color:--vk-brand-subtlest) text-(color:--vk-fg-brand)";
|
|
18
|
+
return "bg-(color:--vk-neutral) text-(color:--vk-fg) hover:bg-(color:--vk-neutral-hovered)";
|
|
19
|
+
}
|
|
20
|
+
export function DefaultPill(props) {
|
|
21
|
+
const { active, variant, size, leading, leadingSlot, onClick, onContextMenu, onPointerDown, menuOpen, ref, children } = props;
|
|
22
|
+
const plain = variant === "plain";
|
|
23
|
+
const small = size === "sm";
|
|
24
|
+
return (_jsxs("button", { ref: ref, type: "button", "data-slot": "vk-pill", "data-active": active ? "true" : undefined, "aria-haspopup": menuOpen === undefined ? undefined : "menu", "aria-expanded": menuOpen, onClick: onClick, onContextMenu: onContextMenu, onPointerDown: onPointerDown, className: cx(ELEMENT_RESET, "inline-flex items-center rounded-full transition-colors duration-150 whitespace-nowrap", plain && !small ? "gap-2" : "gap-1.5", sizeClass(plain, small), (Boolean(leading) || leadingSlot) && (plain && !small ? "pl-3" : "pl-2"), colourClass(props)), children: [leading, children] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ViewsRangeCalendarProps } from "./types.js";
|
|
2
|
+
/** A range built by presses alone: a first press starts it, a second ends it (the earlier day first), and a
|
|
3
|
+
* press on a finished range starts a new one. ISO days compare as text. */
|
|
4
|
+
export declare function rangeAfterPress(from: string | null, to: string | null, day: string): {
|
|
5
|
+
from: string | null;
|
|
6
|
+
to: string | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function DefaultRangeCalendar({ mode, from, to, onSelect, armed, limit, footer, locale, className, }: ViewsRangeCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function rangeAfterPress(from, to, day) {
|
|
6
|
+
if (!from || to)
|
|
7
|
+
return { from: day, to: null };
|
|
8
|
+
if (day < from)
|
|
9
|
+
return { from: day, to: from };
|
|
10
|
+
return { from, to: day };
|
|
11
|
+
}
|
|
12
|
+
export function DefaultRangeCalendar({ mode, from, to, onSelect, armed, limit, footer, locale, className, }) {
|
|
13
|
+
const { Calendar } = useViews().components;
|
|
14
|
+
const shown = mode === "range" && armed === "to" ? to : from;
|
|
15
|
+
const press = (day) => {
|
|
16
|
+
if (day == null)
|
|
17
|
+
return onSelect({ from: null, to: null }, null);
|
|
18
|
+
let next;
|
|
19
|
+
if (mode === "single")
|
|
20
|
+
next = { from: day, to: null };
|
|
21
|
+
else if (armed === "from")
|
|
22
|
+
next = { from: day, to };
|
|
23
|
+
else if (armed === "to")
|
|
24
|
+
next = { from, to: day };
|
|
25
|
+
else
|
|
26
|
+
next = rangeAfterPress(from, to, day);
|
|
27
|
+
onSelect(next, day);
|
|
28
|
+
};
|
|
29
|
+
return (_jsxs("div", { "data-slot": "vk-range-calendar", className: cx("flex flex-col gap-2", className), children: [_jsx(Calendar, { value: shown, onChange: press, min: limit?.before, max: limit?.after, locale: locale }), footer] }));
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
export function DefaultRelationRoles({ relation, roles }) {
|
|
4
4
|
const labels = roles.map((role) => role.label).join(", ");
|
|
5
|
-
return (
|
|
5
|
+
return (_jsx("span", { "data-slot": "vk-relation-roles", title: `${relation.label} · ${labels}`, className: "-ml-1.5 min-w-0 grow basis-0 truncate text-(color:--vk-fg-subtlest)", children: _jsxs("span", { className: "pl-1.5", children: [" · ", labels] }) }));
|
|
6
6
|
}
|
|
@@ -16,15 +16,16 @@ export function DefaultSelectionSheet({ open, onOpenChange, title, verbs, onDele
|
|
|
16
16
|
onOpenChange(false, { reason: "item-press" });
|
|
17
17
|
verb();
|
|
18
18
|
};
|
|
19
|
+
const why = (disabled, reason) => (!busy && disabled ? reason : undefined);
|
|
19
20
|
const Trash = icons.delete;
|
|
20
21
|
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, title: title, label: messages({ key: "views.selection.sheet-label" }), snap: "auto", children: _jsx("div", { "data-slot": "vk-selection-sheet", children: _jsxs(List, { children: [verbs.map((verb, index) => {
|
|
21
22
|
if (verb.kind === "action") {
|
|
22
|
-
return (_jsx(Row, { label: verb.label, leading: verb.icon, className: cx(verb.destructive && DANGER), disabled: busy || verb.disabled, onClick: run(verb.onClick) }, index));
|
|
23
|
+
return (_jsx(Row, { label: verb.label, leading: verb.icon, description: why(verb.disabled, verb.disabledReason), className: cx(verb.destructive && DANGER), disabled: busy || verb.disabled, onClick: run(verb.onClick) }, index));
|
|
23
24
|
}
|
|
24
25
|
const isOpen = expanded === index;
|
|
25
26
|
const rows = verb.kind === "group"
|
|
26
|
-
? verb.items.map((item, at) => (_jsx(Row, { label: item.label, leading: item.icon, className: cx(item.destructive && DANGER), disabled: busy || item.disabled, onClick: run(item.onClick) }, at)))
|
|
27
|
-
: verb.options.map((option) => (_jsx(Row, { size: "compact", label: _jsx(OptionLabel, { option: option }), disabled: busy, onClick: run(() => verb.onSelect(option.value)) }, option.value)));
|
|
28
|
-
return (_jsxs(Fragment, { children: [_jsx(Row, { label: verb.label, leading: verb.icon, disabled: busy || verb.disabled, open: isOpen, onClick: () => setExpanded(isOpen ? null : index) }), _jsx(Collapse, { open: isOpen, children: _jsx("div", { className: "pl-4", children: rows }) })] }, index));
|
|
27
|
+
? verb.items.map((item, at) => (_jsx(Row, { label: item.label, leading: item.icon, description: why(item.disabled, item.disabledReason), className: cx(item.destructive && DANGER), disabled: busy || item.disabled, onClick: run(item.onClick) }, at)))
|
|
28
|
+
: verb.options.map((option) => (_jsx(Row, { size: "compact", label: _jsx(OptionLabel, { option: option, steps: verb.options }), disabled: busy, onClick: run(() => verb.onSelect(option.value)) }, option.value)));
|
|
29
|
+
return (_jsxs(Fragment, { children: [_jsx(Row, { label: verb.label, leading: verb.icon, description: why(verb.disabled, verb.disabledReason), disabled: busy || verb.disabled, open: isOpen, onClick: () => setExpanded(isOpen ? null : index) }), _jsx(Collapse, { open: isOpen, children: _jsx("div", { className: "pl-4", children: rows }) })] }, index));
|
|
29
30
|
}), onDelete ? (_jsx(Row, { label: deleteLabel, leading: _jsx(Trash, { className: "h-4 w-4" }), className: DANGER, disabled: busy, onClick: run(onDelete) })) : null] }) }) }));
|
|
30
31
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ViewsToolbarButtonProps } from "./types.js";
|
|
2
|
+
export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, size, popup, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
5
|
+
import { useViews } from "../provider/context.js";
|
|
6
|
+
const flag = (on) => (on ? "" : undefined);
|
|
7
|
+
export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, size, popup, onClick, onPointerDown, ref, }) {
|
|
8
|
+
const { messages } = useViews();
|
|
9
|
+
const counted = !dot && typeof count === "number" && count > 0;
|
|
10
|
+
return (_jsxs("span", { className: "relative inline-flex shrink-0", children: [_jsxs("button", { ref: ref, type: "button", "aria-label": label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : undefined, disabled: disabled, "data-slot": "vk-toolbar-button", "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), onClick: onClick, onPointerDown: onPointerDown, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center rounded-full transition-colors duration-150", size === "sm" ? "h-8 w-8" : "h-9 w-9", open
|
|
11
|
+
? "bg-(color:--vk-pressed) text-(color:--vk-fg)"
|
|
12
|
+
: cx("hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", changed ? "text-(color:--vk-fg-brand)" : "text-(color:--vk-fg-subtle)"), disabled && "pointer-events-none opacity-40"), children: [icon, word !== null && (_jsx("span", { "data-slot": "vk-toolbar-word", className: "hidden text-sm font-medium", children: word ?? label }))] }), dot && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-toolbar-dot", className: "pointer-events-none absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-(color:--vk-brand)" })), counted &&
|
|
13
|
+
(onClear ? (_jsx("button", { type: "button", "data-slot": "vk-toolbar-count", "aria-label": messages({ key: "views.panels.toolbar-clear" }), disabled: disabled, onClick: (event) => {
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
onClear();
|
|
16
|
+
}, className: cx(ELEMENT_RESET, COUNT_CLASS), children: count })) : (_jsx("span", { "data-slot": "vk-toolbar-count", className: cx(COUNT_CLASS, "pointer-events-none"), children: count })))] }));
|
|
17
|
+
}
|
|
18
|
+
const COUNT_CLASS = "absolute -right-1 -top-1 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-(color:--vk-brand) px-1 text-[10px] font-bold tabular-nums text-(color:--vk-fg-on-brand)";
|
package/dist/atoms/defaults.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { DefaultAvatar } from "./Avatar.js";
|
|
1
2
|
import { DefaultCommandMenu } from "./CommandMenu.js";
|
|
2
3
|
import { DefaultMenuRow, DefaultToggleRow } from "./DrillRows.js";
|
|
3
4
|
import { DefaultCheckRow, DefaultChoiceRow, DefaultDirectionButton, DefaultRadioRow } from "./PanelRows.js";
|
|
4
5
|
import { DefaultPanelSearch } from "./PanelSearch.js";
|
|
6
|
+
import { DefaultPill } from "./Pill.js";
|
|
5
7
|
import { DefaultList } from "./List.js";
|
|
6
8
|
import { DefaultLoading } from "./Loading.js";
|
|
7
9
|
import { DefaultLoadMore } from "./LoadMore.js";
|
|
8
10
|
import { DefaultPlatformMark } from "./PlatformMark.js";
|
|
11
|
+
import { DefaultRangeCalendar } from "./RangeCalendar.js";
|
|
9
12
|
import { DefaultRelationLink } from "./RelationLink.js";
|
|
10
13
|
import { DefaultRelationRoles } from "./RelationRoles.js";
|
|
14
|
+
import { DefaultCellMore } from "./CellMore.js";
|
|
11
15
|
import { DefaultRow, DefaultRowContent } from "./Row.js";
|
|
12
16
|
import { DefaultRowMenu } from "./RowMenu.js";
|
|
13
17
|
import { DefaultSelectionSheet } from "./SelectionSheet.js";
|
|
@@ -15,17 +19,20 @@ import { DefaultStatusBadge } from "./StatusBadge.js";
|
|
|
15
19
|
import { DefaultStatusMarker } from "./StatusMarker.js";
|
|
16
20
|
import { DefaultTag } from "./Tag.js";
|
|
17
21
|
import { DefaultTickBox } from "./TickBox.js";
|
|
22
|
+
import { DefaultToolbarButton } from "./ToolbarButton.js";
|
|
18
23
|
export const DEFAULT_VIEWS_ATOMS = {
|
|
19
24
|
List: DefaultList,
|
|
20
25
|
Row: DefaultRow,
|
|
21
26
|
RowContent: DefaultRowContent,
|
|
22
27
|
TickBox: DefaultTickBox,
|
|
28
|
+
Avatar: DefaultAvatar,
|
|
23
29
|
StatusBadge: DefaultStatusBadge,
|
|
24
30
|
StatusMarker: DefaultStatusMarker,
|
|
25
31
|
Tag: DefaultTag,
|
|
26
32
|
CommandMenu: DefaultCommandMenu,
|
|
27
33
|
RelationLink: DefaultRelationLink,
|
|
28
34
|
RelationRoles: DefaultRelationRoles,
|
|
35
|
+
CellMore: DefaultCellMore,
|
|
29
36
|
Loading: DefaultLoading,
|
|
30
37
|
LoadMore: DefaultLoadMore,
|
|
31
38
|
PlatformMark: DefaultPlatformMark,
|
|
@@ -38,4 +45,7 @@ export const DEFAULT_VIEWS_ATOMS = {
|
|
|
38
45
|
ToggleRow: DefaultToggleRow,
|
|
39
46
|
PanelSearch: DefaultPanelSearch,
|
|
40
47
|
SelectionSheet: DefaultSelectionSheet,
|
|
48
|
+
Pill: DefaultPill,
|
|
49
|
+
RangeCalendar: DefaultRangeCalendar,
|
|
50
|
+
ToolbarButton: DefaultToolbarButton,
|
|
41
51
|
};
|
package/dist/atoms/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType, KeyboardEvent, MouseEventHandler, ReactElement, ReactNode, RefObject } from "react";
|
|
1
|
+
import type { ComponentType, 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";
|
|
@@ -56,14 +56,45 @@ export type ViewsTickBoxProps = {
|
|
|
56
56
|
checked: boolean;
|
|
57
57
|
className?: string;
|
|
58
58
|
};
|
|
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. Paint only: whatever wraps it owns the click. */
|
|
61
|
+
export type ViewsAvatarProps = {
|
|
62
|
+
/** Whose picture: the name the chip or the row shows, for initials. */
|
|
63
|
+
label: string;
|
|
64
|
+
/** The picture, when there is one. */
|
|
65
|
+
avatarUrl?: string | null;
|
|
66
|
+
/** The record's kind as your app names it, for the avatar's shape: a relation's `entity`, `user` for a member,
|
|
67
|
+
* an actor's type. */
|
|
68
|
+
kind?: string;
|
|
69
|
+
/** `chip`: inside a chip, 16px by default. `glyph`: before the name, at `--vk-glyph`. */
|
|
70
|
+
size: "chip" | "glyph";
|
|
71
|
+
/** The glyph the chip or the name draws with no picture. The default draws it when the picture is missing or
|
|
72
|
+
* fails to load; yours may draw it for a kind it doesn't dress (an automation, say). */
|
|
73
|
+
fallback?: ReactNode;
|
|
74
|
+
};
|
|
59
75
|
/** The rows' container: the inset a run of rows sits in, inside a panel or a command group. */
|
|
60
76
|
export type ViewsListProps = {
|
|
61
77
|
children: ReactNode;
|
|
62
78
|
className?: string;
|
|
63
79
|
};
|
|
80
|
+
/** One of a status field's options, as a badge is handed them. */
|
|
81
|
+
export type ViewsStatusOption = {
|
|
82
|
+
value: string;
|
|
83
|
+
label: string;
|
|
84
|
+
slot?: StatusSlot;
|
|
85
|
+
};
|
|
86
|
+
/** Where a status stands among its field's steps: the field's active options in their order, and this one's index. */
|
|
87
|
+
export type ViewsStatusPlace = {
|
|
88
|
+
index: number;
|
|
89
|
+
options: readonly ViewsStatusOption[];
|
|
90
|
+
};
|
|
64
91
|
export type ViewsStatusBadgeProps = {
|
|
65
92
|
slot: StatusSlot;
|
|
66
93
|
label: ReactNode;
|
|
94
|
+
/** Where this status stands among its field's steps (its active options), handed wherever a field's option is
|
|
95
|
+
* drawn: a cell, the select editor, the selection bar. Absent for a value that is no step (a stray value, an
|
|
96
|
+
* archived one) and for a badge that is no option. */
|
|
97
|
+
place?: ViewsStatusPlace;
|
|
67
98
|
/** Replaces the slot's own mark. */
|
|
68
99
|
leading?: ReactNode;
|
|
69
100
|
title?: string;
|
|
@@ -124,6 +155,14 @@ export type ViewsRelationRolesProps = {
|
|
|
124
155
|
label: string;
|
|
125
156
|
}[];
|
|
126
157
|
};
|
|
158
|
+
/** The count after a cell's shown values ("+2"), drawn inside its element (`data-slot="vk-cell-more"`): a button that
|
|
159
|
+
* opens the whole list, or plain text when the host owns the click (`inert`). The default draws the "+" and the number,
|
|
160
|
+
* and with it ViewKit keeps today's frame on the element; with an app's own the element is bare, so the app's chip (a
|
|
161
|
+
* count tag) stands there alone. */
|
|
162
|
+
export type ViewsCellMoreProps = {
|
|
163
|
+
count: number;
|
|
164
|
+
inert: boolean;
|
|
165
|
+
};
|
|
127
166
|
/** A wait: the whole list reloading (`body`), or more rows arriving (`footer`). The default is a
|
|
128
167
|
* plain ring; an app swaps in its own loader. */
|
|
129
168
|
export type ViewsLoadingProps = {
|
|
@@ -168,6 +207,7 @@ export type ViewsSelectionSheetProps = {
|
|
|
168
207
|
onOpenChange: ViewsOpenChange;
|
|
169
208
|
/** "3 selected". */
|
|
170
209
|
title: string;
|
|
210
|
+
/** Each disabled verb carries its `disabledReason`; the default draws it as the row's second line. */
|
|
171
211
|
verbs: readonly SelectionVerb[];
|
|
172
212
|
/** The bar's own delete, drawn last; absent when the list has no bulk delete. */
|
|
173
213
|
onDelete?: () => void;
|
|
@@ -260,6 +300,8 @@ export type ViewsMenuRowProps = {
|
|
|
260
300
|
active: boolean;
|
|
261
301
|
/** Listed but not openable. */
|
|
262
302
|
disabled?: boolean;
|
|
303
|
+
/** Why it is disabled; a disabled row with one shows it in the map's `Tooltip` once the pointer rests. */
|
|
304
|
+
disabledReason?: string;
|
|
263
305
|
onClick: () => void;
|
|
264
306
|
};
|
|
265
307
|
/** A boolean that flips in place, a painted switch where the chevron would be; `reset` draws the way back to
|
|
@@ -269,6 +311,8 @@ export type ViewsToggleRowProps = {
|
|
|
269
311
|
label: string;
|
|
270
312
|
active: boolean;
|
|
271
313
|
disabled?: boolean;
|
|
314
|
+
/** Why it is disabled; a disabled row with one shows it in the map's `Tooltip` once the pointer rests. */
|
|
315
|
+
disabledReason?: string;
|
|
272
316
|
onClick: () => void;
|
|
273
317
|
reset?: {
|
|
274
318
|
onReset: () => void;
|
|
@@ -290,17 +334,110 @@ export type ViewsPanelSearchProps = {
|
|
|
290
334
|
suffix?: ReactNode;
|
|
291
335
|
inputMode?: "text" | "decimal" | "numeric";
|
|
292
336
|
};
|
|
337
|
+
/** One option of a row of pills (the views row, a tab row): a button. The row decides its state and
|
|
338
|
+
* hands its glyph and label in; the pill draws its look. */
|
|
339
|
+
export type ViewsPillProps = {
|
|
340
|
+
/** The pill stands for the current choice. */
|
|
341
|
+
active: boolean;
|
|
342
|
+
/** `solid`: every pill a filled chip, the active one tinted; `plain`: a ghost, the active one a selected wash. */
|
|
343
|
+
variant: "solid" | "plain";
|
|
344
|
+
/** `sm` for a row beneath another. */
|
|
345
|
+
size: "default" | "sm";
|
|
346
|
+
/** The glyph slot ahead of the label: the option's glyph, or in a row that reorders the grip over it. */
|
|
347
|
+
leading?: ReactNode;
|
|
348
|
+
/** Keep the leading inset with no glyph: a pill that can be dragged, where the grip lands. */
|
|
349
|
+
leadingSlot?: boolean;
|
|
350
|
+
/** The app's own classes for this option's active look, in place of the pill's own: a status colour. */
|
|
351
|
+
activeClassName?: string;
|
|
352
|
+
/** The app's own `hover:` classes while this option is inactive, in place of the pill's own hover. */
|
|
353
|
+
hoverClassName?: string;
|
|
354
|
+
onClick?: () => void;
|
|
355
|
+
onContextMenu?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
356
|
+
onPointerDown?: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
357
|
+
/** Set when the pill opens a menu: `aria-haspopup="menu"`, and `aria-expanded` from it. */
|
|
358
|
+
menuOpen?: boolean;
|
|
359
|
+
ref?: Ref<HTMLButtonElement>;
|
|
360
|
+
children: ReactNode;
|
|
361
|
+
};
|
|
362
|
+
/** A month to pick one day or a range of days on, in ISO days (`YYYY-MM-DD`): the filter panel's date, its date
|
|
363
|
+
* ranges and its custom time scope (VK-392). The default is the map's one-day `Calendar`; an app hands its own
|
|
364
|
+
* to paint a range. */
|
|
365
|
+
export type ViewsRangeCalendarProps = {
|
|
366
|
+
/** `single`: one day, held in `from`. `range`: two ends. */
|
|
367
|
+
mode: "single" | "range";
|
|
368
|
+
from: string | null;
|
|
369
|
+
to: string | null;
|
|
370
|
+
/** Every press: the selection the calendar makes of it, and the day pressed (null when the calendar emptied
|
|
371
|
+
* the selection). */
|
|
372
|
+
onSelect: (next: {
|
|
373
|
+
from: string | null;
|
|
374
|
+
to: string | null;
|
|
375
|
+
}, day: string | null) => void;
|
|
376
|
+
/** The end the next press sets, which the editor decides; the other end is drawn quieter. Absent, the
|
|
377
|
+
* calendar picks a range by its own rule: a first press starts it, a second ends it. */
|
|
378
|
+
armed?: "from" | "to";
|
|
379
|
+
/** Days before `before` or after `after` can't be pressed. */
|
|
380
|
+
limit?: {
|
|
381
|
+
before?: string;
|
|
382
|
+
after?: string;
|
|
383
|
+
};
|
|
384
|
+
/** A window painted in place of the selection, which no press changes (a relative date). */
|
|
385
|
+
window?: {
|
|
386
|
+
from: string;
|
|
387
|
+
to: string;
|
|
388
|
+
};
|
|
389
|
+
/** A range spans at least this many nights, so a first press stays a partial range. */
|
|
390
|
+
minNights?: number;
|
|
391
|
+
/** Drawn under the month. */
|
|
392
|
+
footer?: ReactNode;
|
|
393
|
+
/** A day cell's size, a CSS length; every other size follows it. */
|
|
394
|
+
cellSize?: string;
|
|
395
|
+
/** The conventions' locale (BCP 47), as the map's `Calendar` takes it. */
|
|
396
|
+
locale: string;
|
|
397
|
+
className?: string;
|
|
398
|
+
};
|
|
399
|
+
/** A toolbar's button (VK-409): a glyph in a circle, its word for the dresses that show one, and what it says
|
|
400
|
+
* about the list. The toolbar's parts hand it in; an app swaps it for its own. */
|
|
401
|
+
export type ViewsToolbarButtonProps = {
|
|
402
|
+
/** The glyph. */
|
|
403
|
+
icon: ReactNode;
|
|
404
|
+
/** The button's name: its `aria-label`, and the word a dress shows unless `word` says otherwise. */
|
|
405
|
+
label: string;
|
|
406
|
+
/** The word a dress shows in place of the glyph; `null`, none (Search: its glyph is its word). */
|
|
407
|
+
word?: string | null;
|
|
408
|
+
/** A number in the corner: what is applied. */
|
|
409
|
+
count?: number;
|
|
410
|
+
/** With a count: the count becomes a ✕ badge that clears what it counts. */
|
|
411
|
+
onClear?: () => void;
|
|
412
|
+
/** "Something is applied" with no number; drawn instead of a count. */
|
|
413
|
+
dot?: boolean;
|
|
414
|
+
/** What it opens is open: the ground stays painted. */
|
|
415
|
+
open?: boolean;
|
|
416
|
+
/** The list differs from its default here (lit). */
|
|
417
|
+
changed?: boolean;
|
|
418
|
+
/** The row's outermost button, the one a dress may set apart (New). */
|
|
419
|
+
edge?: boolean;
|
|
420
|
+
disabled?: boolean;
|
|
421
|
+
size: "md" | "sm";
|
|
422
|
+
/** Set when it opens a popup: `aria-haspopup`, and `aria-expanded` from `open`. */
|
|
423
|
+
popup?: "menu" | "dialog";
|
|
424
|
+
onClick?: (event: ReactMouseEvent<HTMLButtonElement>) => void;
|
|
425
|
+
onPointerDown?: (event: ReactPointerEvent<HTMLButtonElement>) => void;
|
|
426
|
+
ref?: Ref<HTMLButtonElement>;
|
|
427
|
+
};
|
|
293
428
|
export type ViewsAtoms = {
|
|
294
429
|
List: ComponentType<ViewsListProps>;
|
|
295
430
|
Row: ComponentType<ViewsRowProps>;
|
|
296
431
|
RowContent: ComponentType<ViewsRowContentProps>;
|
|
297
432
|
TickBox: ComponentType<ViewsTickBoxProps>;
|
|
433
|
+
Avatar: ComponentType<ViewsAvatarProps>;
|
|
298
434
|
StatusBadge: ComponentType<ViewsStatusBadgeProps>;
|
|
299
435
|
StatusMarker: ComponentType<ViewsStatusMarkerProps>;
|
|
300
436
|
Tag: ComponentType<ViewsTagProps>;
|
|
301
437
|
CommandMenu: ComponentType<ViewsCommandMenuProps>;
|
|
302
438
|
RelationLink: ComponentType<ViewsRelationLinkProps>;
|
|
303
439
|
RelationRoles: ComponentType<ViewsRelationRolesProps>;
|
|
440
|
+
CellMore: ComponentType<ViewsCellMoreProps>;
|
|
304
441
|
Loading: ComponentType<ViewsLoadingProps>;
|
|
305
442
|
LoadMore: ComponentType<ViewsLoadMoreProps>;
|
|
306
443
|
PlatformMark: ComponentType<ViewsPlatformMarkProps>;
|
|
@@ -313,4 +450,7 @@ export type ViewsAtoms = {
|
|
|
313
450
|
ToggleRow: ComponentType<ViewsToggleRowProps>;
|
|
314
451
|
PanelSearch: ComponentType<ViewsPanelSearchProps>;
|
|
315
452
|
SelectionSheet: ComponentType<ViewsSelectionSheetProps>;
|
|
453
|
+
Pill: ComponentType<ViewsPillProps>;
|
|
454
|
+
RangeCalendar: ComponentType<ViewsRangeCalendarProps>;
|
|
455
|
+
ToolbarButton: ComponentType<ViewsToolbarButtonProps>;
|
|
316
456
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
2
|
import type { PercentDisplay } from "@viewkitjs/fields";
|
|
3
3
|
import type { FieldPresentation, FieldViewerContext } from "../display/options.js";
|
|
4
4
|
import type { FieldRowMenuItem } from "../fields/menus.js";
|
|
5
5
|
import type { ListColumn, ListRelationValue, ListSelectColor } from "../model/column-schema.js";
|
|
6
6
|
import type { ListDateStyle, ListDurationStyle } from "../model/column-format.js";
|
|
7
|
+
import type { ViewsCheckboxProps } from "../provider/components.js";
|
|
7
8
|
/**
|
|
8
9
|
* COLUMN-SHAPED FORMATTING — the two string formatters that still take a column,
|
|
9
10
|
* and the per-row currency only this layer can resolve.
|
|
@@ -36,6 +37,11 @@ export type GridCellOptions = {
|
|
|
36
37
|
withTime?: boolean;
|
|
37
38
|
/** Percent columns: the workspace's display — wins over `format.percentDisplay`. */
|
|
38
39
|
percentDisplay?: PercentDisplay;
|
|
40
|
+
/** The grid's part on a title's name link (`vk-grid-title`), spread on the element that opens the row. Only the
|
|
41
|
+
* grid hands it; a title drawn anywhere else names no part. */
|
|
42
|
+
titleData?: {
|
|
43
|
+
readonly "data-slot": string;
|
|
44
|
+
};
|
|
39
45
|
/** Optimistic pending value (Tier 3) — wins over `accessor(row)` when defined.
|
|
40
46
|
* Only typed cells honor it; custom `render` columns show confirmed data. */
|
|
41
47
|
valueOverride?: unknown;
|
|
@@ -56,6 +62,9 @@ export type GridCellOptions = {
|
|
|
56
62
|
* unclickable glyph, so a read-only or settings-locked column can't be toggled.
|
|
57
63
|
*/
|
|
58
64
|
onToggle?: (next: boolean) => void;
|
|
65
|
+
/** A two-way boolean in the checkbox style draws this control in place of ViewKit's tick box in its own button:
|
|
66
|
+
* the grid hands the components map's `Checkbox` while the provider's `gridCheckboxes` is `checkbox`. */
|
|
67
|
+
booleanCheckbox?: ComponentType<ViewsCheckboxProps>;
|
|
59
68
|
/**
|
|
60
69
|
* `command` columns: the verbs this row offers INSTEAD of an editor, already
|
|
61
70
|
* resolved for the row (`FieldMenus<Row>[key](row)`). Behavioral, like the two
|
|
@@ -13,4 +13,8 @@ import type { ListColumn } from "../model/column-schema.js";
|
|
|
13
13
|
* generic indicator lane for this type: the adornment has to sit inside the
|
|
14
14
|
* cell's own layout rules about where the click target ends.
|
|
15
15
|
*/
|
|
16
|
-
export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, content: ReactNode
|
|
16
|
+
export declare function renderTitleCell<Row>(col: ListColumn<Row>, row: Row, content: ReactNode,
|
|
17
|
+
/** The surface's part on the name link: the grid hands `vk-grid-title`; elsewhere none. */
|
|
18
|
+
data?: {
|
|
19
|
+
readonly "data-slot": string;
|
|
20
|
+
}): ReactNode;
|