bitboss-ui 2.1.134 → 3.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +244 -21
- package/bin/bitboss-ui-mcp.mjs +557 -0
- package/bin/bitboss-ui.mjs +626 -0
- package/dist/ai/BbAccordion.md +522 -113
- package/dist/ai/BbAlert.md +377 -197
- package/dist/ai/BbAsterisk.md +46 -0
- package/dist/ai/BbAvatar.md +454 -178
- package/dist/ai/BbBadge.md +695 -225
- package/dist/ai/BbBadgeButton.md +54 -0
- package/dist/ai/BbBaseButton.md +489 -0
- package/dist/ai/BbBaseCheckbox.md +49 -0
- package/dist/ai/BbBaseCheckboxGroup.md +64 -0
- package/dist/ai/BbBaseCheckboxIcon.md +174 -0
- package/dist/ai/BbBaseColorInput.md +64 -0
- package/dist/ai/BbBaseColorPalette.md +39 -0
- package/dist/ai/BbBaseDatePicker.md +42 -0
- package/dist/ai/BbBaseDatePickerInput.md +73 -0
- package/dist/ai/BbBaseInputContainer.md +48 -0
- package/dist/ai/BbBaseNumberInput.md +71 -0
- package/dist/ai/BbBaseRadio.md +46 -0
- package/dist/ai/BbBaseRadioGroup.md +63 -0
- package/dist/ai/BbBaseRadioIcon.md +187 -0
- package/dist/ai/BbBaseRating.md +51 -0
- package/dist/ai/BbBaseSelect.md +88 -0
- package/dist/ai/BbBaseSlider.md +56 -0
- package/dist/ai/BbBaseSwitch.md +49 -0
- package/dist/ai/BbBaseSwitchGroup.md +64 -0
- package/dist/ai/BbBaseSwitchIcon.md +184 -0
- package/dist/ai/BbBaseTag.md +68 -0
- package/dist/ai/BbBaseTextInput.md +75 -0
- package/dist/ai/BbBaseTextarea.md +62 -0
- package/dist/ai/BbBaseTimePickerInput.md +62 -0
- package/dist/ai/BbBreadcrumbs.md +542 -503
- package/dist/ai/BbButton.md +767 -636
- package/dist/ai/BbCheckbox.md +572 -254
- package/dist/ai/BbCheckboxGroup.md +561 -361
- package/dist/ai/BbCollapsible.md +419 -103
- package/dist/ai/BbColorInput.md +529 -323
- package/dist/ai/BbColorPalette.md +565 -330
- package/dist/ai/BbConfirm.md +612 -136
- package/dist/ai/BbConfirmPortal.md +28 -0
- package/dist/ai/BbDatePicker.md +244 -0
- package/dist/ai/BbDatePickerInput.md +706 -388
- package/dist/ai/BbDialog.md +770 -99
- package/dist/ai/BbDropdown.md +1054 -763
- package/dist/ai/BbDropdownButton.md +511 -615
- package/dist/ai/BbDropdownGroup.md +34 -0
- package/dist/ai/BbDropzone.md +1148 -436
- package/dist/ai/BbForm.md +239 -0
- package/dist/ai/BbIcon.md +379 -212
- package/dist/ai/BbIndicator.md +283 -0
- package/dist/ai/BbNumberInput.md +713 -355
- package/dist/ai/BbOffCanvas.md +875 -498
- package/dist/ai/BbPagination.md +483 -535
- package/dist/ai/BbPopover.md +583 -546
- package/dist/ai/BbProgress.md +456 -69
- package/dist/ai/BbRadio.md +343 -229
- package/dist/ai/BbRadioGroup.md +426 -353
- package/dist/ai/BbRating.md +361 -226
- package/dist/ai/BbSelect.md +1380 -536
- package/dist/ai/BbSelectPopover.md +1240 -1579
- package/dist/ai/BbSlider.md +478 -257
- package/dist/ai/BbSmoothHeight.md +472 -139
- package/dist/ai/BbSpinner.md +718 -131
- package/dist/ai/BbSwitch.md +549 -119
- package/dist/ai/BbSwitchGroup.md +503 -214
- package/dist/ai/BbTable.md +1956 -2358
- package/dist/ai/BbTabs.md +1113 -0
- package/dist/ai/BbTabsList.md +29 -0
- package/dist/ai/BbTabsPanes.md +27 -0
- package/dist/ai/BbTabsRoot.md +57 -0
- package/dist/ai/BbTag.md +393 -292
- package/dist/ai/BbTextInput.md +852 -333
- package/dist/ai/BbTextarea.md +836 -255
- package/dist/ai/BbTimePicker.md +231 -0
- package/dist/ai/BbTimePickerInput.md +196 -0
- package/dist/ai/BbToast.md +624 -196
- package/dist/ai/BbToastPortal.md +28 -0
- package/dist/ai/BbTooltip.md +443 -346
- package/dist/ai/BbTree.md +984 -235
- package/dist/ai/ChipsBox.md +27 -199
- package/dist/ai/ClearableButton.md +21 -55
- package/dist/ai/CommaBox.md +25 -200
- package/dist/ai/CommonInputWrapper.md +42 -0
- package/dist/ai/CommonPopover.md +30 -510
- package/dist/ai/ErrorIcon.md +19 -56
- package/dist/ai/FlatListBox.md +35 -379
- package/dist/ai/GroupedListBox.md +37 -535
- package/dist/ai/GuidesComponent.md +21 -0
- package/dist/ai/ListBox.md +38 -231
- package/dist/ai/OptionsContainer.md +34 -253
- package/dist/ai/WarningIcon.md +21 -0
- package/dist/ai/components.json +15883 -0
- package/dist/ai/composables/useBbConfig.md +80 -0
- package/dist/ai/composables/useBbFormContext.md +110 -0
- package/dist/ai/composables/useBbTableContext.md +164 -0
- package/dist/ai/composables/useBbTabsContext.md +118 -0
- package/dist/ai/composables/useBroadcastChannelInstance.md +97 -0
- package/dist/ai/composables/useConfirm.md +306 -0
- package/dist/ai/composables/useCountdown.md +84 -0
- package/dist/ai/composables/useId.md +60 -0
- package/dist/ai/composables/useMobile.md +85 -0
- package/dist/ai/composables/useToast.md +230 -0
- package/dist/ai/guides/agent-contract.md +108 -0
- package/dist/ai/guides/ai-router.md +111 -0
- package/dist/ai/guides/app-layout.md +295 -0
- package/dist/ai/guides/coherence-playbook.md +136 -0
- package/dist/ai/guides/component-picker.md +195 -0
- package/dist/ai/guides/design-language.md +461 -0
- package/dist/ai/guides/design-tokens.md +424 -0
- package/dist/ai/guides/fetch-items-playbook.md +161 -0
- package/dist/ai/guides/floating-bottom-panel.md +191 -0
- package/dist/ai/guides/icons-policy.md +257 -0
- package/dist/ai/guides/inertia-helpers.md +1394 -0
- package/dist/ai/guides/inline-edit-playbook.md +258 -0
- package/dist/ai/guides/installation-and-plugin-setup.md +377 -0
- package/dist/ai/guides/migration/components/bb-alert.md +37 -0
- package/dist/ai/guides/migration/components/bb-avatar.md +24 -0
- package/dist/ai/guides/migration/components/bb-badge.md +110 -0
- package/dist/ai/guides/migration/components/bb-breadcrumbs.md +26 -0
- package/dist/ai/guides/migration/components/bb-button.md +55 -0
- package/dist/ai/guides/migration/components/bb-checkbox-group.md +54 -0
- package/dist/ai/guides/migration/components/bb-checkbox.md +45 -0
- package/dist/ai/guides/migration/components/bb-chip.md +35 -0
- package/dist/ai/guides/migration/components/bb-collapsible.md +26 -0
- package/dist/ai/guides/migration/components/bb-color-input.md +23 -0
- package/dist/ai/guides/migration/components/bb-color-palette.md +31 -0
- package/dist/ai/guides/migration/components/bb-date-picker-input.md +84 -0
- package/dist/ai/guides/migration/components/bb-dialog.md +46 -0
- package/dist/ai/guides/migration/components/bb-dropdown-button.md +31 -0
- package/dist/ai/guides/migration/components/bb-dropdown.md +36 -0
- package/dist/ai/guides/migration/components/bb-dropzone.md +27 -0
- package/dist/ai/guides/migration/components/bb-icon.md +27 -0
- package/dist/ai/guides/migration/components/bb-off-canvas.md +25 -0
- package/dist/ai/guides/migration/components/bb-offcanvas.md +54 -0
- package/dist/ai/guides/migration/components/bb-pagination.md +24 -0
- package/dist/ai/guides/migration/components/bb-popover.md +52 -0
- package/dist/ai/guides/migration/components/bb-rating.md +24 -0
- package/dist/ai/guides/migration/components/bb-select-popover.md +58 -0
- package/dist/ai/guides/migration/components/bb-select.md +68 -0
- package/dist/ai/guides/migration/components/bb-slider.md +25 -0
- package/dist/ai/guides/migration/components/bb-smooth-height.md +45 -0
- package/dist/ai/guides/migration/components/bb-spinner.md +23 -0
- package/dist/ai/guides/migration/components/bb-table.md +66 -0
- package/dist/ai/guides/migration/components/bb-tabs.md +47 -0
- package/dist/ai/guides/migration/components/bb-tag.md +29 -0
- package/dist/ai/guides/migration/components/bb-text-input.md +37 -0
- package/dist/ai/guides/migration/components/bb-toast.md +47 -0
- package/dist/ai/guides/migration/components/bb-tooltip.md +34 -0
- package/dist/ai/guides/migration/components/bb-tree.md +77 -0
- package/dist/ai/guides/migration/components/use-confirm.md +46 -0
- package/dist/ai/guides/migration/v2-to-v3.md +649 -0
- package/dist/ai/guides/options-items-playbook.md +222 -0
- package/dist/ai/guides/page-shell.md +314 -0
- package/dist/ai/guides/validated-forms.md +177 -0
- package/dist/ai/index.md +156 -32
- package/dist/ai/recipes/inertia/approvals-inbox.md +1598 -0
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +1733 -0
- package/dist/ai/recipes/inertia/onboarding.md +1765 -0
- package/dist/ai/recipes/inertia/ownership-atlas.md +1281 -0
- package/dist/ai/recipes/inertia/record-form.md +1442 -0
- package/dist/ai/recipes/inertia/records-workspace.md +1328 -0
- package/dist/ai/recipes/inertia/upload-center.md +1926 -0
- package/dist/ai/recipes/inertia/wizard-form.md +1477 -0
- package/dist/ai/recipes/nuxt/approvals-inbox.md +1561 -0
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +1690 -0
- package/dist/ai/recipes/nuxt/onboarding.md +1698 -0
- package/dist/ai/recipes/nuxt/record-form.md +1456 -0
- package/dist/ai/recipes/nuxt/records-workspace.md +1314 -0
- package/dist/ai/recipes/nuxt/upload-center.md +1847 -0
- package/dist/ai/recipes/nuxt/wizard-form.md +1486 -0
- package/dist/ai/recipes/vue/approvals-inbox.md +1479 -0
- package/dist/ai/recipes/vue/inline-edit-workspace.md +1581 -0
- package/dist/ai/recipes/vue/onboarding.md +1653 -0
- package/dist/ai/recipes/vue/record-form.md +1540 -0
- package/dist/ai/recipes/vue/records-workspace.md +1230 -0
- package/dist/ai/recipes/vue/upload-center.md +1806 -0
- package/dist/ai/recipes/vue/wizard-form.md +1418 -0
- package/dist/ai/source/BbAccordion.md +122 -0
- package/dist/ai/source/BbAlert.md +396 -0
- package/dist/ai/source/BbAsterisk.md +32 -0
- package/dist/ai/source/BbAvatar.md +256 -0
- package/dist/ai/source/BbBadge.md +560 -0
- package/dist/ai/source/BbBadgeButton.md +490 -0
- package/dist/ai/source/BbBaseButton.md +682 -0
- package/dist/ai/source/BbBaseCheckbox.md +459 -0
- package/dist/ai/source/BbBaseCheckboxGroup.md +554 -0
- package/dist/ai/source/BbBaseCheckboxIcon.md +201 -0
- package/dist/ai/source/BbBaseColorInput.md +413 -0
- package/dist/ai/source/BbBaseColorPalette.md +934 -0
- package/dist/ai/source/BbBaseDatePicker.md +1001 -0
- package/dist/ai/source/BbBaseDatePickerInput.md +1781 -0
- package/dist/ai/source/BbBaseInputContainer.md +1148 -0
- package/dist/ai/source/BbBaseNumberInput.md +615 -0
- package/dist/ai/source/BbBaseRadio.md +377 -0
- package/dist/ai/source/BbBaseRadioGroup.md +499 -0
- package/dist/ai/source/BbBaseRadioIcon.md +153 -0
- package/dist/ai/source/BbBaseRating.md +573 -0
- package/dist/ai/source/BbBaseSelect.md +895 -0
- package/dist/ai/source/BbBaseSlider.md +1085 -0
- package/dist/ai/source/BbBaseSwitch.md +246 -0
- package/dist/ai/source/BbBaseSwitchGroup.md +302 -0
- package/dist/ai/source/BbBaseSwitchIcon.md +206 -0
- package/dist/ai/source/BbBaseTag.md +688 -0
- package/dist/ai/source/BbBaseTextInput.md +511 -0
- package/dist/ai/source/BbBaseTextarea.md +480 -0
- package/dist/ai/source/BbBaseTimePickerInput.md +1013 -0
- package/dist/ai/source/BbBreadcrumbs.md +811 -0
- package/dist/ai/source/BbButton.md +990 -0
- package/dist/ai/source/BbCheckbox.md +319 -0
- package/dist/ai/source/BbCheckboxGroup.md +412 -0
- package/dist/ai/source/BbCollapsible.md +133 -0
- package/dist/ai/source/BbColorInput.md +315 -0
- package/dist/ai/source/BbColorPalette.md +361 -0
- package/dist/ai/source/BbConfirm.md +173 -0
- package/dist/ai/source/BbConfirmPortal.md +74 -0
- package/dist/ai/source/BbDatePicker.md +725 -0
- package/dist/ai/source/BbDatePickerInput.md +518 -0
- package/dist/ai/source/BbDialog.md +812 -0
- package/dist/ai/source/BbDropdown.md +2369 -0
- package/dist/ai/source/BbDropdownButton.md +313 -0
- package/dist/ai/source/BbDropdownGroup.md +1249 -0
- package/dist/ai/source/BbDropzone.md +749 -0
- package/dist/ai/source/BbForm.md +100 -0
- package/dist/ai/source/BbIcon.md +212 -0
- package/dist/ai/source/BbIndicator.md +298 -0
- package/dist/ai/source/BbNumberInput.md +365 -0
- package/dist/ai/source/BbOffCanvas.md +1260 -0
- package/dist/ai/source/BbPagination.md +829 -0
- package/dist/ai/source/BbPopover.md +853 -0
- package/dist/ai/source/BbProgress.md +140 -0
- package/dist/ai/source/BbRadio.md +294 -0
- package/dist/ai/source/BbRadioGroup.md +401 -0
- package/dist/ai/source/BbRating.md +362 -0
- package/dist/ai/source/BbSelect.md +681 -0
- package/dist/ai/source/BbSelectPopover.md +2209 -0
- package/dist/ai/source/BbSlider.md +371 -0
- package/dist/ai/source/BbSmoothHeight.md +261 -0
- package/dist/ai/source/BbSpinner.md +127 -0
- package/dist/ai/source/BbSwitch.md +175 -0
- package/dist/ai/source/BbSwitchGroup.md +240 -0
- package/dist/ai/source/BbTable.md +3348 -0
- package/dist/ai/source/BbTabs.md +403 -0
- package/dist/ai/source/BbTabsList.md +578 -0
- package/dist/ai/source/BbTabsPanes.md +368 -0
- package/dist/ai/source/BbTabsRoot.md +372 -0
- package/dist/ai/source/BbTag.md +383 -0
- package/dist/ai/source/BbTextInput.md +345 -0
- package/dist/ai/source/BbTextarea.md +330 -0
- package/dist/ai/source/BbTimePicker.md +591 -0
- package/dist/ai/source/BbTimePickerInput.md +367 -0
- package/dist/ai/source/BbToast.md +524 -0
- package/dist/ai/source/BbToastPortal.md +482 -0
- package/dist/ai/source/BbTooltip.md +508 -0
- package/dist/ai/source/BbTree.md +319 -0
- package/dist/ai/source/ChipsBox.md +201 -0
- package/dist/ai/source/ClearableButton.md +70 -0
- package/dist/ai/source/CommaBox.md +202 -0
- package/dist/ai/source/CommonInputWrapper.md +554 -0
- package/dist/ai/source/CommonPopover.md +606 -0
- package/dist/ai/source/ErrorIcon.md +43 -0
- package/dist/ai/source/FlatListBox.md +396 -0
- package/dist/ai/source/GroupedListBox.md +540 -0
- package/dist/ai/source/GuidesComponent.md +383 -0
- package/dist/ai/source/ListBox.md +238 -0
- package/dist/ai/source/OptionsContainer.md +191 -0
- package/dist/ai/source/WarningIcon.md +47 -0
- package/dist/alert-variants.d.ts +12 -0
- package/dist/assets/css/reset.css_inline.js +4 -0
- package/dist/assets/svgs/alert.svg_raw.js +4 -0
- package/dist/assets/svgs/calendar.svg_raw.js +4 -0
- package/dist/assets/svgs/check_stroke.svg_raw.js +4 -0
- package/dist/assets/svgs/chevron_down.svg_raw.js +4 -0
- package/dist/assets/svgs/chevron_right.svg_raw.js +4 -0
- package/dist/assets/svgs/clear.svg_raw.js +4 -0
- package/dist/assets/svgs/clock.svg_raw.js +4 -0
- package/dist/assets/svgs/error.svg_raw.js +4 -0
- package/dist/assets/svgs/search.svg_raw.js +4 -0
- package/dist/assets/svgs/sort.svg_raw.js +4 -0
- package/dist/assets/svgs/spinner.svg_raw.js +4 -0
- package/dist/assets/svgs/user.svg_raw.js +4 -0
- package/dist/badge-variants.d.ts +18 -0
- package/dist/button-variants.d.ts +15 -0
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +9 -3
- package/dist/components/BbAccordion/BbAccordion.vue.js +6 -0
- package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/BbAccordion/types.d.ts +10 -7
- package/dist/components/BbAlert/BbAlert.vue.d.ts +12 -3
- package/dist/components/BbAlert/BbAlert.vue.js +6 -0
- package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BbAlert/types.d.ts +51 -12
- package/dist/components/BbAsterisk/BbAsterisk.vue.d.ts +3 -0
- package/dist/components/BbAsterisk/BbAsterisk.vue.js +6 -0
- package/dist/components/BbAsterisk/BbAsterisk.vue_vue_type_script_setup_true_lang.js +13 -0
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +5 -0
- package/dist/components/BbAvatar/BbAvatar.vue.js +6 -0
- package/dist/components/BbAvatar/BbAvatar.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/components/BbAvatar/types.d.ts +4 -5
- package/dist/components/BbBadge/BadgeAppendIcon.vue.d.ts +3 -0
- package/dist/components/BbBadge/BadgeAppendIcon.vue.js +5 -0
- package/dist/components/BbBadge/BadgeAppendIcon.vue_vue_type_script_setup_true_lang.js +22 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue.d.ts +15 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue.js +5 -0
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/components/BbBadge/BbBadge.vue.d.ts +8 -1
- package/dist/components/BbBadge/BbBadge.vue.js +6 -0
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/components/BbBadge/BbBadgeButton.vue.d.ts +12 -0
- package/dist/components/BbBadge/BbBadgeButton.vue.js +5 -0
- package/dist/components/BbBadge/BbBadgeButton.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/BbBadge/badgeButtonContext.d.ts +27 -0
- package/dist/components/BbBadge/badgeButtonContext.js +5 -0
- package/dist/components/BbBadge/types.d.ts +61 -16
- package/dist/components/BbBaseButton/BbBaseButton.vue.d.ts +13 -0
- package/dist/components/BbBaseButton/BbBaseButton.vue.js +6 -0
- package/dist/components/BbBaseButton/BbBaseButton.vue_vue_type_script_setup_true_lang.js +171 -0
- package/dist/components/BbBaseButton/RouterComponent.vue.js +5 -0
- package/dist/components/BbBaseButton/RouterComponent.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/BbBaseButton/types.d.ts +191 -0
- package/dist/components/BbBaseButton/types.js +33 -0
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.d.ts +40 -0
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.js +6 -0
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue_vue_type_script_setup_true_lang.js +145 -0
- package/dist/components/BbBaseCheckbox/types.d.ts +222 -0
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.d.ts +19 -0
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.js +6 -0
- package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbBaseCheckboxGroup/types.d.ts +257 -0
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue.d.ts +4 -0
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue.js +6 -0
- package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/components/BbBaseCheckboxIcon/types.d.ts +47 -0
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.d.ts +42 -0
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.js +6 -0
- package/dist/components/BbBaseColorInput/BbBaseColorInput.vue_vue_type_script_setup_true_lang.js +178 -0
- package/dist/components/BbBaseColorInput/types.d.ts +207 -0
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue.d.ts +13 -0
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue.js +6 -0
- package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue_vue_type_script_setup_true_lang.js +395 -0
- package/dist/components/BbBaseColorPalette/types.d.ts +40 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue.js +6 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue_vue_type_script_setup_true_lang.js +300 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.d.ts +44 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.js +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue_vue_type_script_setup_true_lang.js +310 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.d.ts +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.js +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.d.ts +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.js +5 -0
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/components/BbBaseDatePicker/typeahead.d.ts +112 -0
- package/dist/components/BbBaseDatePicker/typeahead.js +37 -0
- package/dist/components/BbBaseDatePicker/types.d.ts +97 -0
- package/dist/components/BbBaseDatePicker/useDatePickerContext.d.ts +58 -0
- package/dist/components/BbBaseDatePicker/useDatePickerContext.js +11 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.d.ts +30 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.js +6 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue_vue_type_script_setup_true_lang.js +713 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.d.ts +30 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.js +6 -0
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/BbBaseDatePickerInput/types.d.ts +309 -0
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.d.ts +17 -0
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.js +6 -0
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue_vue_type_script_setup_true_lang.js +184 -0
- package/dist/components/BbBaseInputContainer/types.d.ts +185 -0
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.d.ts +52 -0
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.js +6 -0
- package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue_vue_type_script_setup_true_lang.js +211 -0
- package/dist/components/BbBaseNumberInput/types.d.ts +211 -0
- package/dist/components/BbBaseRadio/BbBaseRadio.vue.d.ts +33 -0
- package/dist/components/BbBaseRadio/BbBaseRadio.vue.js +6 -0
- package/dist/components/BbBaseRadio/BbBaseRadio.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/BbBaseRadio/types.d.ts +179 -0
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue.d.ts +19 -0
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue.js +6 -0
- package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue_vue_type_script_setup_true_lang.js +172 -0
- package/dist/components/BbBaseRadioGroup/types.d.ts +215 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue.d.ts +4 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue.js +6 -0
- package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/BbBaseRadioIcon/types.d.ts +41 -0
- package/dist/components/BbBaseRating/BbBaseRating.vue.d.ts +38 -0
- package/dist/components/BbBaseRating/BbBaseRating.vue.js +6 -0
- package/dist/components/BbBaseRating/BbBaseRating.vue_vue_type_script_setup_true_lang.js +184 -0
- package/dist/components/BbBaseRating/types.d.ts +168 -0
- package/dist/components/BbBaseSelect/BbBaseSelect.vue.d.ts +19 -0
- package/dist/components/BbBaseSelect/BbBaseSelect.vue.js +6 -0
- package/dist/components/BbBaseSelect/BbBaseSelect.vue_vue_type_script_setup_true_lang.js +307 -0
- package/dist/components/BbBaseSelect/types.d.ts +294 -0
- package/dist/components/BbBaseSlider/BbBaseSlider.vue.d.ts +35 -0
- package/dist/components/BbBaseSlider/BbBaseSlider.vue.js +6 -0
- package/dist/components/BbBaseSlider/BbBaseSlider.vue_vue_type_script_setup_true_lang.js +324 -0
- package/dist/components/BbBaseSlider/types.d.ts +200 -0
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue.d.ts +35 -0
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue.js +6 -0
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/BbBaseSwitch/types.d.ts +10 -0
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.d.ts +19 -0
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.js +6 -0
- package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbBaseSwitchGroup/types.d.ts +8 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue.d.ts +4 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue.js +6 -0
- package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/BbBaseSwitchIcon/types.d.ts +48 -0
- package/dist/components/BbBaseTag/BbBaseTag.vue.d.ts +50 -0
- package/dist/components/BbBaseTag/BbBaseTag.vue.js +6 -0
- package/dist/components/BbBaseTag/BbBaseTag.vue_vue_type_script_setup_true_lang.js +266 -0
- package/dist/components/BbBaseTag/types.d.ts +160 -0
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.d.ts +45 -0
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.js +6 -0
- package/dist/components/BbBaseTextInput/BbBaseTextInput.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/BbBaseTextInput/types.d.ts +209 -0
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.d.ts +39 -0
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.js +6 -0
- package/dist/components/BbBaseTextarea/BbBaseTextarea.vue_vue_type_script_setup_true_lang.js +175 -0
- package/dist/components/BbBaseTextarea/types.d.ts +170 -0
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.d.ts +27 -0
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.js +6 -0
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue_vue_type_script_setup_true_lang.js +517 -0
- package/dist/components/BbBaseTimePickerInput/types.d.ts +151 -0
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +0 -1
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.js +6 -0
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +224 -0
- package/dist/components/BbBreadcrumbs/estimateBreadcrumbItemWidth.js +47 -0
- package/dist/components/BbBreadcrumbs/types.d.ts +33 -22
- package/dist/components/BbButton/BbButton.vue.d.ts +6 -5
- package/dist/components/BbButton/BbButton.vue.js +6 -0
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +177 -0
- package/dist/components/BbButton/types.d.ts +48 -47
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +4 -3
- package/dist/components/BbCheckbox/BbCheckbox.vue.js +6 -0
- package/dist/components/BbCheckbox/BbCheckbox.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/BbCheckbox/types.d.ts +24 -10
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +2 -13
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.js +6 -0
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbCheckboxGroup/types.d.ts +44 -23
- package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +2 -1
- package/dist/components/BbCollapsible/BbCollapsible.vue.js +6 -0
- package/dist/components/BbCollapsible/BbCollapsible.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/BbCollapsible/types.d.ts +10 -9
- package/dist/components/BbColorInput/BbColorInput.vue.d.ts +10 -1
- package/dist/components/BbColorInput/BbColorInput.vue.js +6 -0
- package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +177 -0
- package/dist/components/BbColorInput/types.d.ts +37 -11
- package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +5 -8
- package/dist/components/BbColorPalette/BbColorPalette.vue.js +5 -0
- package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/BbColorPalette/types.d.ts +66 -53
- package/dist/components/BbConfirm/BbConfirm.vue.js +6 -0
- package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +5 -6
- package/dist/components/BbConfirm/BbConfirmPortal.vue.js +5 -0
- package/dist/components/BbConfirm/BbConfirmPortal.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +37 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue.js +6 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +319 -0
- package/dist/components/BbDatePicker/types.d.ts +155 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +3 -1
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.js +6 -0
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +179 -0
- package/dist/components/BbDatePickerInput/types.d.ts +127 -16
- package/dist/components/BbDialog/BbDialog.vue.d.ts +8 -6
- package/dist/components/BbDialog/BbDialog.vue.js +6 -0
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +214 -0
- package/dist/components/BbDialog/types.d.ts +146 -1
- package/dist/components/BbDialog/useDialogStack.d.ts +5 -0
- package/dist/components/BbDialog/useDialogStack.js +20 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +18 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue.js +6 -0
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +14 -7
- package/dist/components/BbDropdown/BbDropdown.vue.js +6 -0
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +560 -0
- package/dist/components/BbDropdown/BbDropdownGroup.vue.d.ts +44 -0
- package/dist/components/BbDropdown/BbDropdownGroup.vue.js +5 -0
- package/dist/components/BbDropdown/BbDropdownGroup.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +27 -0
- package/dist/components/BbDropdown/BbDropdownList.vue.js +6 -0
- package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +464 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue.d.ts +16 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue.js +5 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/components/BbDropdown/normalizeGroups.d.ts +18 -0
- package/dist/components/BbDropdown/normalizeGroups.js +46 -0
- package/dist/components/BbDropdown/types.d.ts +457 -45
- package/dist/components/BbDropdown/types.js +4 -0
- package/dist/components/BbDropdown/useDropdownContext.d.ts +89 -0
- package/dist/components/BbDropdown/useDropdownContext.js +9 -0
- package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +108 -0
- package/dist/components/BbDropdown/useDropdownGroupRegistry.js +5 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +3 -3
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.js +6 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/components/BbDropdownButton/types.d.ts +45 -52
- package/dist/components/BbDropzone/BbDropzone.vue.d.ts +5 -4
- package/dist/components/BbDropzone/BbDropzone.vue.js +6 -0
- package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +284 -0
- package/dist/components/BbDropzone/types.d.ts +55 -7
- package/dist/components/BbIcon/BbIcon.vue.d.ts +3 -2
- package/dist/components/BbIcon/BbIcon.vue.js +6 -0
- package/dist/components/BbIcon/BbIcon.vue_vue_type_script_setup_true_lang.js +65 -0
- package/dist/components/BbIcon/types.d.ts +6 -19
- package/dist/components/BbIndicator/BbIndicator.vue.d.ts +14 -0
- package/dist/components/BbIndicator/BbIndicator.vue.js +6 -0
- package/dist/components/BbIndicator/BbIndicator.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/components/BbIndicator/types.d.ts +49 -0
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +12 -6
- package/dist/components/BbNumberInput/BbNumberInput.vue.js +6 -0
- package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/BbNumberInput/types.d.ts +31 -4
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +10 -10
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.js +6 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +284 -0
- package/dist/components/BbOffCanvas/types.d.ts +71 -39
- package/dist/components/BbOffCanvas/useOffCanvasStack.d.ts +25 -0
- package/dist/components/BbOffCanvas/useOffCanvasStack.js +68 -0
- package/dist/components/BbPagination/BbPagination.vue.d.ts +3 -4
- package/dist/components/BbPagination/BbPagination.vue.js +6 -0
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BbPagination/paginationFit.d.ts +38 -0
- package/dist/components/BbPagination/paginationFit.js +13 -0
- package/dist/components/BbPagination/types.d.ts +51 -16
- package/dist/components/BbPopover/BbPopover.vue.d.ts +10 -15
- package/dist/components/BbPopover/BbPopover.vue.js +6 -0
- package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +310 -0
- package/dist/components/BbPopover/escapeStack.d.ts +6 -0
- package/dist/components/BbPopover/escapeStack.js +10 -0
- package/dist/components/BbPopover/types.d.ts +84 -31
- package/dist/components/BbProgress/BbProgress.vue.d.ts +1 -0
- package/dist/components/BbProgress/BbProgress.vue.js +6 -0
- package/dist/components/BbProgress/BbProgress.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/BbProgress/types.d.ts +15 -1
- package/dist/components/BbRadio/BbRadio.vue.d.ts +5 -3
- package/dist/components/BbRadio/BbRadio.vue.js +6 -0
- package/dist/components/BbRadio/BbRadio.vue_vue_type_script_setup_true_lang.js +133 -0
- package/dist/components/BbRadio/types.d.ts +23 -9
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +4 -14
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.js +6 -0
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +184 -0
- package/dist/components/BbRadioGroup/types.d.ts +41 -22
- package/dist/components/BbRating/BbRating.vue.d.ts +4 -1
- package/dist/components/BbRating/BbRating.vue.js +6 -0
- package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +150 -0
- package/dist/components/BbRating/types.d.ts +37 -10
- package/dist/components/BbSelect/BbSelect.vue.d.ts +2 -11
- package/dist/components/BbSelect/BbSelect.vue.js +6 -0
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/components/BbSelect/types.d.ts +105 -59
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +1 -10
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.js +6 -0
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +637 -0
- package/dist/components/BbSelectPopover/types.d.ts +189 -102
- package/dist/components/BbSlider/BbSlider.vue.d.ts +3 -6
- package/dist/components/BbSlider/BbSlider.vue.js +6 -0
- package/dist/components/BbSlider/BbSlider.vue_vue_type_script_setup_true_lang.js +166 -0
- package/dist/components/BbSlider/types.d.ts +37 -13
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +3 -1
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.js +6 -0
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/BbSmoothHeight/types.d.ts +13 -2
- package/dist/components/BbSpinner/BbSpinner.vue.d.ts +1 -1
- package/dist/components/BbSpinner/BbSpinner.vue.js +6 -0
- package/dist/components/BbSpinner/BbSpinner.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/BbSpinner/types.d.ts +10 -3
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +5 -3
- package/dist/components/BbSwitch/BbSwitch.vue.js +6 -0
- package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +142 -0
- package/dist/components/BbSwitch/types.d.ts +3 -1
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +4 -14
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.js +6 -0
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +190 -0
- package/dist/components/BbSwitchGroup/types.d.ts +3 -22
- package/dist/components/BbTable/BbTable.vue.d.ts +53 -31
- package/dist/components/BbTable/BbTable.vue.js +6 -0
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +889 -0
- package/dist/components/BbTable/types.d.ts +176 -37
- package/dist/components/BbTable/utils.d.ts +9 -1
- package/dist/components/BbTable/utils.js +53 -0
- package/dist/components/BbTabs/BbTabs.vue.d.ts +20 -0
- package/dist/components/BbTabs/BbTabs.vue.js +6 -0
- package/dist/components/BbTabs/BbTabs.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/components/BbTabs/BbTabsList.vue.d.ts +19 -0
- package/dist/components/BbTabs/BbTabsList.vue.js +6 -0
- package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/BbTabs/BbTabsPanes.vue.d.ts +16 -0
- package/dist/components/BbTabs/BbTabsPanes.vue.js +6 -0
- package/dist/components/BbTabs/BbTabsPanes.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/components/BbTabs/BbTabsRoot.vue.d.ts +20 -0
- package/dist/components/BbTabs/BbTabsRoot.vue.js +5 -0
- package/dist/components/BbTabs/BbTabsRoot.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/BbTabs/types.d.ts +264 -0
- package/dist/components/BbTag/BbTag.vue.d.ts +19 -6
- package/dist/components/BbTag/BbTag.vue.js +6 -0
- package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/BbTag/types.d.ts +48 -17
- package/dist/components/BbTextInput/BbTextInput.vue.d.ts +10 -1
- package/dist/components/BbTextInput/BbTextInput.vue.js +6 -0
- package/dist/components/BbTextInput/BbTextInput.vue_vue_type_script_setup_true_lang.js +195 -0
- package/dist/components/BbTextInput/types.d.ts +24 -4
- package/dist/components/BbTextarea/BbTextarea.vue.d.ts +10 -1
- package/dist/components/BbTextarea/BbTextarea.vue.js +6 -0
- package/dist/components/BbTextarea/BbTextarea.vue_vue_type_script_setup_true_lang.js +178 -0
- package/dist/components/BbTextarea/types.d.ts +26 -2
- package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +33 -0
- package/dist/components/BbTimePicker/BbTimePicker.vue.js +6 -0
- package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/components/BbTimePicker/types.d.ts +129 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +25 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.js +6 -0
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/BbTimePickerInput/types.d.ts +165 -0
- package/dist/components/BbToast/BbToast.vue.d.ts +2 -3
- package/dist/components/BbToast/BbToast.vue.js +6 -0
- package/dist/components/BbToast/BbToast.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +17 -8
- package/dist/components/BbToast/BbToastMessage.vue.js +5 -0
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/BbToast/BbToastPortal.vue.d.ts +30 -0
- package/dist/components/BbToast/BbToastPortal.vue.js +5 -0
- package/dist/components/BbToast/BbToastPortal.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/BbToast/BbToastRegion.vue.d.ts +8 -0
- package/dist/components/BbToast/BbToastRegion.vue.js +5 -0
- package/dist/components/BbToast/BbToastRegion.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/BbToast/types.d.ts +69 -5
- package/dist/components/BbTooltip/BbTooltip.vue.d.ts +4 -3
- package/dist/components/BbTooltip/BbTooltip.vue.js +6 -0
- package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/components/BbTooltip/types.d.ts +61 -11
- package/dist/components/BbTree/BbTree.vue.d.ts +26 -13
- package/dist/components/BbTree/BbTree.vue.js +6 -0
- package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/BbTree/BbTreeLevel.vue.d.ts +19 -0
- package/dist/components/BbTree/BbTreeLevel.vue.js +5 -0
- package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/components/BbTree/context.d.ts +17 -0
- package/dist/components/BbTree/context.js +4 -0
- package/dist/components/BbTree/types.d.ts +93 -42
- package/dist/components/ChipsBox/ChipsBox.vue.d.ts +2 -1
- package/dist/components/ChipsBox/ChipsBox.vue.js +5 -0
- package/dist/components/ChipsBox/ChipsBox.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/components/ChipsBox/types.d.ts +12 -5
- package/dist/components/ClearableButton/ClearableButton.vue.d.ts +2 -1
- package/dist/components/ClearableButton/ClearableButton.vue.js +6 -0
- package/dist/components/ClearableButton/ClearableButton.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/ClearableButton/types.d.ts +7 -1
- package/dist/components/CloseIcon/CloseButton.vue.d.ts +5 -0
- package/dist/components/CloseIcon/CloseButton.vue.js +7 -0
- package/dist/components/CloseIcon/CloseButton.vue_vue_type_script_setup_true_lang.js +23 -0
- package/dist/components/CloseIcon/types.d.ts +2 -0
- package/dist/components/CommaBox/CommaBox.vue.d.ts +2 -1
- package/dist/components/CommaBox/CommaBox.vue.js +6 -0
- package/dist/components/CommaBox/CommaBox.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/components/CommaBox/types.d.ts +6 -7
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue.d.ts +19 -0
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue.js +6 -0
- package/dist/components/CommonInputWrapper/CommonInputWrapper.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/CommonInputWrapper/types.d.ts +96 -0
- package/dist/components/CommonPopover/CommonPopover.vue.d.ts +3 -3
- package/dist/components/CommonPopover/CommonPopover.vue.js +6 -0
- package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +160 -0
- package/dist/components/CommonPopover/types.d.ts +61 -16
- package/dist/components/ErrorIcon/ErrorIcon.vue.d.ts +2 -0
- package/dist/components/ErrorIcon/ErrorIcon.vue.js +6 -0
- package/dist/components/ErrorIcon/ErrorIcon.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/components/FlatListBox/FlatListBox.vue.d.ts +2 -5
- package/dist/components/FlatListBox/FlatListBox.vue.js +5 -0
- package/dist/components/FlatListBox/FlatListBox.vue_vue_type_script_setup_true_lang.js +167 -0
- package/dist/components/FlatListBox/types.d.ts +1 -1
- package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +2 -5
- package/dist/components/GroupedListBox/GroupedListBox.vue.js +5 -0
- package/dist/components/GroupedListBox/GroupedListBox.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/ListBox/ListBox.vue.d.ts +3 -6
- package/dist/components/ListBox/ListBox.vue.js +5 -0
- package/dist/components/ListBox/ListBox.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/ListBox/types.d.ts +1 -1
- package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +1 -0
- package/dist/components/OptionsContainer/OptionsContainer.vue.js +5 -0
- package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/components/OptionsContainer/types.d.ts +14 -24
- package/dist/components/Transitions/ScaleFade.vue.js +5 -0
- package/dist/components/Transitions/ScaleFade.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/components/Transitions/Slide.vue.js +7 -0
- package/dist/components/Transitions/Slide.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/WarningIcon/WarningIcon.vue.d.ts +5 -0
- package/dist/components/WarningIcon/WarningIcon.vue.js +6 -0
- package/dist/components/WarningIcon/WarningIcon.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/components/WarningIcon/types.d.ts +3 -0
- package/dist/composables/__testResets.d.ts +1 -0
- package/dist/composables/useActiveInactiveState.d.ts +4 -0
- package/dist/composables/useActiveInactiveState.js +21 -0
- package/dist/composables/useBaseOptions.d.ts +3 -3
- package/dist/composables/useBaseOptions.js +31 -0
- package/dist/composables/useBbConfig.d.ts +8 -37
- package/dist/composables/useBbConfig.js +5 -0
- package/dist/composables/useBbDropdownContext.d.ts +89 -0
- package/dist/composables/useBbDropdownContext.js +46 -0
- package/dist/composables/useBbFormContext.d.ts +90 -0
- package/dist/composables/useBbFormContext.js +69 -0
- package/dist/composables/useBbTableContext.d.ts +195 -0
- package/dist/composables/useBbTableContext.js +208 -0
- package/dist/composables/useBbTabsContext.d.ts +111 -0
- package/dist/composables/useBbTabsContext.js +219 -0
- package/dist/composables/useBreakpoint.d.ts +13 -0
- package/dist/composables/useBreakpoint.js +39 -0
- package/dist/composables/useBroadcastChannelInstance.d.ts +1 -3
- package/dist/composables/useBroadcastChannelInstance.js +39 -0
- package/dist/composables/useCancelableFunction.js +37 -0
- package/dist/composables/useCoherence.js +16 -0
- package/dist/composables/useConfirm.d.ts +257 -67
- package/dist/composables/useConfirm.js +122 -0
- package/dist/composables/useCountdown.js +42 -0
- package/dist/composables/useHashedWatcher.d.ts +17 -0
- package/dist/composables/useHashedWatcher.js +14 -0
- package/dist/composables/useId.d.ts +3 -2
- package/dist/composables/useIndexById.js +16 -0
- package/dist/composables/useInertiaPage.d.ts +10 -0
- package/dist/composables/useInertiaPage.js +8 -0
- package/dist/composables/useItemText.js +17 -0
- package/dist/composables/useItemValue.js +9 -0
- package/dist/composables/useItemsGetter.d.ts +1 -1
- package/dist/composables/useItemsGetter.js +30 -0
- package/dist/composables/useListboxFocus.js +66 -0
- package/dist/composables/useLocale.d.ts +1 -1
- package/dist/composables/useLocale.js +11 -0
- package/dist/composables/useLogger.d.ts +1 -1
- package/dist/composables/useLogger.js +10 -0
- package/dist/composables/useMinimalQueue.d.ts +1 -1
- package/dist/composables/useMobile.js +7 -0
- package/dist/composables/useOnFalsy.d.ts +2 -0
- package/dist/composables/useOnFalsy.js +9 -0
- package/dist/composables/useOnTruthy.d.ts +7 -0
- package/dist/composables/useOnTruthy.js +9 -0
- package/dist/composables/usePrefill.d.ts +2 -1
- package/dist/composables/usePrefill.js +24 -0
- package/dist/composables/useQuery.d.ts +15 -3
- package/dist/composables/useQuery.js +42 -0
- package/dist/composables/useRoute.js +11 -0
- package/dist/composables/useRouter.js +8 -0
- package/dist/composables/useSafeArea.d.ts +51 -0
- package/dist/composables/useSafeArea.js +16 -0
- package/dist/composables/useSegmentedFields.d.ts +103 -0
- package/dist/composables/useSegmentedFields.js +152 -0
- package/dist/composables/useTableWidthContext.d.ts +5 -0
- package/dist/composables/useTableWidthContext.js +42 -0
- package/dist/composables/useToast.d.ts +17 -73
- package/dist/composables/useToast.js +49 -0
- package/dist/composables/useTopLayer.d.ts +9 -0
- package/dist/composables/useTopLayer.js +7 -0
- package/dist/composables/useUntil.js +13 -0
- package/dist/composables/useViewportWidth.d.ts +17 -0
- package/dist/composables/useViewportWidth.js +6 -0
- package/dist/confirm-variants.d.ts +10 -0
- package/dist/deprecation/ai-deprecations.json.d.ts +784 -0
- package/dist/deprecation/ai-deprecations.json.js +4 -0
- package/dist/deprecation/removedProps.d.ts +3 -0
- package/dist/deprecation/removedProps.js +13 -0
- package/dist/directives/bbColor.d.ts +65 -0
- package/dist/directives/bbColor.js +24 -0
- package/dist/directives/bbDate.d.ts +66 -0
- package/dist/directives/bbDate.js +24 -0
- package/dist/directives/bbDropdown.d.ts +15 -11
- package/dist/directives/bbDropdown.js +23 -0
- package/dist/directives/bbTime.d.ts +64 -0
- package/dist/directives/bbTime.js +24 -0
- package/dist/directives/bbTooltip.d.ts +16 -11
- package/dist/directives/bbTooltip.js +24 -0
- package/dist/dropdown-item-variants.d.ts +10 -0
- package/dist/i18n/index.d.ts +51 -3
- package/dist/i18n/index.js +27 -0
- package/dist/i18n/locales/cs.json +115 -0
- package/dist/i18n/locales/da.json +115 -0
- package/dist/i18n/locales/de.json +115 -0
- package/dist/i18n/locales/el.json +115 -0
- package/dist/i18n/locales/en.json +115 -0
- package/dist/i18n/locales/es.json +115 -0
- package/dist/i18n/locales/fi.json +115 -0
- package/dist/i18n/locales/fr.json +115 -0
- package/dist/i18n/locales/hu.json +115 -0
- package/dist/i18n/locales/it.json +115 -0
- package/dist/i18n/locales/ja.json +115 -0
- package/dist/i18n/locales/ko.json +115 -0
- package/dist/i18n/locales/nb.json +115 -0
- package/dist/i18n/locales/nl.json +115 -0
- package/dist/i18n/locales/pl.json +115 -0
- package/dist/i18n/locales/pt.json +115 -0
- package/dist/i18n/locales/ro.json +115 -0
- package/dist/i18n/locales/ru.json +115 -0
- package/dist/i18n/locales/sv.json +115 -0
- package/dist/i18n/locales/tr.json +115 -0
- package/dist/i18n/locales/uk.json +115 -0
- package/dist/i18n/locales/zh-cn.json +115 -0
- package/dist/icons-whitelist.d.ts +8 -0
- package/dist/index.d.ts +94 -79
- package/dist/index.js +76 -82
- package/dist/indicator-variants.d.ts +13 -0
- package/dist/llms-full.txt +77073 -0
- package/dist/llms-medium.txt +1334 -0
- package/dist/llms.txt +103 -0
- package/dist/locale-blueprint.json +141 -0
- package/dist/nuxt-module.d.ts +3 -0
- package/dist/nuxt.js +19 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.js +22 -0
- package/dist/reset.css +1 -0
- package/dist/reset.d.ts +0 -0
- package/dist/runtime/nuxt-plugin.d.ts +2 -0
- package/dist/runtime/nuxt-plugin.js +24 -0
- package/dist/styles.css +2 -0
- package/dist/styles.d.ts +0 -0
- package/dist/toast-variants.d.ts +13 -0
- package/dist/tooltip-variants.d.ts +10 -0
- package/dist/types/ActionButton.d.ts +32 -0
- package/dist/types/AlertVariant.d.ts +16 -0
- package/dist/types/BadgeVariant.d.ts +16 -0
- package/dist/types/ButtonVariant.d.ts +17 -0
- package/dist/types/Classes.d.ts +1 -1
- package/dist/types/ColumnName.d.ts +1 -1
- package/dist/types/CommonProps.d.ts +66 -279
- package/dist/types/Config.d.ts +84 -0
- package/dist/types/ConfirmVariant.d.ts +15 -0
- package/dist/types/DropdownItemVariant.d.ts +18 -0
- package/dist/types/Icon.d.ts +5 -7
- package/dist/types/IndicatorVariant.d.ts +16 -0
- package/dist/types/InputDirection.d.ts +15 -0
- package/dist/types/ItemAccessor.d.ts +21 -0
- package/dist/types/Placement.d.ts +6 -0
- package/dist/types/ResponsiveSize.d.ts +20 -0
- package/dist/types/SizeScale.d.ts +8 -0
- package/dist/types/ToastVariant.d.ts +17 -0
- package/dist/types/TooltipVariant.d.ts +18 -0
- package/dist/utilities/functions/bytesToUnit.d.ts +2 -0
- package/dist/utilities/functions/bytesToUnit.js +18 -0
- package/dist/utilities/functions/clampPrecision.js +10 -0
- package/dist/utilities/functions/convertDateValue.d.ts +23 -10
- package/dist/utilities/functions/convertDateValue.js +12 -0
- package/dist/utilities/functions/deburr.js +5 -0
- package/dist/utilities/functions/empty.js +5 -0
- package/dist/utilities/functions/flattenTree.d.ts +1 -1
- package/dist/utilities/functions/hash.js +5 -0
- package/dist/utilities/functions/isDateDisabled.d.ts +1 -0
- package/dist/utilities/functions/isDateDisabled.js +20 -0
- package/dist/utilities/functions/isEqual.js +5 -0
- package/dist/utilities/functions/isNotEmpty.js +5 -0
- package/dist/utilities/functions/matchAnyKey.d.ts +1 -1
- package/dist/utilities/functions/matchAnyKey.js +15 -0
- package/dist/utilities/functions/parseSize.d.ts +1 -1
- package/dist/utilities/functions/parseSize.js +15 -0
- package/dist/utilities/functions/percentage.js +11 -0
- package/dist/utilities/functions/pipe.d.ts +1 -1
- package/dist/utilities/functions/reject.d.ts +25 -0
- package/dist/utilities/functions/reject.js +28 -0
- package/dist/utilities/functions/resolveEnumProp.d.ts +19 -0
- package/dist/utilities/functions/resolveEnumProp.js +5 -0
- package/dist/utilities/functions/slotKey.d.ts +13 -0
- package/dist/utilities/functions/slotKey.js +4 -0
- package/dist/utilities/functions/sort.d.ts +2 -2
- package/dist/utilities/functions/sort.js +19 -0
- package/dist/utilities/functions/throttle.js +5 -0
- package/dist/utilities/functions/waitFor.d.ts +9 -2
- package/dist/utilities/functions/waitFor.js +14 -0
- package/dist/utilities/functions/warnRemovedAttrs.d.ts +11 -0
- package/dist/utilities/functions/warnRemovedAttrs.js +20 -0
- package/dist/utilities/functions/when.js +5 -0
- package/dist/utilities/misc/iconsInjectionKey.d.ts +15 -0
- package/dist/utilities/misc/iconsInjectionKey.js +4 -0
- package/dist/utilities/misc/transitions.d.ts +5 -0
- package/dist/utilities/misc/transitions.js +8 -0
- package/dist/utils/injectLibraryStyles.d.ts +6 -0
- package/dist/utils/injectLibraryStyles.js +38 -0
- package/dist/validated/BbCheckbox.vue.d.ts +29 -0
- package/dist/validated/BbCheckbox.vue.js +5 -0
- package/dist/validated/BbCheckbox.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/validated/BbCheckboxGroup.vue.d.ts +34 -0
- package/dist/validated/BbCheckboxGroup.vue.js +5 -0
- package/dist/validated/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/validated/BbColorInput.vue.d.ts +36 -0
- package/dist/validated/BbColorInput.vue.js +5 -0
- package/dist/validated/BbColorInput.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/validated/BbDatePickerInput.vue.d.ts +40 -0
- package/dist/validated/BbDatePickerInput.vue.js +5 -0
- package/dist/validated/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/validated/BbDropzone.vue.d.ts +24 -0
- package/dist/validated/BbDropzone.vue.js +5 -0
- package/dist/validated/BbDropzone.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/validated/BbForm.vue.d.ts +28 -0
- package/dist/validated/BbForm.vue.js +5 -0
- package/dist/validated/BbForm.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/validated/BbNumberInput.vue.d.ts +36 -0
- package/dist/validated/BbNumberInput.vue.js +5 -0
- package/dist/validated/BbNumberInput.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/validated/BbRadioGroup.vue.d.ts +34 -0
- package/dist/validated/BbRadioGroup.vue.js +5 -0
- package/dist/validated/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/validated/BbRating.vue.d.ts +30 -0
- package/dist/validated/BbRating.vue.js +5 -0
- package/dist/validated/BbRating.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/validated/BbSelect.vue.d.ts +46 -0
- package/dist/validated/BbSelect.vue.js +5 -0
- package/dist/validated/BbSelect.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/validated/BbSlider.vue.d.ts +36 -0
- package/dist/validated/BbSlider.vue.js +5 -0
- package/dist/validated/BbSlider.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/validated/BbSwitch.vue.d.ts +29 -0
- package/dist/validated/BbSwitch.vue.js +5 -0
- package/dist/validated/BbSwitch.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/validated/BbSwitchGroup.vue.d.ts +34 -0
- package/dist/validated/BbSwitchGroup.vue.js +5 -0
- package/dist/validated/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/validated/BbTag.vue.d.ts +36 -0
- package/dist/validated/BbTag.vue.js +5 -0
- package/dist/validated/BbTag.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/validated/BbTextInput.vue.d.ts +36 -0
- package/dist/validated/BbTextInput.vue.js +5 -0
- package/dist/validated/BbTextInput.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/validated/BbTextarea.vue.d.ts +36 -0
- package/dist/validated/BbTextarea.vue.js +5 -0
- package/dist/validated/BbTextarea.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/validated/BbTimePickerInput.vue.d.ts +36 -0
- package/dist/validated/BbTimePickerInput.vue.js +5 -0
- package/dist/validated/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/validated/index.d.ts +29 -0
- package/dist/validated/useValidatedField.d.ts +52 -0
- package/dist/validated/useValidatedField.js +51 -0
- package/dist/validated.js +21 -0
- package/dist/vite-plugin.d.ts +217 -0
- package/dist/vite.js +530 -0
- package/llms.txt +105 -0
- package/package.json +161 -59
- package/scripts/lib/__fixtures__/validated-manifest.json +65 -0
- package/scripts/lib/ensure-manifest.mjs +39 -0
- package/scripts/lib/eslint-plugin-autofix.node.test.mjs +109 -0
- package/scripts/lib/eslint-plugin.mjs +285 -0
- package/scripts/lib/eslint-plugin.node.test.mjs +161 -0
- package/scripts/lib/html-attributes.mjs +191 -0
- package/scripts/lib/mcp-config.mjs +126 -0
- package/scripts/lib/migrate-fix.mjs +115 -0
- package/scripts/lib/validate-bb-markup.mjs +421 -0
- package/dist/ai/BaseButton.md +0 -449
- package/dist/ai/BaseCheckbox.md +0 -512
- package/dist/ai/BaseCheckboxGroup.md +0 -597
- package/dist/ai/BaseColorInput.md +0 -461
- package/dist/ai/BaseDatePicker.md +0 -739
- package/dist/ai/BaseDatePickerInput.md +0 -1517
- package/dist/ai/BaseDialog.md +0 -610
- package/dist/ai/BaseInputContainer.md +0 -570
- package/dist/ai/BaseNumberInput.md +0 -509
- package/dist/ai/BaseRadio.md +0 -405
- package/dist/ai/BaseRadioGroup.md +0 -535
- package/dist/ai/BaseRating.md +0 -489
- package/dist/ai/BaseSelect.md +0 -1742
- package/dist/ai/BaseSlider.md +0 -871
- package/dist/ai/BaseSwitch.md +0 -322
- package/dist/ai/BaseSwitchGroup.md +0 -298
- package/dist/ai/BaseTag.md +0 -623
- package/dist/ai/BaseTextInput.md +0 -392
- package/dist/ai/BaseTextarea.md +0 -398
- package/dist/ai/BbChip.md +0 -147
- package/dist/ai/BbIntersection.md +0 -120
- package/dist/ai/BbRatio.md +0 -61
- package/dist/ai/BbRows.md +0 -307
- package/dist/ai/BbTab.md +0 -950
- package/dist/ai/CommonInputInnerContainer.md +0 -414
- package/dist/ai/CommonInputOuterContainer.md +0 -55
- package/dist/components/BaseButton/BaseButton.vue.d.ts +0 -14
- package/dist/components/BaseButton/types.d.ts +0 -159
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +0 -39
- package/dist/components/BaseCheckbox/types.d.ts +0 -213
- package/dist/components/BaseCheckboxGroup/BaseCheckboxGroup.vue.d.ts +0 -30
- package/dist/components/BaseCheckboxGroup/types.d.ts +0 -282
- package/dist/components/BaseColorInput/BaseColorInput.vue.d.ts +0 -35
- package/dist/components/BaseColorInput/ColorPalette.vue.d.ts +0 -13
- package/dist/components/BaseColorInput/types.d.ts +0 -233
- package/dist/components/BaseDatePicker/BaseDatePickerHeader.vue.d.ts +0 -15
- package/dist/components/BaseDatePicker/BaseDatePickerInputDaySelector.vue.d.ts +0 -58
- package/dist/components/BaseDatePicker/BaseDatePickerMonthSelector.vue.d.ts +0 -12
- package/dist/components/BaseDatePicker/BaseDatePickerYearSelector.vue.d.ts +0 -12
- package/dist/components/BaseDatePicker/types.d.ts +0 -100
- package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +0 -26
- package/dist/components/BaseDatePickerInput/types.d.ts +0 -206
- package/dist/components/BaseDialog/BaseDialog.vue.d.ts +0 -37
- package/dist/components/BaseDialog/types.d.ts +0 -180
- package/dist/components/BaseInputContainer/BaseInputContainer.vue.d.ts +0 -18
- package/dist/components/BaseInputContainer/types.d.ts +0 -126
- package/dist/components/BaseNumberInput/BaseNumberInput.vue.d.ts +0 -46
- package/dist/components/BaseNumberInput/types.d.ts +0 -191
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +0 -31
- package/dist/components/BaseRadio/types.d.ts +0 -173
- package/dist/components/BaseRadioGroup/BaseRadioGroup.vue.d.ts +0 -30
- package/dist/components/BaseRadioGroup/types.d.ts +0 -240
- package/dist/components/BaseRating/BaseRating.vue.d.ts +0 -35
- package/dist/components/BaseRating/types.d.ts +0 -144
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +0 -28
- package/dist/components/BaseSelect/types.d.ts +0 -470
- package/dist/components/BaseSlider/BaseSlider.vue.d.ts +0 -38
- package/dist/components/BaseSlider/types.d.ts +0 -201
- package/dist/components/BaseSwitch/BaseSwitch.vue.d.ts +0 -34
- package/dist/components/BaseSwitch/types.d.ts +0 -25
- package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +0 -30
- package/dist/components/BaseSwitchGroup/types.d.ts +0 -8
- package/dist/components/BaseTag/BaseTag.vue.d.ts +0 -37
- package/dist/components/BaseTag/types.d.ts +0 -136
- package/dist/components/BaseTextInput/BaseTextInput.vue.d.ts +0 -33
- package/dist/components/BaseTextInput/types.d.ts +0 -166
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +0 -31
- package/dist/components/BaseTextarea/types.d.ts +0 -151
- package/dist/components/BbChip/BbChip.vue.d.ts +0 -17
- package/dist/components/BbChip/types.d.ts +0 -23
- package/dist/components/BbIntersection/BbIntersection.vue.d.ts +0 -23
- package/dist/components/BbIntersection/types.d.ts +0 -36
- package/dist/components/BbRatio/BbRatio.vue.d.ts +0 -14
- package/dist/components/BbRatio/types.d.ts +0 -15
- package/dist/components/BbRows/BbRows.vue.d.ts +0 -62
- package/dist/components/BbRows/types.d.ts +0 -21
- package/dist/components/BbTab/BbTab.vue.d.ts +0 -27
- package/dist/components/BbTab/types.d.ts +0 -186
- package/dist/components/CommonInputInnerContainer/CommonInputInnerContainer.vue.d.ts +0 -15
- package/dist/components/CommonInputInnerContainer/types.d.ts +0 -47
- package/dist/components/CommonInputOuterContainer/CommonInputOuterContainer.vue.d.ts +0 -11
- package/dist/components/CommonInputOuterContainer/types.d.ts +0 -16
- package/dist/composables/useModalsState.d.ts +0 -5
- package/dist/composables/useQueue.d.ts +0 -58
- package/dist/composables/useWizard.d.ts +0 -85
- package/dist/i18n/en.d.ts +0 -67
- package/dist/i18n/it.d.ts +0 -67
- package/dist/index.css +0 -2
- package/dist/index100.js +0 -6
- package/dist/index101.js +0 -300
- package/dist/index102.js +0 -16
- package/dist/index103.js +0 -16
- package/dist/index104.js +0 -27
- package/dist/index109.js +0 -19
- package/dist/index11.js +0 -42
- package/dist/index110.js +0 -12
- package/dist/index111.js +0 -19
- package/dist/index112.js +0 -25
- package/dist/index114.js +0 -7
- package/dist/index115.js +0 -241
- package/dist/index116.js +0 -5
- package/dist/index117.js +0 -42
- package/dist/index118.js +0 -5
- package/dist/index119.js +0 -53
- package/dist/index120.js +0 -5
- package/dist/index121.js +0 -32
- package/dist/index122.js +0 -5
- package/dist/index124.js +0 -52
- package/dist/index125.js +0 -5
- package/dist/index126.js +0 -223
- package/dist/index128.js +0 -6
- package/dist/index129.js +0 -162
- package/dist/index13.js +0 -92
- package/dist/index130.js +0 -25
- package/dist/index131.js +0 -51
- package/dist/index132.js +0 -5
- package/dist/index133.js +0 -607
- package/dist/index135.js +0 -6
- package/dist/index136.js +0 -14
- package/dist/index137.js +0 -153
- package/dist/index139.js +0 -6
- package/dist/index14.js +0 -306
- package/dist/index140.js +0 -224
- package/dist/index141.js +0 -5
- package/dist/index143.js +0 -128
- package/dist/index145.js +0 -6
- package/dist/index146.js +0 -8
- package/dist/index147.js +0 -182
- package/dist/index149.js +0 -6
- package/dist/index15.js +0 -10
- package/dist/index151.js +0 -4
- package/dist/index152.js +0 -95
- package/dist/index154.js +0 -6
- package/dist/index155.js +0 -168
- package/dist/index157.js +0 -6
- package/dist/index158.js +0 -145
- package/dist/index16.js +0 -59
- package/dist/index160.js +0 -6
- package/dist/index161.js +0 -53
- package/dist/index163.js +0 -6
- package/dist/index164.js +0 -16
- package/dist/index166.js +0 -35
- package/dist/index168.js +0 -6
- package/dist/index169.js +0 -89
- package/dist/index171.js +0 -6
- package/dist/index172.js +0 -82
- package/dist/index174.js +0 -6
- package/dist/index175.js +0 -38
- package/dist/index176.js +0 -461
- package/dist/index177.js +0 -28
- package/dist/index178.js +0 -66
- package/dist/index18.js +0 -35
- package/dist/index180.js +0 -162
- package/dist/index181.js +0 -5
- package/dist/index182.js +0 -217
- package/dist/index183.js +0 -5
- package/dist/index184.js +0 -112
- package/dist/index185.js +0 -5
- package/dist/index186.js +0 -459
- package/dist/index188.js +0 -6
- package/dist/index19.js +0 -4
- package/dist/index192.js +0 -268
- package/dist/index194.js +0 -6
- package/dist/index195.js +0 -124
- package/dist/index197.js +0 -6
- package/dist/index198.js +0 -174
- package/dist/index2.js +0 -20
- package/dist/index20.js +0 -9
- package/dist/index200.js +0 -6
- package/dist/index201.js +0 -224
- package/dist/index203.js +0 -6
- package/dist/index204.js +0 -135
- package/dist/index206.js +0 -6
- package/dist/index207.js +0 -5
- package/dist/index208.js +0 -170
- package/dist/index21.js +0 -35
- package/dist/index210.js +0 -6
- package/dist/index211.js +0 -37
- package/dist/index213.js +0 -6
- package/dist/index214.js +0 -63
- package/dist/index216.js +0 -6
- package/dist/index217.js +0 -74
- package/dist/index219.js +0 -6
- package/dist/index22.js +0 -6
- package/dist/index220.js +0 -65
- package/dist/index222.js +0 -6
- package/dist/index223.js +0 -67
- package/dist/index225.js +0 -6
- package/dist/index226.js +0 -41
- package/dist/index228.js +0 -6
- package/dist/index229.js +0 -10
- package/dist/index23.js +0 -7
- package/dist/index230.js +0 -22
- package/dist/index232.js +0 -8
- package/dist/index233.js +0 -297
- package/dist/index235.js +0 -6
- package/dist/index236.js +0 -47
- package/dist/index237.js +0 -165
- package/dist/index239.js +0 -6
- package/dist/index24.js +0 -9
- package/dist/index241.js +0 -159
- package/dist/index243.js +0 -6
- package/dist/index244.js +0 -134
- package/dist/index246.js +0 -6
- package/dist/index247.js +0 -167
- package/dist/index249.js +0 -6
- package/dist/index25.js +0 -24
- package/dist/index250.js +0 -147
- package/dist/index252.js +0 -6
- package/dist/index253.js +0 -35
- package/dist/index255.js +0 -6
- package/dist/index256.js +0 -65
- package/dist/index258.js +0 -6
- package/dist/index259.js +0 -19
- package/dist/index260.js +0 -5
- package/dist/index261.js +0 -160
- package/dist/index263.js +0 -6
- package/dist/index264.js +0 -60
- package/dist/index266.js +0 -6
- package/dist/index267.js +0 -134
- package/dist/index269.js +0 -6
- package/dist/index27.js +0 -4
- package/dist/index271.js +0 -206
- package/dist/index273.js +0 -6
- package/dist/index274.js +0 -85
- package/dist/index275.js +0 -5
- package/dist/index276.js +0 -55
- package/dist/index277.js +0 -5
- package/dist/index278.js +0 -164
- package/dist/index28.js +0 -8
- package/dist/index280.js +0 -6
- package/dist/index281.js +0 -145
- package/dist/index283.js +0 -6
- package/dist/index284.js +0 -11
- package/dist/index285.js +0 -200
- package/dist/index287.js +0 -6
- package/dist/index288.js +0 -241
- package/dist/index29.js +0 -7
- package/dist/index290.js +0 -6
- package/dist/index291.js +0 -21
- package/dist/index293.js +0 -6
- package/dist/index294.js +0 -125
- package/dist/index296.js +0 -6
- package/dist/index297.js +0 -161
- package/dist/index299.js +0 -6
- package/dist/index30.js +0 -118
- package/dist/index300.js +0 -127
- package/dist/index302.js +0 -6
- package/dist/index303.js +0 -20
- package/dist/index305.js +0 -6
- package/dist/index306.js +0 -116
- package/dist/index307.js +0 -5
- package/dist/index308.js +0 -507
- package/dist/index31.js +0 -10
- package/dist/index310.js +0 -6
- package/dist/index311.js +0 -196
- package/dist/index313.js +0 -6
- package/dist/index314.js +0 -142
- package/dist/index316.js +0 -6
- package/dist/index317.js +0 -134
- package/dist/index319.js +0 -6
- package/dist/index32.js +0 -28
- package/dist/index320.js +0 -162
- package/dist/index322.js +0 -6
- package/dist/index323.js +0 -319
- package/dist/index325.js +0 -6
- package/dist/index326.js +0 -40
- package/dist/index327.js +0 -43
- package/dist/index328.js +0 -665
- package/dist/index33.js +0 -5
- package/dist/index330.js +0 -6
- package/dist/index331.js +0 -155
- package/dist/index333.js +0 -6
- package/dist/index334.js +0 -142
- package/dist/index336.js +0 -6
- package/dist/index337.js +0 -155
- package/dist/index339.js +0 -6
- package/dist/index34.js +0 -112
- package/dist/index340.js +0 -58
- package/dist/index341.js +0 -5
- package/dist/index342.js +0 -20
- package/dist/index344.js +0 -6
- package/dist/index345.js +0 -142
- package/dist/index347.js +0 -6
- package/dist/index349.js +0 -109
- package/dist/index351.js +0 -6
- package/dist/index353.js +0 -24
- package/dist/index354.js +0 -23
- package/dist/index355.js +0 -839
- package/dist/index356.js +0 -474
- package/dist/index357.js +0 -52
- package/dist/index358.js +0 -7
- package/dist/index36.js +0 -6
- package/dist/index38.js +0 -63
- package/dist/index39.js +0 -63
- package/dist/index40.js +0 -9
- package/dist/index42.js +0 -8
- package/dist/index43.js +0 -179
- package/dist/index44.js +0 -21
- package/dist/index46.js +0 -385
- package/dist/index48.js +0 -6
- package/dist/index49.js +0 -33
- package/dist/index5.js +0 -34
- package/dist/index50.js +0 -12
- package/dist/index51.js +0 -8
- package/dist/index52.js +0 -106
- package/dist/index53.js +0 -330
- package/dist/index54.js +0 -97
- package/dist/index55.js +0 -328
- package/dist/index56.js +0 -28
- package/dist/index57.js +0 -102
- package/dist/index58.js +0 -157
- package/dist/index6.js +0 -38
- package/dist/index60.js +0 -6
- package/dist/index61.js +0 -131
- package/dist/index62.js +0 -5
- package/dist/index65.js +0 -35
- package/dist/index66.js +0 -26
- package/dist/index68.js +0 -6
- package/dist/index69.js +0 -54
- package/dist/index7.js +0 -58
- package/dist/index71.js +0 -6
- package/dist/index72.js +0 -14
- package/dist/index74.js +0 -6
- package/dist/index75.js +0 -159
- package/dist/index77.js +0 -6
- package/dist/index78.js +0 -4
- package/dist/index79.js +0 -4
- package/dist/index80.js +0 -54
- package/dist/index81.js +0 -5
- package/dist/index82.js +0 -5
- package/dist/index83.js +0 -141
- package/dist/index85.js +0 -6
- package/dist/index86.js +0 -65
- package/dist/index88.js +0 -6
- package/dist/index89.js +0 -30
- package/dist/index9.js +0 -11
- package/dist/index90.js +0 -19
- package/dist/index91.js +0 -17
- package/dist/index92.js +0 -9
- package/dist/index93.js +0 -34
- package/dist/index95.js +0 -16
- package/dist/index96.js +0 -10
- package/dist/index97.js +0 -18
- package/dist/index98.js +0 -189
- package/dist/types/VoidHtmlElements.d.ts +0 -1
- package/dist/utilities/functions/add.d.ts +0 -1
- package/dist/utilities/functions/booleanishToBoolean.d.ts +0 -6
- package/dist/utilities/functions/capitalize.d.ts +0 -4
- package/dist/utilities/functions/cloneDeep.d.ts +0 -1
- package/dist/utilities/functions/debounce.d.ts +0 -1
- package/dist/utilities/functions/drop.d.ts +0 -1
- package/dist/utilities/functions/exceedsPrecision.d.ts +0 -1
- package/dist/utilities/functions/findRight.d.ts +0 -4
- package/dist/utilities/functions/findRightIndex.d.ts +0 -4
- package/dist/utilities/functions/flow.d.ts +0 -1
- package/dist/utilities/functions/getHueFromRGB.d.ts +0 -9
- package/dist/utilities/functions/groupBy.d.ts +0 -6
- package/dist/utilities/functions/gt.d.ts +0 -7
- package/dist/utilities/functions/hexToRGB.d.ts +0 -7
- package/dist/utilities/functions/hslToHex.d.ts +0 -1
- package/dist/utilities/functions/includes.d.ts +0 -1
- package/dist/utilities/functions/initial.d.ts +0 -1
- package/dist/utilities/functions/isCssColor.d.ts +0 -5
- package/dist/utilities/functions/lt.d.ts +0 -7
- package/dist/utilities/functions/makeUrl.d.ts +0 -1
- package/dist/utilities/functions/mapKeys.d.ts +0 -5
- package/dist/utilities/functions/mapValues.d.ts +0 -1
- package/dist/utilities/functions/matchesPropertyInsensitive.d.ts +0 -1
- package/dist/utilities/functions/max.d.ts +0 -2
- package/dist/utilities/functions/mean.d.ts +0 -4
- package/dist/utilities/functions/merge.d.ts +0 -11
- package/dist/utilities/functions/millisecondsTo.d.ts +0 -1
- package/dist/utilities/functions/negate.d.ts +0 -4
- package/dist/utilities/functions/normalizeItemGroups.d.ts +0 -13
- package/dist/utilities/functions/omit.d.ts +0 -2
- package/dist/utilities/functions/overEvery.d.ts +0 -4
- package/dist/utilities/functions/pick.d.ts +0 -1
- package/dist/utilities/functions/replace.d.ts +0 -1
- package/dist/utilities/functions/replaceInTree.d.ts +0 -4
- package/dist/utilities/functions/retry.d.ts +0 -5
- package/dist/utilities/functions/roundToTheNearest.d.ts +0 -8
- package/dist/utilities/functions/set.d.ts +0 -15
- package/dist/utilities/functions/stub.d.ts +0 -6
- package/dist/utilities/functions/transposePercent.d.ts +0 -9
- package/dist/utilities/functions/tryTo.d.ts +0 -2
- package/dist/utilities/functions/uniqBy.d.ts +0 -1
- /package/dist/{index64.js → _virtual/_plugin-vue_export-helper.js} +0 -0
- /package/dist/components/{BaseButton → BbBaseButton}/RouterComponent.vue.d.ts +0 -0
- /package/dist/components/{BaseDatePicker/BaseDatePicker.vue.d.ts → BbBaseDatePicker/BbBaseDatePicker.vue.d.ts} +0 -0
- /package/dist/{index165.js → composables/useArray.js} +0 -0
- /package/dist/{index17.js → composables/useFrameworkDetection.js} +0 -0
- /package/dist/{index12.js → composables/useId.js} +0 -0
- /package/dist/{index352.js → directives/createPopoverDirective.js} +0 -0
- /package/dist/{index107.js → utilities/functions/chunk.js} +0 -0
- /package/dist/{index8.js → utilities/functions/clamp.js} +0 -0
- /package/dist/{index150.js → utilities/functions/curry.js} +0 -0
- /package/dist/{index45.js → utilities/functions/extractDomContainer.js} +0 -0
- /package/dist/{index270.js → utilities/functions/findInTree.js} +0 -0
- /package/dist/{index348.js → utilities/functions/flattenTree.js} +0 -0
- /package/dist/{index41.js → utilities/functions/get.js} +0 -0
- /package/dist/{index189.js → utilities/functions/head.js} +0 -0
- /package/dist/{index108.js → utilities/functions/identity.js} +0 -0
- /package/dist/{index179.js → utilities/functions/indexBy.js} +0 -0
- /package/dist/{index37.js → utilities/functions/isHex.js} +0 -0
- /package/dist/{index94.js → utilities/functions/isNil.js} +0 -0
- /package/dist/{index26.js → utilities/functions/isNotNil.js} +0 -0
- /package/dist/{index105.js → utilities/functions/last.js} +0 -0
- /package/dist/{index142.js → utilities/functions/noop.js} +0 -0
- /package/dist/{index231.js → utilities/functions/parseWidthString.js} +0 -0
- /package/dist/{index240.js → utilities/functions/pickBy.js} +0 -0
- /package/dist/{index123.js → utilities/functions/range.js} +0 -0
- /package/dist/{index190.js → utilities/functions/snapToStep.js} +0 -0
- /package/dist/{index191.js → utilities/functions/transpose.js} +0 -0
- /package/dist/{index106.js → utilities/functions/validateDateFormat.js} +0 -0
- /package/dist/{index10.js → utilities/functions/wait.js} +0 -0
|
@@ -0,0 +1,1394 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inertia Helpers
|
|
3
|
+
summary: App-side toolkit for Laravel + Inertia apps — typed page props, lazy props, URL-driven filters, paginated/selection page contexts, promise forms, and navigation guards that pair with bitboss-ui pages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Inertia Helpers
|
|
7
|
+
|
|
8
|
+
A curated toolkit of composables for **Laravel + Inertia (Vue 3)** apps built
|
|
9
|
+
on bitboss-ui. These are _app-side_ code: copy the ones you need into your
|
|
10
|
+
project (conventionally `src/composables/`) — they are not exported by the
|
|
11
|
+
`bitboss-ui` package. The [Inertia recipes](../recipes/inertia/crud-listing-page.md)
|
|
12
|
+
assume this toolkit.
|
|
13
|
+
|
|
14
|
+
Why it exists: in Inertia there is no client data layer — data arrives as
|
|
15
|
+
**page props** and changes through **visits**. These helpers give that model
|
|
16
|
+
a clean, typed API so pages stay thin: props read through one surface,
|
|
17
|
+
filters live in the URL, paginated data and selection are shared through
|
|
18
|
+
keyed contexts instead of prop drilling, and forms return promises that
|
|
19
|
+
bitboss-ui buttons and dialogs can await.
|
|
20
|
+
|
|
21
|
+
Dependencies: `@inertiajs/vue3`, `@vueuse/core`, `query-string`, and
|
|
22
|
+
`object-code` (powering the `isEqual` hash-comparison utility). A few tiny
|
|
23
|
+
utilities are assumed under `@/utils` and defined below.
|
|
24
|
+
|
|
25
|
+
## Shared types and utilities
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// src/types/index.ts — the Laravel paginator shape and base page props
|
|
29
|
+
export type PaginatedResponse<T> = {
|
|
30
|
+
data: T[];
|
|
31
|
+
meta: {
|
|
32
|
+
total: number;
|
|
33
|
+
per_page: number;
|
|
34
|
+
current_page: number;
|
|
35
|
+
last_page: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type BasePageProps = {
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// src/utils/index.ts — micro-utilities the helpers share
|
|
46
|
+
import { hash } from 'object-code';
|
|
47
|
+
|
|
48
|
+
export const isNil = (value: unknown): value is null | undefined =>
|
|
49
|
+
value === null || value === undefined;
|
|
50
|
+
|
|
51
|
+
export const isNotNil = <T>(value: T | null | undefined): value is T =>
|
|
52
|
+
!isNil(value);
|
|
53
|
+
|
|
54
|
+
export const isEmpty = (value: unknown): boolean =>
|
|
55
|
+
isNil(value) || value === '' || (Array.isArray(value) && value.length === 0);
|
|
56
|
+
|
|
57
|
+
export const noop = (): void => undefined;
|
|
58
|
+
|
|
59
|
+
/** Deep equality by structural hash — cheap and dependency-light. */
|
|
60
|
+
export const isEqual = (a: unknown, b: unknown): boolean => hash(a) === hash(b);
|
|
61
|
+
|
|
62
|
+
export const isPlainObject = (
|
|
63
|
+
value: unknown
|
|
64
|
+
): value is Record<string, unknown> =>
|
|
65
|
+
typeof value === 'object' &&
|
|
66
|
+
value !== null &&
|
|
67
|
+
Object.getPrototypeOf(value) === Object.prototype;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Page props
|
|
73
|
+
|
|
74
|
+
### useProp / useOptionalProp
|
|
75
|
+
|
|
76
|
+
Typed, reactive access to a page prop by path. `useProp` throws when the
|
|
77
|
+
path is missing (a controller contract violation should fail loudly);
|
|
78
|
+
`useOptionalProp` returns `undefined` instead.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
// src/composables/useProp.ts
|
|
82
|
+
import { usePage } from '@inertiajs/vue3';
|
|
83
|
+
import { computed, type ComputedRef } from 'vue';
|
|
84
|
+
|
|
85
|
+
const walk = <T>(
|
|
86
|
+
source: unknown,
|
|
87
|
+
path: string[]
|
|
88
|
+
): { found: boolean; value: T | undefined } => {
|
|
89
|
+
let current: unknown = source;
|
|
90
|
+
for (const segment of path) {
|
|
91
|
+
if (
|
|
92
|
+
current === null ||
|
|
93
|
+
typeof current !== 'object' ||
|
|
94
|
+
!(segment in current)
|
|
95
|
+
) {
|
|
96
|
+
return { found: false, value: undefined };
|
|
97
|
+
}
|
|
98
|
+
current = (current as Record<string, unknown>)[segment];
|
|
99
|
+
}
|
|
100
|
+
return { found: true, value: current as T };
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const toPath = (propPath: string | string[]): string[] =>
|
|
104
|
+
typeof propPath === 'string' ? propPath.split('.') : propPath;
|
|
105
|
+
|
|
106
|
+
/** Reactive page prop by path. Throws when the path is not present. */
|
|
107
|
+
export const useProp = <T>(propPath: string | string[]): ComputedRef<T> => {
|
|
108
|
+
const page = usePage();
|
|
109
|
+
const path = toPath(propPath);
|
|
110
|
+
|
|
111
|
+
return computed(() => {
|
|
112
|
+
const { found, value } = walk<T>(page.props, path);
|
|
113
|
+
if (!found) {
|
|
114
|
+
throw new Error(`Page prop "${path.join('.')}" is missing.`);
|
|
115
|
+
}
|
|
116
|
+
return value as T;
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** Like useProp, but resolves to `undefined` when the path is missing. */
|
|
121
|
+
export const useOptionalProp = <T>(
|
|
122
|
+
propPath: string | string[]
|
|
123
|
+
): ComputedRef<T | undefined> => {
|
|
124
|
+
const page = usePage();
|
|
125
|
+
const path = toPath(propPath);
|
|
126
|
+
|
|
127
|
+
return computed(() => walk<T>(page.props, path).value);
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### useLazyProp
|
|
132
|
+
|
|
133
|
+
Reads a prop the server marked lazy (`Inertia::lazy()` / `optional()`).
|
|
134
|
+
The returned `value` is self-loading: the first template or computed that
|
|
135
|
+
reads it triggers a partial reload (`only: [propName]`) and the ref updates
|
|
136
|
+
when the data lands. `loading`/`loaded`/`error` expose the fetch state;
|
|
137
|
+
`execute()` forces the load imperatively.
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
// src/composables/useLazyProp.ts
|
|
141
|
+
import { isEqual, isNil, isNotNil } from '@/utils';
|
|
142
|
+
import { router, usePage } from '@inertiajs/vue3';
|
|
143
|
+
import type { Ref } from 'vue';
|
|
144
|
+
import { customRef, onBeforeUnmount, readonly, ref, watch } from 'vue';
|
|
145
|
+
|
|
146
|
+
export type UseLazyPropOptions = {
|
|
147
|
+
/** Keep the last non-nil value across visits that reset the prop. Default true. */
|
|
148
|
+
cache?: boolean;
|
|
149
|
+
headers?: Record<string, string>;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export function useLazyProp<T>(
|
|
153
|
+
propName: string,
|
|
154
|
+
initialValue?: T,
|
|
155
|
+
options: UseLazyPropOptions = {}
|
|
156
|
+
): {
|
|
157
|
+
value: Ref<T | undefined>;
|
|
158
|
+
loaded: Readonly<Ref<boolean>>;
|
|
159
|
+
loading: Readonly<Ref<boolean>>;
|
|
160
|
+
error: Readonly<Ref<Error | null>>;
|
|
161
|
+
execute: () => Promise<void>;
|
|
162
|
+
} {
|
|
163
|
+
const page = usePage<{ [key: string]: T | undefined }>();
|
|
164
|
+
const { cache = true } = options;
|
|
165
|
+
const loading = ref(false);
|
|
166
|
+
const loaded = ref(page.props[propName] !== undefined);
|
|
167
|
+
const error = ref<Error | null>(null);
|
|
168
|
+
let inFlightPromise: Promise<void> | null = null;
|
|
169
|
+
let isUnmounted = false;
|
|
170
|
+
let cached = page.props[propName];
|
|
171
|
+
|
|
172
|
+
onBeforeUnmount(() => {
|
|
173
|
+
isUnmounted = true;
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const loadProp = (onSuccess: () => void): Promise<void> => {
|
|
177
|
+
if (inFlightPromise) return inFlightPromise;
|
|
178
|
+
|
|
179
|
+
error.value = null;
|
|
180
|
+
|
|
181
|
+
inFlightPromise = new Promise<void>((resolve) => {
|
|
182
|
+
router.reload({
|
|
183
|
+
only: [propName],
|
|
184
|
+
replace: true,
|
|
185
|
+
headers: options.headers,
|
|
186
|
+
onStart: () => {
|
|
187
|
+
loading.value = true;
|
|
188
|
+
},
|
|
189
|
+
onSuccess: () => {
|
|
190
|
+
if (!isUnmounted) {
|
|
191
|
+
loaded.value = true;
|
|
192
|
+
cached = page.props[propName];
|
|
193
|
+
onSuccess();
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
onError: (errors) => {
|
|
197
|
+
if (!isUnmounted) {
|
|
198
|
+
error.value =
|
|
199
|
+
errors instanceof Error
|
|
200
|
+
? errors
|
|
201
|
+
: new Error(`Failed to load lazy prop "${propName}"`);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
onFinish: () => {
|
|
205
|
+
if (!isUnmounted) {
|
|
206
|
+
loading.value = false;
|
|
207
|
+
}
|
|
208
|
+
inFlightPromise = null;
|
|
209
|
+
resolve();
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
return inFlightPromise;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/** Self-loading ref: reading it while the prop is absent starts the fetch. */
|
|
218
|
+
const value = customRef<T | undefined>((track, trigger) => ({
|
|
219
|
+
get() {
|
|
220
|
+
track();
|
|
221
|
+
const isMissing = page.props[propName] === undefined;
|
|
222
|
+
|
|
223
|
+
if (isMissing && !loaded.value && !loading.value) {
|
|
224
|
+
loading.value = true;
|
|
225
|
+
void loadProp(trigger);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (isMissing && !loaded.value) {
|
|
229
|
+
return initialValue;
|
|
230
|
+
}
|
|
231
|
+
if (cache && cached !== undefined) {
|
|
232
|
+
return cached;
|
|
233
|
+
}
|
|
234
|
+
return page.props[propName];
|
|
235
|
+
},
|
|
236
|
+
set() {
|
|
237
|
+
throw new Error(`Lazy prop "${propName}" is read-only.`);
|
|
238
|
+
},
|
|
239
|
+
}));
|
|
240
|
+
|
|
241
|
+
const execute = () => loadProp(noopTrigger);
|
|
242
|
+
|
|
243
|
+
watch(
|
|
244
|
+
() => page.props[propName],
|
|
245
|
+
(newVal, oldVal) => {
|
|
246
|
+
if (isUnmounted) return;
|
|
247
|
+
// Persist shape changes into the cache…
|
|
248
|
+
if (isNotNil(newVal) && !isEqual(newVal, oldVal) && cache) {
|
|
249
|
+
cached = newVal;
|
|
250
|
+
}
|
|
251
|
+
// …reset state when a navigation clears the prop (uncached mode)…
|
|
252
|
+
if (isNil(newVal) && isNotNil(oldVal) && !cache) {
|
|
253
|
+
loaded.value = false;
|
|
254
|
+
loading.value = false;
|
|
255
|
+
error.value = null;
|
|
256
|
+
} else if (isNotNil(newVal) && isNil(oldVal)) {
|
|
257
|
+
// …and mark loaded when the value first arrives.
|
|
258
|
+
loaded.value = true;
|
|
259
|
+
loading.value = false;
|
|
260
|
+
error.value = null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
value,
|
|
267
|
+
loaded: readonly(loaded),
|
|
268
|
+
loading: readonly(loading),
|
|
269
|
+
error: readonly(error),
|
|
270
|
+
execute,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const noopTrigger = () => undefined;
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Gotchas:
|
|
278
|
+
|
|
279
|
+
- Inertia partial reloads only target **top-level** props — you cannot lazy
|
|
280
|
+
load `stats.revenue`, only `stats`.
|
|
281
|
+
- Filter navigations reset lazy props server-side; with `cache: true`
|
|
282
|
+
(default) the last value keeps rendering while the fresh one loads.
|
|
283
|
+
|
|
284
|
+
### useLazyPropGetter
|
|
285
|
+
|
|
286
|
+
Adapts a lazy prop into an **async getter** — exactly the items-provider
|
|
287
|
+
shape `BbSelect` / `BbSelectPopover` / `BbCheckboxGroup` accept. The prop
|
|
288
|
+
loads on first demand (e.g. when the select opens) instead of inflating the
|
|
289
|
+
initial page load.
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
// src/composables/useLazyPropGetter.ts
|
|
293
|
+
import {
|
|
294
|
+
useLazyProp,
|
|
295
|
+
type UseLazyPropOptions,
|
|
296
|
+
} from '@/composables/useLazyProp';
|
|
297
|
+
import { isNil } from '@/utils';
|
|
298
|
+
import type { Ref } from 'vue';
|
|
299
|
+
|
|
300
|
+
export function useLazyPropGetter<T, U = T>(
|
|
301
|
+
propName: string,
|
|
302
|
+
formatter?: (value: T) => U,
|
|
303
|
+
options?: UseLazyPropOptions
|
|
304
|
+
): {
|
|
305
|
+
getter: () => Promise<U>;
|
|
306
|
+
loaded: Readonly<Ref<boolean>>;
|
|
307
|
+
loading: Readonly<Ref<boolean>>;
|
|
308
|
+
} {
|
|
309
|
+
const { value, loaded, loading, execute } = useLazyProp<T>(
|
|
310
|
+
propName,
|
|
311
|
+
undefined,
|
|
312
|
+
options
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
const getter = async (): Promise<U> => {
|
|
316
|
+
if (!loaded.value) {
|
|
317
|
+
await execute();
|
|
318
|
+
}
|
|
319
|
+
if (isNil(value.value)) {
|
|
320
|
+
throw new Error(`Could not load lazy prop "${propName}"`);
|
|
321
|
+
}
|
|
322
|
+
if (isNil(formatter)) return value.value as unknown as U;
|
|
323
|
+
return formatter(value.value);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
return { getter, loaded, loading };
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
```vue
|
|
331
|
+
<!-- The controller shares `roles` as a lazy prop; the select loads it on open. -->
|
|
332
|
+
<script setup lang="ts">
|
|
333
|
+
const { getter: fetchRoles } = useLazyPropGetter<Role[]>('roles');
|
|
334
|
+
</script>
|
|
335
|
+
|
|
336
|
+
<template>
|
|
337
|
+
<BbSelect
|
|
338
|
+
v-model="role"
|
|
339
|
+
item-text="name"
|
|
340
|
+
item-value="id"
|
|
341
|
+
:items="fetchRoles"
|
|
342
|
+
label="Role"
|
|
343
|
+
/>
|
|
344
|
+
</template>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## URL state
|
|
350
|
+
|
|
351
|
+
In Inertia the URL is the only client state that survives a visit — filters,
|
|
352
|
+
page numbers and sort orders belong there, not in refs that reset on
|
|
353
|
+
navigation.
|
|
354
|
+
|
|
355
|
+
### useQuery
|
|
356
|
+
|
|
357
|
+
Parses the current page URL's query string into an object. Snapshot, not
|
|
358
|
+
reactive — used by the writers below.
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
// src/composables/useQuery.ts
|
|
362
|
+
import { usePage } from '@inertiajs/vue3';
|
|
363
|
+
import qs, { type StringifyOptions } from 'query-string';
|
|
364
|
+
|
|
365
|
+
export const useQuery = ({
|
|
366
|
+
arrayFormat = 'comma',
|
|
367
|
+
}: { arrayFormat?: StringifyOptions['arrayFormat'] } = {}): Record<
|
|
368
|
+
string,
|
|
369
|
+
unknown
|
|
370
|
+
> => {
|
|
371
|
+
const { url } = usePage();
|
|
372
|
+
const [, queryString] = url.split('?');
|
|
373
|
+
if (!queryString) return {};
|
|
374
|
+
return qs.parse(decodeURIComponent(queryString), {
|
|
375
|
+
arrayFormat,
|
|
376
|
+
decode: true,
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### useRouteQuery
|
|
382
|
+
|
|
383
|
+
A single query parameter as a **writable ref**. Reading tracks the current
|
|
384
|
+
URL; writing merges the parameter and performs a (replace) visit, so the
|
|
385
|
+
server re-renders with the new value. Writing the current value is a no-op —
|
|
386
|
+
safe to sync from server responses without visit loops.
|
|
387
|
+
|
|
388
|
+
```ts
|
|
389
|
+
// src/composables/useRouteQuery.ts
|
|
390
|
+
import { router, usePage } from '@inertiajs/vue3';
|
|
391
|
+
import qs from 'query-string';
|
|
392
|
+
import { computed, type WritableComputedRef } from 'vue';
|
|
393
|
+
|
|
394
|
+
type Options<T> = {
|
|
395
|
+
/** Parse the raw string (e.g. `Number`). Defaults to identity. */
|
|
396
|
+
transform?: (value: string) => T;
|
|
397
|
+
preserveScroll?: boolean;
|
|
398
|
+
preserveState?: boolean;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export function useRouteQuery<T = string>(
|
|
402
|
+
key: string,
|
|
403
|
+
defaultValue: string,
|
|
404
|
+
options: Options<T> = {}
|
|
405
|
+
): WritableComputedRef<T> {
|
|
406
|
+
const {
|
|
407
|
+
transform = (value) => value as unknown as T,
|
|
408
|
+
preserveScroll = true,
|
|
409
|
+
preserveState = true,
|
|
410
|
+
} = options;
|
|
411
|
+
const page = usePage();
|
|
412
|
+
|
|
413
|
+
const readRaw = (): string => {
|
|
414
|
+
const [, queryString = ''] = page.url.split('?');
|
|
415
|
+
const raw = qs.parse(queryString)[key];
|
|
416
|
+
const single = Array.isArray(raw) ? raw[0] : raw;
|
|
417
|
+
return single != null ? String(single) : defaultValue;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
return computed<T>({
|
|
421
|
+
get: () => transform(readRaw()),
|
|
422
|
+
set: (next) => {
|
|
423
|
+
const nextRaw = String(next);
|
|
424
|
+
if (nextRaw === readRaw()) return;
|
|
425
|
+
|
|
426
|
+
const [path, queryString = ''] = page.url.split('?');
|
|
427
|
+
const query = qs.parse(queryString);
|
|
428
|
+
if (nextRaw === defaultValue) {
|
|
429
|
+
delete query[key]; // keep URLs clean at the default
|
|
430
|
+
} else {
|
|
431
|
+
query[key] = nextRaw;
|
|
432
|
+
}
|
|
433
|
+
const stringified = qs.stringify(query);
|
|
434
|
+
router.visit(stringified ? `${path}?${stringified}` : path, {
|
|
435
|
+
preserveScroll,
|
|
436
|
+
preserveState,
|
|
437
|
+
replace: true,
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### useQueryObject
|
|
445
|
+
|
|
446
|
+
The **filter engine**: watch a filters object and mirror its non-empty
|
|
447
|
+
values into the query string with an Inertia visit per change. Keys it has
|
|
448
|
+
seen are cleaned up when they empty out; the `page` parameter resets on
|
|
449
|
+
every filter change so results are never hidden on an out-of-range page.
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
// src/composables/useQueryObject.ts
|
|
453
|
+
import { useQuery } from '@/composables/useQuery';
|
|
454
|
+
import { isEmpty, isNil } from '@/utils';
|
|
455
|
+
import { router, usePage } from '@inertiajs/vue3';
|
|
456
|
+
import qs, { type StringifyOptions } from 'query-string';
|
|
457
|
+
import { toValue, watch, type MaybeRefOrGetter } from 'vue';
|
|
458
|
+
|
|
459
|
+
type Options<T> = {
|
|
460
|
+
transform?: (value: Partial<T>) => Partial<T>;
|
|
461
|
+
/** Reset the `page` parameter on change. Default true. */
|
|
462
|
+
resetPage?: boolean;
|
|
463
|
+
/** Additional query keys removed whenever the object changes. */
|
|
464
|
+
resetKeys?: string[];
|
|
465
|
+
/** Inertia partial reload prop names (supports reactive getter). */
|
|
466
|
+
only?: MaybeRefOrGetter<string[]>;
|
|
467
|
+
/**
|
|
468
|
+
* When it resolves to `false` the watcher keeps tracking keys but skips
|
|
469
|
+
* the navigation — use it when another owner performs the visit during a
|
|
470
|
+
* programmatic transition, to avoid competing self-cancelling requests.
|
|
471
|
+
*/
|
|
472
|
+
shouldNavigate?: MaybeRefOrGetter<boolean>;
|
|
473
|
+
arrayFormat?: StringifyOptions['arrayFormat'];
|
|
474
|
+
preserveState?: boolean;
|
|
475
|
+
preserveScroll?: boolean;
|
|
476
|
+
replace?: boolean;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export function useQueryObject<T extends Record<string, unknown>>(
|
|
480
|
+
object: MaybeRefOrGetter<T>,
|
|
481
|
+
options: Options<T> = {}
|
|
482
|
+
): void {
|
|
483
|
+
const {
|
|
484
|
+
transform,
|
|
485
|
+
resetPage = true,
|
|
486
|
+
resetKeys = [],
|
|
487
|
+
preserveState = true,
|
|
488
|
+
preserveScroll = true,
|
|
489
|
+
replace = true,
|
|
490
|
+
only: onlyOption = [],
|
|
491
|
+
shouldNavigate = true,
|
|
492
|
+
arrayFormat = 'comma',
|
|
493
|
+
} = options;
|
|
494
|
+
|
|
495
|
+
const filterValidValues = (obj: T): Partial<T> => {
|
|
496
|
+
const filtered: Partial<T> = {};
|
|
497
|
+
Object.entries(obj).forEach(([key, val]) => {
|
|
498
|
+
if (!isNil(val) && val !== '') {
|
|
499
|
+
(filtered as Record<string, unknown>)[key] = val;
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
return filtered;
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/** Every key this composable has ever managed, for stable URL cleanup. */
|
|
506
|
+
const seenKeys = new Set<string>(Object.keys(toValue(object) ?? {}));
|
|
507
|
+
|
|
508
|
+
watch(
|
|
509
|
+
() => toValue(object),
|
|
510
|
+
(newObject) => {
|
|
511
|
+
if (!newObject) return;
|
|
512
|
+
|
|
513
|
+
Object.keys(newObject).forEach((key) => {
|
|
514
|
+
if (!seenKeys.has(key)) {
|
|
515
|
+
console.warn(
|
|
516
|
+
`[useQueryObject] Key "${key}" appeared after initialization. ` +
|
|
517
|
+
`Initialize the object with all possible keys for stable URL cleanup.`
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
seenKeys.add(key);
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
const validValues = filterValidValues(newObject);
|
|
524
|
+
const transformedValues = transform
|
|
525
|
+
? transform(validValues)
|
|
526
|
+
: validValues;
|
|
527
|
+
|
|
528
|
+
// Start from the existing query to preserve keys owned elsewhere.
|
|
529
|
+
const existingQuery = useQuery({ arrayFormat });
|
|
530
|
+
seenKeys.forEach((key) => delete existingQuery[key]);
|
|
531
|
+
if (resetPage) delete existingQuery.page;
|
|
532
|
+
resetKeys.forEach((key) => delete existingQuery[key]);
|
|
533
|
+
|
|
534
|
+
Object.entries(transformedValues).forEach(([key, val]) => {
|
|
535
|
+
if (!isEmpty(val)) existingQuery[key] = val;
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
const stringified = qs.stringify(existingQuery, { arrayFormat });
|
|
539
|
+
const newUrl = stringified
|
|
540
|
+
? [window.location.pathname, stringified].join('?')
|
|
541
|
+
: window.location.pathname;
|
|
542
|
+
|
|
543
|
+
if (newUrl === usePage().url) return;
|
|
544
|
+
if (!toValue(shouldNavigate)) return;
|
|
545
|
+
|
|
546
|
+
router.visit(newUrl, {
|
|
547
|
+
preserveState,
|
|
548
|
+
preserveScroll,
|
|
549
|
+
only: toValue(onlyOption),
|
|
550
|
+
replace,
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
{ deep: true, flush: 'sync' }
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
```ts
|
|
559
|
+
// A listing page's whole filter wiring:
|
|
560
|
+
const filters = reactive({ search: '', status: null as string | null });
|
|
561
|
+
useQueryObject(filters, { only: ['invoices'] });
|
|
562
|
+
// Bind BbTextInput / BbSelectPopover to `filters.*` — every change becomes a
|
|
563
|
+
// partial reload and the server re-renders the `invoices` prop.
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
## Shared page data (contexts)
|
|
569
|
+
|
|
570
|
+
These share **server data** across a page by string key — the Inertia
|
|
571
|
+
counterpart of the component-state context
|
|
572
|
+
[`useBbTableContext`](../composables/useBbTableContext.md). Rule of thumb:
|
|
573
|
+
`useBbTableContext` mirrors what the _table widget_ is doing (selection,
|
|
574
|
+
sort, highlight); these contexts own what the _server sent_ (items, meta)
|
|
575
|
+
and survive being read from any component on the page. First caller creates
|
|
576
|
+
the context, later callers join it — no provider component required.
|
|
577
|
+
|
|
578
|
+
### usePaginatedResponseContext
|
|
579
|
+
|
|
580
|
+
Wraps a Laravel paginated prop (`PaginatedResponse<T>`) into a shared
|
|
581
|
+
context: `items` (editable until next navigation), `totalItems`,
|
|
582
|
+
`totalPages`, and URL-backed `page` / `perPage` refs. On every successful
|
|
583
|
+
visit the context re-syncs from the fresh prop.
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
// src/composables/usePaginatedResponseContext.ts
|
|
587
|
+
import { useRouteQuery } from '@/composables/useRouteQuery';
|
|
588
|
+
import type { PaginatedResponse } from '@/types';
|
|
589
|
+
import { isNotNil } from '@/utils';
|
|
590
|
+
import { router, usePage } from '@inertiajs/vue3';
|
|
591
|
+
import { injectLocal, provideLocal } from '@vueuse/core';
|
|
592
|
+
import { computed, onScopeDispose, ref, type ComputedRef, type Ref } from 'vue';
|
|
593
|
+
|
|
594
|
+
export type PaginatedResponseContext<T> = {
|
|
595
|
+
totalItems: ComputedRef<number>;
|
|
596
|
+
perPage: Ref<number>;
|
|
597
|
+
page: Ref<number>;
|
|
598
|
+
totalPages: ComputedRef<number>;
|
|
599
|
+
/** Current page items. Writable for optimistic edits; resets on navigation. */
|
|
600
|
+
items: Ref<T[]>;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
const toContextKey = (key: string): string => `${key}:paginatedResponse`;
|
|
604
|
+
|
|
605
|
+
export const usePaginatedResponseContext = <T = object>(
|
|
606
|
+
dataKey: string
|
|
607
|
+
): PaginatedResponseContext<T> => {
|
|
608
|
+
const existing = injectLocal<PaginatedResponseContext<T> | null>(
|
|
609
|
+
toContextKey(dataKey),
|
|
610
|
+
null
|
|
611
|
+
);
|
|
612
|
+
if (isNotNil(existing)) return existing;
|
|
613
|
+
|
|
614
|
+
const paginated = computed(
|
|
615
|
+
() => usePage<{ [key: string]: PaginatedResponse<T> }>().props[dataKey]
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
const items = ref<T[]>(paginated.value.data ?? []) as Ref<T[]>;
|
|
619
|
+
const totalItems = computed(() => paginated.value.meta.total ?? 0);
|
|
620
|
+
const totalPages = computed(() => paginated.value.meta.last_page ?? 0);
|
|
621
|
+
|
|
622
|
+
const perPage = useRouteQuery(
|
|
623
|
+
'per_page',
|
|
624
|
+
`${paginated.value.meta.per_page ?? 10}`,
|
|
625
|
+
{
|
|
626
|
+
transform: Number,
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
const page = useRouteQuery(
|
|
630
|
+
'page',
|
|
631
|
+
`${paginated.value.meta.current_page ?? 1}`,
|
|
632
|
+
{
|
|
633
|
+
transform: Number,
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
|
|
637
|
+
const context: PaginatedResponseContext<T> = {
|
|
638
|
+
totalItems,
|
|
639
|
+
perPage,
|
|
640
|
+
page,
|
|
641
|
+
totalPages,
|
|
642
|
+
items,
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
// Re-sync from the fresh prop after every successful visit.
|
|
646
|
+
const unbind = router.on('success', (event) => {
|
|
647
|
+
const props = event.detail.page.props as {
|
|
648
|
+
[key: string]: PaginatedResponse<T> | undefined;
|
|
649
|
+
};
|
|
650
|
+
const data = props[dataKey];
|
|
651
|
+
if (!data) return;
|
|
652
|
+
items.value = data.data ?? [];
|
|
653
|
+
page.value = data.meta?.current_page ?? 1;
|
|
654
|
+
perPage.value = data.meta?.per_page ?? 10;
|
|
655
|
+
});
|
|
656
|
+
onScopeDispose(unbind);
|
|
657
|
+
|
|
658
|
+
provideLocal(toContextKey(dataKey), context);
|
|
659
|
+
|
|
660
|
+
return context;
|
|
661
|
+
};
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### useTableSelectionContext
|
|
665
|
+
|
|
666
|
+
Shared selection state by key, in server terms: `selected` and `unselected`
|
|
667
|
+
item lists plus the `all` flag ("select-all across pages" semantics — when
|
|
668
|
+
`all` is true, `selected` does **not** enumerate every row; the server
|
|
669
|
+
combines `all` + `unselected` instead). Bind these to `BbTable`'s
|
|
670
|
+
`v-model`, `v-model:unselected-items` and `v-model:select-all`.
|
|
671
|
+
|
|
672
|
+
```ts
|
|
673
|
+
// src/composables/useTableSelectionContext.ts
|
|
674
|
+
import { isNotNil } from '@/utils';
|
|
675
|
+
import { injectLocal, provideLocal } from '@vueuse/core';
|
|
676
|
+
import { ref, type Ref } from 'vue';
|
|
677
|
+
|
|
678
|
+
export type TableSelectionContext<U> = {
|
|
679
|
+
/** The select-all checkbox state. Does not enumerate items. */
|
|
680
|
+
all: Ref<boolean>;
|
|
681
|
+
/** Items manually selected. NOT the full list when `all` is true. */
|
|
682
|
+
selected: Ref<U[]>;
|
|
683
|
+
/** Items manually unselected while `all` is true. */
|
|
684
|
+
unselected: Ref<U[]>;
|
|
685
|
+
resetSelection: () => void;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
const toSelectionKey = (key: string): string => `${key}:selection`;
|
|
689
|
+
|
|
690
|
+
/** Bare selection state, no provide/inject — for callers that own sharing. */
|
|
691
|
+
export const createSelectionContext = <
|
|
692
|
+
U = unknown,
|
|
693
|
+
>(): TableSelectionContext<U> => {
|
|
694
|
+
const all = ref(false);
|
|
695
|
+
const selected = ref<U[]>([]) as Ref<U[]>;
|
|
696
|
+
const unselected = ref<U[]>([]) as Ref<U[]>;
|
|
697
|
+
|
|
698
|
+
const resetSelection = (): void => {
|
|
699
|
+
all.value = false;
|
|
700
|
+
selected.value = [];
|
|
701
|
+
unselected.value = [];
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
return { all, selected, unselected, resetSelection };
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
export const useTableSelectionContext = <U = unknown>(
|
|
708
|
+
key: string
|
|
709
|
+
): TableSelectionContext<U> => {
|
|
710
|
+
const selectionKey = toSelectionKey(key);
|
|
711
|
+
const existing = injectLocal<TableSelectionContext<U> | null>(
|
|
712
|
+
selectionKey,
|
|
713
|
+
null
|
|
714
|
+
);
|
|
715
|
+
if (isNotNil(existing)) return existing;
|
|
716
|
+
|
|
717
|
+
const context = createSelectionContext<U>();
|
|
718
|
+
provideLocal(selectionKey, context);
|
|
719
|
+
return context;
|
|
720
|
+
};
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
### useTableContext
|
|
724
|
+
|
|
725
|
+
The composition of the two above — one keyed context carrying a listing
|
|
726
|
+
page's whole server-data spine: items, pagination, and selection. This is
|
|
727
|
+
what the [Inertia CRUD listing recipe](../recipes/inertia/crud-listing-page.md)
|
|
728
|
+
builds on.
|
|
729
|
+
|
|
730
|
+
```ts
|
|
731
|
+
// src/composables/useTableContext.ts
|
|
732
|
+
import {
|
|
733
|
+
usePaginatedResponseContext,
|
|
734
|
+
type PaginatedResponseContext,
|
|
735
|
+
} from '@/composables/usePaginatedResponseContext';
|
|
736
|
+
import {
|
|
737
|
+
useTableSelectionContext,
|
|
738
|
+
type TableSelectionContext,
|
|
739
|
+
} from '@/composables/useTableSelectionContext';
|
|
740
|
+
import { isNotNil } from '@/utils';
|
|
741
|
+
import { injectLocal, provideLocal } from '@vueuse/core';
|
|
742
|
+
|
|
743
|
+
export type TableContext<T, U> = TableSelectionContext<U> &
|
|
744
|
+
PaginatedResponseContext<T>;
|
|
745
|
+
|
|
746
|
+
const toTableKey = (key: string): string => `${key}:table`;
|
|
747
|
+
|
|
748
|
+
export const useTableContext = <T = object, U = T>(
|
|
749
|
+
dataKey: string
|
|
750
|
+
): TableContext<T, U> => {
|
|
751
|
+
const existing = injectLocal<TableContext<T, U> | null>(
|
|
752
|
+
toTableKey(dataKey),
|
|
753
|
+
null
|
|
754
|
+
);
|
|
755
|
+
if (isNotNil(existing)) return existing;
|
|
756
|
+
|
|
757
|
+
const context: TableContext<T, U> = {
|
|
758
|
+
...useTableSelectionContext<U>(dataKey),
|
|
759
|
+
...usePaginatedResponseContext<T>(dataKey),
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
provideLocal(toTableKey(dataKey), context);
|
|
763
|
+
return context;
|
|
764
|
+
};
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
Gotchas:
|
|
768
|
+
|
|
769
|
+
- The key is a rendezvous string (use the page-prop name, e.g.
|
|
770
|
+
`'invoices'`). Like the library's table context, a typo doesn't error —
|
|
771
|
+
it silently creates a second, orphan context.
|
|
772
|
+
- Each composite context provides under a namespaced key
|
|
773
|
+
(`invoices:table`, `invoices:selection`, `invoices:paginatedResponse`),
|
|
774
|
+
so the pieces can also be joined individually.
|
|
775
|
+
|
|
776
|
+
---
|
|
777
|
+
|
|
778
|
+
## Forms and guards
|
|
779
|
+
|
|
780
|
+
### usePromiseForm
|
|
781
|
+
|
|
782
|
+
Inertia's `useForm` with **promise semantics**: `post/put/patch/remove`
|
|
783
|
+
resolve on success and reject on validation errors, so you can `await` a
|
|
784
|
+
submit, chain a toast, or hand the promise to a `BbButton` `@click` /
|
|
785
|
+
`useConfirm` `onClick` for automatic busy states. `form` is the underlying
|
|
786
|
+
Inertia form — `form.errors`, `form.isDirty`, `form.reset()` all work.
|
|
787
|
+
|
|
788
|
+
**Declare the draft shape as a `type` alias, not an `interface`.** The generic
|
|
789
|
+
is constrained to `Record<string, FormValue>` (what Inertia can serialize), and
|
|
790
|
+
TypeScript gives an implicit index signature to object _type aliases_ only — an
|
|
791
|
+
`interface` never satisfies that constraint, however form-encodable its fields
|
|
792
|
+
are. The same applies to any nested shape (a line-item row, say). It is a
|
|
793
|
+
TypeScript quirk, not a statement about your data.
|
|
794
|
+
|
|
795
|
+
```ts
|
|
796
|
+
// src/composables/usePromiseForm.ts
|
|
797
|
+
import { useLoading } from '@/composables/useLoading';
|
|
798
|
+
import {
|
|
799
|
+
useForm,
|
|
800
|
+
type InertiaForm,
|
|
801
|
+
type InertiaFormProps,
|
|
802
|
+
} from '@inertiajs/vue3';
|
|
803
|
+
|
|
804
|
+
type FormValue =
|
|
805
|
+
| string
|
|
806
|
+
| number
|
|
807
|
+
| boolean
|
|
808
|
+
| null
|
|
809
|
+
| File
|
|
810
|
+
| undefined
|
|
811
|
+
| FormValue[]
|
|
812
|
+
| { [key: string]: FormValue };
|
|
813
|
+
|
|
814
|
+
type Options = Parameters<InertiaFormProps<object>['get']>[1];
|
|
815
|
+
|
|
816
|
+
export const usePromiseForm = <T extends Record<string, FormValue>>(
|
|
817
|
+
initialData: T
|
|
818
|
+
) => {
|
|
819
|
+
// @ts-expect-error - typed as InertiaForm<T> to avoid fighting the type system
|
|
820
|
+
const form = useForm(initialData) as InertiaForm<T>;
|
|
821
|
+
|
|
822
|
+
const { fn: submit, loading: isSubmitting } = useLoading(
|
|
823
|
+
(
|
|
824
|
+
url: string,
|
|
825
|
+
method: 'get' | 'post' | 'put' | 'patch' | 'delete' = 'post',
|
|
826
|
+
options: Options = {}
|
|
827
|
+
): Promise<void> =>
|
|
828
|
+
new Promise<void>((resolve, reject) => {
|
|
829
|
+
const { onFinish: userOnFinish, ...visitOptions } = options;
|
|
830
|
+
|
|
831
|
+
form[method](url, {
|
|
832
|
+
...visitOptions,
|
|
833
|
+
onSuccess: () => resolve(),
|
|
834
|
+
onError: (errors: unknown) => reject(errors),
|
|
835
|
+
onFinish: (
|
|
836
|
+
...args: Parameters<NonNullable<NonNullable<Options>['onFinish']>>
|
|
837
|
+
) => {
|
|
838
|
+
userOnFinish?.(...args);
|
|
839
|
+
// A non-Inertia response (e.g. a 423 entity lock or a 419
|
|
840
|
+
// CSRF mismatch) fires neither onSuccess nor onError, only
|
|
841
|
+
// onFinish. Settle here so isSubmitting is released instead
|
|
842
|
+
// of hanging the form forever. No-op once already settled.
|
|
843
|
+
reject(new Error('Inertia visit did not return a valid response.'));
|
|
844
|
+
},
|
|
845
|
+
});
|
|
846
|
+
})
|
|
847
|
+
);
|
|
848
|
+
|
|
849
|
+
const post = (url: string, options?: Options) => submit(url, 'post', options);
|
|
850
|
+
const put = (url: string, options?: Options) => submit(url, 'put', options);
|
|
851
|
+
const patch = (url: string, options?: Options) =>
|
|
852
|
+
submit(url, 'patch', options);
|
|
853
|
+
const remove = (url: string, options?: Options) =>
|
|
854
|
+
submit(url, 'delete', options);
|
|
855
|
+
|
|
856
|
+
return { form, submit, post, put, patch, remove, isSubmitting };
|
|
857
|
+
};
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
### useHasChanged
|
|
861
|
+
|
|
862
|
+
Deep dirty-checking against a snapshot baseline — for edit screens whose
|
|
863
|
+
state is not a single Inertia form (multiple forms, ad-hoc refs). For a
|
|
864
|
+
single `usePromiseForm`, prefer the built-in `form.isDirty`.
|
|
865
|
+
|
|
866
|
+
```ts
|
|
867
|
+
// src/composables/useHasChanged.ts
|
|
868
|
+
import { isEqual } from '@/utils';
|
|
869
|
+
import { computed, ref, toValue, type WatchSource } from 'vue';
|
|
870
|
+
|
|
871
|
+
export function useHasChanged<T extends WatchSource<unknown>[]>(
|
|
872
|
+
dependencies: T
|
|
873
|
+
) {
|
|
874
|
+
// Deep-copied baselines avoid reference entanglement with live state.
|
|
875
|
+
const baselineValues = ref<unknown[]>(
|
|
876
|
+
dependencies.map((dep) => structuredClone(toValue(dep)))
|
|
877
|
+
);
|
|
878
|
+
|
|
879
|
+
/** Re-baseline (call after a successful save). */
|
|
880
|
+
const takeSnapshot = (): void => {
|
|
881
|
+
baselineValues.value = dependencies.map((dep) =>
|
|
882
|
+
structuredClone(toValue(dep))
|
|
883
|
+
);
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
const hasChanged = computed(() =>
|
|
887
|
+
dependencies.some(
|
|
888
|
+
(dep, index) =>
|
|
889
|
+
!isEqual(structuredClone(toValue(dep)), baselineValues.value[index])
|
|
890
|
+
)
|
|
891
|
+
);
|
|
892
|
+
|
|
893
|
+
return { hasChanged, takeSnapshot };
|
|
894
|
+
}
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
### useConfirmOnRouteLeave
|
|
898
|
+
|
|
899
|
+
A dirty-state navigation guard: intercepts Inertia visits and asks through
|
|
900
|
+
[`useConfirm`](../composables/useConfirm.md) before leaving. Requires
|
|
901
|
+
`<BbConfirm />` mounted in the app root. Server redirects after a
|
|
902
|
+
whitelisted action carry the `X-Whitelisted-Action` header so a saving
|
|
903
|
+
visit's redirect is never blocked by its own guard.
|
|
904
|
+
|
|
905
|
+
```ts
|
|
906
|
+
// src/composables/useConfirmOnRouteLeave.ts
|
|
907
|
+
import { router } from '@inertiajs/vue3';
|
|
908
|
+
import { useConfirm } from 'bitboss-ui';
|
|
909
|
+
import { onUnmounted, toValue, type MaybeRefOrGetter } from 'vue';
|
|
910
|
+
|
|
911
|
+
type Visit = {
|
|
912
|
+
url: URL;
|
|
913
|
+
headers?: Record<string, string>;
|
|
914
|
+
[key: string]: unknown;
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
type Options = {
|
|
918
|
+
/** URLs that bypass the dialog (e.g. the form's own submit target). */
|
|
919
|
+
whitelist?: MaybeRefOrGetter<string[]>;
|
|
920
|
+
/** Disable the guard (bind to `!hasChanged` / `!form.isDirty`). */
|
|
921
|
+
disabled?: MaybeRefOrGetter<boolean>;
|
|
922
|
+
/** Runs synchronously before the dialog; return false to allow the visit. */
|
|
923
|
+
onBefore?: (visit: Visit) => unknown;
|
|
924
|
+
/** Runs after the user confirms leaving. */
|
|
925
|
+
onLeave?: (visit: Visit) => unknown;
|
|
926
|
+
title?: string;
|
|
927
|
+
text?: string;
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
const normalizeUrl = (value: string | URL) => {
|
|
931
|
+
const url = new URL(value.toString(), window.location.origin);
|
|
932
|
+
return url.pathname.replace(/\/+$/, '') || '/';
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
const getHeaderValue = (
|
|
936
|
+
headers: Record<string, string> | undefined,
|
|
937
|
+
headerName: string
|
|
938
|
+
) => {
|
|
939
|
+
if (!headers) return undefined;
|
|
940
|
+
const normalized = headerName.toLowerCase();
|
|
941
|
+
const matched = Object.keys(headers).find(
|
|
942
|
+
(key) => key.toLowerCase() === normalized
|
|
943
|
+
);
|
|
944
|
+
return matched ? headers[matched] : undefined;
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
export const WHITELIST_HEADER = 'X-Whitelisted-Action';
|
|
948
|
+
|
|
949
|
+
export const useConfirmOnRouteLeave = ({
|
|
950
|
+
whitelist = [],
|
|
951
|
+
disabled = false,
|
|
952
|
+
onBefore = () => true,
|
|
953
|
+
onLeave = () => true,
|
|
954
|
+
title = 'Unsaved changes',
|
|
955
|
+
text = 'You have unsaved changes. Leave without saving?',
|
|
956
|
+
}: Options = {}) => {
|
|
957
|
+
// Captured in setup so the built-in dialog is owned by the guarded page:
|
|
958
|
+
// if the page unmounts anyway, the dialog dismisses itself quietly.
|
|
959
|
+
const { confirm } = useConfirm();
|
|
960
|
+
let bypassNextVisit = false;
|
|
961
|
+
|
|
962
|
+
const unbind = router.on('before', (event) => {
|
|
963
|
+
const visit = event.detail.visit as Visit;
|
|
964
|
+
|
|
965
|
+
if (bypassNextVisit) {
|
|
966
|
+
bypassNextVisit = false;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if (toValue(disabled)) return;
|
|
971
|
+
if (getHeaderValue(visit.headers, WHITELIST_HEADER) === '1') return;
|
|
972
|
+
|
|
973
|
+
const nextPath = normalizeUrl(visit.url.href);
|
|
974
|
+
if (nextPath === normalizeUrl(window.location.href)) return;
|
|
975
|
+
if (toValue(whitelist).map(normalizeUrl).includes(nextPath)) return;
|
|
976
|
+
|
|
977
|
+
if (onBefore(visit) === false) return false;
|
|
978
|
+
event.preventDefault();
|
|
979
|
+
|
|
980
|
+
void (async () => {
|
|
981
|
+
const confirmed = await confirm({
|
|
982
|
+
variant: 'destructive',
|
|
983
|
+
title,
|
|
984
|
+
text,
|
|
985
|
+
yes: 'Discard changes',
|
|
986
|
+
no: 'Keep editing',
|
|
987
|
+
});
|
|
988
|
+
if (!confirmed) return;
|
|
989
|
+
|
|
990
|
+
await onLeave(visit);
|
|
991
|
+
bypassNextVisit = true;
|
|
992
|
+
router.visit(visit.url, {
|
|
993
|
+
...(visit as Parameters<typeof router.visit>[1]),
|
|
994
|
+
headers: { ...(visit.headers ?? {}), [WHITELIST_HEADER]: '1' },
|
|
995
|
+
});
|
|
996
|
+
})();
|
|
997
|
+
});
|
|
998
|
+
|
|
999
|
+
onUnmounted(unbind);
|
|
1000
|
+
};
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
---
|
|
1004
|
+
|
|
1005
|
+
## Async utilities
|
|
1006
|
+
|
|
1007
|
+
### useLoading
|
|
1008
|
+
|
|
1009
|
+
Wraps any async function with a concurrent-safe `loading` flag (a counter,
|
|
1010
|
+
so overlapping calls don't flicker it off early).
|
|
1011
|
+
|
|
1012
|
+
```ts
|
|
1013
|
+
// src/composables/useLoading.ts
|
|
1014
|
+
import { computed, ref } from 'vue';
|
|
1015
|
+
|
|
1016
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1017
|
+
export const useLoading = <T extends (...args: any[]) => any>(fn: T) => {
|
|
1018
|
+
const counter = ref(0);
|
|
1019
|
+
const loading = computed(() => counter.value > 0);
|
|
1020
|
+
|
|
1021
|
+
const fnWithLoading = async (...args: Parameters<T>) => {
|
|
1022
|
+
counter.value++;
|
|
1023
|
+
try {
|
|
1024
|
+
return await fn(...args);
|
|
1025
|
+
} finally {
|
|
1026
|
+
counter.value--;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
return { loading, fn: fnWithLoading };
|
|
1031
|
+
};
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
### useAsyncFn
|
|
1035
|
+
|
|
1036
|
+
A full async-state engine for **non-Inertia** requests (JSON endpoints,
|
|
1037
|
+
exports): `data` / `error` / `loading` / `aborted` state, an `AbortSignal`
|
|
1038
|
+
per run, auto-abort of the previous run on re-execute, and abort on
|
|
1039
|
+
unmount.
|
|
1040
|
+
|
|
1041
|
+
```ts
|
|
1042
|
+
// src/composables/useAsyncFn.ts
|
|
1043
|
+
import { isPlainObject } from '@/utils';
|
|
1044
|
+
import {
|
|
1045
|
+
onBeforeMount,
|
|
1046
|
+
onBeforeUnmount,
|
|
1047
|
+
shallowRef,
|
|
1048
|
+
type ShallowRef,
|
|
1049
|
+
} from 'vue';
|
|
1050
|
+
|
|
1051
|
+
type BaseOptions = {
|
|
1052
|
+
/** Run on mount. Default true. */
|
|
1053
|
+
immediate?: boolean;
|
|
1054
|
+
/** Swallow AbortError instead of exposing it on `error`. Default true. */
|
|
1055
|
+
abortSilently?: boolean;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
type AsyncFnParams = {
|
|
1059
|
+
setError: (err: string) => void;
|
|
1060
|
+
setErrorData: (err: Record<string, unknown>) => void;
|
|
1061
|
+
signal: AbortSignal;
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
type AsyncFnReturn<D> = {
|
|
1065
|
+
data: ShallowRef<D>;
|
|
1066
|
+
error: ShallowRef<Error | null>;
|
|
1067
|
+
errorData: ShallowRef<Record<string, unknown> | null>;
|
|
1068
|
+
loading: ShallowRef<boolean>;
|
|
1069
|
+
aborted: ShallowRef<boolean>;
|
|
1070
|
+
execute: () => Promise<D>;
|
|
1071
|
+
stop: () => void;
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
type AsyncFn<T> = (params: AsyncFnParams) => Promise<T> | T;
|
|
1075
|
+
|
|
1076
|
+
export function useAsyncFn<T>(
|
|
1077
|
+
fn: AsyncFn<T>,
|
|
1078
|
+
options: BaseOptions & { defaultValue: T }
|
|
1079
|
+
): AsyncFnReturn<T>;
|
|
1080
|
+
export function useAsyncFn<T>(
|
|
1081
|
+
fn: AsyncFn<T>,
|
|
1082
|
+
options?: BaseOptions & { defaultValue?: undefined }
|
|
1083
|
+
): AsyncFnReturn<T | null>;
|
|
1084
|
+
export function useAsyncFn<T>(
|
|
1085
|
+
fn: AsyncFn<T>,
|
|
1086
|
+
{
|
|
1087
|
+
immediate = true,
|
|
1088
|
+
abortSilently = true,
|
|
1089
|
+
defaultValue,
|
|
1090
|
+
}: BaseOptions & { defaultValue?: T } = {}
|
|
1091
|
+
) {
|
|
1092
|
+
const data = shallowRef(defaultValue ?? null);
|
|
1093
|
+
const error = shallowRef<Error | null>(null);
|
|
1094
|
+
const errorData = shallowRef<Record<string, unknown> | null>(null);
|
|
1095
|
+
const loading = shallowRef(false);
|
|
1096
|
+
const aborted = shallowRef(false);
|
|
1097
|
+
let abortController: AbortController | null = null;
|
|
1098
|
+
|
|
1099
|
+
const setError = (err: string) => {
|
|
1100
|
+
error.value = new Error(err);
|
|
1101
|
+
};
|
|
1102
|
+
const setErrorData = (err: Record<string, unknown>) => {
|
|
1103
|
+
errorData.value = err;
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
const isAbortError = (err: unknown): boolean =>
|
|
1107
|
+
err instanceof DOMException && err.name === 'AbortError';
|
|
1108
|
+
|
|
1109
|
+
const execute = async () => {
|
|
1110
|
+
abortController?.abort();
|
|
1111
|
+
abortController = new AbortController();
|
|
1112
|
+
loading.value = true;
|
|
1113
|
+
aborted.value = false;
|
|
1114
|
+
error.value = null;
|
|
1115
|
+
errorData.value = null;
|
|
1116
|
+
|
|
1117
|
+
try {
|
|
1118
|
+
data.value = await fn({
|
|
1119
|
+
setError,
|
|
1120
|
+
setErrorData,
|
|
1121
|
+
signal: abortController.signal,
|
|
1122
|
+
});
|
|
1123
|
+
} catch (err) {
|
|
1124
|
+
if (isAbortError(err)) {
|
|
1125
|
+
aborted.value = true;
|
|
1126
|
+
if (!abortSilently) error.value = err as Error;
|
|
1127
|
+
} else if (err instanceof Error) {
|
|
1128
|
+
error.value = err;
|
|
1129
|
+
} else if (typeof err === 'string') {
|
|
1130
|
+
error.value = new Error(err);
|
|
1131
|
+
} else if (isPlainObject(err)) {
|
|
1132
|
+
// Laravel validation bag: surface the first message.
|
|
1133
|
+
const firstKey = Object.keys(err)[0];
|
|
1134
|
+
error.value = new Error(String(err[firstKey]));
|
|
1135
|
+
}
|
|
1136
|
+
} finally {
|
|
1137
|
+
loading.value = false;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
return data.value;
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
if (immediate) onBeforeMount(execute);
|
|
1144
|
+
|
|
1145
|
+
const stop = () => {
|
|
1146
|
+
abortController?.abort();
|
|
1147
|
+
abortController = null;
|
|
1148
|
+
};
|
|
1149
|
+
onBeforeUnmount(stop);
|
|
1150
|
+
|
|
1151
|
+
return { data, error, errorData, loading, aborted, execute, stop };
|
|
1152
|
+
}
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
### useResourceContext
|
|
1156
|
+
|
|
1157
|
+
"Given an id, keep its resource loaded": re-fetches whenever the id
|
|
1158
|
+
changes, resets to `null` when the id clears, exposes `loading` and
|
|
1159
|
+
`refresh()`. The natural engine for a detail sidebar or peek panel — feed
|
|
1160
|
+
it the highlighted row's id.
|
|
1161
|
+
|
|
1162
|
+
```ts
|
|
1163
|
+
// src/composables/useResourceContext.ts
|
|
1164
|
+
import { useLoading } from '@/composables/useLoading';
|
|
1165
|
+
import { noop } from '@/utils';
|
|
1166
|
+
import { ref, toValue, watch, type MaybeRefOrGetter, type Ref } from 'vue';
|
|
1167
|
+
|
|
1168
|
+
type UseResourceContextOptions<T, ID> = {
|
|
1169
|
+
immediate?: boolean;
|
|
1170
|
+
disabled?: MaybeRefOrGetter<boolean>;
|
|
1171
|
+
onReset?: () => void | Promise<void>;
|
|
1172
|
+
onSuccess?: (data: T, resourceId: ID) => void | Promise<void>;
|
|
1173
|
+
onError?: (error: unknown, resourceId: ID) => void | Promise<void>;
|
|
1174
|
+
onFinish?: (resourceId: ID) => void | Promise<void>;
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
export function useResourceContext<T, ID = string>(
|
|
1178
|
+
id: MaybeRefOrGetter<ID | null | undefined>,
|
|
1179
|
+
fn: (id: ID) => Promise<T>,
|
|
1180
|
+
options: UseResourceContextOptions<T, ID> = {}
|
|
1181
|
+
) {
|
|
1182
|
+
const data = ref<T | null>(null) as Ref<T | null>;
|
|
1183
|
+
const {
|
|
1184
|
+
immediate = true,
|
|
1185
|
+
disabled = false,
|
|
1186
|
+
onSuccess = noop,
|
|
1187
|
+
onError = (error: unknown) => {
|
|
1188
|
+
console.error('Failed to fetch resource:', error);
|
|
1189
|
+
},
|
|
1190
|
+
onReset = noop,
|
|
1191
|
+
onFinish = noop,
|
|
1192
|
+
} = options;
|
|
1193
|
+
|
|
1194
|
+
const { loading, fn: fetch } = useLoading((resourceId: ID) => fn(resourceId));
|
|
1195
|
+
|
|
1196
|
+
const load = async (resourceId: ID) => {
|
|
1197
|
+
try {
|
|
1198
|
+
const result = await fetch(resourceId);
|
|
1199
|
+
data.value = result;
|
|
1200
|
+
await onSuccess(result, resourceId);
|
|
1201
|
+
} catch (error) {
|
|
1202
|
+
data.value = null;
|
|
1203
|
+
await onError(error, resourceId);
|
|
1204
|
+
} finally {
|
|
1205
|
+
await onFinish(resourceId);
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
watch(
|
|
1210
|
+
() => ({ resourceId: toValue(id), isDisabled: toValue(disabled) }),
|
|
1211
|
+
async ({ resourceId, isDisabled }) => {
|
|
1212
|
+
if (!resourceId) {
|
|
1213
|
+
data.value = null;
|
|
1214
|
+
await onReset();
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
// Keep already-loaded data while disabled.
|
|
1218
|
+
if (isDisabled) return;
|
|
1219
|
+
await load(resourceId as ID);
|
|
1220
|
+
},
|
|
1221
|
+
{ immediate }
|
|
1222
|
+
);
|
|
1223
|
+
|
|
1224
|
+
const refresh = async () => {
|
|
1225
|
+
const currentId = toValue(id);
|
|
1226
|
+
if (toValue(disabled) || !currentId) return;
|
|
1227
|
+
await load(currentId as ID);
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
return { data, loading, refresh };
|
|
1231
|
+
}
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
---
|
|
1235
|
+
|
|
1236
|
+
## UI utilities
|
|
1237
|
+
|
|
1238
|
+
### useDeleteCmd
|
|
1239
|
+
|
|
1240
|
+
Fires a callback on Delete/Backspace — unless an input, textarea, select or
|
|
1241
|
+
contenteditable is focused. Pairs with table selection: select rows, hit
|
|
1242
|
+
Delete, dispatch the same confirm-guarded bulk action as the button.
|
|
1243
|
+
|
|
1244
|
+
```ts
|
|
1245
|
+
// src/composables/useDeleteCmd.ts
|
|
1246
|
+
import { useMagicKeys, whenever } from '@vueuse/core';
|
|
1247
|
+
import { toValue, type MaybeRefOrGetter } from 'vue';
|
|
1248
|
+
|
|
1249
|
+
export type UseDeleteCmdOptions = {
|
|
1250
|
+
disabled?: MaybeRefOrGetter<boolean>;
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
const isInteractiveElementFocused = (): boolean => {
|
|
1254
|
+
const active = document.activeElement;
|
|
1255
|
+
if (!active) return false;
|
|
1256
|
+
const tag = active.tagName.toLowerCase();
|
|
1257
|
+
if (tag === 'input' || tag === 'textarea' || tag === 'select') return true;
|
|
1258
|
+
return active.getAttribute('contenteditable') === 'true';
|
|
1259
|
+
};
|
|
1260
|
+
|
|
1261
|
+
export function useDeleteCmd(
|
|
1262
|
+
onDelete: () => void,
|
|
1263
|
+
options: UseDeleteCmdOptions = {}
|
|
1264
|
+
) {
|
|
1265
|
+
const keys = useMagicKeys();
|
|
1266
|
+
|
|
1267
|
+
const handleDelete = () => {
|
|
1268
|
+
if (isInteractiveElementFocused()) return;
|
|
1269
|
+
if (!toValue(options.disabled)) onDelete();
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
whenever(keys['delete'], handleDelete);
|
|
1273
|
+
whenever(keys['backspace'], handleDelete);
|
|
1274
|
+
}
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
### useScreenSizes
|
|
1278
|
+
|
|
1279
|
+
Shared reactive breakpoints aligned with Tailwind `md`/`lg` — one window
|
|
1280
|
+
listener for the whole app via `createSharedComposable`.
|
|
1281
|
+
|
|
1282
|
+
```ts
|
|
1283
|
+
// src/composables/useScreenSizes.ts
|
|
1284
|
+
import { useWindowSize } from '@vueuse/core';
|
|
1285
|
+
import { createSharedComposable } from '@vueuse/shared';
|
|
1286
|
+
import { computed } from 'vue';
|
|
1287
|
+
|
|
1288
|
+
/** Tailwind md breakpoint (px). Mobile when width < 768. */
|
|
1289
|
+
export const SCREEN_BREAKPOINT_MD = 768;
|
|
1290
|
+
/** Tailwind lg breakpoint (px). Tablet when 768 <= width < 1024. */
|
|
1291
|
+
export const SCREEN_BREAKPOINT_LG = 1024;
|
|
1292
|
+
|
|
1293
|
+
const useScreenSizesImpl = () => {
|
|
1294
|
+
const { width } = useWindowSize();
|
|
1295
|
+
|
|
1296
|
+
const isMobile = computed(() => width.value < SCREEN_BREAKPOINT_MD);
|
|
1297
|
+
const isTablet = computed(
|
|
1298
|
+
() =>
|
|
1299
|
+
width.value >= SCREEN_BREAKPOINT_MD && width.value < SCREEN_BREAKPOINT_LG
|
|
1300
|
+
);
|
|
1301
|
+
const isDesktop = computed(() => width.value >= SCREEN_BREAKPOINT_LG);
|
|
1302
|
+
|
|
1303
|
+
return { width, isMobile, isTablet, isDesktop };
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
export const useScreenSizes = createSharedComposable(useScreenSizesImpl);
|
|
1307
|
+
```
|
|
1308
|
+
|
|
1309
|
+
### useIndexById
|
|
1310
|
+
|
|
1311
|
+
Index an item list by key for O(1) lookups — e.g. mapping the ids in a
|
|
1312
|
+
selection context back to full rows for a bulk-action payload.
|
|
1313
|
+
|
|
1314
|
+
```ts
|
|
1315
|
+
// src/composables/useIndexById.ts
|
|
1316
|
+
import { computed, unref, type MaybeRef } from 'vue';
|
|
1317
|
+
|
|
1318
|
+
type Options<TItem> = {
|
|
1319
|
+
items: MaybeRef<readonly TItem[]>;
|
|
1320
|
+
/** The item property holding the id (e.g. 'id'). */
|
|
1321
|
+
key: keyof TItem & string;
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
export const useIndexById = <TItem>({ items, key }: Options<TItem>) => {
|
|
1325
|
+
const data = computed<Record<string, TItem>>(() => {
|
|
1326
|
+
const map: Record<string, TItem> = {};
|
|
1327
|
+
for (const item of unref(items)) {
|
|
1328
|
+
map[String(item[key])] = item;
|
|
1329
|
+
}
|
|
1330
|
+
return map;
|
|
1331
|
+
});
|
|
1332
|
+
|
|
1333
|
+
const get = (id: string | number): TItem | undefined =>
|
|
1334
|
+
data.value[String(id)];
|
|
1335
|
+
|
|
1336
|
+
return { data, get };
|
|
1337
|
+
};
|
|
1338
|
+
```
|
|
1339
|
+
|
|
1340
|
+
### useUntil
|
|
1341
|
+
|
|
1342
|
+
A ref that flips once, the first time a condition becomes true, then stops
|
|
1343
|
+
watching — for one-shot reveals ("has ever loaded", onboarding hints).
|
|
1344
|
+
|
|
1345
|
+
```ts
|
|
1346
|
+
// src/composables/useUntil.ts
|
|
1347
|
+
import { noop } from '@/utils';
|
|
1348
|
+
import { ref, toValue, watch, type MaybeRefOrGetter } from 'vue';
|
|
1349
|
+
|
|
1350
|
+
type Options<T, U> = {
|
|
1351
|
+
initialValue?: T;
|
|
1352
|
+
nextValue?: U;
|
|
1353
|
+
onChange?: VoidFunction;
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
export const useUntil = <T = boolean, U = boolean>(
|
|
1357
|
+
condition: MaybeRefOrGetter<boolean>,
|
|
1358
|
+
{
|
|
1359
|
+
initialValue = false as T,
|
|
1360
|
+
nextValue = true as U,
|
|
1361
|
+
onChange = noop,
|
|
1362
|
+
}: Options<T, U> = {}
|
|
1363
|
+
) => {
|
|
1364
|
+
const value = ref<T | U>(initialValue);
|
|
1365
|
+
|
|
1366
|
+
const stopWatching = watch(
|
|
1367
|
+
() => toValue(condition),
|
|
1368
|
+
(met) => {
|
|
1369
|
+
if (met) {
|
|
1370
|
+
onChange();
|
|
1371
|
+
value.value = nextValue;
|
|
1372
|
+
stopWatching();
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
);
|
|
1376
|
+
|
|
1377
|
+
return value;
|
|
1378
|
+
};
|
|
1379
|
+
```
|
|
1380
|
+
|
|
1381
|
+
---
|
|
1382
|
+
|
|
1383
|
+
## Related
|
|
1384
|
+
|
|
1385
|
+
- [Recipe: CRUD Listing Page (Inertia)](../recipes/inertia/crud-listing-page.md) —
|
|
1386
|
+
these helpers assembled into a full page.
|
|
1387
|
+
- [Recipe: Record Form (Inertia)](../recipes/inertia/record-form.md) —
|
|
1388
|
+
`usePromiseForm` + `useConfirmOnRouteLeave` in practice.
|
|
1389
|
+
- [Page Shell](./page-shell.md) and
|
|
1390
|
+
[Floating Bottom Panel](./floating-bottom-panel.md) — the app-side layout
|
|
1391
|
+
components these pages sit in.
|
|
1392
|
+
- [useBbTableContext](../composables/useBbTableContext.md) — the library's
|
|
1393
|
+
by-id context for table _widget_ state; complements, not replaces, the
|
|
1394
|
+
keyed data contexts here.
|