bitboss-ui 3.0.0-beta.67 → 3.0.0-beta.69
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/README.md +230 -91
- package/bin/bitboss-ui-mcp.mjs +368 -142
- package/bin/bitboss-ui.mjs +24 -2073
- package/bin/cli.mjs +1922 -0
- package/dist/ai/BbAccordion.md +1 -1
- package/dist/ai/BbAlert.md +16 -12
- package/dist/ai/BbAsterisk.md +1 -1
- package/dist/ai/BbAvatar.md +3 -3
- package/dist/ai/BbBadge.md +5 -5
- package/dist/ai/BbBadgeButton.md +1 -1
- package/dist/ai/BbBaseButton.md +1 -1
- package/dist/ai/BbBaseCheckboxIcon.md +4 -0
- package/dist/ai/BbBaseRadioIcon.md +7 -3
- package/dist/ai/BbBaseSwitchIcon.md +11 -2
- package/dist/ai/BbBreadcrumbs.md +3 -3
- package/dist/ai/BbButton.md +63 -10
- package/dist/ai/BbCalendar.md +15 -2
- package/dist/ai/BbCarousel.md +1093 -0
- package/dist/ai/BbCheckbox.md +28 -8
- package/dist/ai/BbCheckboxGroup.md +65 -32
- package/dist/ai/BbColorInput.md +18 -15
- package/dist/ai/BbColorPalette.md +9 -6
- package/dist/ai/BbConfigScope.md +218 -0
- package/dist/ai/BbConfirm.md +25 -22
- package/dist/ai/BbDatePicker.md +12 -6
- package/dist/ai/BbDatePickerInput.md +29 -18
- package/dist/ai/BbDialog.md +11 -10
- package/dist/ai/BbDropdown.md +36 -29
- package/dist/ai/BbDropdownButton.md +21 -21
- package/dist/ai/BbDropzone.md +5 -16
- package/dist/ai/BbForm.md +14 -8
- package/dist/ai/BbHost.md +20 -14
- package/dist/ai/BbHoverCard.md +2 -2
- package/dist/ai/BbIcon.md +3 -3
- package/dist/ai/BbIndicator.md +4 -4
- package/dist/ai/BbNumberInput.md +20 -16
- package/dist/ai/BbOffCanvas.md +15 -10
- package/dist/ai/BbPagination.md +15 -6
- package/dist/ai/BbPopover.md +16 -9
- package/dist/ai/BbRadio.md +30 -9
- package/dist/ai/BbRadioGroup.md +78 -35
- package/dist/ai/BbRating.md +13 -11
- package/dist/ai/BbSelect.md +84 -49
- package/dist/ai/BbSelectPopover.md +33 -31
- package/dist/ai/BbSlider.md +266 -66
- package/dist/ai/BbSpinner.md +3 -3
- package/dist/ai/BbSwitch.md +33 -9
- package/dist/ai/BbSwitchGroup.md +27 -18
- package/dist/ai/BbTable.md +28 -25
- package/dist/ai/BbTabs.md +29 -32
- package/dist/ai/BbTabsList.md +4 -4
- package/dist/ai/BbTabsRoot.md +2 -2
- package/dist/ai/BbTag.md +15 -14
- package/dist/ai/BbTextInput.md +32 -22
- package/dist/ai/BbTextarea.md +20 -18
- package/dist/ai/BbTimePicker.md +5 -5
- package/dist/ai/BbTimePickerInput.md +15 -14
- package/dist/ai/BbToast.md +72 -28
- package/dist/ai/BbTooltip.md +7 -6
- package/dist/ai/BbTree.md +1 -1
- package/dist/ai/ChipsBox.md +1 -1
- package/dist/ai/ClearableButton.md +1 -1
- package/dist/ai/CommonField.md +5 -5
- package/dist/ai/CommonFieldInput.md +3 -2
- package/dist/ai/CommonPopover.md +4 -4
- package/dist/ai/CommonTimeSelector.md +1 -1
- package/dist/ai/ErrorIcon.md +1 -1
- package/dist/ai/FlatListBox.md +5 -4
- package/dist/ai/GroupedListBox.md +5 -4
- package/dist/ai/ListBox.md +6 -5
- package/dist/ai/OptionsContainer.md +20 -4
- package/dist/ai/WarningIcon.md +1 -1
- package/dist/ai/changelog.json +1002 -39
- package/dist/ai/components.json +117 -246
- package/dist/ai/composables/useBbConfig.md +3 -3
- package/dist/ai/composables/useBbDialog.md +1 -1
- package/dist/ai/composables/useBbFormField.md +1 -1
- package/dist/ai/composables/useConfirm.md +1 -1
- package/dist/ai/composables/useToast.md +16 -16
- package/dist/ai/design-tokens.json +10 -5
- package/dist/ai/guides/agent-contract.md +15 -10
- package/dist/ai/guides/ai-router.md +15 -10
- package/dist/ai/guides/app-layout.md +1 -1
- package/dist/ai/guides/calendars-and-digits.md +123 -0
- package/dist/ai/guides/component-picker.md +1 -1
- package/dist/ai/guides/design-language.md +18 -14
- package/dist/ai/guides/design-tokens.md +85 -43
- package/dist/ai/guides/eslint-rules.md +21 -2
- package/dist/ai/guides/fetch-items-playbook.md +1 -1
- package/dist/ai/guides/icons-policy.md +1 -1
- package/dist/ai/guides/inertia-helpers.md +322 -41
- package/dist/ai/guides/inline-edit-playbook.md +1 -1
- package/dist/ai/guides/installation-and-plugin-setup.md +498 -189
- package/dist/ai/guides/migration/adoption-checklist.md +5 -5
- package/dist/ai/guides/migration/components/bb-alert.md +2 -2
- package/dist/ai/guides/migration/components/bb-badge.md +1 -1
- package/dist/ai/guides/migration/components/bb-checkbox-group.md +15 -15
- package/dist/ai/guides/migration/components/bb-dialog.md +2 -2
- package/dist/ai/guides/migration/components/bb-dropdown.md +1 -1
- package/dist/ai/guides/migration/components/bb-host.md +10 -8
- package/dist/ai/guides/migration/components/bb-offcanvas.md +1 -1
- package/dist/ai/guides/migration/components/bb-rating.md +1 -1
- package/dist/ai/guides/migration/components/bb-select-popover.md +2 -2
- package/dist/ai/guides/migration/components/bb-select.md +3 -3
- package/dist/ai/guides/migration/components/bb-slider.md +17 -2
- package/dist/ai/guides/migration/components/bb-table.md +1 -0
- package/dist/ai/guides/migration/components/bb-tabs.md +33 -15
- package/dist/ai/guides/migration/components/bb-toast.md +10 -9
- package/dist/ai/guides/migration/components/use-confirm.md +1 -1
- package/dist/ai/guides/migration/v2-to-v3.md +345 -76
- package/dist/ai/guides/migration/v3-beta-css-classes.md +1 -0
- package/dist/ai/guides/migration/v3-beta-tooling.md +30 -13
- package/dist/ai/guides/options-items-playbook.md +5 -1
- package/dist/ai/guides/passthrough.md +150 -135
- package/dist/ai/guides/ssr-prefill.md +7 -1
- package/dist/ai/guides/typescript-generic-components.md +7 -7
- package/dist/ai/guides/validated-forms.md +14 -5
- package/dist/ai/guides/validation-libraries.md +4 -4
- package/dist/ai/helpers/inertia/manifest.json +23 -14
- package/dist/ai/helpers/inertia/useQuery.ts +74 -0
- package/dist/ai/helpers/inertia/useQueryObject.ts +33 -1
- package/dist/ai/helpers/inertia/useRouteQuery.ts +158 -30
- package/dist/ai/index.md +5 -3
- package/dist/ai/manifest/common.json +13 -15
- package/dist/ai/manifest/components/BbAccordion.tree.json +22 -4
- package/dist/ai/manifest/components/BbAlert.json +3 -2
- package/dist/ai/manifest/components/BbAlert.tree.json +26 -3
- package/dist/ai/manifest/components/BbAsterisk.tree.json +7 -1
- package/dist/ai/manifest/components/BbAvatar.json +2 -1
- package/dist/ai/manifest/components/BbAvatar.tree.json +16 -2
- package/dist/ai/manifest/components/BbBadge.json +4 -3
- package/dist/ai/manifest/components/BbBadge.tree.json +39 -4
- package/dist/ai/manifest/components/BbBadgeButton.tree.json +2 -2
- package/dist/ai/manifest/components/BbBaseButton.tree.json +16 -1
- package/dist/ai/manifest/components/BbBaseCheckboxIcon.tree.json +23 -2
- package/dist/ai/manifest/components/BbBaseRadioIcon.tree.json +21 -4
- package/dist/ai/manifest/components/BbBaseSwitchIcon.tree.json +26 -2
- package/dist/ai/manifest/components/BbBreadcrumbs.json +1 -1
- package/dist/ai/manifest/components/BbBreadcrumbs.tree.json +34 -4
- package/dist/ai/manifest/components/BbButton.json +5 -4
- package/dist/ai/manifest/components/BbButton.tree.json +78 -5
- package/dist/ai/manifest/components/BbCalendar.json +2 -2
- package/dist/ai/manifest/components/BbCalendar.tree.json +81 -5
- package/dist/ai/manifest/components/BbCarousel.json +59 -0
- package/dist/ai/manifest/components/BbCarousel.tree.json +135 -0
- package/dist/ai/manifest/components/BbCheckbox.json +5 -4
- package/dist/ai/manifest/components/BbCheckbox.tree.json +31 -2
- package/dist/ai/manifest/components/BbCheckboxGroup.json +18 -15
- package/dist/ai/manifest/components/BbCheckboxGroup.removed.json +1 -1
- package/dist/ai/manifest/components/BbCheckboxGroup.tree.json +89 -5
- package/dist/ai/manifest/components/BbCollapsible.tree.json +11 -1
- package/dist/ai/manifest/components/BbColorInput.json +7 -6
- package/dist/ai/manifest/components/BbColorInput.tree.json +49 -4
- package/dist/ai/manifest/components/BbColorPalette.json +4 -3
- package/dist/ai/manifest/components/BbColorPalette.tree.json +36 -2
- package/dist/ai/manifest/components/BbConfigScope.json +23 -0
- package/dist/ai/manifest/components/BbConfirm.json +3 -2
- package/dist/ai/manifest/components/BbConfirm.tree.json +27 -3
- package/dist/ai/manifest/components/BbDatePicker.json +7 -6
- package/dist/ai/manifest/components/BbDatePicker.tree.json +42 -3
- package/dist/ai/manifest/components/BbDatePickerInput.json +7 -6
- package/dist/ai/manifest/components/BbDatePickerInput.tree.json +86 -5
- package/dist/ai/manifest/components/BbDialog.json +3 -2
- package/dist/ai/manifest/components/BbDialog.tree.json +28 -3
- package/dist/ai/manifest/components/BbDropdown.json +14 -10
- package/dist/ai/manifest/components/BbDropdown.tree.json +80 -3
- package/dist/ai/manifest/components/BbDropdownButton.json +14 -11
- package/dist/ai/manifest/components/BbDropdownButton.tree.json +47 -4
- package/dist/ai/manifest/components/BbDropzone.json +2 -1
- package/dist/ai/manifest/components/BbDropzone.tree.json +27 -1
- package/dist/ai/manifest/components/BbForm.json +2 -2
- package/dist/ai/manifest/components/BbHost.tree.json +1 -1
- package/dist/ai/manifest/components/BbHoverCard.json +3 -3
- package/dist/ai/manifest/components/BbHoverCard.tree.json +18 -1
- package/dist/ai/manifest/components/BbIcon.json +2 -1
- package/dist/ai/manifest/components/BbIcon.tree.json +7 -1
- package/dist/ai/manifest/components/BbIndicator.json +2 -1
- package/dist/ai/manifest/components/BbIndicator.tree.json +27 -1
- package/dist/ai/manifest/components/BbNumberInput.json +6 -5
- package/dist/ai/manifest/components/BbNumberInput.tree.json +40 -3
- package/dist/ai/manifest/components/BbOffCanvas.json +2 -1
- package/dist/ai/manifest/components/BbOffCanvas.tree.json +55 -2
- package/dist/ai/manifest/components/BbPagination.json +1 -1
- package/dist/ai/manifest/components/BbPagination.tree.json +23 -3
- package/dist/ai/manifest/components/BbPopover.json +5 -4
- package/dist/ai/manifest/components/BbPopover.tree.json +20 -2
- package/dist/ai/manifest/components/BbProgress.tree.json +9 -1
- package/dist/ai/manifest/components/BbRadio.json +3 -2
- package/dist/ai/manifest/components/BbRadio.tree.json +30 -2
- package/dist/ai/manifest/components/BbRadioGroup.json +22 -19
- package/dist/ai/manifest/components/BbRadioGroup.removed.json +1 -1
- package/dist/ai/manifest/components/BbRadioGroup.tree.json +88 -5
- package/dist/ai/manifest/components/BbRating.json +6 -5
- package/dist/ai/manifest/components/BbRating.removed.json +1 -0
- package/dist/ai/manifest/components/BbRating.tree.json +37 -2
- package/dist/ai/manifest/components/BbSelect.json +13 -11
- package/dist/ai/manifest/components/BbSelect.tree.json +70 -7
- package/dist/ai/manifest/components/BbSelectPopover.json +17 -13
- package/dist/ai/manifest/components/BbSelectPopover.tree.json +94 -8
- package/dist/ai/manifest/components/BbSlider.json +30 -27
- package/dist/ai/manifest/components/BbSlider.removed.json +3 -0
- package/dist/ai/manifest/components/BbSlider.tree.json +48 -3
- package/dist/ai/manifest/components/BbSmoothHeight.tree.json +10 -1
- package/dist/ai/manifest/components/BbSpinner.tree.json +21 -2
- package/dist/ai/manifest/components/BbSwitch.json +3 -2
- package/dist/ai/manifest/components/BbSwitch.tree.json +31 -2
- package/dist/ai/manifest/components/BbSwitchGroup.json +9 -7
- package/dist/ai/manifest/components/BbSwitchGroup.removed.json +1 -1
- package/dist/ai/manifest/components/BbSwitchGroup.tree.json +65 -3
- package/dist/ai/manifest/components/BbTable.json +10 -9
- package/dist/ai/manifest/components/BbTable.tree.json +144 -5
- package/dist/ai/manifest/components/BbTabs.json +7 -6
- package/dist/ai/manifest/components/BbTabs.removed.json +5 -1
- package/dist/ai/manifest/components/BbTabs.tree.json +34 -3
- package/dist/ai/manifest/components/BbTabsList.json +4 -4
- package/dist/ai/manifest/components/BbTabsList.removed.json +5 -1
- package/dist/ai/manifest/components/BbTabsList.tree.json +24 -2
- package/dist/ai/manifest/components/BbTabsPanels.tree.json +16 -1
- package/dist/ai/manifest/components/BbTabsRoot.json +3 -3
- package/dist/ai/manifest/components/BbTag.json +7 -6
- package/dist/ai/manifest/components/BbTag.tree.json +49 -4
- package/dist/ai/manifest/components/BbTextInput.json +6 -5
- package/dist/ai/manifest/components/BbTextInput.tree.json +43 -3
- package/dist/ai/manifest/components/BbTextarea.json +7 -6
- package/dist/ai/manifest/components/BbTextarea.tree.json +46 -3
- package/dist/ai/manifest/components/BbTimePicker.json +7 -6
- package/dist/ai/manifest/components/BbTimePicker.tree.json +30 -3
- package/dist/ai/manifest/components/BbTimePickerInput.json +7 -6
- package/dist/ai/manifest/components/BbTimePickerInput.tree.json +58 -6
- package/dist/ai/manifest/components/BbToast.json +3 -2
- package/dist/ai/manifest/components/BbToast.tree.json +46 -2
- package/dist/ai/manifest/components/BbTooltip.json +4 -3
- package/dist/ai/manifest/components/BbTooltip.tree.json +17 -1
- package/dist/ai/manifest/components/BbTree.tree.json +14 -1
- package/dist/ai/manifest/components/ChipsBox.tree.json +1 -1
- package/dist/ai/manifest/components/ClearableButton.tree.json +8 -2
- package/dist/ai/manifest/components/CommonField.json +2 -2
- package/dist/ai/manifest/components/CommonField.tree.json +68 -1
- package/dist/ai/manifest/components/CommonFieldInput.json +2 -2
- package/dist/ai/manifest/components/CommonFieldInput.tree.json +38 -6
- package/dist/ai/manifest/components/CommonPopover.json +7 -5
- package/dist/ai/manifest/components/CommonPopover.tree.json +11 -1
- package/dist/ai/manifest/components/CommonTimeSelector.tree.json +18 -2
- package/dist/ai/manifest/components/ErrorIcon.tree.json +8 -2
- package/dist/ai/manifest/components/FlatListBox.json +1 -1
- package/dist/ai/manifest/components/FlatListBox.tree.json +4 -3
- package/dist/ai/manifest/components/GroupedListBox.json +1 -1
- package/dist/ai/manifest/components/GroupedListBox.tree.json +4 -3
- package/dist/ai/manifest/components/ListBox.json +1 -1
- package/dist/ai/manifest/components/ListBox.tree.json +2 -2
- package/dist/ai/manifest/components/OptionsContainer.json +4 -3
- package/dist/ai/manifest/components/OptionsContainer.tree.json +16 -1
- package/dist/ai/manifest/components/WarningIcon.tree.json +8 -2
- package/dist/ai/manifest/index.json +6 -5
- package/dist/ai/manifest/meta.json +23 -153
- package/dist/ai/manifest/types.advanced.json +78 -77
- package/dist/ai/manifest/types.api.json +29 -19
- package/dist/ai/manifest/types.wrapper.json +115 -112
- package/dist/ai/recipes/inertia/approvals-inbox.md +10 -10
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +24 -20
- package/dist/ai/recipes/inertia/onboarding.md +10 -10
- package/dist/ai/recipes/inertia/ownership-atlas.md +8 -8
- package/dist/ai/recipes/inertia/record-form.md +16 -16
- package/dist/ai/recipes/inertia/records-workspace.md +13 -12
- package/dist/ai/recipes/inertia/settings-workspace.md +16 -15
- package/dist/ai/recipes/inertia/upload-center.md +13 -13
- package/dist/ai/recipes/inertia/wizard-form.md +16 -16
- package/dist/ai/recipes/nuxt/approvals-inbox.md +13 -13
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +26 -22
- package/dist/ai/recipes/nuxt/onboarding.md +10 -10
- package/dist/ai/recipes/nuxt/ownership-atlas.md +12 -12
- package/dist/ai/recipes/nuxt/record-form.md +16 -16
- package/dist/ai/recipes/nuxt/records-workspace.md +16 -15
- package/dist/ai/recipes/nuxt/settings-workspace.md +15 -14
- package/dist/ai/recipes/nuxt/upload-center.md +15 -15
- package/dist/ai/recipes/nuxt/wizard-form.md +17 -17
- package/dist/ai/recipes/vue/approvals-inbox.md +15 -13
- package/dist/ai/recipes/vue/inline-edit-workspace.md +26 -22
- package/dist/ai/recipes/vue/onboarding.md +16 -11
- package/dist/ai/recipes/vue/ownership-atlas.md +12 -12
- package/dist/ai/recipes/vue/record-form.md +18 -16
- package/dist/ai/recipes/vue/records-workspace.md +18 -15
- package/dist/ai/recipes/vue/settings-workspace.md +18 -15
- package/dist/ai/recipes/vue/upload-center.md +15 -15
- package/dist/ai/recipes/vue/wizard-form.md +18 -16
- package/dist/ai/source/BbAccordion.md +11 -14
- package/dist/ai/source/BbAlert.md +103 -91
- package/dist/ai/source/BbAsterisk.md +6 -7
- package/dist/ai/source/BbAvatar.md +42 -41
- package/dist/ai/source/BbBadge.md +100 -89
- package/dist/ai/source/BbBadgeButton.md +80 -76
- package/dist/ai/source/BbBaseButton.md +284 -276
- package/dist/ai/source/BbBaseCheckboxIcon.md +76 -68
- package/dist/ai/source/BbBaseRadioIcon.md +80 -68
- package/dist/ai/source/BbBaseSwitchIcon.md +98 -74
- package/dist/ai/source/BbBreadcrumbs.md +76 -63
- package/dist/ai/source/BbButton.md +101 -77
- package/dist/ai/source/BbCalendar.md +166 -176
- package/dist/ai/source/BbCarousel.md +2897 -0
- package/dist/ai/source/BbCheckbox.md +230 -192
- package/dist/ai/source/BbCheckboxGroup.md +172 -79
- package/dist/ai/source/BbCollapsible.md +7 -10
- package/dist/ai/source/BbColorInput.md +256 -243
- package/dist/ai/source/BbColorPalette.md +239 -160
- package/dist/ai/source/BbConfigScope.md +123 -0
- package/dist/ai/source/BbConfirm.md +38 -32
- package/dist/ai/source/BbConfirmPortal.md +30 -26
- package/dist/ai/source/BbDatePicker.md +218 -187
- package/dist/ai/source/BbDatePickerInput.md +789 -428
- package/dist/ai/source/BbDialog.md +207 -191
- package/dist/ai/source/BbDropdown.md +326 -234
- package/dist/ai/source/BbDropdownButton.md +115 -68
- package/dist/ai/source/BbDropdownGroup.md +271 -216
- package/dist/ai/source/BbDropzone.md +101 -100
- package/dist/ai/source/BbForm.md +29 -29
- package/dist/ai/source/BbHost.md +6 -6
- package/dist/ai/source/BbHoverCard.md +34 -20
- package/dist/ai/source/BbHoverCardPortal.md +9 -12
- package/dist/ai/source/BbIcon.md +32 -30
- package/dist/ai/source/BbIndicator.md +76 -70
- package/dist/ai/source/BbNumberInput.md +334 -313
- package/dist/ai/source/BbOffCanvas.md +245 -216
- package/dist/ai/source/BbPagination.md +144 -116
- package/dist/ai/source/BbPopover.md +49 -31
- package/dist/ai/source/BbPopoverPortal.md +11 -14
- package/dist/ai/source/BbProgress.md +20 -12
- package/dist/ai/source/BbRadio.md +205 -181
- package/dist/ai/source/BbRadioGroup.md +461 -364
- package/dist/ai/source/BbRating.md +212 -177
- package/dist/ai/source/BbSelect.md +514 -482
- package/dist/ai/source/BbSelectPopover.md +497 -413
- package/dist/ai/source/BbSlider.md +1208 -777
- package/dist/ai/source/BbSmoothHeight.md +8 -9
- package/dist/ai/source/BbSpinner.md +20 -20
- package/dist/ai/source/BbSwitch.md +25 -13
- package/dist/ai/source/BbSwitchGroup.md +115 -34
- package/dist/ai/source/BbTable.md +577 -531
- package/dist/ai/source/BbTabs.md +134 -116
- package/dist/ai/source/BbTabsList.md +164 -136
- package/dist/ai/source/BbTabsPanels.md +128 -113
- package/dist/ai/source/BbTabsRoot.md +125 -110
- package/dist/ai/source/BbTag.md +286 -281
- package/dist/ai/source/BbTextInput.md +59 -50
- package/dist/ai/source/BbTextarea.md +85 -71
- package/dist/ai/source/BbTimePicker.md +145 -126
- package/dist/ai/source/BbTimePickerInput.md +383 -316
- package/dist/ai/source/BbToast.md +97 -44
- package/dist/ai/source/BbToastPortal.md +56 -36
- package/dist/ai/source/BbTooltip.md +155 -129
- package/dist/ai/source/BbTree.md +16 -12
- package/dist/ai/source/CommonField.md +94 -59
- package/dist/ai/source/CommonFieldInput.md +18 -13
- package/dist/ai/source/CommonPopover.md +28 -9
- package/dist/ai/source/CommonTimeSelector.md +41 -8
- package/dist/ai/source/FlatListBox.md +16 -5
- package/dist/ai/source/GroupedListBox.md +18 -6
- package/dist/ai/source/ListBox.md +2 -1
- package/dist/ai/source/OptionsContainer.md +82 -4
- package/dist/assets/svgs/arrow_up.svg_raw.js +3 -0
- package/dist/assets/svgs/caret_down.svg_raw.js +3 -0
- package/dist/assets/svgs/chevron_left.svg_raw.js +3 -0
- package/dist/assets/svgs/chevron_left_small.svg_raw.js +3 -0
- package/dist/assets/svgs/chevron_right_small.svg_raw.js +3 -0
- package/dist/assets/svgs/close.svg_raw.js +3 -0
- package/dist/assets/svgs/eyedropper.svg_raw.js +3 -0
- package/dist/assets/svgs/move.svg_raw.js +3 -0
- package/dist/assets/svgs/pause.svg_raw.js +3 -0
- package/dist/assets/svgs/play.svg_raw.js +3 -0
- package/dist/assets/svgs/star.svg_raw.js +1 -1
- package/dist/assets/svgs/x.svg_raw.js +3 -0
- package/dist/calendar-runtime.js +112 -0
- package/dist/calendars.js +83 -0
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +2 -2
- package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/BbAccordion/ptKeys.generated.d.ts +44 -0
- package/dist/components/BbAccordion/types.d.ts +5 -6
- package/dist/components/BbAlert/BbAlert.vue.d.ts +5 -4
- package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +52 -48
- package/dist/components/BbAlert/ptKeys.generated.d.ts +104 -0
- package/dist/components/BbAlert/types.d.ts +16 -9
- package/dist/components/BbAsterisk/BbAsterisk.vue.d.ts +2 -2
- package/dist/components/BbAsterisk/ptKeys.generated.d.ts +8 -0
- package/dist/components/BbAsterisk/types.d.ts +4 -5
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +3 -3
- package/dist/components/BbAvatar/BbAvatar.vue_vue_type_script_setup_true_lang.js +54 -53
- package/dist/components/BbAvatar/ptKeys.generated.d.ts +12 -0
- package/dist/components/BbAvatar/types.d.ts +5 -6
- package/dist/components/BbBadge/BbBadge.vue.d.ts +4 -4
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +75 -71
- package/dist/components/BbBadge/BbBadgeButton.vue.d.ts +2 -2
- package/dist/components/BbBadge/badgeButtonContext.d.ts +5 -5
- package/dist/components/BbBadge/ptKeys.generated.d.ts +160 -0
- package/dist/components/BbBadge/types.d.ts +17 -10
- package/dist/components/BbBaseButton/BbBaseButton.vue.d.ts +2 -2
- package/dist/components/BbBaseButton/ptKeys.generated.d.ts +20 -0
- package/dist/components/BbBaseButton/types.d.ts +13 -6
- package/dist/components/BbBaseButton/useLinkState.d.ts +1 -1
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue.d.ts +2 -2
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/BbBaseCheckboxIcon/ptKeys.generated.d.ts +40 -0
- package/dist/components/BbBaseCheckboxIcon/types.d.ts +12 -6
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue.d.ts +2 -2
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/BbBaseRadioIcon/ptKeys.generated.d.ts +36 -0
- package/dist/components/BbBaseRadioIcon/types.d.ts +12 -6
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue.d.ts +2 -2
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/BbBaseSwitchIcon/ptKeys.generated.d.ts +40 -0
- package/dist/components/BbBaseSwitchIcon/types.d.ts +12 -6
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +2 -2
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/BbBreadcrumbs/ptKeys.generated.d.ts +48 -0
- package/dist/components/BbBreadcrumbs/types.d.ts +15 -8
- package/dist/components/BbButton/BbButton.vue.d.ts +6 -4
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +130 -118
- package/dist/components/BbButton/ptKeys.generated.d.ts +196 -0
- package/dist/components/BbButton/toggleRoving.js +29 -28
- package/dist/components/BbButton/types.d.ts +29 -21
- package/dist/components/BbCalendar/BbCalendar.vue.d.ts +9 -71
- package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +327 -340
- package/dist/components/BbCalendar/CalendarMonthPanel.vue_vue_type_script_setup_true_lang.js +67 -65
- package/dist/components/BbCalendar/CalendarYearPanel.vue_vue_type_script_setup_true_lang.js +76 -67
- package/dist/components/BbCalendar/calendarHost.d.ts +1 -1
- package/dist/components/BbCalendar/calendarMath.d.ts +102 -0
- package/dist/components/BbCalendar/calendarMath.js +124 -0
- package/dist/components/BbCalendar/ptKeys.generated.d.ts +248 -0
- package/dist/components/BbCalendar/types.d.ts +15 -9
- package/dist/components/BbCalendar/useCalendarContext.d.ts +43 -17
- package/dist/components/BbCalendar/useCalendarGrid.d.ts +71 -4
- package/dist/components/BbCalendar/useCalendarGrid.js +264 -209
- package/dist/components/BbCalendar/useDayGrid.d.ts +26 -8
- package/dist/components/BbCalendar/useDayGrid.js +178 -172
- package/dist/components/BbCalendar/useDayjsLocale.d.ts +18 -3
- package/dist/components/BbCalendar/useDayjsLocale.js +28 -28
- package/dist/components/BbCalendar/useToday.d.ts +5 -3
- package/dist/components/BbCalendar/useToday.js +22 -12
- package/dist/components/BbCarousel/BbCarousel.vue.d.ts +51 -0
- package/dist/components/BbCarousel/BbCarousel.vue.js +5 -0
- package/dist/components/BbCarousel/BbCarousel.vue_vue_type_script_setup_true_lang.js +818 -0
- package/dist/components/BbCarousel/ptKeys.generated.d.ts +60 -0
- package/dist/components/BbCarousel/types.d.ts +213 -0
- package/dist/components/BbCarousel/types.js +27 -0
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +8 -6
- package/dist/components/BbCheckbox/BbCheckbox.vue_vue_type_script_setup_true_lang.js +123 -111
- package/dist/components/BbCheckbox/ptKeys.generated.d.ts +220 -0
- package/dist/components/BbCheckbox/types.d.ts +30 -14
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +167 -306
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +222 -189
- package/dist/components/BbCheckboxGroup/ptKeys.generated.d.ts +492 -0
- package/dist/components/BbCheckboxGroup/types.d.ts +42 -28
- package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +4 -4
- package/dist/components/BbCollapsible/BbCollapsible.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbCollapsible/ptKeys.generated.d.ts +20 -0
- package/dist/components/BbCollapsible/types.d.ts +5 -6
- package/dist/components/BbColorInput/BbColorInput.vue.d.ts +16 -14
- package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +206 -195
- package/dist/components/BbColorInput/ptKeys.generated.d.ts +656 -0
- package/dist/components/BbColorInput/types.d.ts +30 -20
- package/dist/components/BbColorInput/types.js +1 -1
- package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +4 -4
- package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +331 -296
- package/dist/components/BbColorPalette/ptKeys.generated.d.ts +40 -0
- package/dist/components/BbColorPalette/types.d.ts +17 -10
- package/dist/components/BbConfigScope/BbConfigScope.vue.d.ts +12 -0
- package/dist/components/BbConfigScope/BbConfigScope.vue.js +4 -0
- package/dist/components/BbConfigScope/BbConfigScope.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/BbConfigScope/types.d.ts +20 -0
- package/dist/components/BbConfirm/BbConfirm.vue.d.ts +1 -1
- package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +1 -1
- package/dist/components/BbConfirm/confirmEntry.d.ts +2 -2
- package/dist/components/BbConfirm/ptKeys.generated.d.ts +184 -0
- package/dist/components/BbConfirm/types.d.ts +14 -7
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +16 -97
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +201 -197
- package/dist/components/BbDatePicker/ptKeys.generated.d.ts +324 -0
- package/dist/components/BbDatePicker/types.d.ts +22 -15
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +20 -309
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +793 -660
- package/dist/components/BbDatePickerInput/calendarFields.d.ts +91 -0
- package/dist/components/BbDatePickerInput/calendarFields.js +188 -0
- package/dist/components/BbDatePickerInput/dateFieldLayout.d.ts +6 -0
- package/dist/components/BbDatePickerInput/dateFieldLayout.js +11 -1
- package/dist/components/BbDatePickerInput/ptKeys.generated.d.ts +1156 -0
- package/dist/components/BbDatePickerInput/types.d.ts +36 -26
- package/dist/components/BbDatePickerInput/types.js +1 -1
- package/dist/components/BbDialog/BbDialog.vue.d.ts +9 -8
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +211 -204
- package/dist/components/BbDialog/ptKeys.generated.d.ts +100 -0
- package/dist/components/BbDialog/types.d.ts +26 -20
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +1 -1
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +7 -6
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +399 -377
- package/dist/components/BbDropdown/BbDropdownGroup.vue.d.ts +2 -2
- package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +1 -1
- package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +297 -292
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +97 -97
- package/dist/components/BbDropdown/DropdownRow.vue.d.ts +3 -3
- package/dist/components/BbDropdown/DropdownRow.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbDropdown/normalizeGroups.d.ts +2 -2
- package/dist/components/BbDropdown/pointerTrail.d.ts +5 -0
- package/dist/components/BbDropdown/pointerTrail.js +26 -0
- package/dist/components/BbDropdown/ptKeys.generated.d.ts +228 -0
- package/dist/components/BbDropdown/types.d.ts +65 -48
- package/dist/components/BbDropdown/types.js +11 -2
- package/dist/components/BbDropdown/useDropdownContext.d.ts +3 -3
- package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +5 -5
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +7 -6
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +168 -144
- package/dist/components/BbDropdownButton/ptKeys.generated.d.ts +616 -0
- package/dist/components/BbDropdownButton/types.d.ts +47 -23
- package/dist/components/BbDropdownButton/types.js +7 -3
- package/dist/components/BbDropzone/BbDropzone.vue.d.ts +7 -26
- package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +14 -14
- package/dist/components/BbDropzone/ptKeys.generated.d.ts +76 -0
- package/dist/components/BbDropzone/types.d.ts +15 -8
- package/dist/components/BbForm/BbForm.vue.d.ts +5 -5
- package/dist/components/BbForm/BbFormCustomField.d.ts +1 -1
- package/dist/components/BbForm/BbFormCustomField.js +2 -2
- package/dist/components/BbForm/bindFormField.d.ts +4 -4
- package/dist/components/BbForm/bindFormField.js +66 -66
- package/dist/components/BbForm/formFields.d.ts +5 -5
- package/dist/components/BbForm/formSchema.d.ts +4 -4
- package/dist/components/BbHost/BbHost.vue.d.ts +1 -1
- package/dist/components/BbHost/BbHost.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbHost/BbHostOpening.d.ts +4 -4
- package/dist/components/BbHost/types.d.ts +3 -3
- package/dist/components/BbHoverCard/BbHoverCard.vue.d.ts +4 -4
- package/dist/components/BbHoverCard/BbHoverCard.vue_vue_type_script_setup_true_lang.js +169 -162
- package/dist/components/BbHoverCard/BbHoverCardPortal.vue.d.ts +1 -1
- package/dist/components/BbHoverCard/ptKeys.generated.d.ts +44 -0
- package/dist/components/BbHoverCard/types.d.ts +8 -9
- package/dist/components/BbIcon/BbIcon.vue.d.ts +3 -3
- package/dist/components/BbIcon/BbIcon.vue_vue_type_script_setup_true_lang.js +41 -40
- package/dist/components/BbIcon/ptKeys.generated.d.ts +8 -0
- package/dist/components/BbIcon/types.d.ts +7 -8
- package/dist/components/BbIndicator/BbIndicator.vue.d.ts +4 -4
- package/dist/components/BbIndicator/BbIndicator.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbIndicator/ptKeys.generated.d.ts +52 -0
- package/dist/components/BbIndicator/types.d.ts +15 -8
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +15 -12
- package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +327 -311
- package/dist/components/BbNumberInput/numberDisplay.d.ts +10 -11
- package/dist/components/BbNumberInput/ptKeys.generated.d.ts +476 -0
- package/dist/components/BbNumberInput/types.d.ts +33 -22
- package/dist/components/BbNumberInput/types.js +1 -1
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +9 -9
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +408 -406
- package/dist/components/BbOffCanvas/ptKeys.generated.d.ts +88 -0
- package/dist/components/BbOffCanvas/sheetAttrs.d.ts +1 -1
- package/dist/components/BbOffCanvas/sheetSnap.d.ts +2 -2
- package/dist/components/BbOffCanvas/types.d.ts +30 -23
- package/dist/components/BbOffCanvas/useOffCanvasStack.d.ts +1 -1
- package/dist/components/BbPagination/BbPagination.vue.d.ts +3 -3
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +110 -114
- package/dist/components/BbPagination/paginationFit.d.ts +1 -1
- package/dist/components/BbPagination/ptKeys.generated.d.ts +48 -0
- package/dist/components/BbPagination/types.d.ts +16 -8
- package/dist/components/BbPopover/BbPopover.vue.d.ts +4 -4
- package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +121 -115
- package/dist/components/BbPopover/BbPopoverPortal.vue.d.ts +1 -1
- package/dist/components/BbPopover/ptKeys.generated.d.ts +52 -0
- package/dist/components/BbPopover/types.d.ts +10 -11
- package/dist/components/BbProgress/BbProgress.vue.d.ts +2 -2
- package/dist/components/BbProgress/BbProgress.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbProgress/ptKeys.generated.d.ts +20 -0
- package/dist/components/BbProgress/types.d.ts +4 -5
- package/dist/components/BbRadio/BbRadio.vue.d.ts +8 -6
- package/dist/components/BbRadio/BbRadio.vue_vue_type_script_setup_true_lang.js +134 -122
- package/dist/components/BbRadio/ptKeys.generated.d.ts +196 -0
- package/dist/components/BbRadio/types.d.ts +24 -13
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +152 -248
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +248 -215
- package/dist/components/BbRadioGroup/ptKeys.generated.d.ts +492 -0
- package/dist/components/BbRadioGroup/types.d.ts +41 -24
- package/dist/components/BbRating/BbRating.vue.d.ts +9 -7
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +153 -142
- package/dist/components/BbRating/ptKeys.generated.d.ts +152 -0
- package/dist/components/BbRating/types.d.ts +31 -20
- package/dist/components/BbRating/types.js +1 -1
- package/dist/components/BbSelect/BbSelect.vue.d.ts +269 -483
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +362 -341
- package/dist/components/BbSelect/ptKeys.generated.d.ts +960 -0
- package/dist/components/BbSelect/types.d.ts +50 -37
- package/dist/components/BbSelect/types.js +4 -2
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +23 -50
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +750 -730
- package/dist/components/BbSelectPopover/knownItems.d.ts +4 -4
- package/dist/components/BbSelectPopover/ptKeys.generated.d.ts +148 -0
- package/dist/components/BbSelectPopover/reclickClears.d.ts +17 -0
- package/dist/components/BbSelectPopover/reclickClears.js +4 -0
- package/dist/components/BbSelectPopover/sheetChipAttrs.d.ts +1 -1
- package/dist/components/BbSelectPopover/types.d.ts +44 -31
- package/dist/components/BbSelectPopover/types.js +3 -1
- package/dist/components/BbSlider/BbSlider.vue.d.ts +27 -86
- package/dist/components/BbSlider/BbSlider.vue_vue_type_script_setup_true_lang.js +414 -331
- package/dist/components/BbSlider/ptKeys.generated.d.ts +316 -0
- package/dist/components/BbSlider/types.d.ts +162 -61
- package/dist/components/BbSlider/types.js +2 -0
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +3 -3
- package/dist/components/BbSmoothHeight/ptKeys.generated.d.ts +8 -0
- package/dist/components/BbSmoothHeight/types.d.ts +5 -6
- package/dist/components/BbSpinner/BbSpinner.vue.d.ts +3 -3
- package/dist/components/BbSpinner/ptKeys.generated.d.ts +8 -0
- package/dist/components/BbSpinner/types.d.ts +5 -6
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +6 -6
- package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +30 -30
- package/dist/components/BbSwitch/ptKeys.generated.d.ts +220 -0
- package/dist/components/BbSwitch/types.d.ts +15 -5
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +38 -116
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +13 -10
- package/dist/components/BbSwitchGroup/ptKeys.generated.d.ts +332 -0
- package/dist/components/BbSwitchGroup/types.d.ts +14 -5
- package/dist/components/BbTable/BbTable.vue.d.ts +13 -13
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +1360 -1366
- package/dist/components/BbTable/BbTableDataRow.d.ts +4 -4
- package/dist/components/BbTable/BbTableEdgeRow.d.ts +5 -5
- package/dist/components/BbTable/BbTableExpandRow.d.ts +2 -2
- package/dist/components/BbTable/BbTableSelectToggle.d.ts +3 -3
- package/dist/components/BbTable/estimatedFloors.golden.d.ts +1 -1
- package/dist/components/BbTable/gridWidgets.d.ts +1 -1
- package/dist/components/BbTable/measuredFloors.d.ts +1 -1
- package/dist/components/BbTable/measuredFloorsTestKit.d.ts +1 -1
- package/dist/components/BbTable/ptKeys.generated.d.ts +280 -0
- package/dist/components/BbTable/types.d.ts +30 -22
- package/dist/components/BbTable/utils.d.ts +5 -5
- package/dist/components/BbTable/utils.js +89 -88
- package/dist/components/BbTabs/BbTabs.vue.d.ts +41 -69
- package/dist/components/BbTabs/BbTabs.vue_vue_type_script_setup_true_lang.js +21 -15
- package/dist/components/BbTabs/BbTabsList.vue.d.ts +3 -3
- package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +121 -122
- package/dist/components/BbTabs/BbTabsPanels.vue.d.ts +3 -3
- package/dist/components/BbTabs/BbTabsPanels.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbTabs/BbTabsRoot.vue.d.ts +2 -2
- package/dist/components/BbTabs/ptKeys.generated.d.ts +226 -0
- package/dist/components/BbTabs/types.d.ts +41 -23
- package/dist/components/BbTag/BbTag.vue.d.ts +18 -16
- package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +248 -238
- package/dist/components/BbTag/ptKeys.generated.d.ts +540 -0
- package/dist/components/BbTag/types.d.ts +28 -18
- package/dist/components/BbTag/types.js +1 -1
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +19 -171
- package/dist/components/BbTextInput/BbTextInput.vue_vue_type_script_setup_true_lang.js +176 -165
- package/dist/components/BbTextInput/ptKeys.generated.d.ts +608 -0
- package/dist/components/BbTextInput/types.d.ts +30 -21
- package/dist/components/BbTextInput/types.js +1 -1
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +19 -171
- package/dist/components/BbTextarea/BbTextarea.vue_vue_type_script_setup_true_lang.js +206 -196
- package/dist/components/BbTextarea/ptKeys.generated.d.ts +608 -0
- package/dist/components/BbTextarea/types.d.ts +29 -20
- package/dist/components/BbTextarea/types.js +1 -1
- package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +13 -33
- package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +137 -136
- package/dist/components/BbTimePicker/ptKeys.generated.d.ts +80 -0
- package/dist/components/BbTimePicker/types.d.ts +19 -13
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +18 -201
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +421 -397
- package/dist/components/BbTimePickerInput/ptKeys.generated.d.ts +732 -0
- package/dist/components/BbTimePickerInput/types.d.ts +35 -23
- package/dist/components/BbTimePickerInput/types.js +1 -1
- package/dist/components/BbToast/BbToast.vue.d.ts +2 -2
- package/dist/components/BbToast/BbToast.vue_vue_type_script_setup_true_lang.js +60 -53
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +2 -2
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +75 -80
- package/dist/components/BbToast/BbToastPortal.vue.d.ts +1 -1
- package/dist/components/BbToast/BbToastRegion.vue.d.ts +5 -3
- package/dist/components/BbToast/ptKeys.generated.d.ts +232 -0
- package/dist/components/BbToast/types.d.ts +22 -13
- package/dist/components/BbTooltip/BbTooltip.vue.d.ts +6 -6
- package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +99 -88
- package/dist/components/BbTooltip/ptKeys.generated.d.ts +36 -0
- package/dist/components/BbTooltip/tooltipWarmup.d.ts +2 -2
- package/dist/components/BbTooltip/types.d.ts +16 -9
- package/dist/components/BbTree/BbTree.vue.d.ts +7 -11
- package/dist/components/BbTree/BbTreeLevel.vue.d.ts +1 -1
- package/dist/components/BbTree/context.d.ts +2 -2
- package/dist/components/BbTree/ptKeys.generated.d.ts +16 -0
- package/dist/components/BbTree/types.d.ts +5 -6
- package/dist/components/ChipsBox/ChipsBox.vue.d.ts +2 -2
- package/dist/components/ChipsBox/types.d.ts +2 -2
- package/dist/components/ClearableButton/ClearableButton.vue.d.ts +2 -2
- package/dist/components/CloseIcon/CloseButton.vue.d.ts +2 -2
- package/dist/components/CloseIcon/CloseButton.vue.js +1 -1
- package/dist/components/CloseIcon/CloseButton.vue_vue_type_script_setup_true_lang.js +11 -16
- package/dist/components/CommaBox/CommaBox.vue.d.ts +2 -2
- package/dist/components/CommaBox/types.d.ts +2 -2
- package/dist/components/CommonField/CommonField.vue.d.ts +7 -7
- package/dist/components/CommonField/CommonField.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/components/CommonField/messageHeightMatrix.d.ts +1 -1
- package/dist/components/CommonField/types.d.ts +18 -14
- package/dist/components/CommonFieldInput/CommonFieldInput.vue.d.ts +3 -3
- package/dist/components/CommonFieldInput/types.d.ts +4 -4
- package/dist/components/CommonPopover/CommonPopover.vue.d.ts +4 -4
- package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +56 -55
- package/dist/components/CommonPopover/resolvePlacement.d.ts +9 -0
- package/dist/components/CommonPopover/resolvePlacement.js +9 -0
- package/dist/components/CommonPopover/types.d.ts +5 -5
- package/dist/components/CommonTimeSelector/CommonTimeSelector.vue.d.ts +2 -2
- package/dist/components/CommonTimeSelector/CommonTimeSelector.vue_vue_type_script_setup_true_lang.js +110 -99
- package/dist/components/CommonTimeSelector/useMeridiem.d.ts +1 -1
- package/dist/components/ErrorIcon/ErrorIcon.vue.d.ts +2 -2
- package/dist/components/FlatListBox/FlatListBox.vue.d.ts +2 -2
- package/dist/components/FlatListBox/FlatListBox.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/components/FlatListBox/types.d.ts +3 -3
- package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +2 -2
- package/dist/components/GroupedListBox/GroupedListBox.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/components/GroupedListBox/types.d.ts +3 -3
- package/dist/components/ListBox/ListBox.vue.d.ts +2 -2
- package/dist/components/ListBox/types.d.ts +3 -3
- package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +1 -1
- package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +101 -69
- package/dist/components/OptionsContainer/types.d.ts +8 -3
- package/dist/components/Transitions/Slide.vue.d.ts +5 -3
- package/dist/components/Transitions/Slide.vue.js +1 -1
- package/dist/components/WarningIcon/WarningIcon.vue.d.ts +2 -2
- package/dist/composables/autoHost.d.ts +1 -1
- package/dist/composables/formSubmitLock.d.ts +5 -5
- package/dist/composables/hostOpenings.d.ts +6 -6
- package/dist/composables/hostRegistry.d.ts +2 -2
- package/dist/composables/overlayRegistry.d.ts +25 -25
- package/dist/composables/overlayRegistry.js +13 -7
- package/dist/composables/useBaseOptions.d.ts +2 -2
- package/dist/composables/useBbConfig.d.ts +5 -5
- package/dist/composables/useBbDialog.d.ts +17 -17
- package/dist/composables/useBbDialog.js +2 -1
- package/dist/composables/useBbDropdown.d.ts +1 -1
- package/dist/composables/useBbForm.d.ts +2 -2
- package/dist/composables/useBbFormField.d.ts +4 -4
- package/dist/composables/useBbOffCanvas.d.ts +6 -6
- package/dist/composables/useBbTable.d.ts +4 -4
- package/dist/composables/useBbTabs.d.ts +4 -4
- package/dist/composables/useBbTabs.js +99 -94
- package/dist/composables/useBreakpoint.d.ts +1 -1
- package/dist/composables/useCharacterCounter.d.ts +2 -2
- package/dist/composables/useChoiceIndicator.d.ts +2 -2
- package/dist/composables/useClosingInert.d.ts +1 -1
- package/dist/composables/useConfig.d.ts +3 -3
- package/dist/composables/useConfig.js +2 -9
- package/dist/composables/useConfigDefaults.d.ts +54 -0
- package/dist/composables/useConfigDefaults.js +56 -0
- package/dist/composables/useConfirm.d.ts +18 -18
- package/dist/composables/useDirection.d.ts +43 -0
- package/dist/composables/useDirection.js +12 -0
- package/dist/composables/useFormBinding.d.ts +5 -5
- package/dist/composables/useFormBinding.js +3 -3
- package/dist/composables/useId.d.ts +1 -1
- package/dist/composables/useItemsGetter.d.ts +3 -3
- package/dist/composables/useKeyboardInset.d.ts +1 -1
- package/dist/composables/useListboxFocus.d.ts +1 -1
- package/dist/composables/useLocale.d.ts +2 -2
- package/dist/composables/useOnDemandOpener.d.ts +3 -3
- package/dist/composables/useOverlayNavigation.d.ts +1 -1
- package/dist/composables/useOverlayYield.d.ts +1 -1
- package/dist/composables/usePassthrough.d.ts +13 -11
- package/dist/composables/usePassthrough.js +137 -133
- package/dist/composables/useQuery.d.ts +1 -1
- package/dist/composables/useRefusedCloseAnnouncement.d.ts +1 -1
- package/dist/composables/useSafeArea.d.ts +1 -1
- package/dist/composables/useSafeAreaInternal.d.ts +1 -1
- package/dist/composables/useSegmentedFields.d.ts +25 -0
- package/dist/composables/useSegmentedFields.js +165 -115
- package/dist/composables/useServerPrefetch.d.ts +2 -2
- package/dist/composables/useSheetSurface.d.ts +1 -1
- package/dist/composables/useSsrState.d.ts +2 -2
- package/dist/composables/useToast.d.ts +13 -5
- package/dist/composables/useToast.js +52 -38
- package/dist/composables/useTypeahead.js +22 -21
- package/dist/deprecation/ai-deprecations.json.d.ts +160 -15
- package/dist/deprecation/ai-deprecations.json.js +1 -1
- package/dist/deprecation/removedProps.d.ts +1 -1
- package/dist/directives/bbColor.d.ts +1 -1
- package/dist/directives/bbDate.d.ts +1 -1
- package/dist/directives/bbDialog.d.ts +3 -3
- package/dist/directives/bbDropdown.d.ts +1 -1
- package/dist/directives/bbDropdown.js +7 -7
- package/dist/directives/bbHoverCard.d.ts +3 -3
- package/dist/directives/bbOffCanvas.d.ts +2 -2
- package/dist/directives/bbPopover.d.ts +3 -3
- package/dist/directives/bbTime.d.ts +1 -1
- package/dist/directives/bbTooltip.d.ts +4 -4
- package/dist/directives/directivePortal.d.ts +4 -4
- package/dist/directives/overlayTrigger.d.ts +4 -4
- package/dist/directives/overlayTrigger.js +2 -1
- package/dist/i18n/eraNames.d.ts +2 -0
- package/dist/i18n/eraNames.js +2013 -0
- package/dist/i18n/index.d.ts +9 -7
- package/dist/i18n/localeTags.d.ts +36 -0
- package/dist/i18n/locales/ar.json +176 -0
- package/dist/i18n/locales/cs.json +23 -3
- package/dist/i18n/locales/da.json +23 -3
- package/dist/i18n/locales/de-CH.json +23 -3
- package/dist/i18n/locales/de.json +23 -3
- package/dist/i18n/locales/el.json +23 -3
- package/dist/i18n/locales/en-GB.json +23 -3
- package/dist/i18n/locales/en.json +23 -3
- package/dist/i18n/locales/es-MX.json +23 -3
- package/dist/i18n/locales/es.json +23 -3
- package/dist/i18n/locales/fa.json +176 -0
- package/dist/i18n/locales/fi.json +23 -3
- package/dist/i18n/locales/fr.json +23 -3
- package/dist/i18n/locales/he.json +176 -0
- package/dist/i18n/locales/hu.json +23 -3
- package/dist/i18n/locales/it.json +23 -3
- package/dist/i18n/locales/ja.json +23 -3
- package/dist/i18n/locales/ko.json +23 -3
- package/dist/i18n/locales/nb.json +23 -3
- package/dist/i18n/locales/nl.json +23 -3
- package/dist/i18n/locales/pl.json +23 -3
- package/dist/i18n/locales/pt-BR.json +23 -3
- package/dist/i18n/locales/pt-PT.json +23 -3
- package/dist/i18n/locales/ro.json +23 -3
- package/dist/i18n/locales/ru.json +23 -3
- package/dist/i18n/locales/sv.json +23 -3
- package/dist/i18n/locales/tr.json +23 -3
- package/dist/i18n/locales/uk.json +23 -3
- package/dist/i18n/locales/zh-CN.json +23 -3
- package/dist/i18n/locales/zh-HK.json +23 -3
- package/dist/i18n/locales/zh-TW.json +23 -3
- package/dist/i18n/regionHints.js +22 -22
- package/dist/i18n/regions.d.ts +73 -24
- package/dist/i18n/regions.js +57 -12
- package/dist/index.d.ts +192 -190
- package/dist/index.js +55 -54
- package/dist/llms-full.txt +8848 -5872
- package/dist/llms-medium.txt +830 -506
- package/dist/llms.txt +6 -5
- package/dist/locale-blueprint.json +26 -3
- package/dist/locale-tags.js +81 -0
- package/dist/mcp-sdk.LICENSES.txt +210 -0
- package/dist/mcp-sdk.mjs +78 -0
- package/dist/nuxt-auto-imports.d.ts +1 -1
- package/dist/nuxt-auto-imports.js +1 -1
- package/dist/nuxt-module.d.ts +5 -5
- package/dist/nuxt.js +26 -23
- package/dist/plugin.d.ts +2 -2
- package/dist/project-dts.d.ts +76 -14
- package/dist/project-dts.js +117 -63
- package/dist/setup-kit.LICENSES.txt +23 -0
- package/dist/setup-kit.mjs +9 -0
- package/dist/styles.css +2 -2
- package/dist/types/ActionButton.d.ts +3 -3
- package/dist/types/AlertVariant.d.ts +2 -2
- package/dist/types/BadgeVariant.d.ts +2 -2
- package/dist/types/ButtonVariant.d.ts +2 -2
- package/dist/types/CheckboxVariant.d.ts +9 -6
- package/dist/types/CheckboxVariant.js +5 -1
- package/dist/types/ColumnName.d.ts +1 -1
- package/dist/types/CommonProps.d.ts +25 -3
- package/dist/types/Config.d.ts +24 -110
- package/dist/types/ConfigDefaults.d.ts +352 -0
- package/dist/types/ConfigDefaults.js +115 -0
- package/dist/types/ConfirmVariant.d.ts +2 -2
- package/dist/types/DatePickerType.d.ts +29 -2
- package/dist/types/DatePickerType.js +6 -2
- package/dist/types/DropdownItemVariant.d.ts +2 -2
- package/dist/types/FieldLayout.d.ts +3 -3
- package/dist/types/IndicatorVariant.d.ts +2 -2
- package/dist/types/InputVariant.d.ts +58 -25
- package/dist/types/ItemAccessor.d.ts +7 -1
- package/dist/types/ItemProps.d.ts +3 -3
- package/dist/types/ItemsProvider.d.ts +2 -2
- package/dist/types/Placement.d.ts +7 -2
- package/dist/types/RadioVariant.d.ts +9 -6
- package/dist/types/RadioVariant.js +5 -1
- package/dist/types/ShapeErased.d.ts +1 -1
- package/dist/types/SizeScale.d.ts +4 -0
- package/dist/types/SizeScale.js +17 -0
- package/dist/types/TabsVariant.d.ts +2 -2
- package/dist/types/ToastVariant.d.ts +2 -2
- package/dist/types/TooltipVariant.d.ts +2 -2
- package/dist/types/fallthrough.d.ts +1 -1
- package/dist/types/passthrough.d.ts +23 -23
- package/dist/types/ptComponentMap.d.ts +29 -28
- package/dist/utilities/calendar/canonicalParts.d.ts +29 -0
- package/dist/utilities/calendar/canonicalParts.js +12 -0
- package/dist/utilities/calendar/digits.d.ts +18 -0
- package/dist/utilities/calendar/digits.js +26 -0
- package/dist/utilities/calendar/gregorian.d.ts +2 -0
- package/dist/utilities/calendar/gregorian.js +36 -0
- package/dist/utilities/calendar/index.d.ts +3 -0
- package/dist/utilities/calendar/index.js +1 -0
- package/dist/utilities/calendar/international.d.ts +19 -0
- package/dist/utilities/calendar/resolve.d.ts +32 -0
- package/dist/utilities/calendar/resolve.js +12 -0
- package/dist/utilities/calendar/runtime.d.ts +49 -0
- package/dist/utilities/calendar/types.d.ts +140 -0
- package/dist/utilities/calendar/types.js +83 -0
- package/dist/utilities/functions/convertDateValue.d.ts +15 -2
- package/dist/utilities/functions/convertDateValue.js +22 -17
- package/dist/utilities/functions/elementLabel.d.ts +1 -1
- package/dist/utilities/functions/extractDomContainer.d.ts +1 -1
- package/dist/utilities/functions/isDateDisabled.d.ts +9 -1
- package/dist/utilities/functions/isDateDisabled.js +38 -21
- package/dist/utilities/functions/itemProps.d.ts +1 -1
- package/dist/utilities/functions/normalizeDateBound.d.ts +45 -2
- package/dist/utilities/functions/normalizeDateBound.js +52 -11
- package/dist/utilities/functions/parseSize.d.ts +2 -2
- package/dist/utilities/functions/readableValue.d.ts +1 -1
- package/dist/utilities/functions/responsiveDefault.d.ts +1 -1
- package/dist/utilities/functions/searchRank.d.ts +19 -0
- package/dist/utilities/functions/searchRank.js +76 -0
- package/dist/utilities/functions/slotKey.d.ts +1 -1
- package/dist/utilities/functions/toggleInput.d.ts +1 -1
- package/dist/utilities/functions/warnRemovedAttrs.d.ts +3 -3
- package/dist/utilities/functions/when.d.ts +1 -1
- package/dist/utilities/misc/autofocus.d.ts +2 -2
- package/dist/utilities/misc/listboxMetrics.d.ts +2 -2
- package/dist/utilities/misc/maskaDataOptions.d.ts +1 -1
- package/dist/utilities/misc/ssrStateInjectionKey.d.ts +1 -1
- package/dist/utilities/misc/ssrValue.d.ts +1 -1
- package/dist/utils/configDefaults.d.ts +43 -0
- package/dist/utils/configDefaults.js +170 -0
- package/dist/utils/configScope.d.ts +43 -0
- package/dist/utils/configScope.js +13 -0
- package/dist/utils/copyData.d.ts +2 -2
- package/dist/utils/cssLayers.d.ts +1 -1
- package/dist/utils/focusVisibility.d.ts +1 -1
- package/dist/utils/injectLibraryStyles.d.ts +1 -1
- package/dist/utils/overlayEscapeStack.d.ts +1 -1
- package/dist/utils/passthrough.d.ts +5 -8
- package/dist/utils/passthrough.js +31 -29
- package/dist/utils/passthroughDeduper.d.ts +1 -1
- package/dist/utils/releasedActivator.d.ts +20 -0
- package/dist/utils/releasedActivator.js +11 -0
- package/dist/utils/versionCheck.d.ts +1 -1
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite-plugin.d.ts +139 -218
- package/dist/vite.js +451 -425
- package/llms.txt +6 -5
- package/package.json +51 -19
- package/scripts/README.md +2 -1
- package/scripts/lib/adoption-checklist.json +2 -2
- package/scripts/lib/agent-manifest.mjs +107 -22
- package/scripts/lib/agent-refresh.mjs +151 -0
- package/scripts/lib/agent-setup.mjs +679 -0
- package/scripts/lib/carousel-items-without-slide.mjs +263 -0
- package/scripts/lib/carousel-prop-or-local.mjs +117 -0
- package/scripts/lib/check-fix.mjs +1 -1
- package/scripts/lib/collapsible-trigger-aria.mjs +1 -1
- package/scripts/lib/css-class-check.mjs +3 -3
- package/scripts/lib/css-local-check.mjs +25 -17
- package/scripts/lib/css-surface-answer.mjs +117 -0
- package/scripts/lib/define-preset-copy.mjs +1 -1
- package/scripts/lib/distributed-alias.mjs +81 -0
- package/scripts/lib/doc-sections.mjs +12 -4
- package/scripts/lib/dropdown-default-slot.mjs +1 -1
- package/scripts/lib/eslint-disable.mjs +60 -2
- package/scripts/lib/eslint-plugin.d.ts +13 -2
- package/scripts/lib/eslint-plugin.mjs +609 -64
- package/scripts/lib/form-v-model.mjs +1 -1
- package/scripts/lib/hand-imported-styles.mjs +2 -2
- package/scripts/lib/hand-roll-hints.mjs +25 -3
- package/scripts/lib/helper-canon.mjs +4 -4
- package/scripts/lib/helpers-add.mjs +39 -24
- package/scripts/lib/hidden-label-placeholder.mjs +1 -1
- package/scripts/lib/idiom-scan.mjs +12 -11
- package/scripts/lib/is-direct-run.mjs +20 -0
- package/scripts/lib/items-provider-context.mjs +1 -1
- package/scripts/lib/linked-target.mjs +26 -2
- package/scripts/lib/local-components.mjs +2 -2
- package/scripts/lib/locale-check.mjs +109 -13
- package/scripts/lib/mcp-config.mjs +140 -75
- package/scripts/lib/mcp-sdk.mjs +199 -0
- package/scripts/lib/migrate-fix.mjs +3 -3
- package/scripts/lib/plugin-options-check.mjs +170 -0
- package/scripts/lib/pnp.mjs +165 -0
- package/scripts/lib/portal-names.mjs +4 -4
- package/scripts/lib/prefer-v-bb-dialog.mjs +1 -1
- package/scripts/lib/project-variant-dts.mjs +182 -48
- package/scripts/lib/reactive-v-model.mjs +2 -2
- package/scripts/lib/redundant-item-accessor.mjs +1 -1
- package/scripts/lib/renamed-item-field.mjs +1 -1
- package/scripts/lib/renamed-slot-prop.mjs +524 -0
- package/scripts/lib/rule-registry.mjs +1 -1
- package/scripts/lib/setup-edits.mjs +1845 -0
- package/scripts/lib/setup.mjs +440 -0
- package/scripts/lib/slot-key.mjs +1 -1
- package/scripts/lib/slot-renames.mjs +3 -3
- package/scripts/lib/squashed-slot-words.mjs +1 -1
- package/scripts/lib/tab-links.mjs +2 -2
- package/scripts/lib/text-null-value.mjs +1 -1
- package/scripts/lib/toolchain-check.mjs +3 -3
- package/scripts/lib/tooling-options.mjs +87 -0
- package/scripts/lib/unimported-components.mjs +1 -1
- package/scripts/lib/unstyled-variants.mjs +1 -1
- package/scripts/lib/valid-locale.mjs +119 -0
- package/scripts/lib/validate-bb-markup.mjs +219 -115
- package/scripts/lib/wrapper-props.mjs +2 -2
- package/dist/ai/BbPtScope.md +0 -138
- package/dist/ai/manifest/components/BbPtScope.json +0 -21
- package/dist/ai/source/BbPtScope.md +0 -54
- package/dist/components/BbNumberInput/warroom/corpus.d.ts +0 -58
- package/dist/components/BbNumberInput/warroom/currency-verify.rows.d.ts +0 -28
- package/dist/components/BbNumberInput/warroom/currency.rows.d.ts +0 -2
- package/dist/components/BbNumberInput/warroom/harness.d.ts +0 -217
- package/dist/components/BbNumberInput/warroom/oracle.d.ts +0 -150
- package/dist/components/BbPtScope/BbPtScope.vue.d.ts +0 -12
- package/dist/components/BbPtScope/BbPtScope.vue.js +0 -4
- package/dist/components/BbPtScope/BbPtScope.vue_vue_type_script_setup_true_lang.js +0 -12
- package/dist/components/BbPtScope/types.d.ts +0 -15
- package/dist/components/BbTable/warroom/harness.d.ts +0 -260
- package/dist/types/PtScope.d.ts +0 -15
- package/dist/utilities/functions/head.js +0 -3
- package/dist/utilities/functions/matchAnyKey.d.ts +0 -8
- package/dist/utilities/functions/matchAnyKey.js +0 -14
- package/dist/utilities/functions/pipe.d.ts +0 -3
- package/dist/utilities/functions/range.js +0 -7
- package/dist/utils/ptScope.d.ts +0 -8
- package/dist/utils/ptScope.js +0 -3
- package/scripts/lib/check-queue.mjs +0 -102
- package/scripts/lib/component-attr-targets.ts +0 -123
- package/scripts/lib/component-tree.ts +0 -648
- package/scripts/lib/consumer-install.mjs +0 -64
- package/scripts/lib/css-class-surface.mjs +0 -328
- package/scripts/lib/css-color-resolve.mjs +0 -296
- package/scripts/lib/css-comment-text.mjs +0 -16
- package/scripts/lib/design-token-manifest.mjs +0 -506
- package/scripts/lib/ensure-manifest.mjs +0 -135
- package/scripts/lib/example-checks.mjs +0 -337
- package/scripts/lib/guide-claims.mjs +0 -452
- package/scripts/lib/manifest-pointers.mjs +0 -71
- package/scripts/lib/pack.mjs +0 -55
- package/scripts/lib/public-type-exports.mjs +0 -273
- package/scripts/lib/quiet-gate.mjs +0 -385
- package/scripts/lib/recipe-excerpts.mjs +0 -98
- package/scripts/lib/swap-noun.mjs +0 -33
- package/scripts/lib/token-color-mix.mjs +0 -114
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<CommonField
|
|
10
10
|
:id="id"
|
|
11
11
|
class="bb-slider"
|
|
12
|
-
:compact="compact"
|
|
12
|
+
:compact="configDefaults.compact"
|
|
13
13
|
:description="description"
|
|
14
14
|
:disabled="disabled"
|
|
15
15
|
:errors="fieldErrors"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
:label-align="labelAlign"
|
|
23
23
|
:label-mode="resolvedLabelMode"
|
|
24
24
|
:label-position="labelPosition"
|
|
25
|
-
:layout="layout"
|
|
25
|
+
:layout="configDefaults.layout"
|
|
26
26
|
:name="name"
|
|
27
27
|
:passthrough="passthrough"
|
|
28
28
|
:readonly="fieldReadonly"
|
|
29
|
-
:reverse="reverse"
|
|
29
|
+
:reverse="configDefaults.reverse"
|
|
30
30
|
:show-asterisk="showAsterisk"
|
|
31
31
|
:show-hint="showHint"
|
|
32
32
|
:warnings="warnings"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<span
|
|
48
48
|
class="bb-slider__body"
|
|
49
49
|
:class="{
|
|
50
|
-
'bb-slider__body--compact': compact,
|
|
50
|
+
'bb-slider__body--compact': configDefaults.compact,
|
|
51
51
|
'bb-slider__body--disabled': disabled,
|
|
52
52
|
'bb-slider__body--errors': fieldHasErrors,
|
|
53
53
|
'bb-slider__body--warnings':
|
|
@@ -57,12 +57,14 @@
|
|
|
57
57
|
>
|
|
58
58
|
<slot
|
|
59
59
|
:decrease="decrease"
|
|
60
|
+
:decrease-disabled="stepDisabled.decrease"
|
|
60
61
|
:disabled="stepDisabled.decrease"
|
|
61
62
|
:increase="increase"
|
|
63
|
+
:increase-disabled="stepDisabled.increase"
|
|
62
64
|
name="prepend"
|
|
63
65
|
></slot>
|
|
64
66
|
<!-- `data-bb-no-drag`: dragging a thumb inside a draggable sheet adjusts
|
|
65
|
-
the value; it must not hand the gesture to swipe-to-dismiss
|
|
67
|
+
the value; it must not hand the gesture to swipe-to-dismiss. -->
|
|
66
68
|
<span
|
|
67
69
|
ref="container"
|
|
68
70
|
v-bind="mergeProps(innerContainerAttributes, passthrough.box)"
|
|
@@ -76,150 +78,118 @@
|
|
|
76
78
|
>
|
|
77
79
|
<span
|
|
78
80
|
v-for="tick in ticks"
|
|
79
|
-
:key="tick.
|
|
81
|
+
:key="tick.percent"
|
|
80
82
|
class="bb-slider__tick"
|
|
81
83
|
:class="{ 'bb-slider__tick--in-range': tick.active }"
|
|
82
|
-
|
|
84
|
+
:data-segment="tick.segment.index"
|
|
85
|
+
v-bind="
|
|
86
|
+
passthrough.part('tick', { inRange: tick.active }, tick.segment)
|
|
87
|
+
"
|
|
83
88
|
><slot
|
|
84
89
|
:active="tick.active"
|
|
90
|
+
:label="tick.label"
|
|
85
91
|
name="tick"
|
|
86
92
|
:percent="tick.percent"
|
|
93
|
+
:segment="tick.segment.index"
|
|
87
94
|
:value="tick.value"
|
|
88
95
|
/></span>
|
|
89
96
|
</span>
|
|
90
97
|
<!-- A null value posts no field (as BbSelect), not the literal "null".
|
|
91
|
-
|
|
98
|
+
`multiple` posts ONE field PER value under the same `name`
|
|
92
99
|
(`price=20&price=80`; `price[]` → an array server-side), like BbSelect
|
|
93
|
-
`multiple
|
|
94
|
-
target. No `required
|
|
95
|
-
it carries none, like the checkbox and switch groups.
|
|
100
|
+
`multiple`. The first input stays the focus
|
|
101
|
+
target. No `required`: a slider's role cannot carry it, so
|
|
102
|
+
it carries none, like the checkbox and switch groups. Every input is
|
|
96
103
|
`aria-hidden`: the thumbs are the slider, a read-only text box with
|
|
97
|
-
its name would be a second control
|
|
104
|
+
its name would be a second control. -->
|
|
98
105
|
<input
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
v-for="(hiddenValue, hiddenIndex) in hiddenValues"
|
|
107
|
+
:id="hiddenIndex === 0 ? fieldId : undefined"
|
|
108
|
+
:key="hiddenIndex"
|
|
109
|
+
:ref="(el: any) => setHiddenInput(el, hiddenIndex)"
|
|
101
110
|
aria-hidden="true"
|
|
102
111
|
class="bb-sr-only"
|
|
103
112
|
:disabled="disabled"
|
|
104
|
-
:name="
|
|
113
|
+
:name="hiddenValue == null ? undefined : name"
|
|
105
114
|
:readonly="true"
|
|
106
115
|
:tabindex="-1"
|
|
107
116
|
type="text"
|
|
108
|
-
:value="
|
|
117
|
+
:value="hiddenValue == null ? '' : String(hiddenValue)"
|
|
109
118
|
@focus="onFocusHiddenInput"
|
|
110
119
|
/>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
aria-hidden="true"
|
|
114
|
-
class="bb-sr-only"
|
|
115
|
-
:disabled="disabled"
|
|
116
|
-
:name="hiddenValues[1] == null ? undefined : name"
|
|
117
|
-
:readonly="true"
|
|
118
|
-
:tabindex="-1"
|
|
119
|
-
type="text"
|
|
120
|
-
:value="hiddenValueText(hiddenValues[1])"
|
|
121
|
-
@focus="onFocusHiddenInput"
|
|
122
|
-
/>
|
|
123
|
-
<!-- The rail paints itself; the range bar is its one child. -->
|
|
120
|
+
<!-- The rail paints itself; its children are the segments `fill`
|
|
121
|
+
paints, one `bar` each. -->
|
|
124
122
|
<span ref="track" class="bb-slider__track" v-bind="passthrough.track">
|
|
125
|
-
<span v-bind="mergeProps(barAttributes, passthrough.bar)"></span>
|
|
126
|
-
</span>
|
|
127
|
-
<span
|
|
128
|
-
v-if="props.range"
|
|
129
|
-
v-bind="listeners"
|
|
130
|
-
key="thumblower"
|
|
131
|
-
ref="thumblower"
|
|
132
|
-
:aria-describedby="ariaDescribedby"
|
|
133
|
-
:aria-disabled="disabled ? 'true' : undefined"
|
|
134
|
-
:aria-labelledby="thumbLabelledby(fieldId, 'lower')"
|
|
135
|
-
aria-orientation="horizontal"
|
|
136
|
-
:aria-readonly="fieldReadonly ? 'true' : undefined"
|
|
137
|
-
:aria-valuemax="max"
|
|
138
|
-
:aria-valuemin="min"
|
|
139
|
-
:aria-valuenow="valueNowLower"
|
|
140
|
-
class="bb-slider__thumb-container"
|
|
141
|
-
data-thumb="lower"
|
|
142
|
-
role="slider"
|
|
143
|
-
:style="{ left: getThumbAnchorPosition(internalValueLower) }"
|
|
144
|
-
:tabindex="disabled ? -1 : 0"
|
|
145
|
-
@focus="onFocus"
|
|
146
|
-
@keydown="onKeydown"
|
|
147
|
-
>
|
|
148
123
|
<span
|
|
149
|
-
|
|
150
|
-
:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
left: `0`,
|
|
156
|
-
}"
|
|
157
|
-
v-bind="passthrough.thumb"
|
|
158
|
-
><slot
|
|
159
|
-
:focused="targetThumb === 'lower'"
|
|
160
|
-
name="thumb:lower"
|
|
161
|
-
:percent="internalValueLower"
|
|
162
|
-
:value="valueNowLower"
|
|
163
|
-
><slot
|
|
164
|
-
:focused="targetThumb === 'lower'"
|
|
165
|
-
name="thumb"
|
|
166
|
-
:percent="internalValueLower"
|
|
167
|
-
:value="valueNowLower" /></slot
|
|
124
|
+
v-for="bar in bars"
|
|
125
|
+
:key="bar.segment.index"
|
|
126
|
+
:data-segment="bar.segment.index"
|
|
127
|
+
v-bind="
|
|
128
|
+
mergeProps(bar.attrs, passthrough.part('bar', {}, bar.segment))
|
|
129
|
+
"
|
|
168
130
|
></span>
|
|
169
131
|
</span>
|
|
132
|
+
<!-- One `role="slider"` handle per value, always in value order: a
|
|
133
|
+
thumb dragged past another hands the drag (and focus) over, so DOM,
|
|
134
|
+
tab and visual order never disagree. Pointer presses land on the
|
|
135
|
+
box handler (which tells a thumb grab from a track press); thumbs
|
|
136
|
+
only own focus and keys. -->
|
|
170
137
|
<span
|
|
171
|
-
v-
|
|
172
|
-
key="
|
|
173
|
-
ref="
|
|
138
|
+
v-for="(percent, index) in internalPercents"
|
|
139
|
+
:key="index"
|
|
140
|
+
:ref="(el: any) => setThumbEl(el, index)"
|
|
174
141
|
:aria-describedby="ariaDescribedby"
|
|
175
142
|
:aria-disabled="disabled ? 'true' : undefined"
|
|
176
|
-
:aria-labelledby="thumbLabelledby(fieldId,
|
|
143
|
+
:aria-labelledby="thumbLabelledby(fieldId, index)"
|
|
177
144
|
aria-orientation="horizontal"
|
|
178
145
|
:aria-readonly="fieldReadonly ? 'true' : undefined"
|
|
179
|
-
:aria-valuemax="
|
|
180
|
-
:aria-valuemin="
|
|
181
|
-
:aria-valuenow="
|
|
146
|
+
:aria-valuemax="scaleMax"
|
|
147
|
+
:aria-valuemin="scaleMin"
|
|
148
|
+
:aria-valuenow="thumbPosition(index)"
|
|
149
|
+
:aria-valuetext="stops ? thumbLabel(index) : undefined"
|
|
182
150
|
class="bb-slider__thumb-container"
|
|
183
|
-
data-thumb="
|
|
151
|
+
:data-thumb="thumbName(index)"
|
|
152
|
+
:data-thumb-index="index"
|
|
184
153
|
role="slider"
|
|
185
|
-
:style="{
|
|
154
|
+
:style="{ insetInlineStart: getThumbAnchorPosition(percent) }"
|
|
186
155
|
:tabindex="disabled ? -1 : 0"
|
|
187
|
-
@
|
|
188
|
-
@
|
|
156
|
+
@blur="onBlur(index)"
|
|
157
|
+
@focus="onFocus($event, index)"
|
|
158
|
+
@keydown="onKeydown($event, index)"
|
|
189
159
|
>
|
|
190
160
|
<span
|
|
191
|
-
class="bb-slider__thumb
|
|
192
|
-
:class="
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
161
|
+
class="bb-slider__thumb"
|
|
162
|
+
:class="[
|
|
163
|
+
thumbClass(index),
|
|
164
|
+
{
|
|
165
|
+
'bb-slider__thumb--focused': focusedIndex === index,
|
|
166
|
+
},
|
|
167
|
+
]"
|
|
168
|
+
:style="thumbStyle(percent)"
|
|
199
169
|
v-bind="passthrough.thumb"
|
|
200
170
|
><slot
|
|
201
|
-
:focused="
|
|
202
|
-
|
|
203
|
-
:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
:percent="internalValueHigher"
|
|
209
|
-
:value="valueNowHigher" /></slot
|
|
210
|
-
></span>
|
|
171
|
+
:focused="focusedIndex === index"
|
|
172
|
+
:index="index"
|
|
173
|
+
:label="thumbLabel(index)"
|
|
174
|
+
name="thumb"
|
|
175
|
+
:percent="percent"
|
|
176
|
+
:value="thumbModel(index)"
|
|
177
|
+
/></span>
|
|
211
178
|
</span>
|
|
212
179
|
</span>
|
|
213
180
|
<slot
|
|
214
181
|
:decrease="decrease"
|
|
182
|
+
:decrease-disabled="stepDisabled.decrease"
|
|
215
183
|
:disabled="stepDisabled.increase"
|
|
216
184
|
:increase="increase"
|
|
185
|
+
:increase-disabled="stepDisabled.increase"
|
|
217
186
|
name="append"
|
|
218
187
|
></slot>
|
|
219
|
-
<!-- Localized qualifiers referenced by the
|
|
220
|
-
so the
|
|
221
|
-
|
|
222
|
-
|
|
188
|
+
<!-- Localized qualifiers referenced by the multiple thumbs'
|
|
189
|
+
aria-labelledby so the identical role=slider spans are distinguishable
|
|
190
|
+
to AT: minimum/maximum for two, "2 of 3" numbering for more.
|
|
191
|
+
`hidden`: read through the reference, never as page text. -->
|
|
192
|
+
<template v-if="thumbCount === 2">
|
|
223
193
|
<span :id="`${fieldId}__thumb_label_lower`" hidden>{{
|
|
224
194
|
t('slider.minimumThumb').value
|
|
225
195
|
}}</span>
|
|
@@ -227,12 +197,27 @@
|
|
|
227
197
|
t('slider.maximumThumb').value
|
|
228
198
|
}}</span>
|
|
229
199
|
</template>
|
|
200
|
+
<template v-else-if="thumbCount > 2">
|
|
201
|
+
<span
|
|
202
|
+
v-for="qualifierIndex in thumbCount"
|
|
203
|
+
:id="`${fieldId}__thumb_label_${qualifierIndex - 1}`"
|
|
204
|
+
:key="qualifierIndex"
|
|
205
|
+
hidden
|
|
206
|
+
>{{
|
|
207
|
+
t('slider.thumbPosition', qualifierIndex, thumbCount).value
|
|
208
|
+
}}</span
|
|
209
|
+
>
|
|
210
|
+
</template>
|
|
230
211
|
</span>
|
|
231
212
|
</template>
|
|
232
213
|
</CommonField>
|
|
233
214
|
</template>
|
|
234
215
|
|
|
235
|
-
<script
|
|
216
|
+
<script
|
|
217
|
+
setup
|
|
218
|
+
lang="ts"
|
|
219
|
+
generic="M extends boolean | number = false, V = number"
|
|
220
|
+
>
|
|
236
221
|
import type { ShapeErasedProps } from '@/types/ShapeErased';
|
|
237
222
|
import type { FallthroughAttrs } from '@/types/fallthrough';
|
|
238
223
|
import { autofocusOnMount } from '@/utilities/misc/autofocus';
|
|
@@ -244,6 +229,7 @@ import {
|
|
|
244
229
|
} from '@/composables/usePassthrough';
|
|
245
230
|
import {
|
|
246
231
|
computed,
|
|
232
|
+
getCurrentInstance,
|
|
247
233
|
mergeProps,
|
|
248
234
|
onBeforeUnmount,
|
|
249
235
|
onDeactivated,
|
|
@@ -252,15 +238,18 @@ import {
|
|
|
252
238
|
useAttrs,
|
|
253
239
|
watch,
|
|
254
240
|
} from 'vue';
|
|
255
|
-
import {
|
|
241
|
+
import {
|
|
242
|
+
useConfigFallback,
|
|
243
|
+
useConfigDefaults,
|
|
244
|
+
} from '@/composables/useConfigDefaults';
|
|
245
|
+
import type { InputLabelMode } from '@/types/Config';
|
|
246
|
+
import { inlineStep, isRtl } from '@/composables/useDirection';
|
|
256
247
|
import { useFormBinding } from '@/composables/useFormBinding';
|
|
257
248
|
import { useLocale } from '@/composables/useLocale';
|
|
258
249
|
import { useLogger } from '@/composables/useLogger';
|
|
259
250
|
import { removedPropsFor } from '@/deprecation/removedProps';
|
|
260
251
|
import { clamp } from '@/utilities/functions/clamp';
|
|
261
|
-
import { head } from '@/utilities/functions/head';
|
|
262
252
|
import { isNil } from '@/utilities/functions/isNil';
|
|
263
|
-
import { last } from '@/utilities/functions/last';
|
|
264
253
|
import {
|
|
265
254
|
getAsPercentage,
|
|
266
255
|
getAsPercentageBetween,
|
|
@@ -273,9 +262,11 @@ import { warnRemovedAttrs } from '@/utilities/functions/warnRemovedAttrs';
|
|
|
273
262
|
import {
|
|
274
263
|
BB_SLIDER_PT,
|
|
275
264
|
type BbSliderBaseProps,
|
|
265
|
+
type BbSliderItemValue,
|
|
276
266
|
type BbSliderModelProps,
|
|
277
267
|
type BbSliderProps,
|
|
278
268
|
type BbSliderEvents,
|
|
269
|
+
type BbSliderSegment,
|
|
279
270
|
type BbSliderValue,
|
|
280
271
|
type BbSliderSlots,
|
|
281
272
|
} from './types';
|
|
@@ -284,47 +275,74 @@ defineOptions({ inheritAttrs: false });
|
|
|
284
275
|
const declaredProps = withDefaults(
|
|
285
276
|
defineProps<
|
|
286
277
|
BbSliderBaseProps &
|
|
287
|
-
/* @vue-ignore */ BbSliderModelProps<
|
|
278
|
+
/* @vue-ignore */ BbSliderModelProps<M, V> &
|
|
288
279
|
/* @vue-ignore */ FallthroughAttrs<
|
|
289
280
|
'div',
|
|
290
|
-
BbSliderProps<
|
|
291
|
-
BbSliderEvents<
|
|
281
|
+
BbSliderProps<M, V>,
|
|
282
|
+
BbSliderEvents<M, V>
|
|
292
283
|
>
|
|
293
284
|
>(),
|
|
294
285
|
{
|
|
286
|
+
fill: 'normal',
|
|
295
287
|
maxPrecision: 2,
|
|
296
288
|
max: 100,
|
|
297
289
|
min: 0,
|
|
298
290
|
step: 1,
|
|
291
|
+
// Tri-state: unset lets the components map show through.
|
|
292
|
+
compact: undefined,
|
|
293
|
+
// Tri-state: unset lets the components map show through.
|
|
294
|
+
reverse: undefined,
|
|
299
295
|
}
|
|
300
296
|
);
|
|
301
|
-
const declaredEmit = defineEmits<BbSliderEvents<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
297
|
+
const declaredEmit = defineEmits<BbSliderEvents<M, V>>();
|
|
298
|
+
|
|
299
|
+
defineSlots<BbSliderSlots<V>>();
|
|
300
|
+
|
|
301
|
+
const configDefaults = useConfigDefaults('BbSlider', declaredProps, {
|
|
302
|
+
compact: false,
|
|
303
|
+
reverse: false,
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// `M` types the v-model for the caller; inside, the value is either shape.
|
|
307
|
+
const anyShapeProps = declaredProps as unknown as ShapeErasedProps<
|
|
308
|
+
BbSliderBaseProps,
|
|
309
|
+
{
|
|
310
|
+
fill: NonNullable<BbSliderProps['fill']>;
|
|
311
|
+
maxPrecision: number;
|
|
312
|
+
max: number;
|
|
313
|
+
min: number;
|
|
314
|
+
step: number;
|
|
315
|
+
}
|
|
316
|
+
>;
|
|
317
|
+
const anyShapeEmit = declaredEmit as unknown as BbSliderEvents<
|
|
318
|
+
boolean | number,
|
|
319
|
+
string | number
|
|
307
320
|
>;
|
|
308
|
-
|
|
309
|
-
|
|
321
|
+
|
|
322
|
+
/** How many thumbs: one, two for a bare `multiple`, or the number given. */
|
|
323
|
+
const countOf = (multiple: boolean | number | undefined) =>
|
|
324
|
+
multiple === true ? 2 : typeof multiple === 'number' ? multiple : 1;
|
|
325
|
+
|
|
326
|
+
// Inside a BbForm the field joins it: `props` / `emit` are bound.
|
|
310
327
|
const {
|
|
311
328
|
props,
|
|
312
329
|
emit,
|
|
313
330
|
showAsterisk,
|
|
314
331
|
errors: fieldErrors,
|
|
315
332
|
readonly: fieldReadonly,
|
|
316
|
-
} = useFormBinding(
|
|
333
|
+
} = useFormBinding(anyShapeProps, anyShapeEmit, {
|
|
317
334
|
componentName: 'BbSlider',
|
|
318
335
|
identifierFallback: () => declaredProps.label,
|
|
319
|
-
|
|
336
|
+
// An unset `multiple` slider is empty (`[]`), not a number.
|
|
337
|
+
emptyValue: () => (countOf(declaredProps.multiple) > 1 ? [] : 0),
|
|
320
338
|
leaveOn: 'inactive',
|
|
321
339
|
});
|
|
322
|
-
const config = useConfig();
|
|
323
340
|
|
|
324
341
|
if (process.env.NODE_ENV !== 'production')
|
|
325
342
|
warnRemovedAttrs('BbSlider', removedPropsFor('BbSlider'));
|
|
326
343
|
|
|
327
344
|
const SLIDER_LABEL_MODES = ['outside', 'inside'] as const;
|
|
345
|
+
const SLIDER_FILLS = ['normal', 'inverted', 'segments'] as const;
|
|
328
346
|
|
|
329
347
|
// A slider can't float. When the consumer *explicitly* asks for an unsupported
|
|
330
348
|
// mode (e.g. 'floating' from an untyped/plain-JS caller — it's no longer in the
|
|
@@ -332,6 +350,7 @@ const SLIDER_LABEL_MODES = ['outside', 'inside'] as const;
|
|
|
332
350
|
// value-enum policy: a bad token is cosmetic, never fatal. When `labelMode` is
|
|
333
351
|
// unset we take the library default, degrading a global 'floating' to 'outside'
|
|
334
352
|
// silently — the consumer made no choice, so there's nothing to warn about.
|
|
353
|
+
const labelFallback = useConfigFallback('BbSlider', 'labelMode');
|
|
335
354
|
const resolvedLabelMode = computed(() => {
|
|
336
355
|
if (props.labelMode != null) {
|
|
337
356
|
return resolveEnumProp(props.labelMode, SLIDER_LABEL_MODES, 'outside', {
|
|
@@ -339,10 +358,17 @@ const resolvedLabelMode = computed(() => {
|
|
|
339
358
|
component: 'BbSlider',
|
|
340
359
|
});
|
|
341
360
|
}
|
|
342
|
-
const mode =
|
|
343
|
-
return mode === 'floating' ? 'outside' : mode;
|
|
361
|
+
const mode = labelFallback() as InputLabelMode | undefined;
|
|
362
|
+
return mode === 'floating' || !mode ? 'outside' : mode;
|
|
344
363
|
});
|
|
345
364
|
|
|
365
|
+
const resolvedFill = computed(() =>
|
|
366
|
+
resolveEnumProp(props.fill, SLIDER_FILLS, 'normal', {
|
|
367
|
+
prop: 'fill',
|
|
368
|
+
component: 'BbSlider',
|
|
369
|
+
})
|
|
370
|
+
);
|
|
371
|
+
|
|
346
372
|
/**
|
|
347
373
|
* On while the slider is engaged: from a thumb's focus until a focus or click
|
|
348
374
|
* lands outside the rail. Drives the hint, `pt:*:active` and the
|
|
@@ -352,10 +378,15 @@ const active = ref(false);
|
|
|
352
378
|
const showHint = computed(() => props.persistentHint || active.value);
|
|
353
379
|
|
|
354
380
|
/**
|
|
355
|
-
* Passthrough
|
|
381
|
+
* Passthrough. Resolved here, where the states
|
|
356
382
|
* are known: the frame binds `root` / `label` / `description` / `message` /
|
|
357
|
-
* `hint`, `track` lands on the rail
|
|
383
|
+
* `hint`, `track` lands on the rail, `bar` on every painted segment and
|
|
384
|
+
* `thumb` on every handle below.
|
|
358
385
|
*/
|
|
386
|
+
/** `hasValue`: a non-null model; with `multiple`, at least one value in it. */
|
|
387
|
+
const hasSliderValue = (value: unknown) =>
|
|
388
|
+
Array.isArray(value) ? value.some((v) => v != null) : value != null;
|
|
389
|
+
|
|
359
390
|
const passthrough = usePassthrough({
|
|
360
391
|
component: 'BbSlider',
|
|
361
392
|
attrs: useAttrs(),
|
|
@@ -363,12 +394,10 @@ const passthrough = usePassthrough({
|
|
|
363
394
|
parts: BB_SLIDER_PT.parts,
|
|
364
395
|
states: BB_SLIDER_PT.states,
|
|
365
396
|
active: {
|
|
366
|
-
...pickActive(
|
|
367
|
-
|
|
368
|
-
'warnings',
|
|
369
|
-
|
|
370
|
-
'readonly',
|
|
371
|
-
]),
|
|
397
|
+
...pickActive(
|
|
398
|
+
formControlPtActive(props, () => hasSliderValue(props.modelValue)),
|
|
399
|
+
['errors', 'warnings', 'disabled', 'readonly', 'hasValue']
|
|
400
|
+
),
|
|
372
401
|
active: () => active.value,
|
|
373
402
|
},
|
|
374
403
|
});
|
|
@@ -377,18 +406,114 @@ const logger = useLogger();
|
|
|
377
406
|
|
|
378
407
|
const { t } = useLocale();
|
|
379
408
|
|
|
409
|
+
const thumbCount = computed(() => countOf(props.multiple));
|
|
410
|
+
|
|
411
|
+
/** One `items` stop, its label resolved. */
|
|
412
|
+
type Stop = { value: BbSliderItemValue; label: string };
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* `items` must be a list of at least two distinct string / number values
|
|
416
|
+
* (bare, or as `{ value, label }`): the slider maps positions to them.
|
|
417
|
+
*/
|
|
418
|
+
const assertItems = (list: unknown) => {
|
|
419
|
+
if (list == null) return;
|
|
420
|
+
if (!Array.isArray(list) || list.length < 2)
|
|
421
|
+
logger.throw(
|
|
422
|
+
'BbSlider items needs at least two stops (an array of strings, numbers or { value, label })',
|
|
423
|
+
TypeError
|
|
424
|
+
);
|
|
425
|
+
const seen = new Set<unknown>();
|
|
426
|
+
for (const item of list as unknown[]) {
|
|
427
|
+
const value =
|
|
428
|
+
typeof item === 'object' && item !== null
|
|
429
|
+
? (item as { value?: unknown }).value
|
|
430
|
+
: item;
|
|
431
|
+
if (typeof value !== 'string' && typeof value !== 'number')
|
|
432
|
+
logger.throw(
|
|
433
|
+
`BbSlider items: every stop is a string, a number or { value, label } with a string / number value, got ${JSON.stringify(item)}`,
|
|
434
|
+
TypeError
|
|
435
|
+
);
|
|
436
|
+
if (seen.has(value))
|
|
437
|
+
logger.throw(
|
|
438
|
+
`BbSlider items: the value ${JSON.stringify(value)} appears twice — every stop needs its own value`,
|
|
439
|
+
TypeError
|
|
440
|
+
);
|
|
441
|
+
seen.add(value);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
assertItems(props.items);
|
|
445
|
+
|
|
446
|
+
// `items` sets the scale, so a `step` / `min` / `max` beside it means the
|
|
447
|
+
// wiring disagrees with itself. Judged on what the caller PASSED, never on the
|
|
448
|
+
// resolved props: their defaults would otherwise trip every `items` slider.
|
|
449
|
+
if (props.items != null) {
|
|
450
|
+
const passed = getCurrentInstance()?.vnode.props ?? {};
|
|
451
|
+
const clash = ['step', 'min', 'max'].filter((key) => key in passed);
|
|
452
|
+
if (clash.length)
|
|
453
|
+
logger.throw(
|
|
454
|
+
`BbSlider items sets the stops, so ${clash.map((key) => `\`${key}\``).join(' / ')} cannot be set beside it — remove ${clash.length > 1 ? 'them' : 'it'}`,
|
|
455
|
+
TypeError
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/** The `items` stops, or null for a numeric slider. */
|
|
460
|
+
const stops = computed<Stop[] | null>(() =>
|
|
461
|
+
props.items == null
|
|
462
|
+
? null
|
|
463
|
+
: props.items.map((item) =>
|
|
464
|
+
typeof item === 'object'
|
|
465
|
+
? { value: item.value, label: item.label ?? String(item.value) }
|
|
466
|
+
: { value: item, label: String(item) }
|
|
467
|
+
)
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* The numeric scale the rail runs on: `min` / `max` / `step`, or the stop
|
|
472
|
+
* positions `0 … n-1` with `items`. Everything below works on it; `toScale`
|
|
473
|
+
* / `fromScale` convert at the edges (the model, the slots, the emit).
|
|
474
|
+
*/
|
|
475
|
+
const scaleMin = computed(() => (stops.value ? 0 : props.min));
|
|
476
|
+
const scaleMax = computed(() =>
|
|
477
|
+
stops.value ? stops.value.length - 1 : props.max
|
|
478
|
+
);
|
|
479
|
+
const scaleStep = computed(() => (stops.value ? 1 : props.step));
|
|
480
|
+
|
|
481
|
+
/** A model value on the scale: itself, or its stop's position with `items`. */
|
|
482
|
+
const toScale = (value: unknown): number => {
|
|
483
|
+
if (!stops.value) return value as number;
|
|
484
|
+
const at = stops.value.findIndex((stop) => stop.value === value);
|
|
485
|
+
if (at === -1)
|
|
486
|
+
logger.throw(
|
|
487
|
+
`BbSlider modelValue ${JSON.stringify(value)} is not one of the items`,
|
|
488
|
+
TypeError
|
|
489
|
+
);
|
|
490
|
+
return at;
|
|
491
|
+
};
|
|
492
|
+
/** A scale position as a model value: itself, or the stop there. */
|
|
493
|
+
/** A scale position as a model value: itself, or the stop there. */
|
|
494
|
+
const fromScale = (position: number): BbSliderItemValue =>
|
|
495
|
+
stops.value ? (stops.value[position]?.value ?? position) : position;
|
|
496
|
+
// The slots hand values out typed as the caller's `V` (a stop value, or a
|
|
497
|
+
// number without `items`): one of them by construction.
|
|
498
|
+
const asItem = (value: BbSliderItemValue) => value as unknown as V;
|
|
499
|
+
const labelAt = (position: number) => stops.value?.[position]?.label;
|
|
500
|
+
const isMultiple = computed(() => thumbCount.value > 1);
|
|
501
|
+
|
|
380
502
|
/**
|
|
381
503
|
* `role="slider"` is name-from-author: the frame's visible `<label>`
|
|
382
504
|
* targets the bb-sr-only hidden input (`for`/`id`), which never names these
|
|
383
505
|
* sibling thumb spans — without an explicit reference the focused thumb
|
|
384
506
|
* announces as an unnamed "slider, N". CommonField renders that label text as
|
|
385
|
-
* `${id}__label`, so the thumbs point at it;
|
|
386
|
-
*
|
|
507
|
+
* `${id}__label`, so the thumbs point at it; `multiple` appends a localized
|
|
508
|
+
* qualifier so the thumbs are distinguishable.
|
|
387
509
|
*/
|
|
388
|
-
const thumbLabelledby = (fieldId: string,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
510
|
+
const thumbLabelledby = (fieldId: string, index: number) => {
|
|
511
|
+
if (thumbCount.value === 2)
|
|
512
|
+
return `${fieldId}__label ${fieldId}__thumb_label_${index === 0 ? 'lower' : 'higher'}`;
|
|
513
|
+
if (thumbCount.value > 2)
|
|
514
|
+
return `${fieldId}__label ${fieldId}__thumb_label_${index}`;
|
|
515
|
+
return `${fieldId}__label`;
|
|
516
|
+
};
|
|
392
517
|
|
|
393
518
|
if (
|
|
394
519
|
props.min < Number.MIN_SAFE_INTEGER ||
|
|
@@ -419,62 +544,126 @@ if (!Number.isFinite(props.maxPrecision) || props.maxPrecision < 0) {
|
|
|
419
544
|
);
|
|
420
545
|
}
|
|
421
546
|
|
|
547
|
+
/**
|
|
548
|
+
* The mode and the model must agree: one number per thumb, or an
|
|
549
|
+
* empty `multiple` model (`[]` / `null`) that has not been set yet. Anything
|
|
550
|
+
* else is a wiring mistake, so it throws instead of guessing.
|
|
551
|
+
*/
|
|
552
|
+
const assertModelShape = (value: unknown, count: number) => {
|
|
553
|
+
if (
|
|
554
|
+
typeof props.multiple === 'number' &&
|
|
555
|
+
(!Number.isInteger(props.multiple) || props.multiple < 2)
|
|
556
|
+
) {
|
|
557
|
+
logger.throw(
|
|
558
|
+
`BbSlider multiple must be true or a whole number of thumbs of at least 2, got ${props.multiple}`,
|
|
559
|
+
RangeError
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
if (count === 1) {
|
|
563
|
+
if (Array.isArray(value))
|
|
564
|
+
logger.throw(
|
|
565
|
+
'BbSlider modelValue is an array but multiple is not set — add `multiple` (two thumbs) or `:multiple="n"`, or bind a number',
|
|
566
|
+
TypeError
|
|
567
|
+
);
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (value == null) return;
|
|
571
|
+
if (!Array.isArray(value)) {
|
|
572
|
+
logger.throw(
|
|
573
|
+
'BbSlider multiple needs an array modelValue (or null / [] to start unset)',
|
|
574
|
+
TypeError
|
|
575
|
+
);
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (value.length !== 0 && value.length !== count)
|
|
579
|
+
logger.throw(
|
|
580
|
+
`BbSlider multiple renders ${count} thumbs but modelValue has ${value.length} values — bind ${count} values, or [] to start unset`,
|
|
581
|
+
TypeError
|
|
582
|
+
);
|
|
583
|
+
};
|
|
584
|
+
assertModelShape(props.modelValue, thumbCount.value);
|
|
585
|
+
|
|
422
586
|
const container = ref<HTMLElement>();
|
|
423
587
|
const track = ref<HTMLElement>();
|
|
424
|
-
const
|
|
425
|
-
const
|
|
588
|
+
const thumbEls = ref<Array<HTMLElement | undefined>>([]);
|
|
589
|
+
const setThumbEl = (el: unknown, index: number) => {
|
|
590
|
+
thumbEls.value[index] = el instanceof HTMLElement ? el : undefined;
|
|
591
|
+
};
|
|
426
592
|
const hiddenInput = ref<HTMLInputElement>();
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return head(props.modelValue) ?? undefined;
|
|
432
|
-
return isNil(props.modelValue) ? undefined : Number(props.modelValue);
|
|
433
|
-
});
|
|
434
|
-
const valueNowHigher = computed(() => {
|
|
435
|
-
if (Array.isArray(props.modelValue))
|
|
436
|
-
return last(props.modelValue) ?? undefined;
|
|
437
|
-
return isNil(props.modelValue) ? undefined : Number(props.modelValue);
|
|
438
|
-
});
|
|
439
|
-
const sortedInternalValues = computed(() => {
|
|
440
|
-
return [internalValueLower.value, internalValueHigher.value].sort(
|
|
441
|
-
(a, b) => a - b
|
|
442
|
-
);
|
|
443
|
-
});
|
|
593
|
+
const setHiddenInput = (el: unknown, index: number) => {
|
|
594
|
+
if (index === 0)
|
|
595
|
+
hiddenInput.value = el instanceof HTMLInputElement ? el : undefined;
|
|
596
|
+
};
|
|
444
597
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
598
|
+
/**
|
|
599
|
+
* Thumb positions as track percentages (0–100), one per thumb, always
|
|
600
|
+
* sorted. Kept in sync with `modelValue` by the watcher below; during a drag
|
|
601
|
+
* it leads and the model follows through `update:modelValue`.
|
|
602
|
+
*/
|
|
603
|
+
const internalPercents = ref<number[]>([0]);
|
|
604
|
+
|
|
605
|
+
/** A thumb's place on the scale (`aria-valuenow`), from its live position. */
|
|
606
|
+
const thumbPosition = (index: number): number | undefined => {
|
|
607
|
+
if (!isMultiple.value && isNil(props.modelValue)) return undefined;
|
|
608
|
+
const percent = internalPercents.value[index];
|
|
609
|
+
if (percent === undefined) return undefined;
|
|
610
|
+
return valueAt(percent);
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
/** The model value a thumb holds (an `items` value with `items`). */
|
|
614
|
+
const thumbModel = (index: number) => {
|
|
615
|
+
const position = thumbPosition(index);
|
|
616
|
+
return position === undefined ? undefined : asItem(fromScale(position));
|
|
617
|
+
};
|
|
618
|
+
/** The stop label under a thumb with `items` (`aria-valuetext`, slot). */
|
|
619
|
+
const thumbLabel = (index: number) => {
|
|
620
|
+
const position = thumbPosition(index);
|
|
621
|
+
return position === undefined ? undefined : labelAt(position);
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const valueAt = (percent: number) => {
|
|
625
|
+
const value = getValueFromPercentageInInterval(
|
|
626
|
+
percent,
|
|
627
|
+
scaleMin.value,
|
|
628
|
+
scaleMax.value
|
|
457
629
|
);
|
|
458
|
-
|
|
630
|
+
// Stop positions are whole; numbers keep `maxPrecision` (float dust).
|
|
631
|
+
return stops.value
|
|
632
|
+
? Math.round(value)
|
|
633
|
+
: Number(value.toFixed(props.maxPrecision));
|
|
634
|
+
};
|
|
459
635
|
|
|
460
|
-
|
|
636
|
+
/** `data-thumb` identity: lower/higher for two thumbs, the index for more. */
|
|
637
|
+
const thumbName = (index: number) => {
|
|
638
|
+
if (thumbCount.value === 2) return index === 0 ? 'lower' : 'higher';
|
|
639
|
+
if (thumbCount.value > 2) return String(index);
|
|
640
|
+
return 'higher';
|
|
641
|
+
};
|
|
642
|
+
const thumbClass = (index: number) =>
|
|
643
|
+
thumbCount.value === 2 && index === 0
|
|
644
|
+
? 'bb-slider__thumb--lower'
|
|
645
|
+
: thumbCount.value > 2
|
|
646
|
+
? 'bb-slider__thumb--multiple'
|
|
647
|
+
: 'bb-slider__thumb--higher';
|
|
648
|
+
|
|
649
|
+
// the same guard as every other field's `autofocus`.
|
|
461
650
|
onMounted(() => {
|
|
462
|
-
if (props.autofocus && !props.disabled)
|
|
463
|
-
autofocusOnMount(
|
|
464
|
-
props.range ? (thumblower.value ?? thumbhigher.value) : thumbhigher.value
|
|
465
|
-
);
|
|
651
|
+
if (props.autofocus && !props.disabled) autofocusOnMount(thumbEls.value[0]);
|
|
466
652
|
});
|
|
467
653
|
|
|
468
|
-
|
|
469
|
-
const
|
|
654
|
+
/** The thumb being dragged by `dragPointerId`, or null between drags. */
|
|
655
|
+
const dragIndex = ref<number | null>(null);
|
|
656
|
+
const dragPointerId = ref<number | null>(null);
|
|
657
|
+
/**
|
|
658
|
+
* The thumb holding keyboard/DOM focus. Deliberately separate from the drag
|
|
659
|
+
* state: releasing the pointer ends the drag, not the focus, and the
|
|
660
|
+
* `--focused` styling must survive `pointerup`.
|
|
661
|
+
*/
|
|
662
|
+
const focusedIndex = ref<number | null>(null);
|
|
470
663
|
|
|
471
664
|
const focusDefaultThumb = () => {
|
|
472
665
|
if (props.disabled) return;
|
|
473
|
-
|
|
474
|
-
(thumblower.value ?? thumbhigher.value)?.focus();
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
thumbhigher.value?.focus();
|
|
666
|
+
thumbEls.value[0]?.focus();
|
|
478
667
|
};
|
|
479
668
|
|
|
480
669
|
const onFocusHiddenInput = () => {
|
|
@@ -482,15 +671,133 @@ const onFocusHiddenInput = () => {
|
|
|
482
671
|
focusDefaultThumb();
|
|
483
672
|
};
|
|
484
673
|
|
|
674
|
+
/**
|
|
675
|
+
* The thumbs sit along the inline axis, so right to left the scale runs from
|
|
676
|
+
* the right edge (the page's `dir`, read by the CSS: nothing here knows the
|
|
677
|
+
* direction). The anchor is an inline-start offset.
|
|
678
|
+
*/
|
|
485
679
|
const getThumbAnchorPosition = (percent: number) =>
|
|
486
680
|
`calc(var(--track-inset) + (100% - (var(--track-inset) * 2)) * ${percent} / 100)`;
|
|
487
681
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
682
|
+
/**
|
|
683
|
+
* The handle on its anchor. By default it is pulled back by its own width ×
|
|
684
|
+
* the percent, so it stays on the rail at both ends; the pull points toward
|
|
685
|
+
* the inline start, `--sx` (index.css) gives its physical sign. With
|
|
686
|
+
* `disableThumbTranslate` it is centred on the anchor, the same either way.
|
|
687
|
+
*/
|
|
688
|
+
const thumbStyle = (percent: number) =>
|
|
689
|
+
props.disableThumbTranslate
|
|
690
|
+
? { transform: 'translateY(-50%) translateX(-50%)', left: '0' }
|
|
691
|
+
: {
|
|
692
|
+
transform: `translateY(-50%) translateX(calc(var(--sx, 1) * ${percent}%))`,
|
|
693
|
+
insetInlineStart: '0',
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Snap a track percentage to the step grid (the keyboard lands where
|
|
698
|
+
* the pointer does — never between steps, and on the last grid point when
|
|
699
|
+
* `max` is off the grid).
|
|
700
|
+
*/
|
|
701
|
+
const snapPercent = (percent: number) =>
|
|
702
|
+
getAsPercentageBetween(
|
|
703
|
+
snapToStep(
|
|
704
|
+
getValueFromPercentageInInterval(
|
|
705
|
+
clamp(percent, 0, 100),
|
|
706
|
+
scaleMin.value,
|
|
707
|
+
scaleMax.value
|
|
708
|
+
),
|
|
709
|
+
scaleMin.value,
|
|
710
|
+
scaleMax.value,
|
|
711
|
+
scaleStep.value
|
|
712
|
+
),
|
|
713
|
+
scaleMin.value,
|
|
714
|
+
scaleMax.value
|
|
715
|
+
);
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Track-relative percentage (0–100) of a pointer press, or null off-track.
|
|
719
|
+
* Measured from the rail's inline start: the right edge right to left, read
|
|
720
|
+
* when the press lands.
|
|
721
|
+
*/
|
|
722
|
+
const getPressedPercent = (event: PointerEvent): number | null => {
|
|
723
|
+
if (!track.value) return null;
|
|
724
|
+
const rect = track.value.getBoundingClientRect();
|
|
725
|
+
if (rect.width === 0) return null;
|
|
726
|
+
const fromStart = isRtl(track.value)
|
|
727
|
+
? rect.right - event.clientX
|
|
728
|
+
: event.clientX - rect.left;
|
|
729
|
+
return clamp((fromStart / rect.width) * 100, 0, 100);
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
/** The thumb closest to a pressed percentage; ties go to the higher thumb. */
|
|
733
|
+
const nearestIndex = (percent: number): number => {
|
|
734
|
+
let nearest = 0;
|
|
735
|
+
let nearestDistance = Infinity;
|
|
736
|
+
internalPercents.value.forEach((thumbPercent, index) => {
|
|
737
|
+
const distance = Math.abs(percent - thumbPercent);
|
|
738
|
+
if (distance <= nearestDistance) {
|
|
739
|
+
nearest = index;
|
|
740
|
+
nearestDistance = distance;
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
return nearest;
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
/** The thumb a press landed on, or null when it landed on the track. */
|
|
747
|
+
const pressedThumbIndex = (event: Event): number | null => {
|
|
748
|
+
const index = thumbEls.value.findIndex((el) =>
|
|
749
|
+
el?.contains(event.target as Node)
|
|
750
|
+
);
|
|
751
|
+
return index === -1 ? null : index;
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
/** Arm the engaged state (`active` event, hint, `pt:*:active`). */
|
|
755
|
+
const armActive = () => {
|
|
756
|
+
if (active.value) return;
|
|
757
|
+
active.value = true;
|
|
758
|
+
emit('active');
|
|
759
|
+
document.addEventListener('focusin', onDocumentInteraction);
|
|
760
|
+
document.addEventListener('click', onDocumentInteraction);
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Focus a thumb and mark it focused. Both happen explicitly here, never as a
|
|
765
|
+
* side effect of the focus event: `focus()` on an already-focused thumb
|
|
766
|
+
* fires nothing, which used to leave a second track press without a drag
|
|
767
|
+
* target — the track went dead until the thumb itself was clicked.
|
|
768
|
+
*/
|
|
769
|
+
const engageThumb = (index: number) => {
|
|
770
|
+
focusedIndex.value = index;
|
|
771
|
+
thumbEls.value[index]?.focus();
|
|
772
|
+
armActive();
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Move one thumb to a track percentage and return its index afterwards.
|
|
777
|
+
* Thumbs may cross: the positions are re-sorted, so a thumb dragged past
|
|
778
|
+
* another takes its place, and the caller hands the drag and focus to the
|
|
779
|
+
* thumb now at that index (Radix's model). Nothing can pin a thumb — a stack
|
|
780
|
+
* of thumbs on one value always comes apart in the direction of the move.
|
|
781
|
+
*/
|
|
782
|
+
const moveThumb = (index: number, percent: number): number => {
|
|
783
|
+
const next = snapPercent(percent);
|
|
784
|
+
const positions = [...internalPercents.value];
|
|
785
|
+
positions[index] = next;
|
|
786
|
+
positions.sort((a, b) => a - b);
|
|
787
|
+
internalPercents.value = positions;
|
|
788
|
+
// A stack on one value is interchangeable: keep the thumb that moved
|
|
789
|
+
// when it is still among them.
|
|
790
|
+
return positions[index] === next ? index : positions.indexOf(next);
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
/** Move and follow: the drag and focus go where the moved value went. */
|
|
794
|
+
const moveAndFollow = (index: number, percent: number): number => {
|
|
795
|
+
const landed = moveThumb(index, percent);
|
|
796
|
+
if (landed !== index) {
|
|
797
|
+
if (dragIndex.value !== null) dragIndex.value = landed;
|
|
798
|
+
engageThumb(landed);
|
|
799
|
+
}
|
|
800
|
+
return landed;
|
|
494
801
|
};
|
|
495
802
|
|
|
496
803
|
const removePointerListeners = () => {
|
|
@@ -504,320 +811,241 @@ const removeInteractionListeners = () => {
|
|
|
504
811
|
document.removeEventListener('click', onDocumentInteraction);
|
|
505
812
|
};
|
|
506
813
|
|
|
814
|
+
/**
|
|
815
|
+
* One entry point for every press on the box, thumb or track:
|
|
816
|
+
* - a thumb press only grabs (the value follows on move, never jumps);
|
|
817
|
+
* - a track press jumps the nearest thumb to the press and drags it in the
|
|
818
|
+
* same gesture.
|
|
819
|
+
* Non-primary buttons and second pointers mid-drag are ignored, so a stray
|
|
820
|
+
* touch cannot retarget a drag already in flight.
|
|
821
|
+
*/
|
|
507
822
|
const onPointerdown = (event: PointerEvent) => {
|
|
508
823
|
if (props.disabled || props.readonly) return;
|
|
509
|
-
if (
|
|
510
|
-
|
|
824
|
+
if (event.button > 0) return;
|
|
825
|
+
if (dragIndex.value !== null) return;
|
|
826
|
+
// A 0-width / unmeasured track can't map a press to a position.
|
|
827
|
+
const percent = getPressedPercent(event);
|
|
828
|
+
if (percent === null || internalPercents.value.length === 0) return;
|
|
829
|
+
emit('pointerdown', event);
|
|
830
|
+
// The press's default focus step would run after this handler and park
|
|
831
|
+
// focus on the box's nearest focusable ancestor (or <body>) — undoing the
|
|
832
|
+
// thumb focus below, so the keyboard went dead after a track press.
|
|
833
|
+
event.preventDefault();
|
|
834
|
+
const grabbed = pressedThumbIndex(event);
|
|
835
|
+
const index = grabbed ?? nearestIndex(percent);
|
|
836
|
+
engageThumb(index);
|
|
837
|
+
dragIndex.value = index;
|
|
838
|
+
dragPointerId.value = event.pointerId ?? null;
|
|
839
|
+
try {
|
|
840
|
+
container.value?.setPointerCapture(event.pointerId);
|
|
841
|
+
} catch {
|
|
842
|
+
// A synthetic or already-released pointer has nothing to capture; the
|
|
843
|
+
// document listeners below still carry the drag.
|
|
511
844
|
}
|
|
512
|
-
thumbPressed.value = true;
|
|
513
845
|
document.addEventListener('pointermove', onPointermove);
|
|
514
846
|
document.addEventListener('pointerup', onPointerup);
|
|
515
847
|
document.addEventListener('pointercancel', onPointercancel);
|
|
516
|
-
|
|
848
|
+
if (grabbed === null) {
|
|
849
|
+
emit('pointermove', event);
|
|
850
|
+
moveAndFollow(index, percent);
|
|
851
|
+
emit('update:modelValue', getValueToEmit());
|
|
852
|
+
}
|
|
517
853
|
};
|
|
518
854
|
|
|
519
|
-
const listeners = computed(() => (thumbPressed.value ? {} : { onPointerdown }));
|
|
520
|
-
|
|
521
855
|
const onPointermove = (event: PointerEvent) => {
|
|
522
856
|
if (props.disabled || props.readonly) return;
|
|
523
|
-
if (
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
// Snap the value to the step
|
|
531
|
-
const transposedValue = transpose(
|
|
532
|
-
clickOffset,
|
|
533
|
-
trackStart,
|
|
534
|
-
trackStart + trackLength,
|
|
535
|
-
props.min,
|
|
536
|
-
props.max
|
|
537
|
-
);
|
|
538
|
-
const snappedValue = snapToStep(
|
|
539
|
-
transposedValue,
|
|
540
|
-
props.min,
|
|
541
|
-
props.max,
|
|
542
|
-
props.step
|
|
543
|
-
);
|
|
544
|
-
|
|
545
|
-
// Transform the snapped value back to a percentage so it matches the original intent
|
|
546
|
-
const adjustedPercent = getAsPercentageBetween(
|
|
547
|
-
snappedValue,
|
|
548
|
-
props.min,
|
|
549
|
-
props.max
|
|
550
|
-
);
|
|
551
|
-
const clampedPercent = clamp(adjustedPercent, 0, 100);
|
|
552
|
-
if (targetThumb.value === 'higher') {
|
|
553
|
-
internalValueHigher.value = clampedPercent;
|
|
554
|
-
} else if (targetThumb.value === 'lower') {
|
|
555
|
-
internalValueLower.value = clampedPercent;
|
|
556
|
-
}
|
|
557
|
-
emit('update:modelValue', getValueToEmit());
|
|
558
|
-
}
|
|
857
|
+
if (dragIndex.value === null) return;
|
|
858
|
+
if (!isDragPointer(event)) return;
|
|
859
|
+
const percent = getPressedPercent(event);
|
|
860
|
+
if (percent === null) return;
|
|
861
|
+
emit('pointermove', event);
|
|
862
|
+
moveAndFollow(dragIndex.value, percent);
|
|
863
|
+
emit('update:modelValue', getValueToEmit());
|
|
559
864
|
};
|
|
560
865
|
|
|
561
866
|
/**
|
|
562
|
-
* The values the hidden inputs post: one per
|
|
563
|
-
* otherwise
|
|
867
|
+
* The values the hidden inputs post: one per thumb with `multiple`, the
|
|
868
|
+
* single value otherwise. A null or empty model posts nothing.
|
|
564
869
|
*/
|
|
565
|
-
const hiddenValues = computed<Array<
|
|
870
|
+
const hiddenValues = computed<Array<BbSliderItemValue | null>>(() => {
|
|
566
871
|
const value = props.modelValue;
|
|
567
|
-
if (
|
|
568
|
-
return Array.isArray(value) && value.length
|
|
569
|
-
return [
|
|
872
|
+
if (isMultiple.value)
|
|
873
|
+
return Array.isArray(value) && value.length > 0 ? [...value] : [null];
|
|
874
|
+
return [
|
|
875
|
+
typeof value === 'number' || typeof value === 'string' ? value : null,
|
|
876
|
+
];
|
|
570
877
|
});
|
|
571
|
-
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (
|
|
581
|
-
|
|
582
|
-
[
|
|
583
|
-
getValueFromPercentageInInterval(
|
|
584
|
-
internalValueLower.value,
|
|
585
|
-
props.min,
|
|
586
|
-
props.max
|
|
587
|
-
),
|
|
588
|
-
getValueFromPercentageInInterval(
|
|
589
|
-
internalValueHigher.value,
|
|
590
|
-
props.min,
|
|
591
|
-
props.max
|
|
592
|
-
),
|
|
593
|
-
]
|
|
594
|
-
.sort((a, b) => a - b)
|
|
595
|
-
// This prevents floating point precision issues like 10.000000000000002
|
|
596
|
-
.map((v) => Number(v.toFixed(props.maxPrecision))) as [number, number]
|
|
597
|
-
);
|
|
598
|
-
} else {
|
|
599
|
-
const value = getValueFromPercentageInInterval(
|
|
600
|
-
internalValueHigher.value,
|
|
601
|
-
props.min,
|
|
602
|
-
props.max
|
|
603
|
-
);
|
|
604
|
-
return Number(value.toFixed(props.maxPrecision));
|
|
605
|
-
}
|
|
878
|
+
|
|
879
|
+
const getValueToEmit = (): BbSliderValue<
|
|
880
|
+
boolean | number,
|
|
881
|
+
BbSliderItemValue
|
|
882
|
+
> => {
|
|
883
|
+
// `valueAt` rounds away floating point dust like 10.000000000000002.
|
|
884
|
+
const values = internalPercents.value.map((percent) =>
|
|
885
|
+
fromScale(valueAt(percent))
|
|
886
|
+
);
|
|
887
|
+
if (isMultiple.value) return values;
|
|
888
|
+
return values[0] ?? fromScale(scaleMin.value);
|
|
606
889
|
};
|
|
607
890
|
|
|
608
891
|
/**
|
|
609
892
|
* DEV-only: the prepend/append `increase`/`decrease` slot callbacks are no-ops
|
|
610
|
-
*
|
|
611
|
-
* a
|
|
893
|
+
* with `multiple` (there is no single value to step). Warn so a stepper wired
|
|
894
|
+
* to a multiple slider isn't silent dead UI.
|
|
612
895
|
*/
|
|
613
|
-
const
|
|
896
|
+
const warnArrayStepper = (callback: 'increase' | 'decrease') => {
|
|
614
897
|
if (!import.meta.env.DEV) return;
|
|
615
898
|
logger.warn(
|
|
616
|
-
`BbSlider: the ${callback}() slot callback does nothing
|
|
899
|
+
`BbSlider: the ${callback}() slot callback does nothing with multiple — steppers are only supported on single-value sliders.`
|
|
617
900
|
);
|
|
618
901
|
};
|
|
619
902
|
|
|
620
903
|
/**
|
|
621
|
-
* Whether each stepper would do nothing
|
|
904
|
+
* Whether each stepper would do nothing: the
|
|
622
905
|
* `#prepend` side (decrease) at `min`, the `#append` side (increase) at
|
|
623
|
-
* `max`, both when the slider is disabled, readonly or
|
|
624
|
-
* value to step). Handed to the slots as `disabled
|
|
906
|
+
* `max`, both when the slider is disabled, readonly or `multiple` (no single
|
|
907
|
+
* value to step). Handed to the slots as `disabled` (this side) and as
|
|
908
|
+
* `decreaseDisabled` / `increaseDisabled` (both, for a slot holding − and +).
|
|
625
909
|
*/
|
|
910
|
+
/** The single value on the scale, for the steppers (unset counts as 0). */
|
|
911
|
+
const currentScale = () =>
|
|
912
|
+
isNil(props.modelValue) ? 0 : toScale(props.modelValue);
|
|
913
|
+
|
|
626
914
|
const stepDisabled = computed(() => {
|
|
627
|
-
const off = props.disabled || props.readonly ||
|
|
628
|
-
const value =
|
|
915
|
+
const off = props.disabled || props.readonly || isMultiple.value;
|
|
916
|
+
const value = off ? 0 : currentScale();
|
|
629
917
|
return {
|
|
630
|
-
decrease: off || value <=
|
|
631
|
-
increase: off || value >=
|
|
918
|
+
decrease: off || value <= scaleMin.value,
|
|
919
|
+
increase: off || value >= scaleMax.value,
|
|
632
920
|
};
|
|
633
921
|
});
|
|
634
922
|
|
|
635
|
-
const
|
|
923
|
+
const step = (direction: 1 | -1) => {
|
|
636
924
|
if (props.disabled || props.readonly) return;
|
|
637
|
-
if (
|
|
638
|
-
|
|
925
|
+
if (isMultiple.value) {
|
|
926
|
+
warnArrayStepper(direction === 1 ? 'increase' : 'decrease');
|
|
639
927
|
return;
|
|
640
928
|
}
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
929
|
+
const clamped = snapToStep(
|
|
930
|
+
currentScale() + direction * scaleStep.value,
|
|
931
|
+
scaleMin.value,
|
|
932
|
+
scaleMax.value,
|
|
933
|
+
scaleStep.value
|
|
934
|
+
);
|
|
644
935
|
// Same float-dust guard as the pointer/keyboard path (getValueToEmit).
|
|
645
|
-
emit(
|
|
936
|
+
emit(
|
|
937
|
+
'update:modelValue',
|
|
938
|
+
stops.value
|
|
939
|
+
? fromScale(Math.round(clamped))
|
|
940
|
+
: Number(clamped.toFixed(props.maxPrecision))
|
|
941
|
+
);
|
|
646
942
|
};
|
|
943
|
+
const increase = () => step(1);
|
|
944
|
+
const decrease = () => step(-1);
|
|
647
945
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
const initialValue = (props.modelValue as number | null) ?? 0;
|
|
655
|
-
const decreased = initialValue - props.step;
|
|
656
|
-
const clamped = snapToStep(decreased, props.min, props.max, props.step);
|
|
657
|
-
// Same float-dust guard as the pointer/keyboard path (getValueToEmit).
|
|
658
|
-
emit('update:modelValue', Number(clamped.toFixed(props.maxPrecision)));
|
|
659
|
-
};
|
|
946
|
+
/** Unset `multiple`: the thumbs spread evenly from `min` to `max`. */
|
|
947
|
+
const spreadPercents = (count: number) =>
|
|
948
|
+
Array.from({ length: count }, (_, index) =>
|
|
949
|
+
snapPercent((index / (count - 1)) * 100)
|
|
950
|
+
);
|
|
660
951
|
|
|
661
952
|
watch(
|
|
662
|
-
() => props.modelValue,
|
|
663
|
-
(value) => {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
internalValueLower.value = normalizedExternal[1];
|
|
683
|
-
internalValueHigher.value = normalizedExternal[0];
|
|
684
|
-
} else {
|
|
685
|
-
internalValueLower.value = normalizedExternal[0];
|
|
686
|
-
internalValueHigher.value = normalizedExternal[1];
|
|
687
|
-
}
|
|
688
|
-
} else {
|
|
689
|
-
const newValue = (value as number | null) ?? props.min;
|
|
690
|
-
const transposed = transpose(newValue, props.min, props.max, 0, 100);
|
|
691
|
-
const clamped = clamp(transposed, 0, 100);
|
|
692
|
-
internalValueHigher.value = clamped;
|
|
953
|
+
[() => props.modelValue, thumbCount, () => props.items],
|
|
954
|
+
([value, count, items]) => {
|
|
955
|
+
assertItems(items);
|
|
956
|
+
assertModelShape(value, count);
|
|
957
|
+
if (count > 1) {
|
|
958
|
+
const values = Array.isArray(value) ? value : [];
|
|
959
|
+
internalPercents.value =
|
|
960
|
+
values.length === 0
|
|
961
|
+
? spreadPercents(count)
|
|
962
|
+
: values
|
|
963
|
+
.map(toScale)
|
|
964
|
+
.sort((a, b) => a - b)
|
|
965
|
+
.map((v) =>
|
|
966
|
+
clamp(
|
|
967
|
+
getAsPercentageBetween(v, scaleMin.value, scaleMax.value),
|
|
968
|
+
0,
|
|
969
|
+
100
|
|
970
|
+
)
|
|
971
|
+
);
|
|
972
|
+
return;
|
|
693
973
|
}
|
|
974
|
+
const newValue = isNil(value) ? scaleMin.value : toScale(value);
|
|
975
|
+
const transposed = transpose(
|
|
976
|
+
newValue,
|
|
977
|
+
scaleMin.value,
|
|
978
|
+
scaleMax.value,
|
|
979
|
+
0,
|
|
980
|
+
100
|
|
981
|
+
);
|
|
982
|
+
internalPercents.value = [clamp(transposed, 0, 100)];
|
|
694
983
|
},
|
|
695
984
|
{ immediate: true }
|
|
696
985
|
);
|
|
697
986
|
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
987
|
+
const isDragPointer = (event: PointerEvent) =>
|
|
988
|
+
dragPointerId.value === null ||
|
|
989
|
+
event.pointerId == null ||
|
|
990
|
+
event.pointerId === dragPointerId.value;
|
|
991
|
+
|
|
992
|
+
const endDrag = () => {
|
|
993
|
+
dragIndex.value = null;
|
|
994
|
+
dragPointerId.value = null;
|
|
701
995
|
removePointerListeners();
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
const onPointerup = (event: PointerEvent) => {
|
|
999
|
+
if (!isDragPointer(event)) return;
|
|
1000
|
+
endDrag();
|
|
702
1001
|
emit('pointerup', event);
|
|
703
1002
|
};
|
|
704
1003
|
|
|
705
1004
|
// A touch press that turns into a pan fires pointercancel and never pointerup:
|
|
706
1005
|
// end the drag the same way, without emitting a pointerup that never happened.
|
|
707
|
-
const onPointercancel = () => {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
removePointerListeners();
|
|
1006
|
+
const onPointercancel = (event: PointerEvent) => {
|
|
1007
|
+
if (!isDragPointer(event)) return;
|
|
1008
|
+
endDrag();
|
|
711
1009
|
};
|
|
712
1010
|
|
|
713
1011
|
const proportionalStep = computed(() =>
|
|
714
|
-
getAsPercentage(
|
|
1012
|
+
getAsPercentage(scaleStep.value, scaleMax.value - scaleMin.value)
|
|
715
1013
|
);
|
|
716
1014
|
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
719
|
-
targetThumb.value === 'higher' ||
|
|
720
|
-
document.activeElement === thumbhigher.value ||
|
|
721
|
-
event.target === thumbhigher.value
|
|
722
|
-
) {
|
|
723
|
-
return 'higher' as const;
|
|
724
|
-
}
|
|
725
|
-
return 'lower' as const;
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Snap a track percentage to the step grid (Q51.6: the keyboard lands where
|
|
730
|
-
* the pointer does — never between steps, and on the last grid point when
|
|
731
|
-
* `max` is off the grid).
|
|
732
|
-
*/
|
|
733
|
-
const snapPercent = (percent: number) =>
|
|
734
|
-
getAsPercentageBetween(
|
|
735
|
-
snapToStep(
|
|
736
|
-
getValueFromPercentageInInterval(
|
|
737
|
-
clamp(percent, 0, 100),
|
|
738
|
-
props.min,
|
|
739
|
-
props.max
|
|
740
|
-
),
|
|
741
|
-
props.min,
|
|
742
|
-
props.max,
|
|
743
|
-
props.step
|
|
744
|
-
),
|
|
745
|
-
props.min,
|
|
746
|
-
props.max
|
|
747
|
-
);
|
|
748
|
-
|
|
749
|
-
const updateThumbByPercent = (thumb: 'higher' | 'lower', nextValue: number) => {
|
|
750
|
-
const clampedValue = snapPercent(nextValue);
|
|
751
|
-
if (thumb === 'higher') {
|
|
752
|
-
internalValueHigher.value = clampedValue;
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
internalValueLower.value = clampedValue;
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
const onKeydown = (event: KeyboardEvent) => {
|
|
1015
|
+
const onKeydown = (event: KeyboardEvent, index: number) => {
|
|
759
1016
|
emit('keydown', event);
|
|
760
1017
|
if (props.disabled || props.readonly) {
|
|
761
1018
|
return;
|
|
762
1019
|
}
|
|
763
|
-
|
|
1020
|
+
// Shift+Arrow jumps ten steps, like PageUp/PageDown (Radix parity).
|
|
764
1021
|
const pageStep = proportionalStep.value * 10;
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
: internalValueLower.value) - proportionalStep.value
|
|
779
|
-
),
|
|
780
|
-
ArrowRight: () =>
|
|
781
|
-
updateThumbByPercent(
|
|
782
|
-
thumb,
|
|
783
|
-
(thumb === 'higher'
|
|
784
|
-
? internalValueHigher.value
|
|
785
|
-
: internalValueLower.value) + proportionalStep.value
|
|
786
|
-
),
|
|
787
|
-
ArrowUp: () =>
|
|
788
|
-
updateThumbByPercent(
|
|
789
|
-
thumb,
|
|
790
|
-
(thumb === 'higher'
|
|
791
|
-
? internalValueHigher.value
|
|
792
|
-
: internalValueLower.value) + proportionalStep.value
|
|
793
|
-
),
|
|
794
|
-
PageDown: () =>
|
|
795
|
-
updateThumbByPercent(
|
|
796
|
-
thumb,
|
|
797
|
-
(thumb === 'higher'
|
|
798
|
-
? internalValueHigher.value
|
|
799
|
-
: internalValueLower.value) - pageStep
|
|
800
|
-
),
|
|
801
|
-
PageUp: () =>
|
|
802
|
-
updateThumbByPercent(
|
|
803
|
-
thumb,
|
|
804
|
-
(thumb === 'higher'
|
|
805
|
-
? internalValueHigher.value
|
|
806
|
-
: internalValueLower.value) + pageStep
|
|
807
|
-
),
|
|
808
|
-
Home: () => updateThumbByPercent(thumb, 0),
|
|
809
|
-
End: () => updateThumbByPercent(thumb, 100),
|
|
1022
|
+
const arrowStep = event.shiftKey ? pageStep : proportionalStep.value;
|
|
1023
|
+
const current = internalPercents.value[index] ?? 0;
|
|
1024
|
+
// Left / right move the thumb that way on screen: right to left the scale
|
|
1025
|
+
// runs leftward, so ArrowRight steps down (MUI, Radix). Home / End stay
|
|
1026
|
+
// min / max.
|
|
1027
|
+
const along = inlineStep(event.key, thumbEls.value[index]);
|
|
1028
|
+
const targets: Record<string, number> = {
|
|
1029
|
+
ArrowDown: current - arrowStep,
|
|
1030
|
+
ArrowUp: current + arrowStep,
|
|
1031
|
+
PageDown: current - pageStep,
|
|
1032
|
+
PageUp: current + pageStep,
|
|
1033
|
+
Home: 0,
|
|
1034
|
+
End: 100,
|
|
810
1035
|
};
|
|
811
|
-
const
|
|
812
|
-
|
|
1036
|
+
const target =
|
|
1037
|
+
along === null
|
|
1038
|
+
? targets[event.key]
|
|
1039
|
+
: current + (along === 'next' ? arrowStep : -arrowStep);
|
|
1040
|
+
if (target === undefined) {
|
|
813
1041
|
return;
|
|
814
1042
|
}
|
|
815
1043
|
event.preventDefault();
|
|
816
|
-
|
|
1044
|
+
moveAndFollow(index, target);
|
|
817
1045
|
emit('update:modelValue', getValueToEmit());
|
|
818
1046
|
};
|
|
819
1047
|
|
|
820
|
-
const onFocus = (event: FocusEvent) => {
|
|
1048
|
+
const onFocus = (event: FocusEvent, index: number) => {
|
|
821
1049
|
if (props.disabled) {
|
|
822
1050
|
if (event.target instanceof HTMLElement) {
|
|
823
1051
|
event.target.blur();
|
|
@@ -825,14 +1053,12 @@ const onFocus = (event: FocusEvent) => {
|
|
|
825
1053
|
return;
|
|
826
1054
|
}
|
|
827
1055
|
emit('focus', event);
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
document.addEventListener('click', onDocumentInteraction);
|
|
835
|
-
}
|
|
1056
|
+
focusedIndex.value = index;
|
|
1057
|
+
armActive();
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
const onBlur = (index: number) => {
|
|
1061
|
+
if (focusedIndex.value === index) focusedIndex.value = null;
|
|
836
1062
|
};
|
|
837
1063
|
|
|
838
1064
|
const onDocumentInteraction = (event: Event) => {
|
|
@@ -844,7 +1070,7 @@ const onDocumentInteraction = (event: Event) => {
|
|
|
844
1070
|
!!container.value?.contains(activeElement);
|
|
845
1071
|
if (!isTargetInside && !isFocusInside) {
|
|
846
1072
|
active.value = false;
|
|
847
|
-
|
|
1073
|
+
focusedIndex.value = null;
|
|
848
1074
|
emit('inactive');
|
|
849
1075
|
removeInteractionListeners();
|
|
850
1076
|
}
|
|
@@ -856,11 +1082,10 @@ const onDocumentInteraction = (event: Event) => {
|
|
|
856
1082
|
* listeners both arm. `inactive` fires only if the slider was active.
|
|
857
1083
|
*/
|
|
858
1084
|
const leave = () => {
|
|
859
|
-
|
|
860
|
-
removePointerListeners();
|
|
1085
|
+
endDrag();
|
|
861
1086
|
if (active.value) {
|
|
862
1087
|
active.value = false;
|
|
863
|
-
|
|
1088
|
+
focusedIndex.value = null;
|
|
864
1089
|
emit('inactive');
|
|
865
1090
|
}
|
|
866
1091
|
removeInteractionListeners();
|
|
@@ -872,80 +1097,79 @@ const leave = () => {
|
|
|
872
1097
|
onDeactivated(leave);
|
|
873
1098
|
onBeforeUnmount(leave);
|
|
874
1099
|
|
|
875
|
-
|
|
876
|
-
const getPressedPercent = (event: PointerEvent): number | null => {
|
|
877
|
-
if (!track.value) return null;
|
|
878
|
-
const rect = track.value.getBoundingClientRect();
|
|
879
|
-
if (rect.width === 0) return null;
|
|
880
|
-
return clamp(((event.clientX - rect.left) / rect.width) * 100, 0, 100);
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
/** The thumb closest to a pressed percentage; ties break toward the press direction. */
|
|
884
|
-
const nearestThumb = (percent: number): 'higher' | 'lower' => {
|
|
885
|
-
const distLower = Math.abs(percent - internalValueLower.value);
|
|
886
|
-
const distHigher = Math.abs(percent - internalValueHigher.value);
|
|
887
|
-
if (distLower === distHigher) {
|
|
888
|
-
return percent < internalValueLower.value ? 'lower' : 'higher';
|
|
889
|
-
}
|
|
890
|
-
return distLower < distHigher ? 'lower' : 'higher';
|
|
891
|
-
};
|
|
892
|
-
|
|
1100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- an attribute and listener bag bound with `v-bind`; `Record<string, unknown>` (Vue's `Data`) would type it too, nothing gained internally
|
|
893
1101
|
const innerContainerAttributes: Record<string, any> = {
|
|
894
|
-
onPointerdown
|
|
895
|
-
// Don't focus the thumb or attach document drag listeners on a disabled or
|
|
896
|
-
// readonly track (the value can't change anyway) — SUS-024.
|
|
897
|
-
if (props.disabled || props.readonly) return;
|
|
898
|
-
// A 0-width / unmeasured track can't map a press to a position — bail for
|
|
899
|
-
// BOTH range and single mode (single mode previously skipped this guard and
|
|
900
|
-
// acted on a NaN position when the track measured 0×0).
|
|
901
|
-
const percent = getPressedPercent(event);
|
|
902
|
-
if (percent === null) return;
|
|
903
|
-
if (props.range) {
|
|
904
|
-
// Range mode: move the nearest thumb to the pressed position and drag
|
|
905
|
-
// it, instead of leaving the track dead.
|
|
906
|
-
targetThumb.value = nearestThumb(percent);
|
|
907
|
-
(targetThumb.value === 'lower'
|
|
908
|
-
? thumblower.value
|
|
909
|
-
: thumbhigher.value
|
|
910
|
-
)?.focus();
|
|
911
|
-
} else {
|
|
912
|
-
thumbhigher.value?.focus();
|
|
913
|
-
}
|
|
914
|
-
onPointermove(event);
|
|
915
|
-
document.addEventListener('pointermove', onPointermove);
|
|
916
|
-
document.addEventListener('pointerup', onPointerup);
|
|
917
|
-
document.addEventListener('pointercancel', onPointercancel);
|
|
918
|
-
},
|
|
1102
|
+
onPointerdown,
|
|
919
1103
|
};
|
|
920
1104
|
|
|
921
|
-
/**
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
return {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1105
|
+
/**
|
|
1106
|
+
* The rail's segments: N thumbs cut it into N + 1, numbered from the start.
|
|
1107
|
+
* Positions are percentages; `from` / `to` are the values a `pt` function
|
|
1108
|
+
* reads.
|
|
1109
|
+
*/
|
|
1110
|
+
const segments = computed(() => {
|
|
1111
|
+
const edges = [0, ...internalPercents.value, 100];
|
|
1112
|
+
return edges.slice(0, -1).map((start, index) => {
|
|
1113
|
+
const end = edges[index + 1] ?? 100;
|
|
1114
|
+
const segment: BbSliderSegment = {
|
|
1115
|
+
index,
|
|
1116
|
+
from: valueAt(start),
|
|
1117
|
+
to: valueAt(end),
|
|
1118
|
+
};
|
|
1119
|
+
return { start, end, segment };
|
|
1120
|
+
});
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* The painted bars (`fill`). `normal` is one bar from the start to the thumb
|
|
1125
|
+
* (segment 0), or from the lowest to the highest thumb with `multiple`
|
|
1126
|
+
* (segments 1…N-1 as one bar, its `index` the first of them); `inverted` the
|
|
1127
|
+
* outer segments; `segments` every one. A bar touching an end of the rail
|
|
1128
|
+
* takes that end's rounding.
|
|
1129
|
+
*/
|
|
1130
|
+
const bars = computed(() => {
|
|
1131
|
+
const all = segments.value;
|
|
1132
|
+
const last = all.length - 1;
|
|
1133
|
+
type Span = { start: number; end: number; segment: BbSliderSegment };
|
|
1134
|
+
let spans: Span[];
|
|
1135
|
+
if (resolvedFill.value === 'segments') spans = all;
|
|
1136
|
+
else if (resolvedFill.value === 'inverted')
|
|
1137
|
+
spans = last === 1 ? [all[1]] : [all[0], all[last]];
|
|
1138
|
+
else if (last === 1) spans = [all[0]];
|
|
1139
|
+
else {
|
|
1140
|
+
const first = all[1];
|
|
1141
|
+
const end = all[last - 1];
|
|
1142
|
+
spans = [
|
|
1143
|
+
{
|
|
1144
|
+
start: first.start,
|
|
1145
|
+
end: end.end,
|
|
1146
|
+
segment: { index: 1, from: first.segment.from, to: end.segment.to },
|
|
1147
|
+
},
|
|
1148
|
+
];
|
|
1149
|
+
}
|
|
1150
|
+
return spans.map(({ start, end, segment }) => ({
|
|
1151
|
+
segment,
|
|
1152
|
+
start,
|
|
1153
|
+
end,
|
|
1154
|
+
attrs: {
|
|
1155
|
+
class: [
|
|
1156
|
+
'bb-slider__bar',
|
|
1157
|
+
{
|
|
1158
|
+
'bb-slider__bar--start': segment.index === 0,
|
|
1159
|
+
'bb-slider__bar--end': segment.index === last,
|
|
1160
|
+
},
|
|
1161
|
+
],
|
|
1162
|
+
style: { width: `${end - start}%`, left: `${start}%` },
|
|
1163
|
+
},
|
|
1164
|
+
}));
|
|
932
1165
|
});
|
|
933
1166
|
|
|
934
1167
|
type Tick = {
|
|
935
|
-
value:
|
|
1168
|
+
value: V;
|
|
1169
|
+
label: string | undefined;
|
|
936
1170
|
percent: number;
|
|
937
1171
|
active: boolean;
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
const isSelected = (value: number) => {
|
|
941
|
-
if (isNil(props.modelValue)) return false;
|
|
942
|
-
|
|
943
|
-
if (Array.isArray(props.modelValue)) {
|
|
944
|
-
if (props.modelValue.length === 0) return false;
|
|
945
|
-
const ordered = [...props.modelValue].sort((a, b) => a - b);
|
|
946
|
-
return ordered[0] <= value && ordered[1] >= value;
|
|
947
|
-
}
|
|
948
|
-
return value <= Number(props.modelValue);
|
|
1172
|
+
segment: BbSliderSegment;
|
|
949
1173
|
};
|
|
950
1174
|
|
|
951
1175
|
const ticks = computed<Tick[]>(() => {
|
|
@@ -956,19 +1180,33 @@ const ticks = computed<Tick[]>(() => {
|
|
|
956
1180
|
// reach the loop below with an increment that never advances `current`, and
|
|
957
1181
|
// hang the tab — inside a computed, so during render. A silent empty tick
|
|
958
1182
|
// list is a far better failure than a frozen page.
|
|
959
|
-
if (!Number.isFinite(
|
|
1183
|
+
if (!Number.isFinite(scaleStep.value) || scaleStep.value <= 0)
|
|
1184
|
+
return [] as Tick[];
|
|
1185
|
+
// An unset single slider paints nothing, so no tick is in range.
|
|
1186
|
+
const unset = !isMultiple.value && isNil(props.modelValue);
|
|
1187
|
+
const painted = bars.value;
|
|
1188
|
+
const all = segments.value;
|
|
960
1189
|
const ticks: Tick[] = [];
|
|
961
|
-
let current =
|
|
962
|
-
while (current <=
|
|
963
|
-
const
|
|
964
|
-
const percent = getAsPercentageBetween(
|
|
965
|
-
|
|
1190
|
+
let current = scaleMin.value;
|
|
1191
|
+
while (current <= scaleMax.value) {
|
|
1192
|
+
const position = current;
|
|
1193
|
+
const percent = getAsPercentageBetween(
|
|
1194
|
+
position,
|
|
1195
|
+
scaleMin.value,
|
|
1196
|
+
scaleMax.value
|
|
1197
|
+
);
|
|
1198
|
+
// A tick on a thumb belongs to the segment before it.
|
|
1199
|
+
const owner = all.find(({ end }) => percent <= end) ?? all[all.length - 1];
|
|
966
1200
|
ticks.push({
|
|
967
|
-
value,
|
|
1201
|
+
value: asItem(fromScale(position)),
|
|
1202
|
+
label: labelAt(position),
|
|
968
1203
|
percent,
|
|
969
|
-
active
|
|
1204
|
+
active:
|
|
1205
|
+
!unset &&
|
|
1206
|
+
painted.some(({ start, end }) => percent >= start && percent <= end),
|
|
1207
|
+
segment: owner.segment,
|
|
970
1208
|
});
|
|
971
|
-
current +=
|
|
1209
|
+
current += scaleStep.value;
|
|
972
1210
|
}
|
|
973
1211
|
return ticks;
|
|
974
1212
|
});
|
|
@@ -985,13 +1223,21 @@ const ticks = computed<Tick[]>(() => {
|
|
|
985
1223
|
```ts
|
|
986
1224
|
import type { Responsive } from '@/types/ResponsiveSize';
|
|
987
1225
|
import type { HTMLAttributes, InputHTMLAttributes } from 'vue';
|
|
988
|
-
import type {
|
|
1226
|
+
import type {
|
|
1227
|
+
PtCompoundProps,
|
|
1228
|
+
PtItemCtx,
|
|
1229
|
+
PtItemResult,
|
|
1230
|
+
PtNoInfer,
|
|
1231
|
+
PtScopedItemMap,
|
|
1232
|
+
PtValue,
|
|
1233
|
+
} from '@/types/passthrough';
|
|
989
1234
|
import type { FieldCrossAlign, FieldLayout } from '@/types/FieldLayout';
|
|
990
1235
|
import type { FormFieldProps } from '@/composables/useFormBinding';
|
|
991
1236
|
import type { CommonFieldAsteriskSlotProps } from '../CommonField/types';
|
|
1237
|
+
import type { BbSliderPtKeys } from './ptKeys.generated';
|
|
992
1238
|
|
|
993
1239
|
/**
|
|
994
|
-
* Passthrough parts of `BbSlider
|
|
1240
|
+
* Passthrough parts of `BbSlider`.
|
|
995
1241
|
*
|
|
996
1242
|
* @part root - The slider's container: the label, the track and the lines
|
|
997
1243
|
* under them.
|
|
@@ -1007,13 +1253,17 @@ import type { CommonFieldAsteriskSlotProps } from '../CommonField/types';
|
|
|
1007
1253
|
* here reach everything inside.
|
|
1008
1254
|
* @part track - The rail the thumbs slide on: its full length, painted with
|
|
1009
1255
|
* `--track-color`.
|
|
1010
|
-
* @part bar -
|
|
1011
|
-
*
|
|
1012
|
-
* and position are set from the
|
|
1256
|
+
* @part bar - A coloured piece on the rail: from the start to the value, or
|
|
1257
|
+
* from the lowest to the highest thumb with `multiple`; `fill` picks other
|
|
1258
|
+
* pieces. Painted with `--accent`; its size and position are set from the
|
|
1259
|
+
* value (the same word as BbProgress's fill). A broadcast.
|
|
1013
1260
|
* @part ticks - The row that holds the tick marks (`ticks` prop).
|
|
1014
1261
|
* @part tick - Every tick mark; a broadcast, resolved per tick with its own
|
|
1015
1262
|
* `inRange`. Its content is the `tick` slot.
|
|
1016
|
-
* @part thumb - Every handle — one, or
|
|
1263
|
+
* @part thumb - Every handle — one, or one per value with `multiple`; a
|
|
1264
|
+
* broadcast.
|
|
1265
|
+
*
|
|
1266
|
+
* Per-item functions: on the instance, `bar` and `tick` also accept `({ item, inRange, … }) => PtValue | false | null | undefined` — `item` is the rail segment (`{ index, from, to }`; the thumbs cut the rail into segments `0…N`) the bar paints or the tick sits on, and every state a boolean beside it — in the `pt` object or the `:pt:<part>` attribute, never on a `<part>:<state>` key and never in the global map or a scope (they ship as JSON). Its result is merged last, after every state entry, through the same deduper; a falsy result leaves the node as it was. See the passthrough guide, _Per-item functions_.
|
|
1017
1267
|
*/
|
|
1018
1268
|
export type BbSliderPtPart =
|
|
1019
1269
|
| 'root'
|
|
@@ -1030,6 +1280,9 @@ export type BbSliderPtPart =
|
|
|
1030
1280
|
/**
|
|
1031
1281
|
* Passthrough states of `BbSlider`, true while the matching `--` modifier is on.
|
|
1032
1282
|
*
|
|
1283
|
+
* @state hasValue - Component-wide: a value is set — the model is not
|
|
1284
|
+
* `null`; with `multiple`, it holds at least one value (`[]` is unset).
|
|
1285
|
+
* On every part.
|
|
1033
1286
|
* @state readonly - Component-wide: the slider is `readonly`.
|
|
1034
1287
|
* @state disabled - Component-wide: the slider is `disabled`.
|
|
1035
1288
|
* @state warnings - Component-wide: the slider shows warnings and no errors.
|
|
@@ -1044,12 +1297,13 @@ export type BbSliderPtState =
|
|
|
1044
1297
|
| 'warnings'
|
|
1045
1298
|
| 'disabled'
|
|
1046
1299
|
| 'readonly'
|
|
1300
|
+
| 'hasValue'
|
|
1047
1301
|
| 'active'
|
|
1048
1302
|
| 'inRange';
|
|
1049
1303
|
/** Every `part` / `part:state` key of `BbSlider` — only the pairs that land: `inRange` on a tick. */
|
|
1050
1304
|
export type BbSliderPtKey =
|
|
1051
1305
|
| BbSliderPtPart
|
|
1052
|
-
| `${BbSliderPtPart}:${'readonly' | 'disabled' | 'warnings' | 'errors' | 'active'}`
|
|
1306
|
+
| `${BbSliderPtPart}:${'hasValue' | 'readonly' | 'disabled' | 'warnings' | 'errors' | 'active'}`
|
|
1053
1307
|
| 'tick:inRange';
|
|
1054
1308
|
/** The runtime lists the resolver is wired with — kept next to the types so the two cannot drift. */
|
|
1055
1309
|
export const BB_SLIDER_PT = {
|
|
@@ -1066,10 +1320,18 @@ export const BB_SLIDER_PT = {
|
|
|
1066
1320
|
'tick',
|
|
1067
1321
|
'thumb',
|
|
1068
1322
|
],
|
|
1069
|
-
states: [
|
|
1323
|
+
states: [
|
|
1324
|
+
'hasValue',
|
|
1325
|
+
'inRange',
|
|
1326
|
+
'readonly',
|
|
1327
|
+
'disabled',
|
|
1328
|
+
'warnings',
|
|
1329
|
+
'errors',
|
|
1330
|
+
'active',
|
|
1331
|
+
],
|
|
1070
1332
|
/** On every part: what the resolver's `active` map turns on. */
|
|
1071
|
-
wide: ['readonly', 'disabled', 'warnings', 'errors', 'active'],
|
|
1072
|
-
/** Per node: a tick
|
|
1333
|
+
wide: ['hasValue', 'readonly', 'disabled', 'warnings', 'errors', 'active'],
|
|
1334
|
+
/** Per node: a tick under a painted bar. */
|
|
1073
1335
|
node: { tick: ['inRange'] },
|
|
1074
1336
|
} as const satisfies {
|
|
1075
1337
|
parts: readonly BbSliderPtPart[];
|
|
@@ -1078,229 +1340,329 @@ export const BB_SLIDER_PT = {
|
|
|
1078
1340
|
node: Partial<Record<BbSliderPtPart, readonly BbSliderPtState[]>>;
|
|
1079
1341
|
};
|
|
1080
1342
|
|
|
1081
|
-
/**
|
|
1082
|
-
export type
|
|
1083
|
-
? number | [number, number]
|
|
1084
|
-
: R extends true
|
|
1085
|
-
? [number, number]
|
|
1086
|
-
: number;
|
|
1343
|
+
/** The parts that also take a per-item function, called with a rail segment. */
|
|
1344
|
+
export type BbSliderItemPtPart = 'bar' | 'tick';
|
|
1087
1345
|
|
|
1088
|
-
/**
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1346
|
+
/**
|
|
1347
|
+
* One segment of the rail: the thumbs cut it into `N + 1` segments, numbered
|
|
1348
|
+
* from the start (`0`) to the end (`N`). What a `bar` paints and a `tick`
|
|
1349
|
+
* sits on — the `item` of their per-item `pt` functions. With `items`,
|
|
1350
|
+
* `from` / `to` are positions in the list (`0` = the first stop).
|
|
1351
|
+
*/
|
|
1352
|
+
export type BbSliderSegment = {
|
|
1353
|
+
/** The segment's position on the rail, `0` (start) … `N` (end). */
|
|
1354
|
+
readonly index: number;
|
|
1355
|
+
/** Its start value: `min`, or the thumb before it. */
|
|
1356
|
+
readonly from: number;
|
|
1357
|
+
/** Its end value: the thumb after it, or `max`. */
|
|
1358
|
+
readonly to: number;
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
/** What an `items` stop's `value` can be. */
|
|
1362
|
+
export type BbSliderItemValue = string | number;
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* One stop of an `items` slider: the value itself (its label is the value
|
|
1366
|
+
* as written), or `{ value, label }` — the label is what assistive tech
|
|
1367
|
+
* announces (`aria-valuetext`) and what the `tick` / `thumb` slots receive.
|
|
1368
|
+
*/
|
|
1369
|
+
export type BbSliderItem<V = BbSliderItemValue> =
|
|
1370
|
+
| V
|
|
1371
|
+
| { readonly value: V; readonly label?: string };
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* A slider's emitted value: a number (an `items` value with `items`), or one
|
|
1375
|
+
* per thumb with `multiple`, sorted (`[low, high]` with a bare `multiple`:
|
|
1376
|
+
* two thumbs).
|
|
1377
|
+
*/
|
|
1378
|
+
export type BbSliderValue<
|
|
1379
|
+
M extends boolean | number = boolean | number,
|
|
1380
|
+
V = number,
|
|
1381
|
+
> = boolean extends M
|
|
1382
|
+
? V | V[]
|
|
1383
|
+
: [M] extends [false]
|
|
1384
|
+
? V
|
|
1385
|
+
: [M] extends [true]
|
|
1386
|
+
? [V, V]
|
|
1387
|
+
: V[];
|
|
1388
|
+
|
|
1389
|
+
/** What `modelValue` takes: `multiple` accepts any readonly array. */
|
|
1390
|
+
type BbSliderModel<M extends boolean | number, V> = boolean extends M
|
|
1391
|
+
? V | readonly V[]
|
|
1392
|
+
: [M] extends [false]
|
|
1393
|
+
? V
|
|
1394
|
+
: readonly V[];
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* BbSlider's `pt:*` attributes: the documented keys, and the patterns
|
|
1398
|
+
* Vue's SFC resolver skips (compound keys, an app's own variant states; the
|
|
1399
|
+
* vue-ignore marker). This alias keeps the marker on a member right after its
|
|
1400
|
+
* `=`: the declaration emit drops it at the start of a line or ahead of a whole type.
|
|
1401
|
+
*/
|
|
1402
|
+
type BbSliderPtProps = /* @vue-ignore */ PtCompoundProps<typeof BB_SLIDER_PT> &
|
|
1403
|
+
BbSliderPtKeys;
|
|
1094
1404
|
|
|
1095
1405
|
// Spelled INLINE with this component's own unions (Vue's SFC type resolver
|
|
1096
1406
|
// does not substitute a generic alias's type parameters — PASSTHROUGH.md T20).
|
|
1097
|
-
|
|
1098
|
-
export type BbSliderBaseProps = {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
readonly?:
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1407
|
+
/* eslint-disable @typescript-eslint/consistent-indexed-object-style */
|
|
1408
|
+
export type BbSliderBaseProps = BbSliderPtProps & {
|
|
1409
|
+
// The segment parts also take a per-item function, called with the
|
|
1410
|
+
// segment — a literal function type, not `PtItemFn` (T23).
|
|
1411
|
+
[K in `pt:${BbSliderItemPtPart}`]?:
|
|
1412
|
+
| PtValue
|
|
1413
|
+
| ((ctx: PtItemCtx<BbSliderSegment, BbSliderPtState>) => PtItemResult);
|
|
1414
|
+
} & {
|
|
1415
|
+
/**
|
|
1416
|
+
* Passthrough, object form: the same keys as the `pt:*` attributes
|
|
1417
|
+
* without the prefix. See the `pt:<part>` row.
|
|
1418
|
+
*/
|
|
1419
|
+
pt?: PtScopedItemMap<
|
|
1420
|
+
BbSliderPtKey,
|
|
1421
|
+
BbSliderItemPtPart,
|
|
1422
|
+
BbSliderPtState,
|
|
1423
|
+
BbSliderSegment
|
|
1424
|
+
>;
|
|
1425
|
+
/* eslint-enable @typescript-eslint/consistent-indexed-object-style */
|
|
1426
|
+
/**
|
|
1427
|
+
* Focuses the field when it mounts (a dialog already open included), unless the user is typing in another field.
|
|
1428
|
+
*/
|
|
1429
|
+
autofocus?: InputHTMLAttributes['autofocus'];
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Compact density. The track's height follows `--bb-input-h-compact` and the
|
|
1433
|
+
* label gap `--bb-label-spacing-y-compact`, so a `--bb-input-h` or
|
|
1434
|
+
* `--bb-label-spacing-y` you set on the component is ignored while
|
|
1435
|
+
* `compact` is on: set the `-compact` tokens instead.
|
|
1436
|
+
*/
|
|
1437
|
+
compact?: boolean;
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Text between the label and the input. Unlike the hint it is always
|
|
1441
|
+
* visible; it joins the input's `aria-describedby` after any `errors` /
|
|
1442
|
+
* `warnings`, before the `hint`.
|
|
1443
|
+
*/
|
|
1444
|
+
description?: string;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* How label and input sit together: `'vertical'`, `'horizontal'` (50/50),
|
|
1448
|
+
* `'auto'`, `'label-fill'`, `'input-fill'`, a ratio like `'xx xxxxx'`, or a
|
|
1449
|
+
* per-breakpoint map (`{ default: 'vertical', md: 'xx xxxxx' }`).
|
|
1450
|
+
*/
|
|
1451
|
+
layout?: Responsive<FieldLayout>;
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Vertical position of the label block in a side-by-side row; not
|
|
1455
|
+
* `labelPosition`, the horizontal one. Omitted, the label's first line
|
|
1456
|
+
* meets the control's.
|
|
1457
|
+
*/
|
|
1458
|
+
labelAlign?: FieldCrossAlign;
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Vertical position of the control in a side-by-side row; not
|
|
1462
|
+
* `inputPosition`, the horizontal one. Omitted, the control's first line
|
|
1463
|
+
* meets the label's.
|
|
1464
|
+
*/
|
|
1465
|
+
inputAlign?: FieldCrossAlign;
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* Disables the component.
|
|
1469
|
+
*/
|
|
1470
|
+
disabled?: boolean;
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Error messages under the field, a string or array, in an
|
|
1474
|
+
* `aria-live="polite"` region and first in the control's
|
|
1475
|
+
* `aria-describedby`, so they are re-read when it regains focus.
|
|
1476
|
+
*/
|
|
1477
|
+
errors?: string | string[];
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* Define if the component should be in an error state.
|
|
1481
|
+
* It usually attaches a CSS class for styling purposes.
|
|
1482
|
+
*/
|
|
1483
|
+
hasErrors?: boolean;
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Warning messages under the field, a string or array: amber, in their own
|
|
1487
|
+
* `aria-live` region and in the control's `aria-describedby` after the
|
|
1488
|
+
* errors. Non-empty turns on the warning state; errors win when both are
|
|
1489
|
+
* set.
|
|
1490
|
+
*/
|
|
1491
|
+
warnings?: string | string[];
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* Define if the component should be in a warning state.
|
|
1495
|
+
* Same chrome as errors with `--bb-warn`; errors take priority.
|
|
1496
|
+
*/
|
|
1497
|
+
hasWarnings?: boolean;
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Visually hides the label of the input while maintaining accessibility.
|
|
1501
|
+
*/
|
|
1502
|
+
hideLabel?: boolean;
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* Text box to be displayed near the input, usually to indicate instructions.
|
|
1506
|
+
*/
|
|
1507
|
+
hint?: string;
|
|
1508
|
+
|
|
1509
|
+
/**
|
|
1510
|
+
* The `id` of the native control; the label's `for` and the description
|
|
1511
|
+
* and message ids derive from it. Generated when omitted.
|
|
1512
|
+
*/
|
|
1513
|
+
id?: HTMLAttributes['id'];
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Text content of the label of the element.
|
|
1517
|
+
*/
|
|
1518
|
+
label: string;
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Text alignment of the label. `'start'` / `'end'` follow the page direction (the inline start is the left in a left-to-right page, the right in a right-to-left one); `'left'` / `'right'` stay physical; `'center'` centres it.
|
|
1522
|
+
* The default, `'start'`, follows the page direction.
|
|
1523
|
+
*
|
|
1524
|
+
* @defaultValue `'start'`
|
|
1525
|
+
*/
|
|
1526
|
+
labelPosition?: 'left' | 'center' | 'right' | 'start' | 'end';
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* Label rendering mode.
|
|
1530
|
+
* Sliders do not support `floating` labels.
|
|
1531
|
+
*/
|
|
1532
|
+
labelMode?: 'outside' | 'inside';
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Maximum value cap.
|
|
1536
|
+
*
|
|
1537
|
+
* @defaultValue `100`
|
|
1538
|
+
*/
|
|
1539
|
+
max?: number;
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Maximum decimal places to retain in emitted values.
|
|
1543
|
+
* @defaultValue `2`
|
|
1544
|
+
*/
|
|
1545
|
+
maxPrecision?: number;
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* Minimum value cap.
|
|
1549
|
+
*
|
|
1550
|
+
* @defaultValue `0`
|
|
1551
|
+
*/
|
|
1552
|
+
min?: number;
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* Used by v-model.
|
|
1556
|
+
*
|
|
1557
|
+
* @defaultValue `0`
|
|
1558
|
+
*/
|
|
1559
|
+
modelValue?: Array<number | string> | number | string | null;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* Named stops instead of a numeric scale, spaced evenly in list order:
|
|
1563
|
+
* strings, numbers or `{ value, label }`. `v-model` holds the `value`;
|
|
1564
|
+
* `label` is announced and passed to the slots. Replaces `min` / `max`
|
|
1565
|
+
* / `step` (setting them too throws).
|
|
1566
|
+
*/
|
|
1567
|
+
items?: ReadonlyArray<
|
|
1568
|
+
| string
|
|
1569
|
+
| number
|
|
1570
|
+
| { readonly value: string | number; readonly label?: string }
|
|
1571
|
+
>;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* Defines the name of the input.
|
|
1575
|
+
*/
|
|
1576
|
+
name?: InputHTMLAttributes['name'];
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Keeps the hint displayed.
|
|
1580
|
+
*/
|
|
1581
|
+
persistentHint?: boolean;
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* Several thumbs: `multiple` is two (a min–max interval), `:multiple="3"`
|
|
1585
|
+
* three (at least 2). `modelValue` holds one value per thumb, always
|
|
1586
|
+
* sorted, or is empty (`[]` / `null`) to start unset; another length
|
|
1587
|
+
* throws. Thumbs may cross.
|
|
1588
|
+
*/
|
|
1589
|
+
multiple?: boolean | number;
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* Which rail segments are painted: `'normal'` start → thumb (lowest →
|
|
1593
|
+
* highest with `multiple`), `'inverted'` the rest, `'segments'` every
|
|
1594
|
+
* segment as its own `bar` (colour each with a `pt:bar` function on
|
|
1595
|
+
* `item.index`).
|
|
1596
|
+
*
|
|
1597
|
+
* @defaultValue `'normal'`
|
|
1598
|
+
*/
|
|
1599
|
+
fill?: 'normal' | 'inverted' | 'segments';
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Sets the input in a readonly state.
|
|
1603
|
+
*/
|
|
1604
|
+
readonly?: boolean;
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Reverses the layout. Applicable in every direction the order of the label and
|
|
1608
|
+
* the input is swapped.
|
|
1609
|
+
*/
|
|
1610
|
+
reverse?: boolean;
|
|
1611
|
+
|
|
1612
|
+
/**
|
|
1613
|
+
* The step attribute specifies the granularity that the value must adhere to.
|
|
1614
|
+
*
|
|
1615
|
+
* @defaultValue `1`
|
|
1616
|
+
*/
|
|
1617
|
+
step?: number;
|
|
1618
|
+
|
|
1619
|
+
/**
|
|
1620
|
+
* Disables the proportional thumb translation that keeps the thumb on
|
|
1621
|
+
* track (enabled by default). Set it when displaying ticks so they align
|
|
1622
|
+
* with less effort.
|
|
1623
|
+
*
|
|
1624
|
+
* @defaultValue `false`
|
|
1625
|
+
*/
|
|
1626
|
+
disableThumbTranslate?: boolean;
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* Displays ticks on step.
|
|
1630
|
+
*/
|
|
1631
|
+
ticks?: boolean;
|
|
1632
|
+
} & FormFieldProps<Array<number | string> | number | string | null>;
|
|
1289
1633
|
|
|
1290
1634
|
/**
|
|
1291
|
-
* The v-model of `BbSlider`, typed by the mode props (
|
|
1635
|
+
* The v-model of `BbSlider`, typed by the mode props (vmodel): what the
|
|
1292
1636
|
* generic component adds to `BbSliderBaseProps`, whose own spelling stays
|
|
1293
1637
|
* non-generic so the SFC compiler keeps Vue's Boolean cast on them.
|
|
1294
1638
|
*/
|
|
1295
|
-
export type BbSliderModelProps<
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1639
|
+
export type BbSliderModelProps<
|
|
1640
|
+
M extends boolean | number = boolean | number,
|
|
1641
|
+
V = number,
|
|
1642
|
+
> = {
|
|
1643
|
+
multiple?: M;
|
|
1644
|
+
modelValue?: PtNoInfer<BbSliderModel<M, V>> | null;
|
|
1645
|
+
} & (
|
|
1646
|
+
| { items?: undefined }
|
|
1647
|
+
// `items` sets the stops: `step` / `min` / `max` beside it are a type
|
|
1648
|
+
// error here (and a throw at mount for untyped callers).
|
|
1649
|
+
| {
|
|
1650
|
+
items: ReadonlyArray<BbSliderItem<V>>;
|
|
1651
|
+
step?: never;
|
|
1652
|
+
min?: never;
|
|
1653
|
+
max?: never;
|
|
1654
|
+
}
|
|
1655
|
+
);
|
|
1299
1656
|
|
|
1300
|
-
export type BbSliderProps<
|
|
1301
|
-
|
|
1657
|
+
export type BbSliderProps<
|
|
1658
|
+
M extends boolean | number = boolean | number,
|
|
1659
|
+
V = number,
|
|
1660
|
+
> = BbSliderBaseProps & BbSliderModelProps<M, V>;
|
|
1302
1661
|
|
|
1303
|
-
export type BbSliderEvents<
|
|
1662
|
+
export type BbSliderEvents<
|
|
1663
|
+
M extends boolean | number = boolean | number,
|
|
1664
|
+
V = number,
|
|
1665
|
+
> = {
|
|
1304
1666
|
/**
|
|
1305
1667
|
* Emitted when the slider gains focus and becomes interactive.
|
|
1306
1668
|
*/
|
|
@@ -1320,7 +1682,7 @@ export type BbSliderEvents<R extends boolean = boolean> = {
|
|
|
1320
1682
|
*/
|
|
1321
1683
|
(e: 'keydown', event: KeyboardEvent): void;
|
|
1322
1684
|
/**
|
|
1323
|
-
* Emitted when a pointer device is pressed on a thumb.
|
|
1685
|
+
* Emitted when a pointer device is pressed on a thumb or on the track.
|
|
1324
1686
|
* Forwards the original DOM `PointerEvent`.
|
|
1325
1687
|
*/
|
|
1326
1688
|
(e: 'pointerdown', event: PointerEvent): void;
|
|
@@ -1336,19 +1698,30 @@ export type BbSliderEvents<R extends boolean = boolean> = {
|
|
|
1336
1698
|
(e: 'pointerup', event: PointerEvent): void;
|
|
1337
1699
|
/**
|
|
1338
1700
|
* Emitted with new value(s) whenever the slider position changes.
|
|
1339
|
-
*
|
|
1701
|
+
* A number for a single slider (an `items` value with `items`), one per
|
|
1702
|
+
* thumb (sorted) with `multiple`.
|
|
1340
1703
|
*/
|
|
1341
|
-
(e: 'update:modelValue', value: BbSliderValue<
|
|
1704
|
+
(e: 'update:modelValue', value: BbSliderValue<M, V>): void;
|
|
1342
1705
|
};
|
|
1343
1706
|
|
|
1344
1707
|
/**
|
|
1345
|
-
* Props exposed by the `thumb
|
|
1708
|
+
* Props exposed by the `thumb` slot.
|
|
1346
1709
|
*/
|
|
1347
|
-
export type BbSliderThumbSlotProps = {
|
|
1710
|
+
export type BbSliderThumbSlotProps<V = number> = {
|
|
1711
|
+
/**
|
|
1712
|
+
* Which thumb this is, by position from the start: `0` for a single
|
|
1713
|
+
* slider, the value's index in the sorted array with `multiple`.
|
|
1714
|
+
*/
|
|
1715
|
+
index: number;
|
|
1348
1716
|
/**
|
|
1349
1717
|
* The current value controlled by this thumb, or `undefined` if unset.
|
|
1350
1718
|
*/
|
|
1351
|
-
value:
|
|
1719
|
+
value: V | undefined;
|
|
1720
|
+
/**
|
|
1721
|
+
* The `label` of the stop under the thumb with `items`, else
|
|
1722
|
+
* `undefined`.
|
|
1723
|
+
*/
|
|
1724
|
+
label: string | undefined;
|
|
1352
1725
|
/**
|
|
1353
1726
|
* The thumb's horizontal position as a percentage (0–100) along the track.
|
|
1354
1727
|
*/
|
|
@@ -1375,27 +1748,49 @@ export type BbSliderStepSlotProps = {
|
|
|
1375
1748
|
* Whether this side's stepper would do nothing, for its button's
|
|
1376
1749
|
* `disabled`: in `#prepend` (the decrease side) the value is at `min`, in
|
|
1377
1750
|
* `#append` (the increase side) at `max`; on both sides the slider is
|
|
1378
|
-
* `disabled`, `readonly` or
|
|
1751
|
+
* `disabled`, `readonly` or `multiple`.
|
|
1379
1752
|
*/
|
|
1380
1753
|
disabled: boolean;
|
|
1754
|
+
/**
|
|
1755
|
+
* `increase()` would not move the value: it sits at `max`, or the slider is
|
|
1756
|
+
* `disabled` / `readonly` / `multiple`. The same in both slots, for a slot
|
|
1757
|
+
* holding both buttons.
|
|
1758
|
+
*/
|
|
1759
|
+
increaseDisabled: boolean;
|
|
1760
|
+
/**
|
|
1761
|
+
* `decrease()` would not move the value: it sits at `min`, or the slider is
|
|
1762
|
+
* `disabled` / `readonly` / `multiple`. The same in both slots, for a slot
|
|
1763
|
+
* holding both buttons.
|
|
1764
|
+
*/
|
|
1765
|
+
decreaseDisabled: boolean;
|
|
1381
1766
|
};
|
|
1382
1767
|
|
|
1383
1768
|
/**
|
|
1384
1769
|
* Props exposed by the `tick` slot.
|
|
1385
1770
|
*/
|
|
1386
|
-
export type BbSliderTickSlotProps = {
|
|
1771
|
+
export type BbSliderTickSlotProps<V = number> = {
|
|
1387
1772
|
/**
|
|
1388
|
-
* The
|
|
1773
|
+
* The value this tick represents (an `items` value with `items`).
|
|
1389
1774
|
*/
|
|
1390
|
-
value:
|
|
1775
|
+
value: V;
|
|
1776
|
+
/**
|
|
1777
|
+
* The stop's `label` with `items`, else `undefined`.
|
|
1778
|
+
*/
|
|
1779
|
+
label: string | undefined;
|
|
1391
1780
|
/**
|
|
1392
1781
|
* The tick's horizontal position as a percentage (0–100) along the track.
|
|
1393
1782
|
*/
|
|
1394
1783
|
percent: number;
|
|
1395
1784
|
/**
|
|
1396
|
-
* Whether the tick
|
|
1785
|
+
* Whether the tick sits under a painted `bar` (which ones `fill` picks).
|
|
1397
1786
|
*/
|
|
1398
1787
|
active: boolean;
|
|
1788
|
+
/**
|
|
1789
|
+
* The rail segment the tick sits on, `0` (start) … `N` (end) — the
|
|
1790
|
+
* `item.index` of the `bar` painting it, to colour ticks like their bar.
|
|
1791
|
+
* A tick on a thumb belongs to the segment before it.
|
|
1792
|
+
*/
|
|
1793
|
+
segment: number;
|
|
1399
1794
|
};
|
|
1400
1795
|
|
|
1401
1796
|
/** Props exposed by the `description` slot. */
|
|
@@ -1421,16 +1816,8 @@ export type BbSliderLabelSlotProps = CommonFieldAsteriskSlotProps & {
|
|
|
1421
1816
|
// Every slot below has an empty runtime default, so none is required to render
|
|
1422
1817
|
// a slider. The thumb / tick / step slots used to be the only non-optional
|
|
1423
1818
|
// slots across ~132 in the library, which made the slots type unusable as a
|
|
1424
|
-
// plain object type
|
|
1425
|
-
export type BbSliderSlots = {
|
|
1426
|
-
/**
|
|
1427
|
-
* Replaces the default higher-value thumb in range mode (`range: true`).
|
|
1428
|
-
*/
|
|
1429
|
-
'thumb:higher'?: (props: BbSliderThumbSlotProps) => any;
|
|
1430
|
-
/**
|
|
1431
|
-
* Replaces the default lower-value thumb in range mode (`range: true`).
|
|
1432
|
-
*/
|
|
1433
|
-
'thumb:lower'?: (props: BbSliderThumbSlotProps) => any;
|
|
1819
|
+
// plain object type.
|
|
1820
|
+
export type BbSliderSlots<V = number> = {
|
|
1434
1821
|
/**
|
|
1435
1822
|
* Content rendered after the slider track, typically used to add a max-value label or button.
|
|
1436
1823
|
*/
|
|
@@ -1440,13 +1827,13 @@ export type BbSliderSlots = {
|
|
|
1440
1827
|
*/
|
|
1441
1828
|
prepend?: (props: BbSliderStepSlotProps) => any;
|
|
1442
1829
|
/**
|
|
1443
|
-
*
|
|
1830
|
+
* Replaces every thumb's content; with `multiple`, tell them apart by `index`.
|
|
1444
1831
|
*/
|
|
1445
|
-
thumb?: (props: BbSliderThumbSlotProps) => any;
|
|
1832
|
+
thumb?: (props: BbSliderThumbSlotProps<V>) => any;
|
|
1446
1833
|
/**
|
|
1447
1834
|
* Replaces the default tick mark rendered at each step when ticks are enabled.
|
|
1448
1835
|
*/
|
|
1449
|
-
tick?: (props: BbSliderTickSlotProps) => any;
|
|
1836
|
+
tick?: (props: BbSliderTickSlotProps<V>) => any;
|
|
1450
1837
|
/**
|
|
1451
1838
|
* Replaces the default label text rendered above the slider.
|
|
1452
1839
|
*/
|
|
@@ -1581,7 +1968,7 @@ export type BbSliderSlots = {
|
|
|
1581
1968
|
background-color: var(--bg);
|
|
1582
1969
|
border: var(--bw) solid var(--border-color);
|
|
1583
1970
|
border-radius: var(--r);
|
|
1584
|
-
/* Elevation alone; the ring is the outline
|
|
1971
|
+
/* Elevation alone; the ring is the outline: full width from rest,
|
|
1585
1972
|
transparent, only its colour fades (in on the focused state's
|
|
1586
1973
|
`--ring-t`, out on this one's). */
|
|
1587
1974
|
box-shadow: var(--elev);
|
|
@@ -1595,6 +1982,10 @@ export type BbSliderSlots = {
|
|
|
1595
1982
|
padding-bottom: var(--py);
|
|
1596
1983
|
padding-top: var(--py);
|
|
1597
1984
|
position: relative;
|
|
1985
|
+
/* A press anywhere on the box starts a drag, so the browser must not
|
|
1986
|
+
claim the gesture for scrolling first (it would fire pointercancel
|
|
1987
|
+
and kill the drag mid-move). The thumb already opts out alone. */
|
|
1988
|
+
touch-action: none;
|
|
1598
1989
|
-webkit-touch-callout: none;
|
|
1599
1990
|
|
|
1600
1991
|
--ring-t: var(--bb-transition-medium);
|
|
@@ -1629,15 +2020,21 @@ export type BbSliderSlots = {
|
|
|
1629
2020
|
right: var(--track-inset);
|
|
1630
2021
|
top: var(--centre);
|
|
1631
2022
|
transform: translateY(-50%);
|
|
2023
|
+
|
|
2024
|
+
/* Right to left the scale runs from the right edge: the rail is
|
|
2025
|
+
symmetric, so mirroring it moves the bars (placed from the left in JS)
|
|
2026
|
+
and their end rounding with it. `scale`, not `transform`, so a `pt`
|
|
2027
|
+
transform on the rail still composes. */
|
|
2028
|
+
&:dir(rtl) {
|
|
2029
|
+
scale: -1 1;
|
|
2030
|
+
}
|
|
1632
2031
|
}
|
|
1633
2032
|
|
|
1634
|
-
/*
|
|
2033
|
+
/* A bar: one painted segment (`fill`), positioned and sized from JS. It
|
|
2034
|
+
takes the rail's rounding only where it meets an end of the rail; between
|
|
2035
|
+
thumbs its ends sit under them. */
|
|
1635
2036
|
.bb-slider__bar {
|
|
1636
2037
|
background-color: var(--accent);
|
|
1637
|
-
/* stylelint-disable-next-line property-disallowed-list -- geometry: the thumb and fill are placed by physical percentages set in JS */
|
|
1638
|
-
border-bottom-left-radius: var(--r);
|
|
1639
|
-
/* stylelint-disable-next-line property-disallowed-list -- geometry: the thumb and fill are placed by physical percentages set in JS */
|
|
1640
|
-
border-top-left-radius: var(--r);
|
|
1641
2038
|
cursor: pointer;
|
|
1642
2039
|
display: block;
|
|
1643
2040
|
height: 100%;
|
|
@@ -1647,23 +2044,48 @@ export type BbSliderSlots = {
|
|
|
1647
2044
|
top: 0;
|
|
1648
2045
|
}
|
|
1649
2046
|
|
|
2047
|
+
.bb-slider__bar--start {
|
|
2048
|
+
/* stylelint-disable-next-line property-disallowed-list -- geometry: the thumb and fill are placed by physical percentages set in JS */
|
|
2049
|
+
border-bottom-left-radius: var(--r);
|
|
2050
|
+
/* stylelint-disable-next-line property-disallowed-list -- geometry: the thumb and fill are placed by physical percentages set in JS */
|
|
2051
|
+
border-top-left-radius: var(--r);
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
.bb-slider__bar--end {
|
|
2055
|
+
/* stylelint-disable-next-line property-disallowed-list -- geometry: the thumb and fill are placed by physical percentages set in JS */
|
|
2056
|
+
border-bottom-right-radius: var(--r);
|
|
2057
|
+
/* stylelint-disable-next-line property-disallowed-list -- geometry: the thumb and fill are placed by physical percentages set in JS */
|
|
2058
|
+
border-top-right-radius: var(--r);
|
|
2059
|
+
}
|
|
2060
|
+
|
|
1650
2061
|
.bb-slider__thumb-container {
|
|
1651
2062
|
display: block;
|
|
1652
2063
|
position: absolute;
|
|
1653
2064
|
top: var(--centre);
|
|
1654
2065
|
|
|
1655
2066
|
/* Hover highlights like focus (shadcn behavior) — a hint that the
|
|
1656
|
-
thumb is grabbable before the pointer commits.
|
|
2067
|
+
thumb is grabbable before the pointer commits. The engaged thumb
|
|
2068
|
+
also paints above its neighbours, so stacked thumbs (two
|
|
2069
|
+
values on one point) show which one
|
|
2070
|
+
has focus instead of hiding its ring under the next thumb. */
|
|
1657
2071
|
&:focus,
|
|
1658
2072
|
&:hover {
|
|
2073
|
+
z-index: 1;
|
|
2074
|
+
|
|
1659
2075
|
.bb-slider__thumb {
|
|
1660
2076
|
--ring-t: var(--bb-transition-fast);
|
|
1661
2077
|
outline-color: var(--ring-color);
|
|
1662
2078
|
}
|
|
1663
2079
|
}
|
|
2080
|
+
|
|
2081
|
+
&:active {
|
|
2082
|
+
.bb-slider__thumb {
|
|
2083
|
+
cursor: grabbing;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
1664
2086
|
}
|
|
1665
2087
|
|
|
1666
|
-
/* Sealed fill
|
|
2088
|
+
/* Sealed fill: the plate paints `--bg`, defaulted to the panel at
|
|
1667
2089
|
specificity 0 — a `pt` class or a theme island retints this one surface
|
|
1668
2090
|
without moving `--bb-panel` for every panel on the page. */
|
|
1669
2091
|
:where(.bb-slider__thumb) {
|
|
@@ -1671,6 +2093,9 @@ export type BbSliderSlots = {
|
|
|
1671
2093
|
}
|
|
1672
2094
|
|
|
1673
2095
|
.bb-slider__thumb {
|
|
2096
|
+
/* Which physical way the thumb's own-width pull points (BbSlider.vue
|
|
2097
|
+
`thumbStyle`): toward the inline start, the left left to right. */
|
|
2098
|
+
--sx: -1;
|
|
1674
2099
|
/* Small-chrome resting lift, DECLARED here so it is sealed: an ancestor
|
|
1675
2100
|
that sets `--elev` for its own plate must not reach in and lift this.
|
|
1676
2101
|
Same tier and same name as the checkbox and radio glyphs. */
|
|
@@ -1680,9 +2105,11 @@ export type BbSliderSlots = {
|
|
|
1680
2105
|
/* Circle is the library default (Material / HIG). Hard-edge languages
|
|
1681
2106
|
square this in host leftover — do not mint a thumb-shape knob. */
|
|
1682
2107
|
border-radius: 50%;
|
|
1683
|
-
/* Elevation alone; the ring is the outline
|
|
2108
|
+
/* Elevation alone; the ring is the outline, faded like the box's. */
|
|
1684
2109
|
box-shadow: var(--elev);
|
|
1685
|
-
|
|
2110
|
+
/* A handle, not a link: grab reads as draggable where pointer only
|
|
2111
|
+
promised a click (the track keeps `pointer`, click-to-jump). */
|
|
2112
|
+
cursor: grab;
|
|
1686
2113
|
display: block;
|
|
1687
2114
|
height: var(--thumb);
|
|
1688
2115
|
outline: var(--bb-ring-size) solid transparent;
|
|
@@ -1694,6 +2121,10 @@ export type BbSliderSlots = {
|
|
|
1694
2121
|
transition-property: box-shadow, outline-color;
|
|
1695
2122
|
transition-timing-function: var(--bb-ease);
|
|
1696
2123
|
width: var(--thumb);
|
|
2124
|
+
|
|
2125
|
+
&:dir(rtl) {
|
|
2126
|
+
--sx: 1;
|
|
2127
|
+
}
|
|
1697
2128
|
}
|
|
1698
2129
|
|
|
1699
2130
|
/* The tick row sits IN the box's flow, below the control row, so whatever
|
|
@@ -1776,11 +2207,11 @@ export type BbSliderSlots = {
|
|
|
1776
2207
|
}
|
|
1777
2208
|
}
|
|
1778
2209
|
|
|
1779
|
-
/* ---- Touch target: the thumb
|
|
2210
|
+
/* ---- Touch target: the thumb ---------------------------------
|
|
1780
2211
|
* The thumb is a 12px circle and only a thumb takes the drag: a fingertip
|
|
1781
2212
|
* that lands 7px off it grabs nothing. On a coarse pointer only, an invisible
|
|
1782
2213
|
* 44×44 `::after` centred on the thumb is the grab area; the thumb, the rail
|
|
1783
|
-
* and the row height do not change. Two
|
|
2214
|
+
* and the row height do not change. Two thumbs closer than 44px share
|
|
1784
2215
|
* that zone and the upper thumb (later in the DOM) takes it, the same
|
|
1785
2216
|
* precedence their visual overlap already has. */
|
|
1786
2217
|
@media (pointer: coarse) {
|