viewkitjs 0.28.0 → 0.30.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 +218 -0
- package/MIGRATION.md +181 -11
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.d.ts +2 -2
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/cell-values.js +9 -12
- package/views/dist/contract.d.ts +161 -18
- package/views/dist/contract.js +170 -28
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/customize/customize.d.ts +176 -0
- package/views/dist/controls/customize/customize.js +348 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +15 -0
- package/views/dist/controls/customize/map-customize-body.js +195 -0
- package/views/dist/controls/customize/map-ranges.d.ts +23 -0
- package/views/dist/controls/customize/map-ranges.js +41 -0
- package/views/dist/controls/customize/rules.d.ts +39 -0
- package/views/dist/controls/customize/rules.js +21 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +65 -0
- package/views/dist/controls/customize/words.js +42 -0
- package/views/dist/controls/customize.css +57 -0
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +4 -0
- package/views/dist/controls/filter-editor/filter-editor.js +86 -43
- package/views/dist/controls/filter-editor/how.d.ts +1 -1
- package/views/dist/controls/filter-editor/how.js +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
- package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
- package/views/dist/controls/filter-editor/map-rules.js +73 -42
- package/views/dist/controls/filter-editor/rules.d.ts +42 -5
- package/views/dist/controls/filter-editor/rules.js +55 -2
- package/views/dist/controls/filter-editor/words.d.ts +15 -0
- package/views/dist/controls/filter-editor/words.js +6 -0
- package/views/dist/controls/filter-editor.css +18 -0
- package/views/dist/controls/index.d.ts +33 -9
- package/views/dist/controls/index.js +32 -9
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
- package/views/dist/controls/menu-list/menu-list.js +26 -8
- package/views/dist/controls/menu-list.css +8 -0
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/pane.d.ts +4 -0
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +59 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
- package/views/dist/controls/text-editor/map-text-body.js +2 -2
- package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
- package/views/dist/controls/text-editor/text-editor.js +17 -7
- package/views/dist/controls/text-editor.css +11 -0
- package/views/dist/controls/toast/toast.d.ts +5 -1
- package/views/dist/controls/toast/toast.js +5 -3
- package/views/dist/controls/tokens.js +18 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/values-editor/values.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +3 -3
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +3 -0
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/options.d.ts +1 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/display/rich-text.js +0 -1
- package/views/dist/editors/ChipsEditor.d.ts +4 -5
- package/views/dist/editors/ChipsEditor.js +12 -78
- package/views/dist/editors/DateEditor.d.ts +12 -16
- package/views/dist/editors/DateEditor.js +40 -191
- package/views/dist/editors/EditorPanel.d.ts +2 -6
- package/views/dist/editors/EditorPanel.js +2 -2
- package/views/dist/editors/LocationEditor.d.ts +11 -19
- package/views/dist/editors/LocationEditor.js +19 -211
- package/views/dist/editors/NameEditor.d.ts +8 -16
- package/views/dist/editors/NameEditor.js +11 -100
- package/views/dist/editors/NumberEditor.d.ts +14 -21
- package/views/dist/editors/NumberEditor.js +22 -49
- package/views/dist/editors/RangeEditor.d.ts +9 -33
- package/views/dist/editors/RangeEditor.js +12 -97
- package/views/dist/editors/RelationEditor.d.ts +6 -9
- package/views/dist/editors/RelationEditor.js +11 -30
- package/views/dist/editors/RelationSetEditor.d.ts +13 -24
- package/views/dist/editors/RelationSetEditor.js +33 -101
- package/views/dist/editors/SelectEditor.d.ts +15 -17
- package/views/dist/editors/SelectEditor.js +15 -94
- package/views/dist/editors/TextEditor.d.ts +23 -26
- package/views/dist/editors/TextEditor.js +11 -48
- package/views/dist/editors/ValueListEditor.d.ts +14 -23
- package/views/dist/editors/ValueListEditor.js +16 -202
- package/views/dist/editors/body-panel.d.ts +13 -7
- package/views/dist/editors/body-panel.js +3 -7
- package/views/dist/editors/edit-cores.d.ts +15 -15
- package/views/dist/editors/edit-cores.js +14 -14
- package/views/dist/editors/number-body.d.ts +1 -1
- package/views/dist/editors/number-step.d.ts +0 -34
- package/views/dist/editors/number-step.js +0 -37
- package/views/dist/editors/option-add-flow.d.ts +1 -13
- package/views/dist/editors/option-add-flow.js +0 -22
- package/views/dist/editors/relation-links-body.d.ts +2 -3
- package/views/dist/editors/relation-picker.d.ts +13 -3
- package/views/dist/editors/relation-source.d.ts +0 -22
- package/views/dist/editors/relation-source.js +0 -21
- package/views/dist/field-row/FieldRow.js +5 -6
- package/views/dist/field-row/FieldRowLane.js +0 -1
- package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
- package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
- package/views/dist/field-row/editors/RowDateEditor.js +2 -2
- package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowNameEditor.js +7 -12
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
- package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
- package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
- package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowTextEditor.js +3 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
- package/views/dist/field-row/field-row-button.d.ts +6 -9
- package/views/dist/field-row/field-row-button.js +1 -6
- package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
- package/views/dist/field-row/row-target.d.ts +0 -7
- package/views/dist/field-row/row-target.js +0 -2
- package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +8 -66
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
- package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
- package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
- package/views/dist/grid/chrome/GridCellEditors.js +12 -12
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
- package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
- package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
- package/views/dist/grid/chrome/GridDateEditor.js +3 -3
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
- package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
- package/views/dist/grid/chrome/GridHeader.js +3 -2
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
- package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
- package/views/dist/grid/chrome/GridNameEditor.js +4 -4
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
- package/views/dist/grid/chrome/GridNumberEditor.js +5 -6
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
- package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
- package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
- package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
- package/views/dist/grid/chrome/GridRow.js +0 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
- package/views/dist/grid/chrome/GridRowActions.js +0 -5
- package/views/dist/grid/chrome/GridRowCells.js +11 -7
- package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
- package/views/dist/grid/chrome/GridStructure.js +0 -1
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
- package/views/dist/grid/chrome/GridTextEditor.js +5 -18
- package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
- package/views/dist/grid/chrome/grid-body-place.js +4 -8
- package/views/dist/grid/chrome/grid-button.d.ts +7 -10
- package/views/dist/grid/chrome/grid-button.js +1 -6
- package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
- package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
- package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
- package/views/dist/grid/chrome/grid-hover.js +0 -1
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
- package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
- package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/core/editing-controller.d.ts +2 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +2 -2
- package/views/dist/grid/core/write-states.d.ts +3 -1
- package/views/dist/grid/core/write-states.js +6 -2
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/model/body-frame.d.ts +0 -32
- package/views/dist/model/body-frame.js +1 -15
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/column-inspect.d.ts +5 -5
- package/views/dist/model/column-inspect.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/customize-body.d.ts +1 -10
- package/views/dist/panels/customize-body.js +0 -3
- package/views/dist/panels/filter/MenuSelect.js +0 -5
- package/views/dist/panels/filter/RangeFilterBody.js +0 -1
- package/views/dist/panels/filter/details.d.ts +1 -5
- package/views/dist/panels/filter/details.js +0 -13
- package/views/dist/panels/filter/filter-list.d.ts +0 -1
- package/views/dist/panels/filter/filter-list.js +1 -1
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +10 -2
- package/views/dist/panels/panel-button.d.ts +10 -12
- package/views/dist/panels/panel-button.js +1 -6
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/chrome.d.ts +0 -17
- package/views/dist/panels/react/chrome.js +0 -8
- package/views/dist/panels/react/customize-body.d.ts +14 -12
- package/views/dist/panels/react/customize-body.js +93 -19
- package/views/dist/panels/react/customize.d.ts +16 -12
- package/views/dist/panels/react/customize.js +4 -110
- package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
- package/views/dist/panels/react/filter/FilterEditor.js +6 -330
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +27 -51
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
- package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
- package/views/dist/panels/react/filter/editor-ctx.js +5 -33
- package/views/dist/panels/react/filter/filter-body.js +5 -2
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
- package/views/dist/panels/react/filter/filter-part-body.js +0 -5
- package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
- package/views/dist/panels/react/filter/rule-writes.js +4 -95
- package/views/dist/panels/react/order-details.d.ts +1 -26
- package/views/dist/panels/react/order-details.js +3 -69
- package/views/dist/panels/react/panel-header.js +0 -1
- package/views/dist/panels/react/panel-step.d.ts +3 -0
- package/views/dist/panels/react/panel-step.js +2 -1
- package/views/dist/panels/react/popover.d.ts +4 -7
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -136
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
- package/views/dist/panels/react/sort/SortEditor.js +8 -245
- package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
- package/views/dist/panels/react/sort/SortFieldList.js +11 -25
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +16 -18
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
- package/views/dist/panels/react/view-actions.js +0 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +2 -5
- package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +30 -45
- package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
- package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
- package/views/dist/panels/react/views-row/menu-classes.js +0 -2
- package/views/dist/panels/react.d.ts +5 -12
- package/views/dist/panels/react.js +5 -12
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +40 -9
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.d.ts +2 -46
- package/views/dist/provider/ViewsProvider.js +31 -27
- package/views/dist/provider/components.d.ts +295 -107
- package/views/dist/provider/context.d.ts +7 -21
- package/views/dist/provider/missing-slot.d.ts +3 -7
- package/views/dist/provider/missing-slot.js +2 -9
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -3
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +6 -4
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +694 -191
- package/views/dist/styles.unlayered.css +691 -188
- package/views/docs/contract.md +133 -130
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/getting-started.md +222 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +224 -4
- package/views/docs/guides/display.md +3 -3
- package/views/docs/guides/editors.md +235 -20
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +7 -7
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +15 -17
- package/views/docs/guides/the-provider.md +9 -15
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +215 -21
- package/views/docs/reference/display.md +1 -0
- package/views/docs/reference/editors-chips.md +2 -2
- package/views/docs/reference/editors-date.md +4 -4
- package/views/docs/reference/editors-location.md +4 -7
- package/views/docs/reference/editors-name.md +3 -5
- package/views/docs/reference/editors-number.md +10 -10
- package/views/docs/reference/editors-panel.md +3 -3
- package/views/docs/reference/editors-range.md +3 -5
- package/views/docs/reference/editors-relation.md +4 -4
- package/views/docs/reference/editors-select.md +3 -3
- package/views/docs/reference/editors-text.md +3 -4
- package/views/docs/reference/editors-value-list.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -2
- package/views/docs/reference/looks.md +25 -11
- package/views/docs/reference/panels-react.md +23 -37
- package/views/docs/reference/panels.md +8 -6
- package/views/docs/reference/react.md +24 -24
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +12 -11
- package/views/skills/views/SKILL.md +2 -2
- package/views/dist/editors/relation-panel.d.ts +0 -69
- package/views/dist/editors/relation-panel.js +0 -46
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
- package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
- package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
- package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
- package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
- package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
- package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
- package/views/dist/grid/chrome/GridFlyout.js +0 -80
- package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
- package/views/dist/grid/chrome/GridMenuRow.js +0 -15
- package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
- package/views/dist/grid/chrome/grid-menu-search.js +0 -7
- package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
- package/views/dist/panels/react/GroupBucketsList.js +0 -44
- package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
- package/views/dist/panels/react/LayoutColumnsList.js +0 -101
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
- package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
- package/views/dist/panels/react/drag.d.ts +0 -2
- package/views/dist/panels/react/drag.js +0 -5
- package/views/dist/panels/react/layout-detail.d.ts +0 -4
- package/views/dist/panels/react/layout-detail.js +0 -29
- package/views/dist/panels/react/root-list.d.ts +0 -6
- package/views/dist/panels/react/root-list.js +0 -31
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
- package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
- package/views/dist/panels/react/view-footer.d.ts +0 -20
- package/views/dist/panels/react/view-footer.js +0 -41
|
@@ -180,6 +180,7 @@ export function usePicker(props) {
|
|
|
180
180
|
function usePickerAt(props, under) {
|
|
181
181
|
const { label, items, multiple, value, onDone, empty, search, onSearch, doing, onRetry, onMore, nothingYet, actions = [], readOnly, none: noneWords } = props;
|
|
182
182
|
const w = { ...PICKER_WORDS, ...props.words };
|
|
183
|
+
const menuWords = { ...props.menuWords, ...(props.words ? { picker: props.words } : {}) };
|
|
183
184
|
const onValueChange = readOnly ? () => { } : props.onValueChange, onCreate = readOnly ? undefined : props.onCreate;
|
|
184
185
|
const host = React.useContext(PhoneHost), small = usePhone();
|
|
185
186
|
const form = props.form ?? (host || small ? "phone" : "computer");
|
|
@@ -427,7 +428,10 @@ function usePickerAt(props, under) {
|
|
|
427
428
|
return false;
|
|
428
429
|
e.preventDefault();
|
|
429
430
|
e.preventBaseUIHandler?.();
|
|
430
|
-
|
|
431
|
+
if (form === "phone" && props.onRowMenu)
|
|
432
|
+
props.onRowMenu(row.item.value);
|
|
433
|
+
else
|
|
434
|
+
setRowMenu({ value: row.item.value, anchor: dots });
|
|
431
435
|
return true;
|
|
432
436
|
};
|
|
433
437
|
const backKey = (e) => {
|
|
@@ -452,11 +456,34 @@ function usePickerAt(props, under) {
|
|
|
452
456
|
lightRow(at >= 0 ? open[(at + (down ? 1 : -1) + open.length) % open.length] : down ? open[0] : open[open.length - 1]);
|
|
453
457
|
return true;
|
|
454
458
|
};
|
|
459
|
+
const passKey = (e) => {
|
|
460
|
+
if (form !== "computer" || e.altKey || e.metaKey || e.ctrlKey || e.shiftKey || (e.key !== "ArrowDown" && e.key !== "ArrowUp"))
|
|
461
|
+
return false;
|
|
462
|
+
const rows = optionRows(), n = rows.length, step = e.key === "ArrowDown" ? 1 : -1;
|
|
463
|
+
if (!n)
|
|
464
|
+
return false;
|
|
465
|
+
const at = rows.findIndex((r) => r.hasAttribute("data-highlighted"));
|
|
466
|
+
const next = at < 0 ? (step > 0 ? 0 : n - 1) : (at + step + n) % n;
|
|
467
|
+
if (!rows[next].hasAttribute("data-disabled"))
|
|
468
|
+
return false;
|
|
469
|
+
e.preventDefault();
|
|
470
|
+
e.preventBaseUIHandler?.();
|
|
471
|
+
for (let k = 1; k < n; k++) {
|
|
472
|
+
const row = rows[(next + k * step + n * n) % n];
|
|
473
|
+
if (!row.hasAttribute("data-disabled")) {
|
|
474
|
+
lightRow(row);
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return true;
|
|
479
|
+
};
|
|
455
480
|
const ends = (e) => {
|
|
456
481
|
if (backKey(e))
|
|
457
482
|
return;
|
|
458
483
|
if (restKey(e))
|
|
459
484
|
return;
|
|
485
|
+
if (passKey(e))
|
|
486
|
+
return;
|
|
460
487
|
if (menuKey(e))
|
|
461
488
|
return;
|
|
462
489
|
if (orderKey(e))
|
|
@@ -472,17 +499,33 @@ function usePickerAt(props, under) {
|
|
|
472
499
|
lightRow(e.key === "Home" ? open[0] : open[open.length - 1]);
|
|
473
500
|
};
|
|
474
501
|
const searchBox = React.useCallback((el) => { input.current = el; focusesInPlace(el); }, []);
|
|
502
|
+
const firstPickable = () => {
|
|
503
|
+
const rows = optionRows();
|
|
504
|
+
return rows.find((r) => r.dataset.name != null && !r.hasAttribute("data-disabled")) ?? rows.find((r) => r.classList.contains("o-picker-create"));
|
|
505
|
+
};
|
|
475
506
|
const answer = items.map((i) => i.value).join("\u0000");
|
|
476
507
|
React.useEffect(() => {
|
|
477
508
|
if (!server || form === "phone" || !find.trim() || doing)
|
|
478
509
|
return;
|
|
479
|
-
|
|
480
|
-
if (rows.some((r) => r.hasAttribute("data-highlighted")))
|
|
510
|
+
if (optionRows().some((r) => r.hasAttribute("data-highlighted")))
|
|
481
511
|
return;
|
|
482
|
-
const first =
|
|
512
|
+
const first = firstPickable();
|
|
483
513
|
if (first)
|
|
484
514
|
lightRow(first);
|
|
485
515
|
}, [answer, doing]);
|
|
516
|
+
React.useEffect(() => {
|
|
517
|
+
if (form === "phone" || !find.trim() || doing)
|
|
518
|
+
return;
|
|
519
|
+
const frame = requestAnimationFrame(() => {
|
|
520
|
+
const lit = optionRows().find((r) => r.hasAttribute("data-highlighted"));
|
|
521
|
+
if (lit && (!lit.hasAttribute("data-disabled") || litByPerson.current))
|
|
522
|
+
return;
|
|
523
|
+
const first = firstPickable();
|
|
524
|
+
if (first)
|
|
525
|
+
lightRow(first);
|
|
526
|
+
});
|
|
527
|
+
return () => cancelAnimationFrame(frame);
|
|
528
|
+
}, [find, doing]);
|
|
486
529
|
const openedNow = under ? under.open : true;
|
|
487
530
|
React.useEffect(() => {
|
|
488
531
|
if (form === "phone" || !openedNow || !opening.current.trim())
|
|
@@ -553,7 +596,13 @@ function usePickerAt(props, under) {
|
|
|
553
596
|
const stopKeys = (e) => { if (e.key === "Enter" || e.key === " ")
|
|
554
597
|
e.stopPropagation(); };
|
|
555
598
|
const rowTrigger = (item) => {
|
|
556
|
-
const open = (e) => {
|
|
599
|
+
const open = (e) => {
|
|
600
|
+
e.stopPropagation();
|
|
601
|
+
if (form === "phone" && props.onRowMenu)
|
|
602
|
+
props.onRowMenu(item.value);
|
|
603
|
+
else
|
|
604
|
+
setRowMenu({ value: item.value, anchor: e.currentTarget });
|
|
605
|
+
};
|
|
557
606
|
return form === "phone"
|
|
558
607
|
? _jsx(MenuDots, { label: w.rowActions(item.label), className: "o-picker-row-menu", onClick: open, onKeyDown: stopKeys })
|
|
559
608
|
: _jsx(Button, { kind: "quiet", shape: "icon", size: "20", tabIndex: -1, className: "o-picker-row-menu", "data-shown": props.rowMenus ?? "always", "aria-label": w.rowActions(item.label), icon: glyph(DOTS_V), onClick: open, onKeyDown: stopKeys });
|
|
@@ -562,7 +611,7 @@ function usePickerAt(props, under) {
|
|
|
562
611
|
const menuItem = rowMenu ? itemOf(rowMenu.value) : undefined;
|
|
563
612
|
const rowMenuEl = items.some(hasMenu)
|
|
564
613
|
? _jsx(Menu, { label: menuItem?.label ?? label, entries: menuItem?.menu ?? [], anchor: rowMenu?.anchor ?? null, align: rowMenu?.anchor instanceof HTMLElement ? "end" : "start", open: !!rowMenu?.open, onOpenChange: (o) => { if (!o)
|
|
565
|
-
setMenuAt((m) => m && { ...m, open: false }); }, frame: props.menuFrame })
|
|
614
|
+
setMenuAt((m) => m && { ...m, open: false }); }, frame: props.menuFrame, words: menuWords })
|
|
566
615
|
: null;
|
|
567
616
|
const ordering = !!props.onOrderChange && !find.trim() && !level;
|
|
568
617
|
const keptNow = multiple && own ? draft : held;
|
|
@@ -740,7 +789,7 @@ function usePickerAt(props, under) {
|
|
|
740
789
|
const showBar = !none && (pill || creatable || menu.length > 0 || (!!level && !byHolder));
|
|
741
790
|
const bar = showBar && (_jsxs("div", { className: "o-picker-bar", children: [level && !byHolder && _jsx(GlassButton, { "aria-label": w.back(level.label), icon: glyph(BACK), className: "o-picker-round", "data-back": "", onMouseDown: (e) => e.preventDefault(), onClick: () => back() }), pill && (_jsxs(InputGroup, { size: "lg", className: "o-picker-pill", ...pillTap, children: [_jsx(InputGroupAddon, { side: "start", children: glyph(SEARCH) }), _jsx(Input, { combobox: true, autofill: false, ref: pillInput, placeholder: search, "aria-label": search ?? label, onKeyDown: (e) => { if (!backKey(e))
|
|
742
791
|
enter(e); } })] })), creatable ? _jsx(Button, { kind: "primary", size: "lg", icon: glyph(PLUS), className: "o-picker-create-button", onClick: createTyped, children: w.createButton })
|
|
743
|
-
: menu.length > 0 && _jsx(Menu, { label: label, entries: menu, trigger: _jsx(GlassButton, { "aria-label": w.actions, icon: glyph(DOTS), className: "o-picker-round" }) })] }));
|
|
792
|
+
: menu.length > 0 && _jsx(Menu, { label: label, entries: menu, words: menuWords, trigger: _jsx(GlassButton, { "aria-label": w.actions, icon: glyph(DOTS), className: "o-picker-round" }) })] }));
|
|
744
793
|
const menuOpen = (item) => (menuOpenFor(item.value) ? { "data-menu-open": "" } : {});
|
|
745
794
|
const heldHere = (v) => inPlace && kept.includes(v);
|
|
746
795
|
const rowValue = (item) => (heldHere(item.value) && !changing ? { key: `unpick:${item.value}`, kind: "unpick", item } : itemEntry(item));
|
|
@@ -804,7 +853,7 @@ function usePickerAt(props, under) {
|
|
|
804
853
|
}, modal: true, disabled: under.disabled, multiple: multiple, value: value_, onValueChange: (v, d) => {
|
|
805
854
|
if (d.reason !== "escape-key")
|
|
806
855
|
take(v, d);
|
|
807
|
-
}, inputValue: query, onInputValueChange: (q, d) => (d.reason === "escape-key" && heldName ? setQuery(heldName) : ask(q)), autoHighlight: true, onItemHighlighted: highlighted, itemToStringValue: (e) => e.key, itemToStringLabel: (e) => entryLabel(e), isItemEqualToValue: (a, b) => a.key === b.key, children: [typeof under.box === "function" ? under.box({ onKeyDown: (e) => { if (!backKey(e) && !restKey(e) && !menuKey(e) && !orderKey(e))
|
|
856
|
+
}, inputValue: query, onInputValueChange: (q, d) => (d.reason === "escape-key" && heldName ? setQuery(heldName) : ask(q)), autoHighlight: true, onItemHighlighted: highlighted, itemToStringValue: (e) => e.key, itemToStringLabel: (e) => entryLabel(e), isItemEqualToValue: (a, b) => a.key === b.key, children: [typeof under.box === "function" ? under.box({ onKeyDown: (e) => { if (!backKey(e) && !restKey(e) && !passKey(e) && !menuKey(e) && !orderKey(e))
|
|
808
857
|
guard(e); }, typed: query, attrs: restAttrs }) : under.box, under.panel(list), _jsx("span", { ref: mark, hidden: true }), rowMenuEl] })) : (_jsxs(BaseCombobox.Root, { inline: true, open: true, multiple: multiple, value: value_, onValueChange: (v, d) => take(v, d), inputValue: query, onInputValueChange: ask, autoHighlight: true, onItemHighlighted: highlighted, itemToStringValue: (e) => e.key, itemToStringLabel: (e) => entryLabel(e), isItemEqualToValue: (a, b) => a.key === b.key, children: [list, rowMenuEl] }));
|
|
809
858
|
return { body, head: {}, step: null };
|
|
810
859
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViewsPopoverProps } from "../../provider/components.js";
|
|
2
2
|
/** ViewKit's popup, drawn as the kit's Popover. */
|
|
3
|
-
export declare function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, onPanelClick, panelData, style, className, children }: ViewsPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, children }: ViewsPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from "./popover.js";
|
|
3
|
-
export function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, onPanelClick, panelData, style, className, children }) {
|
|
4
|
-
return (_jsx(Popover, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, initialFocus: initialFocus, onOutsidePress: onOutsidePress, onEscape: onEscape, style: style, onPopupClick: onPanelClick, popupData: panelData, className: className, children: children }));
|
|
3
|
+
export function MapPopover({ open, onOpenChange, anchor, side, align, sideOffset, alignOffset, initialFocus, onOutsidePress, onEscape, chrome, onPanelClick, panelData, style, className, children }) {
|
|
4
|
+
return (_jsx(Popover, { open: open, onOpenChange: (next, d) => onOpenChange(next, { reason: d.reason }), anchor: anchor, side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, initialFocus: initialFocus, onOutsidePress: onOutsidePress, onEscape: onEscape, style: style, onPopupClick: onPanelClick, popupData: chrome === "menu" ? { ...panelData, "data-popover-chrome": "menu" } : panelData, className: className, children: children }));
|
|
5
5
|
}
|
|
@@ -6,6 +6,7 @@ import { anchorElement, isElement, positionerAnchor } from "../internal/anchor.j
|
|
|
6
6
|
import { closeReasonOf } from "../internal/close-reason.js";
|
|
7
7
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
8
8
|
import { popupHostOf } from "../internal/popup-host.js";
|
|
9
|
+
import { InPane } from "../pane/pane.js";
|
|
9
10
|
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
10
11
|
const reasonOf = (reason) => { const r = closeReasonOf(reason); return r === "swipe" ? "none" : r; };
|
|
11
12
|
function useLastPress(open) {
|
|
@@ -94,7 +95,7 @@ export function Popover({ open, defaultOpen, onOpenChange, trigger, anchor, side
|
|
|
94
95
|
setShown(next);
|
|
95
96
|
onOpenChange?.(next, { reason: reasonOf(details.reason), event: details.event });
|
|
96
97
|
};
|
|
97
|
-
return (_jsxs(BasePopover.Root, { open: isOpen, onOpenChange: change, children: [trigger && _jsx(BasePopover.Trigger, { ref: holdOpener, render: trigger }), _jsx(BasePopover.Portal, { container: host, children: _jsx(BasePopover.Positioner, { ref: setPositioner, className: "o-popover-positioner", anchor: placed, positionMethod: "fixed", side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, children: _jsxs(BasePopover.Popup, { ref: popup, className: cx("o-popover", className), "data-kit": "popover", "aria-label": label, initialFocus: initialFocus, finalFocus: finalFocus, style: style, onClick: onPopupClick, "data-over": sideOffset < 0 ? "" : undefined, ...phoneMark(phone), ...popupData, children: [_jsx("div", { className: "o-popover-cut o-smooth", children: children }), _jsx(Scrollbar, {})] }) }) })] }));
|
|
98
|
+
return (_jsxs(BasePopover.Root, { open: isOpen, onOpenChange: change, children: [trigger && _jsx(BasePopover.Trigger, { ref: holdOpener, render: trigger }), _jsx(BasePopover.Portal, { container: host, children: _jsx(BasePopover.Positioner, { ref: setPositioner, className: "o-popover-positioner", anchor: placed, positionMethod: "fixed", side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, children: _jsxs(BasePopover.Popup, { ref: popup, className: cx("o-popover", className), "data-kit": "popover", "aria-label": label, initialFocus: initialFocus, finalFocus: finalFocus, style: style, onClick: onPopupClick, "data-over": sideOffset < 0 ? "" : undefined, ...phoneMark(phone), ...popupData, children: [_jsx("div", { className: "o-popover-cut o-smooth", children: _jsx(InPane.Provider, { value: false, children: children }) }), _jsx(Scrollbar, {})] }) }) })] }));
|
|
98
99
|
}
|
|
99
100
|
export function PopoverTitle({ children, className }) {
|
|
100
101
|
return _jsx(BasePopover.Title, { className: cx("o-popover-title", className), children: children });
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
data-popover-padding 0 · 4 · 8 · 12 · 16 how far what it holds stands from its edge
|
|
13
13
|
data-popover-gap 0 · 4 · 8 how far it stands from what opened it (none laid over it)
|
|
14
14
|
|
|
15
|
+
On the popup itself, `data-popover-chrome="menu"` marks a popup that holds a list (the components map's `chrome`): the Outright
|
|
16
|
+
look draws it as its card, as its editors were approved; an app's own styles may draw it otherwise.
|
|
17
|
+
|
|
15
18
|
The rules sit in the components layer, so a utility class on it still wins. */
|
|
16
19
|
@layer components {
|
|
17
20
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ViewsPortsHostProps } from "../../provider/components.js";
|
|
2
|
+
import type { ViewsToastPort } from "../../provider/ports.js";
|
|
3
|
+
import { type ToastManager } from "../toast/toast.js";
|
|
4
|
+
/** The toast port on a manager: success with its Undo, error as failed, info plain, warning with its second line. */
|
|
5
|
+
export declare function toastPortOf(manager: ToastManager): ViewsToastPort;
|
|
6
|
+
/** ViewKit's ports host. */
|
|
7
|
+
export declare function MapPortsHost({ toast, confirm, onReady }: ViewsPortsHostProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
5
|
+
import { resolveViewsMessage } from "../../contract.js";
|
|
6
|
+
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
7
|
+
import { createToastManager, Toast } from "../toast/toast.js";
|
|
8
|
+
export function toastPortOf(manager) {
|
|
9
|
+
return {
|
|
10
|
+
success: (message, options) => void manager.show({ words: message, ...(options?.undo && { undo: options.undo }) }),
|
|
11
|
+
error: (message) => void manager.show({ words: message, failed: true }),
|
|
12
|
+
info: (message) => void manager.show({ words: message }),
|
|
13
|
+
warning: (message, options) => void manager.show(options?.description ? { title: message, words: options.description, meaning: "warning" } : { words: message, meaning: "warning" }),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function MapPortsHost({ toast, confirm, onReady }) {
|
|
17
|
+
const say = React.useContext(ViewsContext)?.messages ?? resolveViewsMessage;
|
|
18
|
+
const toastWords = React.useMemo(() => ({ undo: say({ key: "views.panels.toast-undo" }), close: say({ key: "views.panels.close" }), region: say({ key: "views.panels.toast-region" }) }), [say]);
|
|
19
|
+
const dialogWords = React.useMemo(() => ({ close: say({ key: "views.panels.close" }), failed: say({ key: "views.panels.alert-failed" }), tryAgain: say({ key: "views.picker.retry" }) }), [say]);
|
|
20
|
+
const { undo: undoWord, close: closeWord } = toastWords;
|
|
21
|
+
const manager = React.useMemo(() => createToastManager({ undo: undoWord, close: closeWord }), [undoWord, closeWord]);
|
|
22
|
+
const [asking, setAsking] = React.useState(null);
|
|
23
|
+
const standing = React.useRef(null);
|
|
24
|
+
const ask = React.useCallback((request) => new Promise((resolve) => {
|
|
25
|
+
standing.current?.answer(false);
|
|
26
|
+
const now = { request, open: true, answer: (yes) => { if (standing.current === now)
|
|
27
|
+
standing.current = null; resolve(yes); } };
|
|
28
|
+
standing.current = now;
|
|
29
|
+
setAsking(now);
|
|
30
|
+
}), []);
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
onReady({ ...(toast && { toast: toastPortOf(manager) }), ...(confirm && { confirm: ask }) });
|
|
33
|
+
return () => { onReady({}); standing.current?.answer(false); };
|
|
34
|
+
}, [onReady, toast, confirm, manager, ask]);
|
|
35
|
+
const answered = (yes) => {
|
|
36
|
+
const now = asking;
|
|
37
|
+
if (!now)
|
|
38
|
+
return;
|
|
39
|
+
setAsking({ ...now, open: false });
|
|
40
|
+
now.answer(yes);
|
|
41
|
+
};
|
|
42
|
+
return (_jsxs(_Fragment, { children: [toast && (_jsx(Toast, { manager: manager, words: toastWords, children: null })), confirm && asking && (_jsx(AlertDialog, { open: asking.open, onAnswer: answered, title: asking.request.message, ...(asking.request.detail ? { line: asking.request.detail } : {}), action: asking.request.confirmLabel, kind: asking.request.destructive ? "danger" : "primary", cancel: say({ key: "views.picker.cancel" }), words: dialogWords }))] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PRESS_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-spacing";
|
|
3
|
+
readonly kind: "size";
|
|
4
|
+
readonly outright: "--spacing";
|
|
5
|
+
}];
|
|
6
|
+
/** The pressing area's machinery, how far a packed control lets a target's area reach (`--pressing-room-x`, `-y`), is every
|
|
7
|
+
* control's family already (VK_CONTROL_PRIVATE_FAMILIES): nothing of its own. */
|
|
8
|
+
export declare const PRESS_PRIVATE: readonly [];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* The pressing area, as the Outright kit draws it: on a phone a small target keeps the size it draws and takes taps from an
|
|
2
|
+
invisible area round it, 44px each way (spacing × 11), never reaching further from its edge than --pressing-room-x and
|
|
3
|
+
--pressing-room-y. A control that packs targets closer than that sets them to half the room between, so two areas never
|
|
4
|
+
overlap. It is every Button under 44px, the Checkbox's box, the Radio's ring, the Tag's ×, the Switch and a link Option; a
|
|
5
|
+
tap on the area is a tap on the target, as the area is its ::after. On a computer, shadcn's area: 12px either side and 8px
|
|
6
|
+
above and below the Switch, the Checkbox's box and the Radio's ring, inside the same rooms, and never on a row's mark
|
|
7
|
+
(.o-check-in-row), whose row already takes the click.
|
|
8
|
+
|
|
9
|
+
A phone is the device's mark (`data-vk-phone`, by the app's line): each of these controls marks its own root on a phone, so
|
|
10
|
+
the area reaches a target outside any panel too.
|
|
11
|
+
|
|
12
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
13
|
+
@layer components {
|
|
14
|
+
/* On a computer: weighed as nothing (:where), so the phone's rule after it wins on a phone. */
|
|
15
|
+
:where(.o-check-box:not(.o-check-in-row), .o-radio-ring) { position: relative; }
|
|
16
|
+
:where(.o-check-box:not(.o-check-in-row), .o-radio-ring, .o-switch)::after {
|
|
17
|
+
content: ""; position: absolute;
|
|
18
|
+
inset-block: max(calc(var(--vk-spacing) * -2), calc(var(--pressing-room-y, var(--vk-spacing) * 2) * -1));
|
|
19
|
+
inset-inline: max(calc(var(--vk-spacing) * -3), calc(var(--pressing-room-x, var(--vk-spacing) * 3) * -1));
|
|
20
|
+
}
|
|
21
|
+
/* On a phone: (0,2,0), its weight that of its weightiest target, the link Option, as the kit's compiled rule weighed. */
|
|
22
|
+
:is(.o-check-box, .o-radio-ring, .o-tag-remove, .o-option[data-link]):where([data-vk-phone], [data-vk-phone] *) { position: relative; }
|
|
23
|
+
:is(.o-button, .o-check-box, .o-radio-ring, .o-tag-remove, .o-switch, .o-option[data-link]):where([data-vk-phone], [data-vk-phone] *)::after {
|
|
24
|
+
content: ""; position: absolute;
|
|
25
|
+
inset-block: min(0px, max(calc((100% - var(--vk-spacing) * 11) / 2), calc(var(--pressing-room-y, var(--vk-spacing) * 11) * -1)));
|
|
26
|
+
inset-inline: min(0px, max(calc((100% - var(--vk-spacing) * 11) / 2), calc(var(--pressing-room-x, var(--vk-spacing) * 11) * -1)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* ── The rooms: where the kit packs targets closer than 44px. Buttons side by side leave 4px each way between them,
|
|
30
|
+
whatever the gap (8px or more); two joined in a group none along its line; a field's buttons half their 4px or 6px
|
|
31
|
+
gap; choices one under another with no note 8px each way (a list's 44px rows, and choices with notes, stand far
|
|
32
|
+
enough apart); chips in a field half their 6px or 4px gap, link Options in a row half their 6px,
|
|
33
|
+
their lines packed by design. ─────────────────────────────── */
|
|
34
|
+
:is(.o-button:has(+ .o-button), .o-button + .o-button) { --pressing-room-x: var(--vk-spacing); }
|
|
35
|
+
.o-button-group:not([data-orientation="vertical"]) > .o-button:is(:has(+ .o-button), .o-button + .o-button) { --pressing-room-x: 0px; }
|
|
36
|
+
.o-button-group[data-orientation="vertical"] > .o-button:is(:has(+ .o-button), .o-button + .o-button) { --pressing-room-x: calc(var(--vk-spacing) * 11); --pressing-room-y: 0px; }
|
|
37
|
+
.o-input-addon:is([data-side="start"], [data-side="end"]) > .o-button { --pressing-room-x: calc(var(--vk-spacing) * 0.75); }
|
|
38
|
+
.o-input-addon:is([data-side="top"], [data-side="bottom"]) > .o-button { --pressing-room-x: calc(var(--vk-spacing) * 0.5); }
|
|
39
|
+
:is(.o-check:not(.o-check-row), .o-radio):not(.o-radio-row > *, :has(.o-choice-note)):is(:has(+ :is(.o-check, .o-radio)), :is(.o-check, .o-radio) + *) > :is(.o-check-box, .o-radio-ring) { --pressing-room-y: calc(var(--vk-spacing) * 2); }
|
|
40
|
+
.o-tag-field .o-tag-remove { --pressing-room-x: calc(var(--vk-spacing) * 0.75); --pressing-room-y: calc(var(--vk-spacing) * 1.5); }
|
|
41
|
+
.o-select-chips .o-tag-remove { --pressing-room-x: calc(var(--vk-spacing) * 0.5); --pressing-room-y: calc(var(--vk-spacing) * 1); }
|
|
42
|
+
/* Options side by side, 6px apart in a row and between their lines: a link half that each way. */
|
|
43
|
+
.o-options > .o-option[data-link] { --pressing-room-x: calc(var(--vk-spacing) * 0.75); --pressing-room-y: calc(var(--vk-spacing) * 0.75); }
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PieceLooks } from "../../looks/looks.js";
|
|
2
|
+
import type { QuickHolding } from "./rules.js";
|
|
3
|
+
export type QuickFiltersOptionId = "holds";
|
|
4
|
+
/** The quick filters' one option; they have no looks. */
|
|
5
|
+
export declare const QUICK_FILTERS_LOOKS: PieceLooks<QuickFiltersOptionId>;
|
|
6
|
+
/** The option worn round `el`, from the nearest frame that picks it; outside any frame, or a value it lacks, one at a time. */
|
|
7
|
+
export declare function quickFiltersWornOf(el: Element | null): {
|
|
8
|
+
holds: QuickHolding;
|
|
9
|
+
};
|
|
10
|
+
/** The attributes the quick filters watch, so an option changed while they are open reaches them. */
|
|
11
|
+
export declare const QUICK_FILTERS_ATTRS: string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { lookWornOf } from "../../looks/looks.js";
|
|
2
|
+
const options = [
|
|
3
|
+
{ id: "holds", name: "Holds", def: "one", values: [{ id: "one", name: "One at a time" }, { id: "several", name: "Several at once" }] },
|
|
4
|
+
];
|
|
5
|
+
export const QUICK_FILTERS_LOOKS = { id: "quick-filters", name: "Quick filters", options, looks: [] };
|
|
6
|
+
export function quickFiltersWornOf(el) {
|
|
7
|
+
return { holds: lookWornOf(QUICK_FILTERS_LOOKS, el, ["holds"]).holds === "several" ? "several" : "one" };
|
|
8
|
+
}
|
|
9
|
+
export const QUICK_FILTERS_ATTRS = QUICK_FILTERS_LOOKS.options.map((o) => `data-quick-filters-${o.id}`);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ViewsMessageResolver } from "../../contract.js";
|
|
2
|
+
import type { ViewsPickerItem, ViewsQuickFiltersBodyProps } from "../../provider/components.js";
|
|
3
|
+
import { type QuickField } from "./quick-filters.js";
|
|
4
|
+
import type { QuickHolds } from "./rules.js";
|
|
5
|
+
import type { QuickFiltersWords } from "./words.js";
|
|
6
|
+
type ListHold = ViewsQuickFiltersBodyProps["hold"];
|
|
7
|
+
/** ViewKit's hold as the quick filters keep it: each held field's values by its key, a field holding nothing left out. */
|
|
8
|
+
export declare function quickHoldsOf(hold: ListHold): QuickHolds;
|
|
9
|
+
/** The quick filters' holds as ViewKit keeps them: the fields `was` held that still hold, in its order, then the new ones. */
|
|
10
|
+
export declare function quickListHoldOf(holds: QuickHolds, was: ListHold): {
|
|
11
|
+
fieldKey: string;
|
|
12
|
+
values: string[];
|
|
13
|
+
}[];
|
|
14
|
+
/** A field as the quick filters' map reads it: ViewKit's body's, or a quick filter field with its values as shown. */
|
|
15
|
+
export type QuickFiltersFieldIn = {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
searchPlaceholder?: string;
|
|
19
|
+
values: readonly {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
count?: number;
|
|
23
|
+
}[];
|
|
24
|
+
options?: readonly ViewsPickerItem[];
|
|
25
|
+
};
|
|
26
|
+
/** ViewKit's fields as the quick filters take them, each value with its count where handed and its option's mark. */
|
|
27
|
+
export declare function quickFiltersFieldsOf(fields: readonly QuickFiltersFieldIn[]): QuickField[];
|
|
28
|
+
/** The quick filters' words in the app's messages. */
|
|
29
|
+
export declare const quickFiltersWordsOf: (say: ViewsMessageResolver) => QuickFiltersWords;
|
|
30
|
+
export declare function MapQuickFiltersBody({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }: ViewsQuickFiltersBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { resolveViewsMessage } from "../../contract.js";
|
|
5
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
6
|
+
import { glyph, X } from "../internal/editor-parts.js";
|
|
7
|
+
import { HeaderBar } from "../phone-header/header-bar.js";
|
|
8
|
+
import { pickerItemsOf } from "../picker/map-picker.js";
|
|
9
|
+
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
10
|
+
import { QuickFilters } from "./quick-filters.js";
|
|
11
|
+
export function quickHoldsOf(hold) {
|
|
12
|
+
return Object.fromEntries(hold.filter((h) => h.values.length).map((h) => [h.fieldKey, [...h.values]]));
|
|
13
|
+
}
|
|
14
|
+
export function quickListHoldOf(holds, was) {
|
|
15
|
+
const kept = was.filter((h) => holds[h.fieldKey]?.length).map((h) => ({ fieldKey: h.fieldKey, values: holds[h.fieldKey] }));
|
|
16
|
+
const known = new Set(was.map((h) => h.fieldKey));
|
|
17
|
+
const added = Object.entries(holds).filter(([key, values]) => values.length && !known.has(key)).map(([fieldKey, values]) => ({ fieldKey, values }));
|
|
18
|
+
return [...kept, ...added];
|
|
19
|
+
}
|
|
20
|
+
const QUICK_STATUSES = ["start", "between", "won", "lost"];
|
|
21
|
+
function markOf(item) {
|
|
22
|
+
const as = item?.as;
|
|
23
|
+
if (!as)
|
|
24
|
+
return undefined;
|
|
25
|
+
if ("status" in as) {
|
|
26
|
+
if (!QUICK_STATUSES.includes(as.status))
|
|
27
|
+
return undefined;
|
|
28
|
+
const status = as.status;
|
|
29
|
+
return as.quarters ? { status, quarters: as.quarters } : { status };
|
|
30
|
+
}
|
|
31
|
+
if ("avatar" in as)
|
|
32
|
+
return { avatar: as.avatar, ...(as.id ? { id: as.id } : {}) };
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
export function quickFiltersFieldsOf(fields) {
|
|
36
|
+
return fields.map((f) => {
|
|
37
|
+
const own = new Map((f.options?.length ? pickerItemsOf(f.options) : []).map((c) => [c.value, c]));
|
|
38
|
+
return {
|
|
39
|
+
id: f.key, name: f.label, ...(f.searchPlaceholder !== undefined ? { search: f.searchPlaceholder } : {}),
|
|
40
|
+
values: f.values.map((v) => {
|
|
41
|
+
const mark = markOf(own.get(v.value));
|
|
42
|
+
return { value: v.value, label: v.label, ...(v.count !== undefined ? { count: v.count } : {}), ...(mark ? { mark } : {}) };
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export const quickFiltersWordsOf = (say) => ({
|
|
48
|
+
fields: say({ key: "views.panels.quick-fields" }),
|
|
49
|
+
search: (field) => say({ key: "views.panels.quick-search", values: { field } }),
|
|
50
|
+
clear: say({ key: "views.panels.quick-clear-value" }),
|
|
51
|
+
none: say({ key: "views.panels.quick-none" }),
|
|
52
|
+
});
|
|
53
|
+
export function MapQuickFiltersBody({ label, fields, hold, several, showCounts, form, onHoldChange, onDone, actions }) {
|
|
54
|
+
const views = React.useContext(ViewsContext);
|
|
55
|
+
const messages = views?.messages ?? resolveViewsMessage;
|
|
56
|
+
const words = React.useMemo(() => quickFiltersWordsOf(messages), [messages]);
|
|
57
|
+
const quick = React.useMemo(() => quickFiltersFieldsOf(fields), [fields]);
|
|
58
|
+
return (_jsxs(_Fragment, { children: [actions && (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-quick-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: label }), right: _jsx("span", {}), left: _jsx(SheetButton, { "aria-label": actions.close.label, icon: glyph(X), onClick: actions.close.onPress }) }) })), _jsx("div", { "data-quick-filters-holds": several ? "several" : "one", style: { display: "contents" }, children: _jsx(QuickFilters, { fields: quick, holds: quickHoldsOf(hold), onHoldsChange: (next) => onHoldChange(quickListHoldOf(next, hold)), counts: showCounts, form: form, onDone: onDone, words: words }) })] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type QuickHolds, type QuickValue } from "./rules.js";
|
|
2
|
+
import { type QuickFiltersWords } from "./words.js";
|
|
3
|
+
export type { QuickHolds, QuickHolding, QuickMark, QuickValue } from "./rules.js";
|
|
4
|
+
/** A field it offers: its id, its name in the strip, its values, and what its search says when it shows. */
|
|
5
|
+
export interface QuickField {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
values: QuickValue[];
|
|
9
|
+
search?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A press: the field and the value held or let go. */
|
|
12
|
+
export interface QuickPress {
|
|
13
|
+
field: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface QuickFiltersProps {
|
|
17
|
+
/** The fields, in the strip's order. */
|
|
18
|
+
fields: QuickField[];
|
|
19
|
+
/** What is held. */
|
|
20
|
+
holds: QuickHolds;
|
|
21
|
+
/** Each press, and what is held after it. */
|
|
22
|
+
onHoldsChange: (holds: QuickHolds, press: QuickPress) => void;
|
|
23
|
+
/** The field open in the strip, where its holder keeps it; left out, its own, from the first field holding a value. */
|
|
24
|
+
open?: string;
|
|
25
|
+
onOpenChange?: (field: string) => void;
|
|
26
|
+
/** Each value's count, the most first: the Toolbar's Show counts. Off, the values stand in the field's order with none. */
|
|
27
|
+
counts?: boolean;
|
|
28
|
+
/** Which form: the phone's in a phone's window or a PhoneHost screen, else the computer's. */
|
|
29
|
+
form?: "computer" | "phone";
|
|
30
|
+
/** On a phone, called after a press that finishes the job (pressCloses: one hold at a time): its Sheet closes. */
|
|
31
|
+
onDone?: () => void;
|
|
32
|
+
/** Its words; each left out, the Outright kit's English (words.ts). */
|
|
33
|
+
words?: Partial<QuickFiltersWords>;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
/** A list narrowed by a field's values, at a press. */
|
|
37
|
+
export declare function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, onOpenChange, counts, form: given, onDone, words, className }: QuickFiltersProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { Avatar } from "../avatar/avatar.js";
|
|
6
|
+
import { Input, InputGroup, InputGroupAddon } from "../input/input.js";
|
|
7
|
+
import { Icon } from "../internal/icons.js";
|
|
8
|
+
import { usePhoneForm } from "../internal/phone.js";
|
|
9
|
+
import { Scrollbar } from "../scrollbar/scrollbar.js";
|
|
10
|
+
import { StatusGlyph } from "../status/status.js";
|
|
11
|
+
import { Toggle, ToggleGroup } from "../toggle/toggle.js";
|
|
12
|
+
import { QUICK_FILTERS_ATTRS, quickFiltersWornOf } from "./looks.js";
|
|
13
|
+
import { SEARCH_PAST, firstOpen, heldIn, holdAfter, pressCloses, valuesFound, valuesShown } from "./rules.js";
|
|
14
|
+
import { quickFiltersWords } from "./words.js";
|
|
15
|
+
function useHolding(el) {
|
|
16
|
+
const [holding, setHolding] = React.useState("one");
|
|
17
|
+
React.useLayoutEffect(() => {
|
|
18
|
+
const read = () => setHolding(quickFiltersWornOf(el.current).holds);
|
|
19
|
+
read();
|
|
20
|
+
const watch = new MutationObserver(read);
|
|
21
|
+
watch.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: QUICK_FILTERS_ATTRS });
|
|
22
|
+
return () => watch.disconnect();
|
|
23
|
+
}, [el]);
|
|
24
|
+
return holding;
|
|
25
|
+
}
|
|
26
|
+
function Mark({ value, phone }) {
|
|
27
|
+
const m = value.mark;
|
|
28
|
+
if (!m)
|
|
29
|
+
return null;
|
|
30
|
+
return _jsx("span", { className: "o-quick-filters-mark", "aria-hidden": "true", children: "status" in m
|
|
31
|
+
? _jsx(StatusGlyph, { place: m.status, quarters: m.quarters })
|
|
32
|
+
: _jsx(Avatar, { name: value.label, kind: m.avatar === "company" ? "thing" : "person", id: m.id, size: phone ? 24 : 20 }) });
|
|
33
|
+
}
|
|
34
|
+
function Values({ field, values, held, several, onPress, search, phone, clear }) {
|
|
35
|
+
const [at, setAt] = React.useState(() => Math.max(0, values.findIndex((v) => held.includes(v.value)))), rows = React.useRef([]);
|
|
36
|
+
const here = Math.min(at, Math.max(values.length - 1, 0));
|
|
37
|
+
const go = (i) => { const n = Math.max(0, Math.min(values.length - 1, i)); setAt(n); rows.current[n]?.focus(); };
|
|
38
|
+
const keys = (e, i) => {
|
|
39
|
+
const to = { ArrowDown: i + 1, ArrowUp: i - 1, Home: 0, End: values.length - 1 }[e.key];
|
|
40
|
+
if (to !== undefined) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
if (e.key === "ArrowUp" && i === 0 && search.current)
|
|
43
|
+
search.current.focus();
|
|
44
|
+
else
|
|
45
|
+
go(to);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
onPress(values[i].value);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-quick-filters-values", role: "listbox", "aria-label": field.name, "aria-multiselectable": several || undefined, "data-quiet": held.length ? "" : undefined, children: values.map((v, i) => {
|
|
54
|
+
const on = held.includes(v.value);
|
|
55
|
+
return (_jsxs("div", { ref: (el) => { rows.current[i] = el; }, role: "option", "aria-selected": on, tabIndex: i === here ? 0 : -1, className: "o-quick-filters-value", "data-held": on ? "" : undefined, onClick: () => { setAt(i); onPress(v.value); }, onKeyDown: (e) => keys(e, i), children: [_jsx(Mark, { value: v, phone: phone }), _jsx("span", { className: "o-quick-filters-name", children: v.label }), on && _jsx("span", { className: "o-quick-filters-clear", "aria-hidden": "true", children: clear }), v.count !== undefined && _jsx("span", { className: "o-quick-filters-count", children: v.count.toLocaleString("en-GB") })] }, v.value));
|
|
56
|
+
}) }), _jsx(Scrollbar, {})] }));
|
|
57
|
+
}
|
|
58
|
+
export function QuickFilters({ fields, holds, onHoldsChange, open: openGiven, onOpenChange, counts = true, form: given, onDone, words, className }) {
|
|
59
|
+
const phone = usePhoneForm(given), form = phone ? "phone" : "computer", w = quickFiltersWords(words);
|
|
60
|
+
const root = React.useRef(null), searchBox = React.useRef(null), holding = useHolding(root);
|
|
61
|
+
const [own, setOwn] = React.useState(() => firstOpen(fields, holds)), [query, setQuery] = React.useState("");
|
|
62
|
+
const open = openGiven ?? own;
|
|
63
|
+
const field = fields.find((f) => f.id === open) ?? fields[0];
|
|
64
|
+
const show = (id) => { setOwn(id); onOpenChange?.(id); };
|
|
65
|
+
const [typedIn, setTypedIn] = React.useState(field?.id);
|
|
66
|
+
if (field && typedIn !== field.id) {
|
|
67
|
+
setTypedIn(field.id);
|
|
68
|
+
setQuery("");
|
|
69
|
+
}
|
|
70
|
+
if (!field)
|
|
71
|
+
return null;
|
|
72
|
+
const searching = field.values.length > SEARCH_PAST;
|
|
73
|
+
const values = valuesFound(valuesShown(field.values, counts), searching ? query : "");
|
|
74
|
+
const press = (value) => {
|
|
75
|
+
onHoldsChange(holdAfter(holds, field.id, value, holding), { field: field.id, value });
|
|
76
|
+
if (phone && pressCloses(holding))
|
|
77
|
+
onDone?.();
|
|
78
|
+
};
|
|
79
|
+
const toFirst = (e) => {
|
|
80
|
+
if (e.key !== "ArrowDown")
|
|
81
|
+
return;
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
root.current?.querySelector(".o-quick-filters-value")?.focus();
|
|
84
|
+
};
|
|
85
|
+
return (_jsxs("div", { ref: root, className: cx("o-quick-filters", className), "data-kit": "quick-filters", "data-form": form, children: [_jsxs("div", { className: "o-quick-filters-top", children: [_jsx(ToggleGroup, { "aria-label": w.fields, kind: "pill", size: phone ? "sm" : "xs", spacing: phone ? 2 : 1.5, value: [field.id], onValueChange: (v) => { if (v[0])
|
|
86
|
+
show(v[0]); }, className: "o-quick-filters-strip", children: fields.map((f) => _jsx(Toggle, { value: f.id, children: f.name }, f.id)) }), searching && (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { ref: searchBox, value: query, onValueChange: setQuery, placeholder: field.search, "aria-label": field.search ?? w.search(field.name), onKeyDown: toFirst })] }))] }), values.length || !query
|
|
87
|
+
? _jsx(Values, { field: field, values: values, held: heldIn(holds, field.id), several: holding === "several", onPress: press, search: searchBox, phone: phone, clear: w.clear }, `${field.id}:${query}`)
|
|
88
|
+
: _jsx("p", { className: "o-quick-filters-none", role: "status", children: w.none })] }));
|
|
89
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { QuickField } from "./quick-filters.js";
|
|
2
|
+
import { type QuickHolds } from "./rules.js";
|
|
3
|
+
import { type QuickFiltersReminderWords } from "./words.js";
|
|
4
|
+
export interface QuickFiltersReminderProps {
|
|
5
|
+
/** The fields, as quick filters are handed them: the held values are named from them. */
|
|
6
|
+
fields: QuickField[];
|
|
7
|
+
/** What is held; nothing held, it leaves. */
|
|
8
|
+
holds: QuickHolds;
|
|
9
|
+
/** A press on its names: its holder opens quick filters (on a phone, the Sheet). */
|
|
10
|
+
onOpen: () => void;
|
|
11
|
+
/** ✕: every hold let go. */
|
|
12
|
+
onClear: () => void;
|
|
13
|
+
/** Its words, over the English (words.ts): its name, its press's, and its ✕'s. */
|
|
14
|
+
words?: Partial<QuickFiltersReminderWords>;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** On a phone, a pill at the list's foot naming what quick filters hold, opening them, and letting every hold go. */
|
|
18
|
+
export declare function QuickFiltersReminderControl({ fields, holds, onOpen, onClear, words: given, className }: QuickFiltersReminderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
5
|
+
import { cx as cn } from "../../internal/cx.js";
|
|
6
|
+
import { Avatar } from "../avatar/avatar.js";
|
|
7
|
+
import { Button } from "../button/button.js";
|
|
8
|
+
import { Icon } from "../internal/icons.js";
|
|
9
|
+
import { StatusGlyph } from "../status/status.js";
|
|
10
|
+
import { ToolbarControl as Toolbar, ToolbarSeparatorControl as ToolbarSeparator } from "../toolbar/toolbar.js";
|
|
11
|
+
import { heldNames, reminderWords } from "./rules.js";
|
|
12
|
+
import { quickFiltersReminderWords } from "./words.js";
|
|
13
|
+
function Mark({ held }) {
|
|
14
|
+
const m = held.mark;
|
|
15
|
+
if (!m)
|
|
16
|
+
return null;
|
|
17
|
+
return _jsx("span", { className: "o-quick-filters-mark", "aria-hidden": "true", children: "status" in m
|
|
18
|
+
? _jsx(StatusGlyph, { place: m.status, quarters: m.quarters })
|
|
19
|
+
: _jsx(Avatar, { name: held.name, kind: m.avatar === "company" ? "thing" : "person", id: m.id, size: 24 }) });
|
|
20
|
+
}
|
|
21
|
+
export function QuickFiltersReminderControl({ fields, holds, onOpen, onClear, words: given, className }) {
|
|
22
|
+
const spoken = quickFiltersReminderWords(given);
|
|
23
|
+
const named = heldNames(fields, holds), shown = named.length > 0;
|
|
24
|
+
const key = JSON.stringify(named);
|
|
25
|
+
const [kept, setKept] = React.useState({ key, named });
|
|
26
|
+
if (shown && kept.key !== key)
|
|
27
|
+
setKept({ key, named });
|
|
28
|
+
const said = shown ? named : kept.named, { words, more } = reminderWords(said.map((h) => h.name));
|
|
29
|
+
const root = React.useRef(null), wasShown = React.useRef(shown);
|
|
30
|
+
React.useLayoutEffect(() => {
|
|
31
|
+
const left = wasShown.current && !shown;
|
|
32
|
+
wasShown.current = shown;
|
|
33
|
+
const holder = root.current?.parentElement;
|
|
34
|
+
if (!left || !holder || !root.current?.contains(document.activeElement))
|
|
35
|
+
return;
|
|
36
|
+
if (!holder.hasAttribute("tabindex"))
|
|
37
|
+
holder.tabIndex = -1;
|
|
38
|
+
holder.focus({ preventScroll: true });
|
|
39
|
+
}, [shown]);
|
|
40
|
+
return (_jsx("div", { ref: root, className: cn("o-quick-filters-reminder", className), "data-shown": shown ? "" : undefined, inert: !shown, children: _jsxs(Toolbar, { label: spoken.label, spacing: 1, fold: false, form: "phone", children: [_jsxs(BaseToolbar.Button, { className: "o-quick-filters-reminder-words", "aria-label": spoken.names([...new Set(said.map((h) => h.name))].join(", ")), onClick: onOpen, children: [said[0] && _jsx(Mark, { held: said[0] }), _jsx("span", { children: words }), more > 0 && _jsxs("span", { className: "o-quick-filters-reminder-more", children: ["+", more] })] }), _jsx(ToolbarSeparator, {}), _jsx(Button, { kind: "quiet", shape: "icon", size: "44", "aria-label": spoken.clear, icon: _jsx(Icon, { name: "x", size: 18 }), onClick: onClear })] }) }));
|
|
41
|
+
}
|