bitboss-ui 3.0.0-beta.71 → 3.0.0-beta.72
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 +2 -2
- package/bin/cli.mjs +6 -1
- package/dist/ai/BbAccordion.md +38 -19
- package/dist/ai/BbBadge.md +25 -22
- package/dist/ai/BbBreadcrumbs.md +1 -1
- package/dist/ai/BbButton.md +32 -27
- package/dist/ai/BbCalendar.md +1 -0
- package/dist/ai/BbCarousel.md +6 -4
- package/dist/ai/BbCheckboxGroup.md +2 -1
- package/dist/ai/BbColorInput.md +1 -1
- package/dist/ai/BbConfirm.md +65 -81
- package/dist/ai/BbConfirmPortal.md +2 -2
- package/dist/ai/BbDatePicker.md +1 -6
- package/dist/ai/BbDatePickerInput.md +2 -2
- package/dist/ai/BbDialog.md +230 -164
- package/dist/ai/BbDropdown.md +52 -16
- package/dist/ai/BbDropdownButton.md +11 -12
- package/dist/ai/BbDropzone.md +12 -8
- package/dist/ai/BbForm.md +93 -7
- package/dist/ai/BbHost.md +2 -2
- package/dist/ai/BbHoverCardPortal.md +1 -1
- package/dist/ai/BbIcon.md +1 -1
- package/dist/ai/BbIndicator.md +17 -15
- package/dist/ai/BbNumberInput.md +7 -5
- package/dist/ai/BbOffCanvas.md +29 -7
- package/dist/ai/BbPagination.md +2 -2
- package/dist/ai/BbPopover.md +15 -9
- package/dist/ai/BbPopoverPortal.md +1 -1
- package/dist/ai/BbRadioGroup.md +29 -7
- package/dist/ai/BbRating.md +8 -7
- package/dist/ai/BbSelect.md +29 -8
- package/dist/ai/BbSelectPopover.md +9 -3
- package/dist/ai/BbSlider.md +12 -8
- package/dist/ai/BbSpinner.md +3 -2
- package/dist/ai/BbSwitch.md +3 -3
- package/dist/ai/BbSwitchGroup.md +7 -6
- package/dist/ai/BbTable.md +205 -82
- package/dist/ai/BbTabs.md +29 -4
- package/dist/ai/BbTag.md +1 -1
- package/dist/ai/BbTextInput.md +7 -5
- package/dist/ai/BbTextarea.md +4 -3
- package/dist/ai/BbTimePickerInput.md +1 -1
- package/dist/ai/BbToast.md +3 -2
- package/dist/ai/BbTooltip.md +22 -17
- package/dist/ai/BbTree.md +49 -24
- package/dist/ai/CommonFieldInput.md +1 -1
- package/dist/ai/changelog.json +238 -9
- package/dist/ai/components.json +52 -51
- package/dist/ai/composables/useBbDialog.md +5 -8
- package/dist/ai/composables/useBbForm.md +3 -0
- package/dist/ai/composables/useConfirm.md +65 -56
- package/dist/ai/composables/useToast.md +2 -1
- package/dist/ai/guides/agent-contract.md +3 -3
- package/dist/ai/guides/app-layout.md +3 -2
- package/dist/ai/guides/eslint-rules.md +3 -1
- package/dist/ai/guides/fetch-items-playbook.md +1 -1
- package/dist/ai/guides/floating-bottom-panel.md +3 -2
- package/dist/ai/guides/icons-policy.md +7 -5
- package/dist/ai/guides/inertia-helpers.md +35 -30
- package/dist/ai/guides/installation-and-plugin-setup.md +17 -14
- package/dist/ai/guides/migration/adoption-checklist.md +2 -2
- package/dist/ai/guides/migration/components/bb-badge.md +12 -1
- package/dist/ai/guides/migration/components/bb-button.md +24 -0
- package/dist/ai/guides/migration/components/bb-dropdown-button.md +11 -0
- package/dist/ai/guides/migration/components/bb-tabs.md +2 -2
- package/dist/ai/guides/migration/components/bb-toast.md +11 -0
- package/dist/ai/guides/migration/components/use-confirm.md +69 -26
- package/dist/ai/guides/migration/v2-to-v3.md +52 -10
- package/dist/ai/guides/migration/v3-beta-css-classes.md +1 -1
- package/dist/ai/guides/options-items-playbook.md +4 -3
- package/dist/ai/guides/passthrough.md +2 -2
- package/dist/ai/helpers/inertia/manifest.json +28 -15
- package/dist/ai/helpers/inertia/messages.ts +3 -3
- package/dist/ai/helpers/inertia/useConfirmOnRouteLeave.ts +10 -10
- package/dist/ai/helpers/inertia/usePromiseForm.ts +1 -1
- package/dist/ai/helpers/inertia/usePromiseRouter.ts +7 -2
- package/dist/ai/index.md +3 -3
- package/dist/ai/manifest/common.json +3 -3
- package/dist/ai/manifest/components/BbAccordion.json +8 -5
- package/dist/ai/manifest/components/BbAccordion.tree.json +1 -0
- package/dist/ai/manifest/components/BbBadge.json +8 -7
- package/dist/ai/manifest/components/BbBadge.removed.json +3 -1
- package/dist/ai/manifest/components/BbBadge.tree.json +73 -0
- package/dist/ai/manifest/components/BbBreadcrumbs.json +1 -1
- package/dist/ai/manifest/components/BbButton.json +5 -6
- package/dist/ai/manifest/components/BbButton.removed.json +3 -1
- package/dist/ai/manifest/components/BbButton.tree.json +24 -7
- package/dist/ai/manifest/components/BbCalendar.json +2 -1
- package/dist/ai/manifest/components/BbCheckboxGroup.json +2 -2
- package/dist/ai/manifest/components/BbColorInput.json +1 -1
- package/dist/ai/manifest/components/BbColorInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbConfirm.json +2 -2
- package/dist/ai/manifest/components/BbConfirm.removed.json +9 -0
- package/dist/ai/manifest/components/BbConfirm.tree.json +4 -5
- package/dist/ai/manifest/components/BbConfirmPortal.json +3 -3
- package/dist/ai/manifest/components/BbConfirmPortal.removed.json +7 -0
- package/dist/ai/manifest/components/BbDatePicker.json +2 -1
- package/dist/ai/manifest/components/BbDatePicker.tree.json +0 -6
- package/dist/ai/manifest/components/BbDatePickerInput.json +2 -2
- package/dist/ai/manifest/components/BbDatePickerInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbDialog.json +6 -1
- package/dist/ai/manifest/components/BbDialog.tree.json +41 -1
- package/dist/ai/manifest/components/BbDropdown.json +9 -8
- package/dist/ai/manifest/components/BbDropdown.tree.json +4 -0
- package/dist/ai/manifest/components/BbDropdownButton.json +8 -9
- package/dist/ai/manifest/components/BbDropdownButton.removed.json +3 -1
- package/dist/ai/manifest/components/BbForm.json +3 -1
- package/dist/ai/manifest/components/BbNumberInput.json +1 -1
- package/dist/ai/manifest/components/BbNumberInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbOffCanvas.json +6 -1
- package/dist/ai/manifest/components/BbOffCanvas.tree.json +40 -0
- package/dist/ai/manifest/components/BbPagination.json +1 -1
- package/dist/ai/manifest/components/BbRadioGroup.json +4 -3
- package/dist/ai/manifest/components/BbRating.json +2 -2
- package/dist/ai/manifest/components/BbSelect.json +16 -15
- package/dist/ai/manifest/components/BbSelect.tree.json +1 -1
- package/dist/ai/manifest/components/BbSelectPopover.json +1 -0
- package/dist/ai/manifest/components/BbSwitch.json +4 -4
- package/dist/ai/manifest/components/BbSwitchGroup.json +7 -7
- package/dist/ai/manifest/components/BbTable.json +15 -14
- package/dist/ai/manifest/components/BbTable.tree.json +2 -0
- package/dist/ai/manifest/components/BbTabs.json +3 -3
- package/dist/ai/manifest/components/BbTabsList.json +1 -1
- package/dist/ai/manifest/components/BbTabsRoot.json +1 -1
- package/dist/ai/manifest/components/BbTag.json +1 -1
- package/dist/ai/manifest/components/BbTag.tree.json +1 -1
- package/dist/ai/manifest/components/BbTextInput.json +1 -1
- package/dist/ai/manifest/components/BbTextInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbTextarea.json +1 -1
- package/dist/ai/manifest/components/BbTextarea.tree.json +1 -1
- package/dist/ai/manifest/components/BbTimePicker.json +1 -1
- package/dist/ai/manifest/components/BbTimePickerInput.json +1 -1
- package/dist/ai/manifest/components/BbTimePickerInput.tree.json +1 -1
- package/dist/ai/manifest/components/BbToast.removed.json +2 -1
- package/dist/ai/manifest/components/BbTree.json +2 -2
- package/dist/ai/manifest/components/CommonFieldInput.tree.json +3 -3
- package/dist/ai/manifest/index.json +4 -4
- package/dist/ai/manifest/meta.json +5 -1
- package/dist/ai/manifest/types.advanced.json +9 -9
- package/dist/ai/manifest/types.api.json +6 -5
- package/dist/ai/recipes/inertia/approvals-inbox.md +23 -16
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +12 -5
- package/dist/ai/recipes/inertia/layout-scaffold.md +5 -3
- package/dist/ai/recipes/inertia/onboarding.md +23 -12
- package/dist/ai/recipes/inertia/ownership-atlas.md +34 -18
- package/dist/ai/recipes/inertia/record-form.md +12 -8
- package/dist/ai/recipes/inertia/records-workspace.md +14 -7
- package/dist/ai/recipes/inertia/settings-workspace.md +75 -60
- package/dist/ai/recipes/inertia/upload-center.md +17 -9
- package/dist/ai/recipes/inertia/wizard-form.md +2 -2
- package/dist/ai/recipes/nuxt/approvals-inbox.md +23 -16
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +12 -5
- package/dist/ai/recipes/nuxt/layout-scaffold.md +5 -3
- package/dist/ai/recipes/nuxt/onboarding.md +5 -4
- package/dist/ai/recipes/nuxt/ownership-atlas.md +34 -18
- package/dist/ai/recipes/nuxt/record-form.md +14 -10
- package/dist/ai/recipes/nuxt/records-workspace.md +14 -7
- package/dist/ai/recipes/nuxt/settings-workspace.md +70 -60
- package/dist/ai/recipes/nuxt/upload-center.md +17 -9
- package/dist/ai/recipes/nuxt/wizard-form.md +4 -4
- package/dist/ai/recipes/vue/approvals-inbox.md +23 -16
- package/dist/ai/recipes/vue/inline-edit-workspace.md +12 -5
- package/dist/ai/recipes/vue/layout-scaffold.md +5 -3
- package/dist/ai/recipes/vue/onboarding.md +5 -4
- package/dist/ai/recipes/vue/ownership-atlas.md +34 -18
- package/dist/ai/recipes/vue/record-form.md +14 -10
- package/dist/ai/recipes/vue/records-workspace.md +14 -7
- package/dist/ai/recipes/vue/settings-workspace.md +70 -60
- package/dist/ai/recipes/vue/upload-center.md +17 -9
- package/dist/ai/recipes/vue/wizard-form.md +4 -4
- package/dist/ai/source/BbAccordion.md +50 -16
- package/dist/ai/source/BbBadge.md +420 -26
- package/dist/ai/source/BbBadgeButton.md +378 -12
- package/dist/ai/source/BbButton.md +205 -55
- package/dist/ai/source/BbCalendar.md +5 -0
- package/dist/ai/source/BbCheckboxGroup.md +38 -13
- package/dist/ai/source/BbConfigScope.md +19 -2
- package/dist/ai/source/BbConfirm.md +74 -80
- package/dist/ai/source/BbConfirmPortal.md +6 -6
- package/dist/ai/source/BbDatePicker.md +9 -2
- package/dist/ai/source/BbDatePickerInput.md +3 -1
- package/dist/ai/source/BbDialog.md +53 -2
- package/dist/ai/source/BbDropdown.md +350 -98
- package/dist/ai/source/BbDropdownButton.md +20 -12
- package/dist/ai/source/BbDropdownGroup.md +136 -58
- package/dist/ai/source/BbForm.md +144 -10
- package/dist/ai/source/BbOffCanvas.md +53 -2
- package/dist/ai/source/BbPagination.md +1 -1
- package/dist/ai/source/BbRadioGroup.md +72 -10
- package/dist/ai/source/BbRating.md +30 -22
- package/dist/ai/source/BbSelect.md +11 -1
- package/dist/ai/source/BbSelectPopover.md +105 -34
- package/dist/ai/source/BbSwitch.md +23 -8
- package/dist/ai/source/BbSwitchGroup.md +67 -21
- package/dist/ai/source/BbTable.md +359 -48
- package/dist/ai/source/BbTabs.md +6 -0
- package/dist/ai/source/BbTabsList.md +10 -0
- package/dist/ai/source/BbTabsPanels.md +6 -0
- package/dist/ai/source/BbTabsRoot.md +6 -0
- package/dist/ai/source/BbTree.md +14 -4
- package/dist/ai/source/CommonFieldInput.md +2 -1
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +7 -3
- package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +52 -38
- package/dist/components/BbAccordion/ptKeys.generated.d.ts +20 -0
- package/dist/components/BbAccordion/types.d.ts +21 -7
- package/dist/components/BbAccordion/types.js +1 -1
- package/dist/components/BbAlert/BbAlert.vue.d.ts +1 -1
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/BbBadge/BbBadge.vue.d.ts +1 -1
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +65 -42
- package/dist/components/BbBadge/types.d.ts +15 -12
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +79 -73
- package/dist/components/BbButton/types.d.ts +7 -6
- package/dist/components/BbCalendar/BbCalendar.vue.d.ts +2 -1
- package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BbCalendar/types.d.ts +5 -0
- package/dist/components/BbCalendar/useCalendarGrid.js +1 -1
- package/dist/components/BbCalendar/useDayGrid.js +1 -1
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +10 -4
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbCheckboxGroup/types.d.ts +2 -2
- package/dist/components/BbConfigScope/BbConfigScope.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +71 -132
- package/dist/components/BbConfirm/ptKeys.generated.d.ts +5 -5
- package/dist/components/BbConfirm/types.d.ts +5 -5
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +2 -1
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/components/BbDatePicker/types.d.ts +5 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +1 -1
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/BbDatePickerInput/types.d.ts +2 -1
- package/dist/components/BbDialog/BbDialog.vue.d.ts +3 -0
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +263 -235
- package/dist/components/BbDialog/overlayActions.js +94 -0
- package/dist/components/BbDialog/types.d.ts +24 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +382 -332
- package/dist/components/BbDropdown/dropdownHandle.js +6 -0
- package/dist/components/BbDropdown/normalizeGroups.js +58 -48
- package/dist/components/BbDropdown/types.d.ts +107 -48
- package/dist/components/BbDropdown/types.js +2 -2
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +71 -71
- package/dist/components/BbDropdownButton/types.d.ts +2 -4
- package/dist/components/BbForm/BbForm.vue.d.ts +2 -1
- package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +240 -198
- package/dist/components/BbForm/recognizeValidation.d.ts +9 -0
- package/dist/components/BbForm/recognizeValidation.js +55 -0
- package/dist/components/BbForm/validationError.d.ts +10 -0
- package/dist/components/BbForm/validationError.js +11 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +3 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +414 -389
- package/dist/components/BbOffCanvas/sheetAttrs.js +5 -5
- package/dist/components/BbOffCanvas/types.d.ts +24 -0
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +10 -4
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +173 -157
- package/dist/components/BbRadioGroup/types.d.ts +9 -3
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +112 -103
- package/dist/components/BbRating/types.d.ts +3 -2
- package/dist/components/BbSelect/BbSelect.vue.d.ts +9 -8
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/components/BbSelect/types.d.ts +8 -0
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +11 -4
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +513 -502
- package/dist/components/BbSelectPopover/types.d.ts +10 -2
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +2 -0
- package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +85 -73
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +10 -4
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +171 -152
- package/dist/components/BbSwitchGroup/types.d.ts +1 -1
- package/dist/components/BbTable/BbTable.vue.d.ts +36 -25
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +1338 -1215
- package/dist/components/BbTable/BbTableDataRow.js +2 -1
- package/dist/components/BbTable/BbTableRowMenu.js +36 -0
- package/dist/components/BbTable/types.d.ts +32 -17
- package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbTabs/types.d.ts +6 -0
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +1 -1
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +1 -1
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +1 -1
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +88 -94
- package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/components/BbTree/types.d.ts +8 -2
- package/dist/components/CommonFieldInput/CommonFieldInput.vue_vue_type_script_setup_true_lang.js +39 -39
- package/dist/composables/formSubmitLock.js +15 -8
- package/dist/composables/overlayRegistry.d.ts +5 -0
- package/dist/composables/overlayRegistry.js +154 -148
- package/dist/composables/useBbDropdown.d.ts +8 -0
- package/dist/composables/useBbDropdown.js +3 -1
- package/dist/composables/useBbTabs.js +138 -138
- package/dist/composables/useConfirm.d.ts +63 -52
- package/dist/composables/useConfirm.js +22 -18
- package/dist/deprecation/ai-deprecations.json.js +1 -1
- package/dist/directives/bbDropdown.d.ts +7 -7
- package/dist/directives/bbDropdown.js +21 -14
- package/dist/directives/bbTooltip.d.ts +3 -3
- package/dist/directives/createPopoverDirective.js +57 -35
- package/dist/i18n/locales/ar.json +5 -1
- package/dist/i18n/locales/cs.json +5 -1
- package/dist/i18n/locales/da.json +5 -1
- package/dist/i18n/locales/de-CH.json +5 -1
- package/dist/i18n/locales/de.json +5 -1
- package/dist/i18n/locales/el.json +5 -1
- package/dist/i18n/locales/en-GB.json +5 -1
- package/dist/i18n/locales/en.json +5 -1
- package/dist/i18n/locales/es-MX.json +5 -1
- package/dist/i18n/locales/es.json +5 -1
- package/dist/i18n/locales/fa.json +5 -1
- package/dist/i18n/locales/fi.json +5 -1
- package/dist/i18n/locales/fr.json +5 -1
- package/dist/i18n/locales/he.json +5 -1
- package/dist/i18n/locales/hu.json +5 -1
- package/dist/i18n/locales/it.json +5 -1
- package/dist/i18n/locales/ja.json +5 -1
- package/dist/i18n/locales/ko.json +5 -1
- package/dist/i18n/locales/nb.json +5 -1
- package/dist/i18n/locales/nl.json +5 -1
- package/dist/i18n/locales/pl.json +5 -1
- package/dist/i18n/locales/pt-BR.json +5 -1
- package/dist/i18n/locales/pt-PT.json +5 -1
- package/dist/i18n/locales/ro.json +5 -1
- package/dist/i18n/locales/ru.json +5 -1
- package/dist/i18n/locales/sv.json +5 -1
- package/dist/i18n/locales/tr.json +5 -1
- package/dist/i18n/locales/uk.json +5 -1
- package/dist/i18n/locales/zh-CN.json +5 -1
- package/dist/i18n/locales/zh-HK.json +5 -1
- package/dist/i18n/locales/zh-TW.json +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -3
- package/dist/llms-full.txt +1984 -1145
- package/dist/llms-medium.txt +21 -18
- package/dist/llms.txt +2 -2
- package/dist/locale-blueprint.json +5 -1
- package/dist/plugin.js +17 -40
- package/dist/pluginCore.js +30 -0
- package/dist/styles.css +2 -2
- package/dist/types/ActionButton.d.ts +26 -5
- package/dist/types/ActionButton.js +11 -0
- package/dist/types/ConfigDefaults.d.ts +34 -3
- package/dist/types/ConfigDefaults.js +14 -8
- package/dist/types/ItemPath.d.ts +33 -4
- package/dist/types/ptComponentMap.d.ts +1 -1
- package/dist/utilities/functions/clickCount.js +14 -0
- package/dist/utils/versionCheck.js +1 -1
- package/llms.txt +2 -2
- package/package.json +11 -1
- package/scripts/README.md +31 -27
- package/scripts/lib/adoption-checklist.json +2 -2
- package/scripts/lib/eslint-disable.mjs +5 -3
- package/scripts/lib/eslint-plugin.d.ts +2 -0
- package/scripts/lib/eslint-plugin.mjs +213 -1
- package/scripts/lib/redundant-item-accessor.mjs +4 -1
- package/scripts/lib/release-results.mjs +32 -1
- package/scripts/lib/renamed-item-field.mjs +4 -1
- package/scripts/lib/tab-links.mjs +4 -1
- package/scripts/lib/tree-default-expandable.mjs +53 -0
- package/scripts/lib/validate-bb-markup.mjs +536 -52
|
@@ -62,6 +62,12 @@
|
|
|
62
62
|
v-bind="passthrough.input"
|
|
63
63
|
/>
|
|
64
64
|
<!-- eslint-enable vue/attributes-order -->
|
|
65
|
+
<span
|
|
66
|
+
v-if="shown && belowMinQuery"
|
|
67
|
+
:id="`${id}_search_hint`"
|
|
68
|
+
class="bb-sr-only"
|
|
69
|
+
>{{ minQueryHint }}</span
|
|
70
|
+
>
|
|
65
71
|
<ErrorIcon
|
|
66
72
|
aria-hidden="true"
|
|
67
73
|
class="bb-select-popover__search-error-icon"
|
|
@@ -300,8 +306,21 @@
|
|
|
300
306
|
<script
|
|
301
307
|
setup
|
|
302
308
|
lang="ts"
|
|
303
|
-
generic="
|
|
309
|
+
generic="
|
|
310
|
+
const Item = any,
|
|
311
|
+
Known extends BbSelectKnownItems | undefined = undefined,
|
|
312
|
+
A extends string | ((...args: never[]) => unknown) | undefined = undefined,
|
|
313
|
+
Tx extends string | undefined = undefined,
|
|
314
|
+
M extends boolean = false
|
|
315
|
+
"
|
|
304
316
|
>
|
|
317
|
+
import type { ItemGetter } from '@/types/ItemAccessor';
|
|
318
|
+
import type {
|
|
319
|
+
ItemKeyInput,
|
|
320
|
+
MultipleInput,
|
|
321
|
+
OptionValueOf,
|
|
322
|
+
SelectModelOf,
|
|
323
|
+
} from '@/types/ItemPath';
|
|
305
324
|
import { closeOnRelease } from '@/utils/releasedActivator';
|
|
306
325
|
import { asSheetAttrs } from '../BbOffCanvas/sheetAttrs';
|
|
307
326
|
import type { FallthroughAttrs } from '@/types/fallthrough';
|
|
@@ -421,8 +440,12 @@ import { hasVnodeListener } from '@/utilities/functions/hasVnodeListener';
|
|
|
421
440
|
// @attrTargets span dialog
|
|
422
441
|
const props = withDefaults(
|
|
423
442
|
defineProps<
|
|
424
|
-
BbSelectPopoverProps<Item, Known> &
|
|
425
|
-
|
|
443
|
+
BbSelectPopoverProps<Item, Known> & /* @vue-ignore */ {
|
|
444
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a getter returns any value; `A` reads which
|
|
445
|
+
itemValue?: ItemKeyInput<Item, A> | ItemGetter<Item, any>;
|
|
446
|
+
itemText?: ItemKeyInput<Item, Tx> | ItemGetter<Item, string>;
|
|
447
|
+
multiple?: MultipleInput<M>;
|
|
448
|
+
} & /* @vue-ignore */ FallthroughAttrs<
|
|
426
449
|
'span' | 'dialog',
|
|
427
450
|
BbSelectPopoverProps<Item, Known>,
|
|
428
451
|
BbSelectPopoverEvents
|
|
@@ -450,6 +473,7 @@ const props = withDefaults(
|
|
|
450
473
|
disableWriting: undefined,
|
|
451
474
|
filterBy: () => [],
|
|
452
475
|
max: Infinity,
|
|
476
|
+
minQueryLength: 0,
|
|
453
477
|
modelValueDebounceTime: 0,
|
|
454
478
|
// Unset: `all.popoverOffset`, else 4 px.
|
|
455
479
|
offset: undefined,
|
|
@@ -464,7 +488,10 @@ const props = withDefaults(
|
|
|
464
488
|
compact: undefined,
|
|
465
489
|
}
|
|
466
490
|
);
|
|
467
|
-
const emit =
|
|
491
|
+
const emit =
|
|
492
|
+
defineEmits<
|
|
493
|
+
BbSelectPopoverEvents<SelectModelOf<OptionValueOf<Item, A>, M>>
|
|
494
|
+
>();
|
|
468
495
|
|
|
469
496
|
defineSlots<BbSelectPopoverSlots<Item, Known>>();
|
|
470
497
|
|
|
@@ -679,6 +706,9 @@ const computedAriaDescribedby = computed(() => {
|
|
|
679
706
|
// on the field hears why the list is what it is.
|
|
680
707
|
if (shown.value && itemsError.value !== null)
|
|
681
708
|
own.push(`${id}_listbox_failed`);
|
|
709
|
+
// Below `min-query-length` the search box says how much to type.
|
|
710
|
+
if (shown.value && belowMinQuery.value && computedAllowWriting.value)
|
|
711
|
+
own.push(`${id}_search_hint`);
|
|
682
712
|
return own.length ? own.join(' ') : undefined;
|
|
683
713
|
});
|
|
684
714
|
|
|
@@ -845,6 +875,8 @@ const onPopoverFocusProxyFocus = (_event: FocusEvent) => {
|
|
|
845
875
|
*/
|
|
846
876
|
const onSearchInputInput = (event: Event) => {
|
|
847
877
|
emit('input', event);
|
|
878
|
+
if (belowMinQuery.value && !sentQuery) return;
|
|
879
|
+
sentQuery = searchQuery.value;
|
|
848
880
|
// A user search is a first load like any other, so unlock `canLoad` — without
|
|
849
881
|
// this a search-first instance (whose `prefill` trigger is false by design)
|
|
850
882
|
// would never engage its dependency/model watchers, and results would go stale
|
|
@@ -860,7 +892,7 @@ const onSearchInputInput = (event: Event) => {
|
|
|
860
892
|
void Promise.resolve(
|
|
861
893
|
debouncedGetter(() => {
|
|
862
894
|
generation = depsGeneration;
|
|
863
|
-
return [
|
|
895
|
+
return [searchQuery.value, 'search', props.modelValue];
|
|
864
896
|
})
|
|
865
897
|
).then((outcome) => settleUnderParent(generation, 'search', outcome));
|
|
866
898
|
};
|
|
@@ -1105,7 +1137,7 @@ const onEnter = async () => {
|
|
|
1105
1137
|
optionsContainer.value.confirmOption();
|
|
1106
1138
|
return;
|
|
1107
1139
|
}
|
|
1108
|
-
if (!computedAllowWriting.value) return;
|
|
1140
|
+
if (!computedAllowWriting.value || belowMinQuery.value) return;
|
|
1109
1141
|
const text = query.value.trim();
|
|
1110
1142
|
if (isItemSelected(text)) return;
|
|
1111
1143
|
emit('option:add', text);
|
|
@@ -1165,6 +1197,37 @@ const onEsc = (event: KeyboardEvent) => {
|
|
|
1165
1197
|
};
|
|
1166
1198
|
|
|
1167
1199
|
const query = ref<string>('');
|
|
1200
|
+
/**
|
|
1201
|
+
* `min-query-length`: the typed text counts as no query
|
|
1202
|
+
* at all until it holds that many characters, trimmed and counted as code
|
|
1203
|
+
* points. Everything that loads or filters reads `searchQuery`; the slots and
|
|
1204
|
+
* the clear affordance keep the typed `query`.
|
|
1205
|
+
*/
|
|
1206
|
+
const belowMinQuery = computed(
|
|
1207
|
+
() =>
|
|
1208
|
+
props.minQueryLength > 0 &&
|
|
1209
|
+
[...query.value.trim()].length < props.minQueryLength
|
|
1210
|
+
);
|
|
1211
|
+
const searchQuery = computed(() => (belowMinQuery.value ? '' : query.value));
|
|
1212
|
+
/** The "type to search" hint, with the count when one character is not enough. */
|
|
1213
|
+
const minQueryHint = computed(() =>
|
|
1214
|
+
props.minQueryLength > 1
|
|
1215
|
+
? t('select.searchMinLength', props.minQueryLength).value
|
|
1216
|
+
: t('select.searchToStart').value
|
|
1217
|
+
);
|
|
1218
|
+
/**
|
|
1219
|
+
* The search query the last keystroke sent. A keystroke that leaves it
|
|
1220
|
+
* unchanged (still below the minimum) sends nothing; one that falls below it
|
|
1221
|
+
* sends what clearing the box sends. Whatever empties the box resets it.
|
|
1222
|
+
*/
|
|
1223
|
+
let sentQuery = '';
|
|
1224
|
+
watch(
|
|
1225
|
+
query,
|
|
1226
|
+
(next) => {
|
|
1227
|
+
if (!next) sentQuery = '';
|
|
1228
|
+
},
|
|
1229
|
+
{ flush: 'sync' }
|
|
1230
|
+
);
|
|
1168
1231
|
const hasInteracted = ref(false);
|
|
1169
1232
|
|
|
1170
1233
|
const {
|
|
@@ -1300,8 +1363,8 @@ const isSearchFirst = computed(
|
|
|
1300
1363
|
const computedNoDataText = computed(() =>
|
|
1301
1364
|
itemsError.value !== null
|
|
1302
1365
|
? props.failedText || t('common.failedText').value
|
|
1303
|
-
: isSearchFirst.value && !
|
|
1304
|
-
?
|
|
1366
|
+
: isSearchFirst.value && !searchQuery.value
|
|
1367
|
+
? minQueryHint.value
|
|
1305
1368
|
: props.emptyText
|
|
1306
1369
|
);
|
|
1307
1370
|
|
|
@@ -1337,7 +1400,7 @@ const {
|
|
|
1337
1400
|
// newer call superseded returned at once, and stashing or pruning against
|
|
1338
1401
|
// the list it did not write would act on the old or still-empty rows; a
|
|
1339
1402
|
// failed load cleared the rows, and a failure never prunes.
|
|
1340
|
-
const outcome = await load(
|
|
1403
|
+
const outcome = await load(searchQuery.value, 'initial', props.modelValue);
|
|
1341
1404
|
if (outcome !== 'applied') return;
|
|
1342
1405
|
if (props.stash) {
|
|
1343
1406
|
// Stash only the *selected* options this load resolved — the pre-seeded
|
|
@@ -1633,7 +1696,7 @@ const candidateHashes = computed(
|
|
|
1633
1696
|
const options = computed(() => {
|
|
1634
1697
|
const fetched = fetchedProjection.options.value;
|
|
1635
1698
|
const extras = extraProjection.options.value;
|
|
1636
|
-
const openOrdered = listShown.value && !
|
|
1699
|
+
const openOrdered = listShown.value && !searchQuery.value;
|
|
1637
1700
|
if (!extras.length && !(openOrdered && pinned.value.length)) return fetched;
|
|
1638
1701
|
const pos = fetchedPos.value;
|
|
1639
1702
|
if (!openOrdered) {
|
|
@@ -1691,7 +1754,7 @@ const pruneSticky = () => {
|
|
|
1691
1754
|
* like a fresh open, which lists no unselected row (R7, newcode-r7-1) — also
|
|
1692
1755
|
* when the query was typed over the mask.
|
|
1693
1756
|
*/
|
|
1694
|
-
const unpickKeepsPlace = () => !
|
|
1757
|
+
const unpickKeepsPlace = () => !searchQuery.value;
|
|
1695
1758
|
/** B3: removals from outside the list that the user made (a field chip, the clear button). */
|
|
1696
1759
|
const markUserUnpicked = (values: unknown[]) => {
|
|
1697
1760
|
if (!shown.value || !unpickKeepsPlace()) return;
|
|
@@ -1853,7 +1916,7 @@ watch(
|
|
|
1853
1916
|
*/
|
|
1854
1917
|
const { coherent } = useCoherence({
|
|
1855
1918
|
modelValue: toRef(() => props.modelValue),
|
|
1856
|
-
multiple: props.multiple,
|
|
1919
|
+
multiple: !!props.multiple,
|
|
1857
1920
|
iteratee: (value) => !!optionsIndexedByHash.value[hash(value)],
|
|
1858
1921
|
});
|
|
1859
1922
|
|
|
@@ -1869,7 +1932,7 @@ const fetchedValueHashes = computed(
|
|
|
1869
1932
|
const { coherent: fetchedCoherent, coherentValue: fetchedCoherentValue } =
|
|
1870
1933
|
useCoherence({
|
|
1871
1934
|
modelValue: toRef(() => props.modelValue),
|
|
1872
|
-
multiple: props.multiple,
|
|
1935
|
+
multiple: !!props.multiple,
|
|
1873
1936
|
iteratee: (value) => {
|
|
1874
1937
|
const valueHash = hash(value);
|
|
1875
1938
|
return (
|
|
@@ -2081,7 +2144,7 @@ const nameUncovered = () => {
|
|
|
2081
2144
|
}
|
|
2082
2145
|
const reason = hasPrefilled.value ? 'model' : 'initial';
|
|
2083
2146
|
if (reason === 'initial') markPrefilled();
|
|
2084
|
-
void load(
|
|
2147
|
+
void load(searchQuery.value, reason, props.modelValue).then((outcome) => {
|
|
2085
2148
|
if (outcome === 'applied') pruneAgainstFetchedRows();
|
|
2086
2149
|
});
|
|
2087
2150
|
};
|
|
@@ -2101,9 +2164,9 @@ const reloadForRecord = () => {
|
|
|
2101
2164
|
listMasked.value = true;
|
|
2102
2165
|
pinOutsideRows();
|
|
2103
2166
|
// Search-first waits for typing, new record or not (pathway 2).
|
|
2104
|
-
if (isSearchFirst.value && !
|
|
2105
|
-
const reason =
|
|
2106
|
-
void load(
|
|
2167
|
+
if (isSearchFirst.value && !searchQuery.value) return;
|
|
2168
|
+
const reason = searchQuery.value ? 'search' : 'initial';
|
|
2169
|
+
void load(searchQuery.value, reason, props.modelValue).then((outcome) => {
|
|
2107
2170
|
if (outcome === 'applied' && reason !== 'search') pruneAgainstFetchedRows();
|
|
2108
2171
|
});
|
|
2109
2172
|
};
|
|
@@ -2269,7 +2332,7 @@ useHashedWatcher(
|
|
|
2269
2332
|
// reason, and opening does not load again.
|
|
2270
2333
|
const reason = hasPrefilled.value ? 'model' : 'initial';
|
|
2271
2334
|
if (reason === 'initial') markPrefilled();
|
|
2272
|
-
const outcome = await load(
|
|
2335
|
+
const outcome = await load(searchQuery.value, reason, props.modelValue);
|
|
2273
2336
|
if (outcome !== 'applied') return;
|
|
2274
2337
|
// Only when the load did NOT resolve the model: emitting the coherent
|
|
2275
2338
|
// value unconditionally echoed the model back to the parent on every
|
|
@@ -2300,7 +2363,7 @@ useHashedWatcher(
|
|
|
2300
2363
|
const reason =
|
|
2301
2364
|
hasPrefilled.value || usesKnownItems.value ? 'dependencies' : 'initial';
|
|
2302
2365
|
if (!hasPrefilled.value) markPrefilled();
|
|
2303
|
-
const outcome = await load(
|
|
2366
|
+
const outcome = await load(searchQuery.value, reason, props.modelValue);
|
|
2304
2367
|
if (outcome !== 'applied') return;
|
|
2305
2368
|
unpinGone(new Set(Object.keys(modelValueIndexedByHash.value)));
|
|
2306
2369
|
if (pruneAgainstFetchedRows()) optionsContainer.value?.blur();
|
|
@@ -2319,7 +2382,7 @@ const onOptionSelected = async (option: BaseOption) => {
|
|
|
2319
2382
|
userUnpicked.add(valueHash);
|
|
2320
2383
|
userUnpicked.delete(option.valueHash);
|
|
2321
2384
|
if (props.multiple) {
|
|
2322
|
-
emit('update:modelValue', [...props.modelValue, option.value]);
|
|
2385
|
+
emit('update:modelValue', [...props.modelValue, option.value] as never);
|
|
2323
2386
|
if (props.stash) {
|
|
2324
2387
|
addToStash(option.item);
|
|
2325
2388
|
}
|
|
@@ -2362,7 +2425,7 @@ const onOptionUnselected = async (option: BaseOption) => {
|
|
|
2362
2425
|
}
|
|
2363
2426
|
const copy = { ...modelValueIndexedByHash.value };
|
|
2364
2427
|
delete copy[option.valueHash];
|
|
2365
|
-
emit('update:modelValue', Object.values(copy));
|
|
2428
|
+
emit('update:modelValue', Object.values(copy) as never);
|
|
2366
2429
|
|
|
2367
2430
|
if (computedAllowWriting.value && shown.value) {
|
|
2368
2431
|
if (mayRestoreSearchFocus) focusSearchInput();
|
|
@@ -2398,10 +2461,10 @@ const filteredOptions = computed<Array<BaseOption<Item>>>(() => {
|
|
|
2398
2461
|
const pins = new Set(pinned.value.map(({ valueHash }) => valueHash));
|
|
2399
2462
|
return options.value.filter((option) => pins.has(option.valueHash));
|
|
2400
2463
|
}
|
|
2401
|
-
if (!
|
|
2464
|
+
if (!searchQuery.value) return options.value;
|
|
2402
2465
|
if (!props.multiple) {
|
|
2403
2466
|
const queryMatchesASelectedOption = selectedOptions.value.some(
|
|
2404
|
-
(option: BaseOption) => option.text ===
|
|
2467
|
+
(option: BaseOption) => option.text === searchQuery.value
|
|
2405
2468
|
);
|
|
2406
2469
|
if (queryMatchesASelectedOption) return options.value;
|
|
2407
2470
|
}
|
|
@@ -2414,7 +2477,7 @@ const filteredOptions = computed<Array<BaseOption<Item>>>(() => {
|
|
|
2414
2477
|
return rankByQuery(
|
|
2415
2478
|
options.value,
|
|
2416
2479
|
(option) => keyHaystacks(option.item, keys),
|
|
2417
|
-
|
|
2480
|
+
searchQuery.value
|
|
2418
2481
|
);
|
|
2419
2482
|
// The description joins the text when the option has one — the same rule as
|
|
2420
2483
|
// BbDropdown's rows and fetched groups.
|
|
@@ -2425,7 +2488,7 @@ const filteredOptions = computed<Array<BaseOption<Item>>>(() => {
|
|
|
2425
2488
|
option,
|
|
2426
2489
|
option.description != null ? ['text', 'description'] : ['text']
|
|
2427
2490
|
),
|
|
2428
|
-
|
|
2491
|
+
searchQuery.value
|
|
2429
2492
|
);
|
|
2430
2493
|
});
|
|
2431
2494
|
|
|
@@ -2450,7 +2513,7 @@ const groupedOptions = computed<GroupedOptions[]>(() => {
|
|
|
2450
2513
|
// Every row the open list puts on top (pins and other outside rows) is
|
|
2451
2514
|
// placed inside its group and moves no group (R18, pins-r6-2).
|
|
2452
2515
|
// R25: a pin the list holds stays in its list place, so in its group's order.
|
|
2453
|
-
const pins =
|
|
2516
|
+
const pins = searchQuery.value
|
|
2454
2517
|
? new Set<string>()
|
|
2455
2518
|
: new Set([
|
|
2456
2519
|
...pinned.value
|
|
@@ -2705,7 +2768,7 @@ watch(settledCount, () => {
|
|
|
2705
2768
|
if (
|
|
2706
2769
|
repinOnSettle &&
|
|
2707
2770
|
shown.value &&
|
|
2708
|
-
!
|
|
2771
|
+
!searchQuery.value &&
|
|
2709
2772
|
settled?.[0] === '' &&
|
|
2710
2773
|
itemsError.value === null
|
|
2711
2774
|
) {
|
|
@@ -2715,13 +2778,13 @@ watch(settledCount, () => {
|
|
|
2715
2778
|
});
|
|
2716
2779
|
/** R7: a search cleared while open re-orders like a fresh open, once its list lands. */
|
|
2717
2780
|
let repinOnSettle = false;
|
|
2718
|
-
watch(
|
|
2781
|
+
watch(searchQuery, (next, prev) => {
|
|
2719
2782
|
if (shown.value && prev && !next) repinOnSettle = true;
|
|
2720
2783
|
});
|
|
2721
2784
|
// A new query is a new list: it starts at its first match, not at the offset
|
|
2722
2785
|
// the previous list was scrolled to. An opening list places itself.
|
|
2723
2786
|
watch(
|
|
2724
|
-
|
|
2787
|
+
searchQuery,
|
|
2725
2788
|
() => {
|
|
2726
2789
|
placeOnLoad = false;
|
|
2727
2790
|
if (shown.value) optionsContainer.value?.scrollToTop();
|
|
@@ -2744,7 +2807,7 @@ const keepUserOffset = () => {
|
|
|
2744
2807
|
watch(
|
|
2745
2808
|
settledCount,
|
|
2746
2809
|
async () => {
|
|
2747
|
-
if (!placeOnLoad || !shown.value ||
|
|
2810
|
+
if (!placeOnLoad || !shown.value || searchQuery.value) return;
|
|
2748
2811
|
if (settledArgs()?.[0] !== '') return;
|
|
2749
2812
|
placeOnLoad = false;
|
|
2750
2813
|
// The applied answer's follow-ups (pruning, pins) settle first.
|
|
@@ -2991,7 +3054,7 @@ const syncActiveStateOnBlur = () => {
|
|
|
2991
3054
|
|
|
2992
3055
|
const onClear = () => {
|
|
2993
3056
|
markUserUnpicked(modelValueList.value);
|
|
2994
|
-
emit('update:modelValue', props.multiple ? [] : null);
|
|
3057
|
+
emit('update:modelValue', (props.multiple ? [] : null) as never);
|
|
2995
3058
|
};
|
|
2996
3059
|
|
|
2997
3060
|
// The in-search clear button resets the whole search state — both the typed
|
|
@@ -3748,6 +3811,14 @@ export type BbSelectPopoverProps<
|
|
|
3748
3811
|
* @defaultValue `Infinity`
|
|
3749
3812
|
*/
|
|
3750
3813
|
max?: number;
|
|
3814
|
+
/**
|
|
3815
|
+
* Characters to type (trimmed) before the query searches. Below it the
|
|
3816
|
+
* query counts as empty: no `'search'` call, no filtering, and the panel
|
|
3817
|
+
* says how many characters to type. Slots still get the typed `query`.
|
|
3818
|
+
*
|
|
3819
|
+
* @defaultValue `0`
|
|
3820
|
+
*/
|
|
3821
|
+
minQueryLength?: number;
|
|
3751
3822
|
/**
|
|
3752
3823
|
* v-model value. Single value for single select, array for multiple select.
|
|
3753
3824
|
*/
|
|
@@ -3849,7 +3920,8 @@ export type BbSelectPopoverProps<
|
|
|
3849
3920
|
width?: number | string;
|
|
3850
3921
|
};
|
|
3851
3922
|
|
|
3852
|
-
|
|
3923
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- untyped unless the component supplies the value
|
|
3924
|
+
export type BbSelectPopoverEvents<V = any> = {
|
|
3853
3925
|
/** Emitted as soon as the options surface starts to open (the popover, or the sheet on a phone). */
|
|
3854
3926
|
(e: 'show'): void;
|
|
3855
3927
|
/** Emitted once the options surface is open and its open transition has finished. */
|
|
@@ -3887,8 +3959,7 @@ export type BbSelectPopoverEvents = {
|
|
|
3887
3959
|
/**
|
|
3888
3960
|
* Emitted with the next selection value whenever selection changes.
|
|
3889
3961
|
*/
|
|
3890
|
-
|
|
3891
|
-
(e: 'update:modelValue', value: any): void;
|
|
3962
|
+
(e: 'update:modelValue', value: V): void;
|
|
3892
3963
|
/**
|
|
3893
3964
|
* Emitted when the user types a new value and confirms it (Enter key) while
|
|
3894
3965
|
* writing is enabled (i.e. `disableWriting` does not suppress the search
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<CommonField
|
|
10
10
|
:id="id"
|
|
11
11
|
class="bb-switch"
|
|
12
|
-
:compact="compact"
|
|
12
|
+
:compact="configDefaults.compact"
|
|
13
13
|
:description="description"
|
|
14
14
|
:disabled="disabled"
|
|
15
15
|
:errors="fieldErrors"
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
:hide-label="hideLabel"
|
|
19
19
|
:hint="hint"
|
|
20
20
|
:input-align="inputAlign"
|
|
21
|
-
:input-position="inputPosition"
|
|
21
|
+
:input-position="configDefaults.inputPosition"
|
|
22
22
|
:label="label"
|
|
23
23
|
:label-align="labelAlign"
|
|
24
24
|
:label-position="labelPosition"
|
|
25
25
|
label-tag="span"
|
|
26
|
-
:layout="withResponsiveDefault(layout, 'auto')"
|
|
26
|
+
:layout="withResponsiveDefault(configDefaults.layout, 'auto')"
|
|
27
27
|
:name="name"
|
|
28
28
|
:passthrough="passthrough"
|
|
29
29
|
:readonly="fieldReadonly"
|
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
type BbSwitchSlots,
|
|
120
120
|
} from './types';
|
|
121
121
|
import { useFormBinding } from '@/composables/useFormBinding';
|
|
122
|
+
import { useConfigDefaults } from '@/composables/useConfigDefaults';
|
|
122
123
|
export type { BbSwitchProps, BbSwitchEvents, BbSwitchSlots };
|
|
123
124
|
|
|
124
125
|
defineOptions({ inheritAttrs: false });
|
|
@@ -131,15 +132,29 @@ const declaredProps = withDefaults(
|
|
|
131
132
|
// boolean `checked` — default: undefined so an unset prop isn't coerced to
|
|
132
133
|
// `false`; the checked state then derives from `modelValue`.
|
|
133
134
|
checked: undefined,
|
|
134
|
-
layout:
|
|
135
|
-
|
|
136
|
-
//
|
|
137
|
-
|
|
135
|
+
layout: undefined,
|
|
136
|
+
inputPosition: undefined,
|
|
137
|
+
// Tri-state: unset lets the components map show through.
|
|
138
|
+
compact: undefined,
|
|
139
|
+
// Tri-state: unset lets the components map show through.
|
|
140
|
+
reverse: undefined,
|
|
138
141
|
}
|
|
139
142
|
);
|
|
140
143
|
|
|
141
144
|
const declaredEmit = defineEmits<BbSwitchEvents>();
|
|
145
|
+
|
|
142
146
|
defineSlots<BbSwitchSlots>();
|
|
147
|
+
|
|
148
|
+
// The layout family comes from the components map like BbCheckbox's.
|
|
149
|
+
// Control-first by default: always at the start, like BbCheckbox/BbRadio (never
|
|
150
|
+
// the end, even in a horizontal layout).
|
|
151
|
+
const configDefaults = useConfigDefaults('BbSwitch', declaredProps, {
|
|
152
|
+
layout: 'auto',
|
|
153
|
+
inputPosition: 'start',
|
|
154
|
+
compact: false,
|
|
155
|
+
reverse: false,
|
|
156
|
+
});
|
|
157
|
+
|
|
143
158
|
// Inside a BbForm the field joins it: `props` / `emit` are bound.
|
|
144
159
|
const {
|
|
145
160
|
props,
|
|
@@ -174,7 +189,7 @@ const switchInput = ref<HTMLInputElement | null>(null);
|
|
|
174
189
|
const { focused, focusVisible, onFocus, onBlur } = useToggleFocus();
|
|
175
190
|
const showHint = computed(() => props.persistentHint || focused.value);
|
|
176
191
|
// We use the negative to avoid the awkward syntax of :reverse="false" from outside
|
|
177
|
-
const reverse = computed(() => !
|
|
192
|
+
const reverse = computed(() => !configDefaults.reverse);
|
|
178
193
|
|
|
179
194
|
/**
|
|
180
195
|
* The checked state the control PAINTS. Controlled (a `modelValue` or
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<CommonField
|
|
10
10
|
:id="id"
|
|
11
11
|
class="bb-switch-group"
|
|
12
|
-
:compact="compact"
|
|
12
|
+
:compact="configDefaults.compact"
|
|
13
13
|
:description="description"
|
|
14
14
|
:disabled="disabled"
|
|
15
15
|
:errors="fieldErrors"
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
:hide-label="hideLegend"
|
|
20
20
|
:hint="hint"
|
|
21
21
|
:input-align="inputAlign"
|
|
22
|
-
:input-position="inputPosition"
|
|
22
|
+
:input-position="configDefaults.inputPosition"
|
|
23
23
|
:label="legend"
|
|
24
24
|
:label-align="labelAlign"
|
|
25
25
|
:label-mode="legendMode"
|
|
26
26
|
:label-position="legendPosition"
|
|
27
27
|
label-tag="legend"
|
|
28
|
-
:layout="layout"
|
|
28
|
+
:layout="configDefaults.layout"
|
|
29
29
|
:loading="loading"
|
|
30
30
|
:name="name"
|
|
31
31
|
:passthrough="containerPassthrough"
|
|
32
32
|
:readonly="fieldReadonly"
|
|
33
|
-
:reverse="reverse"
|
|
33
|
+
:reverse="configDefaults.reverse"
|
|
34
34
|
:show-asterisk="showAsterisk"
|
|
35
35
|
:show-hint="showHint"
|
|
36
36
|
:ssr-marker="ssrMarker"
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
:hide-label="hideLabel"
|
|
62
62
|
:item-input-align="itemInputAlign"
|
|
63
63
|
:item-label-align="itemLabelAlign"
|
|
64
|
-
:item-layout="itemLayout"
|
|
65
|
-
:item-reverse="itemReverse"
|
|
66
|
-
:list-block="block"
|
|
67
|
-
:list-layout="listLayout"
|
|
64
|
+
:item-layout="configDefaults.itemLayout"
|
|
65
|
+
:item-reverse="configDefaults.itemReverse"
|
|
66
|
+
:list-block="configDefaults.block"
|
|
67
|
+
:list-layout="configDefaults.listLayout"
|
|
68
68
|
:loading="!!loading"
|
|
69
69
|
:loading-text="loadingText"
|
|
70
70
|
:options="options"
|
|
@@ -126,7 +126,23 @@
|
|
|
126
126
|
</CommonField>
|
|
127
127
|
</template>
|
|
128
128
|
|
|
129
|
-
<script
|
|
129
|
+
<script
|
|
130
|
+
setup
|
|
131
|
+
lang="ts"
|
|
132
|
+
generic="
|
|
133
|
+
const T = any,
|
|
134
|
+
A extends string | ((...args: never[]) => unknown) | undefined = undefined,
|
|
135
|
+
Tx extends string | undefined = undefined,
|
|
136
|
+
M extends boolean = true
|
|
137
|
+
"
|
|
138
|
+
>
|
|
139
|
+
import type { ItemGetter } from '@/types/ItemAccessor';
|
|
140
|
+
import type {
|
|
141
|
+
ItemKeyInput,
|
|
142
|
+
MultipleInput,
|
|
143
|
+
OptionValueOf,
|
|
144
|
+
SelectModelOf,
|
|
145
|
+
} from '@/types/ItemPath';
|
|
130
146
|
import type { FallthroughAttrs } from '@/types/fallthrough';
|
|
131
147
|
import { vAutofocus } from '@/utilities/misc/autofocus';
|
|
132
148
|
import CommonField from '../CommonField/CommonField.vue';
|
|
@@ -181,13 +197,18 @@ import {
|
|
|
181
197
|
type BbSwitchGroupSlots,
|
|
182
198
|
} from './types';
|
|
183
199
|
import { useFormBinding } from '@/composables/useFormBinding';
|
|
200
|
+
import { useConfigDefaults } from '@/composables/useConfigDefaults';
|
|
184
201
|
export type { BbSwitchGroupProps, BbSwitchGroupEvents, BbSwitchGroupSlots };
|
|
185
202
|
|
|
186
203
|
defineOptions({ inheritAttrs: false });
|
|
187
204
|
const declaredProps = withDefaults(
|
|
188
205
|
defineProps<
|
|
189
|
-
BbSwitchGroupProps<T> &
|
|
190
|
-
|
|
206
|
+
BbSwitchGroupProps<T> & /* @vue-ignore */ {
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a getter returns any value; `A` reads which
|
|
208
|
+
itemValue?: ItemKeyInput<T, A> | ItemGetter<T, any>;
|
|
209
|
+
itemText?: ItemKeyInput<T, Tx> | ItemGetter<T, string>;
|
|
210
|
+
multiple?: MultipleInput<M, true>;
|
|
211
|
+
} & /* @vue-ignore */ FallthroughAttrs<
|
|
191
212
|
'div',
|
|
192
213
|
BbSwitchGroupProps<T>,
|
|
193
214
|
BbSwitchGroupEvents
|
|
@@ -195,16 +216,37 @@ const declaredProps = withDefaults(
|
|
|
195
216
|
>(),
|
|
196
217
|
{
|
|
197
218
|
// Match BbCheckboxGroup: switch groups are multi-select by default, and an
|
|
198
|
-
// absent boolean-union prop would otherwise coerce to `false`.
|
|
199
|
-
|
|
200
|
-
|
|
219
|
+
// absent boolean-union prop would otherwise coerce to `false`. `as never`:
|
|
220
|
+
// the declared type reads `M`, which a default cannot know.
|
|
221
|
+
multiple: true as never,
|
|
222
|
+
inputPosition: undefined,
|
|
201
223
|
selectable: true,
|
|
224
|
+
// Tri-state: unset lets the components map show through.
|
|
225
|
+
compact: undefined,
|
|
226
|
+
// Tri-state: unset lets the components map show through.
|
|
227
|
+
itemReverse: undefined,
|
|
228
|
+
// Tri-state: unset lets the components map show through.
|
|
229
|
+
reverse: undefined,
|
|
230
|
+
// Tri-state: unset lets the components map show through.
|
|
231
|
+
block: undefined,
|
|
202
232
|
}
|
|
203
233
|
);
|
|
204
234
|
|
|
205
|
-
const declaredEmit =
|
|
235
|
+
const declaredEmit =
|
|
236
|
+
defineEmits<BbSwitchGroupEvents<SelectModelOf<OptionValueOf<T, A>, M>>>();
|
|
206
237
|
|
|
207
238
|
defineSlots<BbSwitchGroupSlots<T>>();
|
|
239
|
+
|
|
240
|
+
// The whole layout family comes from the components map, like
|
|
241
|
+
// BbCheckboxGroup's.
|
|
242
|
+
const configDefaults = useConfigDefaults('BbSwitchGroup', declaredProps, {
|
|
243
|
+
inputPosition: 'start',
|
|
244
|
+
compact: false,
|
|
245
|
+
itemReverse: false,
|
|
246
|
+
reverse: false,
|
|
247
|
+
block: false,
|
|
248
|
+
});
|
|
249
|
+
|
|
208
250
|
// Inside a BbForm the field joins it: `props` / `emit` are bound.
|
|
209
251
|
const {
|
|
210
252
|
props,
|
|
@@ -290,7 +332,7 @@ const { hasPrefilled, whenPrefilled } = usePrefill({
|
|
|
290
332
|
clientReproducible,
|
|
291
333
|
trigger: true,
|
|
292
334
|
currentValue: props.modelValue,
|
|
293
|
-
multiple: props.multiple,
|
|
335
|
+
multiple: !!props.multiple,
|
|
294
336
|
fn: async () => {
|
|
295
337
|
// The group has no search field: no `query` in the context.
|
|
296
338
|
// Coherence runs on an APPLIED result only: a superseded or
|
|
@@ -328,7 +370,10 @@ const { options } = useBaseOptions({
|
|
|
328
370
|
|
|
329
371
|
const onOptionSelected = (option: Option) => {
|
|
330
372
|
if (props.multiple) {
|
|
331
|
-
emit('update:modelValue', [
|
|
373
|
+
emit('update:modelValue', [
|
|
374
|
+
...modelValueArray.value,
|
|
375
|
+
option.value,
|
|
376
|
+
] as never);
|
|
332
377
|
return;
|
|
333
378
|
}
|
|
334
379
|
emit('update:modelValue', option.value);
|
|
@@ -336,12 +381,12 @@ const onOptionSelected = (option: Option) => {
|
|
|
336
381
|
|
|
337
382
|
const onOptionUnselected = (option: Option) => {
|
|
338
383
|
if (!props.multiple) {
|
|
339
|
-
emit('update:modelValue', null);
|
|
384
|
+
emit('update:modelValue', null as never);
|
|
340
385
|
return;
|
|
341
386
|
}
|
|
342
387
|
const copy = { ...modelValueIndexedByHash.value };
|
|
343
388
|
delete copy[option.valueHash];
|
|
344
|
-
emit('update:modelValue', Object.values(copy));
|
|
389
|
+
emit('update:modelValue', Object.values(copy) as never);
|
|
345
390
|
};
|
|
346
391
|
|
|
347
392
|
const { data: optionsIndexedByHash } = useIndexById({
|
|
@@ -351,7 +396,7 @@ const { data: optionsIndexedByHash } = useIndexById({
|
|
|
351
396
|
|
|
352
397
|
const { coherent, coherentValue } = useCoherence({
|
|
353
398
|
modelValue: toRef(() => props.modelValue),
|
|
354
|
-
multiple: props.multiple,
|
|
399
|
+
multiple: !!props.multiple,
|
|
355
400
|
iteratee: (item) => !!optionsIndexedByHash.value[hash(item)],
|
|
356
401
|
});
|
|
357
402
|
|
|
@@ -605,7 +650,8 @@ export type BbSwitchGroupProps<T = any> = BbSwitchGroupPtProps &
|
|
|
605
650
|
};
|
|
606
651
|
|
|
607
652
|
/** Re-export for consumers importing events type from BbSwitchGroup. */
|
|
608
|
-
|
|
653
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- untyped unless the component supplies the value
|
|
654
|
+
export type BbSwitchGroupEvents<V = any> = BbCheckboxGroupEvents<V>;
|
|
609
655
|
|
|
610
656
|
/** Props exposed by the `description` slot. */
|
|
611
657
|
export type BbSwitchGroupDescriptionSlotProps = {
|