viewkitjs 0.31.0 → 0.33.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 +198 -0
- package/MIGRATION.md +40 -6
- package/README.md +1 -1
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/index.d.ts +2 -0
- package/fields/dist/query/index.js +2 -0
- package/fields/dist/query/list-request.d.ts +148 -0
- package/fields/dist/query/list-request.js +125 -0
- package/fields/dist/query/saved-view.d.ts +15 -0
- package/fields/dist/query/saved-view.js +11 -0
- package/fields/dist/query/settings.d.ts +9 -0
- package/fields/dist/query/settings.js +9 -0
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/fields/docs/reference/query.md +66 -0
- package/package.json +5 -1
- package/postgres/README.md +1 -0
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/handler.d.ts +53 -0
- package/postgres/dist/handler.js +211 -0
- package/postgres/dist/ids.d.ts +1 -1
- package/postgres/dist/ids.js +19 -1
- package/postgres/dist/index.d.ts +1 -0
- package/postgres/dist/index.js +1 -0
- package/postgres/dist/limits.d.ts +3 -1
- package/postgres/dist/limits.js +1 -1
- package/postgres/dist/list-fields.d.ts +10 -0
- package/postgres/dist/list-fields.js +36 -0
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/readable.d.ts +4 -0
- package/postgres/dist/readable.js +4 -0
- package/postgres/dist/refusals.d.ts +9 -2
- package/postgres/dist/refusals.js +6 -0
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +3 -3
- package/postgres/docs/guides/list-handler.md +99 -0
- package/postgres/docs/index.md +1 -0
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +12 -4
- package/views/README.md +2 -2
- package/views/dist/atoms/RowMenu.d.ts +7 -0
- package/views/dist/atoms/RowMenu.js +18 -16
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/carried.d.ts +5 -0
- package/views/dist/atoms/carried.js +7 -0
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +19 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +56 -11
- package/views/dist/contract.js +148 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +2 -1
- package/views/dist/controls/atoms.d.ts +2 -0
- package/views/dist/controls/atoms.js +2 -0
- package/views/dist/controls/avatar/avatar.d.ts +3 -3
- package/views/dist/controls/avatar/avatar.js +1 -1
- package/views/dist/controls/avatar/tokens.d.ts +44 -0
- package/views/dist/controls/avatar/tokens.js +11 -0
- package/views/dist/controls/avatar.css +22 -5
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/choice/tokens.d.ts +0 -4
- package/views/dist/controls/choice/tokens.js +0 -1
- package/views/dist/controls/choice.css +3 -3
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +8 -0
- package/views/dist/controls/controls.js +12 -2
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +5 -1
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +22 -4
- package/views/dist/controls/field/field.js +63 -5
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +41 -16
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/glyphs/glyphs.d.ts +10 -0
- package/views/dist/controls/glyphs/glyphs.js +173 -0
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +4 -1
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/input/input.js +6 -3
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/input/tokens.d.ts +4 -0
- package/views/dist/controls/input/tokens.js +1 -0
- package/views/dist/controls/input.css +31 -3
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/icons.js +10 -0
- package/views/dist/controls/internal/keep-focus.d.ts +2 -0
- package/views/dist/controls/internal/keep-focus.js +17 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/internal/watch-frame.d.ts +2 -0
- package/views/dist/controls/internal/watch-frame.js +33 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/markdown/map-markdown.d.ts +4 -0
- package/views/dist/controls/markdown/map-markdown.js +5 -0
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -4
- package/views/dist/controls/menu-list/menu-list.js +27 -25
- package/views/dist/controls/modal/modal.js +5 -1
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +6 -5
- package/views/dist/controls/phone-header/header-bar.d.ts +5 -1
- package/views/dist/controls/phone-header/header-bar.js +2 -2
- package/views/dist/controls/phone-header.css +11 -1
- package/views/dist/controls/picker/map-picker.js +3 -0
- package/views/dist/controls/picker/picker.d.ts +16 -0
- package/views/dist/controls/picker/picker.js +61 -40
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +8 -3
- package/views/dist/controls/radio/radio.js +22 -5
- package/views/dist/controls/radio/tokens.d.ts +44 -0
- package/views/dist/controls/radio/tokens.js +11 -0
- package/views/dist/controls/radio.css +79 -1
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +7 -0
- package/views/dist/controls/select/select.js +12 -6
- package/views/dist/controls/select/tokens.d.ts +8 -0
- package/views/dist/controls/select/tokens.js +2 -0
- package/views/dist/controls/select.css +17 -0
- package/views/dist/controls/setting-row/looks.d.ts +1 -1
- package/views/dist/controls/setting-row/looks.js +9 -4
- package/views/dist/controls/setting-row/setting-row.d.ts +45 -10
- package/views/dist/controls/setting-row/setting-row.js +82 -15
- package/views/dist/controls/setting-row/tokens.d.ts +74 -2
- package/views/dist/controls/setting-row/tokens.js +19 -1
- package/views/dist/controls/setting-row.css +135 -14
- package/views/dist/controls/sheet/bottom-sheet.d.ts +14 -2
- package/views/dist/controls/sheet/bottom-sheet.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sheet.css +4 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +25 -26
- package/views/dist/controls/sort-editor.css +13 -2
- package/views/dist/controls/switch-row/tokens.d.ts +0 -12
- package/views/dist/controls/switch-row/tokens.js +0 -3
- package/views/dist/controls/switch-row.css +3 -7
- package/views/dist/controls/switch.css +17 -7
- package/views/dist/controls/tag/tag.d.ts +3 -1
- package/views/dist/controls/tag/tag.js +2 -2
- package/views/dist/controls/tag/tokens.d.ts +4 -0
- package/views/dist/controls/tag/tokens.js +1 -0
- package/views/dist/controls/tag-field/tag-field.d.ts +5 -1
- package/views/dist/controls/tag-field/tag-field.js +11 -5
- package/views/dist/controls/tag-field/tokens.d.ts +16 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +19 -0
- package/views/dist/controls/tag.css +2 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar/toolbar.d.ts +15 -3
- package/views/dist/controls/toolbar/toolbar.js +22 -15
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +14 -0
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +52 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/toolbar-button.js +2 -3
- package/views/dist/controls/toolbar-button.css +4 -0
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -0
- package/views/dist/controls/views-list/map-view-menu.js +25 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +28 -1
- package/views/dist/controls/views-list/map-views-list-body.js +39 -21
- package/views/dist/controls/views-list/rules.d.ts +2 -0
- package/views/dist/controls/views-list/view-menu.d.ts +7 -0
- package/views/dist/controls/views-list/view-menu.js +33 -29
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/controls/views-list/words.d.ts +2 -0
- package/views/dist/controls/views-list/words.js +1 -1
- package/views/dist/editors/EditorPanel.js +3 -2
- package/views/dist/editors/edit-session.js +2 -5
- package/views/dist/field-row/FieldRow.d.ts +4 -2
- package/views/dist/field-row/FieldRow.js +80 -20
- package/views/dist/field-row/FieldRowLane.d.ts +7 -2
- package/views/dist/field-row/FieldRowLane.js +4 -3
- package/views/dist/field-row/editors/RowEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowEditor.js +31 -1
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +5 -1
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -1
- package/views/dist/field-row/field-row-button.d.ts +5 -0
- package/views/dist/field-row/field-row-button.js +2 -0
- package/views/dist/fields/binding.d.ts +3 -2
- package/views/dist/fields/binding.js +38 -5
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +4 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +3 -2
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -1
- package/views/dist/grid/chrome/GridGroupMenu.js +4 -3
- package/views/dist/grid/chrome/GridHeader.d.ts +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +6 -5
- package/views/dist/grid/chrome/GridRowCells.js +6 -9
- package/views/dist/grid/chrome/GridStructure.d.ts +4 -1
- package/views/dist/grid/chrome/GridStructure.js +4 -4
- package/views/dist/grid/chrome/GridTable.js +9 -3
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-column-menu-items.js +1 -1
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +27 -3
- package/views/dist/grid/chrome/grid-row-menu-items.js +93 -7
- package/views/dist/grid/chrome/grid-row-props.d.ts +7 -2
- package/views/dist/grid/chrome/grid-rows-menu.js +34 -6
- package/views/dist/grid/chrome/grid-table-props.d.ts +38 -7
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +3 -1
- package/views/dist/grid/chrome/useGridBatchApi.js +4 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +7 -2
- package/views/dist/grid/chrome/useGridKeyboard.js +43 -14
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +1 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +20 -7
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/commit-model.d.ts +20 -2
- package/views/dist/grid/core/editing-controller.d.ts +21 -0
- package/views/dist/grid/core/editing-controller.js +194 -42
- package/views/dist/grid/core/editing-model.d.ts +3 -0
- package/views/dist/grid/core/editing-model.js +3 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/save-path.d.ts +24 -0
- package/views/dist/grid/core/save-path.js +122 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +3 -0
- package/views/dist/grid/core/spreadsheet-operations.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/grid/index.d.ts +3 -2
- package/views/dist/grid/index.js +1 -0
- package/views/dist/internal/field-rows.d.ts +26 -0
- package/views/dist/internal/field-rows.js +8 -0
- package/views/dist/internal/page-close.d.ts +7 -0
- package/views/dist/internal/page-close.js +43 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/browser-views-store.d.ts +10 -0
- package/views/dist/list/browser-views-store.js +182 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +36 -0
- package/views/dist/list/index.js +11 -0
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/menu.d.ts +31 -0
- package/views/dist/list/menu.js +76 -0
- package/views/dist/list/parts.d.ts +6 -0
- package/views/dist/list/parts.js +66 -0
- package/views/dist/list/registry.d.ts +11 -0
- package/views/dist/list/registry.js +31 -0
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +41 -0
- package/views/dist/list/root.js +168 -0
- package/views/dist/list/slot.d.ts +14 -0
- package/views/dist/list/slot.js +22 -0
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/source.d.ts +11 -0
- package/views/dist/list/source.js +31 -0
- package/views/dist/list/store.d.ts +119 -0
- package/views/dist/list/store.js +146 -0
- package/views/dist/list/toolbar.d.ts +7 -0
- package/views/dist/list/toolbar.js +371 -0
- package/views/dist/list/views-axis.d.ts +5 -0
- package/views/dist/list/views-axis.js +98 -0
- package/views/dist/list/views-store.d.ts +41 -0
- package/views/dist/list/views-store.js +1 -0
- package/views/dist/list/views.d.ts +72 -0
- package/views/dist/list/views.js +411 -0
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/preferences.js +1 -1
- package/views/dist/model/prefs-buckets.js +1 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/index.d.ts +3 -1
- package/views/dist/panels/index.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/customize-body.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +47 -4
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +6 -326
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +17 -2
- package/views/dist/panels/react/toolbar/Toolbar.js +43 -23
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +7 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +20 -3
- package/views/dist/panels/react/toolbar/context.js +3 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +1 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +15 -4
- package/views/dist/panels/react/views-row/PillGroup.d.ts +5 -2
- package/views/dist/panels/react/views-row/PillGroup.js +16 -7
- package/views/dist/panels/react/views-row/ViewPicker.js +2 -12
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/ViewPickerRow.js +9 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/panels/toolbar/edit-view.d.ts +7 -1
- package/views/dist/panels/toolbar/edit-view.js +14 -0
- package/views/dist/panels/toolbar/model.d.ts +5 -0
- package/views/dist/panels/toolbar/model.js +7 -3
- package/views/dist/panels/view-state.d.ts +5 -3
- package/views/dist/panels/views-row/model.d.ts +19 -2
- package/views/dist/panels/views-row/model.js +14 -0
- package/views/dist/provider/ViewsProvider.d.ts +21 -8
- package/views/dist/provider/ViewsProvider.js +40 -5
- package/views/dist/provider/components.d.ts +102 -2
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +6 -2
- package/views/dist/provider/context.js +1 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/ports.d.ts +19 -12
- package/views/dist/provider/ports.js +69 -1
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +503 -136
- package/views/dist/styles.unlayered.css +503 -136
- package/views/docs/contract.md +292 -34
- package/views/docs/controls/avatar.md +11 -0
- package/views/docs/controls/choice.md +0 -1
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +7 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +5 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +20 -1
- package/views/docs/controls/select.md +10 -0
- package/views/docs/controls/setting-row.md +18 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/switch-row.md +0 -3
- package/views/docs/controls/tag-field.md +4 -0
- package/views/docs/controls/tag.md +1 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/getting-started.md +2 -2
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/columns.md +1 -1
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/the-grid.md +36 -9
- package/views/docs/guides/the-provider.md +22 -3
- package/views/docs/index.md +1 -0
- package/views/docs/reference/controls.md +41 -29
- package/views/docs/reference/editors-session.md +1 -1
- package/views/docs/reference/field-row.md +9 -1
- package/views/docs/reference/grid.md +15 -9
- package/views/docs/reference/list.md +357 -0
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +17 -12
- package/views/docs/reference/panels.md +8 -5
- package/views/docs/reference/react.md +24 -16
- package/views/docs/reference/views.md +10 -6
- package/views/docs/reshaping.md +6 -1
- package/views/skills/views/SKILL.md +9 -6
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { carryAtoms } from "../atoms/carried.js";
|
|
2
|
+
import { CONTROL_ATOMS } from "./atoms.js";
|
|
1
3
|
import { MapButton } from "./button/map-button.js";
|
|
4
|
+
import { MapAppIcon } from "./glyphs/glyphs.js";
|
|
5
|
+
import { MapMarkdown } from "./markdown/map-markdown.js";
|
|
2
6
|
import { MapTooltip } from "./tooltip/map-tooltip.js";
|
|
3
7
|
import { MapPopover } from "./popover/map-popover.js";
|
|
4
8
|
import { MapSheet } from "./sheet/map-sheet.js";
|
|
5
9
|
import { MapCheckbox } from "./checkbox/map-checkbox.js";
|
|
6
10
|
import { MapInput } from "./input/map-input.js";
|
|
7
11
|
import { MapMenu } from "./menu/map-menu.js";
|
|
12
|
+
import { MapSelect } from "./select/map-select.js";
|
|
8
13
|
import { MapSortBody } from "./sort-editor/map-sort-body.js";
|
|
9
14
|
import { MapViewsListBody } from "./views-list/map-views-list-body.js";
|
|
15
|
+
import { MapViewMenu } from "./views-list/map-view-menu.js";
|
|
10
16
|
import { MapFilterBody, MapFilterPartBody } from "./filter-editor/map-filter-body.js";
|
|
11
17
|
import { MapGroupBody } from "./group-editor/map-group-body.js";
|
|
12
18
|
import { MapCustomizeBody } from "./customize/map-customize-body.js";
|
|
@@ -23,16 +29,20 @@ import { MapPartsBody } from "./compound-editor/map-parts-body.js";
|
|
|
23
29
|
import { MapNumberBody } from "./number-editor/map-number-body.js";
|
|
24
30
|
import { MapValuesBody } from "./values-editor/map-values-body.js";
|
|
25
31
|
import { MapLinksBody } from "./links-editor/map-links-body.js";
|
|
26
|
-
export const CONTROLS = {
|
|
32
|
+
export const CONTROLS = carryAtoms({
|
|
27
33
|
Button: MapButton,
|
|
34
|
+
AppIcon: MapAppIcon,
|
|
35
|
+
Markdown: MapMarkdown,
|
|
28
36
|
Tooltip: MapTooltip,
|
|
29
37
|
Popover: MapPopover,
|
|
30
38
|
Sheet: MapSheet,
|
|
31
39
|
Input: MapInput,
|
|
32
40
|
Checkbox: MapCheckbox,
|
|
33
41
|
Menu: MapMenu,
|
|
42
|
+
Select: MapSelect,
|
|
34
43
|
SortBody: MapSortBody,
|
|
35
44
|
ViewsListBody: MapViewsListBody,
|
|
45
|
+
ViewMenu: MapViewMenu,
|
|
36
46
|
FilterBody: MapFilterBody,
|
|
37
47
|
FilterPartBody: MapFilterPartBody,
|
|
38
48
|
GroupBody: MapGroupBody,
|
|
@@ -50,4 +60,4 @@ export const CONTROLS = {
|
|
|
50
60
|
NumberBody: MapNumberBody,
|
|
51
61
|
ValuesBody: MapValuesBody,
|
|
52
62
|
LinksBody: MapLinksBody,
|
|
53
|
-
};
|
|
63
|
+
}, CONTROL_ATOMS);
|
|
@@ -117,21 +117,22 @@ export function useCustomize(props) {
|
|
|
117
117
|
h.land();
|
|
118
118
|
} holds.current = []; }, []);
|
|
119
119
|
const layout = layouts.find((l) => l.id === view.layout) ?? layouts[0];
|
|
120
|
-
const
|
|
120
|
+
const part = (slot, key) => ({ slot: { slot, ...(key !== undefined ? { key } : {}) } });
|
|
121
|
+
const section = (label, icon, s, key) => s ? [{ kind: "actions", icon, label, detail: s.says, inForce: s.inForce, entries: [], ...part("vk-customize-section", key) }] : [];
|
|
121
122
|
const toggleRows = (ts) => ts.flatMap((t) => [
|
|
122
|
-
{ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }) },
|
|
123
|
-
...(t.reset ? [{ icon: null, label: w.toggleReset(t.label), onSelect: t.reset }] : []),
|
|
123
|
+
{ kind: "check", label: t.label, checked: t.value, onCheckedChange: (on) => t.onChange(on), ...(t.icon != null && { icon: t.icon }), ...part("vk-customize-toggle", t.key) },
|
|
124
|
+
...(t.reset ? [{ icon: null, label: w.toggleReset(t.label), onSelect: t.reset, ...part("vk-customize-toggle-reset", t.key) }] : []),
|
|
124
125
|
]);
|
|
125
126
|
const sectionsOfToggles = (ts) => [...new Set(ts.flatMap((t) => (t.section ? [t.section] : [])))];
|
|
126
127
|
const checks = toggles
|
|
127
128
|
? [...toggleRows(toggles.filter((t) => !t.section)),
|
|
128
129
|
...sectionsOfToggles(toggles).map((s) => ({ kind: "group", heading: s, entries: toggleRows(toggles.filter((t) => t.section === s)) }))]
|
|
129
|
-
: [{ kind: "check", label: w.showCounts, checked: view.counts, onCheckedChange: (c) => change({ ...latest.view, counts: c }) }];
|
|
130
|
+
: [{ kind: "check", label: w.showCounts, checked: view.counts, onCheckedChange: (c) => change({ ...latest.view, counts: c }), ...part("vk-customize-toggle", "counts") }];
|
|
130
131
|
const fieldRows = new Map();
|
|
131
132
|
const fieldRow = (f) => {
|
|
132
133
|
const entry = f.disabled != null
|
|
133
|
-
? { icon: f.icon ?? null, label: f.label, disabled: f.disabled }
|
|
134
|
-
: { kind: "actions", icon: f.icon ?? null, label: f.label, detail: f.says, inForce: f.inForce, entries: [] };
|
|
134
|
+
? { icon: f.icon ?? null, label: f.label, disabled: f.disabled, ...part("vk-customize-field", f.key) }
|
|
135
|
+
: { kind: "actions", icon: f.icon ?? null, label: f.label, detail: f.says, inForce: f.inForce, entries: [], ...part("vk-customize-field", f.key) };
|
|
135
136
|
if (f.disabled == null)
|
|
136
137
|
fieldRows.set(entry, f.key);
|
|
137
138
|
return entry;
|
|
@@ -146,10 +147,10 @@ export function useCustomize(props) {
|
|
|
146
147
|
const inForceFields = filterFields.filter((f) => f.inForce).length;
|
|
147
148
|
const foldedFilter = folded ? { says: inForceFields ? String(inForceFields) : w.none, inForce: inForceFields > 0 } : undefined;
|
|
148
149
|
const sections = [
|
|
149
|
-
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, entries: [] }] : []),
|
|
150
|
-
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), entries: [] }] : []),
|
|
150
|
+
...(hasLayout ? [{ kind: "actions", icon: layout?.mark, label: w.layout, detail: layout?.name, entries: [], ...part("vk-customize-section", "layout") }] : []),
|
|
151
|
+
...(hasColumns ? [{ kind: "actions", icon: COLUMNS, label: w.columns, detail: columnsSay(view.columns, w), entries: [], ...part("vk-customize-section", "columns") }] : []),
|
|
151
152
|
...(folded ? [] : fieldEntries(filterFields, true)),
|
|
152
|
-
...section(w.filter, _jsx(Icon, { name: "filter" }), filter ?? foldedFilter), ...section(w.sort, _jsx(Icon, { name: "sort" }), sort), ...section(w.group, GROUP, group),
|
|
153
|
+
...section(w.filter, _jsx(Icon, { name: "filter" }), filter ?? foldedFilter, "filter"), ...section(w.sort, _jsx(Icon, { name: "sort" }), sort, "sort"), ...section(w.group, GROUP, group, "group"),
|
|
153
154
|
...(folded ? [] : fieldEntries(afterFields)),
|
|
154
155
|
...(checks.length ? [{ kind: "separator" }, ...checks] : []),
|
|
155
156
|
];
|
|
@@ -195,10 +196,10 @@ export function useCustomize(props) {
|
|
|
195
196
|
} if ("label" in e && SCREEN_OF[e.label])
|
|
196
197
|
go(SCREEN_OF[e.label]); };
|
|
197
198
|
const footer = [
|
|
198
|
-
...(onCopyLink ? [{ icon: _jsx(Icon, { name: "link" }), label: w.copyLink, onSelect: onCopyLink }] : []),
|
|
199
|
-
...(onExport ? [{ icon: _jsx(Icon, { name: "export" }), label: w.export, ...(exportCount != null ? { count: exportCount } : {}), onSelect: onExport }] : []),
|
|
199
|
+
...(onCopyLink ? [{ icon: _jsx(Icon, { name: "link" }), label: w.copyLink, onSelect: onCopyLink, ...part("vk-customize-action", "copy-link") }] : []),
|
|
200
|
+
...(onExport ? [{ icon: _jsx(Icon, { name: "export" }), label: w.export, ...(exportCount != null ? { count: exportCount } : {}), onSelect: onExport, ...part("vk-customize-action", "export") }] : []),
|
|
200
201
|
];
|
|
201
|
-
const words = (size) => (_jsxs(_Fragment, { children: [stale && _jsx(Notice, { className: "o-customize-stale", children: w.stale }), _jsxs("div", { className: "o-customize-words", children: [_jsx(Button, { kind: "link", size: size, onClick: onReset, disabled: pending, children: w.reset }), onSave && _jsx(Button, { kind: "link", size: size, onClick: onSave, disabled: pending, children: w.save })] })] }));
|
|
202
|
+
const words = (size) => (_jsxs(_Fragment, { children: [stale && _jsx(Notice, { className: "o-customize-stale", "data-slot": "vk-customize-stale", children: w.stale }), _jsxs("div", { className: "o-customize-words", "data-slot": "vk-customize-changes", children: [_jsx(Button, { kind: "link", size: size, "data-slot": "vk-customize-action", "data-key": "reset", onClick: onReset, disabled: pending, children: w.reset }), onSave && _jsx(Button, { kind: "link", size: size, "data-slot": "vk-customize-action", "data-key": "save", onClick: onSave, disabled: pending, children: w.save })] })] }));
|
|
202
203
|
const col = screen === "columns" && column ? view.columns.find((c) => c.id === column && columnOpens(c)) : undefined;
|
|
203
204
|
React.useLayoutEffect(() => { if (column && !col) {
|
|
204
205
|
setColumn(null);
|
|
@@ -215,30 +216,31 @@ export function useCustomize(props) {
|
|
|
215
216
|
? _jsx(MenuList, { label: label, entries: rows, onOpen: choiceOpened, words: w.rows })
|
|
216
217
|
: _jsx(MenuListPanelRows, { label: label, entries: rows, ticks: "switch", onOpen: choiceOpened, words: w.rows }));
|
|
217
218
|
const choiceRow = (c) => {
|
|
218
|
-
const entry = { kind: "choices", icon: null, label: c.label, value: c.value, choices: c.options.map((o) => ({ value: o.value, label: o.label })),
|
|
219
|
-
detail: c.options.find((o) => o.value === c.value)?.label };
|
|
219
|
+
const entry = { kind: "choices", icon: null, label: c.label, value: c.value, choices: c.options.map((o) => ({ value: o.value, label: o.label, ...part("vk-customize-option", o.value) })),
|
|
220
|
+
detail: c.options.find((o) => o.value === c.value)?.label, ...part("vk-customize-choice", c.key) };
|
|
220
221
|
choiceRows.set(entry, c);
|
|
221
222
|
return entry;
|
|
222
223
|
};
|
|
223
224
|
const choice = allChoices.find((c) => c.key === choosing);
|
|
224
225
|
const backFromChoice = () => { setBack(true); setFocusTo(choice?.label ?? null); setChoosing(null); };
|
|
225
226
|
const choiceLevel = choice && (() => {
|
|
226
|
-
const rows = [{ kind: "pick", value: choice.value, choices: choice.options.map((o) => ({ value: o.value, label: o.label })),
|
|
227
|
+
const rows = [{ kind: "pick", value: choice.value, choices: choice.options.map((o) => ({ value: o.value, label: o.label, ...part("vk-customize-option", o.value) })),
|
|
227
228
|
onChoose: (v) => { if (v !== choice.value)
|
|
228
229
|
choice.onChange(v); backFromChoice(); } }];
|
|
229
230
|
return phone ? _jsx(MenuList, { label: choice.label, entries: rows, words: w.rows }) : _jsx(MenuListPanelRows, { label: choice.label, entries: rows, words: w.rows });
|
|
230
231
|
})();
|
|
231
|
-
const heading = (label, act) => (_jsxs("div", { className: "o-customize-heading", children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: label }), act?.map((a) => _jsx(Button, { kind: "link", size: "line", onClick: a.onPress, children: a.label }, a.label))] }));
|
|
232
|
+
const heading = (label, key, act) => (_jsxs("div", { className: "o-customize-heading", "data-slot": "vk-customize-heading", "data-key": key, children: [_jsx("p", { className: "o-list-heading o-customize-heading-words", children: label }), act?.map((a) => _jsx(Button, { kind: "link", size: "line", "data-slot": "vk-customize-columns-action", "data-key": a.key, onClick: a.onPress, children: a.label }, a.label))] }));
|
|
233
|
+
const headingWords = (label, key) => _jsx("p", { className: "o-list-heading o-customize-heading-words", "data-slot": "vk-customize-heading", "data-key": key, children: label });
|
|
232
234
|
const ownSettings = (settings, name, lead = [], own) => {
|
|
233
235
|
const bare = settings.toggles.filter((t) => !t.section), sectioned = sectionsOfToggles(settings.toggles);
|
|
234
236
|
const first = [...lead, ...settings.choices.map(choiceRow), ...toggleRows(bare)];
|
|
235
|
-
const you = settings.personal, yours = you ? [...you.choices.map(choiceRow), ...toggleRows(you.toggles), ...(you.onReset ? [{ icon: null, label: w.personalReset, onSelect: you.onReset }] : [])] : [];
|
|
236
|
-
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own &&
|
|
237
|
+
const you = settings.personal, yours = you ? [...you.choices.map(choiceRow), ...toggleRows(you.toggles), ...(you.onReset ? [{ icon: null, label: w.personalReset, onSelect: you.onReset, ...part("vk-customize-toggle-reset", "personal") }] : [])] : [];
|
|
238
|
+
return _jsxs(_Fragment, { children: [first.length > 0 && _jsxs(_Fragment, { children: [!own && headingWords(name, own === undefined ? layout?.id ?? name : name), rowsList(own?.list ?? w.layoutSettings(name), first)] }), sectioned.map((s) => _jsxs(React.Fragment, { children: [headingWords(s, s), rowsList(s, toggleRows(settings.toggles.filter((t) => t.section === s)))] }, s)), you && yours.length > 0 && _jsxs(_Fragment, { children: [headingWords(you.label, "you"), rowsList(you.label, yours)] })] });
|
|
237
239
|
};
|
|
238
240
|
const layoutScreen = (_jsxs(_Fragment, { children: [_jsx(RadioGroup, { tiles: true, "aria-label": w.layout, value: view.layout, onValueChange: (v) => { if (typeof v === "string")
|
|
239
|
-
change({ ...latest.view, layout: v }); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, disabled: l.later }, l.id)) }), layoutSettings ? ownSettings(layoutSettings, layout?.name ?? w.layout) : layout?.id === "table" && _jsxs(_Fragment, { children: [
|
|
240
|
-
{ kind: "check", label: w.freeze, checked: view.freeze, onCheckedChange: (c) => change({ ...latest.view, freeze: c }) },
|
|
241
|
-
{ kind: "check", label: w.wrap, checked: view.wrap, onCheckedChange: (c) => change({ ...latest.view, wrap: c }) },
|
|
241
|
+
change({ ...latest.view, layout: v }); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, disabled: l.later, "data-slot": "vk-customize-layout", "data-key": l.id }, l.id)) }), layoutSettings ? ownSettings(layoutSettings, layout?.name ?? w.layout) : layout?.id === "table" && _jsxs(_Fragment, { children: [headingWords(layout.name, layout.id), rowsList(w.layoutSettings(layout.name), [
|
|
242
|
+
{ kind: "check", label: w.freeze, checked: view.freeze, onCheckedChange: (c) => change({ ...latest.view, freeze: c }), ...part("vk-customize-toggle", "freeze") },
|
|
243
|
+
{ kind: "check", label: w.wrap, checked: view.wrap, onCheckedChange: (c) => change({ ...latest.view, wrap: c }), ...part("vk-customize-toggle", "wrap") },
|
|
242
244
|
])] })] }));
|
|
243
245
|
const searching = find.trim() !== "", eyes = worn.columns === "eye";
|
|
244
246
|
const found = findColumns(view.columns, find);
|
|
@@ -251,7 +253,7 @@ export function useCustomize(props) {
|
|
|
251
253
|
const block = (shown) => {
|
|
252
254
|
const grips = new Set(gripped(found, shown).map((c) => c.id));
|
|
253
255
|
return found.filter((c) => c.shown === shown).map((c) => {
|
|
254
|
-
const entry = { kind: "check", label: c.label, icon: c.mark, checked: held[c.id] ?? c.shown, grip: grips.has(c.id),
|
|
256
|
+
const entry = { kind: "check", label: c.label, icon: c.mark, checked: held[c.id] ?? c.shown, grip: grips.has(c.id), ...part("vk-customize-column", c.id),
|
|
255
257
|
disabled: c.locked ? w.alwaysShown : undefined, onCheckedChange: (on) => press([c.id], on),
|
|
256
258
|
...(columnOpens(c) && { opens: w.columnSettings(c.label) }),
|
|
257
259
|
...(c.line && { toggle: { icon: lineMark, label: c.line.on ? w.newLineOn(c.label) : w.newLineStart(c.label), on: c.line.on, onPress: () => onLineChange?.(c.id),
|
|
@@ -273,26 +275,26 @@ export function useCustomize(props) {
|
|
|
273
275
|
const canHide = view.columns.some((c) => c.shown && !c.locked), canShow = view.columns.some((c) => !c.shown);
|
|
274
276
|
const shownHere = found.some((c) => c.shown), hiddenHere = found.some((c) => !c.shown);
|
|
275
277
|
const typed = (e) => setFind(e.target.value);
|
|
276
|
-
const columnsBox = (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { value: find, onChange: typed, placeholder: phone ? w.findColumn : w.searchColumns, "aria-label": phone ? w.findColumn : w.searchColumns })] }));
|
|
278
|
+
const columnsBox = (_jsxs(InputGroup, { size: phone ? "lg" : "sm", chrome: "soft", "data-slot": "vk-customize-search", children: [_jsx(InputGroupAddon, { children: _jsx(Icon, { name: "search" }) }), _jsx(Input, { value: find, onChange: typed, placeholder: phone ? w.findColumn : w.searchColumns, "aria-label": phone ? w.findColumn : w.searchColumns })] }));
|
|
277
279
|
const columnsSearch = phone ? columnsBox : _jsx("div", { className: "o-customize-search", children: columnsBox });
|
|
278
280
|
const shownActs = [
|
|
279
|
-
...(!searching && canHide ? [{ label: w.hideAll, onPress: () => press(latest.view.columns.filter((c) => c.shown && !c.locked).map((c) => c.id), false) }] : []),
|
|
280
|
-
...(!searching && columnsReset ? [{ label: w.columnsReset, onPress: columnsReset }] : []),
|
|
281
|
+
...(!searching && canHide ? [{ key: "hide-all", label: w.hideAll, onPress: () => press(latest.view.columns.filter((c) => c.shown && !c.locked).map((c) => c.id), false) }] : []),
|
|
282
|
+
...(!searching && columnsReset ? [{ key: "reset", label: w.columnsReset, onPress: columnsReset }] : []),
|
|
281
283
|
];
|
|
282
|
-
const columnsScreen = (_jsxs(_Fragment, { children: [phone && columnsSearch, shownHere && _jsxs(_Fragment, { children: [heading(w.shownHeading, shownActs), rowsOf(w.shownHeading, true)] }), hiddenHere && _jsxs(_Fragment, { children: [heading(w.hiddenHeading, !searching && canShow ? [{ label: w.showAll, onPress: () => press(latest.view.columns.filter((c) => !c.shown).map((c) => c.id), true) }] : undefined), rowsOf(w.hiddenHeading, false)] }), !found.length && _jsx("p", { className: "o-customize-none", children: w.noColumn(find.trim()) }), columnsFoot != null && _jsx("div", { className: "o-customize-foot-rows", children: columnsFoot })] }));
|
|
284
|
+
const columnsScreen = (_jsxs(_Fragment, { children: [phone && columnsSearch, shownHere && _jsxs(_Fragment, { children: [heading(w.shownHeading, "shown", shownActs), rowsOf(w.shownHeading, true)] }), hiddenHere && _jsxs(_Fragment, { children: [heading(w.hiddenHeading, "hidden", !searching && canShow ? [{ key: "show-all", label: w.showAll, onPress: () => press(latest.view.columns.filter((c) => !c.shown).map((c) => c.id), true) }] : undefined), rowsOf(w.hiddenHeading, false)] }), !found.length && _jsx("p", { className: "o-customize-none", children: w.noColumn(find.trim()) }), columnsFoot != null && _jsx("div", { className: "o-customize-foot-rows", children: columnsFoot })] }));
|
|
283
285
|
const backFromColumn = () => { setBack(true); setFocusTo(col?.label ?? null); setColumn(null); setChoosing(null); };
|
|
284
|
-
const columnLevel = col && (_jsxs(_Fragment, { children: [ownSettings(col.settings ?? { choices: [], toggles: [] }, col.label, col.locked ? [] : [{ kind: "check", label: w.columnShown, checked: held[col.id] ?? col.shown, onCheckedChange: (on) => press([col.id], on) }], { list: w.columnSettings(col.label) }), col.rows != null && _jsxs("div", { className: "o-customize-rows", children: [(!col.locked || columnOpensBySettings(col)) && _jsx("div", { role: "separator", className: "o-list-sep" }), col.rows] })] }));
|
|
286
|
+
const columnLevel = col && (_jsxs(_Fragment, { children: [ownSettings(col.settings ?? { choices: [], toggles: [] }, col.label, col.locked ? [] : [{ kind: "check", label: w.columnShown, checked: held[col.id] ?? col.shown, onCheckedChange: (on) => press([col.id], on), ...part("vk-customize-toggle", "shown") }], { list: w.columnSettings(col.label) }), col.rows != null && _jsxs("div", { className: "o-customize-rows", children: [(!col.locked || columnOpensBySettings(col)) && _jsx("div", { role: "separator", className: "o-list-sep" }), col.rows] })] }));
|
|
285
287
|
const rowsOfField = (label, rows) => (phone
|
|
286
288
|
? _jsx(MenuList, { label: label, entries: rows, words: w.rows }) : _jsx(MenuListPanelRows, { label: label, entries: rows, ticks: "box", words: w.rows }));
|
|
287
289
|
const fieldScreen = field && (() => {
|
|
288
290
|
const o = field.opens;
|
|
289
291
|
if ("pick" in o)
|
|
290
292
|
return o.pick.choices.length === 0 ? _jsx("p", { className: "o-customize-none", children: w.nothingToPick })
|
|
291
|
-
: rowsOfField(field.label, [{ kind: "pick", value: o.pick.value, choices: o.pick.choices, onChoose: (v) => { if (v !== o.pick.value)
|
|
293
|
+
: rowsOfField(field.label, [{ kind: "pick", value: o.pick.value, choices: o.pick.choices.map((c) => ({ ...c, ...part("vk-customize-option", c.value) })), onChoose: (v) => { if (v !== o.pick.value)
|
|
292
294
|
o.pick.onChoose(v); backFromField(); } }]);
|
|
293
295
|
if ("check" in o)
|
|
294
296
|
return o.check.choices.length === 0 ? _jsx("p", { className: "o-customize-none", children: w.nothingToPick })
|
|
295
|
-
: rowsOfField(field.label, o.check.choices.map((c) => ({ kind: "check", label: c.label, ...(c.mark != null && { icon: c.mark }), checked: o.check.values.includes(c.value),
|
|
297
|
+
: rowsOfField(field.label, o.check.choices.map((c) => ({ kind: "check", label: c.label, ...(c.mark != null && { icon: c.mark }), ...part("vk-customize-option", c.value), checked: o.check.values.includes(c.value),
|
|
296
298
|
onCheckedChange: (on) => o.check.onChange(on ? [...o.check.values, c.value] : o.check.values.filter((v) => v !== c.value)) })));
|
|
297
299
|
return typeof o.body === "function" ? o.body(backFromField) : o.body;
|
|
298
300
|
})();
|
|
@@ -312,15 +314,15 @@ export function useCustomize(props) {
|
|
|
312
314
|
const titled = !named;
|
|
313
315
|
const step = choice ? (col ? `columns:${col.id}:${choice.key}` : `layout:${choice.key}`) : col ? `columns:${col.id}` : field ? `field:${field.key}` : screen;
|
|
314
316
|
if (phone) {
|
|
315
|
-
const body = (_jsx("div", { ref: placeRoot, className: "o-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(SheetStep, { step: step, back: back, children: _jsx("div", { className: "o-customize-step", children: content }) }) }));
|
|
316
|
-
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : undefined;
|
|
317
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(SheetStep, { step: step, back: back, children: _jsx("div", { className: "o-customize-step", children: content }) }) }));
|
|
318
|
+
const foot = screen === "list" && (changed || footer.length) ? (_jsxs("div", { className: "o-customize-foot", "data-slot": "vk-customize-foot", ...MENU_LIST_CARD_FRAME, children: [changed && words("44"), footer.length > 0 && _jsx(MenuList, { label: w.share, entries: footer, words: w.rows })] })) : undefined;
|
|
317
319
|
return { body, title: name, head: screen === "list" ? { close: true } : { onBack: backTo, close: titled }, foot, level };
|
|
318
320
|
}
|
|
319
321
|
const title = (words) => (inPane ? _jsx(PaneTitle, { children: words }) : _jsx("h2", { className: "o-pane-title", children: words }));
|
|
320
|
-
const xButton = (extra) => _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "aria-label": w.close, icon: _jsx(Icon, { name: "x" }), ...extra });
|
|
322
|
+
const xButton = (extra) => _jsx(Button, { kind: "quiet", shape: "icon", size: "sm", "data-slot": "vk-customize-close", "aria-label": w.close, icon: _jsx(Icon, { name: "x" }), ...extra });
|
|
321
323
|
const close = inPane ? _jsx(PaneClose, { render: xButton() }) : onClose ? xButton({ onClick: onClose }) : null;
|
|
322
|
-
const head = screen !== "list" ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-screen", children: [_jsx(Button, { ref: backButton, kind: "quiet", shape: "icon", size: "sm", "aria-label": w.back, icon: _jsx(Icon, { name: "left" }), onClick: backTo }), _jsx("span", { className: "o-customize-title", children: title(name) }), titled && close] })) : titled ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-title", children: [_jsx("span", { className: "o-customize-title", children: title(w.title) }), close] })) : (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-name", children: [hasLayout && _jsx(Button, { kind: "outline", shape: "icon", size: "sm", "aria-label": w.layoutButton(layout?.name ?? ""), icon: layout?.mark, onClick: () => go("layout") }), _jsx(ViewName, { name: view.name, label: w.viewName, onRename: (n) => change({ ...latest.view, name: n }) })] }));
|
|
323
|
-
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), footer.length > 0 && _jsx(PaneFoot, { children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
324
|
+
const head = screen !== "list" ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-screen", "data-slot": "vk-customize-head", children: [_jsx(Button, { ref: backButton, kind: "quiet", shape: "icon", size: "sm", "data-slot": "vk-customize-back", "aria-label": w.back, icon: _jsx(Icon, { name: "left" }), onClick: backTo }), _jsx("span", { className: "o-customize-title", "data-slot": "vk-customize-title", children: title(name) }), titled && close] })) : titled ? (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-title", "data-slot": "vk-customize-head", children: [_jsx("span", { className: "o-customize-title", "data-slot": "vk-customize-title", children: title(w.title) }), close] })) : (_jsxs(PaneHead, { className: "o-customize-head o-customize-head-name", "data-slot": "vk-customize-head", children: [hasLayout && _jsx(Button, { kind: "outline", shape: "icon", size: "sm", "data-slot": "vk-customize-layout-button", "aria-label": w.layoutButton(layout?.name ?? ""), icon: layout?.mark, onClick: () => go("layout") }), _jsx(ViewName, { name: view.name, label: w.viewName, onRename: (n) => change({ ...latest.view, name: n }) })] }));
|
|
325
|
+
const parts = (_jsxs(_Fragment, { children: [head, screen === "columns" && !col && columnsSearch, _jsx(PaneBody, { children: _jsx("div", { ref: placeRoot, className: "o-customize", "data-slot": "vk-customize", "data-kit": "customize", "data-customize-form": form, "data-customize-screen": screen, ...phoneMark(!!host || small), ...MENU_LIST_CARD_FRAME, children: _jsx(React.Fragment, { children: content }, step) }) }), screen === "list" && changed && words("xs"), footer.length > 0 && _jsx(PaneFoot, { "data-slot": "vk-customize-foot", children: _jsx(MenuListPanelRows, { label: w.share, entries: footer, words: w.rows }) })] }));
|
|
324
326
|
return { body: inPane ? parts : _jsx("div", { className: "o-customize-frame", children: parts }), title: name, head: {}, level };
|
|
325
327
|
}
|
|
326
328
|
function ViewName({ name, label, onRename }) {
|
|
@@ -332,7 +334,7 @@ function ViewName({ name, label, onRename }) {
|
|
|
332
334
|
onRename(n);
|
|
333
335
|
else
|
|
334
336
|
setDraft(name); };
|
|
335
|
-
return (_jsx("span", { className: "o-customize-name", children: _jsx(Input, { size: "sm", "aria-label": label, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: keep, onKeyDown: (e) => {
|
|
337
|
+
return (_jsx("span", { className: "o-customize-name", children: _jsx(Input, { size: "sm", "data-slot": "vk-customize-name", "aria-label": label, value: draft, onChange: (e) => setDraft(e.target.value), onBlur: keep, onKeyDown: (e) => {
|
|
336
338
|
if (e.key === "Enter") {
|
|
337
339
|
e.preventDefault();
|
|
338
340
|
keep();
|
|
@@ -12,4 +12,6 @@ export declare function customizeWordsOf(say: ViewsMessageResolver): CustomizeWo
|
|
|
12
12
|
* refused one writes nothing) and its columns that differs. Columns, one or several shown or hidden (Hide all, Show all) or moved,
|
|
13
13
|
* through ViewKit's own, in one change. */
|
|
14
14
|
export declare function customizeWriteOf(p: ViewsCustomizeBodyProps, own: CustomizeBodyOwn, now: CustomizeView, next: CustomizeView): (() => void) | null;
|
|
15
|
+
/** ViewKit's Customize, its sort and filter drawing the app's controls where the provider's `panelControls` names them
|
|
16
|
+
* (VK-1013); Customize's own controls stay ViewKit's for now (VK-1014). */
|
|
15
17
|
export declare function MapCustomizeBody(props: ViewsCustomizeBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,6 +17,7 @@ import { SheetPartsFrom } from "../sheet/sheet-parts.js";
|
|
|
17
17
|
import { sortEditorPropsOf, sortEditorWordsOf } from "../sort-editor/map-sort-body.js";
|
|
18
18
|
import { sortLabel } from "../sort-editor/rules.js";
|
|
19
19
|
import { useSortEditor } from "../sort-editor/sort-editor.js";
|
|
20
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
20
21
|
import { layoutMark, useCustomize } from "./customize.js";
|
|
21
22
|
import { DateRangeBody, useTimeRange } from "./map-ranges.js";
|
|
22
23
|
const BACK = ["M5 12l14 0", "M5 12l6 6", "M5 12l6 -6"];
|
|
@@ -113,6 +114,9 @@ const NO_GROUP = { label: "", dimensions: [], group: { value: "none" }, manualOr
|
|
|
113
114
|
const stay = () => undefined;
|
|
114
115
|
const levelOf = (parts) => parts.title !== undefined && parts.head.onBack ? { name: parts.title, back: parts.head.onBack } : null;
|
|
115
116
|
export function MapCustomizeBody(props) {
|
|
117
|
+
return _jsx(PanelControlsFromViews, { children: _jsx(CustomizeBodyInner, { ...props }) });
|
|
118
|
+
}
|
|
119
|
+
function CustomizeBodyInner(props) {
|
|
116
120
|
const { name, onRename, exportCount, onCopyLink, onExport, ...p } = props;
|
|
117
121
|
const views = React.useContext(ViewsContext);
|
|
118
122
|
const say = views?.messages ?? resolveViewsMessage;
|
|
@@ -142,7 +146,7 @@ export function MapCustomizeBody(props) {
|
|
|
142
146
|
const shared = p.view, kit = p.foot === "kit";
|
|
143
147
|
const foot = shared ? (shared.changes > 0 && p.foot !== "none" ? {
|
|
144
148
|
changed: true, onReset: shared.onReset, ...(shared.canPublish && { onSave: shared.onPublish }), pending: shared.pending, stale: shared.stale,
|
|
145
|
-
words: { reset: say({ key: kit ? "views.panels.view-clear" : "views.panels.view-reset" }), save: say({ key: kit ? "views.panels.view-save" : "views.panels.view-publish" }) },
|
|
149
|
+
words: { reset: say({ key: kit ? "views.panels.view-clear" : "views.panels.view-reset" }), save: say({ key: kit ? "views.panels.view-save" : shared.own ? "views.panels.view-save-own" : "views.panels.view-publish" }) },
|
|
146
150
|
} : {}) : p.onClear && p.foot !== "none" ? { changed: true, onReset: p.onClear, words: { reset: say({ key: "views.panels.view-clear" }) } } : {};
|
|
147
151
|
const { words: footWords, ...footProps } = foot;
|
|
148
152
|
const timeField = p.fields?.items.find((f) => f.time);
|
|
@@ -16,9 +16,9 @@ export function DateDays({ year, month, keyDay, picked, today, names, weekdays,
|
|
|
16
16
|
};
|
|
17
17
|
React.useEffect(() => { if (moved.current) {
|
|
18
18
|
moved.current = false;
|
|
19
|
-
grid.current?.querySelector("[data-
|
|
19
|
+
grid.current?.querySelector("[data-stop]")?.focus({ preventScroll: true });
|
|
20
20
|
} }, [keyDay]);
|
|
21
21
|
const cells = monthGrid(year, month);
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-date-editor-weekdays", "aria-hidden": "true", children: weekdays.map((d, i) => _jsx("span", { children: d }, i)) }), _jsx("div", { ref: grid, role: "grid", "aria-label": `${names.months[month]} ${year}`, className: big ? "o-date-editor-days o-date-editor-days-phone" : "o-date-editor-days", onKeyDown: step, children: [0, 1, 2, 3, 4, 5].map((r) => (_jsx("div", { role: "row", className: "o-date-editor-week", children: cells.slice(r * 7, r * 7 + 7).map((day, i) => (_jsx("div", { role: "gridcell", "aria-selected": day && day === picked ? true : undefined, className: "o-date-editor-cell", children: day && _jsx("button", { type: "button", "aria-label": lineText(day, names), className: "o-date-editor-day", tabIndex: day === keyDay ? 0 : -1, disabled: off?.(day) || undefined, "data-today": day === today ? "" : undefined, "data-
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "o-date-editor-weekdays", "data-slot": "vk-date-weekdays", "aria-hidden": "true", children: weekdays.map((d, i) => _jsx("span", { children: d }, i)) }), _jsx("div", { ref: grid, role: "grid", "aria-label": `${names.months[month]} ${year}`, className: big ? "o-date-editor-days o-date-editor-days-phone" : "o-date-editor-days", "data-slot": "vk-date-days", onKeyDown: step, children: [0, 1, 2, 3, 4, 5].map((r) => (_jsx("div", { role: "row", className: "o-date-editor-week", children: cells.slice(r * 7, r * 7 + 7).map((day, i) => (_jsx("div", { role: "gridcell", "aria-selected": day && day === picked ? true : undefined, className: "o-date-editor-cell", children: day && _jsx("button", { type: "button", "aria-label": lineText(day, names), className: "o-date-editor-day", "data-slot": "vk-date-day", tabIndex: day === keyDay ? 0 : -1, disabled: off?.(day) || undefined, "data-today": day === today ? "" : undefined, "data-stop": day === keyDay ? "" : undefined, "data-picked": day === picked ? "" : undefined, "data-reads": reads && day === reads ? "" : undefined, onKeyDown: (e) => { if (e.key !== "Enter")
|
|
23
23
|
return; e.preventDefault(); (onEnter ?? onPick)(day); }, onClick: () => onPick(day), children: Number(day.slice(8)) }) }, i))) }, r))) })] }));
|
|
24
24
|
}
|
|
@@ -187,26 +187,26 @@ export function useDateEditor(props) {
|
|
|
187
187
|
const dayGrid = (big, weekdays) => (_jsx(DateDays, { year: sy, month: sm, keyDay: shownKey, picked: date, today: today, names: names, weekdays: weekdays, big: big, off: off, reads: reading && "date" in reading ? reading.date : null, onPick: pick, onKeyMove: setKey, onEnter: (day) => { pick(day); if (phone || time)
|
|
188
188
|
keep(day, clock); } }));
|
|
189
189
|
const row = phone ? worn.calendar === "plain" : worn.picks === "row";
|
|
190
|
-
const quick = (_jsx("div", { className: "o-date-editor-picks", children: picks.map((p) => (_jsx(Button, { kind: "quiet", size: phone ? "lg" : row ? "2xs" : "sm", className: "o-date-editor-pick", look: phone ? (row ? PICK_PLAIN : PICK_CARDS) : row ? PICK_ROW : PICK_TWO, icon: glyph(row ? ROW_PICKS[p] : PICKS[p].icon), onClick: () => pick(p === "none" ? null : quickPick(p, today)), children: w[PICK_WORD[p]] }, p))) }));
|
|
190
|
+
const quick = (_jsx("div", { className: "o-date-editor-picks", "data-slot": "vk-date-picks", children: picks.map((p) => (_jsx(Button, { kind: "quiet", size: phone ? "lg" : row ? "2xs" : "sm", className: "o-date-editor-pick", "data-slot": "vk-date-pick", "data-key": p, look: phone ? (row ? PICK_PLAIN : PICK_CARDS) : row ? PICK_ROW : PICK_TWO, icon: glyph(row ? ROW_PICKS[p] : PICKS[p].icon), onClick: () => pick(p === "none" ? null : quickPick(p, today)), children: w[PICK_WORD[p]] }, p))) }));
|
|
191
191
|
if (phone) {
|
|
192
192
|
const months = names.months.map((name, i) => ({ value: String(i), label: name }));
|
|
193
193
|
const years = Array.from({ length: 41 }, (_, i) => String(sy - 20 + i)).map((v) => ({ value: v, label: v }));
|
|
194
194
|
const hours = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")).map((v) => ({ value: v, label: v }));
|
|
195
195
|
const mins = ["00", "15", "30", "45"].map((v) => ({ value: v, label: v }));
|
|
196
196
|
const [hh, mm] = (clock ?? "09:00").split(":");
|
|
197
|
-
const head = { left: _jsx(SheetButton, { "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { if (take())
|
|
197
|
+
const head = { left: _jsx(SheetButton, { "data-slot": "vk-editor-close", "aria-label": w.close, icon: glyph(X), onClick: leave }), right: _jsx(SheetButton, { "data-slot": "vk-editor-save", kind: "primary", "aria-label": w.save, icon: glyph(TICK), onClick: () => { if (take())
|
|
198
198
|
keep(dayOfLine(), clock); } }) };
|
|
199
|
-
const wheels = wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : null;
|
|
199
|
+
const wheels = wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "month", label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "hour", label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { name: "minute", label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : null;
|
|
200
200
|
if (worn.calendar === "plain") {
|
|
201
201
|
const toggle = (w) => { if (w === "time" && !clock)
|
|
202
202
|
setTime("09:00"); setWheel(wheel === w ? "none" : w); };
|
|
203
|
-
const plain = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs(InputGroup, { size: "lg", className: "o-date-editor-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: line, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", enterKeyHint: "done", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (e.key !== "Enter" || e.nativeEvent.isComposing)
|
|
203
|
+
const plain = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs(InputGroup, { size: "lg", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: line, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", enterKeyHint: "done", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (e.key !== "Enter" || e.nativeEvent.isComposing)
|
|
204
204
|
return; e.preventDefault(); if (take())
|
|
205
|
-
keep(dayOfLine(), clock); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", children: lineText(reading.date, names) }) })] }), error && _jsx("p", { className: "o-date-editor-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", look: PLAIN_HEADING, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: names.months[sm] }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-year", look: PLAIN_YEAR, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: String(sy) })] }), wheels ?? _jsx(_Fragment, { children: dayGrid(true, names.week) }), time && _jsx(DateParts, { form: "phone", words: w, onEnter: () => { if (take())
|
|
205
|
+
keep(dayOfLine(), clock); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: PLAIN_HEADING, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: names.months[sm] }), _jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-year", "data-slot": "vk-date-year", look: PLAIN_YEAR, "aria-expanded": wheel === "date", onClick: () => toggle("date"), children: String(sy) })] }), wheels ?? _jsx(_Fragment, { children: dayGrid(true, names.week) }), time && _jsx(DateParts, { form: "phone", words: w, onEnter: () => { if (take())
|
|
206
206
|
keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, wheel: wheel, onWheel: toggle, onDate: (d) => { setDate(d); setKey(d); hand(d, clock); }, onClock: setTime }), quick] }));
|
|
207
207
|
return { body: plain, head: shell ? {} : head };
|
|
208
208
|
}
|
|
209
|
-
const body = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs("div", { className: "o-date-editor-card", children: [_jsxs("div", { className: "o-date-editor-card-head", children: [_jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", look: CARD_HEADING, "aria-expanded": wheel === "date", iconEnd: glyph(wheel === "date" ? DOWN : RIGHT), onClick: () => setWheel(wheel === "date" ? "none" : "date"), children: `${names.months[sm]} ${sy}` }), wheel !== "date" && _jsxs("span", { className: "o-date-editor-arrows", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) })] })] }), wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : (_jsx(_Fragment, { children: dayGrid(true, names.weekUpper) }))] }), time && (_jsx("div", { className: "o-date-editor-card", children: wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", children: [_jsx(Wheel, { label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : (_jsx(MenuListRow, { label: w.time, value: clock ?? w.addTime, onSelect: () => { if (!clock)
|
|
209
|
+
const body = (_jsxs("div", { ref: placeRoot, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "phone", ...phoneMark(!!host || small), ...wornAttrs(worn), children: [_jsxs("div", { className: "o-date-editor-card", "data-slot": "vk-date-card", "data-key": "date", children: [_jsxs("div", { className: "o-date-editor-card-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", size: "lg", className: "o-date-editor-heading", "data-slot": "vk-date-month", look: CARD_HEADING, "aria-expanded": wheel === "date", iconEnd: glyph(wheel === "date" ? DOWN : RIGHT), onClick: () => setWheel(wheel === "date" ? "none" : "date"), children: `${names.months[sm]} ${sy}` }), wheel !== "date" && _jsxs("span", { className: "o-date-editor-arrows", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => setKey(addMonths(shownKey, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: "lg", "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => setKey(addMonths(shownKey, 1)) })] })] }), wheel === "date" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "month", label: w.month, items: months, value: String(sm), onChange: (v) => setKey(addMonths(shownKey, Number(v) - sm)) }, "month"), _jsx(Wheel, { name: "year", label: w.year, items: years, value: String(sy), onChange: (v) => setKey(addMonths(shownKey, (Number(v) - sy) * 12)) }, "year")] })) : (_jsx(_Fragment, { children: dayGrid(true, names.weekUpper) }))] }), time && (_jsx("div", { className: "o-date-editor-card", "data-slot": "vk-date-card", "data-key": "time", children: wheel === "time" ? (_jsxs("div", { className: "o-date-editor-wheels", "data-slot": "vk-date-wheels", children: [_jsx(Wheel, { name: "hour", label: w.hour, items: hours, value: hh, onChange: (v) => setTime(`${v}:${mm}`) }, "hour"), _jsx(Wheel, { name: "minute", label: w.minute, items: mins, value: mm, onChange: (v) => setTime(`${hh}:${v}`) }, "minute")] })) : (_jsx(MenuListRow, { "data-slot": "vk-date-time", label: w.time, value: clock ?? w.addTime, onSelect: () => { if (!clock)
|
|
210
210
|
setTime("09:00"); setWheel("time"); } })) })), quick] }));
|
|
211
211
|
return { body, head: shell ? {} : head };
|
|
212
212
|
}
|
|
@@ -239,17 +239,17 @@ export function useDateEditor(props) {
|
|
|
239
239
|
el.focus({ preventScroll: true });
|
|
240
240
|
el.select();
|
|
241
241
|
} };
|
|
242
|
-
const timeButton = _jsx(Button, { kind: "quiet", size: lineBox ? "2xs" : "xs", className: "o-date-editor-time", look: TIME, "aria-pressed": view === "time", "data-empty": clock ? undefined : "", icon: glyph(CLOCK), onClick: () => setView(view === "time" ? "days" : "time"), children: clock ?? w.addTime });
|
|
243
|
-
const boxLine = (_jsxs(InputGroup, { size: "sm", className: "o-date-editor-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (blank(typed) && (e.key === "Backspace" || e.key === "Delete")) {
|
|
242
|
+
const timeButton = _jsx(Button, { kind: "quiet", size: lineBox ? "2xs" : "xs", className: "o-date-editor-time", "data-slot": "vk-date-time", look: TIME, "aria-pressed": view === "time", "data-empty": clock ? undefined : "", icon: glyph(CLOCK), onClick: () => setView(view === "time" ? "days" : "time"), children: clock ?? w.addTime });
|
|
243
|
+
const boxLine = (_jsxs(InputGroup, { size: "sm", className: "o-date-editor-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [_jsx(Input, { ref: lineRef, className: "o-date-editor-input", "aria-label": label, placeholder: `${w.type}…`, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? "", onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onKeyDown: (e) => { if (blank(typed) && (e.key === "Backspace" || e.key === "Delete")) {
|
|
244
244
|
e.preventDefault();
|
|
245
245
|
return;
|
|
246
|
-
} lineKeys(e); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", children: lineText(reading.date, names) }) }), time && !inParts && _jsx(InputGroupAddon, { side: "end", flush: true, children: timeButton })] }));
|
|
246
|
+
} lineKeys(e); } }), reading && "date" in reading && _jsx(InputGroupAddon, { side: "end", children: _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }) }), time && !inParts && _jsx(InputGroupAddon, { side: "end", flush: true, children: timeButton })] }));
|
|
247
247
|
const refocus = (sel) => requestAnimationFrame(() => root.current?.querySelector(sel)?.focus({ preventScroll: true }));
|
|
248
|
-
const body = (_jsxs("div", { ref: rootRef, className: "o-date-editor", "data-kit": "date-editor", "data-date-form": "computer", ...phoneMark(!!host || small), ...wornAttrs(worn), onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: shell ? undefined : (e) => { if (e.key === "Escape") {
|
|
248
|
+
const body = (_jsxs("div", { ref: rootRef, className: "o-date-editor", "data-slot": "vk-date", "data-kit": "date-editor", "data-date-form": "computer", ...phoneMark(!!host || small), ...wornAttrs(worn), onBlur: onBlur, onFocus: () => { settled.current = false; }, onKeyDown: shell ? undefined : (e) => { if (e.key === "Escape") {
|
|
249
249
|
e.preventDefault();
|
|
250
250
|
e.stopPropagation();
|
|
251
251
|
escape();
|
|
252
|
-
} }, children: [lineBox ? boxLine : _jsxs("div", { className: "o-date-editor-line o-popup-line", "data-bad": error ? "" : undefined, children: [glyph(CAL), _jsx(Input, { chrome: "bare", ref: (el) => { line.current = el; first(el); }, className: "o-date-editor-input", "aria-label": label, placeholder: w.type, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? (date ? lineText(date, names) : ""), onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onBeforeInput: (e) => { if (typed == null) {
|
|
252
|
+
} }, children: [lineBox ? boxLine : _jsxs("div", { className: "o-date-editor-line o-popup-line", "data-slot": "vk-date-line", "data-bad": error ? "" : undefined, children: [glyph(CAL), _jsx(Input, { chrome: "bare", ref: (el) => { line.current = el; first(el); }, className: "o-date-editor-input", "aria-label": label, placeholder: w.type, autofill: false, spellCheck: false, "aria-invalid": error ? true : undefined, value: typed ?? (date ? lineText(date, names) : ""), onChange: (e) => { setTyped(e.target.value); setError(null); handTyped(e.target.value); }, onBeforeInput: (e) => { if (typed == null) {
|
|
253
253
|
e.preventDefault();
|
|
254
254
|
const d = e.nativeEvent.data ?? "";
|
|
255
255
|
setTyped(d);
|
|
@@ -260,8 +260,8 @@ export function useDateEditor(props) {
|
|
|
260
260
|
setTyped("");
|
|
261
261
|
handTyped("");
|
|
262
262
|
return;
|
|
263
|
-
} lineKeys(e); } }), reading && "date" in reading && _jsx("span", { className: "o-date-editor-reads", children: lineText(reading.date, names) }), time && !inParts && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-date-editor-bar", "aria-hidden": "true" }), timeButton] })] }), error && _jsx("p", { className: "o-date-editor-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveMonth(-1) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveMonth(1) }), _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-month", look: STANDS_PRESSED, "aria-pressed": view === "months", onClick: () => setView(view === "months" ? "days" : "months"), children: names.months[sm] }), _jsx("span", { className: "o-date-editor-space" }), worn.year === "typed" && view === "years"
|
|
264
|
-
? _jsx(Input, { ref: yearRef, size: "xs", numeric: true, className: "o-date-editor-year-box", "aria-label": w.year, inputMode: "numeric", maxLength: 4, autofill: false, value: yearText ?? String(sy), onChange: (e) => { const t = e.target.value.replace(/\D/g, "").slice(0, 4), yr = yearTyped(t); setYearText(t); if (yr)
|
|
263
|
+
} lineKeys(e); } }), reading && "date" in reading && _jsx("span", { className: "o-date-editor-reads", "data-slot": "vk-date-reads", children: lineText(reading.date, names) }), time && !inParts && _jsxs(_Fragment, { children: [_jsx("span", { className: "o-date-editor-bar", "aria-hidden": "true" }), timeButton] })] }), error && _jsx("p", { className: "o-date-editor-error", "data-slot": "vk-date-error", role: "alert", children: error }), _jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveMonth(-1) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveMonth(1) }), _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-month", "data-slot": "vk-date-month", look: STANDS_PRESSED, "aria-pressed": view === "months", onClick: () => setView(view === "months" ? "days" : "months"), children: names.months[sm] }), _jsx("span", { className: "o-date-editor-space" }), worn.year === "typed" && view === "years"
|
|
264
|
+
? _jsx(Input, { ref: yearRef, size: "xs", numeric: true, className: "o-date-editor-year-box", "data-slot": "vk-date-year", "aria-label": w.year, inputMode: "numeric", maxLength: 4, autofill: false, value: yearText ?? String(sy), onChange: (e) => { const t = e.target.value.replace(/\D/g, "").slice(0, 4), yr = yearTyped(t); setYearText(t); if (yr)
|
|
265
265
|
setKey(addMonths(shownKey, (yr - sy) * 12)); }, onKeyDown: (e) => { if (e.key === "Enter") {
|
|
266
266
|
e.preventDefault();
|
|
267
267
|
leaveYear();
|
|
@@ -269,15 +269,15 @@ export function useDateEditor(props) {
|
|
|
269
269
|
setView("months");
|
|
270
270
|
refocus(".o-date-editor-choice[data-picked]");
|
|
271
271
|
} } })
|
|
272
|
-
: _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-year", look: STANDS_PRESSED, "aria-pressed": view === "years", onMouseDown: worn.year === "typed" ? hold : undefined, onClick: () => { if (view !== "years") {
|
|
272
|
+
: _jsx(Button, { kind: "quiet", size: "xs", className: "o-date-editor-year", "data-slot": "vk-date-year", look: STANDS_PRESSED, "aria-pressed": view === "years", onMouseDown: worn.year === "typed" ? hold : undefined, onClick: () => { if (view !== "years") {
|
|
273
273
|
setYearText(null);
|
|
274
274
|
yearFocus.current = worn.year === "typed";
|
|
275
|
-
} setView(view === "years" ? "days" : "years"); }, children: String(sy) })] }), (view === "days" || (inParts && view === "time")) && _jsx(_Fragment, { children: dayGrid(false, names.week) }), view === "months" && (_jsx("div", { className: "o-date-editor-choices", role: "group", "aria-label": w.months, children: names.monthsShort.map((name, i) => _jsx("button", { type: "button", className: "o-date-editor-choice", onMouseDown: hold, "data-picked": i === sm ? "" : undefined, onClick: () => { setKey(addMonths(shownKey, i - sm)); setView("days"); refocus(".o-date-editor-day[data-
|
|
275
|
+
} setView(view === "years" ? "days" : "years"); }, children: String(sy) })] }), (view === "days" || (inParts && view === "time")) && _jsx(_Fragment, { children: dayGrid(false, names.week) }), view === "months" && (_jsx("div", { className: "o-date-editor-choices", "data-slot": "vk-date-choices", "data-key": "months", role: "group", "aria-label": w.months, children: names.monthsShort.map((name, i) => _jsx("button", { type: "button", className: "o-date-editor-choice", "data-slot": "vk-date-choice", "data-key": String(i), onMouseDown: hold, "data-picked": i === sm ? "" : undefined, onClick: () => { setKey(addMonths(shownKey, i - sm)); setView("days"); refocus(".o-date-editor-day[data-stop]"); }, children: name }, i)) })), view === "years" && (_jsx("div", { className: "o-date-editor-choices", "data-slot": "vk-date-choices", "data-key": "years", role: "group", "aria-label": w.years, children: Array.from({ length: 12 }, (_, i) => sy - 5 + i).map((yr) => (_jsx("button", { type: "button", className: "o-date-editor-choice", "data-slot": "vk-date-choice", "data-key": String(yr), onMouseDown: hold, "data-picked": yr === sy ? "" : undefined, "data-today": yr === parts(today)[0] ? "" : undefined, onClick: () => { leaveYear(); setYearText(null); setKey(addMonths(shownKey, (yr - sy) * 12)); setView("months"); refocus(".o-date-editor-choice[data-picked]"); }, children: yr }, yr))) })), view === "time" && !inParts && (_jsx("div", { className: "o-date-editor-quarters", "data-slot": "vk-date-quarters", role: "group", "aria-label": w.time, children: QUARTERS.map((q) => _jsx("button", { type: "button", className: "o-date-editor-quarter", "data-slot": "vk-date-quarter", "data-key": q, onMouseDown: hold, "data-picked": q === clock ? "" : undefined, ref: q === (clock ?? "09:00") ? (el) => { if (el)
|
|
276
276
|
scrollInList(el, { block: "center" }); } : undefined, onClick: () => { setTime(q); setView("days"); refocus(".o-date-editor-time"); }, children: q }, q)) })), inParts && _jsx(DateParts, { form: "computer", words: w, onEnter: () => { if (take())
|
|
277
|
-
keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, shownTyping: props.opens === "time", onDate: (d) => { setDate(d); setKey(d); setTyped(null); setError(null); hand(d, clock); }, onClock: setTime }), worn.picks === "two" && _jsx("div", { className: "o-date-editor-sep" }), quick] }));
|
|
277
|
+
keep(dayOfLine(), clock); }, date: date, clock: clock, today: today, shownTyping: props.opens === "time", onDate: (d) => { setDate(d); setKey(d); setTyped(null); setError(null); hand(d, clock); }, onClock: setTime }), worn.picks === "two" && _jsx("div", { className: "o-date-editor-sep", "data-slot": "vk-date-sep" }), quick] }));
|
|
278
278
|
return { body, head: {} };
|
|
279
279
|
}
|
|
280
|
-
function Wheel({ label, items, value, onChange }) {
|
|
280
|
+
function Wheel({ name, label, items, value, onChange }) {
|
|
281
281
|
const col = React.useRef(null), timer = React.useRef(0);
|
|
282
282
|
const at = Math.max(0, items.findIndex((i) => i.value === value));
|
|
283
283
|
React.useLayoutEffect(() => { const el = col.current; if (el)
|
|
@@ -293,7 +293,7 @@ function Wheel({ label, items, value, onChange }) {
|
|
|
293
293
|
onChange(items[i].value);
|
|
294
294
|
}, 120);
|
|
295
295
|
};
|
|
296
|
-
return (_jsx("div", { ref: col, className: "o-date-editor-wheel", role: "listbox", "aria-label": label, tabIndex: 0, onScroll: settle, children: items.map((it) => _jsx("div", { role: "option", "aria-selected": it.value === value, className: cx("o-date-editor-wheel-row", it.value === value && "o-date-editor-wheel-on"), onClick: (e) => { scrollInList(e.currentTarget, { block: "center", behavior: "smooth" }); onChange(it.value); }, children: it.label }, it.value)) }));
|
|
296
|
+
return (_jsx("div", { ref: col, className: "o-date-editor-wheel", "data-slot": "vk-date-wheel", "data-key": name, role: "listbox", "aria-label": label, tabIndex: 0, onScroll: settle, children: items.map((it) => _jsx("div", { role: "option", "data-slot": "vk-date-wheel-row", "data-key": it.value, "aria-selected": it.value === value, className: cx("o-date-editor-wheel-row", it.value === value && "o-date-editor-wheel-on"), onClick: (e) => { scrollInList(e.currentTarget, { block: "center", behavior: "smooth" }); onChange(it.value); }, children: it.label }, it.value)) }));
|
|
297
297
|
}
|
|
298
298
|
export function DateEditor(props) {
|
|
299
299
|
return _jsx(_Fragment, { children: useDateEditor(props).body });
|
|
@@ -87,15 +87,15 @@ export function DateParts({ date, clock, today, form, onDate, onClock, shownTypi
|
|
|
87
87
|
const slash = (c) => _jsx("span", { className: "o-date-editor-slash", "aria-hidden": "true", children: c });
|
|
88
88
|
const joined = (list, c, each) => list.flatMap((s, i) => (i ? [_jsx(React.Fragment, { children: slash(c) }, `${s}-sep`), _jsx(React.Fragment, { children: each(s) }, s)] : [_jsx(React.Fragment, { children: each(s) }, s)]));
|
|
89
89
|
if (form === "phone") {
|
|
90
|
-
const shown = (s) => _jsx("span", { className: "o-date-editor-seg", "data-waiting": segs[s] == null ? "" : undefined, children: segmentText(s, segs[s]) });
|
|
91
|
-
const box = (which, list, c) => (_jsx(Select, { opens: "dialog", size: "lg", arrow: "none", "aria-label": which === "date" ? w.date : w.time, className: "o-date-editor-part", shown: _jsx("span", { className: "o-date-editor-shown", children: joined(list, c, shown) }), open: wheel === which, onOpenChange: (o) => { if (o !== (wheel === which))
|
|
90
|
+
const shown = (s) => _jsx("span", { className: "o-date-editor-seg", "data-slot": "vk-date-segment", "data-key": s, "data-waiting": segs[s] == null ? "" : undefined, children: segmentText(s, segs[s]) });
|
|
91
|
+
const box = (which, list, c) => (_jsx(Select, { opens: "dialog", size: "lg", arrow: "none", "aria-label": which === "date" ? w.date : w.time, className: "o-date-editor-part", "data-slot": "vk-date-part", "data-key": which, shown: _jsx("span", { className: "o-date-editor-shown", children: joined(list, c, shown) }), open: wheel === which, onOpenChange: (o) => { if (o !== (wheel === which))
|
|
92
92
|
onWheel?.(which); } }));
|
|
93
|
-
return _jsxs("div", { className: "o-date-editor-parts", children: [box("date", DATE, "/"), box("time", TIME, ":")] });
|
|
93
|
+
return _jsxs("div", { className: "o-date-editor-parts", "data-slot": "vk-date-parts", children: [box("date", DATE, "/"), box("time", TIME, ":")] });
|
|
94
94
|
}
|
|
95
95
|
const seg = (s) => {
|
|
96
96
|
const [min, max] = segmentRange(s, segs), v = segs[s];
|
|
97
|
-
return (_jsx(InputGroupSegment, { "data-seg": s, className: "o-date-editor-seg", "aria-label": NAMES[s], "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": v ?? undefined, "aria-valuetext": segmentText(s, v), on: on === s || (shownTyping && s === "hour"), "data-waiting": v == null && !(shownTyped.seg === s && shownTyped.text) ? "" : undefined, onKeyDown: keys(s), onFocus: () => setOn(s), onBlur: () => { setOn(null); setTyped({ seg: null, text: "" }); }, children: shownTyped.seg === s && shownTyped.text && v == null ? shownTyped.text : segmentText(s, v) }));
|
|
97
|
+
return (_jsx(InputGroupSegment, { "data-seg": s, "data-slot": "vk-date-segment", "data-key": s, className: "o-date-editor-seg", "aria-label": NAMES[s], "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": v ?? undefined, "aria-valuetext": segmentText(s, v), on: on === s || (shownTyping && s === "hour"), "data-waiting": v == null && !(shownTyped.seg === s && shownTyped.text) ? "" : undefined, onKeyDown: keys(s), onFocus: () => setOn(s), onBlur: () => { setOn(null); setTyped({ seg: null, text: "" }); }, children: shownTyped.seg === s && shownTyped.text && v == null ? shownTyped.text : segmentText(s, v) }));
|
|
98
98
|
};
|
|
99
|
-
const box = (which, list, c) => (_jsx(InputGroup, { size: "sm", className: "o-date-editor-part", "aria-label": which === "Date" ? w.date : w.time, "data-force": shownTyping && which === "Time" ? "focus" : undefined, children: joined(list, c, seg) }));
|
|
100
|
-
return _jsxs("div", { ref: own, className: "o-date-editor-parts", children: [box("Date", DATE, "/"), box("Time", TIME, ":")] });
|
|
99
|
+
const box = (which, list, c) => (_jsx(InputGroup, { size: "sm", className: "o-date-editor-part", "data-slot": "vk-date-part", "data-key": which.toLowerCase(), "aria-label": which === "Date" ? w.date : w.time, "data-force": shownTyping && which === "Time" ? "focus" : undefined, children: joined(list, c, seg) }));
|
|
100
|
+
return _jsxs("div", { ref: own, className: "o-date-editor-parts", "data-slot": "vk-date-parts", children: [box("Date", DATE, "/"), box("Time", TIME, ":")] });
|
|
101
101
|
}
|
|
@@ -36,5 +36,5 @@ export function MapCalendar({ value, onChange, min, max, month, onMonthChange, c
|
|
|
36
36
|
const off = (day) => (min != null && day < min) || (max != null && day > max);
|
|
37
37
|
const [y, m] = parts(key);
|
|
38
38
|
const arrows = phone ? "lg" : worn.days === "outlined" ? "2xs" : "xs";
|
|
39
|
-
return (_jsxs("div", { ref: wornRef, className: cx("o-date-editor o-date-calendar", className), "data-kit": "date-editor", "data-date-form": phone ? "phone" : "computer", ...phoneMark(phone), "data-date-days": worn.days, "data-date-year": worn.year, "data-date-calendar": worn.calendar, children: [_jsxs("div", { className: "o-date-editor-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveTo(addMonths(key, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveTo(addMonths(key, 1)) }), _jsx("span", { className: "o-date-editor-caption", children: names.months[m] }), _jsx("span", { className: "o-date-editor-space" }), _jsx("span", { className: "o-date-editor-caption o-date-editor-year", children: String(y) })] }), _jsx(DateDays, { year: y, month: m, keyDay: key, picked: value, today: today, names: names, weekdays: phone && worn.calendar === "cards" ? names.weekUpper : names.week, big: phone, off: off, onPick: onChange, onKeyMove: moveTo })] }));
|
|
39
|
+
return (_jsxs("div", { ref: wornRef, className: cx("o-date-editor o-date-calendar", className), "data-slot": "vk-calendar", "data-kit": "date-editor", "data-date-form": phone ? "phone" : "computer", ...phoneMark(phone), "data-date-days": worn.days, "data-date-year": worn.year, "data-date-calendar": worn.calendar, children: [_jsxs("div", { className: "o-date-editor-head", "data-slot": "vk-date-head", children: [_jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-prev", "aria-label": w.lastMonth, icon: glyph(LEFT), onClick: () => moveTo(addMonths(key, -1)) }), _jsx(Button, { kind: "quiet", shape: "icon", size: arrows, "data-slot": "vk-date-next", "aria-label": w.nextMonth, icon: glyph(RIGHT), onClick: () => moveTo(addMonths(key, 1)) }), _jsx("span", { className: "o-date-editor-caption", "data-slot": "vk-date-month", children: names.months[m] }), _jsx("span", { className: "o-date-editor-space" }), _jsx("span", { className: "o-date-editor-caption o-date-editor-year", "data-slot": "vk-date-year", children: String(y) })] }), _jsx(DateDays, { year: y, month: m, keyDay: key, picked: value, today: today, names: names, weekdays: phone && worn.calendar === "cards" ? names.weekUpper : names.week, big: phone, off: off, onPick: onChange, onKeyMove: moveTo })] }));
|
|
40
40
|
}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
@media (hover: hover) { .o-date-editor-day:hover:not(:disabled) { background-color: var(--vk-overlay-hovered); } }
|
|
49
49
|
.o-date-editor-day[data-today] { color: var(--vk-fg-accent); font-weight: var(--vk-font-weight-semibold); }
|
|
50
|
-
.o-date-editor-day[data-
|
|
50
|
+
.o-date-editor-day[data-stop]:focus-visible { outline: none; box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 1.5) var(--vk-border-brand); }
|
|
51
51
|
.o-date-editor-day[data-picked] { background-color: var(--vk-brand); color: var(--vk-fg-on-brand); font-weight: var(--vk-font-weight-semibold); box-shadow: none; }
|
|
52
52
|
.o-date-editor-day:disabled { color: var(--vk-fg-disabled); cursor: not-allowed; }
|
|
53
53
|
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
}
|
|
104
104
|
.o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-day[data-picked],
|
|
105
105
|
.o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-choice[data-picked] { background-color: var(--vk-brand); font-weight: var(--vk-font-weight-medium); box-shadow: none; }
|
|
106
|
-
.o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-day[data-
|
|
106
|
+
.o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-day[data-stop]:focus-visible { box-shadow: inset 0 0 0 var(--vk-focus-width) var(--vk-border-brand); }
|
|
107
107
|
.o-date-editor[data-date-form="computer"][data-date-days="outlined"] .o-date-editor-choice[data-today] { font-weight: var(--vk-font-weight-normal); }
|
|
108
108
|
|
|
109
109
|
/* The year, typed into: the year in the text's colour; while its twelve stand, a box to type it in. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type FieldRowsCard } from "../../internal/field-rows.js";
|
|
2
3
|
import { type FieldRowsLook } from "./looks.js";
|
|
3
4
|
/** A field's error, or several: none, one (written as it is), or a list (each once). */
|
|
4
5
|
export type FieldError = React.ReactNode | React.ReactNode[];
|
|
@@ -34,11 +35,18 @@ export interface FieldProps {
|
|
|
34
35
|
/** Which form its quiet label takes: the device's unless said (the phone's below the app's line or in a PhoneHost screen).
|
|
35
36
|
* Its responsive layout and sizes are always the device's. */
|
|
36
37
|
form?: "computer" | "phone";
|
|
38
|
+
/** Its public name and which one it is (VK-989), drawn on the field's root in every form: a field editor's part. */
|
|
39
|
+
"data-slot"?: string;
|
|
40
|
+
"data-key"?: string;
|
|
37
41
|
className?: string;
|
|
38
42
|
children: React.ReactNode;
|
|
39
43
|
}
|
|
40
|
-
/** A field: its label, its control (an Input or InputGroup, a select, a tag field), and under it its note or its error.
|
|
41
|
-
|
|
44
|
+
/** A field: its label, its control (an Input or InputGroup, a select, a tag field), and under it its note or its error. Placed in
|
|
45
|
+
* Field rows (VK-960), it is the card's row instead: its label in the row's column, its control beside it (an Input or InputGroup
|
|
46
|
+
* typed in place, their save mark at the row's end), and its note and error under the card. Placed in a computer's SettingRows
|
|
47
|
+
* under its Fields option's At the end (VK-985), it is one of its setting rows: its label and note on the left, its control at the
|
|
48
|
+
* row's end. */
|
|
49
|
+
export declare function Field(props: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
42
50
|
export interface FieldSetProps {
|
|
43
51
|
/** What the group asks or holds, above it ("Who can see this deal", "Billing address"). */
|
|
44
52
|
legend: React.ReactNode;
|
|
@@ -72,9 +80,19 @@ export interface FieldRowsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
72
80
|
/** The look its place hands it, whole (an editor's look), winning over the frame's pick; left out, the frame's. */
|
|
73
81
|
look?: FieldRowsLook;
|
|
74
82
|
}
|
|
75
|
-
/** Field rows' card: fields that belong together, as rows of one card on a phone, or each its own card. Its rows are FieldRowsRows
|
|
76
|
-
* anything else stands in it as its place
|
|
83
|
+
/** Field rows' card: fields that belong together, as rows of one card on a phone, or each its own card. Its rows are FieldRowsRows,
|
|
84
|
+
* or Fields, each then the card's row (VK-960), their notes and errors under the card; anything else stands in it as its place
|
|
85
|
+
* puts it. */
|
|
77
86
|
export declare function FieldRows({ look, className, children, ...props }: FieldRowsProps): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
/** Field rows' card as its Fields see it, and the foot to draw after it: FieldRows', and a setting rows' card on a phone (VK-979).
|
|
88
|
+
* Its Fields in the order they came (VK-960), and those with a note or an error to show; while any has one, its foot stands
|
|
89
|
+
* after the card, the card first, so a foot coming or going never redraws the card or moves the focus in it. In the foot each
|
|
90
|
+
* such Field has its own place, in the order the Fields came (the rows' order, unless a row came later), whatever order their
|
|
91
|
+
* notes came in. The card is handed to its Fields through FieldRowsCardContext by the one that draws it. */
|
|
92
|
+
export declare function useFieldRowsCard(): {
|
|
93
|
+
card: FieldRowsCard;
|
|
94
|
+
foot: React.ReactNode;
|
|
95
|
+
};
|
|
78
96
|
export type FieldRowsRowProps = {
|
|
79
97
|
label?: React.ReactNode;
|
|
80
98
|
labelClassName?: string;
|