bitboss-ui 3.0.0-beta.71 → 3.0.0-beta.73
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 +9 -3
- 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 +233 -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 +100 -13
- 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 +242 -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 +72 -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 +152 -11
- 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 +241 -199
- 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 +1997 -1151
- 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/utilities/functions/hash.js +90 -3
- package/dist/utilities/functions/isEqual.js +61 -3
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite.js +0 -1
- package/llms.txt +2 -2
- package/package.json +12 -2
- package/scripts/README.md +43 -39
- 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/helpers-add.mjs +21 -2
- package/scripts/lib/redundant-item-accessor.mjs +4 -1
- package/scripts/lib/release-results.mjs +180 -5
- 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
package/dist/ai/source/BbForm.md
CHANGED
|
@@ -102,6 +102,7 @@ import {
|
|
|
102
102
|
} from './formSchema';
|
|
103
103
|
import {
|
|
104
104
|
BB_FORM_SUBMIT_LOCK,
|
|
105
|
+
type SubmitOutcome,
|
|
105
106
|
joinOverlaySubmitGuard,
|
|
106
107
|
} from '@/composables/formSubmitLock';
|
|
107
108
|
import {
|
|
@@ -110,6 +111,12 @@ import {
|
|
|
110
111
|
byDocumentOrder,
|
|
111
112
|
focusTarget,
|
|
112
113
|
} from './formFields';
|
|
114
|
+
import {
|
|
115
|
+
type BbIsValidationError,
|
|
116
|
+
type ValidationAnswer,
|
|
117
|
+
recognizeValidation,
|
|
118
|
+
} from './recognizeValidation';
|
|
119
|
+
import { useConfigSetting } from '@/composables/useConfigDefaults';
|
|
113
120
|
|
|
114
121
|
type Props = {
|
|
115
122
|
/**
|
|
@@ -191,6 +198,13 @@ const emit = defineEmits<{
|
|
|
191
198
|
* `unmatched`: the paths no field claims.
|
|
192
199
|
*/
|
|
193
200
|
invalid: [payload: BbFormInvalidPayload];
|
|
201
|
+
/**
|
|
202
|
+
* The save failed for a reason other than the data (a 500, offline, a
|
|
203
|
+
* bug): a `@submit` listener rejected or threw, and the rejection is not a
|
|
204
|
+
* validation answer. Bound, it is handled (nothing reported; rethrow to
|
|
205
|
+
* report it once); unbound, it goes to `app.config.errorHandler`.
|
|
206
|
+
*/
|
|
207
|
+
'submit-error': [error: unknown];
|
|
194
208
|
}>();
|
|
195
209
|
|
|
196
210
|
/*
|
|
@@ -461,6 +475,18 @@ const unmatchedView = computed<Record<string, string[]>>(() => {
|
|
|
461
475
|
const setServerErrors = (
|
|
462
476
|
serverErrors: BbFormServerErrors,
|
|
463
477
|
options: BbFormSetErrorsOptions = {}
|
|
478
|
+
): void => landServerErrors(serverErrors, options, messagesByKey(serverErrors));
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* `setErrors`' work. `announce` is what `invalid` carries (the whole answer,
|
|
482
|
+
* when a rejection lands only the keys `field-errors` does not already show),
|
|
483
|
+
* and `from` marks a server answer for the one-answer-one-event rule.
|
|
484
|
+
*/
|
|
485
|
+
const landServerErrors = (
|
|
486
|
+
serverErrors: BbFormServerErrors,
|
|
487
|
+
options: BbFormSetErrorsOptions,
|
|
488
|
+
announce: Record<string, string[]>,
|
|
489
|
+
from?: AnswerSource
|
|
464
490
|
): void => {
|
|
465
491
|
const focusedBefore = document.activeElement;
|
|
466
492
|
const known = new Map(
|
|
@@ -489,7 +515,7 @@ const setServerErrors = (
|
|
|
489
515
|
unmatchedErrors.value = missed;
|
|
490
516
|
// The caller reads `fields` straight back: publish now, not next tick.
|
|
491
517
|
publishContext();
|
|
492
|
-
emitServerInvalid(
|
|
518
|
+
emitServerInvalid(announce, from);
|
|
493
519
|
if (options.focus !== false && Object.keys(landed).length)
|
|
494
520
|
void focusServerErrors(landed, focusedBefore);
|
|
495
521
|
};
|
|
@@ -499,11 +525,15 @@ const setServerErrors = (
|
|
|
499
525
|
* (`focusServerErrors` keeps a focus the handler moved). Keyed like a failed
|
|
500
526
|
* submit's; `unmatched` is what no entry in `fields` claims.
|
|
501
527
|
*/
|
|
502
|
-
const emitServerInvalid = (
|
|
528
|
+
const emitServerInvalid = (
|
|
529
|
+
serverErrors: Record<string, string[]>,
|
|
530
|
+
from?: AnswerSource
|
|
531
|
+
) => {
|
|
503
532
|
const errors: Record<string, string[]> = {};
|
|
504
533
|
for (const [key, messages] of Object.entries(serverErrors))
|
|
505
534
|
errors[nameToPath(key)] = messages;
|
|
506
535
|
if (!Object.keys(errors).length) return;
|
|
536
|
+
if (from && repeatsAnswer(errors, from)) return;
|
|
507
537
|
emit('invalid', {
|
|
508
538
|
errors,
|
|
509
539
|
values: copyValues(),
|
|
@@ -512,6 +542,37 @@ const emitServerInvalid = (serverErrors: Record<string, string[]>) => {
|
|
|
512
542
|
});
|
|
513
543
|
};
|
|
514
544
|
|
|
545
|
+
/*
|
|
546
|
+
* one server answer = one `invalid`. An
|
|
547
|
+
* Inertia save answers twice: the page's `form.errors` (bound as
|
|
548
|
+
* `field-errors`) updates AND the helper rejects with the same bag, in either
|
|
549
|
+
* order. The second of the pair, in the same submit attempt with the same
|
|
550
|
+
* messages, emits nothing.
|
|
551
|
+
*/
|
|
552
|
+
type AnswerSource = 'rejection' | 'prop';
|
|
553
|
+
let lastAnswer: { attempt: number; key: string; from: AnswerSource } | null =
|
|
554
|
+
null;
|
|
555
|
+
const answerKey = (errors: Record<string, string[]>) =>
|
|
556
|
+
JSON.stringify(
|
|
557
|
+
Object.entries(errors)
|
|
558
|
+
.map(([path, messages]) => [normalisePath(path), [...messages].sort()])
|
|
559
|
+
.sort(([a], [b]) => String(a).localeCompare(String(b)))
|
|
560
|
+
);
|
|
561
|
+
const repeatsAnswer = (
|
|
562
|
+
errors: Record<string, string[]>,
|
|
563
|
+
from: AnswerSource
|
|
564
|
+
) => {
|
|
565
|
+
const key = answerKey(errors);
|
|
566
|
+
const attempt = submitCount.value;
|
|
567
|
+
const repeat =
|
|
568
|
+
!!lastAnswer &&
|
|
569
|
+
lastAnswer.attempt === attempt &&
|
|
570
|
+
lastAnswer.key === key &&
|
|
571
|
+
lastAnswer.from !== from;
|
|
572
|
+
lastAnswer = repeat ? null : { attempt, key, from };
|
|
573
|
+
return repeat;
|
|
574
|
+
};
|
|
575
|
+
|
|
515
576
|
/** The paths of `failing` no entry in `fields` (mounted or kept) has. */
|
|
516
577
|
const unclaimed = (failing: Record<string, string[]>) => {
|
|
517
578
|
const known = new Set(
|
|
@@ -536,7 +597,7 @@ const copyValues = (): Record<string, unknown> => {
|
|
|
536
597
|
* failed client submit does (`focusFirstInvalid`: document order, hidden /
|
|
537
598
|
* inert / collapsed fields skipped). Only while focus is still the form's:
|
|
538
599
|
* inside it, on one of its own controls outside it (a dialog footer's
|
|
539
|
-
* `<BbButton form="id" type="submit"
|
|
600
|
+
* `<BbButton form="id" type="submit">`, or the dialog's `ok` that submitted it), or on `<body>` after a submit. A response that lands while the
|
|
540
601
|
* user is already somewhere else on the page (typing in a search box) does
|
|
541
602
|
* not pull them back, and errors put on a form nobody has submitted (a page
|
|
542
603
|
* that loads with errors in its props) do not grab focus either.
|
|
@@ -554,6 +615,7 @@ const focusServerErrors = async (
|
|
|
554
615
|
const ours =
|
|
555
616
|
!!root &&
|
|
556
617
|
(root.contains(active) ||
|
|
618
|
+
(!!active && active === overlaySubmitter) ||
|
|
557
619
|
(active as Partial<HTMLButtonElement> | null)?.form === root);
|
|
558
620
|
if (onBody ? submitCount.value === 0 : !ours) return;
|
|
559
621
|
focusFirstInvalid(landed);
|
|
@@ -582,7 +644,7 @@ watch(
|
|
|
582
644
|
if (!Object.keys(next).length || (!added && !resubmitted)) return;
|
|
583
645
|
focusedForSubmit = submitCount.value;
|
|
584
646
|
const focusedBefore = document.activeElement;
|
|
585
|
-
emitServerInvalid(next);
|
|
647
|
+
emitServerInvalid(next, 'prop');
|
|
586
648
|
const landed: Record<string, string[]> = {};
|
|
587
649
|
for (const field of fields) {
|
|
588
650
|
const messages = fieldErrorsAt(field.name());
|
|
@@ -741,7 +803,16 @@ provide(BB_FORM_SUBMIT_LOCK, {
|
|
|
741
803
|
});
|
|
742
804
|
// the BbDialog / BbOffCanvas around the form refuses user closes
|
|
743
805
|
// while the lock is on (so `disable-submit-lock` releases it too).
|
|
744
|
-
|
|
806
|
+
// Its `ok` button submits from outside the form (no `form=`): it counts as
|
|
807
|
+
// one of the form's own controls for `focusServerErrors`.
|
|
808
|
+
let overlaySubmitter: Element | undefined;
|
|
809
|
+
const tellOverlay = joinOverlaySubmitGuard({
|
|
810
|
+
locked: submitLocked,
|
|
811
|
+
submit: async (submitter) => {
|
|
812
|
+
overlaySubmitter = submitter;
|
|
813
|
+
return (await onSubmitEvent()) === true;
|
|
814
|
+
},
|
|
815
|
+
});
|
|
745
816
|
|
|
746
817
|
type SubmitListener = (
|
|
747
818
|
values: Record<string, unknown>,
|
|
@@ -773,6 +844,50 @@ const reportListenerError = (error: unknown) => {
|
|
|
773
844
|
const isThenable = (value: unknown): value is PromiseLike<unknown> =>
|
|
774
845
|
typeof (value as PromiseLike<unknown>)?.then === 'function';
|
|
775
846
|
|
|
847
|
+
const isValidationError = useConfigSetting<BbIsValidationError>(
|
|
848
|
+
'BbForm',
|
|
849
|
+
'isValidationError'
|
|
850
|
+
);
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* A validation answer lands like `setErrors`, minus what `field-errors`
|
|
854
|
+
* already shows (the Inertia pair: the page's errors object updated with the
|
|
855
|
+
* same bag), and `invalid` carries the whole answer, once.
|
|
856
|
+
*/
|
|
857
|
+
const landAnswer = (answer: ValidationAnswer) => {
|
|
858
|
+
const toLand: Record<string, string[]> = {};
|
|
859
|
+
for (const [key, messages] of Object.entries(answer)) {
|
|
860
|
+
const shown = fieldErrorsAt(nameToPath(key));
|
|
861
|
+
if (!messages.every((message) => shown.includes(message)))
|
|
862
|
+
toLand[key] = messages;
|
|
863
|
+
}
|
|
864
|
+
if (Object.keys(toLand).length)
|
|
865
|
+
landServerErrors(toLand, {}, answer, 'rejection');
|
|
866
|
+
else emitServerInvalid(answer, 'rejection');
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* A real error: `@submit-error` handles it when bound (a listener that
|
|
871
|
+
* rethrows reports once), else the app's error handler gets it.
|
|
872
|
+
*/
|
|
873
|
+
const submitError = (error: unknown) => {
|
|
874
|
+
const props = instance?.vnode.props as Record<string, unknown> | undefined;
|
|
875
|
+
const raw = props?.onSubmitError;
|
|
876
|
+
const handlers = (Array.isArray(raw) ? raw : raw ? [raw] : []) as Array<
|
|
877
|
+
(error: unknown) => unknown
|
|
878
|
+
>;
|
|
879
|
+
if (!handlers.length) return reportListenerError(error);
|
|
880
|
+
for (const handler of handlers) {
|
|
881
|
+
try {
|
|
882
|
+
const result = handler(error);
|
|
883
|
+
if (isThenable(result))
|
|
884
|
+
Promise.resolve(result).catch(reportListenerError);
|
|
885
|
+
} catch (rethrown) {
|
|
886
|
+
reportListenerError(rethrown);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
|
|
776
891
|
/**
|
|
777
892
|
* Runs the `@submit` listeners. Resolves (or returns) whether the save
|
|
778
893
|
* went through: `false` when a listener threw or its promise rejected, which
|
|
@@ -798,27 +913,50 @@ const runSubmitListeners = (
|
|
|
798
913
|
listeners.push(...once);
|
|
799
914
|
}
|
|
800
915
|
}
|
|
801
|
-
if (!listeners.length)
|
|
916
|
+
if (!listeners.length) {
|
|
917
|
+
tellOverlay({ value: undefined, values: formValues });
|
|
918
|
+
return true;
|
|
919
|
+
}
|
|
802
920
|
|
|
803
921
|
let failed = false;
|
|
922
|
+
let value: unknown;
|
|
923
|
+
/*
|
|
924
|
+
* each listener's outcome on its own:
|
|
925
|
+
* `false` is a handled failure (nothing fires), a validation answer lands
|
|
926
|
+
* on the fields, anything else is a real error for `@submit-error` or the
|
|
927
|
+
* app's error handler. The first value a listener resolves (not
|
|
928
|
+
* `undefined`, not `false`) is the save's result (a dialog completes with
|
|
929
|
+
* it).
|
|
930
|
+
*/
|
|
931
|
+
const succeed = (result: unknown) => {
|
|
932
|
+
if (result === false) failed = true;
|
|
933
|
+
else if (value === undefined && result !== undefined) value = result;
|
|
934
|
+
};
|
|
804
935
|
const fail = (error: unknown) => {
|
|
805
936
|
failed = true;
|
|
806
|
-
|
|
937
|
+
const answer = recognizeValidation(error, isValidationError());
|
|
938
|
+
if (answer) landAnswer(answer);
|
|
939
|
+
else submitError(error);
|
|
807
940
|
};
|
|
941
|
+
const outcome = (): SubmitOutcome =>
|
|
942
|
+
failed ? false : { value, values: formValues };
|
|
808
943
|
const pending: Array<PromiseLike<unknown>> = [];
|
|
809
944
|
for (const listener of listeners) {
|
|
810
945
|
try {
|
|
811
946
|
const result = listener(formValues, { submitter });
|
|
812
947
|
if (isThenable(result)) {
|
|
813
|
-
pending.push(Promise.resolve(result).
|
|
814
|
-
}
|
|
948
|
+
pending.push(Promise.resolve(result).then(succeed, fail));
|
|
949
|
+
} else succeed(result);
|
|
815
950
|
} catch (error) {
|
|
816
951
|
fail(error);
|
|
817
952
|
}
|
|
818
953
|
}
|
|
819
954
|
// Await only what is actually awaitable, so a sync handler keeps the exact
|
|
820
955
|
// timing it has today rather than being pushed a microtask later.
|
|
821
|
-
if (!pending.length)
|
|
956
|
+
if (!pending.length) {
|
|
957
|
+
tellOverlay(outcome());
|
|
958
|
+
return !failed;
|
|
959
|
+
}
|
|
822
960
|
// the form locks for exactly as long as the save runs. Its own
|
|
823
961
|
// flag, not vee-validate's `isSubmitting`, which is also true while
|
|
824
962
|
// validation runs, so a sync submit would flash the lock.
|
|
@@ -830,7 +968,10 @@ const runSubmitListeners = (
|
|
|
830
968
|
savesInFlight.value--;
|
|
831
969
|
countSave(submitter, -1);
|
|
832
970
|
})
|
|
833
|
-
.then(() =>
|
|
971
|
+
.then(() => {
|
|
972
|
+
tellOverlay(outcome());
|
|
973
|
+
return !failed;
|
|
974
|
+
});
|
|
834
975
|
};
|
|
835
976
|
|
|
836
977
|
// With a schema, `formValues` is the schema's OUTPUT: vee-validate hands the
|
|
@@ -169,7 +169,9 @@
|
|
|
169
169
|
:data="overlay.data.value"
|
|
170
170
|
name="footer"
|
|
171
171
|
:reset="overlay.reset"
|
|
172
|
-
|
|
172
|
+
>
|
|
173
|
+
<FooterActions />
|
|
174
|
+
</slot>
|
|
173
175
|
</div>
|
|
174
176
|
</template>
|
|
175
177
|
<!--
|
|
@@ -273,6 +275,10 @@ import {
|
|
|
273
275
|
OFF_CANVAS_FOLLOWS_FORM_LOCK,
|
|
274
276
|
provideOverlaySubmitGuard,
|
|
275
277
|
} from '@/composables/formSubmitLock';
|
|
278
|
+
import {
|
|
279
|
+
ownCompleteListener,
|
|
280
|
+
useOverlayActions,
|
|
281
|
+
} from '../BbDialog/overlayActions';
|
|
276
282
|
import {
|
|
277
283
|
type OverlayCloseReason,
|
|
278
284
|
isOverlayStandIn,
|
|
@@ -310,6 +316,9 @@ const props = withDefaults(
|
|
|
310
316
|
>(),
|
|
311
317
|
{
|
|
312
318
|
side: undefined,
|
|
319
|
+
// `undefined` keeps "unset" apart from `false` (no buttons): a Boolean in
|
|
320
|
+
// the type would cast an absent `actions` to `false`.
|
|
321
|
+
actions: undefined,
|
|
313
322
|
size: 'sm',
|
|
314
323
|
transitionDuration: transitions.medium,
|
|
315
324
|
draggable: false,
|
|
@@ -343,6 +352,7 @@ const overlay = useOverlayHost('offCanvas', {
|
|
|
343
352
|
element: () => rootElementOf(instance),
|
|
344
353
|
enabled: !standIn,
|
|
345
354
|
defaultData: () => props.defaultData,
|
|
355
|
+
onComplete: () => ownCompleteListener(instance),
|
|
346
356
|
});
|
|
347
357
|
/*
|
|
348
358
|
* URL panels (`navigation`): the open state proxies `?<queryKey>`.
|
|
@@ -422,9 +432,25 @@ const renderHeader = () => hasTitle() || !!slots.header || hasDescription();
|
|
|
422
432
|
* `prevent-close` says otherwise (`true` always, `false` never). The switch:
|
|
423
433
|
* OFF_CANVAS_FOLLOWS_FORM_LOCK, see formSubmitLock.ts.
|
|
424
434
|
*/
|
|
435
|
+
const formGuard = provideOverlaySubmitGuard();
|
|
425
436
|
const formSaving = OFF_CANVAS_FOLLOWS_FORM_LOCK
|
|
426
|
-
?
|
|
437
|
+
? formGuard.saving
|
|
427
438
|
: () => false;
|
|
439
|
+
/*
|
|
440
|
+
* `ok` / `cancel` / `actions`, the footer slot's fallback.
|
|
441
|
+
* On the adaptive dialog's sheet they arrive resolved from the dialog, and a
|
|
442
|
+
* completion goes to the dialog (the stand-in's `complete`).
|
|
443
|
+
*/
|
|
444
|
+
const footerActions = useOverlayActions({
|
|
445
|
+
component: 'BbOffCanvas',
|
|
446
|
+
props: () => props,
|
|
447
|
+
surface: formGuard,
|
|
448
|
+
complete: overlay.complete,
|
|
449
|
+
data: () => overlay.data.value,
|
|
450
|
+
close: () => requestClose(),
|
|
451
|
+
block: 'bb-offcanvas',
|
|
452
|
+
});
|
|
453
|
+
const FooterActions = () => footerActions.render();
|
|
428
454
|
// an opener's `onComplete` promise locks it like a saving form.
|
|
429
455
|
const isLocked = computed(
|
|
430
456
|
() => props.preventClose ?? (formSaving() || overlay.completing.value)
|
|
@@ -1761,6 +1787,7 @@ onDeactivated(() => closeWith('unmounted'));
|
|
|
1761
1787
|
```ts
|
|
1762
1788
|
import type { BbDialogResult } from '@/composables/overlayRegistry';
|
|
1763
1789
|
import type { Size } from '@/types/CommonProps';
|
|
1790
|
+
import type { ActionButtonConfig, BbAction } from '@/types/ActionButton';
|
|
1764
1791
|
import type { PtCompoundProps, PtMap } from '@/types/passthrough';
|
|
1765
1792
|
import type { Sizes } from '@/types/SizeScale';
|
|
1766
1793
|
import type { Responsive } from '@/types/ResponsiveSize';
|
|
@@ -1957,6 +1984,23 @@ export type BbOffCanvasProps = BbOffCanvasPtProps & {
|
|
|
1957
1984
|
* @defaultValue `'sm'`
|
|
1958
1985
|
*/
|
|
1959
1986
|
size?: Responsive<OffCanvasSize>;
|
|
1987
|
+
/**
|
|
1988
|
+
* The primary footer button: `true` (the locale's OK), a label, or a
|
|
1989
|
+
* button config. Clicked: its `onClick`, else it submits the one `BbForm`
|
|
1990
|
+
* inside, else `complete(data)`. Unset: no button. Config sets its look.
|
|
1991
|
+
*/
|
|
1992
|
+
ok?: BbAction;
|
|
1993
|
+
/**
|
|
1994
|
+
* The dismiss button, before `ok`: `true` (the locale's Cancel), a label,
|
|
1995
|
+
* or a button config. Clicked: its `onClick`, then the panel closes as a
|
|
1996
|
+
* dismissal (`reason: 'close'`). Unset: no button.
|
|
1997
|
+
*/
|
|
1998
|
+
cancel?: BbAction;
|
|
1999
|
+
/**
|
|
2000
|
+
* Footer buttons replacing `ok` / `cancel`, in order: each runs its
|
|
2001
|
+
* `onClick`, then completes the panel with `data`. `false`: none.
|
|
2002
|
+
*/
|
|
2003
|
+
actions?: false | readonly ActionButtonConfig[];
|
|
1960
2004
|
/**
|
|
1961
2005
|
* Title text announced to assistive technologies. If omitted, no header is rendered and
|
|
1962
2006
|
* accessibility must be handled manually.
|
|
@@ -1979,6 +2023,13 @@ export type BbOffCanvasProps = BbOffCanvasPtProps & {
|
|
|
1979
2023
|
};
|
|
1980
2024
|
|
|
1981
2025
|
export type BbOffCanvasEvents = {
|
|
2026
|
+
/**
|
|
2027
|
+
* The panel completes (`ok`, `complete(value)`): the same value as the
|
|
2028
|
+
* opener's `onComplete`, before it. Return a promise to keep the panel
|
|
2029
|
+
* open and locked until it settles; `false` or a throw keeps it open.
|
|
2030
|
+
*/
|
|
2031
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the opening's value is `any`, like `data`
|
|
2032
|
+
(e: 'complete', value: any): unknown;
|
|
1982
2033
|
/** Emitted as soon as the user triggers the open action (model becomes true). */
|
|
1983
2034
|
(e: 'show'): void;
|
|
1984
2035
|
/**
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
import BbIcon from '../BbIcon/BbIcon.vue';
|
|
85
85
|
import caretDownSvg from '@/assets/svgs/caret_down.svg?raw';
|
|
86
86
|
import type { FallthroughAttrs } from '@/types/fallthrough';
|
|
87
|
-
import
|
|
87
|
+
import BbBaseButton from '@/components/BbBaseButton/BbBaseButton.vue';
|
|
88
88
|
import {
|
|
89
89
|
computed,
|
|
90
90
|
getCurrentInstance,
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
:passthrough="passthrough"
|
|
76
76
|
:role="hasLegend() ? 'radiogroup' : undefined"
|
|
77
77
|
:variant="variant"
|
|
78
|
+
@mousedown.capture="clicks.onPress"
|
|
78
79
|
>
|
|
79
80
|
<template #prepend>
|
|
80
81
|
<!-- The `variant` indicators: first in the list, so the
|
|
@@ -88,6 +89,9 @@
|
|
|
88
89
|
:style="indicatorStyle(box)"
|
|
89
90
|
v-bind="passthrough.indicator"
|
|
90
91
|
></span>
|
|
92
|
+
<span v-if="showClearHint" :id="clearHintId" hidden>{{
|
|
93
|
+
clearHintText
|
|
94
|
+
}}</span>
|
|
91
95
|
<slot name="prepend"></slot>
|
|
92
96
|
</template>
|
|
93
97
|
<template #loading><slot name="loading"></slot></template>
|
|
@@ -144,7 +148,17 @@
|
|
|
144
148
|
</CommonField>
|
|
145
149
|
</template>
|
|
146
150
|
|
|
147
|
-
<script
|
|
151
|
+
<script
|
|
152
|
+
setup
|
|
153
|
+
lang="ts"
|
|
154
|
+
generic="
|
|
155
|
+
const T = any,
|
|
156
|
+
A extends string | ((...args: never[]) => unknown) | undefined = undefined,
|
|
157
|
+
Tx extends string | undefined = undefined
|
|
158
|
+
"
|
|
159
|
+
>
|
|
160
|
+
import type { ItemGetter } from '@/types/ItemAccessor';
|
|
161
|
+
import type { ItemKeyInput, OptionValueOf } from '@/types/ItemPath';
|
|
148
162
|
import { useConfigDefaults } from '@/composables/useConfigDefaults';
|
|
149
163
|
import type { FallthroughAttrs } from '@/types/fallthrough';
|
|
150
164
|
import { vAutofocus } from '@/utilities/misc/autofocus';
|
|
@@ -169,9 +183,11 @@ import {
|
|
|
169
183
|
} from 'vue';
|
|
170
184
|
import type { Option } from '@/types/Option';
|
|
171
185
|
import { useId } from '@/composables/useId';
|
|
186
|
+
import { useLocale } from '@/composables/useLocale';
|
|
172
187
|
import { isNotEmpty } from '@/utilities/functions/isNotEmpty';
|
|
173
188
|
import { withItemDescribedby } from '@/utilities/functions/itemProps';
|
|
174
189
|
import { hash } from '@/utilities/functions/hash';
|
|
190
|
+
import { createClickCount } from '@/utilities/functions/clickCount';
|
|
175
191
|
import {
|
|
176
192
|
preventReadonlyClick,
|
|
177
193
|
preventReadonlyKeydown,
|
|
@@ -209,8 +225,11 @@ defineOptions({
|
|
|
209
225
|
});
|
|
210
226
|
const declaredProps = withDefaults(
|
|
211
227
|
defineProps<
|
|
212
|
-
BbRadioGroupProps<T> &
|
|
213
|
-
|
|
228
|
+
BbRadioGroupProps<T> & /* @vue-ignore */ {
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a getter returns any value; `A` reads which
|
|
230
|
+
itemValue?: ItemKeyInput<T, A> | ItemGetter<T, any>;
|
|
231
|
+
itemText?: ItemKeyInput<T, Tx> | ItemGetter<T, string>;
|
|
232
|
+
} & /* @vue-ignore */ FallthroughAttrs<
|
|
214
233
|
'div',
|
|
215
234
|
BbRadioGroupProps<T>,
|
|
216
235
|
BbRadioGroupEvents
|
|
@@ -229,7 +248,7 @@ const declaredProps = withDefaults(
|
|
|
229
248
|
block: undefined,
|
|
230
249
|
}
|
|
231
250
|
);
|
|
232
|
-
const declaredEmit = defineEmits<BbRadioGroupEvents
|
|
251
|
+
const declaredEmit = defineEmits<BbRadioGroupEvents<OptionValueOf<T, A>>>();
|
|
233
252
|
|
|
234
253
|
const slots = defineSlots<BbRadioGroupSlots<T>>();
|
|
235
254
|
|
|
@@ -301,6 +320,17 @@ if (process.env.NODE_ENV !== 'production')
|
|
|
301
320
|
const fallbackName = useId().id;
|
|
302
321
|
const resolvedName = computed(() => props.name || fallbackName.value);
|
|
303
322
|
|
|
323
|
+
/**
|
|
324
|
+
* `clearable`: a hidden "press Space to clear" hint, last on every
|
|
325
|
+
* radio's describedby while a clear can happen (BbRating's `clearHint`).
|
|
326
|
+
*/
|
|
327
|
+
const { t } = useLocale();
|
|
328
|
+
const clearHintId = useId().id;
|
|
329
|
+
const clearHintText = t('radioGroup.clearHint');
|
|
330
|
+
const showClearHint = computed(
|
|
331
|
+
() => props.clearable && !props.disabled && !props.readonly
|
|
332
|
+
);
|
|
333
|
+
|
|
304
334
|
/**
|
|
305
335
|
* Undocumented fallbacks for props left `undefined`, applied where they are
|
|
306
336
|
* read (the manifest documents no default for them): no items, no debounce,
|
|
@@ -345,7 +375,7 @@ const {
|
|
|
345
375
|
|
|
346
376
|
const alignToCoherenceSettings = () => {
|
|
347
377
|
if (props.enforceCoherence && !coherent.value) {
|
|
348
|
-
emit('update:modelValue', null);
|
|
378
|
+
emit('update:modelValue', null as never);
|
|
349
379
|
}
|
|
350
380
|
};
|
|
351
381
|
|
|
@@ -503,6 +533,18 @@ const syncRowsToData = () => {
|
|
|
503
533
|
});
|
|
504
534
|
};
|
|
505
535
|
|
|
536
|
+
const clicks = createClickCount();
|
|
537
|
+
|
|
538
|
+
/** `clearable`: the checked row back to `null`; true when it cleared. */
|
|
539
|
+
const clearRow = (option: Option) => {
|
|
540
|
+
if (!props.clearable || props.readonly) return false;
|
|
541
|
+
if (option.disabled || !option.selected) return false;
|
|
542
|
+
emit('update:modelValue', null as never);
|
|
543
|
+
// The clicked radio stays natively checked: re-sync once the parent answered.
|
|
544
|
+
nextTick(syncRowsToData);
|
|
545
|
+
return true;
|
|
546
|
+
};
|
|
547
|
+
|
|
506
548
|
const rowListeners = (option: Option) => ({
|
|
507
549
|
onBlur: (event: FocusEvent) => {
|
|
508
550
|
rowFocus.onBlur(option.valueHash);
|
|
@@ -525,6 +567,8 @@ const rowListeners = (option: Option) => ({
|
|
|
525
567
|
onClick: (event: MouseEvent) => {
|
|
526
568
|
preventReadonlyClick(event, props.readonly);
|
|
527
569
|
emit('click', event);
|
|
570
|
+
// A double-click's second click must not undo its first.
|
|
571
|
+
if (clicks.count(event) <= 1) clearRow(option);
|
|
528
572
|
},
|
|
529
573
|
onFocus: (event: FocusEvent) => {
|
|
530
574
|
rowFocus.onFocus(option.valueHash, event);
|
|
@@ -536,6 +580,11 @@ const rowListeners = (option: Option) => ({
|
|
|
536
580
|
preventReadonlyKeydown(event, props.readonly);
|
|
537
581
|
emit('keydown', event);
|
|
538
582
|
},
|
|
583
|
+
// Chromium fires no click for Space on a checked radio, so the key clears
|
|
584
|
+
// here; preventDefault stops an engine that does fire one clearing twice.
|
|
585
|
+
onKeyup: (event: KeyboardEvent) => {
|
|
586
|
+
if (event.key === ' ' && clearRow(option)) event.preventDefault();
|
|
587
|
+
},
|
|
539
588
|
onMousedown: (event: MouseEvent) => emit('mousedown', event),
|
|
540
589
|
onMouseup: (event: MouseEvent) => emit('mouseup', event),
|
|
541
590
|
});
|
|
@@ -550,7 +599,13 @@ const rowInputAttrs = (
|
|
|
550
599
|
descriptionId: string | undefined
|
|
551
600
|
) => ({
|
|
552
601
|
...toggleInputAttrs('radio', {
|
|
553
|
-
ariaDescribedby:
|
|
602
|
+
ariaDescribedby:
|
|
603
|
+
[
|
|
604
|
+
withItemDescribedby(ariaDescribedby, descriptionId),
|
|
605
|
+
showClearHint.value ? clearHintId.value : undefined,
|
|
606
|
+
]
|
|
607
|
+
.filter(Boolean)
|
|
608
|
+
.join(' ') || undefined,
|
|
554
609
|
ariaLabelledby: labelId,
|
|
555
610
|
autofocus: props.autofocus && !index,
|
|
556
611
|
checked: !!option.selected,
|
|
@@ -699,6 +754,12 @@ export type BbRadioGroupProps<T> = BbRadioGroupPtProps & {
|
|
|
699
754
|
*/
|
|
700
755
|
autofocus?: InputHTMLAttributes['autofocus'];
|
|
701
756
|
|
|
757
|
+
/**
|
|
758
|
+
* Clicking the checked option (or Space on it) clears the value to `null`.
|
|
759
|
+
* Off: a radio group can't be emptied.
|
|
760
|
+
*/
|
|
761
|
+
clearable?: boolean;
|
|
762
|
+
|
|
702
763
|
/**
|
|
703
764
|
* Compact density. Swaps `--bb-label-spacing-y` for
|
|
704
765
|
* `--bb-label-spacing-y-compact`, so tune a compact group's label gap with
|
|
@@ -986,7 +1047,8 @@ export type BbRadioGroupProps<T> = BbRadioGroupPtProps & {
|
|
|
986
1047
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `rules` take the model's type (see `modelValue`), so a rule annotated with the app's value type fits
|
|
987
1048
|
} & FormFieldProps<any>;
|
|
988
1049
|
|
|
989
|
-
|
|
1050
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- untyped unless the component supplies the value
|
|
1051
|
+
export type BbRadioGroupEvents<V = any> = {
|
|
990
1052
|
/**
|
|
991
1053
|
* Emitted when one of the generated radio inputs loses focus.
|
|
992
1054
|
* Forwards the original DOM `FocusEvent`.
|
|
@@ -1035,10 +1097,10 @@ export type BbRadioGroupEvents = {
|
|
|
1035
1097
|
*/
|
|
1036
1098
|
(e: 'mouseup', event: MouseEvent): void;
|
|
1037
1099
|
/**
|
|
1038
|
-
* Emitted with the newly selected value when the selection changes
|
|
1100
|
+
* Emitted with the newly selected value when the selection changes; `null`
|
|
1101
|
+
* when a `clearable` group is cleared.
|
|
1039
1102
|
*/
|
|
1040
|
-
|
|
1041
|
-
(e: 'update:modelValue', value: any): void;
|
|
1103
|
+
(e: 'update:modelValue', value: V): void;
|
|
1042
1104
|
};
|
|
1043
1105
|
|
|
1044
1106
|
/**
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
}"
|
|
64
64
|
data-bb-no-drag
|
|
65
65
|
:style="starsStyle"
|
|
66
|
+
@mousedown.capture="clicks.onPress"
|
|
66
67
|
@pointermove="onContainerPointerMove"
|
|
67
68
|
>
|
|
68
69
|
<span
|
|
@@ -155,6 +156,7 @@ import { useOnFalsy } from '@/composables/useOnFalsy';
|
|
|
155
156
|
import { useOnTruthy } from '@/composables/useOnTruthy';
|
|
156
157
|
import { removedPropsFor } from '@/deprecation/removedProps';
|
|
157
158
|
import { parseSize } from '@/utilities/functions/parseSize';
|
|
159
|
+
import { createClickCount } from '@/utilities/functions/clickCount';
|
|
158
160
|
import type { CssSize } from '@/types/CommonProps';
|
|
159
161
|
import { warnRemovedAttrs } from '@/utilities/functions/warnRemovedAttrs';
|
|
160
162
|
import { computed, ref, useAttrs, useTemplateRef } from 'vue';
|
|
@@ -332,20 +334,35 @@ const onInputChange = (event: Event) => {
|
|
|
332
334
|
}
|
|
333
335
|
};
|
|
334
336
|
|
|
337
|
+
const clicks = createClickCount();
|
|
338
|
+
|
|
339
|
+
/** `clearable`: the selected star back to `null`; true when it cleared. */
|
|
340
|
+
const clearStar = (event: Event) => {
|
|
341
|
+
if (props.readonly || !props.clearable) return false;
|
|
342
|
+
const input = event.target;
|
|
343
|
+
if (!(input instanceof HTMLInputElement) || !input.checked) return false;
|
|
344
|
+
if (+input.value !== props.modelValue) return false;
|
|
345
|
+
suppressHoverPreview.value = true;
|
|
346
|
+
emit('update:modelValue', null);
|
|
347
|
+
return true;
|
|
348
|
+
};
|
|
349
|
+
|
|
335
350
|
const onInputClick = (event: MouseEvent) => {
|
|
336
351
|
if (props.readonly) {
|
|
337
352
|
event.preventDefault();
|
|
338
353
|
}
|
|
339
354
|
emit('click', event);
|
|
340
|
-
|
|
341
|
-
if (event
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
355
|
+
// A double-click's second click must not undo its first.
|
|
356
|
+
if (clicks.count(event) <= 1) clearStar(event);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Space on the selected star clears. Chromium fires no click for
|
|
361
|
+
* Space on a checked radio, so the key clears here; preventDefault stops an
|
|
362
|
+
* engine that does fire one from clearing twice.
|
|
363
|
+
*/
|
|
364
|
+
const onInputKeyup = (event: KeyboardEvent) => {
|
|
365
|
+
if (event.key === ' ' && clearStar(event)) event.preventDefault();
|
|
349
366
|
};
|
|
350
367
|
|
|
351
368
|
const onContainerPointerMove = () => {
|
|
@@ -363,17 +380,6 @@ const eventListeners = {
|
|
|
363
380
|
},
|
|
364
381
|
onInput: (event: Event) => emit('input', event),
|
|
365
382
|
onKeydown: (event: KeyboardEvent) => {
|
|
366
|
-
if (
|
|
367
|
-
!props.readonly &&
|
|
368
|
-
props.clearable &&
|
|
369
|
-
['Delete', 'Backspace'].includes(event.key) &&
|
|
370
|
-
event.target instanceof HTMLInputElement &&
|
|
371
|
-
+event.target.value === props.modelValue
|
|
372
|
-
) {
|
|
373
|
-
event.preventDefault();
|
|
374
|
-
emit('update:modelValue', null);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
383
|
if (
|
|
378
384
|
props.readonly &&
|
|
379
385
|
[
|
|
@@ -394,6 +400,7 @@ const eventListeners = {
|
|
|
394
400
|
}
|
|
395
401
|
emit('keydown', event);
|
|
396
402
|
},
|
|
403
|
+
onKeyup: onInputKeyup,
|
|
397
404
|
onMousedown: (event: MouseEvent) => emit('mousedown', event),
|
|
398
405
|
onMouseup: (event: MouseEvent) => emit('mouseup', event),
|
|
399
406
|
};
|
|
@@ -584,7 +591,7 @@ export type BbRatingProps = BbRatingPtProps & {
|
|
|
584
591
|
disabled?: boolean;
|
|
585
592
|
|
|
586
593
|
/**
|
|
587
|
-
* Allows clearing the selected rating
|
|
594
|
+
* Allows clearing the selected rating: click the selected star, or Space on it.
|
|
588
595
|
* @defaultValue `false`
|
|
589
596
|
*/
|
|
590
597
|
clearable?: boolean;
|
|
@@ -765,7 +772,8 @@ export type BbRatingEvents = {
|
|
|
765
772
|
(e: 'mouseup', event: MouseEvent): void;
|
|
766
773
|
/**
|
|
767
774
|
* Emitted with the selected rating (1 to `stars`) when clicked. Emits `null`
|
|
768
|
-
* only when `clearable` is enabled and the already-selected star is clicked
|
|
775
|
+
* only when `clearable` is enabled and the already-selected star is clicked
|
|
776
|
+
* (or gets Space).
|
|
769
777
|
*/
|
|
770
778
|
(e: 'update:modelValue', value: number | null): void;
|
|
771
779
|
};
|