@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
|
@@ -2,10 +2,13 @@ import type { FieldConventions } from "@viewkitjs/fields";
|
|
|
2
2
|
import type { ViewsMessageResolver } from "../contract.js";
|
|
3
3
|
import type { ViewsAtoms } from "../atoms/types.js";
|
|
4
4
|
import type { FieldPresentation } from "../display/options.js";
|
|
5
|
-
import type { ViewsMenuRoute, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetActionsPlace } from "./components.js";
|
|
5
|
+
import type { ViewsDatePicks, ViewsFieldRowButtons, ViewsFieldRowCheckboxes, ViewsGridButtons, ViewsGridCheckboxes, ViewsMenuRoute, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetActionsPlace } from "./components.js";
|
|
6
6
|
import type { ViewsIcons } from "./icons.js";
|
|
7
7
|
import type { ViewsResolvedPorts } from "./ports.js";
|
|
8
8
|
import type { ViewsEscapeRules } from "../editors/escape-rule.js";
|
|
9
|
+
import type { ViewsBodyFrame } from "../model/body-frame.js";
|
|
10
|
+
import type { ViewsSeveralValues } from "../display/fit-values.js";
|
|
11
|
+
import type { ViewsOneValueEditors } from "../model/one-value.js";
|
|
9
12
|
export type ViewsContextValue = {
|
|
10
13
|
/** The app's components, with the optional ones filled: the app's own, or the package's plain default. */
|
|
11
14
|
components: ViewsResolvedComponents;
|
|
@@ -19,16 +22,32 @@ export type ViewsContextValue = {
|
|
|
19
22
|
presentation?: (defaults: FieldPresentation) => FieldPresentation;
|
|
20
23
|
/** The media query that means a desktop: the app's own, or `DEFAULT_DESKTOP_QUERY`. */
|
|
21
24
|
desktopQuery: string;
|
|
22
|
-
/** Where the editor panel's ✕ and
|
|
25
|
+
/** Where the editor panel's ✕ and ✓, and a toolbar panel's ✕, stand on a phone. Absent means `bar`. */
|
|
23
26
|
sheetActions?: ViewsSheetActionsPlace;
|
|
24
27
|
/** What Escape does per field type (`ViewsProvider`'s `escape`); absent, every type throws the edit away. */
|
|
25
28
|
escape?: ViewsEscapeRules;
|
|
29
|
+
/** Which single types open as the value list holding one (`ViewsProvider`'s `oneValue`); absent, the text box. */
|
|
30
|
+
oneValue?: ViewsOneValueEditors;
|
|
26
31
|
/** The grid says why the app refused an edit it sent (`ViewsProvider`'s `sayRefusals`); absent, it says nothing. */
|
|
27
32
|
sayRefusals?: boolean;
|
|
28
33
|
/** How the grid opens its own menus (`ViewsProvider`'s `menus`). Absent means `popover`. */
|
|
29
34
|
menus?: ViewsMenuRoute;
|
|
35
|
+
/** Who draws the buttons the grid draws itself (`ViewsProvider`'s `gridButtons`). Absent means `own`. */
|
|
36
|
+
gridButtons?: ViewsGridButtons;
|
|
37
|
+
/** How a cell of several values draws on one line (`ViewsProvider`'s `severalValues`). Absent means `first`. */
|
|
38
|
+
severalValues?: ViewsSeveralValues;
|
|
39
|
+
/** Who draws a yes/no cell's box in the grid (`ViewsProvider`'s `gridCheckboxes`). Absent means `own`. */
|
|
40
|
+
gridCheckboxes?: ViewsGridCheckboxes;
|
|
41
|
+
/** Who draws a field row's own buttons (`ViewsProvider`'s `fieldRowButtons`). Absent means `own`. */
|
|
42
|
+
fieldRowButtons?: ViewsFieldRowButtons;
|
|
43
|
+
/** Who draws a field row's yes/no box (`ViewsProvider`'s `fieldRowCheckboxes`). Absent means `own`. */
|
|
44
|
+
fieldRowCheckboxes?: ViewsFieldRowCheckboxes;
|
|
45
|
+
/** Who frames a whole body the app hands (`ViewsProvider`'s `bodyFrame`). Absent means `views`. */
|
|
46
|
+
bodyFrame?: ViewsBodyFrame;
|
|
30
47
|
/** Where the selection bar sits (`ViewsProvider`'s `selectionBar`); absent, the package's defaults. */
|
|
31
48
|
selectionBar?: ViewsSelectionBarSettings;
|
|
49
|
+
/** The quick days the date editors offer (`ViewsProvider`'s `datePicks`); absent, today, tomorrow and next Monday. */
|
|
50
|
+
datePicks?: ViewsDatePicks;
|
|
32
51
|
};
|
|
33
52
|
export declare const ViewsContext: import("react").Context<ViewsContextValue | null>;
|
|
34
53
|
export declare function useViews(): ViewsContextValue;
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { ViewsProvider, useViews } from "./provider/ViewsProvider.js";
|
|
2
2
|
export type { ViewsContextValue, ViewsProviderProps } from "./provider/ViewsProvider.js";
|
|
3
3
|
export type { EditEscape, ViewsEscapeRules } from "./editors/escape-rule.js";
|
|
4
|
+
export type { ViewsOneValueEditors } from "./model/one-value.js";
|
|
5
|
+
export type { ViewsBodyFrame } from "./model/body-frame.js";
|
|
4
6
|
export { DEFAULT_DESKTOP_QUERY } from "./provider/desktop.js";
|
|
5
|
-
export type {
|
|
7
|
+
export type { ViewsSeveralValues } from "./display/fit-values.js";
|
|
8
|
+
export type { ViewsAlign, ViewsAnchor, ViewsBarPlacement, ViewsButtonProps, ViewsCalendarProps, ViewsCheckboxProps, ViewsCloseReason, ViewsCollapseProps, ViewsCommandParts, ViewsComponents, ViewsDateBodyProps, ViewsDatePick, ViewsDatePicks, ViewsGridButtons, ViewsSelectionChip, ViewsGridCheckboxes, ViewsFieldRowButtons, ViewsFieldRowCheckboxes, ViewsInputProps, ViewsMenuItem, ViewsMenuProps, ViewsMenuRoute, ViewsNumberBodyProps, ViewsOpenChange, ViewsPartsBodyProps, ViewsPickerAction, ViewsPickerItem, ViewsPickerProps, ViewsPlacePart, ViewsPlaceParts, ViewsPopoverProps, ViewsResolvedComponents, ViewsSelectionBarSettings, ViewsSheetAction, ViewsSheetActions, ViewsSheetActionsPlace, ViewsSheetProps, ViewsSide, ViewsTextBodyProps, ViewsTooltipProps, ViewsValueLine, ViewsValuesBodyProps, } from "./provider/components.js";
|
|
6
9
|
export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
|
|
7
10
|
export { NOOP_PORTS } from "./provider/ports.js";
|
|
8
11
|
export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
|
|
9
12
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|
|
10
|
-
export type { ViewsAtoms, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, } from "./atoms/types.js";
|
|
13
|
+
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, } from "./atoms/types.js";
|
|
11
14
|
export type { ComponentName, PortName, ViewsIconName, ViewsMessage, ViewsMessageResolver } from "./contract.js";
|
|
@@ -4,6 +4,7 @@ import { useRef, useState } from "react";
|
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { cx } from "../internal/cx.js";
|
|
6
6
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
7
|
+
import { DisabledReason } from "../atoms/DisabledReason.js";
|
|
7
8
|
import { useViews } from "../provider/context.js";
|
|
8
9
|
import { useDesktop, useMediaQuery } from "../provider/desktop.js";
|
|
9
10
|
import { overflowItems, splitVerbs } from "./bar-overflow.js";
|
|
@@ -23,14 +24,14 @@ export function SelectionBar(props) {
|
|
|
23
24
|
return createPortal(_jsx("div", { "data-slot": "vk-selection-bar", className: cx("fixed left-1/2 -translate-x-1/2", placement?.className), style: { bottom: placement?.bottom ?? DEFAULT_BOTTOM, zIndex: placement?.zIndex ?? DEFAULT_LAYER }, children: phone ? _jsx(SelectionBarPhone, { ...props }) : _jsx(DesktopBar, { ...props }) }), document.body);
|
|
24
25
|
}
|
|
25
26
|
function DesktopBar({ count, onClear, verbs, busy = false, onDelete, deleteLabel }) {
|
|
26
|
-
const { components, icons, messages } = useViews();
|
|
27
|
+
const { components, icons, messages, selectionBar } = useViews();
|
|
27
28
|
const { Button, Tooltip } = components;
|
|
28
29
|
const { inline, overflow } = splitVerbs(verbs);
|
|
29
30
|
const Close = icons.close;
|
|
30
31
|
const Trash = icons.delete;
|
|
31
32
|
const trashLabel = deleteLabel ?? messages({ key: "views.selection.delete" });
|
|
32
33
|
const deselect = messages({ key: "views.selection.deselect-all" });
|
|
33
|
-
return (_jsxs("div", { "data-slot": "vk-selection-pill", className: cx(PILL_CLASS, "pl-1.5"), children: [_jsx(Tooltip, { side: "top", delayMs: 300, className: "flex items-center gap-2", content: _jsxs(_Fragment, { children: [deselect, _jsx("span", { className: "rounded-sm border border-solid border-(color:--vk-border) px-1 py-px text-[10px] font-medium text-(color:--vk-fg-subtle)", children: messages({ key: "views.selection.escape" }) })] }), children: _jsxs("button", { type: "button", "data-slot": "vk-selection-chip", onClick: onClear, disabled: busy, "aria-label": deselect, className: cx(ELEMENT_RESET, "group/selchip flex h-8 cursor-pointer items-center gap-1.5 rounded-full bg-(color:--vk-neutral) pl-3 pr-2.5 transition-colors hover:bg-(color:--vk-neutral-hovered) disabled:cursor-default disabled:opacity-50"), children: [_jsx(CountWords, { count: count }), _jsx(Close, { className: "h-3 w-3 text-(color:--vk-fg-subtle) transition-colors group-hover/selchip:text-(color:--vk-fg)" })] }) }), _jsxs("div", { className: "flex items-center gap-1 pl-4", children: [inline.map((verb, index) => (_jsx(InlineVerb, { verb: verb, busy: busy }, index))), onDelete ? (_jsx(Button, { size: "icon", variant: "ghost", className: "h-8 w-8 rounded-full text-(color:--vk-danger) hover:bg-(color:--vk-danger-subtlest) hover:text-(color:--vk-danger)", disabled: busy, onClick: onDelete, "aria-label": trashLabel, title: trashLabel, children: _jsx(Trash, { className: "h-4 w-4" }) })) : null] }), _jsx("span", { className: DIVIDER_CLASS }), _jsx(MoreVerbs, { overflow: overflow, busy: busy })] }));
|
|
34
|
+
return (_jsxs("div", { "data-slot": "vk-selection-pill", className: cx(PILL_CLASS, "pl-1.5"), children: [_jsx(Tooltip, { side: "top", delayMs: 300, className: "flex items-center gap-2", content: _jsxs(_Fragment, { children: [deselect, _jsx("span", { className: "rounded-sm border border-solid border-(color:--vk-border) px-1 py-px text-[10px] font-medium text-(color:--vk-fg-subtle)", children: messages({ key: "views.selection.escape" }) })] }), children: selectionBar?.chip === "button" ? (_jsxs(Button, { type: "button", variant: "outline", size: "sm", className: "group/selchip h-8 gap-1.5 rounded-full pl-3 pr-2.5", "data-slot": "vk-selection-chip", "aria-label": deselect, disabled: busy, onClick: onClear, children: [_jsx(CountWords, { count: count }), _jsx(Close, { className: "h-3 w-3 text-(color:--vk-fg-subtle) transition-colors group-hover/selchip:text-(color:--vk-fg)" })] })) : (_jsxs("button", { type: "button", "data-slot": "vk-selection-chip", onClick: onClear, disabled: busy, "aria-label": deselect, className: cx(ELEMENT_RESET, "group/selchip flex h-8 cursor-pointer items-center gap-1.5 rounded-full bg-(color:--vk-neutral) pl-3 pr-2.5 transition-colors hover:bg-(color:--vk-neutral-hovered) disabled:cursor-default disabled:opacity-50"), children: [_jsx(CountWords, { count: count }), _jsx(Close, { className: "h-3 w-3 text-(color:--vk-fg-subtle) transition-colors group-hover/selchip:text-(color:--vk-fg)" })] })) }), _jsxs("div", { className: "flex items-center gap-1 pl-4", children: [inline.map((verb, index) => (_jsx(InlineVerb, { verb: verb, busy: busy }, index))), onDelete ? (_jsx(Button, { size: "icon", variant: "ghost", className: "h-8 w-8 rounded-full text-(color:--vk-danger) hover:bg-(color:--vk-danger-subtlest) hover:text-(color:--vk-danger)", disabled: busy, onClick: onDelete, "aria-label": trashLabel, title: trashLabel, children: _jsx(Trash, { className: "h-4 w-4" }) })) : null] }), _jsx("span", { className: DIVIDER_CLASS }), _jsx(MoreVerbs, { overflow: overflow, busy: busy })] }));
|
|
34
35
|
}
|
|
35
36
|
function InlineVerb({ verb, busy }) {
|
|
36
37
|
const { Button } = useViews().components;
|
|
@@ -38,7 +39,10 @@ function InlineVerb({ verb, busy }) {
|
|
|
38
39
|
return _jsx(OptionsVerb, { verb: verb, busy: busy });
|
|
39
40
|
if (verb.kind === "group")
|
|
40
41
|
return _jsx(GroupVerb, { verb: verb, busy: busy });
|
|
41
|
-
return (_jsxs(Button, { size: "sm", variant: "ghost", className: cx("rounded-full", verb.destructive && "text-(color:--vk-danger) hover:text-(color:--vk-danger)"), disabled: busy || verb.disabled, onClick: verb.onClick, children: [verb.icon, verb.label] }));
|
|
42
|
+
return (_jsx(DisabledReason, { reason: offReason(verb, busy), side: "top", className: "inline-flex", children: _jsxs(Button, { size: "sm", variant: "ghost", className: cx("rounded-full", verb.destructive && "text-(color:--vk-danger) hover:text-(color:--vk-danger)"), disabled: busy || verb.disabled, onClick: verb.onClick, children: [verb.icon, verb.label] }) }));
|
|
43
|
+
}
|
|
44
|
+
function offReason(verb, busy) {
|
|
45
|
+
return !busy && verb.disabled ? verb.disabledReason : undefined;
|
|
42
46
|
}
|
|
43
47
|
function useAnchoredOpen(disabled) {
|
|
44
48
|
const [open, setOpen] = useState(false);
|
|
@@ -63,12 +67,13 @@ function GroupVerb({ verb, busy }) {
|
|
|
63
67
|
const { Button, Menu } = useViews().components;
|
|
64
68
|
const disabled = Boolean(busy || verb.disabled);
|
|
65
69
|
const { open, setOpen, anchor, trigger } = useAnchoredOpen(disabled);
|
|
66
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ...trigger, children: _jsxs(Button, { size: "sm", variant: "ghost", className: "rounded-full", disabled: disabled, "aria-label": verb.label, children: [verb.icon, verb.label] }) }), _jsx(Menu, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "top", align: "center", label: verb.label, items: verb.items.map((item, index) => ({
|
|
70
|
+
return (_jsxs(_Fragment, { children: [_jsx(DisabledReason, { reason: offReason(verb, busy), side: "top", className: "inline-flex", children: _jsx("span", { ...trigger, children: _jsxs(Button, { size: "sm", variant: "ghost", className: "rounded-full", disabled: disabled, "aria-label": verb.label, children: [verb.icon, verb.label] }) }) }), _jsx(Menu, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "top", align: "center", label: verb.label, items: verb.items.map((item, index) => ({
|
|
67
71
|
key: String(index),
|
|
68
72
|
label: item.label,
|
|
69
73
|
icon: item.icon,
|
|
70
74
|
onSelect: item.onClick,
|
|
71
75
|
disabled: item.disabled,
|
|
76
|
+
...(item.disabled && item.disabledReason ? { disabledReason: item.disabledReason } : {}),
|
|
72
77
|
destructive: item.destructive,
|
|
73
78
|
})) })] }));
|
|
74
79
|
}
|
|
@@ -78,7 +83,7 @@ function OptionsVerb({ verb, busy }) {
|
|
|
78
83
|
const { List, Row } = atoms;
|
|
79
84
|
const disabled = Boolean(busy || verb.disabled);
|
|
80
85
|
const { open, setOpen, anchor, trigger } = useAnchoredOpen(disabled);
|
|
81
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ...trigger, children: _jsxs(Button, { size: "sm", variant: "ghost", className: "rounded-full", disabled: disabled, "aria-label": verb.label, children: [verb.icon, verb.label] }) }), _jsx(Popover, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "top", align: "center", sideOffset: 8, onOutsidePress: (event) => (anchor.current?.contains(event.target) ? false : undefined), chrome: "menu", className: "w-48", children: _jsx(List, { className: "max-h-72 overflow-y-auto overscroll-contain scrollbar-overlay", children: verb.options.map((option) => (_jsx(Row, { size: "compact", label: _jsx(OptionLabel, { option: option }), onClick: () => {
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(DisabledReason, { reason: offReason(verb, busy), side: "top", className: "inline-flex", children: _jsx("span", { ...trigger, children: _jsxs(Button, { size: "sm", variant: "ghost", className: "rounded-full", disabled: disabled, "aria-label": verb.label, children: [verb.icon, verb.label] }) }) }), _jsx(Popover, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "top", align: "center", sideOffset: 8, onOutsidePress: (event) => (anchor.current?.contains(event.target) ? false : undefined), chrome: "menu", className: "w-48", children: _jsx(List, { className: "max-h-72 overflow-y-auto overscroll-contain scrollbar-overlay", children: verb.options.map((option) => (_jsx(Row, { size: "compact", label: _jsx(OptionLabel, { option: option, steps: verb.options }), onClick: () => {
|
|
82
87
|
setOpen(false);
|
|
83
88
|
verb.onSelect(option.value);
|
|
84
89
|
} }, option.value))) }) })] }));
|
|
@@ -86,7 +91,8 @@ function OptionsVerb({ verb, busy }) {
|
|
|
86
91
|
function MoreVerbs({ overflow, busy }) {
|
|
87
92
|
const { components, icons, messages } = useViews();
|
|
88
93
|
const { Button, Menu } = components;
|
|
89
|
-
const
|
|
94
|
+
const disabled = busy || overflow.length === 0;
|
|
95
|
+
const { open, setOpen, anchor, trigger } = useAnchoredOpen(disabled);
|
|
90
96
|
const More = icons.more;
|
|
91
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ...trigger, children: _jsxs(Button, { size: "sm", variant: "ghost", className: "rounded-full text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)", disabled:
|
|
97
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ...trigger, children: _jsxs(Button, { size: "sm", variant: "ghost", className: "rounded-full text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)", disabled: disabled, "aria-label": messages({ key: "views.selection.more-label" }), children: [_jsx(More, { className: "h-4 w-4" }), messages({ key: "views.selection.more" })] }) }), _jsx(Menu, { open: open, onOpenChange: (next) => setOpen(next), anchor: anchor, side: "top", label: messages({ key: "views.selection.more" }), items: overflowItems(overflow) })] }));
|
|
92
98
|
}
|
|
@@ -3,10 +3,19 @@ export function splitVerbs(verbs) {
|
|
|
3
3
|
return { inline: verbs.slice(0, INLINE_VERBS), overflow: verbs.slice(INLINE_VERBS) };
|
|
4
4
|
}
|
|
5
5
|
export function overflowItems(overflow) {
|
|
6
|
+
const reason = (disabled, why) => disabled && why ? { disabledReason: why } : {};
|
|
6
7
|
return overflow.map((verb, index) => {
|
|
7
8
|
const key = `verb-${index}`;
|
|
8
9
|
if (verb.kind === "action") {
|
|
9
|
-
return {
|
|
10
|
+
return {
|
|
11
|
+
key,
|
|
12
|
+
label: verb.label,
|
|
13
|
+
icon: verb.icon,
|
|
14
|
+
onSelect: verb.onClick,
|
|
15
|
+
disabled: verb.disabled,
|
|
16
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
17
|
+
destructive: verb.destructive,
|
|
18
|
+
};
|
|
10
19
|
}
|
|
11
20
|
if (verb.kind === "group") {
|
|
12
21
|
return {
|
|
@@ -14,6 +23,7 @@ export function overflowItems(overflow) {
|
|
|
14
23
|
label: verb.label,
|
|
15
24
|
icon: verb.icon,
|
|
16
25
|
disabled: verb.disabled,
|
|
26
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
17
27
|
beside: true,
|
|
18
28
|
children: verb.items.map((item, at) => ({
|
|
19
29
|
key: `${key}-${at}`,
|
|
@@ -21,6 +31,7 @@ export function overflowItems(overflow) {
|
|
|
21
31
|
icon: item.icon,
|
|
22
32
|
onSelect: item.onClick,
|
|
23
33
|
disabled: verb.disabled || item.disabled,
|
|
34
|
+
...reason(verb.disabled || item.disabled, item.disabledReason ?? (verb.disabled ? verb.disabledReason : undefined)),
|
|
24
35
|
destructive: item.destructive,
|
|
25
36
|
})),
|
|
26
37
|
};
|
|
@@ -30,11 +41,13 @@ export function overflowItems(overflow) {
|
|
|
30
41
|
label: verb.label,
|
|
31
42
|
icon: verb.icon,
|
|
32
43
|
disabled: verb.disabled,
|
|
44
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
33
45
|
beside: true,
|
|
34
46
|
children: verb.options.map((option) => ({
|
|
35
47
|
key: `${key}-${option.value}`,
|
|
36
48
|
label: option.label,
|
|
37
49
|
disabled: verb.disabled,
|
|
50
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
38
51
|
onSelect: () => verb.onSelect(option.value),
|
|
39
52
|
})),
|
|
40
53
|
};
|
|
@@ -9,7 +9,9 @@ export declare function CountWords({ count }: {
|
|
|
9
9
|
count: number;
|
|
10
10
|
}): ReactNode;
|
|
11
11
|
/** A value of an options verb as its badge: a status by its slot, a category by its colour, else its words.
|
|
12
|
-
* The same badges a cell shows, so setting status on the bar reads as setting it in a cell.
|
|
13
|
-
|
|
12
|
+
* The same badges a cell shows, so setting status on the bar reads as setting it in a cell. `steps` is the verb's
|
|
13
|
+
* options, the values it sets, which a status badge is placed among (VK-482). */
|
|
14
|
+
export declare function OptionLabel({ option, steps }: {
|
|
14
15
|
option: PickerOption;
|
|
16
|
+
steps: readonly PickerOption[];
|
|
15
17
|
}): ReactNode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { placeAmong } from "../display/status-steps.js";
|
|
3
4
|
import { useViews } from "../provider/context.js";
|
|
4
5
|
export const PILL_CLASS = "flex items-center gap-2 rounded-full border border-solid border-(color:--vk-border) bg-(color:--vk-overlay) py-1.5 pr-1.5 text-(color:--vk-fg) shadow-[var(--vk-float-shadow,0_8px_24px_rgb(0_0_0/0.12))]";
|
|
5
6
|
export const DIVIDER_CLASS = "h-5 w-px bg-(color:--vk-border)";
|
|
@@ -7,10 +8,11 @@ export function CountWords({ count }) {
|
|
|
7
8
|
const { messages } = useViews();
|
|
8
9
|
return (_jsxs("span", { className: "text-sm whitespace-nowrap", children: [_jsx("span", { className: "font-semibold tabular-nums", children: count }), _jsxs("span", { className: "text-(color:--vk-fg-subtle)", children: [" ", messages({ key: "views.selection.selected" })] })] }));
|
|
9
10
|
}
|
|
10
|
-
export function OptionLabel({ option }) {
|
|
11
|
+
export function OptionLabel({ option, steps }) {
|
|
11
12
|
const { atoms } = useViews();
|
|
12
|
-
if (option.slot)
|
|
13
|
-
return _jsx(atoms.StatusBadge, { slot: option.slot, label: option.label });
|
|
13
|
+
if (option.slot) {
|
|
14
|
+
return _jsx(atoms.StatusBadge, { slot: option.slot, label: option.label, place: placeAmong(steps, option.value) });
|
|
15
|
+
}
|
|
14
16
|
if (option.color)
|
|
15
17
|
return _jsx(atoms.Tag, { label: option.label, color: option.color });
|
|
16
18
|
return option.label;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clears the current selection when Escape is pressed, but only while a
|
|
3
|
-
* selection is active
|
|
4
|
-
* (
|
|
3
|
+
* selection is active, and only an Escape nothing else took: a menu or popover
|
|
4
|
+
* that closes on the key marks it handled (`preventDefault`, as Radix and Base
|
|
5
|
+
* UI do), so one press closes the menu and the next clears the selection.
|
|
5
6
|
*/
|
|
6
7
|
export declare function useEscapeToClear(active: boolean, clear: () => void): void;
|
|
@@ -10,6 +10,8 @@ export type SelectionVerbItem = {
|
|
|
10
10
|
* itself is the bar's own `onDelete`, never a verb. */
|
|
11
11
|
destructive?: boolean;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
/** Why it is disabled, in the person's words: More's rows, the bar's button and the phone sheet carry it. */
|
|
14
|
+
disabledReason?: string;
|
|
13
15
|
};
|
|
14
16
|
/** "Set this field on every selected row": the field's values as their badges, the same rows a cell's
|
|
15
17
|
* editor picks from. No current value: the rows may already hold several. */
|
|
@@ -18,6 +20,8 @@ export type SelectionOptionsVerb = {
|
|
|
18
20
|
label: string;
|
|
19
21
|
icon?: ReactNode;
|
|
20
22
|
disabled?: boolean;
|
|
23
|
+
/** Why it is disabled, in the person's words: More's rows, the bar's button and the phone sheet carry it. */
|
|
24
|
+
disabledReason?: string;
|
|
21
25
|
options: PickerOption[];
|
|
22
26
|
onSelect: (value: string) => void;
|
|
23
27
|
};
|
|
@@ -30,5 +34,8 @@ export type SelectionVerb = ({
|
|
|
30
34
|
label: string;
|
|
31
35
|
icon?: ReactNode;
|
|
32
36
|
disabled?: boolean;
|
|
37
|
+
/** Why the group is disabled: its own button and More's row carry it, and so does each of its rows that
|
|
38
|
+
* gives none. */
|
|
39
|
+
disabledReason?: string;
|
|
33
40
|
items: SelectionVerbItem[];
|
|
34
41
|
} | SelectionOptionsVerb;
|