bitboss-ui 3.0.0-beta.4 → 3.0.0-beta.41
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 +317 -98
- package/bin/bitboss-ui-mcp.mjs +1566 -75
- package/bin/bitboss-ui.mjs +716 -72
- package/dist/ai/BbAccordion.md +178 -56
- package/dist/ai/BbAlert.md +140 -28
- package/dist/ai/BbAsterisk.md +61 -4
- package/dist/ai/BbAvatar.md +194 -53
- package/dist/ai/BbBadge.md +250 -50
- package/dist/ai/BbBadgeButton.md +74 -21
- package/dist/ai/BbBaseButton.md +132 -51
- package/dist/ai/BbBaseCheckboxIcon.md +118 -26
- package/dist/ai/BbBaseRadioIcon.md +115 -26
- package/dist/ai/BbBaseSwitchIcon.md +123 -28
- package/dist/ai/BbBreadcrumbs.md +221 -51
- package/dist/ai/BbButton.md +389 -107
- package/dist/ai/BbCalendar.md +667 -0
- package/dist/ai/BbCheckbox.md +242 -80
- package/dist/ai/BbCheckboxGroup.md +575 -66
- package/dist/ai/BbCollapsible.md +158 -39
- package/dist/ai/BbColorInput.md +322 -82
- package/dist/ai/BbColorPalette.md +261 -61
- package/dist/ai/BbConfirm.md +220 -51
- package/dist/ai/BbConfirmPortal.md +1 -1
- package/dist/ai/BbDatePicker.md +272 -37
- package/dist/ai/BbDatePickerInput.md +321 -92
- package/dist/ai/BbDialog.md +492 -87
- package/dist/ai/BbDropdown.md +1182 -104
- package/dist/ai/BbDropdownButton.md +239 -61
- package/dist/ai/BbDropdownGroup.md +5 -5
- package/dist/ai/BbDropzone.md +140 -36
- package/dist/ai/BbForm.md +1165 -40
- package/dist/ai/BbIcon.md +100 -33
- package/dist/ai/BbIndicator.md +79 -12
- package/dist/ai/BbNumberInput.md +257 -87
- package/dist/ai/BbOffCanvas.md +396 -91
- package/dist/ai/BbPagination.md +199 -32
- package/dist/ai/BbPopover.md +219 -54
- package/dist/ai/BbProgress.md +137 -71
- package/dist/ai/BbPtScope.md +136 -0
- package/dist/ai/BbRadio.md +234 -43
- package/dist/ai/BbRadioGroup.md +529 -91
- package/dist/ai/BbRating.md +243 -61
- package/dist/ai/BbSelect.md +690 -120
- package/dist/ai/BbSelectPopover.md +434 -122
- package/dist/ai/BbSlider.md +275 -79
- package/dist/ai/BbSmoothHeight.md +142 -34
- package/dist/ai/BbSpinner.md +179 -81
- package/dist/ai/BbSwitch.md +249 -63
- package/dist/ai/BbSwitchGroup.md +394 -65
- package/dist/ai/BbTable.md +1666 -222
- package/dist/ai/BbTabs.md +898 -178
- package/dist/ai/BbTabsList.md +81 -7
- package/dist/ai/BbTabsPanels.md +77 -0
- package/dist/ai/BbTabsRoot.md +16 -15
- package/dist/ai/BbTag.md +256 -76
- package/dist/ai/BbTextInput.md +480 -102
- package/dist/ai/BbTextarea.md +310 -96
- package/dist/ai/BbTimePicker.md +159 -24
- package/dist/ai/BbTimePickerInput.md +277 -46
- package/dist/ai/BbToast.md +286 -40
- package/dist/ai/BbToastPortal.md +3 -3
- package/dist/ai/BbTooltip.md +187 -34
- package/dist/ai/BbTree.md +260 -85
- package/dist/ai/ChipsBox.md +43 -2
- package/dist/ai/ClearableButton.md +12 -0
- package/dist/ai/CommaBox.md +2 -1
- package/dist/ai/CommonField.md +63 -0
- package/dist/ai/CommonFieldInput.md +90 -0
- package/dist/ai/CommonPopover.md +17 -12
- package/dist/ai/CommonTimeSelector.md +63 -0
- package/dist/ai/ErrorIcon.md +20 -0
- package/dist/ai/FlatListBox.md +41 -11
- package/dist/ai/GroupedListBox.md +42 -12
- package/dist/ai/ListBox.md +46 -11
- package/dist/ai/OptionsContainer.md +13 -10
- package/dist/ai/WarningIcon.md +20 -0
- package/dist/ai/changelog.json +4025 -141
- package/dist/ai/components.json +51872 -10136
- package/dist/ai/composables/useBbConfig.md +72 -11
- package/dist/ai/composables/useBbDropdownContext.md +168 -0
- package/dist/ai/composables/useBbFormContext.md +51 -24
- package/dist/ai/composables/useBbFormField.md +134 -0
- package/dist/ai/composables/useBbTableContext.md +41 -19
- package/dist/ai/composables/useConfirm.md +16 -8
- package/dist/ai/composables/useCountdown.md +1 -1
- package/dist/ai/composables/useId.md +10 -10
- package/dist/ai/composables/useMobile.md +17 -10
- package/dist/ai/composables/useToast.md +25 -19
- package/dist/ai/design-tokens.json +940 -0
- package/dist/ai/design-tokens.manifest.yaml +175 -0
- package/dist/ai/guides/agent-contract.md +168 -22
- package/dist/ai/guides/ai-router.md +79 -40
- package/dist/ai/guides/app-layout.md +8 -4
- package/dist/ai/guides/coherence-playbook.md +8 -8
- package/dist/ai/guides/component-picker.md +42 -34
- package/dist/ai/guides/design-language.md +274 -97
- package/dist/ai/guides/design-tokens.md +493 -105
- package/dist/ai/guides/fetch-items-playbook.md +22 -16
- package/dist/ai/guides/icons-policy.md +67 -35
- package/dist/ai/guides/inertia-helpers.md +4 -1
- package/dist/ai/guides/inline-edit-playbook.md +13 -6
- package/dist/ai/guides/installation-and-plugin-setup.md +817 -73
- package/dist/ai/guides/migration/components/bb-accordion.md +37 -0
- package/dist/ai/guides/migration/components/bb-alert.md +2 -2
- package/dist/ai/guides/migration/components/bb-avatar.md +13 -14
- package/dist/ai/guides/migration/components/bb-badge.md +5 -5
- package/dist/ai/guides/migration/components/bb-breadcrumbs.md +9 -8
- package/dist/ai/guides/migration/components/bb-button.md +80 -20
- package/dist/ai/guides/migration/components/bb-checkbox-group.md +116 -29
- package/dist/ai/guides/migration/components/bb-checkbox.md +53 -10
- package/dist/ai/guides/migration/components/bb-chip.md +6 -6
- package/dist/ai/guides/migration/components/bb-collapsible.md +5 -5
- package/dist/ai/guides/migration/components/bb-color-input.md +5 -5
- package/dist/ai/guides/migration/components/bb-color-palette.md +16 -9
- package/dist/ai/guides/migration/components/bb-date-picker-input.md +45 -35
- package/dist/ai/guides/migration/components/bb-dialog.md +69 -36
- package/dist/ai/guides/migration/components/bb-dropdown-button.md +7 -1
- package/dist/ai/guides/migration/components/bb-dropdown.md +31 -8
- package/dist/ai/guides/migration/components/bb-dropzone.md +8 -0
- package/dist/ai/guides/migration/components/bb-icon.md +7 -7
- package/dist/ai/guides/migration/components/bb-intersection.md +1 -1
- package/dist/ai/guides/migration/components/bb-offcanvas.md +29 -31
- package/dist/ai/guides/migration/components/bb-pagination.md +10 -0
- package/dist/ai/guides/migration/components/bb-popover.md +19 -11
- package/dist/ai/guides/migration/components/bb-radio-group.md +14 -0
- package/dist/ai/guides/migration/components/bb-rating.md +61 -24
- package/dist/ai/guides/migration/components/bb-select-popover.md +9 -1
- package/dist/ai/guides/migration/components/bb-select.md +21 -4
- package/dist/ai/guides/migration/components/bb-slider.md +14 -6
- package/dist/ai/guides/migration/components/bb-switch-group.md +14 -0
- package/dist/ai/guides/migration/components/bb-table.md +574 -33
- package/dist/ai/guides/migration/components/bb-tabs.md +91 -41
- package/dist/ai/guides/migration/components/bb-tag.md +9 -7
- package/dist/ai/guides/migration/components/bb-text-input.md +12 -12
- package/dist/ai/guides/migration/components/bb-toast.md +2 -2
- package/dist/ai/guides/migration/components/bb-tooltip.md +18 -0
- package/dist/ai/guides/migration/components/bb-tree.md +11 -9
- package/dist/ai/guides/migration/components/use-confirm.md +9 -1
- package/dist/ai/guides/migration/v2-to-v3.md +828 -240
- package/dist/ai/guides/migration/v3-beta-css-classes.md +751 -0
- package/dist/ai/guides/migration/v3-beta-tooling.md +119 -0
- package/dist/ai/guides/options-items-playbook.md +161 -12
- package/dist/ai/guides/page-shell.md +1 -1
- package/dist/ai/guides/passthrough.md +958 -0
- package/dist/ai/guides/preset-components.md +361 -0
- package/dist/ai/guides/ssr-prefill.md +127 -0
- package/dist/ai/guides/validated-forms.md +466 -55
- package/dist/ai/guides/validation-libraries.md +171 -0
- package/dist/ai/guides/validation-providers.md +113 -0
- package/dist/ai/index.md +45 -44
- package/dist/ai/recipes/inertia/approvals-inbox.md +26 -10
- package/dist/ai/recipes/inertia/command-palette.md +2 -2
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +46 -30
- package/dist/ai/recipes/inertia/layout-scaffold.md +6 -2
- package/dist/ai/recipes/inertia/onboarding.md +30 -8
- package/dist/ai/recipes/inertia/ownership-atlas.md +72 -49
- package/dist/ai/recipes/inertia/record-form.md +53 -19
- package/dist/ai/recipes/inertia/records-workspace.md +201 -49
- package/dist/ai/recipes/inertia/settings-workspace.md +3809 -0
- package/dist/ai/recipes/inertia/upload-center.md +54 -43
- package/dist/ai/recipes/inertia/wizard-form.md +98 -14
- package/dist/ai/recipes/nuxt/approvals-inbox.md +26 -10
- package/dist/ai/recipes/nuxt/command-palette.md +2 -2
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +68 -52
- package/dist/ai/recipes/nuxt/layout-scaffold.md +6 -2
- package/dist/ai/recipes/nuxt/onboarding.md +30 -8
- package/dist/ai/recipes/nuxt/record-form.md +66 -22
- package/dist/ai/recipes/nuxt/records-workspace.md +199 -48
- package/dist/ai/recipes/nuxt/settings-workspace.md +3898 -0
- package/dist/ai/recipes/nuxt/upload-center.md +52 -41
- package/dist/ai/recipes/nuxt/wizard-form.md +98 -14
- package/dist/ai/recipes/vue/approvals-inbox.md +28 -12
- package/dist/ai/recipes/vue/command-palette.md +2 -2
- package/dist/ai/recipes/vue/inline-edit-workspace.md +69 -53
- package/dist/ai/recipes/vue/layout-scaffold.md +6 -2
- package/dist/ai/recipes/vue/onboarding.md +32 -8
- package/dist/ai/recipes/vue/record-form.md +81 -54
- package/dist/ai/recipes/vue/records-workspace.md +198 -49
- package/dist/ai/recipes/vue/settings-workspace.md +3836 -0
- package/dist/ai/recipes/vue/upload-center.md +53 -42
- package/dist/ai/recipes/vue/wizard-form.md +97 -14
- package/dist/ai/source/BbAccordion.md +90 -24
- package/dist/ai/source/BbAlert.md +209 -62
- package/dist/ai/source/BbAsterisk.md +54 -4
- package/dist/ai/source/BbAvatar.md +73 -16
- package/dist/ai/source/BbBadge.md +265 -97
- package/dist/ai/source/BbBadgeButton.md +218 -79
- package/dist/ai/source/BbBaseButton.md +108 -12
- package/dist/ai/source/BbBaseCheckboxIcon.md +151 -36
- package/dist/ai/source/BbBaseRadioIcon.md +121 -17
- package/dist/ai/source/BbBaseSwitchIcon.md +138 -28
- package/dist/ai/source/BbBreadcrumbs.md +363 -69
- package/dist/ai/source/BbButton.md +563 -174
- package/dist/ai/source/BbCalendar.md +1744 -0
- package/dist/ai/source/BbCheckbox.md +470 -68
- package/dist/ai/source/BbCheckboxGroup.md +976 -95
- package/dist/ai/source/BbCollapsible.md +96 -8
- package/dist/ai/source/BbColorInput.md +597 -67
- package/dist/ai/source/BbColorPalette.md +1284 -65
- package/dist/ai/source/BbConfirm.md +149 -7
- package/dist/ai/source/BbConfirmPortal.md +89 -3
- package/dist/ai/source/BbDatePicker.md +527 -381
- package/dist/ai/source/BbDatePickerInput.md +2015 -118
- package/dist/ai/source/BbDialog.md +531 -64
- package/dist/ai/source/BbDropdown.md +885 -175
- package/dist/ai/source/BbDropdownButton.md +377 -79
- package/dist/ai/source/BbDropdownGroup.md +687 -96
- package/dist/ai/source/BbDropzone.md +140 -31
- package/dist/ai/source/BbForm.md +875 -17
- package/dist/ai/source/BbIcon.md +130 -52
- package/dist/ai/source/BbIndicator.md +117 -60
- package/dist/ai/source/BbNumberInput.md +667 -84
- package/dist/ai/source/BbOffCanvas.md +1007 -261
- package/dist/ai/source/BbPagination.md +203 -31
- package/dist/ai/source/BbPopover.md +267 -90
- package/dist/ai/source/BbProgress.md +88 -26
- package/dist/ai/source/BbPtScope.md +54 -0
- package/dist/ai/source/BbRadio.md +388 -58
- package/dist/ai/source/BbRadioGroup.md +940 -109
- package/dist/ai/source/BbRating.md +736 -84
- package/dist/ai/source/BbSelect.md +1096 -96
- package/dist/ai/source/BbSelectPopover.md +807 -114
- package/dist/ai/source/BbSlider.md +1390 -98
- package/dist/ai/source/BbSmoothHeight.md +48 -2
- package/dist/ai/source/BbSpinner.md +62 -6
- package/dist/ai/source/BbSwitch.md +297 -60
- package/dist/ai/source/BbSwitchGroup.md +761 -83
- package/dist/ai/source/BbTable.md +6950 -1864
- package/dist/ai/source/BbTabs.md +368 -111
- package/dist/ai/source/BbTabsList.md +503 -146
- package/dist/ai/source/BbTabsPanels.md +625 -0
- package/dist/ai/source/BbTabsRoot.md +319 -100
- package/dist/ai/source/BbTag.md +796 -87
- package/dist/ai/source/BbTextInput.md +497 -68
- package/dist/ai/source/BbTextarea.md +550 -65
- package/dist/ai/source/BbTimePicker.md +395 -69
- package/dist/ai/source/BbTimePickerInput.md +1233 -106
- package/dist/ai/source/BbToast.md +250 -74
- package/dist/ai/source/BbToastPortal.md +210 -66
- package/dist/ai/source/BbTooltip.md +181 -30
- package/dist/ai/source/BbTree.md +76 -11
- package/dist/ai/source/ChipsBox.md +25 -5
- package/dist/ai/source/CommaBox.md +21 -6
- package/dist/ai/source/{BbBaseInputContainer.md → CommonField.md} +467 -250
- package/dist/ai/source/CommonFieldInput.md +848 -0
- package/dist/ai/source/CommonPopover.md +116 -30
- package/dist/ai/source/CommonTimeSelector.md +726 -0
- package/dist/ai/source/ErrorIcon.md +2 -2
- package/dist/ai/source/FlatListBox.md +188 -17
- package/dist/ai/source/GroupedListBox.md +236 -44
- package/dist/ai/source/GuidesComponent.md +14 -7
- package/dist/ai/source/ListBox.md +46 -8
- package/dist/ai/source/OptionsContainer.md +288 -60
- package/dist/ai/source/WarningIcon.md +2 -2
- package/dist/assets/css/reset.css_inline.js +1 -1
- package/dist/assets/svgs/star.svg_raw.js +4 -0
- package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +49 -32
- package/dist/components/BbAccordion/types.d.ts +35 -3
- package/dist/components/BbAccordion/types.js +11 -0
- package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +46 -30
- package/dist/components/BbAlert/types.d.ts +37 -3
- package/dist/components/BbAlert/types.js +13 -0
- package/dist/components/BbAsterisk/BbAsterisk.vue.d.ts +3 -1
- package/dist/components/BbAsterisk/BbAsterisk.vue_vue_type_script_setup_true_lang.js +23 -8
- package/dist/components/BbAsterisk/types.d.ts +18 -0
- package/dist/components/BbAsterisk/types.js +7 -0
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +1 -1
- package/dist/components/BbAvatar/BbAvatar.vue_vue_type_script_setup_true_lang.js +57 -44
- package/dist/components/BbAvatar/types.d.ts +23 -0
- package/dist/components/BbAvatar/types.js +7 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +24 -18
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +96 -53
- package/dist/components/BbBadge/BbBadgeButton.vue_vue_type_script_setup_true_lang.js +27 -8
- package/dist/components/BbBadge/badgeButtonContext.d.ts +25 -8
- package/dist/components/BbBadge/types.d.ts +46 -3
- package/dist/components/BbBadge/types.js +13 -0
- package/dist/components/BbBaseButton/BbBaseButton.vue_vue_type_script_setup_true_lang.js +109 -96
- package/dist/components/BbBaseButton/RouterComponent.vue_vue_type_script_setup_true_lang.js +11 -11
- package/dist/components/BbBaseButton/types.d.ts +33 -3
- package/dist/components/BbBaseButton/types.js +9 -2
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue_vue_type_script_setup_true_lang.js +50 -18
- package/dist/components/BbBaseCheckboxIcon/types.d.ts +31 -2
- package/dist/components/BbBaseCheckboxIcon/types.js +8 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue_vue_type_script_setup_true_lang.js +45 -15
- package/dist/components/BbBaseRadioIcon/types.d.ts +31 -2
- package/dist/components/BbBaseRadioIcon/types.js +8 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue_vue_type_script_setup_true_lang.js +48 -16
- package/dist/components/BbBaseSwitchIcon/types.d.ts +31 -2
- package/dist/components/BbBaseSwitchIcon/types.js +8 -0
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +187 -132
- package/dist/components/BbBreadcrumbs/types.d.ts +45 -3
- package/dist/components/BbBreadcrumbs/types.js +12 -0
- package/dist/components/BbButton/BbButton.vue.d.ts +5 -0
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +107 -81
- package/dist/components/BbButton/types.d.ts +113 -2
- package/dist/components/BbButton/types.js +12 -0
- package/dist/components/BbCalendar/BbCalendar.vue.d.ts +34 -0
- package/dist/components/BbCalendar/BbCalendar.vue.js +6 -0
- package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +608 -0
- package/dist/components/BbCalendar/CalendarMonthPanel.vue.js +5 -0
- package/dist/components/BbCalendar/CalendarMonthPanel.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/components/BbCalendar/CalendarYearPanel.vue.js +5 -0
- package/dist/components/BbCalendar/CalendarYearPanel.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/components/BbCalendar/calendarHost.d.ts +29 -0
- package/dist/components/BbCalendar/calendarHost.js +10 -0
- package/dist/components/BbCalendar/types.d.ts +225 -0
- package/dist/components/BbCalendar/types.js +29 -0
- package/dist/components/{BbBaseDatePicker/useDatePickerContext.d.ts → BbCalendar/useCalendarContext.d.ts} +10 -7
- package/dist/components/BbCalendar/useCalendarContext.js +11 -0
- package/dist/components/BbCalendar/useCalendarGrid.d.ts +208 -0
- package/dist/components/BbCalendar/useCalendarGrid.js +274 -0
- package/dist/components/BbCalendar/useDayGrid.d.ts +79 -0
- package/dist/components/BbCalendar/useDayGrid.js +204 -0
- package/dist/components/BbCalendar/useToday.d.ts +23 -0
- package/dist/components/BbCalendar/useToday.js +21 -0
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +7 -7
- package/dist/components/BbCheckbox/BbCheckbox.vue_vue_type_script_setup_true_lang.js +214 -72
- package/dist/components/BbCheckbox/types.d.ts +180 -13
- package/dist/components/BbCheckbox/types.js +8 -0
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +15 -3
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +338 -90
- package/dist/components/BbCheckboxGroup/types.d.ts +195 -20
- package/dist/components/BbCheckboxGroup/types.js +10 -0
- package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +2 -1
- package/dist/components/BbCollapsible/BbCollapsible.vue_vue_type_script_setup_true_lang.js +41 -19
- package/dist/components/BbCollapsible/types.d.ts +44 -1
- package/dist/components/BbCollapsible/types.js +7 -0
- package/dist/components/BbColorInput/BbColorInput.vue.d.ts +17 -7
- package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +330 -86
- package/dist/components/BbColorInput/types.d.ts +230 -12
- package/dist/components/BbColorInput/types.js +24 -0
- package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +10 -2
- package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +515 -108
- package/dist/components/BbColorPalette/types.d.ts +76 -7
- package/dist/components/BbColorPalette/types.js +12 -0
- package/dist/components/BbConfirm/BbConfirm.vue.d.ts +2 -1
- package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +125 -76
- package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +1 -0
- package/dist/components/BbConfirm/types.d.ts +49 -0
- package/dist/components/BbConfirm/types.js +17 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +16 -10
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +320 -223
- package/dist/components/BbDatePicker/types.d.ts +111 -17
- package/dist/components/BbDatePicker/types.js +33 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +16 -4
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +1172 -87
- package/dist/components/BbDatePickerInput/types.d.ts +224 -19
- package/dist/components/BbDatePickerInput/types.js +39 -0
- package/dist/components/BbDialog/BbDialog.vue.d.ts +3 -3
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +227 -136
- package/dist/components/BbDialog/types.d.ts +92 -3
- package/dist/components/BbDialog/types.js +16 -0
- package/dist/components/BbDialog/useDialogStack.d.ts +12 -0
- package/dist/components/BbDialog/useDialogStack.js +9 -2
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +2 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +108 -96
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +10 -2
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +337 -268
- package/dist/components/BbDropdown/BbDropdownGroup.vue.d.ts +5 -1
- package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +8 -2
- package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +377 -293
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +129 -118
- package/dist/components/BbDropdown/normalizeGroups.js +55 -31
- package/dist/components/BbDropdown/types.d.ts +288 -30
- package/dist/components/BbDropdown/types.js +21 -2
- package/dist/components/BbDropdown/useDropdownContext.d.ts +10 -4
- package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +1 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +18 -3
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +172 -40
- package/dist/components/BbDropdownButton/types.d.ts +137 -8
- package/dist/components/BbDropdownButton/types.js +35 -0
- package/dist/components/BbDropzone/BbDropzone.vue.d.ts +2 -2
- package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +186 -144
- package/dist/components/BbDropzone/types.d.ts +38 -4
- package/dist/components/BbDropzone/types.js +16 -0
- package/dist/components/BbForm/BbForm.vue.d.ts +94 -0
- package/dist/{validated → components/BbForm}/BbForm.vue.js +1 -1
- package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +317 -0
- package/dist/components/BbForm/BbFormCustomField.d.ts +14 -0
- package/dist/components/BbForm/BbFormCustomField.js +43 -0
- package/dist/components/BbForm/bindFormField.d.ts +16 -0
- package/dist/components/BbForm/bindFormField.js +85 -0
- package/dist/components/BbForm/formFields.d.ts +64 -0
- package/dist/components/BbForm/formFields.js +11 -0
- package/dist/components/BbForm/formSchema.d.ts +56 -0
- package/dist/components/BbForm/formSchema.js +196 -0
- package/dist/components/BbForm/standardSchema.d.ts +59 -0
- package/dist/components/BbIcon/BbIcon.vue_vue_type_script_setup_true_lang.js +58 -48
- package/dist/components/BbIcon/iconCache.d.ts +63 -0
- package/dist/components/BbIcon/iconCache.js +35 -0
- package/dist/components/BbIcon/types.d.ts +22 -2
- package/dist/components/BbIcon/types.js +7 -0
- package/dist/components/BbIndicator/BbIndicator.vue_vue_type_script_setup_true_lang.js +34 -21
- package/dist/components/BbIndicator/types.d.ts +24 -0
- package/dist/components/BbIndicator/types.js +7 -0
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +12 -8
- package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +308 -85
- package/dist/components/BbNumberInput/types.d.ts +201 -18
- package/dist/components/BbNumberInput/types.js +8 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +3 -3
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +311 -210
- package/dist/components/BbOffCanvas/types.d.ts +79 -6
- package/dist/components/BbOffCanvas/types.js +15 -0
- package/dist/components/BbPagination/BbPagination.vue.d.ts +2 -2
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +125 -90
- package/dist/components/BbPagination/types.d.ts +38 -0
- package/dist/components/BbPagination/types.js +13 -0
- package/dist/components/BbPopover/BbPopover.vue.d.ts +4 -4
- package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +219 -179
- package/dist/components/BbPopover/types.d.ts +51 -5
- package/dist/components/BbPopover/types.js +14 -0
- package/dist/components/BbProgress/BbProgress.vue_vue_type_script_setup_true_lang.js +29 -16
- package/dist/components/BbProgress/types.d.ts +25 -0
- package/dist/components/BbProgress/types.js +7 -0
- package/dist/components/BbPtScope/BbPtScope.vue.d.ts +12 -0
- package/dist/components/BbPtScope/BbPtScope.vue.js +5 -0
- package/dist/components/BbPtScope/BbPtScope.vue_vue_type_script_setup_true_lang.js +13 -0
- package/dist/components/BbPtScope/types.d.ts +15 -0
- package/dist/components/BbRadio/BbRadio.vue.d.ts +7 -7
- package/dist/components/BbRadio/BbRadio.vue_vue_type_script_setup_true_lang.js +172 -59
- package/dist/components/BbRadio/types.d.ts +152 -13
- package/dist/components/BbRadio/types.js +8 -0
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +14 -2
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +319 -92
- package/dist/components/BbRadioGroup/types.d.ts +198 -22
- package/dist/components/BbRadioGroup/types.js +10 -0
- package/dist/components/BbRating/BbRating.vue.d.ts +10 -8
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +259 -78
- package/dist/components/BbRating/types.d.ts +174 -13
- package/dist/components/BbRating/types.js +21 -0
- package/dist/components/BbSelect/BbSelect.vue.d.ts +17 -3
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +553 -83
- package/dist/components/BbSelect/types.d.ts +235 -20
- package/dist/components/BbSelect/types.js +41 -0
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +15 -1
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +541 -391
- package/dist/components/BbSelectPopover/types.d.ts +124 -8
- package/dist/components/BbSelectPopover/types.js +24 -0
- package/dist/components/BbSlider/BbSlider.vue.d.ts +13 -8
- package/dist/components/BbSlider/BbSlider.vue_vue_type_script_setup_true_lang.js +472 -96
- package/dist/components/BbSlider/types.d.ts +202 -13
- package/dist/components/BbSlider/types.js +26 -0
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +1 -1
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue_vue_type_script_setup_true_lang.js +60 -48
- package/dist/components/BbSmoothHeight/types.d.ts +19 -0
- package/dist/components/BbSmoothHeight/types.js +7 -0
- package/dist/components/BbSpinner/BbSpinner.vue_vue_type_script_setup_true_lang.js +27 -14
- package/dist/components/BbSpinner/types.d.ts +22 -1
- package/dist/components/BbSpinner/types.js +7 -0
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +7 -7
- package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +220 -78
- package/dist/components/BbSwitch/types.d.ts +25 -10
- package/dist/components/BbSwitch/types.js +5 -0
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +14 -2
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +338 -90
- package/dist/components/BbSwitchGroup/types.d.ts +30 -7
- package/dist/components/BbSwitchGroup/types.js +5 -0
- package/dist/components/BbTable/BbTable.vue.d.ts +27 -6
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +2013 -685
- package/dist/components/BbTable/BbTableDataRow.d.ts +196 -0
- package/dist/components/BbTable/BbTableDataRow.js +151 -0
- package/dist/components/BbTable/BbTableExpandRow.d.ts +84 -0
- package/dist/components/BbTable/BbTableExpandRow.js +62 -0
- package/dist/components/BbTable/BbTableSelectToggle.d.ts +120 -0
- package/dist/components/BbTable/BbTableSelectToggle.js +122 -0
- package/dist/components/BbTable/gridWidgets.d.ts +30 -0
- package/dist/components/BbTable/gridWidgets.js +14 -0
- package/dist/components/BbTable/types.d.ts +473 -123
- package/dist/components/BbTable/types.js +31 -0
- package/dist/components/BbTable/utils.d.ts +145 -4
- package/dist/components/BbTable/utils.js +154 -37
- package/dist/components/BbTabs/BbTabs.vue.d.ts +3 -1
- package/dist/components/BbTabs/BbTabs.vue_vue_type_script_setup_true_lang.js +62 -26
- package/dist/components/BbTabs/BbTabsList.vue.d.ts +3 -10
- package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +143 -81
- package/dist/components/BbTabs/BbTabsPanels.vue.d.ts +12 -0
- package/dist/components/{BbBaseSwitch/BbBaseSwitch.vue.js → BbTabs/BbTabsPanels.vue.js} +2 -2
- package/dist/components/BbTabs/BbTabsPanels.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/BbTabs/BbTabsRoot.vue.d.ts +3 -1
- package/dist/components/BbTabs/BbTabsRoot.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/BbTabs/types.d.ts +183 -23
- package/dist/components/BbTabs/types.js +34 -0
- package/dist/components/BbTag/BbTag.vue.d.ts +13 -10
- package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +383 -92
- package/dist/components/BbTag/types.d.ts +139 -14
- package/dist/components/BbTag/types.js +22 -0
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +10 -8
- package/dist/components/BbTextInput/BbTextInput.vue_vue_type_script_setup_true_lang.js +257 -84
- package/dist/components/BbTextInput/types.d.ts +168 -13
- package/dist/components/BbTextInput/types.js +8 -0
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +7 -7
- package/dist/components/BbTextarea/BbTextarea.vue_vue_type_script_setup_true_lang.js +291 -94
- package/dist/components/BbTextarea/types.d.ts +158 -14
- package/dist/components/BbTextarea/types.js +8 -0
- package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +12 -4
- package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +199 -122
- package/dist/components/BbTimePicker/types.d.ts +94 -7
- package/dist/components/BbTimePicker/types.js +18 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +14 -4
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +749 -86
- package/dist/components/BbTimePickerInput/types.d.ts +171 -22
- package/dist/components/BbTimePickerInput/types.js +25 -0
- package/dist/components/BbToast/BbToast.vue_vue_type_script_setup_true_lang.js +63 -25
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +4 -1
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +79 -76
- package/dist/components/BbToast/BbToastPortal.vue.d.ts +1 -0
- package/dist/components/BbToast/BbToastRegion.vue.d.ts +4 -1
- package/dist/components/BbToast/BbToastRegion.vue_vue_type_script_setup_true_lang.js +72 -64
- package/dist/components/BbToast/types.d.ts +54 -1
- package/dist/components/BbToast/types.js +28 -0
- package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +104 -87
- package/dist/components/BbTooltip/types.d.ts +40 -2
- package/dist/components/BbTooltip/types.js +7 -0
- package/dist/components/BbTree/BbTree.vue.d.ts +15 -3
- package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +51 -29
- package/dist/components/BbTree/BbTreeLevel.vue.d.ts +1 -1
- package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +17 -16
- package/dist/components/BbTree/context.d.ts +9 -1
- package/dist/components/BbTree/types.d.ts +40 -5
- package/dist/components/BbTree/types.js +7 -0
- package/dist/components/ChipsBox/ChipsBox.vue_vue_type_script_setup_true_lang.js +46 -44
- package/dist/components/ChipsBox/types.d.ts +7 -0
- package/dist/components/ClearableButton/ClearableButton.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/CommaBox/CommaBox.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/components/CommaBox/types.d.ts +7 -0
- package/dist/components/{BbBaseInputContainer/BbBaseInputContainer.vue.d.ts → CommonField/CommonField.vue.d.ts} +5 -5
- package/dist/components/{BbBaseRadio/BbBaseRadio.vue.js → CommonField/CommonField.vue.js} +2 -2
- package/dist/components/CommonField/CommonField.vue_vue_type_script_setup_true_lang.js +189 -0
- package/dist/components/CommonField/messageHeightMatrix.d.ts +2 -0
- package/dist/components/{BbBaseInputContainer → CommonField}/types.d.ts +52 -16
- package/dist/components/{CommonInputWrapper/CommonInputWrapper.vue.d.ts → CommonFieldInput/CommonFieldInput.vue.d.ts} +5 -4
- package/dist/components/{BbBaseRadioGroup/BbBaseRadioGroup.vue.js → CommonFieldInput/CommonFieldInput.vue.js} +2 -2
- package/dist/components/CommonFieldInput/CommonFieldInput.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/CommonFieldInput/boxBorderMatrix.d.ts +10 -0
- package/dist/components/{CommonInputWrapper → CommonFieldInput}/types.d.ts +27 -8
- package/dist/components/CommonPopover/CommonPopover.vue.d.ts +11 -2
- package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +76 -63
- package/dist/components/CommonPopover/types.d.ts +27 -8
- package/dist/components/{BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.d.ts → CommonTimeSelector/CommonTimeSelector.vue.d.ts} +21 -2
- package/dist/components/{BbBaseColorPalette/BbBaseColorPalette.vue.js → CommonTimeSelector/CommonTimeSelector.vue.js} +2 -2
- package/dist/components/CommonTimeSelector/CommonTimeSelector.vue_vue_type_script_setup_true_lang.js +232 -0
- package/dist/components/CommonTimeSelector/types.d.ts +6 -0
- package/dist/components/FlatListBox/FlatListBox.vue.d.ts +5 -1
- package/dist/components/FlatListBox/FlatListBox.vue_vue_type_script_setup_true_lang.js +165 -95
- package/dist/components/FlatListBox/types.d.ts +24 -2
- package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +5 -1
- package/dist/components/GroupedListBox/GroupedListBox.vue_vue_type_script_setup_true_lang.js +217 -134
- package/dist/components/GroupedListBox/types.d.ts +24 -2
- package/dist/components/ListBox/ListBox.vue.d.ts +5 -1
- package/dist/components/ListBox/ListBox.vue_vue_type_script_setup_true_lang.js +95 -69
- package/dist/components/ListBox/types.d.ts +24 -2
- package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +1 -1
- package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +109 -37
- package/dist/components/OptionsContainer/types.d.ts +53 -9
- package/dist/components/Transitions/ScaleFade.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/Transitions/Slide.vue.js +1 -1
- package/dist/composables/useBaseOptions.d.ts +12 -1
- package/dist/composables/useBaseOptions.js +77 -37
- package/dist/composables/useBbConfig.d.ts +27 -6
- package/dist/composables/useBbConfig.js +8 -2
- package/dist/composables/useBbDropdownContext.d.ts +5 -0
- package/dist/composables/useBbFormContext.d.ts +131 -8
- package/dist/composables/useBbFormContext.js +49 -30
- package/dist/composables/useBbFormField.d.ts +40 -0
- package/dist/composables/useBbFormField.js +39 -0
- package/dist/composables/useBbTableContext.d.ts +45 -1
- package/dist/composables/useBbTableContext.js +93 -87
- package/dist/composables/useBbTabsContext.d.ts +15 -9
- package/dist/composables/useBbTabsContext.js +121 -90
- package/dist/composables/useClosingInert.d.ts +4 -4
- package/dist/composables/useCoarsePointer.js +7 -10
- package/dist/composables/useCoherence.js +1 -1
- package/dist/composables/useConfig.d.ts +59 -0
- package/dist/composables/useConfig.js +15 -0
- package/dist/composables/useConfirm.d.ts +39 -7
- package/dist/composables/useConfirm.js +50 -41
- package/dist/composables/useEscapeStackEntry.d.ts +13 -0
- package/dist/composables/useEscapeStackEntry.js +16 -0
- package/dist/composables/useFormBinding.d.ts +116 -0
- package/dist/composables/useFormBinding.js +34 -0
- package/dist/composables/useHydrated.d.ts +18 -0
- package/dist/composables/useHydrated.js +13 -7
- package/dist/composables/useId.d.ts +4 -3
- package/dist/composables/useId.js +1 -7
- package/dist/composables/useItemsGetter.d.ts +11 -0
- package/dist/composables/useItemsGetter.js +44 -18
- package/dist/composables/useKeyboardInset.d.ts +28 -0
- package/dist/composables/useKeyboardInset.js +32 -0
- package/dist/composables/useLocale.js +10 -7
- package/dist/composables/useMobile.js +7 -10
- package/dist/composables/usePassthrough.d.ts +228 -0
- package/dist/composables/usePassthrough.js +247 -0
- package/dist/composables/usePrefill.d.ts +22 -2
- package/dist/composables/usePrefill.js +35 -19
- package/dist/composables/useSafeAreaInternal.js +1 -1
- package/dist/composables/useSegmentedFields.d.ts +2 -2
- package/dist/composables/useSsrState.d.ts +20 -0
- package/dist/composables/useSsrState.js +13 -0
- package/dist/composables/useTableWidthContext.d.ts +24 -4
- package/dist/composables/useTableWidthContext.js +31 -28
- package/dist/composables/useToast.d.ts +18 -1
- package/dist/composables/useToast.js +31 -18
- package/dist/composables/useToggleInput.d.ts +44 -0
- package/dist/composables/useToggleInput.js +39 -0
- package/dist/composables/useViewportWidth.d.ts +5 -25
- package/dist/composables/useViewportWidth.js +14 -7
- package/dist/deprecation/ai-deprecations.json.d.ts +1977 -289
- package/dist/deprecation/ai-deprecations.json.js +1 -1
- package/dist/deprecation/removedProps.js +9 -4
- package/dist/directives/bbDropdown.d.ts +15 -4
- package/dist/directives/bbDropdown.js +31 -9
- package/dist/directives/bbTooltip.d.ts +6 -0
- package/dist/directives/createPopoverDirective.d.ts +62 -0
- package/dist/directives/createPopoverDirective.js +92 -37
- package/dist/i18n/index.d.ts +10 -16
- package/dist/i18n/locales/cs.json +9 -5
- package/dist/i18n/locales/da.json +9 -5
- package/dist/i18n/locales/de.json +9 -5
- package/dist/i18n/locales/el.json +9 -5
- package/dist/i18n/locales/en.json +9 -5
- package/dist/i18n/locales/es.json +9 -5
- package/dist/i18n/locales/fi.json +9 -5
- package/dist/i18n/locales/fr.json +9 -5
- package/dist/i18n/locales/hu.json +9 -5
- package/dist/i18n/locales/it.json +9 -5
- package/dist/i18n/locales/ja.json +9 -5
- package/dist/i18n/locales/ko.json +9 -5
- package/dist/i18n/locales/nb.json +9 -5
- package/dist/i18n/locales/nl.json +9 -5
- package/dist/i18n/locales/pl.json +9 -5
- package/dist/i18n/locales/pt.json +9 -5
- package/dist/i18n/locales/ro.json +9 -5
- package/dist/i18n/locales/ru.json +9 -5
- package/dist/i18n/locales/sv.json +9 -5
- package/dist/i18n/locales/tr.json +9 -5
- package/dist/i18n/locales/uk.json +9 -5
- package/dist/i18n/locales/zh-cn.json +9 -5
- package/dist/icon-scan.d.ts +276 -0
- package/dist/icon-scan.js +485 -0
- package/dist/icons-whitelist.d.ts +5 -4
- package/dist/index.d.ts +40 -21
- package/dist/index.js +78 -71
- package/dist/llms-full.txt +61164 -27972
- package/dist/llms-medium.txt +1482 -366
- package/dist/llms.txt +32 -15
- package/dist/locale-blueprint.json +9 -5
- package/dist/nuxt-auto-imports.d.ts +76 -0
- package/dist/nuxt-auto-imports.js +32 -0
- package/dist/nuxt-module.d.ts +30 -15
- package/dist/nuxt.js +35 -9
- package/dist/passthrough-deduper.js +5 -0
- package/dist/plugin.d.ts +10 -1
- package/dist/plugin.js +29 -19
- package/dist/project-dts.d.ts +84 -0
- package/dist/project-dts.js +170 -0
- package/dist/reset.css +1 -1
- package/dist/runtime/nuxt-plugin.js +34 -21
- package/dist/styles.css +3 -2
- package/dist/types/AlertVariant.d.ts +10 -1
- package/dist/types/BadgeVariant.d.ts +16 -5
- package/dist/types/ButtonVariant.d.ts +12 -1
- package/dist/types/ColumnName.d.ts +30 -3
- package/dist/types/CommonProps.d.ts +2 -2
- package/dist/types/Config.d.ts +94 -1
- package/dist/types/ConfirmVariant.d.ts +8 -1
- package/dist/types/DropdownItemVariant.d.ts +8 -1
- package/dist/types/FieldLayout.d.ts +32 -0
- package/dist/types/IndicatorVariant.d.ts +11 -1
- package/dist/types/InputVariant.d.ts +30 -0
- package/dist/types/ItemProps.d.ts +50 -0
- package/dist/types/Option.d.ts +6 -0
- package/dist/types/PtScope.d.ts +15 -0
- package/dist/types/RegistryKey.d.ts +10 -0
- package/dist/types/TabsVariant.d.ts +25 -0
- package/dist/types/ToastVariant.d.ts +12 -2
- package/dist/types/TooltipVariant.d.ts +8 -1
- package/dist/types/passthrough.d.ts +362 -0
- package/dist/types/passthrough.js +78 -0
- package/dist/types/ptComponentMap.d.ts +62 -0
- package/dist/utilities/functions/hasVnodeListener.d.ts +16 -0
- package/dist/utilities/functions/hasVnodeListener.js +12 -0
- package/dist/utilities/functions/isImeComposing.d.ts +7 -0
- package/dist/utilities/functions/isImeComposing.js +4 -0
- package/dist/utilities/functions/itemProps.d.ts +46 -0
- package/dist/utilities/functions/itemProps.js +47 -0
- package/dist/utilities/functions/slotKey.d.ts +13 -8
- package/dist/utilities/functions/slotKey.js +78 -2
- package/dist/utilities/functions/snapToStep.js +2 -1
- package/dist/utilities/functions/toggleInput.d.ts +98 -0
- package/dist/utilities/functions/toggleInput.js +56 -0
- package/dist/utilities/functions/warnRemovedAttrs.d.ts +27 -1
- package/dist/utilities/functions/warnRemovedAttrs.js +75 -14
- package/dist/utilities/misc/listboxMetrics.d.ts +9 -3
- package/dist/utilities/misc/listboxMetrics.js +5 -2
- package/dist/utilities/misc/ssrStateInjectionKey.d.ts +42 -0
- package/dist/utilities/misc/ssrStateInjectionKey.js +4 -0
- package/dist/utils/cssLayers.d.ts +91 -0
- package/dist/utils/cssLayers.js +43 -0
- package/dist/utils/injectLibraryStyles.d.ts +3 -1
- package/dist/utils/injectLibraryStyles.js +24 -23
- package/dist/utils/overlayEscapeStack.d.ts +10 -0
- package/dist/utils/overlayEscapeStack.js +5 -3
- package/dist/utils/passthrough.d.ts +67 -0
- package/dist/utils/passthrough.js +100 -0
- package/dist/utils/passthroughDeduper.d.ts +2 -0
- package/dist/utils/ptScope.d.ts +8 -0
- package/dist/utils/ptScope.js +4 -0
- package/dist/utils/versionCheck.d.ts +19 -0
- package/dist/utils/versionCheck.js +18 -0
- package/dist/vite-plugin.d.ts +301 -53
- package/dist/vite.js +547 -375
- package/llms.txt +33 -16
- package/package.json +49 -27
- package/scripts/lib/check-fix.mjs +129 -0
- package/scripts/lib/component-attr-targets.ts +123 -0
- package/scripts/lib/component-tree.ts +648 -0
- package/scripts/lib/css-class-check.mjs +326 -0
- package/scripts/lib/css-class-surface.mjs +292 -0
- package/scripts/lib/css-color-resolve.mjs +172 -0
- package/scripts/lib/css-local-check.mjs +267 -0
- package/scripts/lib/design-token-manifest.mjs +499 -0
- package/scripts/lib/doc-sections.mjs +248 -0
- package/scripts/lib/ensure-manifest.mjs +28 -5
- package/scripts/lib/eslint-disable.mjs +141 -0
- package/scripts/lib/eslint-plugin.d.ts +64 -1
- package/scripts/lib/eslint-plugin.mjs +1285 -30
- package/scripts/lib/hand-imported-styles.mjs +326 -0
- package/scripts/lib/hand-roll-hints.mjs +50 -6
- package/scripts/lib/html-attributes.mjs +353 -0
- package/scripts/lib/local-components.mjs +177 -0
- package/scripts/lib/mcp-config.mjs +87 -58
- package/scripts/lib/migrate-fix.mjs +62 -3
- package/scripts/lib/project-variant-dts.mjs +122 -0
- package/scripts/lib/public-type-exports.mjs +273 -0
- package/scripts/lib/slot-key.mjs +147 -0
- package/scripts/lib/slot-renames.mjs +46 -0
- package/scripts/lib/squashed-slot-words.mjs +133 -0
- package/scripts/lib/validate-bb-markup.mjs +2213 -76
- package/scripts/lib/wrapper-props.mjs +188 -0
- package/dist/ai/BbBaseCheckbox.md +0 -49
- package/dist/ai/BbBaseCheckboxGroup.md +0 -64
- package/dist/ai/BbBaseColorInput.md +0 -65
- package/dist/ai/BbBaseColorPalette.md +0 -39
- package/dist/ai/BbBaseDatePicker.md +0 -43
- package/dist/ai/BbBaseDatePickerInput.md +0 -73
- package/dist/ai/BbBaseInputContainer.md +0 -48
- package/dist/ai/BbBaseNumberInput.md +0 -71
- package/dist/ai/BbBaseRadio.md +0 -46
- package/dist/ai/BbBaseRadioGroup.md +0 -64
- package/dist/ai/BbBaseRating.md +0 -52
- package/dist/ai/BbBaseSelect.md +0 -88
- package/dist/ai/BbBaseSlider.md +0 -56
- package/dist/ai/BbBaseSwitch.md +0 -49
- package/dist/ai/BbBaseSwitchGroup.md +0 -64
- package/dist/ai/BbBaseTag.md +0 -68
- package/dist/ai/BbBaseTextInput.md +0 -75
- package/dist/ai/BbBaseTextarea.md +0 -62
- package/dist/ai/BbBaseTimePickerInput.md +0 -62
- package/dist/ai/BbTabsPanes.md +0 -27
- package/dist/ai/CommonInputWrapper.md +0 -42
- package/dist/ai/source/BbBaseCheckbox.md +0 -461
- package/dist/ai/source/BbBaseCheckboxGroup.md +0 -554
- package/dist/ai/source/BbBaseColorInput.md +0 -431
- package/dist/ai/source/BbBaseColorPalette.md +0 -942
- package/dist/ai/source/BbBaseDatePicker.md +0 -1448
- package/dist/ai/source/BbBaseDatePickerInput.md +0 -1940
- package/dist/ai/source/BbBaseNumberInput.md +0 -617
- package/dist/ai/source/BbBaseRadio.md +0 -381
- package/dist/ai/source/BbBaseRadioGroup.md +0 -539
- package/dist/ai/source/BbBaseRating.md +0 -607
- package/dist/ai/source/BbBaseSelect.md +0 -945
- package/dist/ai/source/BbBaseSlider.md +0 -1144
- package/dist/ai/source/BbBaseSwitch.md +0 -246
- package/dist/ai/source/BbBaseSwitchGroup.md +0 -302
- package/dist/ai/source/BbBaseTag.md +0 -694
- package/dist/ai/source/BbBaseTextInput.md +0 -511
- package/dist/ai/source/BbBaseTextarea.md +0 -504
- package/dist/ai/source/BbBaseTimePickerInput.md +0 -1037
- package/dist/ai/source/BbTabsPanes.md +0 -377
- package/dist/ai/source/CommonInputWrapper.md +0 -584
- package/dist/alert-variants.d.ts +0 -19
- package/dist/assets/svgs/sort.svg_raw.js +0 -4
- package/dist/badge-variants.d.ts +0 -19
- package/dist/button-variants.d.ts +0 -21
- package/dist/components/BbBadge/BadgeAppendIcon.vue.d.ts +0 -3
- package/dist/components/BbBadge/BadgeAppendIcon.vue.js +0 -5
- package/dist/components/BbBadge/BadgeAppendIcon.vue_vue_type_script_setup_true_lang.js +0 -22
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.d.ts +0 -40
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.js +0 -6
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue_vue_type_script_setup_true_lang.js +0 -145
- package/dist/components/BbBaseCheckbox/types.d.ts +0 -224
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.d.ts +0 -19
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.js +0 -6
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue_vue_type_script_setup_true_lang.js +0 -190
- package/dist/components/BbBaseCheckboxGroup/types.d.ts +0 -257
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.d.ts +0 -43
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.js +0 -6
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue_vue_type_script_setup_true_lang.js +0 -184
- package/dist/components/BbBaseColorInput/types.d.ts +0 -219
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue.d.ts +0 -13
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue_vue_type_script_setup_true_lang.js +0 -395
- package/dist/components/BbBaseColorPalette/types.d.ts +0 -40
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue.d.ts +0 -20
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue.js +0 -6
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue_vue_type_script_setup_true_lang.js +0 -407
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.d.ts +0 -47
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.js +0 -5
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue_vue_type_script_setup_true_lang.js +0 -318
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.js +0 -5
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue_vue_type_script_setup_true_lang.js +0 -115
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.js +0 -5
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue_vue_type_script_setup_true_lang.js +0 -116
- package/dist/components/BbBaseDatePicker/types.d.ts +0 -108
- package/dist/components/BbBaseDatePicker/useDatePickerContext.js +0 -11
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.d.ts +0 -31
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.js +0 -6
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue_vue_type_script_setup_true_lang.js +0 -737
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.js +0 -6
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue_vue_type_script_setup_true_lang.js +0 -204
- package/dist/components/BbBaseDatePickerInput/types.d.ts +0 -325
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.js +0 -6
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue_vue_type_script_setup_true_lang.js +0 -190
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.d.ts +0 -52
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.js +0 -6
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue_vue_type_script_setup_true_lang.js +0 -215
- package/dist/components/BbBaseNumberInput/types.d.ts +0 -211
- package/dist/components/BbBaseRadio/BbBaseRadio.vue.d.ts +0 -33
- package/dist/components/BbBaseRadio/BbBaseRadio.vue_vue_type_script_setup_true_lang.js +0 -113
- package/dist/components/BbBaseRadio/types.d.ts +0 -179
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue.d.ts +0 -19
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue_vue_type_script_setup_true_lang.js +0 -179
- package/dist/components/BbBaseRadioGroup/types.d.ts +0 -223
- package/dist/components/BbBaseRating/BbBaseRating.vue.d.ts +0 -38
- package/dist/components/BbBaseRating/BbBaseRating.vue.js +0 -6
- package/dist/components/BbBaseRating/BbBaseRating.vue_vue_type_script_setup_true_lang.js +0 -192
- package/dist/components/BbBaseRating/types.d.ts +0 -176
- package/dist/components/BbBaseSelect/BbBaseSelect.vue.d.ts +0 -19
- package/dist/components/BbBaseSelect/BbBaseSelect.vue.js +0 -6
- package/dist/components/BbBaseSelect/BbBaseSelect.vue_vue_type_script_setup_true_lang.js +0 -311
- package/dist/components/BbBaseSelect/types.d.ts +0 -297
- package/dist/components/BbBaseSlider/BbBaseSlider.vue.d.ts +0 -35
- package/dist/components/BbBaseSlider/BbBaseSlider.vue.js +0 -6
- package/dist/components/BbBaseSlider/BbBaseSlider.vue_vue_type_script_setup_true_lang.js +0 -340
- package/dist/components/BbBaseSlider/types.d.ts +0 -200
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue.d.ts +0 -35
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue_vue_type_script_setup_true_lang.js +0 -146
- package/dist/components/BbBaseSwitch/types.d.ts +0 -10
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.d.ts +0 -19
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.js +0 -6
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue_vue_type_script_setup_true_lang.js +0 -190
- package/dist/components/BbBaseSwitchGroup/types.d.ts +0 -8
- package/dist/components/BbBaseTag/BbBaseTag.vue.d.ts +0 -50
- package/dist/components/BbBaseTag/BbBaseTag.vue.js +0 -6
- package/dist/components/BbBaseTag/BbBaseTag.vue_vue_type_script_setup_true_lang.js +0 -266
- package/dist/components/BbBaseTag/types.d.ts +0 -160
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.d.ts +0 -45
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.js +0 -6
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue_vue_type_script_setup_true_lang.js +0 -200
- package/dist/components/BbBaseTextInput/types.d.ts +0 -209
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.d.ts +0 -39
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.js +0 -6
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue_vue_type_script_setup_true_lang.js +0 -187
- package/dist/components/BbBaseTextarea/types.d.ts +0 -170
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.d.ts +0 -27
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.js +0 -6
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue_vue_type_script_setup_true_lang.js +0 -519
- package/dist/components/BbBaseTimePickerInput/types.d.ts +0 -151
- package/dist/components/BbTabs/BbTabsPanes.vue.d.ts +0 -16
- package/dist/components/BbTabs/BbTabsPanes.vue.js +0 -6
- package/dist/components/BbTabs/BbTabsPanes.vue_vue_type_script_setup_true_lang.js +0 -35
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue.js +0 -6
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue_vue_type_script_setup_true_lang.js +0 -107
- package/dist/confirm-variants.d.ts +0 -17
- package/dist/dropdown-item-variants.d.ts +0 -17
- package/dist/indicator-variants.d.ts +0 -20
- package/dist/locale-registry.d.ts +0 -37
- package/dist/toast-variants.d.ts +0 -20
- package/dist/tooltip-variants.d.ts +0 -17
- package/dist/types/InputDirection.d.ts +0 -15
- package/dist/validated/BbCheckbox.vue.d.ts +0 -29
- package/dist/validated/BbCheckbox.vue.js +0 -5
- package/dist/validated/BbCheckbox.vue_vue_type_script_setup_true_lang.js +0 -75
- package/dist/validated/BbCheckboxGroup.vue.d.ts +0 -34
- package/dist/validated/BbCheckboxGroup.vue.js +0 -5
- package/dist/validated/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +0 -82
- package/dist/validated/BbColorInput.vue.d.ts +0 -37
- package/dist/validated/BbColorInput.vue.js +0 -5
- package/dist/validated/BbColorInput.vue_vue_type_script_setup_true_lang.js +0 -75
- package/dist/validated/BbDatePickerInput.vue.d.ts +0 -41
- package/dist/validated/BbDatePickerInput.vue.js +0 -5
- package/dist/validated/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +0 -90
- package/dist/validated/BbDropzone.vue.d.ts +0 -24
- package/dist/validated/BbDropzone.vue.js +0 -5
- package/dist/validated/BbDropzone.vue_vue_type_script_setup_true_lang.js +0 -45
- package/dist/validated/BbForm.vue.d.ts +0 -28
- package/dist/validated/BbForm.vue_vue_type_script_setup_true_lang.js +0 -42
- package/dist/validated/BbNumberInput.vue.d.ts +0 -36
- package/dist/validated/BbNumberInput.vue.js +0 -5
- package/dist/validated/BbNumberInput.vue_vue_type_script_setup_true_lang.js +0 -72
- package/dist/validated/BbRadioGroup.vue.d.ts +0 -34
- package/dist/validated/BbRadioGroup.vue.js +0 -5
- package/dist/validated/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +0 -78
- package/dist/validated/BbRating.vue.d.ts +0 -30
- package/dist/validated/BbRating.vue.js +0 -5
- package/dist/validated/BbRating.vue_vue_type_script_setup_true_lang.js +0 -63
- package/dist/validated/BbSelect.vue.d.ts +0 -46
- package/dist/validated/BbSelect.vue.js +0 -5
- package/dist/validated/BbSelect.vue_vue_type_script_setup_true_lang.js +0 -109
- package/dist/validated/BbSlider.vue.d.ts +0 -36
- package/dist/validated/BbSlider.vue.js +0 -5
- package/dist/validated/BbSlider.vue_vue_type_script_setup_true_lang.js +0 -69
- package/dist/validated/BbSwitch.vue.d.ts +0 -29
- package/dist/validated/BbSwitch.vue.js +0 -5
- package/dist/validated/BbSwitch.vue_vue_type_script_setup_true_lang.js +0 -75
- package/dist/validated/BbSwitchGroup.vue.d.ts +0 -34
- package/dist/validated/BbSwitchGroup.vue.js +0 -5
- package/dist/validated/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +0 -82
- package/dist/validated/BbTag.vue.d.ts +0 -36
- package/dist/validated/BbTag.vue.js +0 -5
- package/dist/validated/BbTag.vue_vue_type_script_setup_true_lang.js +0 -72
- package/dist/validated/BbTextInput.vue.d.ts +0 -36
- package/dist/validated/BbTextInput.vue.js +0 -5
- package/dist/validated/BbTextInput.vue_vue_type_script_setup_true_lang.js +0 -72
- package/dist/validated/BbTextarea.vue.d.ts +0 -36
- package/dist/validated/BbTextarea.vue.js +0 -5
- package/dist/validated/BbTextarea.vue_vue_type_script_setup_true_lang.js +0 -70
- package/dist/validated/BbTimePickerInput.vue.d.ts +0 -37
- package/dist/validated/BbTimePickerInput.vue.js +0 -5
- package/dist/validated/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +0 -81
- package/dist/validated/index.d.ts +0 -43
- package/dist/validated/useValidatedField.d.ts +0 -93
- package/dist/validated/useValidatedField.js +0 -51
- package/dist/validated.js +0 -21
- /package/dist/components/{BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.d.ts → BbCalendar/CalendarMonthPanel.vue.d.ts} +0 -0
- /package/dist/components/{BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.d.ts → BbCalendar/CalendarYearPanel.vue.d.ts} +0 -0
- /package/dist/{components/BbBaseDatePicker/typeahead.d.ts → composables/useTypeahead.d.ts} +0 -0
- /package/dist/{components/BbBaseDatePicker/typeahead.js → composables/useTypeahead.js} +0 -0
package/dist/ai/BbForm.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- Safety level: **Consumer API**
|
|
6
6
|
- Group: **Inputs**
|
|
7
|
-
- Description: Form host for
|
|
7
|
+
- Description: Form host for the form controls inside it: owns the vee-validate form (useForm), validates every field on submit, and emits `submit` with the collected values only when the form is valid. `schema` takes any Standard Schema (Zod, Valibot, ArkType, Yup) as it is; a failed submit focuses the first invalid field on screen and emits `invalid`. Server errors (a 422): `setErrors(errors)` from the slot or `useBbFormContext(id)` puts each on its field.
|
|
8
8
|
- Usage rule: Prefer this component for consumer-facing implementations.
|
|
9
9
|
- Implementation source (only when the contract below is not enough): [source/BbForm.md](./source/BbForm.md)
|
|
10
10
|
|
|
@@ -12,10 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
### When to use
|
|
14
14
|
|
|
15
|
-
`BbForm` is the host
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
its `rules`.
|
|
15
|
+
`BbForm` is the host the form controls join. It calls vee-validate's
|
|
16
|
+
`useForm()` once and every form control inside it (`BbTextInput`, `BbSelect`,
|
|
17
|
+
the groups, the pickers…) binds to it, so a `BbTextInput` inside it needs
|
|
18
|
+
nothing but a `label` (or a `name`) and its `rules`. The same controls outside
|
|
19
|
+
a `BbForm` are plain.
|
|
20
|
+
|
|
21
|
+
It needs the `vee-validate` peer (`npm i vee-validate`); an app without forms
|
|
22
|
+
needs nothing, and a build that uses `BbForm` without it fails with that hint.
|
|
19
23
|
|
|
20
24
|
Reach for it whenever a screen collects input that must be valid before it is
|
|
21
25
|
sent. Do **not** reach for it to lay out a form — it renders a bare `<form>` and
|
|
@@ -23,9 +27,8 @@ nothing else; spacing, columns and section headings stay yours.
|
|
|
23
27
|
|
|
24
28
|
Two things it is not:
|
|
25
29
|
|
|
26
|
-
- **Not needed for unvalidated forms.**
|
|
27
|
-
|
|
28
|
-
the controls you import from `bitboss-ui/validated` participate.
|
|
30
|
+
- **Not needed for unvalidated forms.** Outside a `BbForm` the controls are
|
|
31
|
+
plain, so a plain `<form>` is enough.
|
|
29
32
|
- **Not a submit button.** It has no built-in actions; put your own
|
|
30
33
|
`<BbButton type="submit">` in the slot.
|
|
31
34
|
|
|
@@ -33,6 +36,304 @@ Setup (the peer dependency, defining rules once, the whole control list) lives
|
|
|
33
36
|
in [Validated Forms](./guides/validated-forms.md). This page is only about the
|
|
34
37
|
host.
|
|
35
38
|
|
|
39
|
+
### Which controls join the form
|
|
40
|
+
|
|
41
|
+
Every form control inside a `BbForm` joins it, keyed by its `name` (read as a
|
|
42
|
+
path: `address[city]` → `address.city`), else by its label slugged. Its value is
|
|
43
|
+
submitted, counts toward `dirty`, is reset and is validated if it has rules.
|
|
44
|
+
|
|
45
|
+
- **`formless`** keeps a control out entirely: not submitted, not dirty, not
|
|
46
|
+
reset, not validated. For controls that are not form data: a filter, a
|
|
47
|
+
"show advanced" switch.
|
|
48
|
+
- **A control with neither a `name` nor a label** (a `BbDropzone` has no label)
|
|
49
|
+
throws inside a form: give it a `name`, or `formless`.
|
|
50
|
+
- **Panels and headless pieces never join**: `BbSelectPopover`, `BbDatePicker`,
|
|
51
|
+
`BbTimePicker`, `BbColorPalette`. Use their field twins (`BbSelect`,
|
|
52
|
+
`BbDatePickerInput`, `BbTimePickerInput`, `BbColorInput`) in a form.
|
|
53
|
+
- **The same group rendered twice** (billing and shipping `<AddressFields>`)
|
|
54
|
+
would share one set of fields: pass your group component a prefix of its
|
|
55
|
+
own (`<AddressFields prefix="billing" />`) and name its fields with it
|
|
56
|
+
(`:name="`${prefix}[street]`"`), which also nests the values
|
|
57
|
+
(`{ billing: { street }, shipping: { street } }`).
|
|
58
|
+
- **Rows in a `v-for`** need a per-row `name` (`lines[${i}][qty]`): see
|
|
59
|
+
[Rows](#rows-v-for).
|
|
60
|
+
|
|
61
|
+
### Schemas: pass your Zod, Valibot, ArkType or Yup schema as it is
|
|
62
|
+
|
|
63
|
+
Describe the whole form once, in the schema library you already use, and hand
|
|
64
|
+
it to the `schema` prop. There is no adapter to import and no extra package
|
|
65
|
+
to install: any [Standard Schema](https://standardschema.dev) works, which
|
|
66
|
+
covers Zod 3.24+ and 4, Valibot 1, ArkType 2 and Yup 1.7+.
|
|
67
|
+
|
|
68
|
+
**Sign-up form with a Zod schema**
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<template>
|
|
72
|
+
<!--
|
|
73
|
+
A plain Zod schema on `schema`: no adapter, no per-field
|
|
74
|
+
rules, no refs. Each field's `name` is its path in the schema, and the
|
|
75
|
+
form holds the values until `@submit` hands them over.
|
|
76
|
+
-->
|
|
77
|
+
<BbForm
|
|
78
|
+
id="signup"
|
|
79
|
+
v-slot="{ isSubmitting }"
|
|
80
|
+
class="grid max-w-md gap-3 rounded-(--bb-radius) border p-4"
|
|
81
|
+
:schema="signup"
|
|
82
|
+
@submit="createAccount"
|
|
83
|
+
>
|
|
84
|
+
<BbTextInput autocomplete="name" label="Full name" name="name" />
|
|
85
|
+
<BbTextInput autocomplete="email" label="Email" name="email" type="email" />
|
|
86
|
+
<div class="grid grid-cols-2 gap-3">
|
|
87
|
+
<BbTextInput
|
|
88
|
+
autocomplete="new-password"
|
|
89
|
+
label="Password"
|
|
90
|
+
name="password"
|
|
91
|
+
type="password"
|
|
92
|
+
/>
|
|
93
|
+
<BbTextInput
|
|
94
|
+
autocomplete="new-password"
|
|
95
|
+
label="Repeat password"
|
|
96
|
+
name="confirm"
|
|
97
|
+
type="password"
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
<BbCheckbox label="I accept the terms" name="terms" />
|
|
101
|
+
|
|
102
|
+
<BbButton :loading="isSubmitting" type="submit" variant="primary">
|
|
103
|
+
Create account
|
|
104
|
+
</BbButton>
|
|
105
|
+
|
|
106
|
+
<p v-if="created" class="text-sm" data-testid="created" role="status">
|
|
107
|
+
Welcome, {{ created.name }} ({{ created.email }}).
|
|
108
|
+
</p>
|
|
109
|
+
</BbForm>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<script setup lang="ts">
|
|
113
|
+
import { ref } from 'vue';
|
|
114
|
+
import { z } from 'zod';
|
|
115
|
+
import {
|
|
116
|
+
BbButton,
|
|
117
|
+
BbCheckbox,
|
|
118
|
+
BbForm,
|
|
119
|
+
BbTextInput,
|
|
120
|
+
useBbFormContext,
|
|
121
|
+
} from 'bitboss-ui';
|
|
122
|
+
|
|
123
|
+
const signup = z
|
|
124
|
+
.object({
|
|
125
|
+
// An emptied text field holds `null`: the type's message covers it.
|
|
126
|
+
name: z.string('Enter your name').trim().min(1, 'Enter your name'),
|
|
127
|
+
// A transform: `@submit` receives the lower-cased address.
|
|
128
|
+
email: z.email('Enter a valid email').toLowerCase(),
|
|
129
|
+
password: z.string('Choose a password').min(8, 'At least 8 characters'),
|
|
130
|
+
confirm: z.string('Repeat the password'),
|
|
131
|
+
terms: z.literal(true, 'Accept the terms to continue'),
|
|
132
|
+
})
|
|
133
|
+
// A cross-field rule: `path` puts the message on the second field.
|
|
134
|
+
.refine((form) => form.password === form.confirm, {
|
|
135
|
+
message: 'The passwords do not match',
|
|
136
|
+
path: ['confirm'],
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const form = useBbFormContext('signup');
|
|
140
|
+
const created = ref<z.output<typeof signup> | null>(null);
|
|
141
|
+
|
|
142
|
+
// Typed from the schema: `values` is its OUTPUT, transforms applied.
|
|
143
|
+
const createAccount = async (values: z.output<typeof signup>) => {
|
|
144
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
145
|
+
// The server's word (a Laravel 422, say) lands on its field, beside the
|
|
146
|
+
// schema's messages, until the user edits it.
|
|
147
|
+
if (values.email === 'taken@example.com') {
|
|
148
|
+
form.setErrors({ email: ['This email already has an account.'] });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
created.value = values;
|
|
152
|
+
};
|
|
153
|
+
</script>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
What you get from the one prop:
|
|
157
|
+
|
|
158
|
+
- **Each message lands on its field.** A field's `name` is its path in the
|
|
159
|
+
schema: `name="email"`, `name="address.city"` or `name="address[city]"`,
|
|
160
|
+
`name="lines[0][qty]"` (brackets read as dots). A field with no `name` is
|
|
161
|
+
named after its label, `Full name` → `fullname`, so schema-driven forms set
|
|
162
|
+
`name` on every field. A cross-field rule
|
|
163
|
+
reaches the right field through its `path` (`path: ['confirm']` above).
|
|
164
|
+
- **Submit is gated** by the schema, async refinements included, exactly as it
|
|
165
|
+
is by field rules.
|
|
166
|
+
- **`@submit` receives the schema's output.** Transforms and coercions have
|
|
167
|
+
run (`trim()`, `toLowerCase()`, `z.coerce.number()`, Valibot's
|
|
168
|
+
`v.transform`), and the payload is **typed from the schema**: write the
|
|
169
|
+
handler as `(values: z.output<typeof schema>) => …` (or
|
|
170
|
+
`v.InferOutput<…>`) and it checks.
|
|
171
|
+
- **`isSubmitting` still covers your handler**: return its promise and the
|
|
172
|
+
button spins until it settles.
|
|
173
|
+
|
|
174
|
+
The same form in Valibot, with array rows:
|
|
175
|
+
|
|
176
|
+
**Order lines with a Valibot schema**
|
|
177
|
+
|
|
178
|
+
```vue
|
|
179
|
+
<template>
|
|
180
|
+
<!--
|
|
181
|
+
Valibot this time, with nested and array paths: a field's `name` is its
|
|
182
|
+
path, and brackets read as dots, so `customer[name]` is the schema's
|
|
183
|
+
`customer.name` and `lines[0][qty]` is `lines.0.qty`. Bracket names are
|
|
184
|
+
also what a native form post (and PHP / Laravel) nests correctly.
|
|
185
|
+
-->
|
|
186
|
+
<BbForm
|
|
187
|
+
v-slot="{ isSubmitting }"
|
|
188
|
+
v-model="draft"
|
|
189
|
+
class="grid max-w-lg gap-3 rounded-(--bb-radius) border p-4"
|
|
190
|
+
:schema="order"
|
|
191
|
+
@submit="save"
|
|
192
|
+
>
|
|
193
|
+
<BbTextInput
|
|
194
|
+
label="Customer"
|
|
195
|
+
name="customer[name]"
|
|
196
|
+
placeholder="Company or person"
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
<fieldset class="grid gap-2">
|
|
200
|
+
<legend class="mb-1 text-sm font-medium">Order lines</legend>
|
|
201
|
+
<!--
|
|
202
|
+
The rows are `draft.lines`: the form is bound to `draft`, so
|
|
203
|
+
adding and removing a row is a push and a splice, nothing else.
|
|
204
|
+
A row's name is its path, by index; rows without an id are keyed
|
|
205
|
+
by position.
|
|
206
|
+
-->
|
|
207
|
+
<div
|
|
208
|
+
v-for="(_, index) in draft.lines"
|
|
209
|
+
:key="index"
|
|
210
|
+
class="grid grid-cols-[1fr_7rem_auto] items-start gap-2"
|
|
211
|
+
>
|
|
212
|
+
<BbTextInput
|
|
213
|
+
:label="`Product ${index + 1}`"
|
|
214
|
+
:name="`lines[${index}][product]`"
|
|
215
|
+
/>
|
|
216
|
+
<BbNumberInput
|
|
217
|
+
:label="`Qty ${index + 1}`"
|
|
218
|
+
:min="1"
|
|
219
|
+
:name="`lines[${index}][qty]`"
|
|
220
|
+
/>
|
|
221
|
+
<BbButton
|
|
222
|
+
:aria-label="`Remove line ${index + 1}`"
|
|
223
|
+
class="mt-6"
|
|
224
|
+
:disabled="draft.lines.length === 1"
|
|
225
|
+
icon="lucide:x"
|
|
226
|
+
variant="ghost"
|
|
227
|
+
@click="draft.lines.splice(index, 1)"
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
<BbButton class="justify-self-start" variant="outline" @click="addLine">
|
|
231
|
+
Add a line
|
|
232
|
+
</BbButton>
|
|
233
|
+
</fieldset>
|
|
234
|
+
|
|
235
|
+
<BbButton :loading="isSubmitting" type="submit" variant="primary">
|
|
236
|
+
Save order
|
|
237
|
+
</BbButton>
|
|
238
|
+
|
|
239
|
+
<pre
|
|
240
|
+
v-if="saved"
|
|
241
|
+
class="overflow-auto rounded-(--bb-radius) bg-(--bb-surface-hover) p-2 text-xs"
|
|
242
|
+
data-testid="saved"
|
|
243
|
+
>{{ JSON.stringify(saved) }}</pre
|
|
244
|
+
>
|
|
245
|
+
</BbForm>
|
|
246
|
+
</template>
|
|
247
|
+
|
|
248
|
+
<script setup lang="ts">
|
|
249
|
+
import { reactive, ref } from 'vue';
|
|
250
|
+
import * as v from 'valibot';
|
|
251
|
+
import { BbButton, BbForm, BbNumberInput, BbTextInput } from 'bitboss-ui';
|
|
252
|
+
|
|
253
|
+
const order = v.object({
|
|
254
|
+
customer: v.object({
|
|
255
|
+
name: v.pipe(
|
|
256
|
+
v.string('Who is this order for?'),
|
|
257
|
+
v.trim(),
|
|
258
|
+
v.minLength(1, 'Who is this order for?')
|
|
259
|
+
),
|
|
260
|
+
}),
|
|
261
|
+
lines: v.pipe(
|
|
262
|
+
v.array(
|
|
263
|
+
v.object({
|
|
264
|
+
product: v.pipe(
|
|
265
|
+
v.string('Name the product'),
|
|
266
|
+
v.trim(),
|
|
267
|
+
v.minLength(1, 'Name the product')
|
|
268
|
+
),
|
|
269
|
+
qty: v.pipe(
|
|
270
|
+
v.number('How many?'),
|
|
271
|
+
v.integer('Whole units only'),
|
|
272
|
+
v.minValue(1, 'At least 1')
|
|
273
|
+
),
|
|
274
|
+
})
|
|
275
|
+
),
|
|
276
|
+
v.minLength(1, 'Add at least one line')
|
|
277
|
+
),
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
type Line = { product: string | null; qty: number | null };
|
|
281
|
+
|
|
282
|
+
// What the form starts from: one empty line. The fields fill the rest in.
|
|
283
|
+
const draft = reactive({ lines: [{ product: null, qty: 1 }] as Line[] });
|
|
284
|
+
const saved = ref<v.InferOutput<typeof order> | null>(null);
|
|
285
|
+
|
|
286
|
+
const addLine = () => draft.lines.push({ product: null, qty: 1 });
|
|
287
|
+
|
|
288
|
+
// `values` is the schema's output: trimmed names, whole numbers.
|
|
289
|
+
const save = async (values: v.InferOutput<typeof order>) => {
|
|
290
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
291
|
+
saved.value = values;
|
|
292
|
+
};
|
|
293
|
+
</script>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Four things to know:
|
|
297
|
+
|
|
298
|
+
- **Rows follow your array.** A row field's name is its path by index
|
|
299
|
+
(`lines.0.qty`); key the `v-for` by a stable id or by index, both work.
|
|
300
|
+
Delete and reorder by changing your array; in a form with
|
|
301
|
+
`keep-values-on-unmount` also call `removeField` on a deleted row. See
|
|
302
|
+
[Rows (`v-for`)](#rows-v-for).
|
|
303
|
+
- **An emptied text field holds `null` by default**, not `''`. So
|
|
304
|
+
`z.string().min(1, 'Required')` alone answers an emptied field with the
|
|
305
|
+
library's own "expected string, received null". Two ways out:
|
|
306
|
+
- **Set the plugin option `formControls: { textInputNullValue: '',
|
|
307
|
+
textareaNullValue: '' }`.** Emptied fields then emit `''` and the short
|
|
308
|
+
schema shows your message as written. Start text values as `''` too (a
|
|
309
|
+
field nobody touched keeps what your page gave it).
|
|
310
|
+
- **Or keep `null` and put the message on the type as well:**
|
|
311
|
+
`z.string('Required').min(1, 'Required')`, or `v.string('Required')` in
|
|
312
|
+
Valibot. Yup's `.required()` already covers `null`. An optional text field
|
|
313
|
+
is `.nullable()` (or `.nullish()`).
|
|
314
|
+
See [validation-libraries](./guides/validation-libraries.md) § What needs a tweak.
|
|
315
|
+
- **While a schema is set, per-field `rules` are ignored.** That is
|
|
316
|
+
vee-validate's design: one form, one source of truth. Pick one per form.
|
|
317
|
+
- **Set the schema when the form mounts.** It can change later (a `computed`,
|
|
318
|
+
see [Multi-step forms](#multi-step-forms)), but a form mounted without one
|
|
319
|
+
stays a rules form.
|
|
320
|
+
|
|
321
|
+
vee-validate's own schemas (`toTypedSchema(...)` from `@vee-validate/zod` and
|
|
322
|
+
friends) and an object of rules work too; nothing about them changes.
|
|
323
|
+
|
|
324
|
+
Which library supplies what (the asterisk, all messages or one per path,
|
|
325
|
+
async checks, the emptied-field message) and what changes when you switch:
|
|
326
|
+
[Validation libraries](./guides/validation-libraries.md).
|
|
327
|
+
|
|
328
|
+
#### Server errors go on the field, beside the schema's
|
|
329
|
+
|
|
330
|
+
A 422 from the server is best handed to the form in one call, `setErrors`
|
|
331
|
+
(see [Server errors (setErrors) and fields](#server-errors-seterrors-and-fields)).
|
|
332
|
+
Passing messages to a field (its `:errors` binding, as the email field above
|
|
333
|
+
does) still works too
|
|
334
|
+
(`@update:model-value="taken = []"` clears it on the next edit). Both show
|
|
335
|
+
beside the schema's messages.
|
|
336
|
+
|
|
36
337
|
### Submit is the gate
|
|
37
338
|
|
|
38
339
|
The one event is `submit`, and it fires **only when every field passes**. The
|
|
@@ -42,41 +343,830 @@ and stays put.
|
|
|
42
343
|
|
|
43
344
|
```vue
|
|
44
345
|
<script setup lang="ts">
|
|
45
|
-
import {
|
|
46
|
-
import { BbButton } from 'bitboss-ui';
|
|
47
|
-
import { BbForm, BbTextInput } from 'bitboss-ui/validated';
|
|
48
|
-
|
|
49
|
-
const saving = ref(false);
|
|
346
|
+
import { BbButton, BbForm, BbTextInput } from 'bitboss-ui';
|
|
50
347
|
|
|
348
|
+
// Just await the work — no `saving` ref. The form tracks it (see below).
|
|
51
349
|
const save = async (values: Record<string, unknown>) => {
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await api.contacts.create(values);
|
|
55
|
-
} finally {
|
|
56
|
-
saving.value = false;
|
|
57
|
-
}
|
|
350
|
+
await api.contacts.create(values);
|
|
58
351
|
};
|
|
59
352
|
</script>
|
|
60
353
|
|
|
61
354
|
<template>
|
|
62
|
-
<BbForm @submit="save">
|
|
355
|
+
<BbForm v-slot="{ isSubmitting }" @submit="save">
|
|
63
356
|
<BbTextInput label="Full name" rules="required" />
|
|
64
357
|
<BbTextInput label="Email" rules="required|email" type="email" />
|
|
65
|
-
<BbButton :loading="
|
|
358
|
+
<BbButton :loading="isSubmitting" type="submit" variant="primary">
|
|
359
|
+
Save
|
|
360
|
+
</BbButton>
|
|
66
361
|
</BbForm>
|
|
67
362
|
</template>
|
|
68
363
|
```
|
|
69
364
|
|
|
70
365
|
The payload is the collected form values, keyed by each field's name — derived
|
|
71
|
-
from the control's `label` unless you set `
|
|
366
|
+
from the control's `label` unless you set `name`. `Full name` above arrives as
|
|
72
367
|
`fullname`; when two fields in one form would collide (rows in a `v-for`), give
|
|
73
|
-
those a `
|
|
368
|
+
those a `name`. With a `schema`, the payload is the schema's output
|
|
369
|
+
instead (see [Schemas](#schemas-pass-your-zod-valibot-arktype-or-yup-schema-as-it-is)).
|
|
370
|
+
|
|
371
|
+
### Fields without `v-model`
|
|
372
|
+
|
|
373
|
+
Inside a `BbForm` a form control needs no `v-model`: the form holds the
|
|
374
|
+
value. Give it a `name` (its path) and read the value where you need it:
|
|
375
|
+
|
|
376
|
+
- **`@submit`** gets every value (the schema's output, with a `schema`).
|
|
377
|
+
- **The default slot's `values`**, for chrome inside the form.
|
|
378
|
+
- **`useBbFormContext(id).values`**, from anywhere else on the page.
|
|
379
|
+
|
|
380
|
+
```vue
|
|
381
|
+
<script setup lang="ts">
|
|
382
|
+
import { computed } from 'vue';
|
|
383
|
+
import { BbButton, BbForm, BbTextInput, useBbFormContext } from 'bitboss-ui';
|
|
384
|
+
|
|
385
|
+
const form = useBbFormContext('invite');
|
|
386
|
+
const who = computed(() => form.values.value.email ?? 'nobody yet');
|
|
387
|
+
|
|
388
|
+
const send = async (values: Record<string, unknown>) => {
|
|
389
|
+
await fetch('/api/invites', { method: 'POST', body: JSON.stringify(values) });
|
|
390
|
+
};
|
|
391
|
+
</script>
|
|
392
|
+
|
|
393
|
+
<template>
|
|
394
|
+
<p>Inviting {{ who }}</p>
|
|
395
|
+
<BbForm id="invite" v-slot="{ values, isSubmitting }" @submit="send">
|
|
396
|
+
<BbTextInput label="Email" name="email" rules="required|email" />
|
|
397
|
+
<p>{{ values.email ? `Send to ${values.email}` : 'Type an email' }}</p>
|
|
398
|
+
<BbButton :loading="isSubmitting" type="submit">Invite</BbButton>
|
|
399
|
+
</BbForm>
|
|
400
|
+
</template>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Bind `v-model` when the page owns the value (it loads or resets it, or other
|
|
404
|
+
parts of the page react to it); the two stay in sync either way. You can bind
|
|
405
|
+
it on some fields and not others: each bound ref is a two-way window into that
|
|
406
|
+
one value, and `resetForm()` puts it back too.
|
|
407
|
+
|
|
408
|
+
Only `@submit` (with a `schema`) and a bound `v-model` ref are typed. The
|
|
409
|
+
slot's `values` is untyped and `useBbFormContext(id).values` holds `unknown`
|
|
410
|
+
entries, so narrow what you read there
|
|
411
|
+
(`form.values.value.role as Invite['role'] | undefined`).
|
|
412
|
+
|
|
413
|
+
### Binding the form to your object (`v-model`)
|
|
414
|
+
|
|
415
|
+
`<BbForm v-model="values">` keeps the fields' values in an object your page
|
|
416
|
+
owns, both ways: any reactive object (`reactive({})`, a `ref({})`, Inertia's
|
|
417
|
+
`useForm()`), updated **in place**, never replaced. A field without its own
|
|
418
|
+
`v-model` starts from the value at its path, writes every change back there,
|
|
419
|
+
and follows your own writes:
|
|
420
|
+
|
|
421
|
+
```vue
|
|
422
|
+
<script setup lang="ts">
|
|
423
|
+
import { reactive } from 'vue';
|
|
424
|
+
import { BbButton, BbForm, BbTextInput } from 'bitboss-ui';
|
|
425
|
+
|
|
426
|
+
const values = reactive({ hello: 125, first_name: 'Ada' });
|
|
427
|
+
|
|
428
|
+
async function save(submitted: Record<string, unknown>) {
|
|
429
|
+
await fetch('/api/people', {
|
|
430
|
+
method: 'POST',
|
|
431
|
+
body: JSON.stringify(submitted),
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
</script>
|
|
435
|
+
|
|
436
|
+
<template>
|
|
437
|
+
<BbForm v-model="values" @submit="save">
|
|
438
|
+
<BbTextInput label="First name" name="first_name" rules="required" />
|
|
439
|
+
<BbTextInput label="City" name="address[city]" />
|
|
440
|
+
<BbButton type="submit">Save</BbButton>
|
|
441
|
+
</BbForm>
|
|
442
|
+
</template>
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
- **Seeded, not written on mount.** The fields start from `values`; nothing
|
|
446
|
+
is written until something changes, so Inertia's `isDirty` stays honest.
|
|
447
|
+
- **Written by path.** Typing "Turin" makes `values.address.city` (nested
|
|
448
|
+
objects and arrays are created: `lines[0][qty]` → `values.lines[0].qty`).
|
|
449
|
+
The key is the field's identity: its `name`, else its slugged label.
|
|
450
|
+
- **Foreign keys stay.** `hello` above is never touched. `@submit` receives
|
|
451
|
+
the fields' values (the schema's output with a `schema`), not the foreign
|
|
452
|
+
keys.
|
|
453
|
+
- **Your writes drive the fields.** `values.first_name = 'Grace'`, or
|
|
454
|
+
Inertia's `form.reset()`, updates the field. A field showing an error
|
|
455
|
+
re-checks (not `lazy` / `submit-only`); an outside write never marks a
|
|
456
|
+
field touched.
|
|
457
|
+
- **A field's own `v-model` wins** over the object for that field.
|
|
458
|
+
- **Unmount follows the form.** Without `keep-values-on-unmount`, a field that
|
|
459
|
+
leaves for good takes its key with it; with it, the key stays.
|
|
460
|
+
- **The same object comes back** in `update:modelValue`, so a `ref` keeps its
|
|
461
|
+
identity. Watch it with `{ deep: true }`: its contents change, not its
|
|
462
|
+
reference.
|
|
463
|
+
|
|
464
|
+
With Inertia, bind the `useForm()` object itself and **declare every field in
|
|
465
|
+
`useForm({ … })`**: Inertia posts and resets only the keys it was created
|
|
466
|
+
with, so a key the form adds is kept in the object but never sent.
|
|
467
|
+
|
|
468
|
+
### A failed submit focuses the first invalid field
|
|
469
|
+
|
|
470
|
+
When a submit does not pass, `BbForm` moves focus to the **first invalid field
|
|
471
|
+
that is on screen**, in page order, so a keyboard or screen-reader user lands
|
|
472
|
+
on the problem instead of hunting for it. A field inside a `v-show`-hidden
|
|
473
|
+
section, an `inert` subtree or `hidden` content is skipped; a failing path with
|
|
474
|
+
no field mounted has nothing to focus.
|
|
475
|
+
|
|
476
|
+
It also emits **`invalid`** with `{ errors, values }`: `errors` maps every
|
|
477
|
+
failing path to all its messages, `{ [path]: string[] }` — the same shape and
|
|
478
|
+
keys as the form's `errors` (`address.city`, `lines.0.qty`) — including the
|
|
479
|
+
paths that are not on screen. That is what a wizard needs to jump to the
|
|
480
|
+
step holding the error; focus runs after your handler, so the field that just
|
|
481
|
+
came back on screen is the one that gets it. A handler that moves focus itself
|
|
482
|
+
(to an error summary, say) keeps it: the form leaves focus alone then.
|
|
483
|
+
|
|
484
|
+
```vue
|
|
485
|
+
<BbForm
|
|
486
|
+
:schema="schema"
|
|
487
|
+
@invalid="({ errors }) => report(errors)"
|
|
488
|
+
@submit="save"
|
|
489
|
+
>
|
|
490
|
+
…
|
|
491
|
+
</BbForm>
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
> Behaviour change in 3.0.0-beta.41: a failed submit used to leave focus where
|
|
495
|
+
> it was (usually on the submit button).
|
|
496
|
+
|
|
497
|
+
**Server errors move focus the same way.** `setErrors(map)` focuses the first
|
|
498
|
+
field that got an error and is on screen, in page order (not the first key of
|
|
499
|
+
the map). It holds back when focus is no longer the form's: if the user has
|
|
500
|
+
moved on to something outside the form while the request ran, or if nobody
|
|
501
|
+
has submitted the form yet and focus is on the page (a page that opens with
|
|
502
|
+
errors in its props). Keys that match no field, and an empty map, move
|
|
503
|
+
nothing; `setErrors(map, { focus: false })` never moves it.
|
|
504
|
+
|
|
505
|
+
### Multi-step forms
|
|
506
|
+
|
|
507
|
+
A wizard is one `BbForm` whose schema changes per step, following
|
|
508
|
+
vee-validate's own pattern: **validate the step on Next, with a schema per
|
|
509
|
+
step**. Make the submit button say "Next" until the last step, and the
|
|
510
|
+
per-step schema is the gate: Enter and the button both go through it, and a
|
|
511
|
+
step you cannot leave is simply a submit that does not pass.
|
|
512
|
+
|
|
513
|
+
**Three-step checkout, a schema per step**
|
|
514
|
+
|
|
515
|
+
```vue
|
|
516
|
+
<template>
|
|
517
|
+
<!--
|
|
518
|
+
One form, three steps, a schema per step. The submit button is "Next"
|
|
519
|
+
until the last step, so Enter and the button both go through the gate:
|
|
520
|
+
a step you cannot leave is a submit that does not pass.
|
|
521
|
+
-->
|
|
522
|
+
<BbForm
|
|
523
|
+
v-slot="{ isSubmitting }"
|
|
524
|
+
v-model="checkout"
|
|
525
|
+
class="grid max-w-md gap-4 rounded-(--bb-radius) border p-4"
|
|
526
|
+
keep-values-on-unmount
|
|
527
|
+
:schema="steps[step]"
|
|
528
|
+
@invalid="onInvalid"
|
|
529
|
+
@submit="onSubmit"
|
|
530
|
+
>
|
|
531
|
+
<ol class="flex gap-3 text-xs text-(--bb-text-muted)">
|
|
532
|
+
<li
|
|
533
|
+
v-for="(title, index) in titles"
|
|
534
|
+
:key="title"
|
|
535
|
+
:aria-current="index === step ? 'step' : undefined"
|
|
536
|
+
:class="{ 'font-semibold text-(--bb-text)': index === step }"
|
|
537
|
+
>
|
|
538
|
+
{{ index + 1 }}. {{ title }}
|
|
539
|
+
</li>
|
|
540
|
+
</ol>
|
|
541
|
+
|
|
542
|
+
<h3 ref="step-heading" class="text-sm font-medium" tabindex="-1">
|
|
543
|
+
{{ titles[step] }}
|
|
544
|
+
</h3>
|
|
545
|
+
|
|
546
|
+
<!-- `v-if` steps: keep-values-on-unmount keeps what you typed in them. -->
|
|
547
|
+
<template v-if="step === 0">
|
|
548
|
+
<BbTextInput
|
|
549
|
+
autocomplete="email"
|
|
550
|
+
label="Email"
|
|
551
|
+
name="email"
|
|
552
|
+
type="email"
|
|
553
|
+
/>
|
|
554
|
+
<BbTextInput
|
|
555
|
+
autocomplete="new-password"
|
|
556
|
+
label="Password"
|
|
557
|
+
name="password"
|
|
558
|
+
type="password"
|
|
559
|
+
/>
|
|
560
|
+
</template>
|
|
561
|
+
|
|
562
|
+
<template v-else-if="step === 1">
|
|
563
|
+
<BbTextInput
|
|
564
|
+
autocomplete="street-address"
|
|
565
|
+
label="Street"
|
|
566
|
+
name="address.street"
|
|
567
|
+
/>
|
|
568
|
+
<div class="grid grid-cols-2 gap-3">
|
|
569
|
+
<BbTextInput
|
|
570
|
+
autocomplete="address-level2"
|
|
571
|
+
label="City"
|
|
572
|
+
name="address.city"
|
|
573
|
+
/>
|
|
574
|
+
<BbTextInput
|
|
575
|
+
autocomplete="postal-code"
|
|
576
|
+
label="Postcode"
|
|
577
|
+
name="address.zip"
|
|
578
|
+
/>
|
|
579
|
+
</div>
|
|
580
|
+
</template>
|
|
581
|
+
|
|
582
|
+
<template v-else>
|
|
583
|
+
<BbNumberInput label="Seats" :min="1" name="seats" />
|
|
584
|
+
<BbCheckbox label="I accept the terms of service" name="terms" />
|
|
585
|
+
</template>
|
|
586
|
+
|
|
587
|
+
<footer class="flex justify-between gap-2">
|
|
588
|
+
<BbButton v-if="step > 0" variant="ghost" @click="go(step - 1)">
|
|
589
|
+
Back
|
|
590
|
+
</BbButton>
|
|
591
|
+
<BbButton
|
|
592
|
+
class="ms-auto"
|
|
593
|
+
:loading="isSubmitting"
|
|
594
|
+
type="submit"
|
|
595
|
+
variant="primary"
|
|
596
|
+
>
|
|
597
|
+
{{ step < steps.length - 1 ? 'Next' : 'Place order' }}
|
|
598
|
+
</BbButton>
|
|
599
|
+
</footer>
|
|
600
|
+
|
|
601
|
+
<p v-if="placed" class="text-sm" data-testid="placed" role="status">
|
|
602
|
+
Order placed for {{ placed.email }}: {{ placed.seats }} seat(s), shipping
|
|
603
|
+
to {{ placed.address.city }} {{ placed.address.zip }}.
|
|
604
|
+
</p>
|
|
605
|
+
</BbForm>
|
|
606
|
+
</template>
|
|
607
|
+
|
|
608
|
+
<script setup lang="ts">
|
|
609
|
+
import { nextTick, reactive, ref, useTemplateRef } from 'vue';
|
|
610
|
+
import { z } from 'zod';
|
|
611
|
+
import {
|
|
612
|
+
BbButton,
|
|
613
|
+
BbCheckbox,
|
|
614
|
+
BbForm,
|
|
615
|
+
type BbFormInvalidPayload,
|
|
616
|
+
BbNumberInput,
|
|
617
|
+
BbTextInput,
|
|
618
|
+
} from 'bitboss-ui';
|
|
619
|
+
|
|
620
|
+
// An emptied text field holds `null`, so each message sits on the type too.
|
|
621
|
+
const account = z.object({
|
|
622
|
+
email: z.email('Enter a valid email'),
|
|
623
|
+
password: z.string('Choose a password').min(8, 'At least 8 characters'),
|
|
624
|
+
});
|
|
625
|
+
const shipping = z.object({
|
|
626
|
+
address: z.object({
|
|
627
|
+
street: z.string('Enter a street').trim().min(1, 'Enter a street'),
|
|
628
|
+
city: z.string('Enter a city').trim().min(1, 'Enter a city'),
|
|
629
|
+
// A transform: `@submit` receives the upper-cased postcode.
|
|
630
|
+
zip: z
|
|
631
|
+
.string('Enter a postcode')
|
|
632
|
+
.trim()
|
|
633
|
+
.toUpperCase()
|
|
634
|
+
.regex(/^[A-Z0-9 -]{3,10}$/, 'Enter a postcode'),
|
|
635
|
+
}),
|
|
636
|
+
});
|
|
637
|
+
// The last step validates the WHOLE order, so `@submit` gets all of it —
|
|
638
|
+
// every step's value is still there thanks to keep-values-on-unmount.
|
|
639
|
+
const order = account.extend(shipping.shape).extend({
|
|
640
|
+
seats: z.number('How many seats?').int().min(1).max(50),
|
|
641
|
+
terms: z.literal(true, 'Accept the terms to place the order'),
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
// `as const`: a plain array is typed by the steps' common supertype.
|
|
645
|
+
const steps = [account, shipping, order] as const;
|
|
646
|
+
const titles = ['Account', 'Shipping', 'Review'];
|
|
647
|
+
const step = ref(0);
|
|
648
|
+
|
|
649
|
+
// Where the order starts: one seat. The fields fill in the rest.
|
|
650
|
+
const checkout = reactive({ seats: 1 });
|
|
651
|
+
const placed = ref<z.output<typeof order> | null>(null);
|
|
652
|
+
|
|
653
|
+
const heading = useTemplateRef<HTMLElement>('step-heading');
|
|
654
|
+
// Move focus to the new step's heading, so keyboard and screen-reader users
|
|
655
|
+
// land at the top of what changed.
|
|
656
|
+
const go = async (index: number) => {
|
|
657
|
+
step.value = index;
|
|
658
|
+
await nextTick();
|
|
659
|
+
heading.value?.focus();
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
// Annotated with the step that posts (the last, the whole order): the
|
|
663
|
+
// earlier steps only advance.
|
|
664
|
+
const onSubmit = async (values: z.output<typeof order>) => {
|
|
665
|
+
if (step.value < steps.length - 1) return go(step.value + 1);
|
|
666
|
+
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
667
|
+
placed.value = values;
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
// The last step re-checks everything. Should an earlier step fail there, go
|
|
671
|
+
// back to it: BbForm then focuses the field once it is on screen again.
|
|
672
|
+
const stepOf = (path: string) =>
|
|
673
|
+
path.startsWith('address.')
|
|
674
|
+
? 1
|
|
675
|
+
: path in account.shape
|
|
676
|
+
? 0
|
|
677
|
+
: steps.length - 1;
|
|
678
|
+
const onInvalid = ({ errors }: BbFormInvalidPayload) => {
|
|
679
|
+
const first = Object.keys(errors)[0];
|
|
680
|
+
if (first !== undefined && stepOf(first) !== step.value)
|
|
681
|
+
step.value = stepOf(first);
|
|
682
|
+
};
|
|
683
|
+
</script>
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
The pieces:
|
|
687
|
+
|
|
688
|
+
- `:schema="steps[step]"`: **one schema per step you render**, in
|
|
689
|
+
step order, reactive (a `computed` works too). When it changes, fields
|
|
690
|
+
already validated re-check against the new one. Three steps, three schemas;
|
|
691
|
+
a two-step form is `[account, account.extend(profile.shape)] as const` — do
|
|
692
|
+
not add a separate "whole form" entry after the last step, or the last
|
|
693
|
+
submit only advances to a step that does not exist. **Keep the `as const`**:
|
|
694
|
+
without it TypeScript types the array by its common supertype, `account`
|
|
695
|
+
(the last step extends it), so `@submit` is typed as the first step's
|
|
696
|
+
values and a handler annotated with the whole form does not type-check.
|
|
697
|
+
- **The last step's schema is the whole form** (`account.extend(…)` above), so
|
|
698
|
+
`@submit` gets everything. A last step that validated only its own fields
|
|
699
|
+
would hand `@submit` only those: Zod and Valibot drop keys the schema does
|
|
700
|
+
not name.
|
|
701
|
+
- **`@submit` fires on every step**, with that step's output. With a per-step
|
|
702
|
+
schema the handler may be annotated with the step you post on — the last
|
|
703
|
+
one, the whole form: `(values: z.output<typeof order>)` type-checks (with
|
|
704
|
+
the steps array `as const`, see above). Advance
|
|
705
|
+
on the other steps first (`if (step.value < steps.length - 1) return next()`).
|
|
706
|
+
- `keep-values-on-unmount`: the steps are `v-if`, so a step you leave
|
|
707
|
+
unmounts. Without this, its fields drop out of the form's values (your own
|
|
708
|
+
`v-model` refs keep theirs, the form does not), so the last step's
|
|
709
|
+
whole-form check fails on fields that are not on screen.
|
|
710
|
+
- `@invalid`: if the last step's whole-form check finds a problem in an earlier
|
|
711
|
+
step, jump there; the field is focused once it is back on screen.
|
|
712
|
+
|
|
713
|
+
Three traps, and what each does to you:
|
|
714
|
+
|
|
715
|
+
1. **`v-show` steps with one whole-form schema.** Every step is mounted, so an
|
|
716
|
+
error on a hidden step blocks the submit, and the message sits where nobody
|
|
717
|
+
can see it. Use a schema per step, or jump in `@invalid`.
|
|
718
|
+
2. **`v-if` steps with per-field `rules`** (no schema). An unmounted field is
|
|
719
|
+
not validated at all, so steps the user skipped or emptied go out
|
|
720
|
+
unchecked. Validate each step on Next, which the per-step submit does.
|
|
721
|
+
3. **`v-if` steps with one whole-form schema.** The schema still checks the
|
|
722
|
+
fields of the steps that are not mounted, so the submit is blocked by an
|
|
723
|
+
error with no field on screen. Without `keep-values-on-unmount` it is worse:
|
|
724
|
+
those values are gone, so it always fails. Keep the values, and jump to the
|
|
725
|
+
failing step in `@invalid`.
|
|
726
|
+
|
|
727
|
+
### Conditional validation
|
|
728
|
+
|
|
729
|
+
There is no switch that turns validation off. Put the condition where the
|
|
730
|
+
validation lives: in the template (is the field there?), in the schema, or in
|
|
731
|
+
the rules. Three cases cover it.
|
|
732
|
+
|
|
733
|
+
#### A field that does not apply: `v-if`
|
|
734
|
+
|
|
735
|
+
Render it only when it applies. A field that unmounts is not validated and,
|
|
736
|
+
unless the form keeps values on unmount (next section), its value leaves the
|
|
737
|
+
form, so `@submit` never sees it:
|
|
738
|
+
|
|
739
|
+
```vue
|
|
740
|
+
<BbForm v-slot="{ values }" @submit="save">
|
|
741
|
+
<BbCheckbox label="I am buying for a business" name="business" />
|
|
742
|
+
<BbTextInput
|
|
743
|
+
v-if="values.business"
|
|
744
|
+
label="VAT number"
|
|
745
|
+
name="vat"
|
|
746
|
+
rules="required"
|
|
747
|
+
/>
|
|
748
|
+
</BbForm>
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
This needs no `:rules="business ? 'required' : undefined"` on the field: when
|
|
752
|
+
it is on the page it is required, when it is not there is nothing to check.
|
|
753
|
+
|
|
754
|
+
#### In a preserving form, also call `removeField`
|
|
755
|
+
|
|
756
|
+
With `keep-values-on-unmount` (a wizard, a draftable form), a field that
|
|
757
|
+
unmounts **keeps** its value, because the form cannot tell "does not apply
|
|
758
|
+
any more" from "on another step". Measured, with a VAT number typed and then
|
|
759
|
+
"business" unticked:
|
|
760
|
+
|
|
761
|
+
- per-field `rules`: the hidden value is still submitted, unchecked;
|
|
762
|
+
- a `schema`: the hidden value is still checked, and blocks the submit with an
|
|
763
|
+
error on a field that is not on screen.
|
|
764
|
+
|
|
765
|
+
So when a field stops applying for good, remove it from the form as well,
|
|
766
|
+
from a watcher on whatever hides it. `removeField` applies after the page
|
|
767
|
+
re-renders, so the watcher's timing does not matter:
|
|
768
|
+
|
|
769
|
+
```vue
|
|
770
|
+
<script setup lang="ts">
|
|
771
|
+
import { reactive, watch } from 'vue';
|
|
772
|
+
import { BbCheckbox, BbForm, BbTextInput, useBbFormContext } from 'bitboss-ui';
|
|
773
|
+
|
|
774
|
+
const signup = reactive({ business: false });
|
|
775
|
+
const form = useBbFormContext('signup');
|
|
776
|
+
|
|
777
|
+
watch(
|
|
778
|
+
() => signup.business,
|
|
779
|
+
(isBusiness) => {
|
|
780
|
+
if (!isBusiness) form.removeField('vat');
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
</script>
|
|
784
|
+
|
|
785
|
+
<template>
|
|
786
|
+
<BbForm id="signup" v-model="signup" keep-values-on-unmount>
|
|
787
|
+
<BbCheckbox label="I am buying for a business" name="business" />
|
|
788
|
+
<BbTextInput v-if="signup.business" label="VAT number" name="vat" />
|
|
789
|
+
</BbForm>
|
|
790
|
+
</template>
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
The value, its errors and its `fields` entry are gone, so neither `@submit`
|
|
794
|
+
nor a [saved draft](#saving-a-draft) carries it. A path a field on the page
|
|
795
|
+
still owns is left alone. Only a field that stops applying needs this; a
|
|
796
|
+
field on a step the user merely left keeps its value on purpose.
|
|
797
|
+
|
|
798
|
+
#### A form checked differently depending on state
|
|
799
|
+
|
|
800
|
+
When the whole form is validated one way or another (a draft and a publish, a
|
|
801
|
+
quick add and a full edit), switch the rules in one place instead of on every
|
|
802
|
+
field. With a schema, switch the schema:
|
|
803
|
+
|
|
804
|
+
```ts
|
|
805
|
+
const schema = computed(() => (publishing.value ? publishSchema : draftSchema));
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
```vue
|
|
809
|
+
<BbForm :schema="schema" @submit="save">…</BbForm>
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
With `rules`, compute each field's rules once in the script (`''` means no
|
|
813
|
+
rules) and bind the result:
|
|
814
|
+
|
|
815
|
+
```ts
|
|
816
|
+
const bodyRules = computed(() => (publishing.value ? 'required' : ''));
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
```vue
|
|
820
|
+
<BbTextInput label="Body" name="body" :rules="bodyRules" />
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
Both switch live: the next validation uses the new schema or rules, and
|
|
824
|
+
switching back lets a submit through that was blocked a moment ago.
|
|
825
|
+
|
|
826
|
+
### `isSubmitting` covers your submit, not just validation
|
|
827
|
+
|
|
828
|
+
Bind a button's `loading` to `isSubmitting` (or to `submitting` from
|
|
829
|
+
`useBbFormContext`) and it stays on for as long as your handler is actually
|
|
830
|
+
working — **return the promise** and the form waits for it:
|
|
831
|
+
|
|
832
|
+
```vue
|
|
833
|
+
<!-- the spinner runs until save() settles -->
|
|
834
|
+
<BbForm
|
|
835
|
+
@submit="
|
|
836
|
+
async (values) => {
|
|
837
|
+
await api.save(values);
|
|
838
|
+
}
|
|
839
|
+
"
|
|
840
|
+
/>
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
A synchronous handler resolves immediately, as you would expect. If your
|
|
844
|
+
handler throws or rejects, the flag still clears (so the button never spins
|
|
845
|
+
forever) and the error is routed to `app.config.errorHandler`, the same place
|
|
846
|
+
Vue sends any other event-handler failure — so a global reporter keeps seeing
|
|
847
|
+
it.
|
|
848
|
+
|
|
849
|
+
> Fixed in 3.0.0-beta.15 (Q18.3). Before that, `isSubmitting` cleared as soon
|
|
850
|
+
> as _validation_ resolved, so the spinner flashed for a frame and the user
|
|
851
|
+
> could double-submit a save still in flight. If you worked around it with your
|
|
852
|
+
> own `saving` ref, you can drop it.
|
|
853
|
+
|
|
854
|
+
### Saving in place: `snapshot()`
|
|
855
|
+
|
|
856
|
+
`dirty` compares against the values the form started with. A page that saves
|
|
857
|
+
and keeps the user on it needs a new starting point, or the form reads as
|
|
858
|
+
unsaved forever. Call `snapshot()` after the save succeeds: the current values
|
|
859
|
+
become the baseline, `dirty` and `touched` clear, and the values, the errors
|
|
860
|
+
and `submitCount` stay. Pass the values the server answered with to adopt
|
|
861
|
+
those instead (`snapshot(saved)`: merged over the current ones, arrays
|
|
862
|
+
replace). `reset()` then goes back to this new baseline.
|
|
863
|
+
|
|
864
|
+
```ts
|
|
865
|
+
const form = useBbFormContext('profile');
|
|
866
|
+
|
|
867
|
+
async function save(values: Record<string, unknown>) {
|
|
868
|
+
const saved = await api.updateProfile(values);
|
|
869
|
+
form.snapshot(saved); // the saved profile is the new "clean"
|
|
870
|
+
}
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### Saving a draft
|
|
874
|
+
|
|
875
|
+
A draft saves what the user has typed so far, valid or not, so it does not go
|
|
876
|
+
through `@submit` (which only fires once the form is valid, with the
|
|
877
|
+
schema's cleaned output). Read the raw values from the form and post them
|
|
878
|
+
yourself, then call [`snapshot()`](#saving-in-place-snapshot) so the form no
|
|
879
|
+
longer reads as unsaved:
|
|
880
|
+
|
|
881
|
+
```vue
|
|
882
|
+
<script setup lang="ts">
|
|
883
|
+
import { BbButton, BbForm, BbTextInput, useBbFormContext } from 'bitboss-ui';
|
|
884
|
+
|
|
885
|
+
const form = useBbFormContext('article');
|
|
886
|
+
|
|
887
|
+
async function saveDraft() {
|
|
888
|
+
await fetch('/api/articles/draft', {
|
|
889
|
+
method: 'POST',
|
|
890
|
+
body: JSON.stringify(form.values.value),
|
|
891
|
+
});
|
|
892
|
+
form.snapshot();
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
async function publish(values: Record<string, unknown>) {
|
|
896
|
+
await fetch('/api/articles', {
|
|
897
|
+
method: 'POST',
|
|
898
|
+
body: JSON.stringify(values),
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
</script>
|
|
902
|
+
|
|
903
|
+
<template>
|
|
904
|
+
<BbForm id="article" keep-values-on-unmount @submit="publish">
|
|
905
|
+
<BbTextInput label="Title" name="title" rules="required" />
|
|
906
|
+
<BbTextInput label="Body" name="body" rules="required" />
|
|
907
|
+
<BbButton type="button" variant="secondary" @click="saveDraft">
|
|
908
|
+
Save draft
|
|
909
|
+
</BbButton>
|
|
910
|
+
<BbButton type="submit">Publish</BbButton>
|
|
911
|
+
</BbForm>
|
|
912
|
+
</template>
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
Nothing is validated and no error appears when saving a draft; "Publish" still
|
|
916
|
+
goes through validation. The draft holds the raw values: untrimmed, and
|
|
917
|
+
invalid ones included. In a preserving form, remove fields that stopped
|
|
918
|
+
applying with [`removeField`](#in-a-preserving-form-also-call-removefield),
|
|
919
|
+
or the draft saves them too.
|
|
920
|
+
|
|
921
|
+
`form.values` is live: reading `form.values.value` gives the values at that
|
|
922
|
+
moment. Each read is a new top-level copy, but nested objects (`address`,
|
|
923
|
+
rows) are still the form's own, so a copy you hold on to changes as the user
|
|
924
|
+
types. Post it right away, as above; to keep a draft for later, deep-copy it
|
|
925
|
+
first (`JSON.parse(JSON.stringify(form.values.value))`).
|
|
926
|
+
|
|
927
|
+
### `resetForm()` clears the fields, and your model
|
|
928
|
+
|
|
929
|
+
Resetting publishes the new value back through `update:modelValue`, so the
|
|
930
|
+
control, the form's own state and whatever ref you bound all agree afterwards.
|
|
931
|
+
The same holds for vee-validate's `resetField` and `setFieldValue`.
|
|
932
|
+
|
|
933
|
+
> Fixed in 3.0.0-beta.15 (Q18.4). Before that the value pipe only ran one way:
|
|
934
|
+
> a reset moved the form's internal value but never told your model, so the
|
|
935
|
+
> form reported itself pristine while the user's text was still on screen.
|
|
936
|
+
|
|
937
|
+
A native `<button type="reset">` inside the form does the same thing: BbForm
|
|
938
|
+
catches the `reset` event and calls `resetForm()`. Every field goes back to its
|
|
939
|
+
**initial** value (the value it was mounted with, so a prefilled edit form
|
|
940
|
+
returns to what it loaded, not to empty), just like a native form.
|
|
941
|
+
|
|
942
|
+
Only the library's controls take part. BbForm cancels the browser's own reset
|
|
943
|
+
so it can run `resetForm()` instead, which means a plain `<input>` (or any
|
|
944
|
+
control that is not one of the library's form controls) inside the form keeps its
|
|
945
|
+
value when the form resets. Reset those yourself, or use the validated
|
|
946
|
+
controls.
|
|
947
|
+
|
|
948
|
+
### Server errors (setErrors) and fields
|
|
949
|
+
|
|
950
|
+
The form state is one answer to "what is wrong, and where":
|
|
951
|
+
|
|
952
|
+
- **`errors`** is every error of a field in `fields`, `{ [path]: string[] }`
|
|
953
|
+
with all its messages (rules, schema, server).
|
|
954
|
+
- **`unmatchedErrors`** is every other error: server paths no field has, a
|
|
955
|
+
request-level message. Same shape. It never gates submit or validity, and
|
|
956
|
+
clears when a submit starts, on reset, and on the next `setErrors`.
|
|
957
|
+
- The two never share a path, and a path with no error is omitted, so
|
|
958
|
+
**`{ ...errors, ...unmatchedErrors }` is every error.**
|
|
959
|
+
- **`fields`** lists the form's fields by path: `{ mounted, label,
|
|
960
|
+
validationLabel, errors, dirty, touched }`. `fields[path].errors` is one
|
|
961
|
+
field's full list, the same array as `errors[path]`.
|
|
962
|
+
|
|
963
|
+
All of them are on `useBbFormContext(id)` and in the default slot, with
|
|
964
|
+
`setErrors(map)` and `removeField(path)`.
|
|
965
|
+
|
|
966
|
+
> Changed in 3.0.0-beta.41: `errors` held the first message only
|
|
967
|
+
> (`errors.email` was a string). Read `errors.email?.[0]` for that now.
|
|
968
|
+
|
|
969
|
+
#### A Laravel 422
|
|
970
|
+
|
|
971
|
+
Every provider's shape and its one-line bridge (Inertia visits, error bags
|
|
972
|
+
and `useForm`, a Laravel 422, Precognition, vee-validate, Nuxt UI):
|
|
973
|
+
[Error providers](./guides/validation-providers.md).
|
|
974
|
+
|
|
975
|
+
`setErrors` takes Laravel's `{ key: string[] }` and Inertia's
|
|
976
|
+
`{ key: string }` (a string is read as one message). Keys are field paths,
|
|
977
|
+
dots or brackets (`address.city`, `address[city]`), matched against `fields`.
|
|
978
|
+
It returns nothing: read the state afterwards.
|
|
979
|
+
|
|
980
|
+
```vue
|
|
981
|
+
<script setup lang="ts">
|
|
982
|
+
import {
|
|
983
|
+
BbAlert,
|
|
984
|
+
BbButton,
|
|
985
|
+
BbForm,
|
|
986
|
+
BbTextInput,
|
|
987
|
+
useBbFormContext,
|
|
988
|
+
} from 'bitboss-ui';
|
|
989
|
+
|
|
990
|
+
const form = useBbFormContext('signup');
|
|
991
|
+
|
|
992
|
+
const save = async (values: Record<string, unknown>) => {
|
|
993
|
+
const response = await fetch('/api/signup', {
|
|
994
|
+
method: 'POST',
|
|
995
|
+
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
|
996
|
+
body: JSON.stringify(values),
|
|
997
|
+
});
|
|
998
|
+
if (response.status === 422) {
|
|
999
|
+
const body = await response.json(); // { message, errors: { email: ['…'] } }
|
|
1000
|
+
form.setErrors(body.errors);
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
</script>
|
|
1004
|
+
|
|
1005
|
+
<template>
|
|
1006
|
+
<BbForm
|
|
1007
|
+
id="signup"
|
|
1008
|
+
v-slot="{ errors, unmatchedErrors, isSubmitting }"
|
|
1009
|
+
@submit="save"
|
|
1010
|
+
>
|
|
1011
|
+
<!-- Every error in one summary: the two maps never share a path. -->
|
|
1012
|
+
<BbAlert
|
|
1013
|
+
v-if="Object.keys({ ...errors, ...unmatchedErrors }).length"
|
|
1014
|
+
variant="destructive"
|
|
1015
|
+
>
|
|
1016
|
+
<p
|
|
1017
|
+
v-for="(messages, path) in { ...errors, ...unmatchedErrors }"
|
|
1018
|
+
:key="path"
|
|
1019
|
+
>
|
|
1020
|
+
{{ messages[0] }}
|
|
1021
|
+
</p>
|
|
1022
|
+
</BbAlert>
|
|
1023
|
+
<BbTextInput label="Email" name="email" type="email" />
|
|
1024
|
+
<BbTextInput label="City" name="address[city]" />
|
|
1025
|
+
<BbButton :loading="isSubmitting" type="submit">Create account</BbButton>
|
|
1026
|
+
</BbForm>
|
|
1027
|
+
</template>
|
|
1028
|
+
```
|
|
1029
|
+
|
|
1030
|
+
- A key that names a field lands on it: under the field, and in
|
|
1031
|
+
`fields[path].errors`. It clears when the user edits the field or it is
|
|
1032
|
+
validated again, like any message.
|
|
1033
|
+
- A key that names no field (`plan`, `payment`) is never dropped: it goes in
|
|
1034
|
+
`unmatchedErrors`, and ONLY there — no field shows it, so render it (the
|
|
1035
|
+
summary above).
|
|
1036
|
+
- A key for a field that is not on screen (a wizard step you left) shows
|
|
1037
|
+
nowhere on the page until that step is back. Show the merged summary, or
|
|
1038
|
+
count `fields` per step and jump (next section). If a field with that path mounts
|
|
1039
|
+
later, the message moves onto it.
|
|
1040
|
+
- A request-level message (Laravel's `message`, a 403) has no path: give it a
|
|
1041
|
+
key no field uses IN THE SAME CALL, `form.setErrors({ ...body.errors, _request: [body.message] })`, and it
|
|
1042
|
+
shows in the same summary.
|
|
1043
|
+
- **Each `setErrors` call replaces the last one's errors** (it is one server
|
|
1044
|
+
answer). Two calls in a row keep only the second: merge everything into one
|
|
1045
|
+
map first.
|
|
1046
|
+
- `setErrors` does not emit `invalid` and does not move focus.
|
|
1047
|
+
|
|
1048
|
+
#### Fields on a step you left, and the step badge
|
|
1049
|
+
|
|
1050
|
+
With `keep-values-on-unmount`, a field that unmounts **stays in `fields`**,
|
|
1051
|
+
`mounted: false`, as the form keeps its value. So a server error for the step
|
|
1052
|
+
the user left still lands (in `fields`, shown when the step comes back), and
|
|
1053
|
+
a wizard can count errors per step:
|
|
1054
|
+
|
|
1055
|
+
```vue
|
|
1056
|
+
<script setup lang="ts">
|
|
1057
|
+
import { computed } from 'vue';
|
|
1058
|
+
import { BbBadge, useBbFormContext } from 'bitboss-ui';
|
|
1059
|
+
|
|
1060
|
+
const form = useBbFormContext('checkout');
|
|
1061
|
+
const STEPS = [
|
|
1062
|
+
{ title: 'Account', paths: ['email', 'password'] },
|
|
1063
|
+
{ title: 'Shipping', paths: ['address.street', 'address.city'] },
|
|
1064
|
+
];
|
|
1065
|
+
const badges = computed(() =>
|
|
1066
|
+
STEPS.map(
|
|
1067
|
+
(step) =>
|
|
1068
|
+
step.paths.filter((path) => form.fields.value[path]?.errors.length).length
|
|
1069
|
+
)
|
|
1070
|
+
);
|
|
1071
|
+
// After form.setErrors(…): open the first step that has one.
|
|
1072
|
+
const firstFailing = () => badges.value.findIndex((count) => count > 0);
|
|
1073
|
+
</script>
|
|
1074
|
+
|
|
1075
|
+
<template>
|
|
1076
|
+
<ol>
|
|
1077
|
+
<li v-for="(step, index) in STEPS" :key="step.title">
|
|
1078
|
+
{{ step.title }}
|
|
1079
|
+
<BbBadge v-if="badges[index]" size="sm" variant="destructive">{{
|
|
1080
|
+
badges[index]
|
|
1081
|
+
}}</BbBadge>
|
|
1082
|
+
</li>
|
|
1083
|
+
</ol>
|
|
1084
|
+
</template>
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
Without `keep-values-on-unmount`, a field that unmounts leaves `fields`, so an
|
|
1088
|
+
error for a hidden step is in `unmatchedErrors` instead. The Inertia fixture
|
|
1089
|
+
(`fixtures/inertia/e2e/validated-server-errors.e2e.mjs`) runs both a real
|
|
1090
|
+
Inertia redirect-back and a real 422 through this page shape.
|
|
1091
|
+
|
|
1092
|
+
#### Rows (`v-for`)
|
|
1093
|
+
|
|
1094
|
+
Your array is the truth. Bind the form to the object that holds it, name
|
|
1095
|
+
each field by its index (which is also how Laravel answers, `lines.1.qty`)
|
|
1096
|
+
and key the rows by a stable id when they have one (keying by index works
|
|
1097
|
+
too). Add, delete and reorder by changing the array, with nothing else to
|
|
1098
|
+
call, whether the form keeps values on unmount or not:
|
|
1099
|
+
|
|
1100
|
+
```vue
|
|
1101
|
+
<script setup lang="ts">
|
|
1102
|
+
import { reactive } from 'vue';
|
|
1103
|
+
import { BbButton, BbForm, BbNumberInput, BbTextInput } from 'bitboss-ui';
|
|
1104
|
+
|
|
1105
|
+
let nextId = 3;
|
|
1106
|
+
const order = reactive({
|
|
1107
|
+
lines: [
|
|
1108
|
+
{ id: 1, product: 'Espresso', qty: 1 },
|
|
1109
|
+
{ id: 2, product: 'Cortado', qty: 2 },
|
|
1110
|
+
],
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
async function save(values: Record<string, unknown>) {
|
|
1114
|
+
await fetch('/api/orders', { method: 'POST', body: JSON.stringify(values) });
|
|
1115
|
+
}
|
|
1116
|
+
</script>
|
|
1117
|
+
|
|
1118
|
+
<template>
|
|
1119
|
+
<BbForm v-model="order" @submit="save">
|
|
1120
|
+
<div v-for="(line, i) in order.lines" :key="line.id">
|
|
1121
|
+
<BbTextInput
|
|
1122
|
+
:label="`Product ${i + 1}`"
|
|
1123
|
+
:name="`lines[${i}][product]`"
|
|
1124
|
+
rules="required"
|
|
1125
|
+
/>
|
|
1126
|
+
<BbNumberInput
|
|
1127
|
+
:label="`Quantity ${i + 1}`"
|
|
1128
|
+
:name="`lines[${i}][qty]`"
|
|
1129
|
+
rules="required|min_value:1"
|
|
1130
|
+
/>
|
|
1131
|
+
<BbButton type="button" variant="ghost" @click="order.lines.splice(i, 1)">
|
|
1132
|
+
Remove
|
|
1133
|
+
</BbButton>
|
|
1134
|
+
</div>
|
|
1135
|
+
<BbButton
|
|
1136
|
+
type="button"
|
|
1137
|
+
@click="order.lines.push({ id: nextId++, product: '', qty: 1 })"
|
|
1138
|
+
>
|
|
1139
|
+
Add a line
|
|
1140
|
+
</BbButton>
|
|
1141
|
+
<BbButton type="submit" variant="primary">Save</BbButton>
|
|
1142
|
+
</BbForm>
|
|
1143
|
+
</template>
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
After the page re-renders, the form follows: a row that moved up keeps its
|
|
1147
|
+
own value (and, keyed by id, its error), and the rows no longer in the array
|
|
1148
|
+
leave the values, the errors and `fields`. `@submit` gets exactly the rows on
|
|
1149
|
+
the page, in their order.
|
|
1150
|
+
|
|
1151
|
+
**Rows from an array the form is not bound to** (each field with its own
|
|
1152
|
+
`v-model="line.qty"`) work too, with one extra call in a form with
|
|
1153
|
+
`keep-values-on-unmount`: `useBbFormContext(id).removeField(`lines.${i}`)`
|
|
1154
|
+
beside the `splice`. Such a form keeps a field's value when it unmounts on
|
|
1155
|
+
purpose (a wizard step), so it cannot tell a deleted row from one on another
|
|
1156
|
+
step. Call it in the same tick as your `splice` or later; it removes each row
|
|
1157
|
+
once. Without keep-values, a delete needs nothing else. Prefer the bound
|
|
1158
|
+
object.
|
|
1159
|
+
|
|
1160
|
+
With index keys, a delete moves the fields' values but not their state, so a
|
|
1161
|
+
row's client error clears until it is checked again; keyed by id, the error
|
|
1162
|
+
moves with the row. An error never lands on another row.
|
|
74
1163
|
|
|
75
1164
|
### Reading form state in the slot
|
|
76
1165
|
|
|
77
1166
|
The default slot is scoped, so the chrome around the fields can react without
|
|
78
1167
|
lifting state into the page. It carries `values`, `isSubmitting`, `submitCount`,
|
|
79
|
-
`validate`, `resetForm`,
|
|
1168
|
+
`validate`, `resetForm`, `fields`, `errors`, `unmatchedErrors`, `setErrors`,
|
|
1169
|
+
`removeField`, plus vee-validate's own `meta` flags (`valid`, `dirty`,
|
|
80
1170
|
`touched`, `pending`).
|
|
81
1171
|
|
|
82
1172
|
```vue
|
|
@@ -120,8 +1210,13 @@ through the layout.
|
|
|
120
1210
|
```vue
|
|
121
1211
|
<script setup lang="ts">
|
|
122
1212
|
import { ref } from 'vue';
|
|
123
|
-
import {
|
|
124
|
-
|
|
1213
|
+
import {
|
|
1214
|
+
BbButton,
|
|
1215
|
+
BbDialog,
|
|
1216
|
+
BbForm,
|
|
1217
|
+
BbTextInput,
|
|
1218
|
+
useBbFormContext,
|
|
1219
|
+
} from 'bitboss-ui';
|
|
125
1220
|
|
|
126
1221
|
const open = ref(false);
|
|
127
1222
|
const invite = useBbFormContext('invite-teammate');
|
|
@@ -175,17 +1270,19 @@ autofill, `required` is announced by screen readers — so the fix is not to dro
|
|
|
175
1270
|
them; it is to stop the browser from gating submission. `novalidate` leaves
|
|
176
1271
|
every attribute in the DOM and changes only who decides.
|
|
177
1272
|
|
|
178
|
-
The consequence to know: a field inside `<BbForm>` that is **not**
|
|
179
|
-
|
|
180
|
-
knows about registered fields, and the browser has stepped
|
|
181
|
-
controls
|
|
182
|
-
|
|
1273
|
+
The consequence to know: a field inside `<BbForm>` that is **not** one of the
|
|
1274
|
+
library's form controls (a plain `<input>`) is not validated at all —
|
|
1275
|
+
vee-validate only knows about registered fields, and the browser has stepped
|
|
1276
|
+
aside. Use the library's controls, or `formless` for a control that should stay
|
|
1277
|
+
out.
|
|
183
1278
|
|
|
184
1279
|
#### There is no template-ref handle
|
|
185
1280
|
|
|
186
|
-
`BbForm`
|
|
187
|
-
|
|
188
|
-
|
|
1281
|
+
`BbForm` exposes exactly one thing — `$el`, the native `<form>` — and nothing
|
|
1282
|
+
else, so a template ref gives you no `form.value.submitForm()` / `.isValid` /
|
|
1283
|
+
`.validate()` / `.reset()`. That is deliberate, not an oversight: state and
|
|
1284
|
+
actions live on `useBbFormContext(id)`, so there is no second,
|
|
1285
|
+
instance-shaped API to keep in step with it. Use the context for all four.
|
|
189
1286
|
|
|
190
1287
|
The native form element is still right there, though — `$el` is public-instance
|
|
191
1288
|
API and unaffected:
|
|
@@ -212,25 +1309,53 @@ cast, and does not depend on the root element staying a `<form>`.
|
|
|
212
1309
|
|
|
213
1310
|
### Required markers
|
|
214
1311
|
|
|
215
|
-
|
|
216
|
-
|
|
1312
|
+
With the plugin's `requiredAsterisk: true` option on (it is off by default —
|
|
1313
|
+
see [Validated Forms § Required asterisk](./guides/validated-forms.md)), a field
|
|
1314
|
+
whose rules include `required` renders a red asterisk beside its label
|
|
1315
|
+
([`BbAsterisk`](./BbAsterisk.md) does the drawing).
|
|
1316
|
+
|
|
1317
|
+
With a `schema`, the schema decides, with every Standard Schema
|
|
1318
|
+
library above: a field gets the asterisk when its key is required in the
|
|
1319
|
+
schema (not optional, no default, not nullable, and its parent object required
|
|
1320
|
+
too). Zod 4, ArkType and Joi are read through their JSON Schema; Zod 3, Yup,
|
|
1321
|
+
Valibot and Effect through their own schema shape — nothing to wrap, no
|
|
1322
|
+
`required` to add. The
|
|
1323
|
+
marker follows a per-step schema as it changes, and a field the schema requires
|
|
1324
|
+
also gets the native `required` attribute (inert under `novalidate`), so
|
|
1325
|
+
assistive tech hears what the aria-hidden asterisk shows.
|
|
1326
|
+
|
|
1327
|
+
You only place
|
|
217
1328
|
that component yourself when you have replaced a control's `label` slot with
|
|
218
|
-
custom content — the
|
|
1329
|
+
custom content — the control hands you `showAsterisk` in the slot scope so the
|
|
219
1330
|
marker stays consistent with the rules.
|
|
220
1331
|
|
|
1332
|
+
## v-model
|
|
1333
|
+
|
|
1334
|
+
- `v-model` — type: `Record<string, any> \| undefined`
|
|
1335
|
+
|
|
221
1336
|
## Props
|
|
222
1337
|
|
|
223
1338
|
| Prop | Type | Default | Required | Description |
|
|
224
1339
|
| --- | --- | --- | --- | --- |
|
|
225
|
-
| `id` | `string \| undefined` | | | Explicit id, so anything outside the form can read and drive it through `useBbFormContext(id)` — a dialog footer's submit button, a page toolbar, a leave guard. Omit it when the form is self-contained: the slot scope already carries the
|
|
1340
|
+
| `id` | `string \| undefined` | | | Explicit id, so anything outside the form can read and drive it through `useBbFormContext(id)` — a dialog footer's submit button, a page toolbar, a leave guard. Omit it when the form is self-contained: the slot scope already carries the same state for chrome that lives inside. |
|
|
1341
|
+
| `keepValuesOnUnmount` | `boolean \| Ref<boolean, boolean> \| undefined` | | | Keep a field's value (and its place in `@submit`) when it unmounts — the `v-if` wizard step you left, a collapsed section. Off, an unmounted field drops out of the values. |
|
|
1342
|
+
| `modelValue` | `Record<string, any> \| undefined` | | | Any reactive object (a `reactive({})`, a `ref({})`, Inertia's `useForm()`) that holds the fields' values, both ways, updated IN PLACE, never replaced. A field without its own `v-model` starts from the value at its path (its `name`, else its slugged label), writes every change back there (nested paths created: `lines[0][qty]` → `lines[0].qty`), and follows the page's own writes (`values.email = 'x'`, `form.reset()`). Keys no field owns are never touched. Nothing is written on mount. A field's own `v-model` wins over it. |
|
|
1343
|
+
| `schema` | `MaybeRef<S \| undefined>` | | | One schema for the whole form: any Standard Schema — Zod (3.24+, 4), Valibot, ArkType, Yup, Joi, Effect — passed as it is, no adapter (the vee-validate option underneath is `validationSchema`). Errors land on the field whose `name` is the issue path (`address.city` or `address[city]`, `items.0.qty`), and `@submit` receives the schema's output (transforms applied) typed from it, and the required asterisk comes from the schema (every library above). A vee-validate `toTypedSchema(...)` or rules object works too. Reactive: pass a `computed` to validate a wizard one step at a time. It must be set when the form mounts; it can change, not appear later. While a schema is set, per-field `rules` are ignored (vee-validate's design). |
|
|
1344
|
+
| `validationMode` | `ValidationMode \| undefined` | | | When the fields inside check themselves while the user works: `aggressive`, `balanced`, `lazy`, `submit-only` or `submit-live` (see `ValidationMode`). A field's own `validation-mode` wins. Unset, the app's `formControls.validationMode` applies (`'balanced'` by default). |
|
|
226
1345
|
|
|
227
1346
|
## Events
|
|
228
1347
|
|
|
229
|
-
- `
|
|
1348
|
+
- `invalid` — `(payload: BbFormInvalidPayload): void` — Fired when a submit fails validation, after the form has focused the first invalid field that is on screen. `errors` also holds paths with no field showing, so a wizard can jump to the step that has one.
|
|
1349
|
+
- `submit` — `(values: BbFormSubmitValues<S>): void` — Fired only when every field passes. Carries the values — with a schema, its parsed OUTPUT (transforms and coercions applied), typed from it.
|
|
1350
|
+
- `update:modelValue` — `(value: Record<string, any>): void` — The bound object after a field wrote into it — the SAME object, updated in place, so a `ref` keeps its identity.
|
|
230
1351
|
|
|
231
1352
|
## Slots
|
|
232
1353
|
|
|
233
|
-
- `default` — scope: `{ touched: boolean; dirty: boolean; valid: boolean; pending: boolean; initialValues?: Partial<GenericObject> \| undefined;
|
|
1354
|
+
- `default` — scope: `{ touched: boolean; dirty: boolean; valid: boolean; pending: boolean; initialValues?: Partial<GenericObject> \| undefined; errors: Record<string, string[]>; fie…`
|
|
1355
|
+
|
|
1356
|
+
## Exposed (template ref)
|
|
1357
|
+
|
|
1358
|
+
- `$el`: `HTMLFormElement \| null` — The rendered element.
|
|
234
1359
|
|
|
235
1360
|
## See Also
|
|
236
1361
|
|