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/BbTable.md
CHANGED
|
@@ -8,6 +8,23 @@
|
|
|
8
8
|
- Usage rule: Prefer this component for consumer-facing implementations.
|
|
9
9
|
- Implementation source (only when the contract below is not enough): [source/BbTable.md](./source/BbTable.md)
|
|
10
10
|
|
|
11
|
+
## Reachable through `BbTable`
|
|
12
|
+
|
|
13
|
+
`BbTable` mounts other components (all of them: _Component tree_, near the end). These are the parts of its API that land inside them. Prefer these over `:deep()` on an inner class (allowed, unsupported: it can break on upgrade) — and never an import of an internal component.
|
|
14
|
+
|
|
15
|
+
| pt part | Lands on | In |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| `pt:selectIcon` | the root of `BbBaseCheckboxIcon` | `BbBaseCheckboxIcon` ([contract](./BbBaseCheckboxIcon.md)) |
|
|
18
|
+
|
|
19
|
+
**CSS variables you can set through those parts** — declared deeper in the tree, so set one on the part that reads it (`pt:<part>="[--name:value]"`), never on `BbTable`'s root:
|
|
20
|
+
|
|
21
|
+
| Variable | Set through | Declared by | What it is |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| `--r` | `pt:selectIcon` | `BbBaseCheckboxIcon` | The checkbox corner, capped by the master radius so a zero- or small-radius theme reaches it. Not `--bb-radius-sm`: that tier is 4.8px at the shipped radius and this glyph ships at 4px. |
|
|
24
|
+
| `--ring-color` | `pt:selectIcon` | `BbBaseCheckboxIcon` | The focus ring's colour, re-pointed by errors and warnings. Both ring declarations read it, so a focused glyph grows its ring in its own colour instead of tweening from a different one. |
|
|
25
|
+
| `--elev` | `pt:selectIcon` | `BbBaseCheckboxIcon` | Resting lift; a no-op until a theme pins `--bb-elev`. |
|
|
26
|
+
| `--bg` | `pt:selectIcon` | `BbBaseCheckboxIcon` | The glyph plate. DECLARED here, not consumed bare, because this glyph renders inside surfaces that declare `--bg` themselves — a table row or header cell, a dialog, an off-canvas sheet. Without the declaration it would inherit that surface's fill, which happens to match at the shipped default and would diverge the moment anyone writes `.my-table { --bg: … }`. Identical to the raw tokens it replaces at every theme. |
|
|
27
|
+
|
|
11
28
|
## Usage & Guidelines
|
|
12
29
|
|
|
13
30
|
### When to use
|
|
@@ -25,18 +42,20 @@ keyboard navigation, so your markup stays a column definition plus a few slots.
|
|
|
25
42
|
domain objects straight to `items` and set `item-value` for stable row
|
|
26
43
|
identity — never pre-map rows into `{ label, value }` shapes.
|
|
27
44
|
|
|
28
|
-
The table **reports** state (sort, selection, page, expansion,
|
|
29
|
-
through v-models; it never
|
|
45
|
+
The table **reports** state (sort, column order, selection, page, expansion,
|
|
46
|
+
highlight) through v-models; it never sorts, slices, or fetches on its own. You apply
|
|
30
47
|
that state to your data source (client-side or via `dependencies`-driven
|
|
31
48
|
refetch). This keeps it equally at home in a client-only screen and a
|
|
32
49
|
server-paginated one.
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
**Every row in `items` mounts to the DOM unless you say `virtual`.** A few
|
|
52
|
+
hundred rows is fine for a client-only screen. Past roughly 1,000 rows,
|
|
53
|
+
either page it — feed `BbTable` the current slice as `items` and pass `page`
|
|
54
|
+
/ `per-page` / `total-items` (see § Pagination) so the server, not the DOM,
|
|
55
|
+
holds the rest — or, when the whole dataset legitimately lives in the
|
|
56
|
+
browser (local filtering, a spreadsheet-shaped tool), add `virtual` and let
|
|
57
|
+
the table window its rows (see § Virtual rows). The two compose: a large
|
|
58
|
+
page can be windowed.
|
|
40
59
|
|
|
41
60
|
### Columns: the full grammar
|
|
42
61
|
|
|
@@ -55,17 +74,30 @@ needs is declared here, not in markup:
|
|
|
55
74
|
`align` prop sets the default for the whole table (`left`).
|
|
56
75
|
- **`width`** freezes the column: numbers and bare numeric strings are px
|
|
57
76
|
(`130`, `'130'`); anything carrying a unit passes through (`'12rem'`,
|
|
58
|
-
`'20%'`).
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
`'20%'`). A declared width is the column's grid track and holds exactly;
|
|
78
|
+
unfrozen columns size to their content and share any leftover space equally
|
|
79
|
+
(the table is a CSS grid — the tracks are the width API, there is no
|
|
80
|
+
`table-layout`). An unfrozen text column also has a **floor estimated from
|
|
81
|
+
what it shows**: short values (IDs, emails, dates) ask for one line, prose
|
|
82
|
+
for about three, fitted to the room the sized columns leave — short values
|
|
83
|
+
give way first and wrap, prose keeps at least half its width, and only then
|
|
84
|
+
does the table scroll sideways. The header is always part of that floor, so
|
|
85
|
+
a heading never clips. No floor on `fixed` or `virtual` tables, slot
|
|
86
|
+
columns, or under a custom `#thead`. A grid keyword or function is the track as written:
|
|
87
|
+
`'auto'`, `'2fr'`, `'minmax(0, 1fr)'` (a share that may shrink below its
|
|
88
|
+
content), `'fit-content(200px)'`. When _every_ column declares a length, the
|
|
89
|
+
lengths become floors and the surplus is shared in proportion to their
|
|
90
|
+
numbers (`120` and `'8rem'` share 120 : 8, whatever the units), so the table
|
|
91
|
+
still fills its container. Leave one column without a width if it alone
|
|
92
|
+
should take the leftover space.
|
|
61
93
|
- **`skeleton`** picks the loading placeholder shape (see Loading below).
|
|
62
94
|
- **`sortable` / `sorted`** — see Sorting.
|
|
63
95
|
- **`thClass` / `tdClass` / `rowClass`** style the header cell, the data cells,
|
|
64
|
-
and the whole
|
|
96
|
+
and the whole row. `tdClass` and `rowClass` may be functions
|
|
65
97
|
`(content, key, item) => Classes` for state-dependent styling. Table-level
|
|
66
98
|
`thClass` / `tdClass` / `rowClass` / `headerRowClass` apply everywhere; a
|
|
67
99
|
row's classes accumulate the table `rowClass` plus every column's.
|
|
68
|
-
- **`snap`**
|
|
100
|
+
- **`snap`** names the parent column a nested table's column sits under — see
|
|
69
101
|
Nested tables.
|
|
70
102
|
|
|
71
103
|
**Columns, formatters and a per-row class**
|
|
@@ -73,7 +105,7 @@ needs is declared here, not in markup:
|
|
|
73
105
|
```vue
|
|
74
106
|
<template>
|
|
75
107
|
<div
|
|
76
|
-
class="max-w-2xl overflow-hidden rounded-
|
|
108
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
77
109
|
>
|
|
78
110
|
<BbTable
|
|
79
111
|
caption="Recent invoices"
|
|
@@ -155,11 +187,11 @@ const invoices: Invoice[] = [
|
|
|
155
187
|
},
|
|
156
188
|
];
|
|
157
189
|
|
|
158
|
-
// `row-class` is applied to each
|
|
190
|
+
// `row-class` is applied to each row (`.bb-table__row`); use it to flag rows by state. Soft amber
|
|
159
191
|
// wash matches the design-language attention accent — public API, no internals.
|
|
160
192
|
const rowClass = (invoice: Invoice) =>
|
|
161
193
|
invoice.status === 'overdue'
|
|
162
|
-
? 'bg-[color
|
|
194
|
+
? 'bg-[color-mix(in_oklab,#d97706_8%,var(--bb-panel))]'
|
|
163
195
|
: '';
|
|
164
196
|
</script>
|
|
165
197
|
```
|
|
@@ -194,20 +226,29 @@ pre-mapping your items:
|
|
|
194
226
|
```
|
|
195
227
|
|
|
196
228
|
**`actions` and `select` are not columns.** Both are rendered by the table
|
|
197
|
-
itself
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
229
|
+
itself: the selection column from the `selectable` prop, the actions column
|
|
230
|
+
from the `#actions` slot — providing the slot is what creates the column,
|
|
231
|
+
there is no prop. Putting `{ key: 'actions' }` in `columns` adds an ordinary
|
|
232
|
+
data column that reads `item.actions`, so you get a stray empty cell next to
|
|
233
|
+
the real one, and a `#actions` slot then fills both, rendering twice per row.
|
|
234
|
+
The same goes for any column keyed like one of the table's own slots
|
|
235
|
+
(`select`, `expand`, `loading`, `thead`, `tbody`, `tfoot`): its `#<key>` cell
|
|
236
|
+
slot is the table's slot. Dev builds warn, and `bitboss-ui check` flags the key
|
|
237
|
+
when `columns` is a literal array in the same file.
|
|
202
238
|
|
|
203
239
|
### Custom cells and headers
|
|
204
240
|
|
|
205
241
|
Override any column's body with a `#<key>` slot and its header with a
|
|
206
|
-
`#header:<key>` slot. The slot name is the key
|
|
207
|
-
|
|
208
|
-
`address.city` → `#
|
|
209
|
-
`#issued-at`,
|
|
210
|
-
|
|
242
|
+
`#header:<key>` slot. The slot name is the key through `slotKey`, which is
|
|
243
|
+
**kebab-case**: words split at separators, camelCase humps and digits,
|
|
244
|
+
lowercased, joined by `-` — `address.city` → `#address-city`, `issuedAt` →
|
|
245
|
+
`#issued-at`, `first_name` → `#first-name` (and `address2` → `#address-2`).
|
|
246
|
+
For a key with accents, non-Latin letters or punctuation — or whenever you are
|
|
247
|
+
not sure — write the name through the function instead of by hand:
|
|
248
|
+
`#[slotKey('Qualità')]`, with `import { slotKey } from 'bitboss-ui'`; the same
|
|
249
|
+
goes for slot names built in code (columns from config, a dynamic `<template>`
|
|
250
|
+
loop). A hand copy that differs by one character makes the slot silently never
|
|
251
|
+
match; `bitboss-ui check` catches it when `columns` is in the same file. Keep the column in `columns`
|
|
211
252
|
even when you fully slot it: label, alignment and width still come from there.
|
|
212
253
|
|
|
213
254
|
Body cell scope: `content` (the formatted value), `item` (raw row), `value`
|
|
@@ -217,7 +258,24 @@ Body cell scope: `content` (the formatted value), `item` (raw row), `value`
|
|
|
217
258
|
one-way state; the `toggle*` callbacks are the write path.
|
|
218
259
|
|
|
219
260
|
Header scope: `label`, `items` (the full list — handy for counts), `sortable`,
|
|
220
|
-
`sortOrder`, `toggleSort`, `
|
|
261
|
+
`sortOrder`, `toggleSort`, `hideColumn` (hides the column, see "Column
|
|
262
|
+
visibility"), `classes`.
|
|
263
|
+
|
|
264
|
+
**Add beside a header instead of replacing it** with
|
|
265
|
+
`#header:<key>:prepend` / `#header:<key>:append` — rendered before / after the
|
|
266
|
+
column's existing header content (the label + sort control, or your own
|
|
267
|
+
`#header:<key>` replacement), so a resize grip or reorder handle no longer
|
|
268
|
+
costs you the built-in sort button. The table-wide pair `#header:prepend` /
|
|
269
|
+
`#header:append` applies one template to every data column's header (never the
|
|
270
|
+
structural select/actions cells); both forms receive the header scope above
|
|
271
|
+
plus `columnKey` (the raw column key) so a table-wide template can branch per
|
|
272
|
+
column. When both a per-column and the table-wide slot are provided for the
|
|
273
|
+
same side, the per-column one wins for that column — they never stack. Affixes
|
|
274
|
+
render even beside a full `#header:<key>` replacement (the same rule as
|
|
275
|
+
BbDropdown's `#<key>:prepend/append`). One caveat: a column key that
|
|
276
|
+
normalizes to `prepend` or `append` collides with the table-wide slot names;
|
|
277
|
+
the table-wide interpretation wins, per-column header slots are unavailable
|
|
278
|
+
for that column, and dev builds warn.
|
|
221
279
|
|
|
222
280
|
Below, the status badges carry brand glyphs shipped in the app's `iconDir`,
|
|
223
281
|
referenced as `local:*` names on the badge's `prepend:icon`. Per the icons
|
|
@@ -231,7 +289,7 @@ CSS in a non-scoped style block.
|
|
|
231
289
|
```vue
|
|
232
290
|
<template>
|
|
233
291
|
<div
|
|
234
|
-
class="max-w-2xl overflow-hidden rounded-
|
|
292
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
235
293
|
>
|
|
236
294
|
<BbTable
|
|
237
295
|
caption="Invoice status"
|
|
@@ -240,10 +298,10 @@ CSS in a non-scoped style block.
|
|
|
240
298
|
item-value="id"
|
|
241
299
|
:items="invoices"
|
|
242
300
|
>
|
|
243
|
-
<!-- Cell slot: name = the column key
|
|
244
|
-
|
|
245
|
-
The glyphs are
|
|
246
|
-
`
|
|
301
|
+
<!-- Cell slot: name = the column key in kebab-case (`slotKey`:
|
|
302
|
+
`unitPrice` and `unit_price` are both `#unit-price`).
|
|
303
|
+
The glyphs are mapped to FULL icon literals, never template-composed
|
|
304
|
+
(`lucide:${status}` would defeat the build-time icon scan). -->
|
|
247
305
|
<template #status="{ content }">
|
|
248
306
|
<BbBadge
|
|
249
307
|
:prepend:icon="glyphs[content as Status]"
|
|
@@ -257,9 +315,7 @@ CSS in a non-scoped style block.
|
|
|
257
315
|
<template #header:amount="{ label }">
|
|
258
316
|
<span class="inline-flex items-center gap-1">
|
|
259
317
|
{{ label }}
|
|
260
|
-
<span class="text-xs font-normal text-
|
|
261
|
-
>EUR</span
|
|
262
|
-
>
|
|
318
|
+
<span class="text-xs font-normal text-(--bb-text-muted)">EUR</span>
|
|
263
319
|
</span>
|
|
264
320
|
</template>
|
|
265
321
|
</BbTable>
|
|
@@ -291,11 +347,11 @@ const labels: Record<Status, string> = {
|
|
|
291
347
|
overdue: 'Overdue',
|
|
292
348
|
};
|
|
293
349
|
|
|
294
|
-
// Status → full-name literals (icons policy: no `
|
|
350
|
+
// Status → full-name literals (icons policy: no `lucide:${status}` templates).
|
|
295
351
|
const glyphs: Record<Status, IconType> = {
|
|
296
|
-
paid: '
|
|
297
|
-
pending: '
|
|
298
|
-
overdue: '
|
|
352
|
+
paid: 'lucide:circle-check',
|
|
353
|
+
pending: 'lucide:clock',
|
|
354
|
+
overdue: 'lucide:circle-alert',
|
|
299
355
|
};
|
|
300
356
|
|
|
301
357
|
const variants: Record<Status, BadgeVariantType> = {
|
|
@@ -340,22 +396,22 @@ const invoices: Invoice[] = [
|
|
|
340
396
|
Non-scoped so variant classes on the child badge receive the accents. -->
|
|
341
397
|
<style>
|
|
342
398
|
.bb-badge.bb-badge--soft-green {
|
|
343
|
-
--accent:
|
|
399
|
+
--accent: var(--bb-success);
|
|
344
400
|
}
|
|
345
401
|
.bb-badge.bb-badge--soft-amber {
|
|
346
|
-
--accent:
|
|
402
|
+
--accent: var(--bb-warn);
|
|
347
403
|
}
|
|
348
404
|
.bb-badge.bb-badge--soft-red {
|
|
349
|
-
--accent:
|
|
405
|
+
--accent: var(--bb-danger);
|
|
350
406
|
}
|
|
351
407
|
.bb-badge.bb-badge--soft-green,
|
|
352
408
|
.bb-badge.bb-badge--soft-amber,
|
|
353
409
|
.bb-badge.bb-badge--soft-red {
|
|
354
410
|
--bg: color-mix(in oklab, var(--accent) 15%, var(--bb-panel));
|
|
355
|
-
--
|
|
356
|
-
--
|
|
411
|
+
--fg: color-mix(in oklab, var(--accent) 80%, var(--bb-text));
|
|
412
|
+
--bw: 1px;
|
|
357
413
|
--border-color: color-mix(in oklab, var(--accent) 25%, var(--bb-panel));
|
|
358
|
-
--ring: color-mix(in oklab, var(--accent) 45%, transparent);
|
|
414
|
+
--ring-color: color-mix(in oklab, var(--accent) 45%, transparent);
|
|
359
415
|
}
|
|
360
416
|
</style>
|
|
361
417
|
```
|
|
@@ -363,9 +419,12 @@ const invoices: Invoice[] = [
|
|
|
363
419
|
Beyond per-column slots, the structural slots cover every other region:
|
|
364
420
|
`#header:select` (the select-all cell content), `#header:actions`, `#select`
|
|
365
421
|
(replace the per-row checkbox/radio; scope: `item`, `value`, `checked`,
|
|
366
|
-
`disabled`, `readonly`, `inputName`, `toggleSelected`), `#loading`, `#
|
|
422
|
+
`disabled`, `readonly`, `inputName`, `toggleSelected`), `#loading`, `#empty`
|
|
367
423
|
(both below), and `#thead` / `#tbody` / `#tfoot` to replace an entire region
|
|
368
|
-
when you need full control (you then own its markup and semantics
|
|
424
|
+
when you need full control (you then own its markup and semantics: the table
|
|
425
|
+
is a CSS grid, so pass `<div role="row">` rows holding `<div role="cell">` /
|
|
426
|
+
`<div role="columnheader">` cells — never `<tr>`/`<td>`; a spanning cell uses
|
|
427
|
+
`grid-column: span N` with `#tfoot`'s `columnCount`, see **Styling hooks**).
|
|
369
428
|
|
|
370
429
|
### Loading and empty states
|
|
371
430
|
|
|
@@ -394,15 +453,16 @@ inert, so the busy state is always conveyed.
|
|
|
394
453
|
The `#loading` slot replaces the **skeleton**, so it follows the skeleton's rule:
|
|
395
454
|
it renders only when there is nothing to keep. (Scope: the current, possibly
|
|
396
455
|
stale `items` — handy for matching the previous row count.) When `items` resolves
|
|
397
|
-
empty the table shows its
|
|
398
|
-
`
|
|
399
|
-
full-width empty-state cell (already centred,
|
|
400
|
-
the content — a message, a "clear filters" button — not a
|
|
456
|
+
empty the table shows its empty row — localized default text, overridable via
|
|
457
|
+
`empty-text` or fully via the `#empty` slot. That slot fills the table's own
|
|
458
|
+
full-width empty-state cell (already centred, already spanning every column),
|
|
459
|
+
so pass the content — a message, a "clear filters" button — not a row of your
|
|
460
|
+
own.
|
|
401
461
|
|
|
402
462
|
`loading-text` is the loading row's `aria-live` announcement. Like
|
|
403
|
-
`
|
|
463
|
+
`empty-text` it has a **localized default** (`common.loadingText` —
|
|
404
464
|
"Loading…", translated in every shipped locale), so omitting it still
|
|
405
|
-
announces. Unlike `
|
|
465
|
+
announces. Unlike `empty-text` it is `sr-only`: it is never painted, the
|
|
406
466
|
skeleton carries the visual signal. Set it when a table-specific message beats
|
|
407
467
|
the generic one ("Loading invoices…"), not to avoid an empty announcement.
|
|
408
468
|
|
|
@@ -411,7 +471,7 @@ by analogy with `loading-text`. There is also no table-level error state: a
|
|
|
411
471
|
failed _server_ visit (Inertia, a full-page load) is a full error page, not
|
|
412
472
|
something the table renders inline. For a failed _client-side_ fetch (an
|
|
413
473
|
`items` provider function that rejects), catch it yourself and render the
|
|
414
|
-
failure through the `#
|
|
474
|
+
failure through the `#empty` slot — it's the one slot the table gives you
|
|
415
475
|
for "there is nothing to show, here's why."
|
|
416
476
|
|
|
417
477
|
**Skeletons and a custom empty state**
|
|
@@ -429,7 +489,7 @@ for "there is nothing to show, here's why."
|
|
|
429
489
|
</div>
|
|
430
490
|
|
|
431
491
|
<div
|
|
432
|
-
class="overflow-hidden rounded-
|
|
492
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
433
493
|
>
|
|
434
494
|
<BbTable
|
|
435
495
|
caption="Team members"
|
|
@@ -440,8 +500,8 @@ for "there is nothing to show, here's why."
|
|
|
440
500
|
:loading="loading"
|
|
441
501
|
loading-text="Loading members…"
|
|
442
502
|
>
|
|
443
|
-
<template #
|
|
444
|
-
<p class="p-3 text-center text-sm text-
|
|
503
|
+
<template #empty>
|
|
504
|
+
<p class="p-3 text-center text-sm text-(--bb-text-muted)">
|
|
445
505
|
No members match your filters yet.
|
|
446
506
|
</p>
|
|
447
507
|
</template>
|
|
@@ -515,7 +575,7 @@ type ItemsProvider<T> = (
|
|
|
515
575
|
<!-- `items` is an async function; the table re-runs it (debounced) whenever
|
|
516
576
|
an entry in `dependencies` changes, showing skeletons while it awaits. -->
|
|
517
577
|
<div
|
|
518
|
-
class="overflow-hidden rounded-
|
|
578
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
519
579
|
>
|
|
520
580
|
<BbTable
|
|
521
581
|
caption="Invoices"
|
|
@@ -597,6 +657,80 @@ pagination, confirm-delete, toasts) is the records workspace recipe
|
|
|
597
657
|
(`./recipes/vue/records-workspace.md`), which works unchanged under Inertia or
|
|
598
658
|
Nuxt since the table itself never touches the router.
|
|
599
659
|
|
|
660
|
+
### Filtering
|
|
661
|
+
|
|
662
|
+
**There is no `filter` prop, and its absence is not a gap.** Libraries that ship
|
|
663
|
+
one (Quasar's `filter` / `filter-method`, PrimeVue's per-column filters) are
|
|
664
|
+
answering two different questions with one name, and this table answers both
|
|
665
|
+
already — under names that do not contain the word "filter", which is the only
|
|
666
|
+
reason the story looks missing.
|
|
667
|
+
|
|
668
|
+
On a **server-driven** table, a filter is an input to the fetch. That is
|
|
669
|
+
`dependencies`: list your filter state and the provider re-runs, debounced, with
|
|
670
|
+
out-of-order responses discarded and the previous rows kept on failure. A
|
|
671
|
+
`filter` prop would be a second, weaker spelling of the same thing — one value
|
|
672
|
+
instead of many, and race handling left to you.
|
|
673
|
+
|
|
674
|
+
On a **client-side** table holding every row, filtering is a computed:
|
|
675
|
+
|
|
676
|
+
```vue
|
|
677
|
+
<BbTable :items="filteredItems" :columns="columns" />
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
Always correct, no new prop, and it cannot desync from a `total-items` count the
|
|
681
|
+
way a table that filtered its own rows behind your back would.
|
|
682
|
+
|
|
683
|
+
**The filter bar is Bb controls too.** A search box or a status filter above
|
|
684
|
+
the table still takes a `label` (it names the field for screen readers);
|
|
685
|
+
`hide-label` keeps it and hides it visually, so there is no reason to reach for
|
|
686
|
+
a native `<input>` / `<select>`:
|
|
687
|
+
|
|
688
|
+
```vue
|
|
689
|
+
<div class="flex items-end gap-2">
|
|
690
|
+
<BbTextInput
|
|
691
|
+
v-model="search"
|
|
692
|
+
label="Search invoices"
|
|
693
|
+
hide-label
|
|
694
|
+
placeholder="Search…"
|
|
695
|
+
clearable
|
|
696
|
+
/>
|
|
697
|
+
<BbSelect
|
|
698
|
+
v-model="statuses"
|
|
699
|
+
label="Status"
|
|
700
|
+
hide-label
|
|
701
|
+
multiple
|
|
702
|
+
:items="['draft', 'sent', 'paid']"
|
|
703
|
+
/>
|
|
704
|
+
</div>
|
|
705
|
+
<BbTable :items="filteredItems" :columns="columns" caption="Invoices" />
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
Pick the shape by where the rows come from:
|
|
709
|
+
|
|
710
|
+
| Your situation | The filter mechanism |
|
|
711
|
+
| -------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
712
|
+
| Server returns a page at a time | `:dependencies="[search, status, sort]"` — see § Async items and filters |
|
|
713
|
+
| A whole filtered listing, URL-mirrored | The records workspace recipe (chip rail, tabs, `useQueryObject`) |
|
|
714
|
+
| Filter UI inside one column's header | `#header:<key>:append` — keeps the built-in sort button (see § Custom cells and headers) |
|
|
715
|
+
| All rows already in memory | A computed feeding `items` |
|
|
716
|
+
|
|
717
|
+
For the **per-column** case, use the affix slot rather than a full
|
|
718
|
+
`#header:<key>` replacement, or you take over the sort button too:
|
|
719
|
+
|
|
720
|
+
```vue
|
|
721
|
+
<template #header:status:append>
|
|
722
|
+
<BbSelectPopover v-model="status" :items="statuses" />
|
|
723
|
+
</template>
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
The filter control is yours; the table's only job is to refetch when the value
|
|
727
|
+
lands in `dependencies`. That is the same division of labour as sorting, where
|
|
728
|
+
`v-model:sort` reports intent and your provider acts on it.
|
|
729
|
+
|
|
730
|
+
For a complete worked filter rail — one Filters menu, editable chips, URL
|
|
731
|
+
mirroring, tab counts — read the records workspace recipe rather than assembling
|
|
732
|
+
it here.
|
|
733
|
+
|
|
600
734
|
### Pagination
|
|
601
735
|
|
|
602
736
|
`BbTable` never slices its own data — you do, or the server does. Feed it the
|
|
@@ -615,7 +749,7 @@ the same page ref.
|
|
|
615
749
|
announcements (aria-rowcount / aria-rowindex); the actual slicing is
|
|
616
750
|
yours (or the server's). -->
|
|
617
751
|
<div
|
|
618
|
-
class="overflow-hidden rounded-
|
|
752
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
619
753
|
>
|
|
620
754
|
<BbTable
|
|
621
755
|
caption="Invoices"
|
|
@@ -628,8 +762,8 @@ the same page ref.
|
|
|
628
762
|
:total-items="invoices.length"
|
|
629
763
|
/>
|
|
630
764
|
</div>
|
|
631
|
-
<div class="flex items-center
|
|
632
|
-
<p class="text-xs text-
|
|
765
|
+
<div class="flex items-center gap-2">
|
|
766
|
+
<p class="shrink-0 text-xs whitespace-nowrap text-(--bb-text-muted)">
|
|
633
767
|
{{ rangeStart }}–{{ rangeEnd }} of {{ invoices.length }}
|
|
634
768
|
</p>
|
|
635
769
|
<BbPagination v-model="page" :total-pages="totalPages" />
|
|
@@ -685,14 +819,21 @@ scriptable from anywhere via `useBbTableContext`
|
|
|
685
819
|
### Sorting
|
|
686
820
|
|
|
687
821
|
Mark columns `sortable` and bind `v-model:sort` — an ordered
|
|
688
|
-
`BbTableSortEntry[]` (`[columnKey, 'asc' | 'desc']`).
|
|
689
|
-
|
|
822
|
+
`BbTableSortEntry[]` (`[columnKey, 'asc' | 'desc']`). A click anywhere on a
|
|
823
|
+
sortable header (its whitespace included — AG Grid parity; the built-in
|
|
824
|
+
button is the keyboard/AT control) cycles the column unsorted → asc → desc →
|
|
825
|
+
removed; a direction flip updates the entry in
|
|
690
826
|
place, so the column keeps its priority in a multi-column sort and other
|
|
691
827
|
entries are never touched. The array order **is** the priority: first entry
|
|
692
828
|
sorts first. The table only reports the model; **apply it to your data**
|
|
693
829
|
(client-side, as below) or forward it to the server as `orderBy` and refetch
|
|
694
830
|
via `dependencies`.
|
|
695
831
|
|
|
832
|
+
The affordance is one arrow: nothing at rest, a faint arrow previewed while
|
|
833
|
+
the header is hovered or focused, solid once the column is sorted (up for
|
|
834
|
+
ascending, down for descending — the AG Grid convention), gone again on the
|
|
835
|
+
third click.
|
|
836
|
+
|
|
696
837
|
**Sortable headers driving a client-side sort**
|
|
697
838
|
|
|
698
839
|
```vue
|
|
@@ -702,7 +843,7 @@ via `dependencies`.
|
|
|
702
843
|
cycle asc → desc → off; the table only REPORTS the model — you sort
|
|
703
844
|
the data. -->
|
|
704
845
|
<div
|
|
705
|
-
class="overflow-hidden rounded-
|
|
846
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
706
847
|
>
|
|
707
848
|
<BbTable
|
|
708
849
|
v-model:sort="sort"
|
|
@@ -713,7 +854,7 @@ via `dependencies`.
|
|
|
713
854
|
:items="sortedInvoices"
|
|
714
855
|
/>
|
|
715
856
|
</div>
|
|
716
|
-
<p class="text-xs text-
|
|
857
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
717
858
|
Sort model: <code>{{ JSON.stringify(sort) }}</code>
|
|
718
859
|
</p>
|
|
719
860
|
</div>
|
|
@@ -773,11 +914,295 @@ const sortedInvoices = computed(() => {
|
|
|
773
914
|
|
|
774
915
|
A custom `#header:<key>` slot replaces the built-in sort button, but its scope
|
|
775
916
|
hands you `sortOrder` and `toggleSort` so your header can keep sorting alive
|
|
776
|
-
(render your own button and call `toggleSort`).
|
|
917
|
+
(render your own button and call `toggleSort`). To merely add something next
|
|
918
|
+
to the control — a resize grip, a filter icon — use
|
|
919
|
+
`#header:<key>:prepend/append` instead and keep the built-in button (see
|
|
920
|
+
"Custom cells and headers"). The column-level `sorted`
|
|
777
921
|
field only seeds the header's `aria-sort` when no live model entry exists — it
|
|
778
922
|
does not move the visual indicator; to start pre-sorted, seed `v-model:sort`
|
|
779
923
|
instead (as the example does).
|
|
780
924
|
|
|
925
|
+
### Column order
|
|
926
|
+
|
|
927
|
+
`columns` declares what a column **is**; `v-model:order` is the order
|
|
928
|
+
it **renders** in — an array of column keys, the same split as `sortable` +
|
|
929
|
+
`v-model:sort`. Two things write it:
|
|
930
|
+
|
|
931
|
+
- **Your own control** — a column panel, a settings drawer, a persisted
|
|
932
|
+
preference. Bind the model and write the array; the table follows. No flag
|
|
933
|
+
needed for this.
|
|
934
|
+
- **The user, on the table** — with `reorderable`, every data header
|
|
935
|
+
is a grab surface: drag it and the column moves live under the pointer (AG
|
|
936
|
+
Grid style, a chip with the label follows), release to commit. The same
|
|
937
|
+
header row is also one keyboard tab stop (the AG Grid grammar): ←/→ move
|
|
938
|
+
focus between headers, **Shift+←/→** move the column one slot
|
|
939
|
+
(Shift+Home/End to the ends), Enter sorts a sortable header.
|
|
940
|
+
Each committed move writes the model once and is announced.
|
|
941
|
+
|
|
942
|
+
The model's contract is what makes a column panel trivial:
|
|
943
|
+
|
|
944
|
+
- Keys listed first render first; declared columns the array omits follow, in
|
|
945
|
+
declaration order (a column added to `columns` later renders last).
|
|
946
|
+
- A `hidden` column (next section) keeps its slot without rendering, and keys
|
|
947
|
+
that match no declared column render nothing but are **preserved in
|
|
948
|
+
place** — a column that exists only for some users comes back exactly where
|
|
949
|
+
it was.
|
|
950
|
+
- A user move relocates **exactly one key**; everything else, hidden keys
|
|
951
|
+
included, keeps its relative order. The first move on a partial (or empty)
|
|
952
|
+
model emits the completed array — every declared key, hidden ones included
|
|
953
|
+
— so persist that and the model is complete from then on.
|
|
954
|
+
- A drop that changes nothing emits nothing; unbound, the table keeps the
|
|
955
|
+
order as per-mount state like `sort`.
|
|
956
|
+
- The order is also on the table's context, like `sort`:
|
|
957
|
+
`useBbTableContext(id).order` reads and writes it from anywhere on the
|
|
958
|
+
page, so a "Columns" menu in the toolbar needs no props passed down.
|
|
959
|
+
Writing `[]` puts the columns back in declared order ("Reset order").
|
|
960
|
+
|
|
961
|
+
**Lock a column with `reorderable: false`** on its definition (beside
|
|
962
|
+
`sortable`). It stays where it is declared, and no other column can be dragged
|
|
963
|
+
or Shift+Arrowed past it: at an edge it is always first or last (the name
|
|
964
|
+
column, a row-actions column), in the middle it divides the header row into two
|
|
965
|
+
groups that reorder among themselves. Its header is not a grab surface (a click
|
|
966
|
+
still sorts), and Shift+Arrow on it does nothing. The lock binds what
|
|
967
|
+
**renders**, not the model: an `order` written by a panel or through the
|
|
968
|
+
context that places it elsewhere still shows it at its declared slot, and the
|
|
969
|
+
array is left as you wrote it. The next user move writes a complete array with
|
|
970
|
+
the lock in place.
|
|
971
|
+
|
|
972
|
+
**A column panel and the header drag sharing one order**
|
|
973
|
+
|
|
974
|
+
```vue
|
|
975
|
+
<template>
|
|
976
|
+
<div class="flex max-w-2xl flex-col gap-3">
|
|
977
|
+
<!-- ONE order, two writers: the panel's buttons and the table's own
|
|
978
|
+
header drag / keyboard handles both write `v-model:order`.
|
|
979
|
+
Visibility is a flag ON the definition (`hidden`), so a hidden
|
|
980
|
+
column stays declared, keeps its slot in the order, and comes back
|
|
981
|
+
where it was. -->
|
|
982
|
+
<ul
|
|
983
|
+
aria-label="Columns"
|
|
984
|
+
class="flex flex-wrap gap-2 text-xs text-(--bb-text-muted)"
|
|
985
|
+
>
|
|
986
|
+
<li
|
|
987
|
+
v-for="(column, index) in panelColumns"
|
|
988
|
+
:key="column.key"
|
|
989
|
+
class="flex items-center gap-1 rounded-(--bb-radius-sm) border border-(--bb-border) py-0.5 pr-1 pl-2"
|
|
990
|
+
>
|
|
991
|
+
<BbCheckbox
|
|
992
|
+
:label="column.label"
|
|
993
|
+
:model-value="!hidden.has(column.key)"
|
|
994
|
+
@update:model-value="setHidden(column.key, !$event)"
|
|
995
|
+
/>
|
|
996
|
+
<BbButton
|
|
997
|
+
:aria-label="`Move ${column.label} left`"
|
|
998
|
+
:disabled="index === 0"
|
|
999
|
+
icon="lucide:chevron-left"
|
|
1000
|
+
size="xs"
|
|
1001
|
+
variant="ghost"
|
|
1002
|
+
@click="move(column.key, -1)"
|
|
1003
|
+
/>
|
|
1004
|
+
<BbButton
|
|
1005
|
+
:aria-label="`Move ${column.label} right`"
|
|
1006
|
+
:disabled="index === panelColumns.length - 1"
|
|
1007
|
+
icon="lucide:chevron-right"
|
|
1008
|
+
size="xs"
|
|
1009
|
+
variant="ghost"
|
|
1010
|
+
@click="move(column.key, 1)"
|
|
1011
|
+
/>
|
|
1012
|
+
</li>
|
|
1013
|
+
</ul>
|
|
1014
|
+
<div
|
|
1015
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1016
|
+
>
|
|
1017
|
+
<BbTable
|
|
1018
|
+
v-model:order="order"
|
|
1019
|
+
caption="Invoices"
|
|
1020
|
+
:columns="columns"
|
|
1021
|
+
compact
|
|
1022
|
+
item-value="id"
|
|
1023
|
+
:items="invoices"
|
|
1024
|
+
reorderable
|
|
1025
|
+
@hide:column="(key) => setHidden(key, true)"
|
|
1026
|
+
>
|
|
1027
|
+
<!-- A "hide" control beside every header: the slot's `hideColumn()` is
|
|
1028
|
+
one-way (a hidden column has no header), so the panel above
|
|
1029
|
+
is what brings a column back. -->
|
|
1030
|
+
<template #header:append="{ hideColumn, label }">
|
|
1031
|
+
<BbButton
|
|
1032
|
+
:aria-label="`Hide ${label}`"
|
|
1033
|
+
icon="lucide:eye-off"
|
|
1034
|
+
size="xs"
|
|
1035
|
+
variant="ghost"
|
|
1036
|
+
@click="hideColumn"
|
|
1037
|
+
/>
|
|
1038
|
+
</template>
|
|
1039
|
+
</BbTable>
|
|
1040
|
+
</div>
|
|
1041
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
1042
|
+
Order model: <code>{{ JSON.stringify(order) }}</code> · hidden:
|
|
1043
|
+
<code>{{ JSON.stringify([...hidden]) }}</code>
|
|
1044
|
+
</p>
|
|
1045
|
+
</div>
|
|
1046
|
+
</template>
|
|
1047
|
+
<script setup lang="ts">
|
|
1048
|
+
import { computed, ref } from 'vue';
|
|
1049
|
+
import { BbButton, BbCheckbox, BbTable } from 'bitboss-ui';
|
|
1050
|
+
import type { BbTableColumn } from 'bitboss-ui';
|
|
1051
|
+
|
|
1052
|
+
type Invoice = {
|
|
1053
|
+
id: string;
|
|
1054
|
+
number: string;
|
|
1055
|
+
client: string;
|
|
1056
|
+
issued: string;
|
|
1057
|
+
amount: number;
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
const euro = new Intl.NumberFormat('en-IE', {
|
|
1061
|
+
style: 'currency',
|
|
1062
|
+
currency: 'EUR',
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
// The declaration: what a column IS. Never reordered, never filtered.
|
|
1066
|
+
const definitions: Array<BbTableColumn<Invoice>> = [
|
|
1067
|
+
{ key: 'number', label: 'Invoice', width: 110 },
|
|
1068
|
+
{ key: 'client', label: 'Client' },
|
|
1069
|
+
{ key: 'issued', label: 'Issued', width: 110 },
|
|
1070
|
+
{
|
|
1071
|
+
key: 'amount',
|
|
1072
|
+
label: 'Amount',
|
|
1073
|
+
align: 'right',
|
|
1074
|
+
width: 110,
|
|
1075
|
+
formatter: euro.format,
|
|
1076
|
+
},
|
|
1077
|
+
];
|
|
1078
|
+
|
|
1079
|
+
const invoices: Invoice[] = [
|
|
1080
|
+
{
|
|
1081
|
+
id: '1',
|
|
1082
|
+
number: 'INV-1041',
|
|
1083
|
+
client: 'Northwind Traders',
|
|
1084
|
+
issued: '2026-08-02',
|
|
1085
|
+
amount: 4200,
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
id: '2',
|
|
1089
|
+
number: 'INV-1042',
|
|
1090
|
+
client: 'Globex',
|
|
1091
|
+
issued: '2026-08-05',
|
|
1092
|
+
amount: 980,
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
id: '3',
|
|
1096
|
+
number: 'INV-1043',
|
|
1097
|
+
client: 'Initech',
|
|
1098
|
+
issued: '2026-08-11',
|
|
1099
|
+
amount: 15600,
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
id: '4',
|
|
1103
|
+
number: 'INV-1044',
|
|
1104
|
+
client: 'Umbrella',
|
|
1105
|
+
issued: '2026-08-19',
|
|
1106
|
+
amount: 2750,
|
|
1107
|
+
},
|
|
1108
|
+
];
|
|
1109
|
+
|
|
1110
|
+
// The state, both persistable as-is: render order (keys) and the hidden set.
|
|
1111
|
+
// A partial or empty order is fine — the first move writes back the
|
|
1112
|
+
// complete array, hidden keys in their slots, because every column stays
|
|
1113
|
+
// declared below.
|
|
1114
|
+
const order = ref<string[]>([]);
|
|
1115
|
+
const hidden = ref(new Set<string>());
|
|
1116
|
+
|
|
1117
|
+
// The definitions, with the persisted visibility mapped in. Same shape you
|
|
1118
|
+
// would use for persisted widths (`width`) — the definition is the truth.
|
|
1119
|
+
const columns = computed(() =>
|
|
1120
|
+
definitions.map((column) => ({
|
|
1121
|
+
...column,
|
|
1122
|
+
hidden: hidden.value.has(column.key),
|
|
1123
|
+
}))
|
|
1124
|
+
);
|
|
1125
|
+
|
|
1126
|
+
// The panel lists every declared column in the order the model has them
|
|
1127
|
+
// (omitted keys follow in declaration order, exactly as the table renders).
|
|
1128
|
+
const panelColumns = computed(() => {
|
|
1129
|
+
const rank = (key: string) => {
|
|
1130
|
+
const index = order.value.indexOf(key);
|
|
1131
|
+
return index < 0 ? order.value.length : index;
|
|
1132
|
+
};
|
|
1133
|
+
return [...definitions].sort((a, b) => rank(a.key) - rank(b.key));
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
const setHidden = (key: string, value: boolean) => {
|
|
1137
|
+
const next = new Set(hidden.value);
|
|
1138
|
+
if (value) next.add(key);
|
|
1139
|
+
else next.delete(key);
|
|
1140
|
+
hidden.value = next;
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
const move = (key: string, delta: 1 | -1) => {
|
|
1144
|
+
const next = panelColumns.value.map((column) => column.key);
|
|
1145
|
+
const from = next.indexOf(key);
|
|
1146
|
+
const to = from + delta;
|
|
1147
|
+
if (from < 0 || to < 0 || to >= next.length) return;
|
|
1148
|
+
next.splice(from, 1);
|
|
1149
|
+
next.splice(to, 0, key);
|
|
1150
|
+
order.value = next;
|
|
1151
|
+
};
|
|
1152
|
+
</script>
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
### Column visibility
|
|
1156
|
+
|
|
1157
|
+
`hidden: true` on a column definition hides it: no header, no cells, no grid
|
|
1158
|
+
track. The column stays **declared**, and that is the whole point — the order
|
|
1159
|
+
model is completed against every declared key, so a hidden column keeps its
|
|
1160
|
+
slot through any number of header drags, and it returns to that slot the
|
|
1161
|
+
moment the flag clears. Two rules follow:
|
|
1162
|
+
|
|
1163
|
+
- **Hidden means "exists, not shown".** A column panel, a persisted
|
|
1164
|
+
preference, a narrow-screen breakpoint all write `hidden` into the
|
|
1165
|
+
definition (a `computed` over your persisted set — the example above does
|
|
1166
|
+
exactly that). Filter `columns` only for a column that does **not exist**
|
|
1167
|
+
for this user (a custom field they don't have); its key, if a saved order
|
|
1168
|
+
still lists it, is preserved in place like any unknown key.
|
|
1169
|
+
- **There is no visibility model, on purpose** — the `width` shape, not the
|
|
1170
|
+
`sort` one. The definition is the single declared truth. Header slots
|
|
1171
|
+
(`#header:<key>`, `#header:<key>:append`, the table-wide `#header:append`)
|
|
1172
|
+
receive a `hideColumn()` callback for a "Hide column" control of your own; calling
|
|
1173
|
+
it hides the column for the mount and fires `@hide:column="(key) => …"`
|
|
1174
|
+
once. Persist by writing `hidden: true` back into the definition — the
|
|
1175
|
+
override matches it and stays; write `hidden: false` (the panel showing the
|
|
1176
|
+
column again) and the definition wins. Unbound, the hide lives for the
|
|
1177
|
+
mount, like an unbound resize. A hidden column has no header, so `hideColumn()`
|
|
1178
|
+
is one-way by nature: if you offer it, own the persistence and give the
|
|
1179
|
+
user a panel that shows columns again.
|
|
1180
|
+
|
|
1181
|
+
A nested table that shares its parent's keys shares its `hidden` flags too,
|
|
1182
|
+
the same way it shares `order` — a hidden parent column has no track for a
|
|
1183
|
+
child cell to land on.
|
|
1184
|
+
|
|
1185
|
+
**Pins travel with the column.** `fixed` is a field on the column
|
|
1186
|
+
definition (see "Pinned columns"), so a reorder moves the pin with the cell:
|
|
1187
|
+
drag the identity column to slot 3 and it is still sticky, now at slot 3.
|
|
1188
|
+
The offset is still positional — the pinned columns before it on the same
|
|
1189
|
+
side — so a pinned column dragged away from the edge sticks at `left: 0` and
|
|
1190
|
+
slides over the columns before it. Give a pinned column `reorderable: false`
|
|
1191
|
+
to keep it at its edge.
|
|
1192
|
+
|
|
1193
|
+
**Nested tables.** A parent that uses `order` or `reorderable` is inherited
|
|
1194
|
+
by **position**: its columns can move, so the child's `snap` targets and
|
|
1195
|
+
same-key pairing are ignored there (dev builds warn) and the child aligns to
|
|
1196
|
+
the parent's rails slot by slot. Give both tables the same `v-model:order`
|
|
1197
|
+
when they share keys and they stay paired. Never reorder (or share the order
|
|
1198
|
+
with) a snapped child itself — dev builds warn.
|
|
1199
|
+
|
|
1200
|
+
Apply the model synchronously in your handler and persist afterwards. If you
|
|
1201
|
+
must write it after an `await` (save first, then apply), the table waits up
|
|
1202
|
+
to a second for that write after a keyboard move and puts focus back on the
|
|
1203
|
+
moved header when it lands, as long as focus is still the table's. A later
|
|
1204
|
+
write, or an order change that no keyboard move asked for, never moves focus.
|
|
1205
|
+
|
|
781
1206
|
### Selection and bulk actions
|
|
782
1207
|
|
|
783
1208
|
Add `selectable` for multi-select (`multiple` is the default) bound with
|
|
@@ -802,7 +1227,7 @@ everywhere in the library, the destructive bulk action is gated by
|
|
|
802
1227
|
gated by `useConfirm`. -->
|
|
803
1228
|
<div
|
|
804
1229
|
v-if="selectedCount"
|
|
805
|
-
class="flex items-center gap-2 rounded-
|
|
1230
|
+
class="flex items-center gap-2 rounded-(--bb-radius) border border-(--bb-border) bg-(--bb-muted) px-2.5 py-1.5"
|
|
806
1231
|
>
|
|
807
1232
|
<span class="text-sm">{{ selectedCount }} selected</span>
|
|
808
1233
|
<BbButton
|
|
@@ -817,7 +1242,7 @@ everywhere in the library, the destructive bulk action is gated by
|
|
|
817
1242
|
</div>
|
|
818
1243
|
|
|
819
1244
|
<div
|
|
820
|
-
class="overflow-hidden rounded-
|
|
1245
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
821
1246
|
>
|
|
822
1247
|
<BbTable
|
|
823
1248
|
id="member-selection"
|
|
@@ -956,7 +1381,7 @@ with the current selection, which is exactly where the new rows are known.
|
|
|
956
1381
|
>
|
|
957
1382
|
{{ filter.label }}
|
|
958
1383
|
</BbButton>
|
|
959
|
-
<span class="ml-auto text-xs text-
|
|
1384
|
+
<span class="ml-auto text-xs text-(--bb-text-muted)">
|
|
960
1385
|
{{ selected.length }} selected
|
|
961
1386
|
</span>
|
|
962
1387
|
</div>
|
|
@@ -966,7 +1391,7 @@ with the current selection, which is exactly where the new rows are known.
|
|
|
966
1391
|
show the provider-side reconcile, the pattern paginated tables
|
|
967
1392
|
(where the prop must stay off) still need. -->
|
|
968
1393
|
<div
|
|
969
|
-
class="overflow-hidden rounded-
|
|
1394
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
970
1395
|
>
|
|
971
1396
|
<BbTable
|
|
972
1397
|
v-model="selected"
|
|
@@ -1061,7 +1486,7 @@ const fetchMembers = async (
|
|
|
1061
1486
|
null) — not an array. `select-text` labels the radio column for
|
|
1062
1487
|
screen readers. -->
|
|
1063
1488
|
<div
|
|
1064
|
-
class="overflow-hidden rounded-
|
|
1489
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1065
1490
|
>
|
|
1066
1491
|
<BbTable
|
|
1067
1492
|
v-model="planId"
|
|
@@ -1077,9 +1502,9 @@ const fetchMembers = async (
|
|
|
1077
1502
|
selectable
|
|
1078
1503
|
/>
|
|
1079
1504
|
</div>
|
|
1080
|
-
<p class="text-sm text-
|
|
1505
|
+
<p class="text-sm text-(--bb-text-muted)">
|
|
1081
1506
|
Chosen plan:
|
|
1082
|
-
<span class="font-medium text-
|
|
1507
|
+
<span class="font-medium text-(--bb-text)">{{
|
|
1083
1508
|
chosen ? chosen.name : 'none yet'
|
|
1084
1509
|
}}</span>
|
|
1085
1510
|
</p>
|
|
@@ -1143,7 +1568,7 @@ fields.
|
|
|
1143
1568
|
Track open rows with `v-model:expanded-items` (an array of row values — set
|
|
1144
1569
|
`item-value` so expansion is stable across refetches) and render their detail
|
|
1145
1570
|
through the `#expand` slot, a full-width row below the main one. Trigger it
|
|
1146
|
-
from the `#actions` slot (
|
|
1571
|
+
from the `#actions` slot (the slot creates the actions column; label it with
|
|
1147
1572
|
`actions-text`): the scope hands you `toggleExpanded` — a **callback** — plus
|
|
1148
1573
|
the read-only `expanded` flag. Drive open/close through the callback; the
|
|
1149
1574
|
`expanded` prop is one-way state, not something to mutate.
|
|
@@ -1156,11 +1581,10 @@ the read-only `expanded` flag. Drive open/close through the callback; the
|
|
|
1156
1581
|
you `toggleExpanded` (a callback) and `expanded` (read-only) — drive the
|
|
1157
1582
|
toggle through the callback, never by mutating the slot prop. -->
|
|
1158
1583
|
<div
|
|
1159
|
-
class="max-w-2xl overflow-hidden rounded-
|
|
1584
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1160
1585
|
>
|
|
1161
1586
|
<BbTable
|
|
1162
1587
|
v-model:expanded-items="expanded"
|
|
1163
|
-
actions
|
|
1164
1588
|
actions-text="Details"
|
|
1165
1589
|
caption="Invoices"
|
|
1166
1590
|
:columns="columns"
|
|
@@ -1175,9 +1599,9 @@ the read-only `expanded` flag. Drive open/close through the callback; the
|
|
|
1175
1599
|
</template>
|
|
1176
1600
|
|
|
1177
1601
|
<template #expand="{ item }">
|
|
1178
|
-
<div class="bg-
|
|
1602
|
+
<div class="bg-(--bb-muted) px-3 py-2.5 text-sm">
|
|
1179
1603
|
<p class="font-medium">{{ item.client }} · {{ item.number }}</p>
|
|
1180
|
-
<p class="text-xs text-
|
|
1604
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
1181
1605
|
Issued {{ item.issuedAt }} · net 30 · {{ item.lines }} line items
|
|
1182
1606
|
</p>
|
|
1183
1607
|
</div>
|
|
@@ -1243,6 +1667,12 @@ propagation (so the row click underneath doesn't also toggle highlight), and
|
|
|
1243
1667
|
Enter/Space handling for non-button elements. The nested-table example below
|
|
1244
1668
|
uses it.
|
|
1245
1669
|
|
|
1670
|
+
`expandProps` already toggles on click — do not also bind
|
|
1671
|
+
`@click="toggleExpanded"`, or one click toggles twice and nothing opens. It
|
|
1672
|
+
carries no name: a toggle with visible text is named by it, an icon-only one
|
|
1673
|
+
needs an `aria-label` (the bag cannot add one without overriding a visible
|
|
1674
|
+
label).
|
|
1675
|
+
|
|
1246
1676
|
#### Putting the toggle in the identity cell
|
|
1247
1677
|
|
|
1248
1678
|
`expandProps` / `expanded` / `toggleExpanded` reach **every per-column cell
|
|
@@ -1252,14 +1682,14 @@ sites) that is usually the better shape: the chevron sits where the eye already
|
|
|
1252
1682
|
is, and the actions column stays for actions.
|
|
1253
1683
|
|
|
1254
1684
|
```vue
|
|
1255
|
-
<template #name="{ item, content, expanded, expandProps
|
|
1685
|
+
<template #name="{ item, content, expanded, expandProps }">
|
|
1256
1686
|
<span class="table-identity">
|
|
1257
1687
|
<BbButton
|
|
1258
1688
|
v-bind="expandProps"
|
|
1689
|
+
:aria-label="expanded ? `Collapse ${content}` : `Expand ${content}`"
|
|
1259
1690
|
:icon="expanded ? 'lucide:chevron-down' : 'lucide:chevron-right'"
|
|
1260
1691
|
size="xs"
|
|
1261
1692
|
variant="ghost"
|
|
1262
|
-
@click="toggleExpanded"
|
|
1263
1693
|
/>
|
|
1264
1694
|
<BbBaseButton class="plain-link" @click="peek(item)">{{
|
|
1265
1695
|
content
|
|
@@ -1277,39 +1707,164 @@ fixed first track).
|
|
|
1277
1707
|
The actions-column toggle remains valid — prefer it when expansion reveals
|
|
1278
1708
|
_detail about the row_ rather than _children of it_.
|
|
1279
1709
|
|
|
1710
|
+
### Column resize
|
|
1711
|
+
|
|
1712
|
+
`resizable` puts a handle on the trailing edge of every data header:
|
|
1713
|
+
drag it and the column follows live, release to commit; double-click it to go
|
|
1714
|
+
back to the declared width. From the keyboard, **Alt+←/→** resizes the
|
|
1715
|
+
focused header in 10px steps (the header row is a tab stop whenever columns
|
|
1716
|
+
are resizable or reorderable).
|
|
1717
|
+
|
|
1718
|
+
There is no width model on purpose. `width` on the column definition stays
|
|
1719
|
+
the single declared truth, and a user resize is an **override** the table
|
|
1720
|
+
keeps until that column's `width` changes:
|
|
1721
|
+
|
|
1722
|
+
- Each commit fires `@resize:column="(key, width) => …"` **once** with the new width
|
|
1723
|
+
in px — or `null` after a double-click reset.
|
|
1724
|
+
- To persist, write the reported width back into your column definition (a
|
|
1725
|
+
`computed` over your persisted widths). The definition wins whenever it
|
|
1726
|
+
changes, so a programmatic `width` change always takes effect.
|
|
1727
|
+
- Unbound, the override lives for the mount, like an unbound `sort`.
|
|
1728
|
+
- A resized width is always px; `width` still accepts `'20%'` / `'12rem'`
|
|
1729
|
+
for what you declare yourself.
|
|
1730
|
+
|
|
1731
|
+
Headers never wrap. A column you have not sized is never narrower than its
|
|
1732
|
+
own heading — the label is the table's size hint, so an empty or slim column
|
|
1733
|
+
with a long heading still reads on a narrow screen (the table overflows
|
|
1734
|
+
instead). Once a track is a length (a declared `width`, a user resize) the
|
|
1735
|
+
label cannot widen it: squeezed, it ellipsizes and the sort arrow stays; at
|
|
1736
|
+
the narrowest only the arrow (and the handle) survive, and the column is
|
|
1737
|
+
still resizable. The data cells of a resized column clip with an ellipsis
|
|
1738
|
+
instead of spilling into the neighbour (a squeezed track cannot wrap a single
|
|
1739
|
+
word); every other cell keeps wrapping. A value longer than its column (an
|
|
1740
|
+
email, a URL, an ID in a squeezed `fixed` table) breaks inside its own cell
|
|
1741
|
+
rather than painting over the next one; ordinary words never split, and column
|
|
1742
|
+
sizing is unchanged. While a resize runs the whole page shows the resize
|
|
1743
|
+
cursor.
|
|
1744
|
+
|
|
1745
|
+
A resized column becomes an **exact** track; the other columns keep doing
|
|
1746
|
+
what they did — unfrozen ones share the surplus, and a table whose columns
|
|
1747
|
+
are all declared with a `width` keeps sharing it among the un-resized ones —
|
|
1748
|
+
so a filling table stays filled and nothing collapses. **Shift+drag** moves
|
|
1749
|
+
the border instead: the right neighbour absorbs the delta, the total stays
|
|
1750
|
+
put, and both columns are reported. A table that inherits its widths from a
|
|
1751
|
+
parent (`inherit-column-widths`) renders no handles — its tracks are the
|
|
1752
|
+
parent's.
|
|
1753
|
+
|
|
1754
|
+
**Resizable columns reporting widths back into the definition**
|
|
1755
|
+
|
|
1756
|
+
```vue
|
|
1757
|
+
<template>
|
|
1758
|
+
<div class="flex max-w-2xl flex-col gap-1.5">
|
|
1759
|
+
<div
|
|
1760
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1761
|
+
>
|
|
1762
|
+
<BbTable
|
|
1763
|
+
caption="Invoices"
|
|
1764
|
+
:columns="columns"
|
|
1765
|
+
compact
|
|
1766
|
+
item-value="id"
|
|
1767
|
+
:items="invoices"
|
|
1768
|
+
resizable
|
|
1769
|
+
@resize:column="onResize"
|
|
1770
|
+
/>
|
|
1771
|
+
</div>
|
|
1772
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
1773
|
+
Widths: <code>{{ JSON.stringify(widths) }}</code>
|
|
1774
|
+
</p>
|
|
1775
|
+
</div>
|
|
1776
|
+
</template>
|
|
1777
|
+
<script setup lang="ts">
|
|
1778
|
+
import { computed, ref } from 'vue';
|
|
1779
|
+
import { BbTable } from 'bitboss-ui';
|
|
1780
|
+
import type { BbTableColumn } from 'bitboss-ui';
|
|
1781
|
+
|
|
1782
|
+
type Invoice = { id: string; number: string; client: string; amount: number };
|
|
1783
|
+
|
|
1784
|
+
const base: Array<BbTableColumn<Invoice>> = [
|
|
1785
|
+
{ key: 'number', label: 'Invoice' },
|
|
1786
|
+
{ key: 'client', label: 'Client' },
|
|
1787
|
+
{ key: 'amount', label: 'Amount', align: 'right' },
|
|
1788
|
+
];
|
|
1789
|
+
// Persist THIS (localStorage, a user preference…): key → px.
|
|
1790
|
+
const widths = ref<Record<string, number>>({});
|
|
1791
|
+
// The definition carries the persisted widths; the table treats them as the
|
|
1792
|
+
// declared truth, so nothing jumps after a reload.
|
|
1793
|
+
const columns = computed(() =>
|
|
1794
|
+
base.map((column) => ({ ...column, width: widths.value[column.key] }))
|
|
1795
|
+
);
|
|
1796
|
+
const onResize = (key: string, width: number | null) => {
|
|
1797
|
+
const next = { ...widths.value };
|
|
1798
|
+
if (width === null) delete next[key];
|
|
1799
|
+
else next[key] = width;
|
|
1800
|
+
widths.value = next;
|
|
1801
|
+
};
|
|
1802
|
+
const invoices: Invoice[] = [
|
|
1803
|
+
{ id: '1', number: 'INV-1041', client: 'Northwind Traders', amount: 4200 },
|
|
1804
|
+
{ id: '2', number: 'INV-1042', client: 'Globex', amount: 980 },
|
|
1805
|
+
{ id: '3', number: 'INV-1043', client: 'Initech', amount: 15600 },
|
|
1806
|
+
];
|
|
1807
|
+
</script>
|
|
1808
|
+
```
|
|
1809
|
+
|
|
1280
1810
|
### Nested tables that align with the parent
|
|
1281
1811
|
|
|
1282
1812
|
A `BbTable` rendered inside another's `#expand` slot is independent by
|
|
1283
1813
|
default. Add `inherit-column-widths` and it snaps its columns to the parent's
|
|
1284
1814
|
tracks, so a line-items breakdown reads as a continuation of the invoice row
|
|
1285
|
-
above it
|
|
1815
|
+
above it. The mechanics:
|
|
1286
1816
|
|
|
1287
1817
|
- `inherit-column-widths` — `true` inherits from the nearest ancestor table;
|
|
1288
1818
|
a string targets a specific ancestor's `id` (useful when an intermediate
|
|
1289
1819
|
table has a different column count).
|
|
1290
|
-
- By default child
|
|
1291
|
-
column
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1820
|
+
- By default a child column pairs with the parent column of the **same key**,
|
|
1821
|
+
and a column the parent lacks flows into the next parent track no other
|
|
1822
|
+
column claimed. A column's `snap` names the parent column instead:
|
|
1823
|
+
`snap: 'client'` takes that track, `['client', 'amount']` spans from the
|
|
1824
|
+
start of one through the end of the other, and the parent's structural
|
|
1825
|
+
columns are targets by name (`'select'`, `'actions'` — `['name',
|
|
1826
|
+
'actions']` runs a column across the parent's actions cell too). A
|
|
1827
|
+
trailing `.digits` on a key in a pair is a fraction of that track
|
|
1828
|
+
(`['a', 'b.5']` = all of `a` plus half of `b`). Snaps and keys resolve
|
|
1829
|
+
against the parent's **rendered** columns: a target the parent hides (or
|
|
1830
|
+
never had) makes the column flow like an unsnapped one; a snap that lands
|
|
1831
|
+
before the previous column's cannot tile and flows too (dev builds warn);
|
|
1832
|
+
under a parent that reorders, snaps are ignored (see Column order).
|
|
1295
1833
|
- A child with **more** columns than the parent content-sizes the extras and
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1834
|
+
overflows into the parent's scroll (see below); with **fewer**, the leading
|
|
1835
|
+
columns stay 1:1, the actions column inherits the parent's actions width,
|
|
1836
|
+
and the last content column runs across every remaining parent track so
|
|
1837
|
+
both tables end flush (a right-aligned total lands under the parent's last
|
|
1838
|
+
column). Give that last column a `width` or an explicit `[start, end]`
|
|
1839
|
+
snap only if you want it to stop short — the leftover then joins the
|
|
1840
|
+
actions region instead. A column with nothing free left to flow into is an
|
|
1841
|
+
overflow column too.
|
|
1842
|
+
- **An inheriting child does not scroll on its own — the parent's scrollport
|
|
1843
|
+
is the only one.** That is what keeps the two grids locked together: a child
|
|
1844
|
+
with its own scroll position would fall out of alignment the moment either
|
|
1845
|
+
one moved, which is the whole thing `inherit-column-widths` exists to
|
|
1846
|
+
prevent. One scrollbar moves both.
|
|
1847
|
+
- **The parent's `selectable`/`actions` columns are handled for you** — the
|
|
1848
|
+
child's content columns pair with the parent's content columns by key (no
|
|
1849
|
+
`snap` needed for that), and the parent's select/actions _regions_ are reserved on
|
|
1850
|
+
each side: a child with its own select or actions column widens that cell
|
|
1851
|
+
to the parent's (two equal cells, controls at the row's end, so the ⌃ sits
|
|
1852
|
+
under the parent's); a child without one folds the region into its first/
|
|
1853
|
+
last cell as _padding_, so its content stays flush with the parent's data
|
|
1854
|
+
grid on both edges (the inset reads as hierarchy). Only a child cell
|
|
1855
|
+
_wider_ than the parent's — a select the parent lacks, more buttons — moves
|
|
1856
|
+
anything, and only the adjacent content column: it shrinks by the surplus
|
|
1857
|
+
so every other rail holds. What a child publishes to its own children is
|
|
1858
|
+
the same contract (content rails + regions), so a three-level nest aligns
|
|
1859
|
+
at every depth.
|
|
1308
1860
|
- **Scope any page-level cell-padding overrides to the parent's own cells.** A
|
|
1309
|
-
bare `:deep(
|
|
1310
|
-
clobbers the offset padding it computes to stay aligned — use
|
|
1311
|
-
|
|
1312
|
-
|
|
1861
|
+
bare `:deep([role='cell']:first-child)` also matches the nested table's
|
|
1862
|
+
cells and clobbers the offset padding it computes to stay aligned — use the
|
|
1863
|
+
direct-child chain through the grid's containers
|
|
1864
|
+
(`:deep(> .bb-table__table > .bb-table__body > [role='row'] > :first-child)`)
|
|
1865
|
+
so the child, which lives inside `.bb-table-expand__cell`, keeps its
|
|
1866
|
+
structural padding. The canonical `.table-flush` idiom is under **Styling
|
|
1867
|
+
hooks**.
|
|
1313
1868
|
|
|
1314
1869
|
**Invoice lines aligned under the invoice columns**
|
|
1315
1870
|
|
|
@@ -1319,11 +1874,10 @@ above it (this also forces fixed layout). The mechanics:
|
|
|
1319
1874
|
the parent's tracks, so line items line up under the invoice columns.
|
|
1320
1875
|
The toggle binds the scope's `expandProps` for wired-up aria state. -->
|
|
1321
1876
|
<div
|
|
1322
|
-
class="max-w-2xl overflow-hidden rounded-
|
|
1877
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1323
1878
|
>
|
|
1324
1879
|
<BbTable
|
|
1325
1880
|
v-model:expanded-items="expanded"
|
|
1326
|
-
actions
|
|
1327
1881
|
actions-text="Line items"
|
|
1328
1882
|
caption="Invoices"
|
|
1329
1883
|
:columns="columns"
|
|
@@ -1343,7 +1897,7 @@ above it (this also forces fixed layout). The mechanics:
|
|
|
1343
1897
|
</template>
|
|
1344
1898
|
|
|
1345
1899
|
<template #expand="{ item }">
|
|
1346
|
-
<div class="bg-
|
|
1900
|
+
<div class="bg-(--bb-muted) px-1 py-1">
|
|
1347
1901
|
<BbTable
|
|
1348
1902
|
:caption="`Line items of ${item.number}`"
|
|
1349
1903
|
:columns="lineColumns"
|
|
@@ -1419,6 +1973,50 @@ const expanded = ref<string[]>([]);
|
|
|
1419
1973
|
</script>
|
|
1420
1974
|
```
|
|
1421
1975
|
|
|
1976
|
+
#### Affixed actions on both tables
|
|
1977
|
+
|
|
1978
|
+
A nested table can pin its own actions column with `fixed-actions` — child
|
|
1979
|
+
rows usually need their own row actions — and both action columns pin to the
|
|
1980
|
+
same visible edge:
|
|
1981
|
+
|
|
1982
|
+
```vue
|
|
1983
|
+
<BbTable
|
|
1984
|
+
id="programmes"
|
|
1985
|
+
:columns="columns"
|
|
1986
|
+
fixed-actions
|
|
1987
|
+
:items="rows"
|
|
1988
|
+
item-value="id"
|
|
1989
|
+
>
|
|
1990
|
+
<template #actions="{ item }">…</template>
|
|
1991
|
+
<template #expand="{ item }">
|
|
1992
|
+
<BbTable
|
|
1993
|
+
:columns="childColumns"
|
|
1994
|
+
fixed-actions
|
|
1995
|
+
inherit-column-widths="programmes"
|
|
1996
|
+
:items="item.children"
|
|
1997
|
+
item-value="id"
|
|
1998
|
+
>
|
|
1999
|
+
<template #actions="{ item }">…</template>
|
|
2000
|
+
</BbTable>
|
|
2001
|
+
</template>
|
|
2002
|
+
</BbTable>
|
|
2003
|
+
```
|
|
2004
|
+
|
|
2005
|
+
This works because the child shares the parent's scrollport. `position: sticky`
|
|
2006
|
+
resolves against the nearest scrolling ancestor, and the child's own box is as
|
|
2007
|
+
wide as the parent's **content** — so if it opened a scrollport of its own, the
|
|
2008
|
+
child's actions would affix to an edge sitting out in the overflow, hundreds of
|
|
2009
|
+
pixels past what anyone can see, while the parent's pinned correctly. The
|
|
2010
|
+
child's actions column inherits the parent's actions region by itself (the
|
|
2011
|
+
structural rule above), so the two columns line up rather than merely both
|
|
2012
|
+
being pinned.
|
|
2013
|
+
|
|
2014
|
+
A pinned cell is opaque — it paints the table's `--bg` surface because it
|
|
2015
|
+
slides over its siblings — so a nested table sitting on a tinted expand row
|
|
2016
|
+
(`--bb-muted` is the usual choice) shows white pinned actions unless you tell
|
|
2017
|
+
it which surface it is on: `.nest .bb-table { --bg: var(--bb-muted); }`. Same
|
|
2018
|
+
rule as any table on a non-panel surface (see **Styling hooks**).
|
|
2019
|
+
|
|
1422
2020
|
#### Flush tables + inherited widths: mind the edge padding
|
|
1423
2021
|
|
|
1424
2022
|
`table-flush` removes the outer cell padding so the table reads edge-to-edge in
|
|
@@ -1432,9 +2030,10 @@ Two rules keep them honest:
|
|
|
1432
2030
|
1. **Snap against the same base you paint.** Measure the parent's columns with
|
|
1433
2031
|
the same flush/padded state the child renders in — never measure padded and
|
|
1434
2032
|
render flush.
|
|
1435
|
-
2. **Never add nest padding on the body only.** Padding the child's
|
|
1436
|
-
not its header (or vice versa) reintroduces exactly
|
|
1437
|
-
removed. Put the inset on the nest container, where
|
|
2033
|
+
2. **Never add nest padding on the body only.** Padding the child's body
|
|
2034
|
+
(`.bb-table__body`) but not its header (or vice versa) reintroduces exactly
|
|
2035
|
+
the offset the snap just removed. Put the inset on the nest container, where
|
|
2036
|
+
both row groups inherit it.
|
|
1438
2037
|
|
|
1439
2038
|
### Row highlight (master–detail)
|
|
1440
2039
|
|
|
@@ -1447,11 +2046,42 @@ clicks are ignored on purpose: those inside interactive elements (links,
|
|
|
1447
2046
|
buttons, inputs, labels keep their own semantics) and those ending a text
|
|
1448
2047
|
selection (dragging to copy a cell must not mutate state).
|
|
1449
2048
|
|
|
2049
|
+
**Highlight is opt-in, and the model's value is the switch.** Bind nothing and
|
|
2050
|
+
the mechanic is entirely off — a row click emits `click:row` and does nothing
|
|
2051
|
+
else: no class, no `aria-current`, no state. That matters because the table has
|
|
2052
|
+
nowhere to put a highlight it invents; a table that highlighted itself would
|
|
2053
|
+
drive a cursor the app can neither read nor clear.
|
|
2054
|
+
|
|
2055
|
+
The switch reads the value, not the binding: **`undefined` means "never
|
|
2056
|
+
initialised" and keeps highlight off; `null` means "initialised and currently
|
|
2057
|
+
empty" and turns it on.** So initialise the model:
|
|
2058
|
+
|
|
2059
|
+
```ts
|
|
2060
|
+
const highlighted = ref(null); // ✅ connected
|
|
2061
|
+
const highlighted = ref(); // ❌ undefined — highlight stays off (warns in dev)
|
|
2062
|
+
```
|
|
2063
|
+
|
|
2064
|
+
A value seeded through the shared context counts exactly the same, and binds
|
|
2065
|
+
two ways just like the prop:
|
|
2066
|
+
|
|
2067
|
+
```ts
|
|
2068
|
+
const highlighted = ref(null);
|
|
2069
|
+
useBbTableContext('invoices-table', { highlighted });
|
|
2070
|
+
```
|
|
2071
|
+
|
|
2072
|
+
`click:row` is never gated — it fires on every row click whether or not
|
|
2073
|
+
highlight is connected, so listening for clicks costs you nothing. Calling
|
|
2074
|
+
`toggleHighlighted` from a cell slot on an unconnected table does nothing and
|
|
2075
|
+
warns once in dev.
|
|
2076
|
+
|
|
1450
2077
|
Highlight ships with a **default cursor**: the row gets `aria-current="true"`
|
|
1451
|
-
and the `bb-
|
|
1452
|
-
paints that class with a
|
|
1453
|
-
distinct from hover and from a plain focus ring, and readable
|
|
1454
|
-
and dark.
|
|
2078
|
+
and the `bb-table__row--highlighted` class, and the shipped stylesheet
|
|
2079
|
+
paints that class with a quiet neutral fill plus a left accent bar in your
|
|
2080
|
+
brand primary — distinct from hover and from a plain focus ring, and readable
|
|
2081
|
+
in both light and dark. The fill is `--bb-muted` (the shared "selected/active"
|
|
2082
|
+
stop on the neutral surface ladder, one step above the `--bb-surface-hover`
|
|
2083
|
+
used for row hover) and steps to `--bb-pressed` while hovered, so it never
|
|
2084
|
+
depends on what your `--bb-primary` happens to be — only the accent bar does. Screen-reader users get the `aria-current` announcement either way;
|
|
1455
2085
|
sighted users now get a visible cursor out of the box too, including once
|
|
1456
2086
|
`keyboard-navigation` is on and the roving tabindex needs to be seen. Override
|
|
1457
2087
|
it with `row-class` (or equivalent visible styling) whenever the default
|
|
@@ -1461,7 +2091,7 @@ customize the look:
|
|
|
1461
2091
|
```ts
|
|
1462
2092
|
const rowClass = (item: Invoice) =>
|
|
1463
2093
|
item.id === highlighted.value
|
|
1464
|
-
? 'bg-[color
|
|
2094
|
+
? 'bg-[color-mix(in_oklab,var(--bb-danger)_10%,var(--bb-panel))]'
|
|
1465
2095
|
: '';
|
|
1466
2096
|
```
|
|
1467
2097
|
|
|
@@ -1475,7 +2105,7 @@ const rowClass = (item: Invoice) =>
|
|
|
1475
2105
|
box; this example repaints it explicitly via the public `row-class`
|
|
1476
2106
|
API to show how to customize it (here, matching the same tint). -->
|
|
1477
2107
|
<div
|
|
1478
|
-
class="min-w-0 flex-1 overflow-hidden rounded-
|
|
2108
|
+
class="min-w-0 flex-1 overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1479
2109
|
>
|
|
1480
2110
|
<BbTable
|
|
1481
2111
|
v-model:highlighted="highlighted"
|
|
@@ -1489,15 +2119,15 @@ const rowClass = (item: Invoice) =>
|
|
|
1489
2119
|
</div>
|
|
1490
2120
|
|
|
1491
2121
|
<aside
|
|
1492
|
-
class="w-full shrink-0 rounded-
|
|
2122
|
+
class="w-full shrink-0 rounded-(--bb-radius) border border-(--bb-border) p-3 text-sm sm:w-52"
|
|
1493
2123
|
>
|
|
1494
2124
|
<template v-if="active">
|
|
1495
2125
|
<p class="font-medium">{{ active.client }}</p>
|
|
1496
|
-
<p class="mt-0.5 text-xs text-
|
|
2126
|
+
<p class="mt-0.5 text-xs text-(--bb-text-muted)">
|
|
1497
2127
|
{{ active.number }} · {{ active.amount }}
|
|
1498
2128
|
</p>
|
|
1499
2129
|
</template>
|
|
1500
|
-
<p v-else class="text-xs text-
|
|
2130
|
+
<p v-else class="text-xs text-(--bb-text-muted)">
|
|
1501
2131
|
Select an invoice to preview it.
|
|
1502
2132
|
</p>
|
|
1503
2133
|
</aside>
|
|
@@ -1537,24 +2167,54 @@ const active = computed(() =>
|
|
|
1537
2167
|
// Primary tint for the open row — selection chrome stays on content, not hover.
|
|
1538
2168
|
const rowClass = (invoice: Invoice) =>
|
|
1539
2169
|
invoice.id === highlighted.value
|
|
1540
|
-
? 'cursor-pointer bg-[color
|
|
2170
|
+
? 'cursor-pointer bg-[color-mix(in_oklab,var(--bb-primary)_8%,var(--bb-panel))]'
|
|
1541
2171
|
: 'cursor-pointer';
|
|
1542
2172
|
</script>
|
|
1543
2173
|
```
|
|
1544
2174
|
|
|
1545
2175
|
### Keyboard navigation and row events
|
|
1546
2176
|
|
|
1547
|
-
Add `keyboard-navigation`
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
2177
|
+
Add `keyboard-navigation` and the table becomes an ARIA **grid** (the WAI-ARIA
|
|
2178
|
+
APG data grid): the whole table is **one tab stop**, and a roving focus moves
|
|
2179
|
+
over its cells, the header row included.
|
|
2180
|
+
|
|
2181
|
+
| Key | Does |
|
|
2182
|
+
| -------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
2183
|
+
| ←/→ | One cell left/right (no wrap; mirrored under `direction: rtl`) |
|
|
2184
|
+
| ↑/↓ | One row up/down, same column (↑ from the first row reaches the header) |
|
|
2185
|
+
| Home / End | First / last cell of the row |
|
|
2186
|
+
| Ctrl+Home / Ctrl+End | First cell of the first row (the header) / last cell of the last row |
|
|
2187
|
+
| PageUp / PageDown | Ten rows, same column |
|
|
2188
|
+
| Enter | On a cell holding controls: moves into them. Otherwise activates the row (highlight + `click:row`) |
|
|
2189
|
+
| Space | Activates the row |
|
|
2190
|
+
| Enter/Space on select cell | Toggles the row's selection (the select header: select-all) |
|
|
2191
|
+
| Shift+Space | Toggles the row's selection |
|
|
2192
|
+
| Ctrl/Cmd+A | Select all (when the select-all checkbox is shown) |
|
|
2193
|
+
| F2 / Escape | Into a cell's controls and back out (Escape only when no overlay opened from inside) |
|
|
2194
|
+
|
|
2195
|
+
Controls you render inside cells (links, buttons, the built-in checkboxes)
|
|
2196
|
+
leave the tab order while `keyboard-navigation` is on — Tab goes past the table
|
|
2197
|
+
in one step — and are reached with Enter/F2; a click on one works as always and
|
|
2198
|
+
moves the tab stop to its cell. Their own `tabindex` is restored exactly when
|
|
2199
|
+
the prop turns off. Keys pressed inside a control are the control's.
|
|
2200
|
+
|
|
2201
|
+
Add an `#expand` slot too and the table is a **treegrid**: every data row is a
|
|
2202
|
+
parent (`aria-level="1"`, `aria-expanded`) and its expand row the child
|
|
2203
|
+
(`aria-level="2"`). Rows take focus as well, and the tab stop starts on the
|
|
2204
|
+
first row: ↑/↓/Home/End/PageUp/PageDown move by row, **→** expands a collapsed
|
|
2205
|
+
row (then enters its first cell), **←** collapses an expanded one, ← on a
|
|
2206
|
+
row's first cell returns to the row, Enter/Space activate it. In cell focus,
|
|
2207
|
+
Ctrl+Home/End keep the column. A nested table inside an expand row is its own
|
|
2208
|
+
grid (or table) with its own tab stop.
|
|
2209
|
+
|
|
2210
|
+
Focus and highlight stay independent: arrowing over rows opens nothing until
|
|
2211
|
+
the user commits. A mouse click re-anchors navigation, and focused cells and
|
|
2212
|
+
rows show the standard inset focus ring. The grammar is the table's own body
|
|
2213
|
+
only: with a `#tbody` slot the rows are yours and the table stays a plain
|
|
2214
|
+
`role="table"`.
|
|
1555
2215
|
|
|
1556
2216
|
`keyboard-navigation` rides on the same default cursor as `v-model:highlighted`
|
|
1557
|
-
— the roving
|
|
2217
|
+
— the roving focus, `aria-current` and the built-in highlight tint are all
|
|
1558
2218
|
correct the moment you add the prop, so `j`/`k`/arrow keys move a visible
|
|
1559
2219
|
cursor out of the box. See **Row highlight** above for how to override that
|
|
1560
2220
|
look with `row-class` if the default tint doesn't fit.
|
|
@@ -1564,11 +2224,12 @@ look with `row-class` if the default tint doesn't fit.
|
|
|
1564
2224
|
```vue
|
|
1565
2225
|
<template>
|
|
1566
2226
|
<div class="flex max-w-2xl flex-col gap-1.5">
|
|
1567
|
-
<!-- `keyboard-navigation` makes the
|
|
1568
|
-
focused
|
|
1569
|
-
|
|
2227
|
+
<!-- `keyboard-navigation` makes the table an ARIA grid, one tab stop:
|
|
2228
|
+
the arrows move the focused cell, Home/End go to the row's ends,
|
|
2229
|
+
Enter/Space open its row (same path as a click, so it toggles
|
|
2230
|
+
`highlighted` and emits `click:row`). -->
|
|
1570
2231
|
<div
|
|
1571
|
-
class="overflow-hidden rounded-
|
|
2232
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1572
2233
|
>
|
|
1573
2234
|
<BbTable
|
|
1574
2235
|
v-model:highlighted="openEventId"
|
|
@@ -1581,10 +2242,10 @@ look with `row-class` if the default tint doesn't fit.
|
|
|
1581
2242
|
:row-class="rowClass"
|
|
1582
2243
|
/>
|
|
1583
2244
|
</div>
|
|
1584
|
-
<p class="text-xs text-
|
|
2245
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
1585
2246
|
Tab into the table, move with the arrow keys, press Enter to open a row.
|
|
1586
2247
|
Open event:
|
|
1587
|
-
<span class="font-medium text-
|
|
2248
|
+
<span class="font-medium text-(--bb-text)">{{
|
|
1588
2249
|
openEvent ? `${openEvent.actor} — ${openEvent.action}` : 'none'
|
|
1589
2250
|
}}</span>
|
|
1590
2251
|
</p>
|
|
@@ -1630,15 +2291,17 @@ const openEvent = computed(() =>
|
|
|
1630
2291
|
// customize it (the public API for doing so).
|
|
1631
2292
|
const rowClass = (event: AuditEvent) =>
|
|
1632
2293
|
event.id === openEventId.value
|
|
1633
|
-
? 'bg-[color
|
|
2294
|
+
? 'bg-[color-mix(in_oklab,var(--bb-primary)_8%,var(--bb-panel))]'
|
|
1634
2295
|
: '';
|
|
1635
2296
|
</script>
|
|
1636
2297
|
```
|
|
1637
2298
|
|
|
1638
2299
|
Row events: `click:row`, `dblclick:row` and `contextmenu:row` fire with
|
|
1639
|
-
`(event,
|
|
1640
|
-
|
|
1641
|
-
|
|
2300
|
+
`(event, item)` — the native event and **your record exactly as you passed it
|
|
2301
|
+
in `items`**, nothing else. No wrapper to unpack, no third argument; selection
|
|
2302
|
+
state is already yours through the `v-model`, and the row's value resolves
|
|
2303
|
+
from the record through `item-value` exactly as the models do. Reserve these
|
|
2304
|
+
events for side effects that are not navigation —
|
|
1642
2305
|
logging, opening a drawer (though `v-model:highlighted` usually covers that
|
|
1643
2306
|
without any handler).
|
|
1644
2307
|
|
|
@@ -1662,10 +2325,9 @@ open-in-new-tab for free.
|
|
|
1662
2325
|
<!-- Row-level navigation is offloaded to BbButton: `href` (or `to` in a
|
|
1663
2326
|
router app) makes it a real link, not a JS click handler. -->
|
|
1664
2327
|
<div
|
|
1665
|
-
class="max-w-2xl overflow-hidden rounded-
|
|
2328
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1666
2329
|
>
|
|
1667
2330
|
<BbTable
|
|
1668
|
-
actions
|
|
1669
2331
|
actions-text="Actions"
|
|
1670
2332
|
caption="Invoices"
|
|
1671
2333
|
:columns="columns"
|
|
@@ -1757,7 +2419,7 @@ rollback on failure, and overlay retirement inside the items function.
|
|
|
1757
2419
|
<template>
|
|
1758
2420
|
<div class="flex max-w-2xl flex-col gap-1.5">
|
|
1759
2421
|
<div
|
|
1760
|
-
class="overflow-hidden rounded-
|
|
2422
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
1761
2423
|
>
|
|
1762
2424
|
<BbTable
|
|
1763
2425
|
caption="Sprint tasks — every cell saves itself"
|
|
@@ -1811,10 +2473,10 @@ rollback on failure, and overlay retirement inside the items function.
|
|
|
1811
2473
|
</BbTable>
|
|
1812
2474
|
</div>
|
|
1813
2475
|
|
|
1814
|
-
<p v-if="lastFailure" class="text-xs text-
|
|
2476
|
+
<p v-if="lastFailure" class="text-xs text-(--bb-danger)">
|
|
1815
2477
|
{{ lastFailure }}
|
|
1816
2478
|
</p>
|
|
1817
|
-
<p class="text-xs text-
|
|
2479
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
1818
2480
|
No Save button anywhere — edits persist per field, optimistically.
|
|
1819
2481
|
BB-121's save always fails and rolls back.
|
|
1820
2482
|
</p>
|
|
@@ -1967,26 +2629,26 @@ const labelFor = (status: Status) =>
|
|
|
1967
2629
|
Non-scoped so variant classes on the child badge receive the accents. -->
|
|
1968
2630
|
<style>
|
|
1969
2631
|
.bb-badge.bb-badge--soft-gray {
|
|
1970
|
-
--accent:
|
|
2632
|
+
--accent: var(--bb-text-muted);
|
|
1971
2633
|
}
|
|
1972
2634
|
.bb-badge.bb-badge--soft-blue {
|
|
1973
|
-
--accent:
|
|
2635
|
+
--accent: var(--bb-info);
|
|
1974
2636
|
}
|
|
1975
2637
|
.bb-badge.bb-badge--soft-green {
|
|
1976
|
-
--accent:
|
|
2638
|
+
--accent: var(--bb-success);
|
|
1977
2639
|
}
|
|
1978
2640
|
.bb-badge.bb-badge--soft-red {
|
|
1979
|
-
--accent:
|
|
2641
|
+
--accent: var(--bb-danger);
|
|
1980
2642
|
}
|
|
1981
2643
|
.bb-badge.bb-badge--soft-gray,
|
|
1982
2644
|
.bb-badge.bb-badge--soft-blue,
|
|
1983
2645
|
.bb-badge.bb-badge--soft-green,
|
|
1984
2646
|
.bb-badge.bb-badge--soft-red {
|
|
1985
2647
|
--bg: color-mix(in oklab, var(--accent) 15%, var(--bb-panel));
|
|
1986
|
-
--
|
|
1987
|
-
--
|
|
2648
|
+
--fg: color-mix(in oklab, var(--accent) 80%, var(--bb-text));
|
|
2649
|
+
--bw: 1px;
|
|
1988
2650
|
--border-color: color-mix(in oklab, var(--accent) 25%, var(--bb-panel));
|
|
1989
|
-
--ring: color-mix(in oklab, var(--accent) 45%, transparent);
|
|
2651
|
+
--ring-color: color-mix(in oklab, var(--accent) 45%, transparent);
|
|
1990
2652
|
}
|
|
1991
2653
|
</style>
|
|
1992
2654
|
```
|
|
@@ -2001,12 +2663,16 @@ canonical palette lives in the
|
|
|
2001
2663
|
|
|
2002
2664
|
`compact` tightens row padding. `fixed-headers` makes the header stick to the
|
|
2003
2665
|
top of the nearest scroll container. `fixed` switches to an equal-width fixed
|
|
2004
|
-
layout.
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2666
|
+
layout. Pinned columns (next section) stick while the rest scroll
|
|
2667
|
+
horizontally. When content can't
|
|
2668
|
+
fit, the table keeps every column at its minimum — the estimated floor of a
|
|
2669
|
+
text column, its header label always included — and overflows its container
|
|
2670
|
+
instead of clipping; this is by design, not a bug to work around. Note that truncating cells yourself
|
|
2671
|
+
(`overflow: hidden` + `text-overflow: ellipsis` via `tdClass`) removes that
|
|
2672
|
+
column's content floor — only the label floors it then, and the grid pads
|
|
2673
|
+
every column equally with whatever is left — so declare a `width` on the
|
|
2674
|
+
columns you truncate, or truncate with `white-space: nowrap` alone and let
|
|
2675
|
+
the table scroll.
|
|
2010
2676
|
|
|
2011
2677
|
**The consumer overflow contract has two parts.** Wrap the table in an
|
|
2012
2678
|
`overflow-x: auto` element (below), **and** make sure that wrapper is actually
|
|
@@ -2025,7 +2691,7 @@ your wrapper actually sits on before sprinkling `min-width: 0` everywhere.)
|
|
|
2025
2691
|
|
|
2026
2692
|
```vue
|
|
2027
2693
|
<div
|
|
2028
|
-
class="max-h-52 max-w-2xl overflow-auto rounded-
|
|
2694
|
+
class="max-h-52 max-w-2xl overflow-auto rounded-(--bb-radius) border border-(--bb-border)"
|
|
2029
2695
|
>
|
|
2030
2696
|
<BbTable
|
|
2031
2697
|
caption="Server fleet"
|
|
@@ -2049,6 +2715,144 @@ your wrapper actually sits on before sprinkling `min-width: 0` everywhere.)
|
|
|
2049
2715
|
</div>
|
|
2050
2716
|
```
|
|
2051
2717
|
|
|
2718
|
+
### Pinned columns
|
|
2719
|
+
|
|
2720
|
+
`fixed: 'left' | 'right'` on a column definition makes its cells
|
|
2721
|
+
`position: sticky` on that side — in place, at the column's own render
|
|
2722
|
+
position, like a spreadsheet's freeze panes. Pin a contiguous run from the
|
|
2723
|
+
edge and the offsets accumulate (the second left-pinned column sticks right
|
|
2724
|
+
after the first). The two structural columns have no definition to carry the
|
|
2725
|
+
field, so they pin through the table: `fixed-select` for the selection
|
|
2726
|
+
column and `fixed-actions` for the actions column (each has one sensible
|
|
2727
|
+
side, so both are booleans).
|
|
2728
|
+
|
|
2729
|
+
```vue
|
|
2730
|
+
<BbTable :columns="columns" fixed-actions fixed-select :items="rows" selectable>
|
|
2731
|
+
<template #actions="{ item }">…</template>
|
|
2732
|
+
</BbTable>
|
|
2733
|
+
```
|
|
2734
|
+
|
|
2735
|
+
```ts
|
|
2736
|
+
const columns = [
|
|
2737
|
+
{ key: 'name', label: 'Name', fixed: 'left' },
|
|
2738
|
+
{ key: 'region', label: 'Region' },
|
|
2739
|
+
{ key: 'amount', label: 'Amount', align: 'right' },
|
|
2740
|
+
];
|
|
2741
|
+
```
|
|
2742
|
+
|
|
2743
|
+
Three rules:
|
|
2744
|
+
|
|
2745
|
+
- **The pin is the column's.** Under `order` / `reorderable` it travels with
|
|
2746
|
+
the cell, and a `hidden` pinned column pins nothing. The offset is still
|
|
2747
|
+
positional, so a lone left-pinned column dragged to the middle sticks at
|
|
2748
|
+
`left: 0` and slides over the columns before it — by design; lock the
|
|
2749
|
+
pinned columns in place by normalizing `@update:order` if you need to.
|
|
2750
|
+
- **Pinned cells are opaque** — they paint the table's `--bg` (see Styling
|
|
2751
|
+
hooks), so a table on a tinted surface needs `--bg` set once.
|
|
2752
|
+
- **Nested tables pin against the ancestor scrollport.** A child that
|
|
2753
|
+
inherits the parent's tracks has no scrollport of its own, so both tables'
|
|
2754
|
+
pins land on the same visible edge (see Nested tables).
|
|
2755
|
+
|
|
2756
|
+
### Virtual rows
|
|
2757
|
+
|
|
2758
|
+
`virtual` windows the body: only the rows in the vertical scrollport (plus a
|
|
2759
|
+
few on each side) are mounted, and two spacer rows hold the scrollport at the
|
|
2760
|
+
full list height, so 5,000 or 50,000 rows scroll at the cost of a few dozen.
|
|
2761
|
+
Everything else is the same table — the rows stay in flow in the grid, so the
|
|
2762
|
+
stuck header, pinned columns, nested tables, selection, highlight and the
|
|
2763
|
+
keyboard grammar work untouched. One prop, no knobs.
|
|
2764
|
+
|
|
2765
|
+
- **Give it a scroller.** Bound the table's height (`max-height` / `height`
|
|
2766
|
+
on the table, or a flex item with `min-height: 0`) and the table itself
|
|
2767
|
+
scrolls its rows; left unbounded it grows with the page and the page (or
|
|
2768
|
+
the nearest scrolling ancestor) is the scroller. `virtual` implies a stuck
|
|
2769
|
+
header — a windowed body without column names is a scroller, not a table.
|
|
2770
|
+
- **Columns are sized once.** A windowed body only ever holds a few rows, so
|
|
2771
|
+
`auto` tracks would move as rows come and go. The first rendered batch is
|
|
2772
|
+
measured and its widths become floors (`minmax(px, 1fr)`): they still share
|
|
2773
|
+
surplus, later rows never widen them — and the cells of those columns are
|
|
2774
|
+
single-line and **clip with an ellipsis** (like a resized column) so a
|
|
2775
|
+
longer value that shows up later never spills into its neighbour. Want a
|
|
2776
|
+
column to wrap (prose, notes)? Declare a `width` on it: a declared width
|
|
2777
|
+
wins as always and keeps wrapping. A resize overrides as always, and an
|
|
2778
|
+
empty→non-empty transition (a refetch) re-measures from the new first
|
|
2779
|
+
batch.
|
|
2780
|
+
- **A fast wheel never shows blank space.** A band of skeleton rows is kept
|
|
2781
|
+
rendered beyond the window on both sides (cheap: empty cells at the
|
|
2782
|
+
measured row height), so a wheel that the compositor scrolls ahead of the
|
|
2783
|
+
main thread reveals skeletons, not blank spacer, and they turn into real
|
|
2784
|
+
rows as the window reaches them. While the scroll is fast, rows never
|
|
2785
|
+
mounted before stay skeletons and are swapped for real rows as soon as
|
|
2786
|
+
it slows; rows you have already seen stay real. A moderate scroll never
|
|
2787
|
+
sees a skeleton.
|
|
2788
|
+
- **Dynamic heights are fine.** Every mounted row is measured (wrapping
|
|
2789
|
+
cells, a "show more", an expand row that opens a nested table three levels
|
|
2790
|
+
deep), measurements are cached by row so a row seen once stays right, and a
|
|
2791
|
+
height change _above_ the viewport moves the scroll offset with it so what
|
|
2792
|
+
you are reading does not jump.
|
|
2793
|
+
- **Focus is never lost to an unmount.** The row (or expand row) that owns
|
|
2794
|
+
focus stays mounted however far it scrolls — a control inside a nested
|
|
2795
|
+
table included — and is released on blur. Arrow keys, Home/End and
|
|
2796
|
+
PageUp/PageDown work across the whole list (the target row is scrolled in,
|
|
2797
|
+
mounted, then focused).
|
|
2798
|
+
- **Nested tables are not windowed.** A nested table inside an expand row is
|
|
2799
|
+
one tall row to the virtualizer; give a huge nested dataset its own page.
|
|
2800
|
+
`virtual` is ignored on a table that inherits its widths, and under a
|
|
2801
|
+
`#tbody` slot.
|
|
2802
|
+
- **Rows keep their absolute position for AT** (`aria-rowcount` /
|
|
2803
|
+
`aria-rowindex`), page or no page — a virtual table is one page unless you
|
|
2804
|
+
say otherwise.
|
|
2805
|
+
|
|
2806
|
+
**5,000 rows in a 320px scroller**
|
|
2807
|
+
|
|
2808
|
+
```vue
|
|
2809
|
+
<template>
|
|
2810
|
+
<!-- Bounding the table's height is what makes it the scroller of its own
|
|
2811
|
+
rows; `virtual` windows them and implies the stuck header. -->
|
|
2812
|
+
<div
|
|
2813
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
2814
|
+
>
|
|
2815
|
+
<BbTable
|
|
2816
|
+
caption="Ledger"
|
|
2817
|
+
class="max-h-80"
|
|
2818
|
+
:columns="columns"
|
|
2819
|
+
compact
|
|
2820
|
+
item-value="id"
|
|
2821
|
+
:items="rows"
|
|
2822
|
+
virtual
|
|
2823
|
+
/>
|
|
2824
|
+
</div>
|
|
2825
|
+
</template>
|
|
2826
|
+
<script setup lang="ts">
|
|
2827
|
+
import { BbTable } from 'bitboss-ui';
|
|
2828
|
+
import type { BbTableColumn } from 'bitboss-ui';
|
|
2829
|
+
|
|
2830
|
+
type Entry = {
|
|
2831
|
+
id: number;
|
|
2832
|
+
number: string;
|
|
2833
|
+
client: string;
|
|
2834
|
+
issued: string;
|
|
2835
|
+
amount: string;
|
|
2836
|
+
};
|
|
2837
|
+
|
|
2838
|
+
const columns: Array<BbTableColumn<Entry>> = [
|
|
2839
|
+
{ key: 'number', label: 'Invoice', fixed: 'left' },
|
|
2840
|
+
{ key: 'client', label: 'Client' },
|
|
2841
|
+
{ key: 'issued', label: 'Issued' },
|
|
2842
|
+
{ key: 'amount', label: 'Amount', align: 'right' },
|
|
2843
|
+
];
|
|
2844
|
+
|
|
2845
|
+
const clients = ['Northwind Traders', 'Globex', 'Initech', 'Umbrella', 'Hooli'];
|
|
2846
|
+
const rows: Entry[] = Array.from({ length: 5000 }, (_, i) => ({
|
|
2847
|
+
id: i,
|
|
2848
|
+
number: `INV-${10000 + i}`,
|
|
2849
|
+
client: clients[i % clients.length],
|
|
2850
|
+
issued: `2026-${String(1 + (i % 12)).padStart(2, '0')}-${String(1 + (i % 28)).padStart(2, '0')}`,
|
|
2851
|
+
amount: `€${((i * 37) % 9000) + 100}`,
|
|
2852
|
+
}));
|
|
2853
|
+
</script>
|
|
2854
|
+
```
|
|
2855
|
+
|
|
2052
2856
|
### Narrow screens: hide columns, don't scroll everything
|
|
2053
2857
|
|
|
2054
2858
|
An ops table with ten columns is unusable on a phone as a horizontal scroller —
|
|
@@ -2057,10 +2861,14 @@ leave the screen. Collapse instead of scroll:
|
|
|
2057
2861
|
|
|
2058
2862
|
- **Rank the columns.** Identity + status + the one number that matters stay;
|
|
2059
2863
|
everything else is secondary.
|
|
2060
|
-
- **
|
|
2061
|
-
`
|
|
2062
|
-
`
|
|
2063
|
-
|
|
2864
|
+
- **Flag the secondary ones `hidden` at the breakpoint** — a `computed`
|
|
2865
|
+
over `useMobile()` (or your own `matchMedia`) that maps the definitions
|
|
2866
|
+
with `hidden: isMobile && secondary.has(key)`. A hidden column has no grid
|
|
2867
|
+
track. Do **not** hide cells with `thClass`/`tdClass` + `display: none`:
|
|
2868
|
+
the table is a grid, a hidden cell leaves its track in place and every
|
|
2869
|
+
following cell shifts one track over. The hidden column stays declared, so
|
|
2870
|
+
it keeps its slot in `order` and returns where it was when the screen
|
|
2871
|
+
widens — never filter the order array.
|
|
2064
2872
|
- **Stack what survives into the primary cell.** The identity slot renders the
|
|
2065
2873
|
name plus the hidden facts under it, at `--bb-text-muted`, so nothing is
|
|
2066
2874
|
actually lost.
|
|
@@ -2069,29 +2877,534 @@ Keep the sticky/pinned identity column for the case where the full grid really
|
|
|
2069
2877
|
must stay reachable (a spreadsheet-shaped tool), not as the default for a
|
|
2070
2878
|
records list.
|
|
2071
2879
|
|
|
2880
|
+
**A narrow container, not a narrow screen** (a table in a 360px card on a wide
|
|
2881
|
+
page): key `hidden` off the container's width instead of the viewport's. There
|
|
2882
|
+
is no built-in container breakpoint; one `ResizeObserver` does it:
|
|
2883
|
+
|
|
2884
|
+
```ts
|
|
2885
|
+
import { computed, useTemplateRef } from 'vue';
|
|
2886
|
+
import { useElementSize } from '@vueuse/core';
|
|
2887
|
+
|
|
2888
|
+
const card = useTemplateRef<HTMLElement>('card'); // <div ref="card"><BbTable …/></div>
|
|
2889
|
+
const { width } = useElementSize(card);
|
|
2890
|
+
|
|
2891
|
+
// The card width below which each secondary column drops, widest first.
|
|
2892
|
+
const dropBelow: Record<string, number> = { weight: 680, eta: 460 };
|
|
2893
|
+
|
|
2894
|
+
const visibleColumns = computed(() =>
|
|
2895
|
+
columns.map((column) => ({
|
|
2896
|
+
...column,
|
|
2897
|
+
hidden: width.value > 0 && width.value < (dropBelow[column.key] ?? 0),
|
|
2898
|
+
}))
|
|
2899
|
+
);
|
|
2900
|
+
```
|
|
2901
|
+
|
|
2902
|
+
`width.value > 0` keeps every column on the server and in the first client
|
|
2903
|
+
render, so hydration matches; the columns drop once the card is measured.
|
|
2904
|
+
|
|
2905
|
+
### Styling hooks
|
|
2906
|
+
|
|
2907
|
+
**The table's surface is `--bg`** (default `var(--bb-panel)`), a local on
|
|
2908
|
+
`.bb-table`. Cells are transparent at rest so the row can tint them, but
|
|
2909
|
+
anything that slides over scrolled content — the stuck header band with
|
|
2910
|
+
`fixed-headers`, and pinned (`fixed`) cells — is opaque and paints `--bg` (a
|
|
2911
|
+
pinned cell also picks up its row's hover/highlight tint, so it never reads
|
|
2912
|
+
as a hole). When a table sits on a surface that is not the panel colour, set
|
|
2913
|
+
the one knob and everything pinned follows:
|
|
2914
|
+
|
|
2915
|
+
```css
|
|
2916
|
+
.my-card .bb-table {
|
|
2917
|
+
--bg: var(--card-bg);
|
|
2918
|
+
}
|
|
2919
|
+
```
|
|
2920
|
+
|
|
2921
|
+
#### The table as a card
|
|
2922
|
+
|
|
2923
|
+
The root paints no background, border or radius of its own — it is the
|
|
2924
|
+
scrollport. That is exactly what makes a card four declarations of ordinary
|
|
2925
|
+
CSS on your own class, with no component change and nothing to keep in sync:
|
|
2926
|
+
|
|
2927
|
+
```css
|
|
2928
|
+
.bb-table.card {
|
|
2929
|
+
background: var(--bg);
|
|
2930
|
+
border: var(--bb-border-w) solid var(--bb-border);
|
|
2931
|
+
border-radius: var(--bb-radius-surface);
|
|
2932
|
+
}
|
|
2933
|
+
```
|
|
2934
|
+
|
|
2935
|
+
`background: var(--bg)` is the line that earns it. `--bg` is already what the
|
|
2936
|
+
stuck header band and pinned cells paint, so the card fill and the band are the
|
|
2937
|
+
same value by construction and cannot drift — and `.my-table { --bg: … }`
|
|
2938
|
+
still retints all three at once.
|
|
2939
|
+
|
|
2940
|
+
The radius needs no `overflow` beside it, and **must not be given one**. The
|
|
2941
|
+
root already clips in both axes (`overflow-x: auto`, and `overflow-y` computes
|
|
2942
|
+
to `auto` alongside it), so the radius rounds a clip that already exists: the
|
|
2943
|
+
header band and the last row are cut to the arc, concentric with no inner
|
|
2944
|
+
radius to derive. Adding `overflow: hidden` at a higher specificity takes
|
|
2945
|
+
horizontal scrolling away from the table entirely.
|
|
2946
|
+
|
|
2947
|
+
Two things that do bite:
|
|
2948
|
+
|
|
2949
|
+
- **Never put block padding on the root of a `fixed-headers` table.** The
|
|
2950
|
+
stuck band affixes to the _padding-box_ edge, so scrolled rows show through
|
|
2951
|
+
the strip above it. The card's inset has to come from `border`. Inline
|
|
2952
|
+
padding is fine — the component already uses it.
|
|
2953
|
+
- The border narrows the content box by `2 × --bb-border-w`, so the grid is
|
|
2954
|
+
two pixels narrower inside a card. Harmless, and the reason this is a border
|
|
2955
|
+
rather than an outline: an outline neither clips nor scroll-anchors.
|
|
2956
|
+
|
|
2957
|
+
The table is a **CSS grid of `<div>`s with ARIA roles, not a `<table>`**: the
|
|
2958
|
+
root `.bb-table__table[role=table]` owns the column tracks and every row group
|
|
2959
|
+
and row is a subgrid of it. Style it through the classes and the roles — never
|
|
2960
|
+
through element names, which match nothing:
|
|
2961
|
+
|
|
2962
|
+
| Region | Class | Role |
|
|
2963
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- |
|
|
2964
|
+
| grid root | `.bb-table__table` | `table` |
|
|
2965
|
+
| header group | `.bb-table__head` | `rowgroup` |
|
|
2966
|
+
| header row | `.bb-table__header-row` | `row` |
|
|
2967
|
+
| header cell | `.bb-table__cell-column-header` (+ `--select`, `--actions`) | `columnheader` |
|
|
2968
|
+
| body group | `.bb-table__body` | `rowgroup` |
|
|
2969
|
+
| data row | `.bb-table__row` (+ `--highlighted`) | `row` |
|
|
2970
|
+
| data cell | `.bb-table__cell` (+ `--select`) | `cell` (`gridcell` with `keyboard-navigation`) |
|
|
2971
|
+
| actions cell | `.bb-table__cell--actions` | `cell` (`gridcell` with `keyboard-navigation`) |
|
|
2972
|
+
| expand row | `.bb-table-expand__row` > `.bb-table-expand__cell` | `row` > `cell` (`gridcell`) |
|
|
2973
|
+
| empty state | `.bb-table-empty__row` > `.bb-table-empty__cell` | `row` > `cell` |
|
|
2974
|
+
| footer group | `.bb-table__foot` (`#tfoot` content) | `rowgroup` only when `#tfoot` is provided |
|
|
2975
|
+
| focused cell | `[tabindex]:focus-visible` on `.bb-table__cell`, `.bb-table__cell-column-header`, `.bb-table-expand__cell` / `__row` (inset ring; the grid's roving stop, or a `reorderable` header) | `gridcell` / `columnheader` / `row` |
|
|
2976
|
+
| dragged column | `.bb-table__cell-column-header--dragging` on the header; `.bb-table__head--dragging` on the head group during a drag | — |
|
|
2977
|
+
| clipped header | `.bb-table__cell-column-header--clip` (the track is a length or an equal split, so the label ellipsizes instead of flooring the column) | `columnheader` |
|
|
2978
|
+
| virtual table | `.bb-table--virtual` on the container (`overflow: auto`, the scroller once its height is bounded) | — |
|
|
2979
|
+
| spacer row | `.bb-table-spacer__row` (a `virtual` body's stand-in for unmounted rows, `aria-hidden`; never style its height) | — (`aria-hidden`) |
|
|
2980
|
+
| placeholder row | `.bb-table-placeholder__row` (+ `--pending`) — one node, no cells (a `virtual` body's skeleton band, also on the spacer, and fast-scroll stand-in) | — (`aria-hidden`) |
|
|
2981
|
+
| loading skeleton | `.bb-table-skeleton__row` > `.bb-table-skeleton__cell` (+ `--select`, `--<skeleton>`) > `.bb-table-skeleton__placeholder` (first load, nothing to show yet) | `row` > `cell` |
|
|
2982
|
+
| drag chip | `.bb-table-column-ghost` (a `popover="manual"` in the top layer; paints `--bb-panel`, not the table's `--bg`) | — (`aria-hidden`) |
|
|
2983
|
+
| caption | `.bb-table__caption` (before the root, `aria-labelledby`) | — |
|
|
2984
|
+
|
|
2985
|
+
`[role='row']`, `[role='cell']` and `[role='columnheader']` are supported
|
|
2986
|
+
hooks, not incidental markup — use them when you mean "every row kind" or
|
|
2987
|
+
"every cell"; use the classes when you mean one kind. The table root is
|
|
2988
|
+
`role="table"`, `"grid"` or `"treegrid"` (see **Keyboard navigation**), and
|
|
2989
|
+
under `keyboard-navigation` the body cells are `[role='gridcell']`, and a
|
|
2990
|
+
`rowHeader` column's cells are `[role='rowheader']` in both — write
|
|
2991
|
+
`:is([role='cell'], [role='gridcell'], [role='rowheader'])`, or the cell
|
|
2992
|
+
classes, for a rule that must hold everywhere. Cells are direct
|
|
2993
|
+
children of their row, so `:first-child` / `:last-child` / `:nth-child(n)`
|
|
2994
|
+
address columns.
|
|
2995
|
+
|
|
2996
|
+
The full-bleed idiom every workspace page reaches for — the table bleeds past
|
|
2997
|
+
the content padding and hands the inset back to its outermost cells — is
|
|
2998
|
+
written with a **direct-child chain** so a nested table inheriting the
|
|
2999
|
+
parent's tracks (it lives inside `.bb-table-expand__cell`) is never touched:
|
|
3000
|
+
|
|
3001
|
+
```css
|
|
3002
|
+
.table-flush {
|
|
3003
|
+
--page-inset: 1rem;
|
|
3004
|
+
margin-inline: calc(var(--page-inset) * -1);
|
|
3005
|
+
width: calc(100% + var(--page-inset) * 2);
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
.table-flush
|
|
3009
|
+
:deep(> .bb-table__table > .bb-table__head > [role='row'] > :first-child),
|
|
3010
|
+
.table-flush
|
|
3011
|
+
:deep(
|
|
3012
|
+
> .bb-table__table
|
|
3013
|
+
> .bb-table__body
|
|
3014
|
+
> [role='row']
|
|
3015
|
+
> :first-child:not(.bb-table-expand__cell)
|
|
3016
|
+
) {
|
|
3017
|
+
padding-inline-start: var(--page-inset);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
.table-flush
|
|
3021
|
+
:deep(> .bb-table__table > .bb-table__head > [role='row'] > :last-child),
|
|
3022
|
+
.table-flush
|
|
3023
|
+
:deep(
|
|
3024
|
+
> .bb-table__table
|
|
3025
|
+
> .bb-table__body
|
|
3026
|
+
> [role='row']
|
|
3027
|
+
> :last-child:not(.bb-table-expand__cell)
|
|
3028
|
+
) {
|
|
3029
|
+
padding-inline-end: var(--page-inset);
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
/* Expand rows stay edge-to-edge so the nested table can snap onto the parent
|
|
3033
|
+
tracks without an extra inset shifting it sideways. */
|
|
3034
|
+
.table-flush
|
|
3035
|
+
:deep(
|
|
3036
|
+
> .bb-table__table > .bb-table__body > [role='row'] > .bb-table-expand__cell
|
|
3037
|
+
) {
|
|
3038
|
+
padding-inline: 0;
|
|
3039
|
+
}
|
|
3040
|
+
```
|
|
3041
|
+
|
|
3042
|
+
Leave the geometry alone: `display: grid` / `gap: 0` on the root, row groups
|
|
3043
|
+
and rows, `grid-column: 1 / -1` **and `contain: inline-size`** on the
|
|
3044
|
+
full-width cells (without the containment, expand-row content resizes the
|
|
3045
|
+
parent's columns), `white-space: nowrap` on the actions cell (it sizes the
|
|
3046
|
+
actions track), and `position: sticky` on `.bb-table__head` under
|
|
3047
|
+
`fixed-headers`.
|
|
3048
|
+
|
|
3049
|
+
When you replace a region with `#thead` / `#tbody` / `#tfoot`, ship the same
|
|
3050
|
+
shape the table does — role-complete rows, spanning with `grid-column` rather
|
|
3051
|
+
than `colspan`:
|
|
3052
|
+
|
|
3053
|
+
```vue
|
|
3054
|
+
<template #tfoot="{ columnCount }">
|
|
3055
|
+
<div role="row">
|
|
3056
|
+
<div
|
|
3057
|
+
role="cell"
|
|
3058
|
+
:aria-colspan="columnCount - 1"
|
|
3059
|
+
:style="{ gridColumn: `span ${columnCount - 1}` }"
|
|
3060
|
+
>
|
|
3061
|
+
Total
|
|
3062
|
+
</div>
|
|
3063
|
+
<div role="cell" class="text-right">{{ total }}</div>
|
|
3064
|
+
</div>
|
|
3065
|
+
</template>
|
|
3066
|
+
```
|
|
3067
|
+
|
|
3068
|
+
A `<tr>` inside the grid is not merely unsemantic — the browser wraps it in an
|
|
3069
|
+
implicit `<table>` and the cells never land on the tracks. Nothing lints the
|
|
3070
|
+
roles: a `<div>` row without them renders fine and is invisible to a screen
|
|
3071
|
+
reader.
|
|
3072
|
+
|
|
2072
3073
|
### Config and platform
|
|
2073
3074
|
|
|
2074
3075
|
- **Locale.** The plugin's `locale` (`it`/`en`) drives the built-in strings:
|
|
2075
|
-
the
|
|
3076
|
+
the empty text, the select-all label, the single-select header text, and
|
|
2076
3077
|
the "Select" prefix of each row's accessible selection label. Override any
|
|
2077
|
-
of them per table via `
|
|
3078
|
+
of them per table via `empty-text` / `select-all-label` / `select-text`.
|
|
2078
3079
|
- **`actions-text` is localized** like the other built-in strings (`it` →
|
|
2079
|
-
`Azioni`, `en` → `Actions`). Seeing `
|
|
2080
|
-
plugin is still on the default locale, which is `
|
|
3080
|
+
`Azioni`, `en` → `Actions`). Seeing `Actions` in an Italian app means the
|
|
3081
|
+
plugin is still on the default locale, which is `en` — set the plugin's
|
|
2081
3082
|
`locale` option, or override per table with `actions-text` (it is visually
|
|
2082
3083
|
hidden in the header but read by screen readers).
|
|
2083
|
-
- **SSR / Nuxt.**
|
|
2084
|
-
`onServerPrefetch
|
|
2085
|
-
|
|
2086
|
-
|
|
3084
|
+
- **SSR / Nuxt.** Under `bitboss-ui/nuxt` a provider `items` function
|
|
3085
|
+
participates in `onServerPrefetch` and its rows travel in the Nuxt payload, so
|
|
3086
|
+
the first page renders server-side and hydrates without re-fetching. On other
|
|
3087
|
+
SSR hosts the provider runs on the client only and the server renders the
|
|
3088
|
+
empty table — see [SSR prefill](./guides/ssr-prefill.md). The table context
|
|
3089
|
+
(and thus `table-id` pagination wiring) is wired on the server as well, one
|
|
3090
|
+
registry per request, so a pager bound by `table-id` alone renders the
|
|
3091
|
+
table's page count in the server HTML.
|
|
2087
3092
|
- **Forms.** With `name`, the selection submits as hidden inputs — no JS
|
|
2088
3093
|
needed between the table and a plain `<form>` POST (Inertia included).
|
|
2089
3094
|
|
|
3095
|
+
### Restyling with passthrough
|
|
3096
|
+
|
|
3097
|
+
`pt` reaches a named part of the table with a class list — or, in the
|
|
3098
|
+
object form, a style and attributes — optionally only while a state is on.
|
|
3099
|
+
Parts: `root` (the container), `caption` (the visible caption), `table` (the
|
|
3100
|
+
grid), `head` / `body` / `foot` (the row groups), `header-row`,
|
|
3101
|
+
`cell-column-header` (every header cell — the select and actions ones
|
|
3102
|
+
included, a broadcast), `row` (every DATA row, a broadcast) and `cell` (every
|
|
3103
|
+
data cell — the select and actions cells included, a broadcast), and three
|
|
3104
|
+
glyphs: `sort-icon`, `select-icon` (each row's checkbox or radio and the
|
|
3105
|
+
select-all) and `drag-icon` (on the chip a column drag carries). The grid is
|
|
3106
|
+
`div`s with ARIA roles, so these are parts, not `th` / `td` selectors.
|
|
3107
|
+
|
|
3108
|
+
States: `loading` and `empty` (the table); `selected`, `highlighted`,
|
|
3109
|
+
`expanded` and `disabled` resolved per row — a cell takes its row's states,
|
|
3110
|
+
and a row's `select-icon` its `selected` / `disabled`; `sorted` /
|
|
3111
|
+
`sorted-desc` per header, on its cell and its `sort-icon`; `indeterminate` on
|
|
3112
|
+
the select-all glyph. **`disabled` means the row cannot be selected**
|
|
3113
|
+
(`selectable` rejects it, or the table is `disabled`): the row still clicks,
|
|
3114
|
+
highlights and expands, and a table without selection never has it. Expand
|
|
3115
|
+
rows, the empty row and the skeleton are not parts — `pt:row:expanded` and
|
|
3116
|
+
`pt:body:empty` cover the usual asks.
|
|
3117
|
+
|
|
3118
|
+
The selectable invoices table above, restyled through those parts: muted
|
|
3119
|
+
type on `pt:head`, weight on `pt:row:selected` (Globex is checked), a muted
|
|
3120
|
+
wash on `pt:row:highlighted` (Initech is open). Clicking a row still toggles
|
|
3121
|
+
highlight; the checkboxes still select.
|
|
3122
|
+
|
|
3123
|
+
**pt:row and pt:cell — highlighted and selected invoices**
|
|
3124
|
+
|
|
3125
|
+
```vue
|
|
3126
|
+
<template>
|
|
3127
|
+
<div class="flex max-w-2xl flex-col gap-2">
|
|
3128
|
+
<div
|
|
3129
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
3130
|
+
>
|
|
3131
|
+
<BbTable
|
|
3132
|
+
v-model="selected"
|
|
3133
|
+
v-model:highlighted="highlighted"
|
|
3134
|
+
caption="Invoices"
|
|
3135
|
+
:columns="columns"
|
|
3136
|
+
compact
|
|
3137
|
+
item-value="id"
|
|
3138
|
+
:items="invoices"
|
|
3139
|
+
keyboard-navigation
|
|
3140
|
+
legend="Select invoices"
|
|
3141
|
+
name="pt-invoices"
|
|
3142
|
+
pt:cell="text-sm"
|
|
3143
|
+
pt:head="text-xs font-medium text-(--bb-text-muted)"
|
|
3144
|
+
pt:row="cursor-pointer"
|
|
3145
|
+
pt:row:highlighted="bg-(--bb-muted)"
|
|
3146
|
+
pt:row:selected="font-medium"
|
|
3147
|
+
selectable
|
|
3148
|
+
/>
|
|
3149
|
+
</div>
|
|
3150
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
3151
|
+
Checked rows are selected;
|
|
3152
|
+
<span class="font-medium text-(--bb-text)">{{ openLabel }}</span>
|
|
3153
|
+
is highlighted (open).
|
|
3154
|
+
</p>
|
|
3155
|
+
</div>
|
|
3156
|
+
</template>
|
|
3157
|
+
|
|
3158
|
+
<script setup lang="ts">
|
|
3159
|
+
import { computed, ref } from 'vue';
|
|
3160
|
+
import { BbTable } from 'bitboss-ui';
|
|
3161
|
+
import type { BbTableColumn } from 'bitboss-ui';
|
|
3162
|
+
|
|
3163
|
+
type Invoice = { id: string; number: string; client: string; amount: string };
|
|
3164
|
+
|
|
3165
|
+
const columns: Array<BbTableColumn<Invoice>> = [
|
|
3166
|
+
{ key: 'number', label: 'Invoice', width: 110 },
|
|
3167
|
+
{ key: 'client', label: 'Client' },
|
|
3168
|
+
{ key: 'amount', label: 'Amount', align: 'right', width: 100 },
|
|
3169
|
+
];
|
|
3170
|
+
|
|
3171
|
+
const invoices: Invoice[] = [
|
|
3172
|
+
{
|
|
3173
|
+
id: '1',
|
|
3174
|
+
number: 'INV-1041',
|
|
3175
|
+
client: 'Northwind Traders',
|
|
3176
|
+
amount: '€4,200',
|
|
3177
|
+
},
|
|
3178
|
+
{ id: '2', number: 'INV-1042', client: 'Globex', amount: '€980' },
|
|
3179
|
+
{ id: '3', number: 'INV-1043', client: 'Initech', amount: '€15,600' },
|
|
3180
|
+
];
|
|
3181
|
+
|
|
3182
|
+
const selected = ref<string[]>(['2']);
|
|
3183
|
+
const highlighted = ref<string | null>('3');
|
|
3184
|
+
|
|
3185
|
+
const openLabel = computed(() => {
|
|
3186
|
+
const invoice = invoices.find((row) => row.id === highlighted.value);
|
|
3187
|
+
return invoice ? `${invoice.number} · ${invoice.client}` : 'none';
|
|
3188
|
+
});
|
|
3189
|
+
</script>
|
|
3190
|
+
```
|
|
3191
|
+
|
|
3192
|
+
The header and row states together: every header cell in small caps, the
|
|
3193
|
+
sorted column's header in full ink and its arrow in the primary color, a paid
|
|
3194
|
+
invoice (which `selectable` rejects) muted with a faded checkbox, and the
|
|
3195
|
+
expanded row washed.
|
|
3196
|
+
|
|
3197
|
+
**pt:cell-column-header, sort-icon, row:expanded, row:disabled**
|
|
3198
|
+
|
|
3199
|
+
```vue
|
|
3200
|
+
<template>
|
|
3201
|
+
<div
|
|
3202
|
+
class="max-w-2xl overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
3203
|
+
>
|
|
3204
|
+
<BbTable
|
|
3205
|
+
v-model="selected"
|
|
3206
|
+
v-model:expanded-items="expanded"
|
|
3207
|
+
v-model:sort="sort"
|
|
3208
|
+
caption="Invoices"
|
|
3209
|
+
:columns="columns"
|
|
3210
|
+
compact
|
|
3211
|
+
item-value="id"
|
|
3212
|
+
:items="invoices"
|
|
3213
|
+
legend="Select invoices"
|
|
3214
|
+
name="pt-invoice-headers"
|
|
3215
|
+
pt:cell-column-header="text-xs uppercase tracking-wide"
|
|
3216
|
+
pt:cell-column-header:sorted="text-(--bb-text)"
|
|
3217
|
+
pt:row:disabled="text-(--bb-text-muted)"
|
|
3218
|
+
pt:row:expanded="bg-(--bb-muted)"
|
|
3219
|
+
pt:select-icon:disabled="opacity-40"
|
|
3220
|
+
pt:sort-icon="text-(--bb-primary)"
|
|
3221
|
+
:selectable="(invoice: Invoice) => !invoice.paid"
|
|
3222
|
+
>
|
|
3223
|
+
<template #actions="{ expanded: open, toggleExpanded }">
|
|
3224
|
+
<BbButton size="sm" variant="ghost" @click="toggleExpanded">
|
|
3225
|
+
{{ open ? 'Hide' : 'Notes' }}
|
|
3226
|
+
</BbButton>
|
|
3227
|
+
</template>
|
|
3228
|
+
<template #expand="{ item }">
|
|
3229
|
+
<p class="p-3 text-sm">{{ item.note }}</p>
|
|
3230
|
+
</template>
|
|
3231
|
+
</BbTable>
|
|
3232
|
+
</div>
|
|
3233
|
+
</template>
|
|
3234
|
+
|
|
3235
|
+
<script setup lang="ts">
|
|
3236
|
+
import { ref } from 'vue';
|
|
3237
|
+
import { BbButton, BbTable } from 'bitboss-ui';
|
|
3238
|
+
import type { BbTableColumn, BbTableSortEntry } from 'bitboss-ui';
|
|
3239
|
+
|
|
3240
|
+
type Invoice = {
|
|
3241
|
+
id: string;
|
|
3242
|
+
number: string;
|
|
3243
|
+
client: string;
|
|
3244
|
+
paid: boolean;
|
|
3245
|
+
note: string;
|
|
3246
|
+
};
|
|
3247
|
+
|
|
3248
|
+
const columns: Array<BbTableColumn<Invoice>> = [
|
|
3249
|
+
{ key: 'number', label: 'Invoice', width: 110, sortable: true },
|
|
3250
|
+
{ key: 'client', label: 'Client', sortable: true },
|
|
3251
|
+
];
|
|
3252
|
+
|
|
3253
|
+
const invoices: Invoice[] = [
|
|
3254
|
+
{
|
|
3255
|
+
id: '1',
|
|
3256
|
+
number: 'INV-1041',
|
|
3257
|
+
client: 'Northwind Traders',
|
|
3258
|
+
paid: false,
|
|
3259
|
+
note: 'Second reminder sent.',
|
|
3260
|
+
},
|
|
3261
|
+
{
|
|
3262
|
+
id: '2',
|
|
3263
|
+
number: 'INV-1042',
|
|
3264
|
+
client: 'Globex',
|
|
3265
|
+
paid: true,
|
|
3266
|
+
note: 'Paid by bank transfer.',
|
|
3267
|
+
},
|
|
3268
|
+
{
|
|
3269
|
+
id: '3',
|
|
3270
|
+
number: 'INV-1043',
|
|
3271
|
+
client: 'Initech',
|
|
3272
|
+
paid: false,
|
|
3273
|
+
note: 'Disputed amount.',
|
|
3274
|
+
},
|
|
3275
|
+
];
|
|
3276
|
+
|
|
3277
|
+
const selected = ref<string[]>([]);
|
|
3278
|
+
const expanded = ref<string[]>(['3']);
|
|
3279
|
+
const sort = ref<BbTableSortEntry[]>([['number', 'desc']]);
|
|
3280
|
+
</script>
|
|
3281
|
+
```
|
|
3282
|
+
|
|
3283
|
+
This is what the `:deep(.bb-table__row--highlighted)` reach-in of old
|
|
3284
|
+
becomes: `pt:row:highlighted`. Pinned (`fixed`) cells paint their own
|
|
3285
|
+
background from `--row-bg`, so a highlight fill that must survive under a
|
|
3286
|
+
pinned column goes through the token:
|
|
3287
|
+
`:pt:row:highlighted="{ style: { '--row-bg': 'var(--bb-muted)' } }"`.
|
|
3288
|
+
|
|
3289
|
+
A value that depends on the ITEM — a danger wash on overdue rows — is a
|
|
3290
|
+
**per-item function** on `pt:row`: `({ item, highlighted }) => …`, called
|
|
3291
|
+
with the row's item and every state as a boolean for it, its result merged after the
|
|
3292
|
+
state entries (so the overdue wash below steps aside while the row is
|
|
3293
|
+
highlighted). `rowClass` still works and is computed once per row rather than
|
|
3294
|
+
per render; `pt:cell` takes no function (`tdClass` is the per-cell hook).
|
|
3295
|
+
|
|
3296
|
+
**pt:row as a function — overdue invoices washed by status**
|
|
3297
|
+
|
|
3298
|
+
```vue
|
|
3299
|
+
<template>
|
|
3300
|
+
<div class="flex max-w-2xl flex-col gap-2">
|
|
3301
|
+
<div
|
|
3302
|
+
class="overflow-hidden rounded-(--bb-radius) border border-(--bb-border)"
|
|
3303
|
+
>
|
|
3304
|
+
<BbTable
|
|
3305
|
+
v-model:highlighted="highlighted"
|
|
3306
|
+
caption="Invoices by status"
|
|
3307
|
+
:columns="columns"
|
|
3308
|
+
compact
|
|
3309
|
+
item-value="id"
|
|
3310
|
+
:items="invoices"
|
|
3311
|
+
keyboard-navigation
|
|
3312
|
+
name="pt-row-status"
|
|
3313
|
+
:pt="{ row: 'cursor-pointer' }"
|
|
3314
|
+
pt:cell="text-sm"
|
|
3315
|
+
pt:head="text-xs font-medium text-(--bb-text-muted)"
|
|
3316
|
+
:pt:row="
|
|
3317
|
+
({ item, highlighted }) =>
|
|
3318
|
+
item.status === 'overdue' &&
|
|
3319
|
+
!highlighted &&
|
|
3320
|
+
'bg-red-50 text-red-900'
|
|
3321
|
+
"
|
|
3322
|
+
pt:row:highlighted="bg-(--bb-muted)"
|
|
3323
|
+
/>
|
|
3324
|
+
</div>
|
|
3325
|
+
<p class="text-xs text-(--bb-text-muted)">
|
|
3326
|
+
Overdue rows are washed by their own data; click one and the highlight
|
|
3327
|
+
wash takes over.
|
|
3328
|
+
</p>
|
|
3329
|
+
</div>
|
|
3330
|
+
</template>
|
|
3331
|
+
|
|
3332
|
+
<script setup lang="ts">
|
|
3333
|
+
import { ref } from 'vue';
|
|
3334
|
+
import { BbTable } from 'bitboss-ui';
|
|
3335
|
+
import type { BbTableColumn } from 'bitboss-ui';
|
|
3336
|
+
|
|
3337
|
+
type Invoice = {
|
|
3338
|
+
id: string;
|
|
3339
|
+
number: string;
|
|
3340
|
+
client: string;
|
|
3341
|
+
amount: string;
|
|
3342
|
+
status: 'paid' | 'open' | 'overdue';
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3345
|
+
const columns: Array<BbTableColumn<Invoice>> = [
|
|
3346
|
+
{ key: 'number', label: 'Invoice', width: 110 },
|
|
3347
|
+
{ key: 'client', label: 'Client' },
|
|
3348
|
+
{ key: 'status', label: 'Status', width: 100 },
|
|
3349
|
+
{ key: 'amount', label: 'Amount', align: 'right', width: 100 },
|
|
3350
|
+
];
|
|
3351
|
+
|
|
3352
|
+
const invoices: Invoice[] = [
|
|
3353
|
+
{
|
|
3354
|
+
id: '1',
|
|
3355
|
+
number: 'INV-1041',
|
|
3356
|
+
client: 'Northwind Traders',
|
|
3357
|
+
amount: '€4,200',
|
|
3358
|
+
status: 'paid',
|
|
3359
|
+
},
|
|
3360
|
+
{
|
|
3361
|
+
id: '2',
|
|
3362
|
+
number: 'INV-1042',
|
|
3363
|
+
client: 'Globex',
|
|
3364
|
+
amount: '€980',
|
|
3365
|
+
status: 'overdue',
|
|
3366
|
+
},
|
|
3367
|
+
{
|
|
3368
|
+
id: '3',
|
|
3369
|
+
number: 'INV-1043',
|
|
3370
|
+
client: 'Initech',
|
|
3371
|
+
amount: '€15,600',
|
|
3372
|
+
status: 'open',
|
|
3373
|
+
},
|
|
3374
|
+
{
|
|
3375
|
+
id: '4',
|
|
3376
|
+
number: 'INV-1044',
|
|
3377
|
+
client: 'Umbrella',
|
|
3378
|
+
amount: '€2,150',
|
|
3379
|
+
status: 'overdue',
|
|
3380
|
+
},
|
|
3381
|
+
];
|
|
3382
|
+
|
|
3383
|
+
// The per-item function (inline on `:pt:row`, typed as `Invoice` — the table
|
|
3384
|
+
// is generic over its items): the row's own `status` decides the wash. The
|
|
3385
|
+
// result is merged AFTER `pt:row:highlighted`, so a highlighted overdue row
|
|
3386
|
+
// would keep the red wash — step aside while the row is highlighted instead.
|
|
3387
|
+
const highlighted = ref<string | null>(null);
|
|
3388
|
+
</script>
|
|
3389
|
+
```
|
|
3390
|
+
|
|
3391
|
+
The full grammar, the merge rules and the global map are in the
|
|
3392
|
+
[passthrough guide](./guides/passthrough.md).
|
|
3393
|
+
|
|
3394
|
+
A `pt` value written in `<script>` (a constant, a preset, a wrapper's
|
|
3395
|
+
`pt` prop) is typed as `BbTableProps<Row>['pt']`, or `BbTableProps['pt']`
|
|
3396
|
+
for a preset that fits any row type (never `<any>`), not an imported
|
|
3397
|
+
`PtValue`: see
|
|
3398
|
+
[passthrough § Typing `pt` in `<script>`](./guides/passthrough.md#typing-pt-in-script).
|
|
3399
|
+
|
|
2090
3400
|
### Works well with
|
|
2091
3401
|
|
|
2092
3402
|
- `BbPagination` — shared page ref, or zero-wiring via `id` + `table-id`.
|
|
2093
3403
|
- `useBbTableContext` (`./composables/useBbTableContext.md`) — bulk-action
|
|
2094
3404
|
toolbars, detail panels, "reset sort" buttons living outside the table.
|
|
3405
|
+
(Column order and visibility are not mirrored there: a column panel writes
|
|
3406
|
+
`v-model:order` and the `hidden` flags, so it lives where `columns` is
|
|
3407
|
+
built.)
|
|
2095
3408
|
- `BbButton` — per-row links (`href`/`to`) in cells or `#actions`;
|
|
2096
3409
|
`BbDropdown` for an overflow menu of row actions.
|
|
2097
3410
|
- `BbBadge` / `BbAvatar` — status and identity cells via slots.
|
|
@@ -2107,19 +3420,33 @@ records list.
|
|
|
2107
3420
|
|
|
2108
3421
|
### Gotchas and constraints
|
|
2109
3422
|
|
|
2110
|
-
- Slot names are **
|
|
2111
|
-
`#
|
|
3423
|
+
- Slot names are **kebab-case** (since 3.0.0-beta.41): a camelCase key like
|
|
3424
|
+
`issuedAt` yields `#issued-at`, `first_name` yields `#first-name`. Unsure?
|
|
3425
|
+
Write `#[slotKey('…')]`.
|
|
2112
3426
|
- `loading-text` is `sr-only` — it is announced, never painted. The visible
|
|
2113
3427
|
loading signal is the skeleton (or your `#loading` slot). It defaults to the
|
|
2114
3428
|
localized `common.loadingText`, so an unset value still announces.
|
|
2115
3429
|
- Row selection labels default to the localized "select" word plus every
|
|
2116
3430
|
cell's content. `accessible-label` overrides that per row — it is called
|
|
2117
|
-
`(columns, item)` with the mapped cells
|
|
2118
|
-
|
|
3431
|
+
`(columns, item)` with the mapped cells (in **render** order — look them up
|
|
3432
|
+
by `key`, never by position) and the raw record, and whatever it returns
|
|
3433
|
+
becomes the checkbox's label.
|
|
3434
|
+
- A pin (`column.fixed`) travels with its column under `order`, but its
|
|
3435
|
+
offset is positional: dragged away from the edge, a pinned column sticks
|
|
3436
|
+
at `left: 0` and slides over the columns before it (see Pinned columns).
|
|
3437
|
+
- The actions column has no prop: the `#actions` slot creates it. A
|
|
3438
|
+
conditional slot (`<template v-if="…" #actions>`) adds and removes the
|
|
3439
|
+
column live.
|
|
3440
|
+
- A column panel that holds a partial `order` receives the completed
|
|
3441
|
+
array on the user's first move — its persisted list grows to every declared
|
|
3442
|
+
key, `hidden` ones included. Hide with the flag, not by filtering
|
|
3443
|
+
`columns`: a filtered column is undeclared, so a partial model completes
|
|
3444
|
+
without it and the key is gone from the persisted order.
|
|
2119
3445
|
- Enabling select-all does not re-emit an empty `modelValue` (see the
|
|
2120
3446
|
select-all section) — in all-mode, read `select-all` +
|
|
2121
3447
|
`unselected-items`, not `modelValue`.
|
|
2122
|
-
- Row event payloads are
|
|
3448
|
+
- Row event payloads are `(event, item)` with `item` your raw record — there is
|
|
3449
|
+
no wrapper to unpack and no `selected` argument.
|
|
2123
3450
|
- A mistyped context/pagination `id` does not error; it silently syncs with
|
|
2124
3451
|
nothing. If a toolbar "works" but the table never reacts, check the id.
|
|
2125
3452
|
- In multiple mode `modelValue` must be an array, or it throws.
|
|
@@ -2150,18 +3477,55 @@ records list.
|
|
|
2150
3477
|
it falls back to `caption`, then a generic localized string, so it is never
|
|
2151
3478
|
left without an accessible name. Each selection control carries a
|
|
2152
3479
|
visually-hidden label built from the row's cell contents.
|
|
3480
|
+
- **Mark the column that names each row** with `rowHeader: true` (a
|
|
3481
|
+
customer's name, an order number). Its body cells become row headers
|
|
3482
|
+
(`role="rowheader"`), and a screen reader reading across a row, or down
|
|
3483
|
+
another column, announces that name with each value — "Ada Lovelace,
|
|
3484
|
+
ada@x.io" instead of a bare "ada@x.io". The cells look the same.
|
|
3485
|
+
`accessible-label` is a different thing: it only names each row's
|
|
3486
|
+
selection checkbox. The column:
|
|
3487
|
+
`{ key: 'name', label: 'Name', rowHeader: true }`.
|
|
3488
|
+
|
|
2153
3489
|
- Set `item-value` so selection, expansion and highlight track rows by stable
|
|
2154
3490
|
identity rather than object reference.
|
|
2155
3491
|
- Sortable headers set `aria-sort` and render real buttons; custom header
|
|
2156
3492
|
slots should keep a button calling `toggleSort`.
|
|
3493
|
+
- **The role follows the keyboard.** A plain table is `role="table"` with
|
|
3494
|
+
`cell`s. `keyboard-navigation` makes it `role="grid"` (the APG data grid:
|
|
3495
|
+
one tab stop, cell focus, `gridcell`s, `aria-selected` on selectable rows
|
|
3496
|
+
plus `aria-multiselectable` for multiple selection) — and `role="treegrid"`
|
|
3497
|
+
when an `#expand` slot exists (`aria-level` / `aria-expanded` /
|
|
3498
|
+
`aria-posinset` / `aria-setsize` on rows, Right/Left expand and collapse).
|
|
3499
|
+
Screen readers switch to focus mode inside a grid on their own, so the
|
|
3500
|
+
arrows reach the table without the browse-mode step a `role="table"` needed.
|
|
3501
|
+
An expandable table WITHOUT `keyboard-navigation` stays a table: its expand
|
|
3502
|
+
controllers are disclosure buttons (`aria-expanded` / `aria-controls`), and a
|
|
3503
|
+
treegrid would promise keys it does not have. Keys: **Keyboard navigation**
|
|
3504
|
+
above.
|
|
3505
|
+
- With `reorderable` the header row becomes one roving tab stop
|
|
3506
|
+
(the AG Grid grammar): ←/→ move focus between headers, Home/End to the
|
|
3507
|
+
ends, **Shift+←/→** move the focused column one slot (Shift+Home/End to
|
|
3508
|
+
the ends), Enter/Space sorts a sortable header — every move committed
|
|
3509
|
+
immediately and announced through a polite status region ("X moved to
|
|
3510
|
+
position 2 of 5"); a one-line sr-only instruction describes each header.
|
|
3511
|
+
The sort button leaves the tab order (the header is the target; it still
|
|
3512
|
+
works for the mouse). Without `keyboard-navigation` the table stays
|
|
3513
|
+
`role="table"`, and NVDA/JAWS browse mode intercepts arrows on the focused
|
|
3514
|
+
header (a focus-mode step). With it, the header row is simply the grid's
|
|
3515
|
+
first row: the plain arrows are the grid's, the Shift / Alt chords and
|
|
3516
|
+
Enter/Space stay the header's, and there is one tab stop for the whole
|
|
3517
|
+
table.
|
|
2157
3518
|
- When you paginate, pass `page` / `per-page` / `total-items` so the table
|
|
2158
3519
|
announces the full result count (`aria-rowcount`) and each row's absolute
|
|
2159
3520
|
index (`aria-rowindex`, expansion-aware), not just the current page.
|
|
2160
3521
|
- The loading row is an `aria-live` status; it announces the localized default
|
|
2161
3522
|
unless you give it a more specific `loading-text`.
|
|
2162
3523
|
- The highlighted row carries `aria-current="true"`; add `keyboard-navigation`
|
|
2163
|
-
so row-level interaction is reachable without a mouse (
|
|
2164
|
-
Arrow/PageUp/PageDown/Home/End, Enter/Space).
|
|
3524
|
+
so row-level interaction is reachable without a mouse (the grid: one tab
|
|
3525
|
+
stop, Arrow/PageUp/PageDown/Home/End, Enter/Space).
|
|
3526
|
+
- Under `keyboard-navigation` the controls inside cells leave the tab order
|
|
3527
|
+
(Enter/F2 reach them, Escape/F2 come back). A nested table inside an expand
|
|
3528
|
+
row keeps its own tab stops — it is its own widget.
|
|
2165
3529
|
- `aria-current` is announced to screen readers regardless, and a default
|
|
2166
3530
|
highlight tint ships for sighted users too — pass `row-class` to customize
|
|
2167
3531
|
it. See Row highlight above.
|
|
@@ -2173,6 +3537,7 @@ records list.
|
|
|
2173
3537
|
- `v-model:expandedItems` — type: `any[] \| undefined`
|
|
2174
3538
|
- `v-model:highlighted` — type: `any`
|
|
2175
3539
|
- `v-model` — type: `any`
|
|
3540
|
+
- `v-model:order` — type: `string[] \| undefined`
|
|
2176
3541
|
- `v-model:selectAll` — type: `boolean \| undefined`
|
|
2177
3542
|
- `v-model:sort` — type: `BbTableSortEntry[] \| undefined`
|
|
2178
3543
|
- `v-model:unselectedItems` — type: `any[] \| undefined`
|
|
@@ -2181,80 +3546,159 @@ records list.
|
|
|
2181
3546
|
|
|
2182
3547
|
| Prop | Type | Default | Required | Description |
|
|
2183
3548
|
| --- | --- | --- | --- | --- |
|
|
2184
|
-
| `
|
|
2185
|
-
| `
|
|
3549
|
+
| `pt:<part>`, `pt:<part>:<state>`, `pt` | `PtValue` | | | Passthrough — a class list, or `{ class, style, attrs }`, bound to one named part of the component; the state form applies only while that state is on. Parts: `body`, `caption`, `cell`, `cellColumnHeader`, `dragIcon`, `foot`, `head`, `headerRow`, `root`, `row`, `selectIcon`, `sortIcon`, `table`. States: `disabled`, `empty`, `expanded`, `highlighted`, `indeterminate`, `loading`, `selected`, `sorted`, `sortedDesc`. What each one is: _Passthrough parts and states_ below. `pt` is the object form with the same keys minus the prefix (`{ icon: '…', 'icon:loading': '…' }`). See `guides/passthrough.md`. In `<script>` a `pt` value is typed `BbTableProps<Row>['pt']` (`BbTableProps['pt']` for a preset that fits any row type, never `<any>`) (`PtValue` is not exported): § Typing `pt` in `<script>`. |
|
|
3550
|
+
| `accessibleLabel` | `((columns: MappedCell[], item: any) => string) \| undefined` | | | Function that accepts the columns and the current item as arguments and returns a label to be used for accessibility purposes. The cells arrive in RENDER order (they follow `order`, so the label reads like the row) — look a cell up by `key`, never by position. |
|
|
2186
3551
|
| `actionsText` | `string \| undefined` | | | Label used in the header of the actions column. |
|
|
2187
3552
|
| `align` | `"left" \| "center" \| "right" \| undefined` | `"left"` | | Text alignment of the columns. |
|
|
2188
3553
|
| `caption` | `string \| undefined` | | | Caption that describes the content of the table. Used for accessibility purposes. |
|
|
2189
|
-
| `columns` | `
|
|
2190
|
-
| `compact` | `boolean \| undefined` |
|
|
3554
|
+
| `columns` | `BbTableColumn<T>[] \| undefined` | `[]` | | Array of definitions of how the columns should be rendered. |
|
|
3555
|
+
| `compact` | `boolean \| undefined` | `false` | | Adds a CSS class that applies a compact style to the component. |
|
|
2191
3556
|
| `dependencies` | `unknown[] \| undefined` | `[]` | | Defines an array of dependencies that will trigger actions in the component upon change. |
|
|
2192
3557
|
| `depsDebounceTime` | `number \| undefined` | `0` | | Timeout used to debounce response to changes to dependencies. |
|
|
2193
|
-
| `disabled` | `boolean \| undefined` |
|
|
2194
|
-
| `disableSelectAll` | `boolean \| undefined` |
|
|
2195
|
-
| `displayCaption` | `boolean \| undefined` |
|
|
2196
|
-
| `
|
|
2197
|
-
| `
|
|
2198
|
-
| `
|
|
2199
|
-
| `
|
|
2200
|
-
| `
|
|
2201
|
-
| `
|
|
2202
|
-
| `
|
|
3558
|
+
| `disabled` | `boolean \| undefined` | `false` | | Disables the component |
|
|
3559
|
+
| `disableSelectAll` | `boolean \| undefined` | `false` | | Hides the "Select all" checkbox that selectable multi-row tables display by default. |
|
|
3560
|
+
| `displayCaption` | `boolean \| undefined` | `false` | | Shows the caption as a visible title. Off by default: the caption is visually hidden but still read by screen readers. |
|
|
3561
|
+
| `emptyText` | `string \| undefined` | `the localized `common.emptyText` ("No data to display")` | | String displayed when there are no items to display. |
|
|
3562
|
+
| `enforceCoherence` | `boolean \| undefined` | `false` | | After every load (initial, `dependencies` refetch or a change of the `items` array) prunes the row-keyed models of values whose row is no longer in the result set: `modelValue`, `unselected-items`, `highlighted` and `expanded-items`. Values whose rows are still present survive. Single-value models (`modelValue` without `multiple`, and `highlighted`, which is always single) reset to `null`. Do **not** enable it on a provider-paginated table (`items` is a function): a page change always refetches, so state held on rows of other pages (the `select-all` + `unselected-items` pattern, cross-page selections) would be pruned. Reconcile in the items provider instead. |
|
|
3563
|
+
| `expandedItems` | `any[] \| undefined` | `[]` | | Used by `v-model:expandedItems`. Array of the currently expanded items — toggled by the row expand control and by external writes (mirrors the `highlighted`/`sort` v-model surfaces). Drives the `#expand` slot rows and their `aria-expanded`/`aria-controls` wiring. |
|
|
3564
|
+
| `fixed` | `boolean \| undefined` | `false` | | Splits the width equally among the columns that declare no `width` (each undeclared column becomes a `minmax(0, 1fr)` track) making each column take up the same amount of space. |
|
|
3565
|
+
| `fixedActions` | `boolean \| undefined` | `false` | | Pins the actions column (the one the `#actions` slot creates) to the right edge, `position: sticky`, in place. Data columns pin through `column.fixed`; this is the same feature for the structural column that has no definition to carry it. No effect without an `#actions` slot. |
|
|
3566
|
+
| `fixedHeaders` | `boolean \| undefined` | `false` | | Boolean that sets the headers as sticky to the top of the table. |
|
|
3567
|
+
| `fixedSelect` | `boolean \| undefined` | `false` | | Pins the selection column to the left edge, `position: sticky`, in place. Data columns pin through `column.fixed`; this is the same feature for the structural column that has no definition to carry it. No effect unless the table is `selectable`. |
|
|
3568
|
+
| `headerRowClass` | `Classes \| undefined` | | | Defines the classes to be passed to the header row. |
|
|
3569
|
+
| `highlighted` | `any` | `undefined` | | Used by `v-model:highlighted`. A parallel, UI-intent state to selection — typically "the row whose details are open". A single item value (or `null`) — highlight is single by design. **Opt-in, and `undefined` is the opt-out.** Leave it unbound and the whole mechanic is off: clicking a row emits `click:row` and nothing else — no class, no `aria-current`, no internal state. Bind it and clicking a row toggles it. The value itself is the switch: `undefined` means "never initialised", `null` means "initialised and currently empty", so bind `ref(null)` rather than `ref()` — a bound-but-`undefined` model warns in dev and stays off. A value seeded through `useBbTableContext(id, { highlighted })` counts as bound the same way. A highlighted row gets `aria-current="true"` and the `bb-table__row--highlighted` class, which the shipped stylesheet paints with a neutral fill plus a brand accent bar; override the whole look with `rowClass`. Highlight: a parallel, UI-intent state to selection ("the row whose details are open"). Always a single value or `null`. Purely mechanical — highlighted rows only get a class and `aria-current`, no shipped styling. |
|
|
2203
3570
|
| `id` | `string \| undefined` | | | Stable id for this table's width context. When omitted a unique id is generated. Nested tables use the nearest ancestor id to inherit widths. |
|
|
2204
|
-
| `inheritColumnWidths` | `string \| boolean \| undefined` | | | Opt a nested table into inheriting its column widths from an ancestor table's matching tracks (accounting for `select`/`actions` columns). This also
|
|
2205
|
-
| `interactiveWhileLoading` | `boolean \| undefined` |
|
|
3571
|
+
| `inheritColumnWidths` | `string \| boolean \| undefined` | | | Opt a nested table into inheriting its column widths from an ancestor table's matching tracks (accounting for `select`/`actions` columns). This also makes the parent's tracks authoritative, so it is **off by default** — a nested table renders independently unless you ask for alignment. - `false` (the default): do not inherit; size independently. - `true`: inherit from the nearest ancestor table. - a table id (string): inherit from the specific ancestor in the chain with that id rather than the immediate parent. Use this when an intermediate table has a different column count, so the extra columns would otherwise misalign against it. |
|
|
3572
|
+
| `interactiveWhileLoading` | `boolean \| undefined` | `false` | | Keeps the table interactive while it is loading. The header and the rows are `inert` while loading by default — a refetch is about to replace the rows, so editing, selecting or sorting them races the incoming data. This escape hatch exists for tables that must stay usable during background refreshes (e.g. a poll that must not interrupt an open editor). The loading announcement is never inert, so the busy state is always conveyed. |
|
|
2206
3573
|
| `items` | `Item[] \| ((prefill: boolean, modelValue?: any) => Item[] \| Promise<Item[]>)` | `[]` | yes | Rows to render, or a fetcher that returns them. |
|
|
2207
|
-
| `itemValue` | `ItemAccessor<Item> \| undefined` | | |
|
|
2208
|
-
| `keyboardNavigation` | `boolean \| undefined` |
|
|
2209
|
-
| `legend` | `string \| undefined` | | | Text content of the `<legend>` a `selectable` table renders (it becomes a `<fieldset>`, and the legend is that fieldset's accessible name). Omit it and the table falls back to `caption`, then to a localized default — the fieldset always
|
|
2210
|
-
| `loading` | `boolean \| undefined` |
|
|
2211
|
-
| `loadingText` | `string \| undefined` |
|
|
3574
|
+
| `itemValue` | `ItemAccessor<Item> \| undefined` | | | Defines a path that returns a property of the row to use as its value (the selection, `expandedItems` and row keys compare by it) or a function that returns any value. |
|
|
3575
|
+
| `keyboardNavigation` | `boolean \| undefined` | `false` | | Opt-in keyboard navigation: the table becomes an ARIA `grid` (the WAI-ARIA APG data grid) — or a `treegrid` when an `#expand` slot is present — with ONE tab stop and a roving focus over its cells, the default header row included. Arrows move one cell, Home/End go to the row's first/last cell, Ctrl+Home/End to the first/last row, PageUp/PageDown ten rows. Enter on a cell holding controls moves into them (F2 too; Escape or F2 comes back); otherwise Enter/Space activate the row through the same path as a mouse click (highlight toggle + `click:row`). Shift+Space toggles the row's selection, Ctrl/Cmd+A selects all. A treegrid's rows take focus as well: Right expands a collapsed row (else enters its cells), Left collapses it. Controls inside cells leave the tab order while it is on. Cells are `gridcell`, selectable rows carry `aria-selected`. Ignored (the table stays `role="table"`) with a `#tbody` slot, whose rows are yours. Focus and highlight stay independent — moving does not highlight until committed. |
|
|
3576
|
+
| `legend` | `string \| undefined` | | | Text content of the `<legend>` a `selectable` table renders (it becomes a `<fieldset>`, and the legend is that fieldset's accessible name). Omit it and the table falls back to `caption`, then to a localized default — the fieldset always ends up with SOME accessible name — but a specific `legend` describes the selection better than either fallback. |
|
|
3577
|
+
| `loading` | `boolean \| undefined` | `false` | | Sets the component in a loading state, usually triggering some visual styles. With no rows yet this renders skeletons; over existing rows the rows stay on screen (dimmed, with an indeterminate bar) rather than being replaced — a refetch should not blank a table the user is reading. |
|
|
3578
|
+
| `loadingText` | `string \| undefined` | `the localized `common.loadingText` ("Loading...")` | | Screen-reader announcement for the loading row's `aria-live` status. Visually hidden — the skeleton (or the `#loading` slot) is the visible signal. |
|
|
2212
3579
|
| `max` | `number \| undefined` | `Infinity` | | Maximum number of items that can be selected. |
|
|
2213
3580
|
| `modelValue` | `any` | `[]` | | Used by v-model. Can be any serializable type. |
|
|
2214
3581
|
| `multiple` | `boolean \| undefined` | `true` | | Allows the selection of multiple items. |
|
|
2215
3582
|
| `name` | `string \| undefined` | | | Defines the name of the input. |
|
|
2216
|
-
| `
|
|
2217
|
-
| `page` | `string \| number \| undefined` | | | Current page number starting from 1, used for accessibility purposes. Also flows into the shared table context, so a `BbPagination` paired through `id` reads it as the current page. Numeric strings are coerced (server pagination fields
|
|
2218
|
-
| `perPage` | `string \| number \| undefined` | | | Number of items per page, used for accessibility purposes. Also flows into the shared table context read by a `BbPagination` paired through `id`. When omitted, an array `items` table infers it from `items.length`; an explicit value (or a
|
|
2219
|
-
| `readonly` | `boolean \| undefined` |
|
|
2220
|
-
| `
|
|
3583
|
+
| `order` | `string[] \| undefined` | `[]` | | Used by `v-model:order`. Ordered array of column keys — the render order of the data columns. Keys listed here render first, in this order; declared columns it omits follow, in declaration order (so a column added to `columns` later renders last); a `hidden` column keeps its slot without rendering, and keys that match no declared column render nothing but are PRESERVED in place on every write. The header drag / keyboard reorder of `reorderable` writes it back complete (every declared key present, hidden ones included, duplicates dropped — first occurrence wins) with exactly the moved column relocated: every other key keeps its relative order, and a drop that changes nothing emits nothing. Works uncontrolled when unbound, exactly like `sort`. The `select` and `actions` columns are structural and never part of it. |
|
|
3584
|
+
| `page` | `string \| number \| undefined` | | | Doesn't slice `items` — pass the current page's rows: `const rows = computed(() => all.value.slice((page.value - 1) * perPage.value, page.value * perPage.value))`. Current page number starting from 1, used for accessibility purposes. Also flows into the shared table context, so a `BbPagination` paired through `id` reads it as the current page. Numeric strings are coerced (server pagination fields often arrive as strings), exactly like `BbPagination`'s equivalent props. |
|
|
3585
|
+
| `perPage` | `string \| number \| undefined` | | | Doesn't slice `items` — pass the current page's rows (the `page` prop shows the `computed`). Number of items per page, used for accessibility purposes. Also flows into the shared table context read by a `BbPagination` paired through `id`. When omitted, an array `items` table infers it from `items.length`; an explicit value (or a context write) always wins over that inference. Numeric strings are coerced, exactly like `BbPagination`'s `per-page`. |
|
|
3586
|
+
| `readonly` | `boolean \| undefined` | `false` | | Sets the input in a readonly state. |
|
|
3587
|
+
| `reorderable` | `boolean \| undefined` | `false` | | Lets the user reorder the data columns: drag a header cell (AG Grid style — the column moves live under the pointer and a chip with its label follows) or, from the keyboard, use each header's reorder handle (ArrowLeft / ArrowRight move the column one slot, Home / End to the ends). Every move writes `v-model:order`. Not needed by an external control (a column panel) that only writes `order`. The `select` / `actions` columns and a custom `#thead` are never draggable. |
|
|
3588
|
+
| `resizable` | `boolean \| undefined` | `false` | | Lets the user resize the data columns of a root table: drag the handle on a header's trailing edge (the column follows live, the width commits on release), or press Alt + ArrowLeft / ArrowRight on the focused header; double-click the handle to go back to the declared width. Each commit fires `resize:column(key, width)` once. `column.width` stays the single declared truth: a resized width is an override the table keeps until that column's `width` changes — write the reported width back into your column definition to persist it. Ignored on a table that inherits its widths from a parent. |
|
|
3589
|
+
| `rowClass` | `BbTableRowClasses<Item> \| undefined` | | | Defines the classes to be passed to each data row. Can also be a function of the row's item for dynamic values. |
|
|
2221
3590
|
| `selectable` | `boolean \| ((item: Item) => boolean) \| undefined` | | | Defines whether the table is selectable. Can be a global boolean that affects all rows or a function that accepts an item and returns a boolean that only affects that item. |
|
|
2222
3591
|
| `selectAll` | `boolean \| undefined` | `false` | | Defines whether the "Select all" checkbox is checked. |
|
|
2223
3592
|
| `selectAllLabel` | `string \| undefined` | | | Text of the label used by the "Select all" boolean. |
|
|
2224
3593
|
| `selectText` | `string \| undefined` | | | Text of the header used for the radio inputs when the table is not `multiple`. |
|
|
2225
|
-
| `sort` | `BbTableSortEntry[] \| undefined` | `[]` | | Used by `v-model:sort`. Ordered array of `[columnKey, direction]` entries, one per actively sorted column. Bidirectional: the header buttons of `sortable` columns update it, and external writes update the header indicators. The table does
|
|
2226
|
-
| `tdClass` | `ColumnClasses<Item> \| undefined` | | | Defines the classes to be passed to
|
|
2227
|
-
| `thClass` | `Classes \| undefined` | | | Defines the classes to be passed to
|
|
2228
|
-
| `totalItems` | `string \| number \| undefined` | | | Total number of items there is. Also flows into the shared table context, where a `BbPagination` paired through `id` derives its page count from it. When omitted, an array `items` table infers it from `items.length`; an explicit value (or a
|
|
2229
|
-
| `totalPages` | `string \| number \| undefined` | | | Seeds the page count shown by a `BbPagination` paired through `id`. A shortcut for when the server reports a page count rather than a row count: the table renders nothing from it, it only flows into the shared table context. A known total a
|
|
3594
|
+
| `sort` | `BbTableSortEntry[] \| undefined` | `[]` | | Doesn't sort `items` — apply the model to your own data (or your server query). Used by `v-model:sort`. Ordered array of `[columnKey, direction]` entries, one per actively sorted column. Bidirectional: the header buttons of `sortable` columns update it, and external writes update the header indicators. The table does not sort its items — apply the model to your own data source. |
|
|
3595
|
+
| `tdClass` | `ColumnClasses<Item> \| undefined` | | | Defines the classes to be passed to every data cell. Can also be a function for dynamic values. |
|
|
3596
|
+
| `thClass` | `Classes \| undefined` | | | Defines the classes to be passed to every header cell. |
|
|
3597
|
+
| `totalItems` | `string \| number \| undefined` | | | Total number of items there is. Also flows into the shared table context, where a `BbPagination` paired through `id` derives its page count from it. When omitted, an array `items` table infers it from `items.length`; an explicit value (or a context write) always wins over that inference. Numeric strings are coerced, exactly like `BbPagination`'s `total-items`. |
|
|
3598
|
+
| `totalPages` | `string \| number \| undefined` | | | Seeds the page count shown by a `BbPagination` paired through `id`. A shortcut for when the server reports a page count rather than a row count: the table renders nothing from it, it only flows into the shared table context. A known total always wins — when `totalItems` (or a context write) provides one, the page count is derived from it and this seed is ignored. Numeric strings are coerced, exactly like `BbPagination`'s `total-pages`. |
|
|
2230
3599
|
| `unselectedItems` | `any[] \| undefined` | `[]` | | Items that are not selected. |
|
|
3600
|
+
| `virtual` | `boolean \| undefined` | `false` | | Windows the body: only the rows in (and just around) the vertical scrollport are mounted, so a client-side dataset of any size scrolls at a constant cost. The table itself is the scroller as soon as you bound its height (`max-height` / `height`, or a flex item with `min-height: 0`); left unbounded, the nearest scrolling ancestor or the page scrolls it. The header sticks to that scroller. Column widths are measured once from the first rendered batch and then hold — later rows never widen them. Expand rows and nested tables stay fully rendered inside their row (a nested table is never windowed); the row that owns focus stays mounted even when scrolled out of view. Ignored by a table that inherits its widths from a parent, and under a `#tbody` slot. |
|
|
3601
|
+
|
|
3602
|
+
## Passthrough parts and states
|
|
3603
|
+
|
|
3604
|
+
`pt:<part>="…"` restyles a part; `pt:<part>:<state>="…"` applies only while the state is on. A component-wide state is on for every part at once; a _per node_ state resolves on each node of a broadcast part (one row, one option, one day). Grammar and merge rules: `guides/passthrough.md`. In `<script>`, type a `pt` value as `<Component>Props['pt']` (`<Component>Props<Row>['pt']` on a generic component); `PtValue` is not exported: `guides/passthrough.md` § Typing `pt` in `<script>`.
|
|
3605
|
+
|
|
3606
|
+
| Part | What it is |
|
|
3607
|
+
| --- | --- |
|
|
3608
|
+
| `root` | The table's container. |
|
|
3609
|
+
| `caption` | The visible caption (`caption` with `displayCaption`). |
|
|
3610
|
+
| `table` | The grid root: `role="table"`, or `role="grid"` with `keyboardNavigation` (`role="treegrid"` with an `#expand` slot too). |
|
|
3611
|
+
| `head` | The header row group. |
|
|
3612
|
+
| `headerRow` | The header row. |
|
|
3613
|
+
| `cellColumnHeader` | Every column header cell (`role="columnheader"`), the select and actions headers included — a broadcast resolved per header. Not a `<th>`: the grid is `div`s with ARIA roles. |
|
|
3614
|
+
| `sortIcon` | A sortable column's sort arrow, resolved per header. |
|
|
3615
|
+
| `body` | The body row group. |
|
|
3616
|
+
| `row` | Every DATA row — a broadcast resolved per row. Expand rows and the skeleton are not parts. Also takes a per-item function, called with the row's raw item, once per rendered row: keep it cheap. |
|
|
3617
|
+
| `cell` | Every data cell, the select and actions cells included — a broadcast resolved with its row's states (`role="cell"`, `gridcell` under `keyboardNavigation`). Takes no function: use `tdClass` for a per-cell hook. |
|
|
3618
|
+
| `selectIcon` | The selection glyph: each row's checkbox (radio with single selection) and the select-all checkbox — resolved per node. Not rendered when the `select` / `header:select` slots replace them. |
|
|
3619
|
+
| `dragIcon` | The move glyph on the chip that follows a column drag (`reorderable`). |
|
|
3620
|
+
| `foot` | The footer row group (the `tfoot` slot's container). |
|
|
3621
|
+
|
|
3622
|
+
States are listed in precedence order: when two are on at once and their entries conflict, the later one wins.
|
|
3623
|
+
|
|
3624
|
+
| State | When it is on |
|
|
3625
|
+
| --- | --- |
|
|
3626
|
+
| `empty` | Component-wide: there are no rows (`bb-table--empty`). |
|
|
3627
|
+
| `sorted` | Per node, on `cellColumnHeader` and `sortIcon`: the column is sorted, either direction (`bb-table__cell-column-header--sorted`). |
|
|
3628
|
+
| `sortedDesc` | Per node, on `cellColumnHeader` and `sortIcon`: sorted descending (`bb-table__cell-column-header--sorted-desc`). Ascending is `sorted` alone. |
|
|
3629
|
+
| `selected` | Per node, on `row`, its cells and its `selectIcon`: a checked row; on the select-all glyph, every row is selected. |
|
|
3630
|
+
| `indeterminate` | Per node, on the select-all `selectIcon`: some rows are selected, not all. |
|
|
3631
|
+
| `disabled` | Per node, on `row`, its cells and its `selectIcon`: the row cannot be SELECTED — `selectable` rejects it, or the table is `disabled` (`bb-table__row--disabled`). It still clicks, highlights and expands. Never on a table without selection. The select-all glyph takes it from the table's `disabled`. |
|
|
3632
|
+
| `expanded` | Per node, on `row` and its cells: the row's expand row is open (`bb-table__row--expanded`). |
|
|
3633
|
+
| `highlighted` | Per node, on `row` and its cells: the highlighted row. |
|
|
3634
|
+
| `loading` | Component-wide: the table is `loading`. |
|
|
2231
3635
|
|
|
2232
3636
|
## Events
|
|
2233
3637
|
|
|
2234
|
-
- `click:row` — `(
|
|
2235
|
-
- `contextmenu:row` — `(
|
|
2236
|
-
- `dblclick:row` — `(
|
|
2237
|
-
- `
|
|
2238
|
-
- `item:
|
|
2239
|
-
- `
|
|
2240
|
-
- `
|
|
2241
|
-
- `update:
|
|
2242
|
-
- `update:
|
|
2243
|
-
- `update:
|
|
2244
|
-
- `update:
|
|
3638
|
+
- `click:row` — `(event: MouseEvent, item: any): void` — A body row was clicked, or activated with Enter/Space under `keyboardNavigation`. Carries the DOM `MouseEvent` and the raw record.
|
|
3639
|
+
- `contextmenu:row` — `(event: MouseEvent, item: any): void` — A body row was right-clicked. Carries the DOM `MouseEvent` and the raw record.
|
|
3640
|
+
- `dblclick:row` — `(event: MouseEvent, item: any): void` — A body row was double-clicked. Carries the DOM `MouseEvent` and the raw record.
|
|
3641
|
+
- `hide:column` — `(key: string): void` — A column was hidden from its header (a `#header:<key>` / `#header:<key>:append` control calling the slot's `hideColumn()`). Fired once; the table keeps the column hidden for the mount, or until the column's `hidden` flag changes — write `hidden: true` into the definition to persist it, `hidden: false` (a column panel) to show it again.
|
|
3642
|
+
- `item:selected` — `(value: any): void` — The user selected one row. Carries the row's value (read through `itemValue`, the same value the selection v-model holds).
|
|
3643
|
+
- `item:unselected` — `(value: any): void` — The user unselected one row. Carries the row's value, like `item:selected`.
|
|
3644
|
+
- `resize:column` — `(key: string, width: number \| null): void` — A column was resized by the user (`resizable`): the new width in px, or `null` when the handle was double-clicked to reset the column to its declared width.
|
|
3645
|
+
- `update:expandedItems` — `(value: any[]): void` — Emitted with the new value whenever `v-model:expandedItems` changes.
|
|
3646
|
+
- `update:highlighted` — `(value: any): void` — Emitted with the new value whenever `v-model:highlighted` changes.
|
|
3647
|
+
- `update:modelValue` — `(value: any): void` — Emitted with the new value whenever `v-model` changes.
|
|
3648
|
+
- `update:order` — `(value: string[]): void` — Emitted with the new value whenever `v-model:order` changes.
|
|
3649
|
+
- `update:selectAll` — `(value: boolean): void` — Emitted with the new value whenever `v-model:selectAll` changes.
|
|
3650
|
+
- `update:sort` — `(value: BbTableSortEntry[]): void` — Emitted with the new value whenever `v-model:sort` changes.
|
|
3651
|
+
- `update:unselectedItems` — `(value: any[]): void` — Emitted with the new value whenever `v-model:unselectedItems` changes.
|
|
2245
3652
|
|
|
2246
3653
|
## Slots
|
|
2247
3654
|
|
|
2248
|
-
- `actions` — scope: `{ expanded?: boolean \| undefined; expandProps?: ExpandControllerProps \| undefined; toggleExpanded?: (() => void) \| undefined; highlighted?: boolean \| undefi…` — Content rendered in the actions cell for each row.
|
|
3655
|
+
- `actions` — scope: `{ expanded?: boolean \| undefined; expandProps?: ExpandControllerProps \| undefined; toggleExpanded?: (() => void) \| undefined; highlighted?: boolean \| undefi…` — Content rendered in the actions cell for each row. Providing this slot is what CREATES the actions column (there is no prop): the header cell (labelled by `actions-text`, replaceable through `#header:actions`) and one cell per row appear with it, and go away with it. Pin it with `fixed-actions`.
|
|
3656
|
+
- `empty` — scope: `object` — Content shown when the items list is empty and not loading. It fills the table's own full-width empty-state cell (it already spans the selection/actions columns), so provide the *content* — a message, an illustration, a "clear filters" button — never a row/cell of your own.
|
|
2249
3657
|
- `expand` — scope: `{ expanded: boolean; expandProps?: ExpandControllerProps \| undefined; toggleExpanded: () => void; highlighted?: boolean \| undefined; toggleHighlighted?: (() =…` — Full-width expandable content row rendered below each main row when expanded.
|
|
2250
3658
|
- `header:actions` — scope: `{ text: string; }` — Replaces the default actions header cell content.
|
|
3659
|
+
- `header:append` — scope: `BbTableHeaderAffixSlotProps<Item>` `{ classes?: Classes; columnKey: string; items?: Item[]; label?: string; sortable?: boolean; sortOrder?: "asc" \| "desc" \| null; toggleSort?: (() => void); hideColumn?: (() => void) }` — Content rendered after every data column's header cell content — the label + sort control, or the column's own `header:<key>` replacement. A column's `header:<key>:append` slot wins over this one for that column; they never stack. Branch on `columnKey` for per-column output.
|
|
3660
|
+
- `header:prepend` — scope: `BbTableHeaderAffixSlotProps<Item>` `{ classes?: Classes; columnKey: string; items?: Item[]; label?: string; sortable?: boolean; sortOrder?: "asc" \| "desc" \| null; toggleSort?: (() => void); hideColumn?: (() => void) }` — Content rendered before every data column's header cell content — the label + sort control, or the column's own `header:<key>` replacement. A column's `header:<key>:prepend` slot wins over this one for that column; they never stack. Branch on `columnKey` for per-column output.
|
|
2251
3661
|
- `header:select` — scope: `{ multiple: boolean; selectAll: boolean; text: string; }` — Replaces the default selection header cell content (checkbox or radio label).
|
|
2252
3662
|
- `loading` — scope: `{ items: Item[]; }` — Content shown while table rows are loading (replaces the skeleton rows).
|
|
2253
|
-
- `no-data` — scope: `object` — Content shown when the items list is empty and not loading. It fills the table's own full-width empty-state cell (the colspan already accounts for the selection/actions columns), so provide the *content* — a message, an illustration, a "cle…
|
|
2254
3663
|
- `select` — scope: `{ item: Item; value: any; checked: boolean; disabled: boolean; inputName: string; readonly: boolean; toggleSelected?: (() => void) \| undefined; }` — Replaces the default checkbox/radio in the selection cell for each row.
|
|
2255
|
-
- `tbody` — scope: `object` — Replaces the
|
|
2256
|
-
- `tfoot` — scope: `{ columnCount: number; }` —
|
|
2257
|
-
- `thead` — scope: `object` — Replaces the
|
|
3664
|
+
- `tbody` — scope: `object` — Replaces the content of the body row group (`.bb-table__body`). Use when you need full control over the body markup. Provide role-complete rows — `<div role="row">` holding one `<div role="cell">` per column — never a `<tr>`/`<td>`. A full-width cell spans with `grid-column: 1 / -1`.
|
|
3665
|
+
- `tfoot` — scope: `{ columnCount: number; }` — Fills the footer row group (`.bb-table__foot`). Use when you need a footer. Provide role-complete rows — `<div role="row">` holding `<div role="cell">` elements — never a `<tr>`/`<td>`.
|
|
3666
|
+
- `thead` — scope: `object` — Replaces the content of the header row group (`.bb-table__head`). Use when you need full control over the header markup. The table is a CSS grid, not a `<table>`: provide role-complete rows — `<div role="row">` holding one `<div role="columnheader">` per column — and never a `<tr>`/`<th>`. Rows are subgrid rows, so each cell lands on the matching column track.
|
|
3667
|
+
- `#<key>` (named from data) — scope: `object` — One column's body cell in every row, by the column `key` through `slotKey`. Scope: `{ item, value, content, selected, expanded, highlighted, classes, sortOrder, toggleSelected, toggleExpanded, toggleHighlighted, expandProps }`. Reserved keys (their slot is one of this component's own, so a key spelled like them is an error): `actions`, `append`, `empty`, `expand`, `loading`, `prepend`, `select`, `tbody`, `tfoot`, `thead`.
|
|
3668
|
+
- `#header:<key>` (named from data) — scope: `object` — One column's header content, replacing its label and the built-in sort button. Scope: `{ label, items, sortable, sortOrder, toggleSort, hideColumn, classes }`.
|
|
3669
|
+
- `#header:<key>:prepend` (named from data) — scope: `BbTableHeaderAffixSlotProps<Item>` — Content before one column's header, keeping the sort button; beats `header:prepend` (they never stack).
|
|
3670
|
+
- `#header:<key>:append` (named from data) — scope: `BbTableHeaderAffixSlotProps<Item>` — Content after one column's header, keeping the sort button; beats `header:append` (they never stack).
|
|
3671
|
+
|
|
3672
|
+
## CSS custom properties
|
|
3673
|
+
|
|
3674
|
+
Set these on the element, or on a class you put on it, to retune this component alone — the sanctioned alternative to reaching past the API with `:deep()`. They are this component's own locals — a **Set on** of `pt:<part>` means the local lives on that part's element, so set it through that entry (`pt:box="[--border-color:var(--color-green-500)]"`); the global `--bb-*` theme tokens are a separate tier (see the [design-tokens guide](./guides/design-tokens.md), or the MCP `list_tokens` tool).
|
|
3675
|
+
|
|
3676
|
+
| Property | Default | What it is |
|
|
3677
|
+
| --- | --- | --- |
|
|
3678
|
+
| `--bg` | `var(--bb-panel)` | The table's surface colour. Cells are transparent at rest so the row can tint them, but anything that sticks over scrolled content — the stuck head band and pinned (`column.fixed`) cells — must be opaque, and paints this. Set it on the table (`.my-table { --bg: … }`) when the table sits on a surface that is not `--bb-panel`; a nested table re-declares its own. |
|
|
3679
|
+
| `--px` | `12px` | |
|
|
3680
|
+
| `--cell-h` | `36px` | |
|
|
3681
|
+
| `--py` | `6px` | |
|
|
3682
|
+
| `--actions-spacing` | `8px` | |
|
|
3683
|
+
| `--offset-start` | `0px` | Raw structural edge offset measured by the component (the parent's select/actions track width). Default 0 keeps every calc at its base. |
|
|
3684
|
+
| `--offset-end` | `0px` | |
|
|
3685
|
+
| `--offset-internal-start` | `var(--offset-start)` | Routing of that offset. By default it is "internal": added to the first/last cell padding and folded into the first/last column width. Swap internal↔external (set internal to 0 and external to the raw offset) to pad the whole table instead of the edge cells. |
|
|
3686
|
+
| `--offset-internal-end` | `var(--offset-end)` | |
|
|
3687
|
+
| `--offset-external-start` | `0px` | |
|
|
3688
|
+
| `--offset-external-end` | `0px` | |
|
|
3689
|
+
|
|
3690
|
+
## Component tree
|
|
3691
|
+
|
|
3692
|
+
`BbTable` is not one component: rendering it mounts every component below, and each one is live inside it. **Read this before styling, theming or debugging `BbTable`, and before concluding a part, a token or a behaviour does not exist** — it may live on a component further down. How to read it:
|
|
3693
|
+
|
|
3694
|
+
- **_internal_** nodes are building blocks with no API of their own: you reach them only through `BbTable`. A pt part listed as landing there is set on `BbTable` (`pt:<part>`).
|
|
3695
|
+
- **_public_** nodes are components with their own contract. `BbTable` reaches one only through a pt part of its own that lands on it (shown on the parent node as `part → Component`, e.g. `spinner → BbSpinner`) or through a pt map it hands it (shown as "hands … the pt map", in `BbTable`'s words → the child's). The child's other props and parts are not exposed; its contract explains what it renders.
|
|
3696
|
+
- **CSS custom properties** listed on a node are declared on THAT node's root and read by elements inside it. Set one on that node's root or on the element inside it that reads it — the pt part that lands there is how you reach it (`pt:box="[--border-color:…]"` on a text input) — never on `BbTable`'s root, where the node's own declaration masks it (design-tokens guide, _Overriding one from a consumer app_, rule 0).
|
|
3697
|
+
- Listed nodes are the ones `BbTable`'s API reaches or that declare a documented CSS variable; the rest fold into "also mounts". The complete tree, repeats and undocumented locals included, is the `tree` field of this component in `components.json`.
|
|
3698
|
+
|
|
3699
|
+
- `BbTable` _(this component)_ — its own template binds: `caption` → `div.bb-table__caption`, `dragIcon` → `svg.bb-table__drag-icon`, `table` → `div`, `head` → `div.bb-table__head`, `headerRow` → `div.bb-table__header-row`, `cellColumnHeader` → `div.bb-table__cell-column-header`, `selectIcon` → `BbBaseCheckboxIcon`, `sortIcon` → `svg.bb-table__sort-icon`, `body` → `div.bb-table__body`, `foot` → `div.bb-table__foot`
|
|
3700
|
+
- `BbBaseButton` _(public — [contract](./BbBaseButton.md))_ — its own pt parts (`BbBaseButton`): `root` → `RouterComponent`, `root` → `a`, `root` → `component`; also mounts `RouterComponent`
|
|
3701
|
+
- Also mounts `BbBaseCheckboxIcon`
|
|
2258
3702
|
|
|
2259
3703
|
## See Also
|
|
2260
3704
|
|