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
|
@@ -3,6 +3,7 @@ export const RADIO_TOKENS = [
|
|
|
3
3
|
{ name: "--vk-border-danger", kind: "colour", outright: "--border-danger" },
|
|
4
4
|
{ name: "--vk-border-input", kind: "colour", outright: "--border-input" },
|
|
5
5
|
{ name: "--vk-border-input-hovered", kind: "colour", outright: "--border-input-hovered" },
|
|
6
|
+
{ name: "--vk-border-overlay-card", kind: "colour", outright: "--border-overlay-card" },
|
|
6
7
|
{ name: "--vk-border-selected", kind: "colour", outright: "--border-selected" },
|
|
7
8
|
{ name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
|
|
8
9
|
{ name: "--vk-border-width", kind: "size", outright: "--border-width" },
|
|
@@ -19,19 +20,29 @@ export const RADIO_TOKENS = [
|
|
|
19
20
|
{ name: "--vk-fg-inverse", kind: "colour", outright: "--text-inverse" },
|
|
20
21
|
{ name: "--vk-fg-on-brand", kind: "colour", outright: "--text-brand-inverse" },
|
|
21
22
|
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
23
|
+
{ name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
|
|
22
24
|
{ name: "--vk-focus-offset", kind: "size", outright: "--focus-offset" },
|
|
23
25
|
{ name: "--vk-focus-width", kind: "size", outright: "--focus-width" },
|
|
26
|
+
{ name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
|
|
24
27
|
{ name: "--vk-font-weight-medium", kind: "size", outright: "--font-weight-medium" },
|
|
25
28
|
{ name: "--vk-font-weight-normal", kind: "size", outright: "--font-weight-normal" },
|
|
26
29
|
{ name: "--vk-ground", kind: "colour", outright: "--surface" },
|
|
27
30
|
{ name: "--vk-hovered", kind: "colour", outright: "--surface-hovered" },
|
|
28
31
|
{ name: "--vk-input", kind: "colour", outright: "--background-input" },
|
|
32
|
+
{ name: "--vk-line-height-base", kind: "size", outright: "--text-base--line-height" },
|
|
33
|
+
{ name: "--vk-label-amber", kind: "colour", outright: "--label-amber" },
|
|
29
34
|
{ name: "--vk-label-amber-fill", kind: "colour", outright: "--label-amber-fill" },
|
|
35
|
+
{ name: "--vk-label-blue", kind: "colour", outright: "--label-blue" },
|
|
30
36
|
{ name: "--vk-label-blue-fill", kind: "colour", outright: "--label-blue-fill" },
|
|
37
|
+
{ name: "--vk-label-green", kind: "colour", outright: "--label-green" },
|
|
31
38
|
{ name: "--vk-label-green-fill", kind: "colour", outright: "--label-green-fill" },
|
|
39
|
+
{ name: "--vk-label-pink", kind: "colour", outright: "--label-pink" },
|
|
32
40
|
{ name: "--vk-label-pink-fill", kind: "colour", outright: "--label-pink-fill" },
|
|
41
|
+
{ name: "--vk-label-purple", kind: "colour", outright: "--label-purple" },
|
|
33
42
|
{ name: "--vk-label-purple-fill", kind: "colour", outright: "--label-purple-fill" },
|
|
43
|
+
{ name: "--vk-label-red", kind: "colour", outright: "--label-red" },
|
|
34
44
|
{ name: "--vk-label-red-fill", kind: "colour", outright: "--label-red-fill" },
|
|
45
|
+
{ name: "--vk-label-teal", kind: "colour", outright: "--label-teal" },
|
|
35
46
|
{ name: "--vk-label-teal-fill", kind: "colour", outright: "--label-teal-fill" },
|
|
36
47
|
{ name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
|
|
37
48
|
{ name: "--vk-overlay-card", kind: "colour", outright: "--surface-overlay-card" },
|
|
@@ -149,5 +149,83 @@
|
|
|
149
149
|
.o-radio-tiles:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card.o-radio-marked { justify-content: center; min-height: calc(var(--vk-spacing) * 18); }
|
|
150
150
|
.o-radio-tiles:where([data-vk-phone], [data-vk-phone] *) > .o-radio-marked > .o-radio-mark > svg { width: calc(var(--vk-spacing) * 5.5); height: calc(var(--vk-spacing) * 5.5); }
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
/* ── On a phone, the swatches and the pictured cards (VK-955; the settings canvas, round 3, the iOS round: look-ios.mjs, .sws
|
|
153
|
+
and .pics): each row a card of its own, the overlay card's ground and corner, as the tiles are on a phone. The swatches 28
|
|
154
|
+
across, 13 apart, each in its colour's bold shade, as round 3 draws them (the label's own hue, grey the quietest text; VK-963),
|
|
155
|
+
the chosen one ringed in the text colour just outside a gap of the card's ground. The pictured cards drop
|
|
156
|
+
their edge, ring and ground: each a phone, 46 × 88, framed in the field's edge, over its name; the chosen one framed in
|
|
157
|
+
the brand, its name a pill in the brand; no mark, the radio itself kept for the keys and focus, which rings the card. The
|
|
158
|
+
three stand spaced around their card. ──────────────────────────────────────────────────────────────────────────────── */
|
|
159
|
+
.o-radio-group.o-radio-row:where([data-vk-phone], [data-vk-phone] *):has(> .o-radio-swatched) {
|
|
160
|
+
gap: calc(var(--vk-spacing) * 3.25); min-height: 0; padding: calc(var(--vk-spacing) * 3.5) calc(var(--vk-spacing) * 4.5);
|
|
161
|
+
border-radius: var(--vk-radius-xl); background-color: var(--vk-overlay-card);
|
|
162
|
+
}
|
|
163
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch { width: calc(var(--vk-spacing) * 7); height: calc(var(--vk-spacing) * 7); }
|
|
164
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="blue"]:not([data-disabled]) { background-color: var(--vk-label-blue); }
|
|
165
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="green"]:not([data-disabled]) { background-color: var(--vk-label-green); }
|
|
166
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="amber"]:not([data-disabled]) { background-color: var(--vk-label-amber); }
|
|
167
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="red"]:not([data-disabled]) { background-color: var(--vk-label-red); }
|
|
168
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="purple"]:not([data-disabled]) { background-color: var(--vk-label-purple); }
|
|
169
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="pink"]:not([data-disabled]) { background-color: var(--vk-label-pink); }
|
|
170
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="teal"]:not([data-disabled]) { background-color: var(--vk-label-teal); }
|
|
171
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-colour="grey"]:not([data-disabled]) { background-color: var(--vk-fg-subtlest); }
|
|
172
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-force="hover"]:not([data-checked], [data-disabled]) { box-shadow: 0 0 0 var(--vk-focus-offset) var(--vk-overlay-card), 0 0 0 calc(var(--vk-focus-offset) + var(--vk-focus-width)) var(--vk-border-input-hovered); }
|
|
173
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-checked]:not([data-disabled]) { box-shadow: 0 0 0 var(--vk-focus-offset) var(--vk-overlay-card), 0 0 0 calc(var(--vk-focus-offset) + var(--vk-focus-width)) var(--vk-fg); }
|
|
174
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-swatched > .o-radio-swatch[data-disabled][data-checked] { box-shadow: 0 0 0 var(--vk-focus-offset) var(--vk-overlay-card), 0 0 0 calc(var(--vk-focus-offset) + var(--vk-focus-width)) var(--vk-border-input); }
|
|
175
|
+
|
|
176
|
+
.o-radio-group.o-radio-row:where([data-vk-phone], [data-vk-phone] *):has(> .o-radio-pictured) {
|
|
177
|
+
display: flex; justify-content: space-around; gap: 0; padding: calc(var(--vk-spacing) * 4.5) calc(var(--vk-spacing) * 2.5) calc(var(--vk-spacing) * 4);
|
|
178
|
+
border-radius: var(--vk-radius-xl); background-color: var(--vk-overlay-card);
|
|
179
|
+
}
|
|
180
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card.o-radio-marked.o-radio-pictured {
|
|
181
|
+
position: relative; display: flex; flex-direction: column; align-items: center; gap: calc(var(--vk-spacing) * 2.5); width: auto; padding: 0;
|
|
182
|
+
border: 0 none; box-shadow: none; background-color: transparent; color: var(--vk-fg);
|
|
183
|
+
}
|
|
184
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-pictured > .o-radio-picture {
|
|
185
|
+
flex: none; width: calc(var(--vk-spacing) * 11.5); height: calc(var(--vk-spacing) * 22);
|
|
186
|
+
border: var(--vk-focus-width) solid var(--vk-border-input); border-radius: var(--vk-radius-lg);
|
|
187
|
+
transition: border-color var(--vk-duration-fast) var(--vk-ease-out);
|
|
188
|
+
}
|
|
189
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-pictured:has(> [data-checked]) > .o-radio-picture { border-color: var(--vk-brand); }
|
|
190
|
+
/* The radio itself, out of sight: still the one the keys move and focus lands on. */
|
|
191
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-pictured > .o-radio-mark { position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); }
|
|
192
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-pictured > .o-choice-text {
|
|
193
|
+
min-height: calc(var(--vk-spacing) * 6.25); padding: 0 calc(var(--vk-spacing) * 2.75); border-radius: var(--vk-radius-full);
|
|
194
|
+
transition: background-color var(--vk-duration-fast) var(--vk-ease-out), color var(--vk-duration-fast) var(--vk-ease-out);
|
|
195
|
+
}
|
|
196
|
+
.o-radio-row:where([data-vk-phone], [data-vk-phone] *) > .o-radio-pictured:has(> [data-checked]) > .o-choice-text { background-color: var(--vk-brand); color: var(--vk-fg-on-brand); }
|
|
197
|
+
|
|
198
|
+
/* ── On a phone, a group of cards (VK-968; the settings canvas, round 3, the iOS round: look-ios.mjs, .grp, .r and .ck): iOS's
|
|
199
|
+
✓ rows, on one card in the overlay card's ground and corner, as the swatches and the tiles stand on a phone; each row 52 at
|
|
200
|
+
least, 16 in, its label in the base words and its line under it in the quietest, a rule between each from the words, which a
|
|
201
|
+
place may stop --field-rows-line-end short of the right edge, as Field rows' rule; no edge and no ground of its own. Its ring
|
|
202
|
+
stands at the row's end, 20 square and bare: chosen, the ✓ in the accent; else nothing. The ring keeps the keys and the focus. */
|
|
203
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *):has(> .o-choice-card:not(.o-radio-marked)) {
|
|
204
|
+
gap: 0; overflow: hidden; border-radius: var(--vk-radius-xl); background-color: var(--vk-overlay-card);
|
|
205
|
+
}
|
|
206
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) {
|
|
207
|
+
display: flex; align-items: center; gap: calc(var(--vk-spacing) * 3); min-height: calc(var(--vk-spacing) * 13);
|
|
208
|
+
padding: calc(var(--vk-spacing) * 2.5) calc(var(--vk-spacing) * 4); border: 0; border-radius: 0; box-shadow: none; background-color: transparent;
|
|
209
|
+
}
|
|
210
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) + .o-choice-card {
|
|
211
|
+
background-image: linear-gradient(var(--vk-border-overlay-card), var(--vk-border-overlay-card)); background-repeat: no-repeat;
|
|
212
|
+
background-size: calc(100% - var(--vk-spacing) * 4 - var(--field-rows-line-end, 0px)) var(--vk-border-width); background-position: calc(var(--vk-spacing) * 4) 0;
|
|
213
|
+
}
|
|
214
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) > .o-choice-text { flex: 1 1 auto; min-width: 0; }
|
|
215
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) .o-choice-label {
|
|
216
|
+
font-size: var(--vk-font-size-base); line-height: calc(var(--vk-font-size-base) * var(--vk-line-height-base)); font-weight: var(--vk-font-weight-normal);
|
|
217
|
+
}
|
|
218
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) .o-choice-note { color: var(--vk-fg-subtlest); }
|
|
219
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) > .o-radio-ring {
|
|
220
|
+
order: 1; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); margin: 0; border: 0; border-radius: var(--vk-radius-sm); background-color: transparent;
|
|
221
|
+
}
|
|
222
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) .o-radio-dot { display: contents; }
|
|
223
|
+
.o-radio-check { display: none; }
|
|
224
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) .o-radio-check {
|
|
225
|
+
display: block; width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); stroke-width: 2.4; color: var(--vk-fg-accent); visibility: hidden;
|
|
226
|
+
}
|
|
227
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) > [data-checked] .o-radio-check { visibility: visible; }
|
|
228
|
+
.o-radio-group:where([data-vk-phone], [data-vk-phone] *) > .o-choice-card:not(.o-radio-marked) > [data-disabled] .o-radio-check { color: var(--vk-fg-disabled); }
|
|
229
|
+
|
|
230
|
+
@media (prefers-reduced-motion: reduce) { .o-radio-ring, .o-radio-dot, .o-radio-mark, .o-radio-swatch, .o-radio-picture, .o-radio-pictured > .o-choice-text { transition: none; } }
|
|
153
231
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { markOwnControl } from "../../provider/own-control.js";
|
|
3
|
+
import { Select } from "./select.js";
|
|
4
|
+
const asItems = (items) => items.map(({ icon, level, ...row }) => ({ ...row, ...(icon != null ? { mark: icon } : {}), ...(level ? { level: asItems(level) } : {}) }));
|
|
5
|
+
export function MapSelect({ items, size, ...rest }) {
|
|
6
|
+
return _jsx(Select, { listWidth: "rows", size: size === "default" ? "md" : "sm", items: asItems(items), ...rest });
|
|
7
|
+
}
|
|
8
|
+
markOwnControl(MapSelect);
|
|
@@ -22,6 +22,10 @@ export interface SelectItem {
|
|
|
22
22
|
interface SelectFieldProps {
|
|
23
23
|
/** What the field holds, above it. Without one, give it an aria-label. */
|
|
24
24
|
label?: React.ReactNode;
|
|
25
|
+
/** Where its label stands: over the box (the default), or inside it before its value, in the quieter words, the box the
|
|
26
|
+
* outline Button's own (its ground, edge and depth) and as wide as what it holds: a filter, Person Anyone ⌄. A field typed
|
|
27
|
+
* into keeps it over the box. */
|
|
28
|
+
labelAt?: "above" | "inside";
|
|
25
29
|
placeholder?: string;
|
|
26
30
|
/** Its height, as the Input's and the Button's: 24 and 28px in dense rows (24 with 12px words), 32 in
|
|
27
31
|
* toolbars, 36 (md) beside other fields, 44 on the phone. */
|
|
@@ -38,6 +42,9 @@ interface SelectFieldProps {
|
|
|
38
42
|
className?: string;
|
|
39
43
|
/** The field drawn as under the pointer or in focus, as a page that shows it draws it; saved, its Saved held. */
|
|
40
44
|
"data-force"?: "hover" | "focus" | "saved";
|
|
45
|
+
/** Its public name where a panel names it (VK-988), drawn on its box with `data-key`: `vk-sort-field`, say. */
|
|
46
|
+
"data-slot"?: string;
|
|
47
|
+
"data-key"?: string;
|
|
41
48
|
/** The app saving what was picked (VK-921): the Spinner at the field's end, before its chevron, the field busy. It wins
|
|
42
49
|
* over saved. */
|
|
43
50
|
saving?: boolean;
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
|
|
5
5
|
import { Field as BaseField } from "@base-ui/react/field";
|
|
6
6
|
import { Avatar } from "../avatar/avatar.js";
|
|
7
|
-
import { Button } from "../button/button.js";
|
|
7
|
+
import { Button, buttonClass } from "../button/button.js";
|
|
8
8
|
import { Field } from "../field/field.js";
|
|
9
9
|
import { Input, InputGroupAddon } from "../input/input.js";
|
|
10
10
|
import { Option, Options } from "../option/option.js";
|
|
@@ -81,7 +81,7 @@ function PickerSelect(p) {
|
|
|
81
81
|
if (placed.open !== open)
|
|
82
82
|
setPlaced({ open, side: open ? sideAsItOpens(p, f, box) : p.side ?? "bottom" });
|
|
83
83
|
const side = placed.side;
|
|
84
|
-
return (_jsxs(Labelled, { ...p, id: f.id, typed: typed, children: [_jsx(PickerUnder, { ...picker.props, empty: typed ? undefined : picker.props.empty, search: picker.words ?? p.search ?? (p.create || p.onSearch || p.footer ? "Search" : undefined), searchShown: typed || !!(p.search || p.create || p.onSearch || p.footer), searchIn: typed ? "box" : "list", open: open, onOpenChange: setOpen, disabled: disabled, box: typed ? (search) => _jsx(TypedBox, { p: p, f: f, trigger: trigger, field: field, hint: picker.words ?? p.search ?? placeholder, search: search }) : (_jsxs(BaseCombobox.Trigger, { ref: trigger, className:
|
|
84
|
+
return (_jsxs(Labelled, { ...p, id: f.id, typed: typed, children: [_jsx(PickerUnder, { ...picker.props, empty: typed ? undefined : picker.props.empty, search: picker.words ?? p.search ?? (p.create || p.onSearch || p.footer ? "Search" : undefined), searchShown: typed || !!(p.search || p.create || p.onSearch || p.footer), searchIn: typed ? "box" : "list", open: open, onOpenChange: setOpen, disabled: disabled, box: typed ? (search) => _jsx(TypedBox, { p: p, f: f, trigger: trigger, field: field, hint: picker.words ?? p.search ?? placeholder, search: search }) : (_jsxs(BaseCombobox.Trigger, { ref: trigger, className: boxClass(p), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...fieldAria(p, f.id), ...busy(p), children: [inside(p) && _jsx("span", { id: `${f.id}-label`, className: "o-select-label-in", children: p.label }), _jsx("span", { id: `${f.id}-value`, className: "contents", children: _jsx(Value, { chosen: f.chosen, multiple: multiple, chips: chips, placeholder: placeholder }) }), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Icon, { className: "o-select-chevron", children: glyph(CHEVRON, "") })] })), panel: (list) => (_jsx(BaseCombobox.Portal, { container: host, children: _jsx(BaseCombobox.Positioner, { className: "o-list-positioner", side: side, sideOffset: gapOf(box ?? host), collisionPadding: edgeOf(box ?? host), align: p.align ?? "start", collisionAvoidance: { side: "none" }, anchor: typed ? field : undefined, children: _jsx(BaseCombobox.Popup, { ref: popup, className: "o-list o-select-list o-smooth o-smooth-ease", ...mark, "data-list-width": p.listWidth === "rows" ? "rows" : undefined, "aria-label": titleOf(p), children: list }) }, side) })) }), _jsx(FormValue, { p: p, f: f, focusBox: () => (typed ? field.current?.querySelector("input") : trigger.current)?.focus() })] }));
|
|
85
85
|
}
|
|
86
86
|
function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
87
87
|
const { multiple, disabled } = p, q = search.typed, mark = phoneMark(usePhoneForm());
|
|
@@ -110,7 +110,7 @@ function TypedBox({ p, f, trigger, field, hint, search }) {
|
|
|
110
110
|
const one = !multiple && f.chosen.length === 1 ? f.chosen[0] : undefined;
|
|
111
111
|
const slot = one?.mark != null && (_jsxs(InputGroupAddon, { side: "start", className: "o-select-mark", "aria-hidden": "true", "data-searching": q !== one.label ? "" : undefined, children: [_jsx("span", { className: "o-select-mark-own", children: one.mark }), glyph(SEARCH, "o-select-mark-search")] }));
|
|
112
112
|
const box = (_jsx(Input, { combobox: true, chrome: "bare", ref: input, className: "o-select-typed-input", placeholder: multiple && f.chosen.length ? undefined : hint, onKeyDown: search.onKeyDown, ...search.attrs, ...(p.label != null ? {} : { "aria-label": p["aria-label"] }) }));
|
|
113
|
-
return (_jsxs(BaseCombobox.InputGroup, { ref: field, className: cx("o-input o-input-group o-select-field o-select-typed o-smooth o-smooth-ease", sized(p.size)), "data-force": p["data-force"], "data-kit": "select", ...mark, ...busy(p), onMouseDown: keep, children: [slot, multiple ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "o-select-measure", "aria-hidden": "true", inert: true, children: _jsxs("span", { ref: measure, children: [f.chosen.map((i) => _jsx(Option, { icon: chipMark(i.mark), onRemove: () => { }, children: i.label }, i.value)), _jsx(Option, { count: n }), _jsx("span", { className: "o-select-measure-words", children: q })] }) }), _jsxs(BaseCombobox.Chips, { ref: chipsBox, className: "o-select-chips", children: [f.chosen.map((i, at) => _jsx(BaseCombobox.Chip, { "data-over": at >= fit ? "" : undefined, render: _jsx(Option, { icon: chipMark(i.mark), onRemove: () => f.setValue(f.value.filter((v) => v !== i.value)) }), children: i.label }, i.value)), fit < n && _jsx(Option, { count: n - fit }), box] })] })) : box, !small && !disabled && !p.readOnly && f.chosen.length > 0 && (_jsx(BaseCombobox.Clear, { render: (props) => _jsx(Button, { ...props, kind: "quiet", size: "2xs", shape: "icon", className: "o-select-clear", "aria-label": "Clear", icon: glyph(X, ""), children: null }) })), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Trigger, { ref: trigger, className: "o-select-chevron o-select-typed-trigger", tabIndex: -1, "aria-label": `Show every ${typeof p.label === "string" ? p.label.toLowerCase() : "choice"}`, children: glyph(CHEVRON, "") })] }));
|
|
113
|
+
return (_jsxs(BaseCombobox.InputGroup, { ref: field, className: cx("o-input o-input-group o-select-field o-select-typed o-smooth o-smooth-ease", sized(p.size)), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...busy(p), onMouseDown: keep, children: [slot, multiple ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "o-select-measure", "aria-hidden": "true", inert: true, children: _jsxs("span", { ref: measure, children: [f.chosen.map((i) => _jsx(Option, { icon: chipMark(i.mark), onRemove: () => { }, children: i.label }, i.value)), _jsx(Option, { count: n }), _jsx("span", { className: "o-select-measure-words", children: q })] }) }), _jsxs(BaseCombobox.Chips, { ref: chipsBox, className: "o-select-chips", children: [f.chosen.map((i, at) => _jsx(BaseCombobox.Chip, { "data-over": at >= fit ? "" : undefined, render: _jsx(Option, { icon: chipMark(i.mark), onRemove: () => f.setValue(f.value.filter((v) => v !== i.value)) }), children: i.label }, i.value)), fit < n && _jsx(Option, { count: n - fit }), box] })] })) : box, !small && !disabled && !p.readOnly && f.chosen.length > 0 && (_jsx(BaseCombobox.Clear, { render: (props) => _jsx(Button, { ...props, kind: "quiet", size: "2xs", shape: "icon", className: "o-select-clear", "aria-label": "Clear", icon: glyph(X, ""), children: null }) })), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), _jsx(BaseCombobox.Trigger, { ref: trigger, className: "o-select-chevron o-select-typed-trigger", tabIndex: -1, "aria-label": `Show every ${typeof p.label === "string" ? p.label.toLowerCase() : "choice"}`, children: glyph(CHEVRON, "") })] }));
|
|
114
114
|
}
|
|
115
115
|
const gapOf = (at) => spacingPx(1, at), edgeOf = (at) => spacingPx(1.25, at);
|
|
116
116
|
function listNeed(at, rows, lines) {
|
|
@@ -194,8 +194,14 @@ function useField({ multiple, defaultValue, value: outside, onValueChange, items
|
|
|
194
194
|
return { items, add, value, setValue, chosen, id: React.useId() };
|
|
195
195
|
}
|
|
196
196
|
const sized = (size) => size && size !== "md" && `o-input-${size}`;
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
const inside = (p) => p.labelAt === "inside" && p.label != null && p.searchIn !== "field";
|
|
198
|
+
const GLASS_PILL = "o-glass o-glass-button o-glass-button-worded o-glass-button-sm";
|
|
199
|
+
const boxClass = (p, phone = false) => inside(p) ? cx("o-select-field", phone ? GLASS_PILL : buttonClass("outline", p.size ?? "md")) : cx("o-input o-select-field o-smooth o-smooth-ease", sized(p.size));
|
|
200
|
+
function Labelled({ label, labelAt, note, error, id, size, typed, disabled, className, children }) {
|
|
201
|
+
const within = inside({ label, labelAt, searchIn: typed ? "field" : "list" });
|
|
202
|
+
if (within)
|
|
203
|
+
label = undefined;
|
|
204
|
+
const cls = cx("o-select", size && size !== "md" && `o-select-${size}`, within && "o-select-inside", className);
|
|
199
205
|
return label != null || note != null || (error != null && error !== "")
|
|
200
206
|
? _jsx(Field, { label: label, note: note, error: error, disabled: disabled, nativeLabel: !!typed, labelId: `${id}-label`, className: cls, children: children })
|
|
201
207
|
: _jsx("div", { className: cls, children: children });
|
|
@@ -221,7 +227,7 @@ function AloneSelect({ opens, shown, open = false, onOpenChange, placeholder = "
|
|
|
221
227
|
onOpenChange?.(true);
|
|
222
228
|
} };
|
|
223
229
|
const empty = shown == null || shown === "" || shown === false;
|
|
224
|
-
return (_jsx(Labelled, { ...p, id: id, children: _jsxs(BaseField.Control, { render: _jsx("button", { type: "button" }), ref: own, disabled: p.disabled, className:
|
|
230
|
+
return (_jsx(Labelled, { ...p, id: id, children: _jsxs(BaseField.Control, { render: _jsx("button", { type: "button" }), ref: own, disabled: p.disabled, className: boxClass(p, !!mark), "data-force": p["data-force"], "data-slot": p["data-slot"], "data-key": p["data-key"], "data-kit": "select", ...mark, ...fieldAria(p, id), ...busy(p), "aria-haspopup": opens, "aria-expanded": open, "data-popup-open": open ? "" : undefined, onClick: press, onKeyDown: keys, children: [inside(p) && _jsx("span", { id: `${id}-label`, className: "o-select-label-in", children: p.label }), _jsx("span", { id: `${id}-value`, className: "contents", children: empty ? _jsx("span", { className: "o-select-value o-select-placeholder", children: placeholder })
|
|
225
231
|
: _jsx("span", { className: "o-select-value", children: typeof shown === "string" ? _jsx("span", { className: "o-list-main", children: shown }) : shown }) }), _jsx(SaveMark, { saving: p.saving, saved: p.saved }), arrow !== "none" && _jsx("span", { className: "o-select-chevron", "data-arrow": arrow, "aria-hidden": "true", children: glyph(ARROWS[arrow], "") })] }) }));
|
|
226
232
|
}
|
|
227
233
|
export function SelectShown({ items, defaultValue, multiple, chips, search, none, placeholder = "Choose", "aria-label": name }) {
|
|
@@ -2,6 +2,10 @@ export declare const SELECT_TOKENS: readonly [{
|
|
|
2
2
|
readonly name: "--vk-fg-disabled";
|
|
3
3
|
readonly kind: "colour";
|
|
4
4
|
readonly outright: "--text-disabled";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-fg-subtle";
|
|
7
|
+
readonly kind: "colour";
|
|
8
|
+
readonly outright: "--text-subtle";
|
|
5
9
|
}, {
|
|
6
10
|
readonly name: "--vk-fg-subtlest";
|
|
7
11
|
readonly kind: "colour";
|
|
@@ -10,6 +14,10 @@ export declare const SELECT_TOKENS: readonly [{
|
|
|
10
14
|
readonly name: "--vk-font-size-base";
|
|
11
15
|
readonly kind: "size";
|
|
12
16
|
readonly outright: "--text-base";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "--vk-font-weight-normal";
|
|
19
|
+
readonly kind: "size";
|
|
20
|
+
readonly outright: "--font-weight-normal";
|
|
13
21
|
}, {
|
|
14
22
|
readonly name: "--vk-spacing";
|
|
15
23
|
readonly kind: "size";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export const SELECT_TOKENS = [
|
|
2
2
|
{ name: "--vk-fg-disabled", kind: "colour", outright: "--text-disabled" },
|
|
3
|
+
{ name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
|
|
3
4
|
{ name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
|
|
4
5
|
{ name: "--vk-font-size-base", kind: "size", outright: "--text-base" },
|
|
6
|
+
{ name: "--vk-font-weight-normal", kind: "size", outright: "--font-weight-normal" },
|
|
5
7
|
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
6
8
|
{ name: "--vk-duration-fast", kind: "motion", outright: "--duration-fast" },
|
|
7
9
|
{ name: "--vk-ease-out", kind: "motion", outright: "--ease-out" },
|
|
@@ -22,6 +22,23 @@
|
|
|
22
22
|
.o-select-2xs .o-select-chevron svg:where([data-vk-phone], [data-vk-phone] *) { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
23
23
|
.o-select-field[data-popup-open] .o-select-chevron:not([data-arrow="right"]) { rotate: 180deg; }
|
|
24
24
|
|
|
25
|
+
/* ── Its label inside its box (labelAt="inside"): the box the outline Button's own (button.css draws its ground, edge, depth,
|
|
26
|
+
size and states), as wide as what it holds and never wider than its place; the label in the quieter words at the regular
|
|
27
|
+
weight, then the value in the Button's words, then a 14px chevron in them ─────────────────────────────────────────── */
|
|
28
|
+
.o-select.o-select-inside { width: max-content; max-width: 100%; }
|
|
29
|
+
.o-select-inside .o-select-field { max-width: 100%; justify-content: flex-start; gap: calc(var(--vk-spacing) * 1.5); }
|
|
30
|
+
/* Narrower than its words, the label and the value each end in "…" and the chevron stays inside. */
|
|
31
|
+
.o-select-label-in { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--vk-fg-subtle); font-weight: var(--vk-font-weight-normal); white-space: nowrap; }
|
|
32
|
+
.o-select-inside .o-select-value { flex: 0 1 auto; }
|
|
33
|
+
.o-select-inside .o-select-chevron svg { width: calc(var(--vk-spacing) * 3.5); height: calc(var(--vk-spacing) * 3.5); stroke: currentColor; }
|
|
34
|
+
/* On a phone (VK-968): the box the Glass button's worded pill at sm (glass-button.css draws its glass, rim, size and words), its
|
|
35
|
+
value then a 16px ⌄ in the quietest words; the label kept for a screen reader alone, as the Sheet it opens is titled with it. */
|
|
36
|
+
.o-select-inside .o-select-field:where([data-vk-phone]) { gap: var(--vk-spacing); }
|
|
37
|
+
.o-select-inside .o-select-field:where([data-vk-phone]) > .o-select-label-in {
|
|
38
|
+
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
39
|
+
}
|
|
40
|
+
.o-select-inside .o-select-field:where([data-vk-phone]) .o-select-chevron svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); stroke: var(--vk-fg-subtlest); }
|
|
41
|
+
|
|
25
42
|
/* ── Typed into: the field holds the box you type in (the group's bare control), and with several, their
|
|
26
43
|
chips first, each the Option with its own ×, wrapping onto more lines as they grow; from 32px up a quiet ×
|
|
27
44
|
clears it; the chevron shows every choice ───────────────────────────────────────────────────────── */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PieceLooks } from "../../looks/looks.js";
|
|
2
|
-
export type SettingRowOptionId = "card" | "rows";
|
|
2
|
+
export type SettingRowOptionId = "card" | "rows" | "end" | "fields" | "icon";
|
|
3
3
|
/** One value for every option. */
|
|
4
4
|
export type SettingRowPicks = Record<SettingRowOptionId, string>;
|
|
5
5
|
/** The setting row's options and looks. */
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { lookWornOf } from "../../looks/looks.js";
|
|
2
|
-
const OUTRIGHT = { card: "outlined", rows: "snug" };
|
|
3
|
-
const ATTIO = { card: "raised", rows: "roomy" };
|
|
2
|
+
const OUTRIGHT = { card: "outlined", rows: "snug", end: "buttons", fields: "boxes", icon: "line" };
|
|
3
|
+
const ATTIO = { card: "raised", rows: "roomy", end: "buttons", fields: "boxes", icon: "line" };
|
|
4
|
+
const LINEAR = { card: "edged", rows: "inset", end: "words", fields: "end", icon: "line" };
|
|
4
5
|
const options = [
|
|
5
|
-
{ id: "card", name: "Card", device: "desktop", def: OUTRIGHT.card, values: [{ id: "outlined", name: "Outlined" }, { id: "raised", name: "Raised" }] },
|
|
6
|
-
{ id: "rows", name: "Rows", device: "desktop", def: OUTRIGHT.rows, values: [{ id: "snug", name: "Snug" }, { id: "roomy", name: "Roomy" }] },
|
|
6
|
+
{ id: "card", name: "Card", device: "desktop", def: OUTRIGHT.card, values: [{ id: "outlined", name: "Outlined" }, { id: "raised", name: "Raised" }, { id: "edged", name: "Edged" }] },
|
|
7
|
+
{ id: "rows", name: "Rows", device: "desktop", def: OUTRIGHT.rows, values: [{ id: "snug", name: "Snug" }, { id: "roomy", name: "Roomy" }, { id: "inset", name: "Inset" }] },
|
|
8
|
+
{ id: "end", name: "End", device: "desktop", def: OUTRIGHT.end, values: [{ id: "buttons", name: "Buttons" }, { id: "words", name: "Words" }] },
|
|
9
|
+
{ id: "fields", name: "Fields", device: "desktop", def: OUTRIGHT.fields, values: [{ id: "boxes", name: "Boxes" }, { id: "end", name: "At the end" }] },
|
|
10
|
+
{ id: "icon", name: "Icon", device: "phone", def: OUTRIGHT.icon, values: [{ id: "line", name: "Line" }, { id: "tile", name: "Tile" }] },
|
|
7
11
|
];
|
|
8
12
|
const looks = [
|
|
9
13
|
{ id: "outright", name: "Outright", picks: OUTRIGHT },
|
|
10
14
|
{ id: "attio", name: "Attio", picks: ATTIO },
|
|
15
|
+
{ id: "linear", name: "Linear", picks: LINEAR },
|
|
11
16
|
];
|
|
12
17
|
export const SETTING_ROW_LOOKS = { id: "setting-row", name: "Setting row", options, looks };
|
|
13
18
|
const IDS = options.map((o) => o.id);
|
|
@@ -1,25 +1,43 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { OptionColour } from "../option/looks.js";
|
|
2
3
|
import { type SelectListProps } from "../select/select.js";
|
|
3
4
|
import { type SwitchProps } from "../switch/switch.js";
|
|
5
|
+
import { type SettingRowPicks } from "./looks.js";
|
|
4
6
|
/** A setting row's button: its words, an icon before them, what a press does. */
|
|
5
7
|
export interface SettingAction {
|
|
6
8
|
label: string;
|
|
7
9
|
icon?: React.ReactNode;
|
|
8
10
|
onClick?: () => void;
|
|
9
11
|
disabled?: boolean;
|
|
12
|
+
/** Its icon alone, its label naming it (a pencil for Change). */
|
|
13
|
+
iconOnly?: boolean;
|
|
14
|
+
/** The Button's kind: danger where it can't be undone, outline where it can (Leave); left out, danger in the danger zone,
|
|
15
|
+
* outline elsewhere. */
|
|
16
|
+
kind?: "outline" | "danger";
|
|
17
|
+
}
|
|
18
|
+
/** A word of state before a row's control: what is true now (Connected), in a value's colour. */
|
|
19
|
+
export interface SettingState {
|
|
20
|
+
label: string;
|
|
21
|
+
colour?: OptionColour;
|
|
10
22
|
}
|
|
11
23
|
interface SettingRowBase {
|
|
12
24
|
/** The setting's name ("Weekly digest"). */
|
|
13
25
|
label: React.ReactNode;
|
|
14
26
|
/** The line under its name: what it does. */
|
|
15
27
|
note?: React.ReactNode;
|
|
16
|
-
/** An icon
|
|
28
|
+
/** An icon at the row's start: on a computer in a 32 box; on a phone a line icon, or a tile under the Icon option's Tile. */
|
|
17
29
|
icon?: React.ReactNode;
|
|
30
|
+
/** The tile's colour under the Icon option's Tile, a label colour (the palette's 700s); left out, grey. Line ignores it. */
|
|
31
|
+
colour?: OptionColour;
|
|
18
32
|
/** A mark at the row's start, as given (Google's, a team's letter). */
|
|
19
33
|
mark?: React.ReactNode;
|
|
20
|
-
/** Why it can't change: its control is shut, and this stands before it
|
|
34
|
+
/** Why it can't change: its control is shut, and this stands before it. On a phone the row fades and the reason stands in
|
|
35
|
+
* place of its line; a page that puts the reason in its group's note passes `true`. */
|
|
21
36
|
locked?: React.ReactNode;
|
|
22
|
-
/** A
|
|
37
|
+
/** A word of state: on a computer before its control, the Option in its colour (Connected, green); on a phone the grey
|
|
38
|
+
* value before ›, the row then the press of its action. */
|
|
39
|
+
state?: SettingState;
|
|
40
|
+
/** A lone row: one action on its own; on a computer bare, with no card; on a phone a card of its own, the row the press. */
|
|
23
41
|
alone?: boolean;
|
|
24
42
|
className?: string;
|
|
25
43
|
}
|
|
@@ -31,31 +49,48 @@ export type SettingRowProps = SettingRowBase & (({
|
|
|
31
49
|
} & No<"select" | "action" | "onOpen" | "value">) | ({
|
|
32
50
|
select: Omit<SelectListProps, "label" | "size">;
|
|
33
51
|
} & No<"switch" | "action" | "onOpen" | "value">) | ({
|
|
34
|
-
action: SettingAction;
|
|
35
|
-
|
|
52
|
+
action: SettingAction; /** On a computer, a value before its action, as the open kind's (an email before Change). */
|
|
53
|
+
value?: React.ReactNode;
|
|
54
|
+
} & No<"switch" | "select" | "onOpen">) | ({
|
|
36
55
|
onOpen: () => void;
|
|
37
56
|
value?: React.ReactNode;
|
|
38
57
|
} & No<"switch" | "select" | "action">));
|
|
39
58
|
export interface SettingRowsProps {
|
|
40
|
-
/** The danger zone's: a red edge, each row's button the Button's danger kind, on a phone its
|
|
59
|
+
/** The danger zone's: a red edge, each row's button the Button's danger kind unless its action says outline, on a phone its
|
|
60
|
+
* names red. */
|
|
41
61
|
danger?: boolean;
|
|
42
62
|
/** Its form: the device's unless told (a PhoneHost screen, or below the app's line, is a phone's). */
|
|
43
63
|
form?: "computer" | "phone";
|
|
44
64
|
className?: string;
|
|
45
65
|
children: React.ReactNode;
|
|
46
66
|
}
|
|
47
|
-
/**
|
|
67
|
+
/** The setting row's options as the frame round `el` picks them, kept up to date as they change; each its default for `null`. */
|
|
68
|
+
export declare function useSettingRowWorn(el: Element | null): SettingRowPicks;
|
|
69
|
+
/** True for a part placed in a computer's SettingRows whose Fields option is At the end: it draws as one of the card's rows (a
|
|
70
|
+
* Field, the kit's photo). */
|
|
71
|
+
export declare function useSettingRowsRow(): boolean;
|
|
72
|
+
/** The icon at a row's start, or beside a list's name: Line or Tile by the Icon option, the tile on `colour`. */
|
|
73
|
+
export declare function SettingIcon({ colour, children }: {
|
|
74
|
+
colour?: OptionColour;
|
|
75
|
+
children: React.ReactNode;
|
|
76
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
/** iOS's ›, 9 × 15, at a phone row's end: the setting row's, drawn by a list beside setting rows too (the kit's settings list, an
|
|
78
|
+
* app's own row), so one › stands on every settings page. */
|
|
79
|
+
export declare function SettingChevron(): import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
/** Settings rows in a card, a line between each; `danger` the danger zone's. On a phone, Field rows' card: a Field placed in it
|
|
81
|
+
* is its row, beside the setting rows, its note and error under the card (VK-979). */
|
|
48
82
|
export declare function SettingRows({ danger, form, className, children }: SettingRowsProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
-
/** One setting as a row: its name and its line, its control at its end.
|
|
83
|
+
/** One setting as a row: its name and its line, its control at its end. What it holds is no row of its card: a Field its control
|
|
84
|
+
* draws (a Select with a note) stands as it does anywhere else. */
|
|
50
85
|
export declare function SettingRow(props: SettingRowProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
-
/** A setting with a switch: the setting row's switch kind, its
|
|
86
|
+
/** A setting with a switch: the setting row's switch kind, only its Switch switching it. */
|
|
52
87
|
export interface SwitchRowProps extends SwitchProps {
|
|
53
88
|
/** The setting's name ("Daily summary"), not the action. */
|
|
54
89
|
label: React.ReactNode;
|
|
55
90
|
/** A line under it: what it does, or why it is locked. */
|
|
56
91
|
note?: React.ReactNode;
|
|
57
92
|
}
|
|
58
|
-
/** A setting in a settings list: its name and a line on the left, the switch on the right
|
|
93
|
+
/** A setting in a settings list: its name and a line on the left, the switch on the right, which alone switches it. */
|
|
59
94
|
export declare function SwitchRow({ label, note, locked, ...props }: SwitchRowProps): import("react/jsx-runtime").JSX.Element;
|
|
60
95
|
/** Settings rows in a bordered box, a line between each: the setting rows' card in its computer form on every device. */
|
|
61
96
|
export declare function SwitchRows({ className, children }: {
|
|
@@ -1,41 +1,108 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cx } from "../../internal/cx.js";
|
|
4
|
+
import { FieldRowsCardContext, OutOfFieldRows, SettingRowField } from "../../internal/field-rows.js";
|
|
4
5
|
import { Button } from "../button/button.js";
|
|
6
|
+
import { useFieldRowsCard } from "../field/field.js";
|
|
5
7
|
import { phoneMark, usePhoneForm } from "../internal/phone.js";
|
|
8
|
+
import { Option } from "../option/option.js";
|
|
6
9
|
import { Select } from "../select/select.js";
|
|
7
10
|
import { Switch } from "../switch/switch.js";
|
|
11
|
+
import { SETTING_ROW_ATTRS, settingRowWornOf } from "./looks.js";
|
|
8
12
|
const Rows = React.createContext(null);
|
|
13
|
+
const useBeforePaint = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
14
|
+
const DEF = settingRowWornOf(null);
|
|
15
|
+
const sameWorn = (a, b) => Object.keys(a).every((k) => a[k] === b[k]);
|
|
16
|
+
export function useSettingRowWorn(el) {
|
|
17
|
+
const [worn, setWorn] = React.useState(DEF);
|
|
18
|
+
useBeforePaint(() => {
|
|
19
|
+
const read = () => setWorn((was) => { const now = settingRowWornOf(el); return sameWorn(was, now) ? was : now; });
|
|
20
|
+
read();
|
|
21
|
+
if (!el)
|
|
22
|
+
return;
|
|
23
|
+
const watch = new MutationObserver(read);
|
|
24
|
+
watch.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter: SETTING_ROW_ATTRS });
|
|
25
|
+
return () => watch.disconnect();
|
|
26
|
+
}, [el]);
|
|
27
|
+
return worn;
|
|
28
|
+
}
|
|
29
|
+
export function useSettingRowsRow() {
|
|
30
|
+
return React.useContext(SettingRowField);
|
|
31
|
+
}
|
|
32
|
+
export function SettingIcon({ colour, children }) {
|
|
33
|
+
return _jsx("span", { className: "o-setting-row-icon", "data-colour": colour, "aria-hidden": "true", ...phoneMark(usePhoneForm()), children: children });
|
|
34
|
+
}
|
|
35
|
+
const PHONE_CHEVRON = (_jsx("svg", { className: "o-setting-row-chevron", "data-phone": "", viewBox: "0 0 9 15", fill: "none", stroke: "currentColor", strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M1.5 1.5 7.5 7.5 1.5 13.5" }) }));
|
|
36
|
+
export function SettingChevron() {
|
|
37
|
+
return PHONE_CHEVRON;
|
|
38
|
+
}
|
|
9
39
|
const CHEVRON = (_jsx("svg", { className: "o-setting-row-chevron", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M6 3.5 10.5 8 6 12.5" }) }));
|
|
10
40
|
export function SettingRows({ danger = false, form, className, children }) {
|
|
11
|
-
const phone = usePhoneForm(form);
|
|
12
|
-
|
|
41
|
+
const phone = usePhoneForm(form), { card, foot } = useFieldRowsCard();
|
|
42
|
+
const [el, setEl] = React.useState(null), worn = useSettingRowWorn(phone ? null : el);
|
|
43
|
+
const rows = React.useMemo(() => ({ danger, phone, worn }), [danger, phone, worn]);
|
|
44
|
+
return (_jsxs(FieldRowsCardContext.Provider, { value: phone ? card : null, children: [_jsx(SettingRowField.Provider, { value: !phone && worn.fields === "end", children: _jsx("div", { ref: setEl, className: cx("o-setting-rows o-smooth o-smooth-ease", danger && "o-setting-rows-danger", phone && "o-field-rows", className), "data-kit": "setting-row", ...phoneMark(phone), children: _jsx(Rows.Provider, { value: rows, children: children }) }) }), phone && foot] }));
|
|
13
45
|
}
|
|
14
46
|
export function SettingRow(props) {
|
|
15
|
-
|
|
47
|
+
return _jsx(OutOfFieldRows, { children: _jsx(SettingRowOf, { ...props }) });
|
|
48
|
+
}
|
|
49
|
+
function SettingRowOf(props) {
|
|
50
|
+
const rows = React.useContext(Rows), device = usePhoneForm(), danger = !!rows?.danger;
|
|
16
51
|
const { label, note, icon, mark, locked, alone, className } = props;
|
|
52
|
+
const id = React.useId();
|
|
53
|
+
const [own, setOwn] = React.useState(null), ownWorn = useSettingRowWorn(rows || device ? null : own);
|
|
54
|
+
if (alone && !rows && device)
|
|
55
|
+
return _jsx(SettingRows, { form: "phone", children: _jsx(SettingRow, { ...props }) });
|
|
56
|
+
const phone = !!rows?.phone, worn = rows ? rows.worn : ownWorn, inWords = !phone && worn.end === "words";
|
|
17
57
|
const shut = locked != null && locked !== false;
|
|
18
58
|
const reason = shut && locked !== true ? locked : null;
|
|
19
59
|
const kind = props.switch ? "switch" : props.select ? "select" : props.action ? "action" : "open";
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
60
|
+
const begins = mark != null ? "mark" : icon != null || (phone && danger && props.action?.icon != null) ? "icon" : undefined;
|
|
61
|
+
const ownCard = alone && !rows && !device && worn.card === "edged";
|
|
62
|
+
const root = { className: cx("o-setting-row", phone && "o-field-row", props.switch && "o-switch-row", ownCard && "o-smooth o-smooth-ease", className), "data-setting-row-kind": kind,
|
|
63
|
+
"data-setting-row-start": begins, "data-locked": shut ? "" : undefined, "data-alone": alone ? "" : undefined, ...(rows ? {} : { ref: setOwn }) };
|
|
64
|
+
const start = mark ?? (icon != null ? _jsx(SettingIcon, { colour: props.colour, children: icon }) : null);
|
|
65
|
+
const chevron = phone ? PHONE_CHEVRON : CHEVRON;
|
|
23
66
|
const line = phone && reason != null ? reason : note;
|
|
24
|
-
const words = (_jsxs("span", { className: "o-choice-text", children: [_jsx("span", { className: "o-choice-label", children: label }), line != null && _jsx("span", { className: "o-choice-note", children: line })] }));
|
|
67
|
+
const words = (_jsxs("span", { className: "o-choice-text", children: [_jsx("span", { className: "o-choice-label", id: `${id}-label`, children: label }), line != null && _jsx("span", { className: "o-choice-note", id: `${id}-note`, children: line })] }));
|
|
25
68
|
const why = !phone && reason != null ? _jsx("span", { className: "o-setting-row-reason", children: reason }) : null;
|
|
26
69
|
const name = typeof label === "string" ? label : undefined;
|
|
70
|
+
const s = props.state;
|
|
71
|
+
const said = phone || !s ? null : inWords
|
|
72
|
+
? _jsxs("span", { className: "o-setting-row-said", children: [s.colour && _jsx("span", { className: "o-setting-row-dot", "data-colour": s.colour, "aria-hidden": "true" }), s.label] })
|
|
73
|
+
: _jsx(Option, { colour: s.colour, children: s.label });
|
|
74
|
+
const lead = said != null || why != null ? _jsxs(_Fragment, { children: [said, why] }) : null;
|
|
75
|
+
if (inWords && why != null)
|
|
76
|
+
return _jsxs("div", { ...root, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [said, why] })] });
|
|
27
77
|
if (props.switch) {
|
|
28
|
-
|
|
78
|
+
const toggle = _jsx(Switch, { "aria-labelledby": `${id}-label`, "aria-describedby": line != null ? `${id}-note` : undefined, ...props.switch, locked: shut });
|
|
79
|
+
return (_jsxs("div", { ...root, children: [start, words, said == null ? _jsxs(_Fragment, { children: [why, toggle] }) : _jsxs("span", { className: "o-setting-row-end", children: [said, why, toggle] })] }));
|
|
29
80
|
}
|
|
30
81
|
if (props.select)
|
|
31
|
-
return _jsx(SelectRow, { root: root, start: start, words: words, why:
|
|
82
|
+
return _jsx(SelectRow, { root: root, start: start, words: words, why: lead, name: name, select: props.select, shut: shut, phone: phone });
|
|
32
83
|
if (props.action) {
|
|
33
84
|
const a = props.action;
|
|
34
|
-
if (phone)
|
|
35
|
-
|
|
36
|
-
|
|
85
|
+
if (phone) {
|
|
86
|
+
const off = shut || a.disabled;
|
|
87
|
+
if (alone)
|
|
88
|
+
return _jsxs("button", { type: "button", ...root, disabled: off, onClick: a.onClick, children: [start, words] });
|
|
89
|
+
if (danger)
|
|
90
|
+
return _jsxs("button", { type: "button", ...root, disabled: off, onClick: a.onClick, children: [a.icon != null ? _jsx(SettingIcon, { children: a.icon }) : start, words] });
|
|
91
|
+
if (props.state)
|
|
92
|
+
return (_jsxs("button", { type: "button", ...root, disabled: off, onClick: a.onClick, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [_jsx("span", { className: "o-setting-row-value", children: props.state.label }), chevron] })] }));
|
|
93
|
+
const about = line != null ? `${id}-label ${id}-note` : `${id}-label`;
|
|
94
|
+
return _jsxs("div", { ...root, children: [start, words, _jsx("span", { className: "o-setting-row-end", children: _jsx("button", { type: "button", className: "o-setting-row-act", "aria-describedby": about, disabled: off, onClick: a.onClick, children: a.label }) })] });
|
|
95
|
+
}
|
|
96
|
+
const kindOf = a.kind ?? (danger ? "danger" : "outline");
|
|
97
|
+
const value = props.value != null ? _jsx("span", { className: "o-setting-row-value", children: props.value }) : null;
|
|
98
|
+
const act = inWords
|
|
99
|
+
? _jsx("button", { type: "button", className: "o-setting-row-act", "data-kind": kindOf === "danger" ? "danger" : undefined, "data-icon": a.iconOnly ? "" : undefined, "aria-label": a.iconOnly ? a.label : undefined, disabled: shut || a.disabled, onClick: a.onClick, children: a.iconOnly ? a.icon : a.label })
|
|
100
|
+
: a.iconOnly
|
|
101
|
+
? _jsx(Button, { kind: kindOf, size: "sm", shape: "icon", icon: a.icon, "aria-label": a.label, disabled: shut || a.disabled, onClick: a.onClick })
|
|
102
|
+
: _jsx(Button, { kind: kindOf, size: "sm", icon: a.icon, disabled: shut || a.disabled, onClick: a.onClick, children: a.label });
|
|
103
|
+
return (_jsxs("div", { ...root, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [value, lead, act] })] }));
|
|
37
104
|
}
|
|
38
|
-
return (_jsxs("button", { type: "button", ...root, disabled: shut, onClick: shut ? undefined : props.onOpen, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [
|
|
105
|
+
return (_jsxs("button", { type: "button", ...root, disabled: shut, onClick: shut ? undefined : props.onOpen, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [lead, props.value != null && _jsx("span", { className: "o-setting-row-value", children: props.value }), chevron] })] }));
|
|
39
106
|
}
|
|
40
107
|
const firstOf = (v) => (Array.isArray(v) ? v : v == null ? [] : [v]);
|
|
41
108
|
function SelectRow({ root, start, words, why, name, select, shut, phone }) {
|
|
@@ -46,7 +113,7 @@ function SelectRow({ root, start, words, why, name, select, shut, phone }) {
|
|
|
46
113
|
if (!phone)
|
|
47
114
|
return _jsxs("div", { ...root, children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [why, field] })] });
|
|
48
115
|
const shown = firstOf(value).map((v) => findItem(select.items, v)?.label ?? v);
|
|
49
|
-
return (_jsxs("div", { ...root, children: [_jsxs("button", { type: "button", className: "o-setting-row-press", disabled: shut || select.disabled, onClick: () => setOpen(true), children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [shown.length > 0 && _jsx("span", { className: "o-setting-row-value", children: shown.join(", ") }),
|
|
116
|
+
return (_jsxs("div", { ...root, children: [_jsxs("button", { type: "button", className: "o-setting-row-press", disabled: shut || select.disabled, onClick: () => setOpen(true), children: [start, words, _jsxs("span", { className: "o-setting-row-end", children: [shown.length > 0 && _jsx("span", { className: "o-setting-row-value", children: shown.join(", ") }), PHONE_CHEVRON] })] }), _jsx("span", { hidden: true, children: field })] }));
|
|
50
117
|
}
|
|
51
118
|
const findItem = (items, v) => {
|
|
52
119
|
for (const i of items) {
|