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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<BbButton
|
|
18
18
|
v-bind="{ ...mainProps(), ...splitAttrs().main }"
|
|
19
19
|
class="bb-dropdown-button__main"
|
|
20
|
-
:group="
|
|
20
|
+
:group="grouped()"
|
|
21
21
|
:pt="
|
|
22
22
|
passthrough.forward(
|
|
23
23
|
{ main: 'root', icon: 'icon', spinner: 'spinner', text: 'text' },
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
>
|
|
28
28
|
<template v-if="slots.default" #default><slot /></template>
|
|
29
29
|
<!-- The main button's icon slots, with its states. -->
|
|
30
|
-
<template v-if="slots.icon" #icon="scope"
|
|
31
|
-
><slot name="icon" v-bind="scope"
|
|
32
|
-
/></template>
|
|
33
30
|
<template v-if="slots['prepend:icon']" #prepend:icon="scope"
|
|
34
31
|
><slot name="prepend:icon" v-bind="scope"
|
|
35
32
|
/></template>
|
|
@@ -68,18 +65,21 @@
|
|
|
68
65
|
menu button, not a toggle: no v-model, so no aria-pressed beside the
|
|
69
66
|
activator's aria-expanded, which alone paints it open (f397). -->
|
|
70
67
|
<BbButton
|
|
71
|
-
:aria-label="toggleLabel"
|
|
72
68
|
class="bb-dropdown-button__toggle"
|
|
73
69
|
disable-auto-loading
|
|
74
70
|
:disabled="disabled"
|
|
75
71
|
group
|
|
76
|
-
|
|
72
|
+
icon-only
|
|
77
73
|
interactive-while-loading
|
|
78
74
|
:loading="menuLoading"
|
|
75
|
+
:prepend:icon="toggleIcon"
|
|
79
76
|
:pt="toggleButtonPt()"
|
|
80
77
|
:size="button.size"
|
|
78
|
+
:text="toggleLabel"
|
|
81
79
|
:variant="button.variant"
|
|
82
80
|
v-bind="props"
|
|
81
|
+
@vue:mounted="toggleShown = true"
|
|
82
|
+
@vue:unmounted="toggleShown = false"
|
|
83
83
|
/>
|
|
84
84
|
</template>
|
|
85
85
|
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
|
|
97
97
|
<script setup lang="ts">
|
|
98
98
|
import type { FallthroughAttrs } from '@/types/fallthrough';
|
|
99
|
-
import { computed, ref, useAttrs, useTemplateRef } from 'vue';
|
|
99
|
+
import { computed, onMounted, ref, useAttrs, useTemplateRef } from 'vue';
|
|
100
100
|
import BbButton from '../BbButton/BbButton.vue';
|
|
101
101
|
import { useLinkState } from '../BbBaseButton/useLinkState';
|
|
102
102
|
import BbDropdown from '../BbDropdown/BbDropdown.vue';
|
|
@@ -181,7 +181,6 @@ const OWN_SLOTS = new Set([
|
|
|
181
181
|
'activator',
|
|
182
182
|
'default',
|
|
183
183
|
'dropdown',
|
|
184
|
-
'icon',
|
|
185
184
|
'prepend:icon',
|
|
186
185
|
'append:icon',
|
|
187
186
|
]);
|
|
@@ -201,6 +200,17 @@ const menuItems = () => props.items ?? [];
|
|
|
201
200
|
// filter lives in the dropdown, this only asks whether a row survives it.
|
|
202
201
|
const hasMenu = () => hasVisibleRow(menuItems()) || !!slots.dropdown;
|
|
203
202
|
|
|
203
|
+
/**
|
|
204
|
+
* The main button joins the toggle while the toggle is there. The menu drops
|
|
205
|
+
* it when no row is left visible, also once a fetched group resolves all
|
|
206
|
+
* hidden, which only the dropdown knows: read off the toggle itself.
|
|
207
|
+
* Until mount (and on the server) the static answer stands.
|
|
208
|
+
*/
|
|
209
|
+
const toggleShown = ref(false);
|
|
210
|
+
const mounted = ref(false);
|
|
211
|
+
onMounted(() => (mounted.value = true));
|
|
212
|
+
const grouped = () => hasMenu() && (!mounted.value || toggleShown.value);
|
|
213
|
+
|
|
204
214
|
/**
|
|
205
215
|
* The props that are the menu's or the whole control's; every other declared
|
|
206
216
|
* prop is BbButton's, for the main button.
|
|
@@ -812,11 +822,9 @@ export type BbDropdownButtonSlots = {
|
|
|
812
822
|
*/
|
|
813
823
|
default?: () => any;
|
|
814
824
|
/**
|
|
815
|
-
* The main button's icon, replacing
|
|
816
|
-
*
|
|
825
|
+
* The main button's leading icon, replacing `prepend:icon` (the one
|
|
826
|
+
* `icon-only` shows); inside its `icon` part, with its states.
|
|
817
827
|
*/
|
|
818
|
-
icon?: (props: BbButtonIconSlotProps) => any;
|
|
819
|
-
/** The main button's leading icon, replacing `prepend:icon`. */
|
|
820
828
|
'prepend:icon'?: (props: BbButtonIconSlotProps) => any;
|
|
821
829
|
/** The main button's trailing icon, replacing `append:icon`. */
|
|
822
830
|
'append:icon'?: (props: BbButtonIconSlotProps) => any;
|
|
@@ -369,7 +369,7 @@ export type BbDropdownItemProps<T = any> = ItemProps<T, DropdownItemFields>;
|
|
|
369
369
|
*/
|
|
370
370
|
type SubmenuExclusive =
|
|
371
371
|
| {
|
|
372
|
-
items:
|
|
372
|
+
items: ItemEntry[];
|
|
373
373
|
/** A submenu row opens its submenu; it cannot also run an action. */
|
|
374
374
|
onClick?: never;
|
|
375
375
|
/** A submenu row opens its submenu; it cannot also navigate. */
|
|
@@ -385,6 +385,8 @@ export type InternalItem = Omit<
|
|
|
385
385
|
> &
|
|
386
386
|
SubmenuExclusive &
|
|
387
387
|
DropdownEntryBase & {
|
|
388
|
+
/** Rows have no search box (a group has); declared so a group's `searchable` discriminates. */
|
|
389
|
+
searchable?: never;
|
|
388
390
|
/** The row's text. */
|
|
389
391
|
label: string;
|
|
390
392
|
/**
|
|
@@ -446,27 +448,32 @@ export type InternalItem = Omit<
|
|
|
446
448
|
* when its latest load FAILED (`'failed'`: the footer under whatever rows a
|
|
447
449
|
* `stash` keeps listed). Rendered as a non-interactive row that
|
|
448
450
|
* shows `label` or, when provided, the dropdown's `loading` / `empty` slot.
|
|
449
|
-
*
|
|
451
|
+
*
|
|
452
|
+
* @internal Set by `BbDropdownGroup`.
|
|
450
453
|
*/
|
|
451
454
|
placeholder?: 'loading' | 'empty' | 'failed';
|
|
452
455
|
/**
|
|
453
456
|
* On a `'failed'` placeholder: what the group's `items` load rejected
|
|
454
|
-
* with
|
|
455
|
-
*
|
|
457
|
+
* with, handed to the `empty` slot as `error`.
|
|
458
|
+
*
|
|
459
|
+
* @internal Set by the pipeline resolver.
|
|
456
460
|
*/
|
|
457
461
|
error?: unknown;
|
|
458
462
|
/**
|
|
459
463
|
* Marks a row built by the pipeline resolver from a fetched item. Its
|
|
460
464
|
* `selectable` predicate already ran against the RAW item there, so
|
|
461
465
|
* `normalizeGroups` must not run it again against this row object.
|
|
462
|
-
*
|
|
466
|
+
*
|
|
467
|
+
* @internal
|
|
463
468
|
*/
|
|
464
469
|
fetched?: true;
|
|
465
470
|
/**
|
|
466
471
|
* Optional slot token used to resolve per-item named slots. Primarily set
|
|
467
472
|
* by the pipeline resolver so slot names can be derived from the resolved
|
|
468
473
|
* `itemValue` (readable), while `rowKey` remains the hash-based selection
|
|
469
|
-
* id.
|
|
474
|
+
* id.
|
|
475
|
+
*
|
|
476
|
+
* @internal
|
|
470
477
|
*/
|
|
471
478
|
slotKey?: string;
|
|
472
479
|
};
|
|
@@ -497,16 +504,24 @@ export type InternalItem = Omit<
|
|
|
497
504
|
*
|
|
498
505
|
* A provider signals a failure by THROWING, never by returning `[]`: the
|
|
499
506
|
* rows are cleared, nothing is pruned, and the `empty` placeholder shows
|
|
500
|
-
* `failedText` with the error. Zero-argument providers keep working.
|
|
501
|
-
*
|
|
507
|
+
* `failedText` with the error. Zero-argument providers keep working. An
|
|
508
|
+
* unannotated getter reads its context typed (`query` a string on a
|
|
509
|
+
* `searchable` group); a provider shared with other components is annotated
|
|
510
|
+
* `BbDropdownGroupItemsContext`.
|
|
502
511
|
*/
|
|
503
|
-
export type DropdownGroupItemsGetter =
|
|
512
|
+
export type DropdownGroupItemsGetter = PlainGetter | SearchGetter;
|
|
513
|
+
|
|
514
|
+
/** A group without a search box: no `query` arrives. */
|
|
515
|
+
type PlainGetter = (
|
|
516
|
+
context: BbDropdownGroupItemsContext
|
|
517
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a fetched group's rows are the API's records: the dropdown is not generic, so their type cannot reach the accessors
|
|
518
|
+
) => any[] | Promise<any[]>;
|
|
519
|
+
|
|
520
|
+
/** A `searchable` group: `query` always arrives, `''` until typed. */
|
|
521
|
+
type SearchGetter = (
|
|
522
|
+
context: BbDropdownGroupItemsContext & { query: string }
|
|
504
523
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a fetched group's rows are the API's records: the dropdown is not generic, so their type cannot reach the accessors
|
|
505
|
-
|
|
506
|
-
| ((
|
|
507
|
-
context: BbDropdownGroupItemsContext & { query: string }
|
|
508
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a fetched group's rows are the API's records: the dropdown is not generic, so their type cannot reach the accessors
|
|
509
|
-
) => any[] | Promise<any[]>);
|
|
524
|
+
) => any[] | Promise<any[]>;
|
|
510
525
|
|
|
511
526
|
export type InternalGroup = DropdownEntryBase & {
|
|
512
527
|
/**
|
|
@@ -546,23 +561,9 @@ export type InternalGroup = DropdownEntryBase & {
|
|
|
546
561
|
*/
|
|
547
562
|
group?: true;
|
|
548
563
|
/**
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
* `({ reason, modelValue, signal }) => Item[] | Promise<Item[]>` (plus
|
|
553
|
-
* `query` when the group is `searchable`; see {@link DropdownGroupItemsGetter})
|
|
554
|
-
* and pair it with `itemText`/`itemValue`. A `<BbDropdownGroup :id v-model>`
|
|
555
|
-
* companion resolves such a group and surfaces the selected `itemValue`(s)
|
|
556
|
-
* through `v-model`.
|
|
557
|
-
*/
|
|
558
|
-
items:
|
|
559
|
-
| Array<InternalItem | InternalItem[]>
|
|
560
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a fetched group's raw records, before normalisation (see `itemText`)
|
|
561
|
-
| any[]
|
|
562
|
-
| DropdownGroupItemsGetter;
|
|
563
|
-
/**
|
|
564
|
-
* Pipeline groups only. Path/getter producing each item's display text
|
|
565
|
-
* (a primitive item is its own text; a getter still maps it).
|
|
564
|
+
* Pipeline groups only. Path/getter producing each item's display text.
|
|
565
|
+
* A string or number row needs none, fetched or written: it is its own
|
|
566
|
+
* text and value (a getter here still maps a fetched one).
|
|
566
567
|
*
|
|
567
568
|
* Unset: own `label`, else `text` (`{ label, value }` needs no accessor).
|
|
568
569
|
*
|
|
@@ -659,17 +660,6 @@ export type InternalGroup = DropdownEntryBase & {
|
|
|
659
660
|
* @defaultValue `'interaction'`
|
|
660
661
|
*/
|
|
661
662
|
prefill?: boolean | 'interaction';
|
|
662
|
-
/**
|
|
663
|
-
* Renders a search field at the top of THIS group (so, inside its submenu when
|
|
664
|
-
* the group is one), scoped to this group alone — the nested "category ›
|
|
665
|
-
* searchable options" pattern. Typing narrows this group's rows by
|
|
666
|
-
* the ranked search (see `filterBy`) and, for an async group, passes
|
|
667
|
-
* the typed text to its getter as the context's `query` (a user search arrives
|
|
668
|
-
* with `reason: 'search'`, as on `BbSelect`; see
|
|
669
|
-
* `BbDropdownGroupItemsContext`). Each searchable group owns its own query,
|
|
670
|
-
* independent of its siblings.
|
|
671
|
-
*/
|
|
672
|
-
searchable?: boolean;
|
|
673
663
|
/** Placeholder for this group's search field. Defaults to the localized label. */
|
|
674
664
|
searchPlaceholder?: string;
|
|
675
665
|
/**
|
|
@@ -726,7 +716,65 @@ export type InternalGroup = DropdownEntryBase & {
|
|
|
726
716
|
* category, yet still wants a label for chips.
|
|
727
717
|
*/
|
|
728
718
|
hideLabel?: boolean;
|
|
729
|
-
};
|
|
719
|
+
} & GroupSource;
|
|
720
|
+
|
|
721
|
+
// `searchable` picks the getter's context: a searchable group's getter always
|
|
722
|
+
// gets `query`, any other group's none. Each side has one signature, so an
|
|
723
|
+
// unannotated getter reads its context typed (a union of the two did not).
|
|
724
|
+
type GroupSource =
|
|
725
|
+
| {
|
|
726
|
+
/**
|
|
727
|
+
* Renders a search field at the top of THIS group (so, inside its submenu when
|
|
728
|
+
* the group is one), scoped to this group alone — the nested "category ›
|
|
729
|
+
* searchable options" pattern. Typing narrows this group's rows by
|
|
730
|
+
* the ranked search (see `filterBy`) and, for an async group, passes
|
|
731
|
+
* the typed text to its getter as the context's `query` (a user search arrives
|
|
732
|
+
* with `reason: 'search'`, as on `BbSelect`; see
|
|
733
|
+
* `BbDropdownGroupItemsContext`). Each searchable group owns its own query,
|
|
734
|
+
* independent of its siblings.
|
|
735
|
+
*/
|
|
736
|
+
searchable: true;
|
|
737
|
+
/**
|
|
738
|
+
* Items of the group. Plain arrays are flattened.
|
|
739
|
+
*
|
|
740
|
+
* For a **pipeline group**, pass raw objects (`any[]`) or an (async) getter
|
|
741
|
+
* `({ reason, modelValue, signal }) => Item[] | Promise<Item[]>` (plus
|
|
742
|
+
* `query` when the group is `searchable`; see {@link DropdownGroupItemsGetter})
|
|
743
|
+
* and pair it with `itemText`/`itemValue`. A `<BbDropdownGroup :id v-model>`
|
|
744
|
+
* companion resolves such a group and surfaces the selected `itemValue`(s)
|
|
745
|
+
* through `v-model`.
|
|
746
|
+
*/
|
|
747
|
+
items: GroupRows | SearchGetter;
|
|
748
|
+
}
|
|
749
|
+
| {
|
|
750
|
+
/**
|
|
751
|
+
* Renders a search field at the top of THIS group (so, inside its submenu when
|
|
752
|
+
* the group is one), scoped to this group alone — the nested "category ›
|
|
753
|
+
* searchable options" pattern. Typing narrows this group's rows by
|
|
754
|
+
* the ranked search (see `filterBy`) and, for an async group, passes
|
|
755
|
+
* the typed text to its getter as the context's `query` (a user search arrives
|
|
756
|
+
* with `reason: 'search'`, as on `BbSelect`; see
|
|
757
|
+
* `BbDropdownGroupItemsContext`). Each searchable group owns its own query,
|
|
758
|
+
* independent of its siblings.
|
|
759
|
+
*/
|
|
760
|
+
searchable?: false;
|
|
761
|
+
/**
|
|
762
|
+
* Items of the group. Plain arrays are flattened.
|
|
763
|
+
*
|
|
764
|
+
* For a **pipeline group**, pass raw objects (`any[]`) or an (async) getter
|
|
765
|
+
* `({ reason, modelValue, signal }) => Item[] | Promise<Item[]>` (plus
|
|
766
|
+
* `query` when the group is `searchable`; see {@link DropdownGroupItemsGetter})
|
|
767
|
+
* and pair it with `itemText`/`itemValue`. A `<BbDropdownGroup :id v-model>`
|
|
768
|
+
* companion resolves such a group and surfaces the selected `itemValue`(s)
|
|
769
|
+
* through `v-model`.
|
|
770
|
+
*/
|
|
771
|
+
items: GroupRows | PlainGetter;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
type GroupRows =
|
|
775
|
+
| Array<InternalItem | InternalItem[]>
|
|
776
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a fetched group's raw records, before normalisation (see `itemText`)
|
|
777
|
+
| any[];
|
|
730
778
|
|
|
731
779
|
/**
|
|
732
780
|
* A group's items as a raw array, or `[]` when the items are still an
|
|
@@ -739,6 +787,17 @@ export const groupItemsAsArray = (
|
|
|
739
787
|
): Array<InternalItem | InternalItem[]> =>
|
|
740
788
|
Array.isArray(items) ? (items as Array<InternalItem | InternalItem[]>) : [];
|
|
741
789
|
|
|
790
|
+
/**
|
|
791
|
+
* A string or number row: its own text and value (`'Google'` reads "Google"
|
|
792
|
+
* and picks `'Google'`), loose, in a section, in a group's `items` or in a
|
|
793
|
+
* submenu's `items`. It declares `searchable` like every entry, so a group
|
|
794
|
+
* literal beside it still picks its plain or searchable getter.
|
|
795
|
+
*/
|
|
796
|
+
export type PrimitiveRow = (string | number) & { searchable?: never };
|
|
797
|
+
|
|
798
|
+
/** One entry of an `items` array: an {@link Item} or a {@link PrimitiveRow}. */
|
|
799
|
+
export type ItemEntry = Item | PrimitiveRow;
|
|
800
|
+
|
|
742
801
|
/**
|
|
743
802
|
* Items accepted by the dropdown. Entries can be:
|
|
744
803
|
* - a single {@link InternalItem};
|
|
@@ -747,7 +806,12 @@ export const groupItemsAsArray = (
|
|
|
747
806
|
*
|
|
748
807
|
* The shapes can be mixed, e.g. `[item, [item, item], { id, label, items }]`.
|
|
749
808
|
*/
|
|
750
|
-
export type Item =
|
|
809
|
+
export type Item =
|
|
810
|
+
| InternalItem
|
|
811
|
+
| InternalGroup
|
|
812
|
+
// The `searchable` guard lets an unwritten `searchable` pick a group's
|
|
813
|
+
// plain getter: every member of the union has to declare the property.
|
|
814
|
+
| (ItemEntry[] & { searchable?: never });
|
|
751
815
|
|
|
752
816
|
/** Unwraps the item type out of the (possibly nested) {@link Items} shape. */
|
|
753
817
|
export type FlatItem<T> = T extends Array<infer U> ? U : T;
|
|
@@ -778,7 +842,17 @@ export const selectablePredicateOf = (
|
|
|
778
842
|
): ((item: any) => boolean) | undefined =>
|
|
779
843
|
typeof entry.selectable === 'function' ? entry.selectable : undefined;
|
|
780
844
|
|
|
781
|
-
|
|
845
|
+
/** A string or number row: its own text and value (normalizeGroups maps it). */
|
|
846
|
+
export const isPrimitiveRow = (
|
|
847
|
+
entry: ItemEntry | InternalItem | InternalItem[]
|
|
848
|
+
): entry is PrimitiveRow =>
|
|
849
|
+
typeof entry === 'string' || typeof entry === 'number';
|
|
850
|
+
|
|
851
|
+
// A primitive row (`'Google'`, `3`) is its own text and value: never a group,
|
|
852
|
+
// and `in` throws on it, so the object check comes first.
|
|
853
|
+
export const isGroup = (entry: ItemEntry): entry is InternalGroup =>
|
|
854
|
+
typeof entry === 'object' &&
|
|
855
|
+
entry !== null &&
|
|
782
856
|
!Array.isArray(entry) &&
|
|
783
857
|
((entry as InternalGroup).group === true ||
|
|
784
858
|
'selectable' in entry ||
|
|
@@ -1123,7 +1197,13 @@ export type BbDropdownProps = BbDropdownPtProps & {
|
|
|
1123
1197
|
*
|
|
1124
1198
|
* @defaultValue `[]`
|
|
1125
1199
|
*/
|
|
1126
|
-
items: Item
|
|
1200
|
+
items: Array<Item | PrimitiveRow>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Keeps the trigger when no row is visible (by default it is hidden):
|
|
1203
|
+
* inert, no popup ARIA, `empty` in the activator slot. A `contextMenu`
|
|
1204
|
+
* trigger always stays.
|
|
1205
|
+
*/
|
|
1206
|
+
keepActivator?: boolean;
|
|
1127
1207
|
/**
|
|
1128
1208
|
* Default placeholder text shown while a pipeline group's async items load.
|
|
1129
1209
|
* A group's own `loadingText` overrides this; both fall back to the localized
|
|
@@ -1162,9 +1242,8 @@ export type BbDropdownProps = BbDropdownPtProps & {
|
|
|
1162
1242
|
*/
|
|
1163
1243
|
padding?: number;
|
|
1164
1244
|
/**
|
|
1165
|
-
* Position
|
|
1166
|
-
*
|
|
1167
|
-
* (No arrow is drawn either way — arrows are tooltip-only in v3.)
|
|
1245
|
+
* Position relative to the activator; `'cursor'` anchors at the
|
|
1246
|
+
* mouse/touch point. No arrow (tooltips only).
|
|
1168
1247
|
*
|
|
1169
1248
|
* @defaultValue `'bottom'`
|
|
1170
1249
|
*/
|
|
@@ -1213,8 +1292,7 @@ export type BbDropdownEvents = {
|
|
|
1213
1292
|
/**
|
|
1214
1293
|
* The user selected a row in a selectable group, at the click — also when a
|
|
1215
1294
|
* controlled companion's app then refuses the value. The payload is the
|
|
1216
|
-
* row's value (its `item-value` for pipeline groups, else its `value`)
|
|
1217
|
-
* symmetric with `BbTable`'s `item:selected`.
|
|
1295
|
+
* row's value (its `item-value` for pipeline groups, else its `value`).
|
|
1218
1296
|
*/
|
|
1219
1297
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the row's resolved value, whatever a fetched group's `item-value` returns: the dropdown is not generic, and `unknown` would reject a handler annotated `(id: number)`
|
|
1220
1298
|
(e: 'item:selected', value: any): void;
|
|
@@ -1237,6 +1315,8 @@ export type BbDropdownActivatorProps = {
|
|
|
1237
1315
|
export type BbDropdownActivatorSlotProps = {
|
|
1238
1316
|
/** Whether the dropdown is globally disabled. */
|
|
1239
1317
|
disabled?: boolean;
|
|
1318
|
+
/** No row is visible: the trigger is inert. */
|
|
1319
|
+
empty: boolean;
|
|
1240
1320
|
/**
|
|
1241
1321
|
* Whether any item's async `onClick` is currently in flight. Use to reflect a
|
|
1242
1322
|
* global busy state on the trigger.
|
|
@@ -1390,9 +1470,8 @@ export type BbDropdownSlots = {
|
|
|
1390
1470
|
*/
|
|
1391
1471
|
activator?: (props: BbDropdownActivatorSlotProps) => any;
|
|
1392
1472
|
/**
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
* divider — for a title or a filter field.
|
|
1473
|
+
* Pinned above the rows, outside their scroll, with a divider — for a
|
|
1474
|
+
* title or a filter field.
|
|
1396
1475
|
*/
|
|
1397
1476
|
header?: (props: BbDropdownEdgeSlotProps) => any;
|
|
1398
1477
|
/**
|
|
@@ -1407,9 +1486,8 @@ export type BbDropdownSlots = {
|
|
|
1407
1486
|
*/
|
|
1408
1487
|
'item:append'?: (props: BbDropdownItemSlotProps) => any;
|
|
1409
1488
|
/**
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1412
|
-
* divider — for action buttons.
|
|
1489
|
+
* Pinned below the rows, outside their scroll, with a divider — for
|
|
1490
|
+
* action buttons.
|
|
1413
1491
|
*/
|
|
1414
1492
|
footer?: (props: BbDropdownEdgeSlotProps) => any;
|
|
1415
1493
|
} & Record<string, (props: BbDropdownItemSlotProps) => any>;
|
|
@@ -2348,7 +2426,7 @@ export type BbDropdownGroupEvents = {
|
|
|
2348
2426
|
/* Same chevron_right asset the submenu rows use, pointed back:
|
|
2349
2427
|
toward the inline start, which is already where it points in
|
|
2350
2428
|
rtl. */
|
|
2351
|
-
.bb-
|
|
2429
|
+
.bb-button__prepend-icon {
|
|
2352
2430
|
transform: rotate(180deg);
|
|
2353
2431
|
|
|
2354
2432
|
&:dir(rtl) {
|
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(
|
|
@@ -582,7 +643,7 @@ watch(
|
|
|
582
643
|
if (!Object.keys(next).length || (!added && !resubmitted)) return;
|
|
583
644
|
focusedForSubmit = submitCount.value;
|
|
584
645
|
const focusedBefore = document.activeElement;
|
|
585
|
-
emitServerInvalid(next);
|
|
646
|
+
emitServerInvalid(next, 'prop');
|
|
586
647
|
const landed: Record<string, string[]> = {};
|
|
587
648
|
for (const field of fields) {
|
|
588
649
|
const messages = fieldErrorsAt(field.name());
|
|
@@ -741,7 +802,10 @@ provide(BB_FORM_SUBMIT_LOCK, {
|
|
|
741
802
|
});
|
|
742
803
|
// the BbDialog / BbOffCanvas around the form refuses user closes
|
|
743
804
|
// while the lock is on (so `disable-submit-lock` releases it too).
|
|
744
|
-
joinOverlaySubmitGuard(
|
|
805
|
+
const tellOverlay = joinOverlaySubmitGuard({
|
|
806
|
+
locked: submitLocked,
|
|
807
|
+
submit: async () => (await onSubmitEvent()) === true,
|
|
808
|
+
});
|
|
745
809
|
|
|
746
810
|
type SubmitListener = (
|
|
747
811
|
values: Record<string, unknown>,
|
|
@@ -773,6 +837,50 @@ const reportListenerError = (error: unknown) => {
|
|
|
773
837
|
const isThenable = (value: unknown): value is PromiseLike<unknown> =>
|
|
774
838
|
typeof (value as PromiseLike<unknown>)?.then === 'function';
|
|
775
839
|
|
|
840
|
+
const isValidationError = useConfigSetting<BbIsValidationError>(
|
|
841
|
+
'BbForm',
|
|
842
|
+
'isValidationError'
|
|
843
|
+
);
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* A validation answer lands like `setErrors`, minus what `field-errors`
|
|
847
|
+
* already shows (the Inertia pair: the page's errors object updated with the
|
|
848
|
+
* same bag), and `invalid` carries the whole answer, once.
|
|
849
|
+
*/
|
|
850
|
+
const landAnswer = (answer: ValidationAnswer) => {
|
|
851
|
+
const toLand: Record<string, string[]> = {};
|
|
852
|
+
for (const [key, messages] of Object.entries(answer)) {
|
|
853
|
+
const shown = fieldErrorsAt(nameToPath(key));
|
|
854
|
+
if (!messages.every((message) => shown.includes(message)))
|
|
855
|
+
toLand[key] = messages;
|
|
856
|
+
}
|
|
857
|
+
if (Object.keys(toLand).length)
|
|
858
|
+
landServerErrors(toLand, {}, answer, 'rejection');
|
|
859
|
+
else emitServerInvalid(answer, 'rejection');
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* A real error: `@submit-error` handles it when bound (a listener that
|
|
864
|
+
* rethrows reports once), else the app's error handler gets it.
|
|
865
|
+
*/
|
|
866
|
+
const submitError = (error: unknown) => {
|
|
867
|
+
const props = instance?.vnode.props as Record<string, unknown> | undefined;
|
|
868
|
+
const raw = props?.onSubmitError;
|
|
869
|
+
const handlers = (Array.isArray(raw) ? raw : raw ? [raw] : []) as Array<
|
|
870
|
+
(error: unknown) => unknown
|
|
871
|
+
>;
|
|
872
|
+
if (!handlers.length) return reportListenerError(error);
|
|
873
|
+
for (const handler of handlers) {
|
|
874
|
+
try {
|
|
875
|
+
const result = handler(error);
|
|
876
|
+
if (isThenable(result))
|
|
877
|
+
Promise.resolve(result).catch(reportListenerError);
|
|
878
|
+
} catch (rethrown) {
|
|
879
|
+
reportListenerError(rethrown);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
|
|
776
884
|
/**
|
|
777
885
|
* Runs the `@submit` listeners. Resolves (or returns) whether the save
|
|
778
886
|
* went through: `false` when a listener threw or its promise rejected, which
|
|
@@ -798,27 +906,50 @@ const runSubmitListeners = (
|
|
|
798
906
|
listeners.push(...once);
|
|
799
907
|
}
|
|
800
908
|
}
|
|
801
|
-
if (!listeners.length)
|
|
909
|
+
if (!listeners.length) {
|
|
910
|
+
tellOverlay({ value: undefined, values: formValues });
|
|
911
|
+
return true;
|
|
912
|
+
}
|
|
802
913
|
|
|
803
914
|
let failed = false;
|
|
915
|
+
let value: unknown;
|
|
916
|
+
/*
|
|
917
|
+
* each listener's outcome on its own:
|
|
918
|
+
* `false` is a handled failure (nothing fires), a validation answer lands
|
|
919
|
+
* on the fields, anything else is a real error for `@submit-error` or the
|
|
920
|
+
* app's error handler. The first value a listener resolves (not
|
|
921
|
+
* `undefined`, not `false`) is the save's result (a dialog completes with
|
|
922
|
+
* it).
|
|
923
|
+
*/
|
|
924
|
+
const succeed = (result: unknown) => {
|
|
925
|
+
if (result === false) failed = true;
|
|
926
|
+
else if (value === undefined && result !== undefined) value = result;
|
|
927
|
+
};
|
|
804
928
|
const fail = (error: unknown) => {
|
|
805
929
|
failed = true;
|
|
806
|
-
|
|
930
|
+
const answer = recognizeValidation(error, isValidationError());
|
|
931
|
+
if (answer) landAnswer(answer);
|
|
932
|
+
else submitError(error);
|
|
807
933
|
};
|
|
934
|
+
const outcome = (): SubmitOutcome =>
|
|
935
|
+
failed ? false : { value, values: formValues };
|
|
808
936
|
const pending: Array<PromiseLike<unknown>> = [];
|
|
809
937
|
for (const listener of listeners) {
|
|
810
938
|
try {
|
|
811
939
|
const result = listener(formValues, { submitter });
|
|
812
940
|
if (isThenable(result)) {
|
|
813
|
-
pending.push(Promise.resolve(result).
|
|
814
|
-
}
|
|
941
|
+
pending.push(Promise.resolve(result).then(succeed, fail));
|
|
942
|
+
} else succeed(result);
|
|
815
943
|
} catch (error) {
|
|
816
944
|
fail(error);
|
|
817
945
|
}
|
|
818
946
|
}
|
|
819
947
|
// Await only what is actually awaitable, so a sync handler keeps the exact
|
|
820
948
|
// timing it has today rather than being pushed a microtask later.
|
|
821
|
-
if (!pending.length)
|
|
949
|
+
if (!pending.length) {
|
|
950
|
+
tellOverlay(outcome());
|
|
951
|
+
return !failed;
|
|
952
|
+
}
|
|
822
953
|
// the form locks for exactly as long as the save runs. Its own
|
|
823
954
|
// flag, not vee-validate's `isSubmitting`, which is also true while
|
|
824
955
|
// validation runs, so a sync submit would flash the lock.
|
|
@@ -830,7 +961,10 @@ const runSubmitListeners = (
|
|
|
830
961
|
savesInFlight.value--;
|
|
831
962
|
countSave(submitter, -1);
|
|
832
963
|
})
|
|
833
|
-
.then(() =>
|
|
964
|
+
.then(() => {
|
|
965
|
+
tellOverlay(outcome());
|
|
966
|
+
return !failed;
|
|
967
|
+
});
|
|
834
968
|
};
|
|
835
969
|
|
|
836
970
|
// With a schema, `formValues` is the schema's OUTPUT: vee-validate hands the
|