@viewkitjs/views 0.4.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 +768 -0
- package/README.md +5 -3
- 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 +3 -0
- package/dist/atoms/DrillRows.js +27 -0
- package/dist/atoms/Loading.d.ts +6 -0
- package/dist/atoms/Loading.js +4 -1
- package/dist/atoms/PanelRows.d.ts +5 -0
- package/dist/atoms/PanelRows.js +38 -0
- package/dist/atoms/PanelSearch.d.ts +2 -0
- package/dist/atoms/PanelSearch.js +21 -0
- 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.d.ts +3 -0
- package/dist/atoms/SelectionSheet.js +31 -0
- package/dist/atoms/ToolbarButton.d.ts +2 -0
- package/dist/atoms/ToolbarButton.js +18 -0
- package/dist/atoms/defaults.js +22 -0
- package/dist/atoms/types.d.ts +257 -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 +515 -18
- package/dist/contract.js +660 -5
- 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/figures.d.ts +5 -48
- package/dist/figures.js +1 -63
- 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 +7 -4
- package/dist/grid/chrome/GridColumnMenu.js +5 -3
- package/dist/grid/chrome/GridColumnSortSection.d.ts +23 -3
- 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 +7 -3
- 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 +20 -21
- package/dist/grid/useGridTablePrefs.js +6 -58
- package/dist/grid/useGridTableSettings.d.ts +60 -0
- package/dist/grid/useGridTableSettings.js +61 -0
- package/dist/grouping/sort-groups.d.ts +6 -7
- package/dist/internal/count.d.ts +3 -0
- package/dist/internal/count.js +3 -0
- package/dist/model/aggregates.d.ts +3 -3
- package/dist/model/aggregates.js +17 -71
- 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-order.d.ts +2 -2
- package/dist/model/column-schema.d.ts +6 -7
- package/dist/model/column-sort.d.ts +11 -0
- package/dist/model/column-sort.js +14 -0
- package/dist/model/column-state.d.ts +3 -20
- package/dist/model/column-state.js +1 -4
- package/dist/model/column-types.d.ts +1 -15
- package/dist/model/column-types.js +1 -1
- package/dist/model/one-value.d.ts +6 -0
- package/dist/model/one-value.js +5 -0
- package/dist/model/part-columns.d.ts +1 -6
- package/dist/model/part-columns.js +1 -1
- package/dist/model/part-rows.d.ts +2 -9
- package/dist/model/part-rows.js +1 -10
- 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/preferences.d.ts +3 -23
- package/dist/model/preferences.js +1 -17
- package/dist/model/prefs-buckets.d.ts +0 -27
- package/dist/model/prefs-buckets.js +1 -1
- package/dist/model/relation-filters.d.ts +13 -3
- package/dist/model/relation-filters.js +9 -4
- package/dist/model/row-icon.d.ts +17 -11
- 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.d.ts +32 -6
- package/dist/model/view-rules.js +99 -23
- 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 +50 -6
- package/dist/provider/ViewsProvider.js +33 -2
- package/dist/provider/components.d.ts +274 -11
- package/dist/provider/context.d.ts +23 -2
- package/dist/provider/desktop.d.ts +3 -0
- package/dist/provider/desktop.js +7 -4
- package/dist/react.d.ts +5 -2
- package/dist/selection/SelectionBar.d.ts +18 -0
- package/dist/selection/SelectionBar.js +98 -0
- package/dist/selection/SelectionBarPhone.d.ts +3 -0
- package/dist/selection/SelectionBarPhone.js +14 -0
- package/dist/selection/bar-overflow.d.ts +12 -0
- package/dist/selection/bar-overflow.js +55 -0
- package/dist/selection/bar-parts.d.ts +17 -0
- package/dist/selection/bar-parts.js +19 -0
- package/dist/selection/index.d.ts +2 -0
- package/dist/selection/index.js +1 -0
- package/dist/selection/types.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
- package/dist/selection/useListSelectionShortcuts.js +1 -1
- package/dist/selection/verbs.d.ts +41 -0
- package/dist/selection/verbs.js +1 -0
- package/docs/contract.md +355 -35
- package/docs/getting-started.md +1 -1
- package/docs/guides/atoms.md +39 -6
- 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 +35 -21
- package/docs/guides/the-grid.md +24 -13
- package/docs/guides/the-provider.md +24 -6
- package/docs/index.md +2 -0
- package/docs/install.md +3 -1
- 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 +10 -7
- package/docs/reference/panels-react.md +101 -0
- package/docs/reference/panels.md +123 -0
- package/docs/reference/react.md +45 -12
- package/docs/reference/selection.md +11 -3
- package/docs/reference/views.md +41 -38
- package/package.json +33 -4
- package/skills/views/SKILL.md +5 -4
|
@@ -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, 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,14 +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;
|
|
47
|
+
/** Where the selection bar sits (`ViewsProvider`'s `selectionBar`); absent, the package's defaults. */
|
|
48
|
+
selectionBar?: ViewsSelectionBarSettings;
|
|
49
|
+
/** The quick days the date editors offer (`ViewsProvider`'s `datePicks`); absent, today, tomorrow and next Monday. */
|
|
50
|
+
datePicks?: ViewsDatePicks;
|
|
30
51
|
};
|
|
31
52
|
export declare const ViewsContext: import("react").Context<ViewsContextValue | null>;
|
|
32
53
|
export declare function useViews(): ViewsContextValue;
|
|
@@ -7,3 +7,6 @@ export declare function isDesktopNow(query: string): boolean;
|
|
|
7
7
|
/** Whether the screen is a desktop, by the provider's `desktopQuery`: true where there is no
|
|
8
8
|
* `matchMedia`. It follows the query's changes. The package's own: no entry point exports it. */
|
|
9
9
|
export declare function useDesktop(): boolean;
|
|
10
|
+
/** Whether `query` matches the screen, following its changes. `fallback` is the answer where the screen
|
|
11
|
+
* can't be asked (a server render, no `matchMedia`). The package's own: no entry point exports it. */
|
|
12
|
+
export declare function useMediaQuery(query: string, fallback: boolean): boolean;
|
package/dist/provider/desktop.js
CHANGED
|
@@ -10,13 +10,16 @@ export function isDesktopNow(query) {
|
|
|
10
10
|
}
|
|
11
11
|
export function useDesktop() {
|
|
12
12
|
const { desktopQuery } = useViews();
|
|
13
|
+
return useMediaQuery(desktopQuery, true);
|
|
14
|
+
}
|
|
15
|
+
export function useMediaQuery(query, fallback) {
|
|
13
16
|
const subscribe = useCallback((onChange) => {
|
|
14
17
|
if (!canAsk())
|
|
15
18
|
return () => { };
|
|
16
|
-
const list = window.matchMedia(
|
|
19
|
+
const list = window.matchMedia(query);
|
|
17
20
|
list.addEventListener("change", onChange);
|
|
18
21
|
return () => list.removeEventListener("change", onChange);
|
|
19
|
-
}, [
|
|
20
|
-
const read = () =>
|
|
21
|
-
return useSyncExternalStore(subscribe, read, () =>
|
|
22
|
+
}, [query]);
|
|
23
|
+
const read = () => (canAsk() ? window.matchMedia(query).matches : fallback);
|
|
24
|
+
return useSyncExternalStore(subscribe, read, () => fallback);
|
|
22
25
|
}
|
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, ViewsStatusBadgeProps, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, } 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";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { SelectionVerb } from "./verbs.js";
|
|
3
|
+
export type SelectionBarProps = {
|
|
4
|
+
/** How many rows are selected. The bar draws nothing at zero. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Clears the selection: the count chip, the phone's ✕. */
|
|
7
|
+
onClear: () => void;
|
|
8
|
+
/** What the selection lets a person do, in order: the first four on the bar, the rest in More. */
|
|
9
|
+
verbs: readonly SelectionVerb[];
|
|
10
|
+
/** A batch is running: every control is disabled until it ends. */
|
|
11
|
+
busy?: boolean;
|
|
12
|
+
/** Deletes the selection. The bar's own verb, drawn as the trailing trash in the same place on every list;
|
|
13
|
+
* never a verb in `verbs`. A list with no bulk delete leaves it out. */
|
|
14
|
+
onDelete?: () => void;
|
|
15
|
+
/** The trash's accessible name and tooltip. Default: the `views.selection.delete` message. */
|
|
16
|
+
deleteLabel?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function SelectionBar(props: SelectionBarProps): ReactNode;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { cx } from "../internal/cx.js";
|
|
6
|
+
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
7
|
+
import { DisabledReason } from "../atoms/DisabledReason.js";
|
|
8
|
+
import { useViews } from "../provider/context.js";
|
|
9
|
+
import { useDesktop, useMediaQuery } from "../provider/desktop.js";
|
|
10
|
+
import { overflowItems, splitVerbs } from "./bar-overflow.js";
|
|
11
|
+
import { CountWords, DIVIDER_CLASS, OptionLabel, PILL_CLASS } from "./bar-parts.js";
|
|
12
|
+
import { SelectionBarPhone } from "./SelectionBarPhone.js";
|
|
13
|
+
const DEFAULT_BOTTOM = "calc(1rem + env(safe-area-inset-bottom))";
|
|
14
|
+
const DEFAULT_LAYER = 50;
|
|
15
|
+
export function SelectionBar(props) {
|
|
16
|
+
const { selectionBar } = useViews();
|
|
17
|
+
const desktop = useDesktop();
|
|
18
|
+
const phoneQuery = selectionBar?.phoneQuery;
|
|
19
|
+
const phoneByQuery = useMediaQuery(phoneQuery ?? "not all", false);
|
|
20
|
+
const phone = phoneQuery ? phoneByQuery : !desktop;
|
|
21
|
+
if (props.count === 0 || typeof document === "undefined")
|
|
22
|
+
return null;
|
|
23
|
+
const placement = phone ? selectionBar?.phone : selectionBar?.desktop;
|
|
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);
|
|
25
|
+
}
|
|
26
|
+
function DesktopBar({ count, onClear, verbs, busy = false, onDelete, deleteLabel }) {
|
|
27
|
+
const { components, icons, messages, selectionBar } = useViews();
|
|
28
|
+
const { Button, Tooltip } = components;
|
|
29
|
+
const { inline, overflow } = splitVerbs(verbs);
|
|
30
|
+
const Close = icons.close;
|
|
31
|
+
const Trash = icons.delete;
|
|
32
|
+
const trashLabel = deleteLabel ?? messages({ key: "views.selection.delete" });
|
|
33
|
+
const deselect = messages({ key: "views.selection.deselect-all" });
|
|
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 })] }));
|
|
35
|
+
}
|
|
36
|
+
function InlineVerb({ verb, busy }) {
|
|
37
|
+
const { Button } = useViews().components;
|
|
38
|
+
if (verb.kind === "options")
|
|
39
|
+
return _jsx(OptionsVerb, { verb: verb, busy: busy });
|
|
40
|
+
if (verb.kind === "group")
|
|
41
|
+
return _jsx(GroupVerb, { verb: verb, busy: busy });
|
|
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;
|
|
46
|
+
}
|
|
47
|
+
function useAnchoredOpen(disabled) {
|
|
48
|
+
const [open, setOpen] = useState(false);
|
|
49
|
+
const anchor = useRef(null);
|
|
50
|
+
const openAtPress = useRef(null);
|
|
51
|
+
const trigger = {
|
|
52
|
+
ref: anchor,
|
|
53
|
+
className: "inline-flex",
|
|
54
|
+
onPointerDownCapture: () => {
|
|
55
|
+
openAtPress.current = open;
|
|
56
|
+
},
|
|
57
|
+
onClick: () => {
|
|
58
|
+
const wasOpen = openAtPress.current ?? open;
|
|
59
|
+
openAtPress.current = null;
|
|
60
|
+
if (!disabled)
|
|
61
|
+
setOpen(!wasOpen);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
return { open, setOpen, anchor, trigger };
|
|
65
|
+
}
|
|
66
|
+
function GroupVerb({ verb, busy }) {
|
|
67
|
+
const { Button, Menu } = useViews().components;
|
|
68
|
+
const disabled = Boolean(busy || verb.disabled);
|
|
69
|
+
const { open, setOpen, anchor, trigger } = useAnchoredOpen(disabled);
|
|
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) => ({
|
|
71
|
+
key: String(index),
|
|
72
|
+
label: item.label,
|
|
73
|
+
icon: item.icon,
|
|
74
|
+
onSelect: item.onClick,
|
|
75
|
+
disabled: item.disabled,
|
|
76
|
+
...(item.disabled && item.disabledReason ? { disabledReason: item.disabledReason } : {}),
|
|
77
|
+
destructive: item.destructive,
|
|
78
|
+
})) })] }));
|
|
79
|
+
}
|
|
80
|
+
function OptionsVerb({ verb, busy }) {
|
|
81
|
+
const { components, atoms } = useViews();
|
|
82
|
+
const { Button, Popover } = components;
|
|
83
|
+
const { List, Row } = atoms;
|
|
84
|
+
const disabled = Boolean(busy || verb.disabled);
|
|
85
|
+
const { open, setOpen, anchor, trigger } = useAnchoredOpen(disabled);
|
|
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: () => {
|
|
87
|
+
setOpen(false);
|
|
88
|
+
verb.onSelect(option.value);
|
|
89
|
+
} }, option.value))) }) })] }));
|
|
90
|
+
}
|
|
91
|
+
function MoreVerbs({ overflow, busy }) {
|
|
92
|
+
const { components, icons, messages } = useViews();
|
|
93
|
+
const { Button, Menu } = components;
|
|
94
|
+
const disabled = busy || overflow.length === 0;
|
|
95
|
+
const { open, setOpen, anchor, trigger } = useAnchoredOpen(disabled);
|
|
96
|
+
const More = icons.more;
|
|
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) })] }));
|
|
98
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { cx } from "../internal/cx.js";
|
|
5
|
+
import { useViews } from "../provider/context.js";
|
|
6
|
+
import { CountWords, DIVIDER_CLASS, PILL_CLASS } from "./bar-parts.js";
|
|
7
|
+
export function SelectionBarPhone({ count, onClear, verbs, busy = false, onDelete, deleteLabel }) {
|
|
8
|
+
const { components, atoms, icons, messages } = useViews();
|
|
9
|
+
const { Button } = components;
|
|
10
|
+
const { SelectionSheet } = atoms;
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const Close = icons.close;
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { "data-slot": "vk-selection-pill", className: cx(PILL_CLASS, "pl-4"), children: [_jsx(CountWords, { count: count }), _jsx("span", { className: DIVIDER_CLASS }), _jsx(Button, { size: "sm", variant: "ghost", className: "rounded-full", disabled: busy, onClick: () => setOpen(true), children: messages({ key: "views.selection.actions" }) }), _jsx(Button, { size: "icon", variant: "ghost", className: "h-8 w-8 rounded-full text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)", onClick: onClear, disabled: busy, "aria-label": messages({ key: "views.selection.clear" }), children: _jsx(Close, { className: "h-4 w-4" }) })] }), _jsx(SelectionSheet, { open: open, onOpenChange: (next) => setOpen(next), title: messages({ key: "views.selection.count", values: { count } }), verbs: verbs, onDelete: onDelete, deleteLabel: deleteLabel ?? messages({ key: "views.selection.delete" }), busy: busy })] }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViewsMenuItem } from "../provider/components.js";
|
|
2
|
+
import type { SelectionVerb } from "./verbs.js";
|
|
3
|
+
/** How many verbs stay on the bar before the rest fold into More. */
|
|
4
|
+
export declare const INLINE_VERBS = 4;
|
|
5
|
+
export declare function splitVerbs(verbs: readonly SelectionVerb[]): {
|
|
6
|
+
inline: SelectionVerb[];
|
|
7
|
+
overflow: SelectionVerb[];
|
|
8
|
+
};
|
|
9
|
+
/** The spilled verbs as More's rows. A group or an options verb keeps its shape, opening its rows beside
|
|
10
|
+
* the menu: its rows only mean something under their own heading ("Set tag → warming / ready"). A menu row
|
|
11
|
+
* is words, so an options verb's values read as their labels here. */
|
|
12
|
+
export declare function overflowItems(overflow: readonly SelectionVerb[]): ViewsMenuItem[];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const INLINE_VERBS = 4;
|
|
2
|
+
export function splitVerbs(verbs) {
|
|
3
|
+
return { inline: verbs.slice(0, INLINE_VERBS), overflow: verbs.slice(INLINE_VERBS) };
|
|
4
|
+
}
|
|
5
|
+
export function overflowItems(overflow) {
|
|
6
|
+
const reason = (disabled, why) => disabled && why ? { disabledReason: why } : {};
|
|
7
|
+
return overflow.map((verb, index) => {
|
|
8
|
+
const key = `verb-${index}`;
|
|
9
|
+
if (verb.kind === "action") {
|
|
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
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (verb.kind === "group") {
|
|
21
|
+
return {
|
|
22
|
+
key,
|
|
23
|
+
label: verb.label,
|
|
24
|
+
icon: verb.icon,
|
|
25
|
+
disabled: verb.disabled,
|
|
26
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
27
|
+
beside: true,
|
|
28
|
+
children: verb.items.map((item, at) => ({
|
|
29
|
+
key: `${key}-${at}`,
|
|
30
|
+
label: item.label,
|
|
31
|
+
icon: item.icon,
|
|
32
|
+
onSelect: item.onClick,
|
|
33
|
+
disabled: verb.disabled || item.disabled,
|
|
34
|
+
...reason(verb.disabled || item.disabled, item.disabledReason ?? (verb.disabled ? verb.disabledReason : undefined)),
|
|
35
|
+
destructive: item.destructive,
|
|
36
|
+
})),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
key,
|
|
41
|
+
label: verb.label,
|
|
42
|
+
icon: verb.icon,
|
|
43
|
+
disabled: verb.disabled,
|
|
44
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
45
|
+
beside: true,
|
|
46
|
+
children: verb.options.map((option) => ({
|
|
47
|
+
key: `${key}-${option.value}`,
|
|
48
|
+
label: option.label,
|
|
49
|
+
disabled: verb.disabled,
|
|
50
|
+
...reason(verb.disabled, verb.disabledReason),
|
|
51
|
+
onSelect: () => verb.onSelect(option.value),
|
|
52
|
+
})),
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { PickerOption } from "../editors/SelectEditor.js";
|
|
3
|
+
/** The pill the bar floats in: the overlay ground, the hairline and the floating drop. */
|
|
4
|
+
export declare 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
|
+
/** The vertical hairline between the bar's regions. */
|
|
6
|
+
export declare const DIVIDER_CLASS = "h-5 w-px bg-(color:--vk-border)";
|
|
7
|
+
/** "3 selected": the number in weight, the word quieter. */
|
|
8
|
+
export declare function CountWords({ count }: {
|
|
9
|
+
count: number;
|
|
10
|
+
}): ReactNode;
|
|
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. `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 }: {
|
|
15
|
+
option: PickerOption;
|
|
16
|
+
steps: readonly PickerOption[];
|
|
17
|
+
}): ReactNode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { placeAmong } from "../display/status-steps.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
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))]";
|
|
6
|
+
export const DIVIDER_CLASS = "h-5 w-px bg-(color:--vk-border)";
|
|
7
|
+
export function CountWords({ count }) {
|
|
8
|
+
const { messages } = useViews();
|
|
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" })] })] }));
|
|
10
|
+
}
|
|
11
|
+
export function OptionLabel({ option, steps }) {
|
|
12
|
+
const { atoms } = useViews();
|
|
13
|
+
if (option.slot) {
|
|
14
|
+
return _jsx(atoms.StatusBadge, { slot: option.slot, label: option.label, place: placeAmong(steps, option.value) });
|
|
15
|
+
}
|
|
16
|
+
if (option.color)
|
|
17
|
+
return _jsx(atoms.Tag, { label: option.label, color: option.color });
|
|
18
|
+
return option.label;
|
|
19
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type { ListBatchApi, ListSelectionConfig } from "./types.js";
|
|
2
|
+
export { SelectionBar, type SelectionBarProps } from "./SelectionBar.js";
|
|
3
|
+
export type { SelectionOptionsVerb, SelectionVerb, SelectionVerbItem } from "./verbs.js";
|
|
2
4
|
export { SelectCheckbox } from "./SelectCheckbox.js";
|
|
3
5
|
export { useCheckDragSelect, ROW_CHECK_ATTR } from "./useCheckDragSelect.js";
|
|
4
6
|
export { preventShiftTextSelect, selectFromClick, ROW_INTERACTIVE_SELECTOR, ROW_NO_TEXT_SELECT, ROW_OPEN_STOP_SELECTOR, } from "./row-click.js";
|
package/dist/selection/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { SelectionBar } from "./SelectionBar.js";
|
|
1
2
|
export { SelectCheckbox } from "./SelectCheckbox.js";
|
|
2
3
|
export { useCheckDragSelect, ROW_CHECK_ATTR } from "./useCheckDragSelect.js";
|
|
3
4
|
export { preventShiftTextSelect, selectFromClick, ROW_INTERACTIVE_SELECTOR, ROW_NO_TEXT_SELECT, ROW_OPEN_STOP_SELECTOR, } from "./row-click.js";
|
|
@@ -12,6 +12,7 @@ export type ListSelectionConfig = {
|
|
|
12
12
|
retention?: SelectionRetention;
|
|
13
13
|
/** Selection clears whenever this view/filter identity changes. */
|
|
14
14
|
resetKey: string;
|
|
15
|
-
/** Render the floating bar, optionally with the active renderer's
|
|
16
|
-
|
|
15
|
+
/** Render the floating bar (`SelectionBar`, with the app's verbs), optionally with the active renderer's
|
|
16
|
+
* batch API. The renderer calls it on every render, empty selection included. Absent: no bar. */
|
|
17
|
+
renderBar?: (sel: UseListSelectionResult, batch?: ListBatchApi) => ReactNode;
|
|
17
18
|
};
|
|
@@ -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;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { PickerOption } from "../editors/SelectEditor.js";
|
|
3
|
+
/** One verb, or one row of a `group`. */
|
|
4
|
+
export type SelectionVerbItem = {
|
|
5
|
+
label: string;
|
|
6
|
+
/** The app's glyph, drawn before the words. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
/** A verb that undoes or removes something (Cancel, Disconnect): drawn in the danger colour. Delete
|
|
10
|
+
* itself is the bar's own `onDelete`, never a verb. */
|
|
11
|
+
destructive?: boolean;
|
|
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;
|
|
15
|
+
};
|
|
16
|
+
/** "Set this field on every selected row": the field's values as their badges, the same rows a cell's
|
|
17
|
+
* editor picks from. No current value: the rows may already hold several. */
|
|
18
|
+
export type SelectionOptionsVerb = {
|
|
19
|
+
kind: "options";
|
|
20
|
+
label: string;
|
|
21
|
+
icon?: ReactNode;
|
|
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;
|
|
25
|
+
options: PickerOption[];
|
|
26
|
+
onSelect: (value: string) => void;
|
|
27
|
+
};
|
|
28
|
+
/** A verb on the bar: a direct `action`, a `group` that opens a small menu of related verbs, or an
|
|
29
|
+
* `options` verb whose values are picked as badges. */
|
|
30
|
+
export type SelectionVerb = ({
|
|
31
|
+
kind: "action";
|
|
32
|
+
} & SelectionVerbItem) | {
|
|
33
|
+
kind: "group";
|
|
34
|
+
label: string;
|
|
35
|
+
icon?: ReactNode;
|
|
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;
|
|
40
|
+
items: SelectionVerbItem[];
|
|
41
|
+
} | SelectionOptionsVerb;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|