bitboss-ui 3.0.0-beta.71 → 3.0.0-beta.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/README.md +2 -2
  2. package/bin/cli.mjs +6 -1
  3. package/dist/ai/BbAccordion.md +38 -19
  4. package/dist/ai/BbBadge.md +25 -22
  5. package/dist/ai/BbBreadcrumbs.md +1 -1
  6. package/dist/ai/BbButton.md +32 -27
  7. package/dist/ai/BbCalendar.md +1 -0
  8. package/dist/ai/BbCarousel.md +6 -4
  9. package/dist/ai/BbCheckboxGroup.md +2 -1
  10. package/dist/ai/BbColorInput.md +1 -1
  11. package/dist/ai/BbConfirm.md +65 -81
  12. package/dist/ai/BbConfirmPortal.md +2 -2
  13. package/dist/ai/BbDatePicker.md +1 -6
  14. package/dist/ai/BbDatePickerInput.md +2 -2
  15. package/dist/ai/BbDialog.md +230 -164
  16. package/dist/ai/BbDropdown.md +52 -16
  17. package/dist/ai/BbDropdownButton.md +11 -12
  18. package/dist/ai/BbDropzone.md +12 -8
  19. package/dist/ai/BbForm.md +93 -7
  20. package/dist/ai/BbHost.md +2 -2
  21. package/dist/ai/BbHoverCardPortal.md +1 -1
  22. package/dist/ai/BbIcon.md +1 -1
  23. package/dist/ai/BbIndicator.md +17 -15
  24. package/dist/ai/BbNumberInput.md +7 -5
  25. package/dist/ai/BbOffCanvas.md +29 -7
  26. package/dist/ai/BbPagination.md +2 -2
  27. package/dist/ai/BbPopover.md +15 -9
  28. package/dist/ai/BbPopoverPortal.md +1 -1
  29. package/dist/ai/BbRadioGroup.md +29 -7
  30. package/dist/ai/BbRating.md +8 -7
  31. package/dist/ai/BbSelect.md +29 -8
  32. package/dist/ai/BbSelectPopover.md +9 -3
  33. package/dist/ai/BbSlider.md +12 -8
  34. package/dist/ai/BbSpinner.md +3 -2
  35. package/dist/ai/BbSwitch.md +3 -3
  36. package/dist/ai/BbSwitchGroup.md +7 -6
  37. package/dist/ai/BbTable.md +205 -82
  38. package/dist/ai/BbTabs.md +29 -4
  39. package/dist/ai/BbTag.md +1 -1
  40. package/dist/ai/BbTextInput.md +7 -5
  41. package/dist/ai/BbTextarea.md +4 -3
  42. package/dist/ai/BbTimePickerInput.md +1 -1
  43. package/dist/ai/BbToast.md +3 -2
  44. package/dist/ai/BbTooltip.md +22 -17
  45. package/dist/ai/BbTree.md +49 -24
  46. package/dist/ai/CommonFieldInput.md +1 -1
  47. package/dist/ai/changelog.json +238 -9
  48. package/dist/ai/components.json +52 -51
  49. package/dist/ai/composables/useBbDialog.md +5 -8
  50. package/dist/ai/composables/useBbForm.md +3 -0
  51. package/dist/ai/composables/useConfirm.md +65 -56
  52. package/dist/ai/composables/useToast.md +2 -1
  53. package/dist/ai/guides/agent-contract.md +3 -3
  54. package/dist/ai/guides/app-layout.md +3 -2
  55. package/dist/ai/guides/eslint-rules.md +3 -1
  56. package/dist/ai/guides/fetch-items-playbook.md +1 -1
  57. package/dist/ai/guides/floating-bottom-panel.md +3 -2
  58. package/dist/ai/guides/icons-policy.md +7 -5
  59. package/dist/ai/guides/inertia-helpers.md +35 -30
  60. package/dist/ai/guides/installation-and-plugin-setup.md +17 -14
  61. package/dist/ai/guides/migration/adoption-checklist.md +2 -2
  62. package/dist/ai/guides/migration/components/bb-badge.md +12 -1
  63. package/dist/ai/guides/migration/components/bb-button.md +24 -0
  64. package/dist/ai/guides/migration/components/bb-dropdown-button.md +11 -0
  65. package/dist/ai/guides/migration/components/bb-tabs.md +2 -2
  66. package/dist/ai/guides/migration/components/bb-toast.md +11 -0
  67. package/dist/ai/guides/migration/components/use-confirm.md +69 -26
  68. package/dist/ai/guides/migration/v2-to-v3.md +52 -10
  69. package/dist/ai/guides/migration/v3-beta-css-classes.md +1 -1
  70. package/dist/ai/guides/options-items-playbook.md +4 -3
  71. package/dist/ai/guides/passthrough.md +2 -2
  72. package/dist/ai/helpers/inertia/manifest.json +28 -15
  73. package/dist/ai/helpers/inertia/messages.ts +3 -3
  74. package/dist/ai/helpers/inertia/useConfirmOnRouteLeave.ts +10 -10
  75. package/dist/ai/helpers/inertia/usePromiseForm.ts +1 -1
  76. package/dist/ai/helpers/inertia/usePromiseRouter.ts +7 -2
  77. package/dist/ai/index.md +3 -3
  78. package/dist/ai/manifest/common.json +3 -3
  79. package/dist/ai/manifest/components/BbAccordion.json +8 -5
  80. package/dist/ai/manifest/components/BbAccordion.tree.json +1 -0
  81. package/dist/ai/manifest/components/BbBadge.json +8 -7
  82. package/dist/ai/manifest/components/BbBadge.removed.json +3 -1
  83. package/dist/ai/manifest/components/BbBadge.tree.json +73 -0
  84. package/dist/ai/manifest/components/BbBreadcrumbs.json +1 -1
  85. package/dist/ai/manifest/components/BbButton.json +5 -6
  86. package/dist/ai/manifest/components/BbButton.removed.json +3 -1
  87. package/dist/ai/manifest/components/BbButton.tree.json +24 -7
  88. package/dist/ai/manifest/components/BbCalendar.json +2 -1
  89. package/dist/ai/manifest/components/BbCheckboxGroup.json +2 -2
  90. package/dist/ai/manifest/components/BbColorInput.json +1 -1
  91. package/dist/ai/manifest/components/BbColorInput.tree.json +1 -1
  92. package/dist/ai/manifest/components/BbConfirm.json +2 -2
  93. package/dist/ai/manifest/components/BbConfirm.removed.json +9 -0
  94. package/dist/ai/manifest/components/BbConfirm.tree.json +4 -5
  95. package/dist/ai/manifest/components/BbConfirmPortal.json +3 -3
  96. package/dist/ai/manifest/components/BbConfirmPortal.removed.json +7 -0
  97. package/dist/ai/manifest/components/BbDatePicker.json +2 -1
  98. package/dist/ai/manifest/components/BbDatePicker.tree.json +0 -6
  99. package/dist/ai/manifest/components/BbDatePickerInput.json +2 -2
  100. package/dist/ai/manifest/components/BbDatePickerInput.tree.json +1 -1
  101. package/dist/ai/manifest/components/BbDialog.json +6 -1
  102. package/dist/ai/manifest/components/BbDialog.tree.json +41 -1
  103. package/dist/ai/manifest/components/BbDropdown.json +9 -8
  104. package/dist/ai/manifest/components/BbDropdown.tree.json +4 -0
  105. package/dist/ai/manifest/components/BbDropdownButton.json +8 -9
  106. package/dist/ai/manifest/components/BbDropdownButton.removed.json +3 -1
  107. package/dist/ai/manifest/components/BbForm.json +3 -1
  108. package/dist/ai/manifest/components/BbNumberInput.json +1 -1
  109. package/dist/ai/manifest/components/BbNumberInput.tree.json +1 -1
  110. package/dist/ai/manifest/components/BbOffCanvas.json +6 -1
  111. package/dist/ai/manifest/components/BbOffCanvas.tree.json +40 -0
  112. package/dist/ai/manifest/components/BbPagination.json +1 -1
  113. package/dist/ai/manifest/components/BbRadioGroup.json +4 -3
  114. package/dist/ai/manifest/components/BbRating.json +2 -2
  115. package/dist/ai/manifest/components/BbSelect.json +16 -15
  116. package/dist/ai/manifest/components/BbSelect.tree.json +1 -1
  117. package/dist/ai/manifest/components/BbSelectPopover.json +1 -0
  118. package/dist/ai/manifest/components/BbSwitch.json +4 -4
  119. package/dist/ai/manifest/components/BbSwitchGroup.json +7 -7
  120. package/dist/ai/manifest/components/BbTable.json +15 -14
  121. package/dist/ai/manifest/components/BbTable.tree.json +2 -0
  122. package/dist/ai/manifest/components/BbTabs.json +3 -3
  123. package/dist/ai/manifest/components/BbTabsList.json +1 -1
  124. package/dist/ai/manifest/components/BbTabsRoot.json +1 -1
  125. package/dist/ai/manifest/components/BbTag.json +1 -1
  126. package/dist/ai/manifest/components/BbTag.tree.json +1 -1
  127. package/dist/ai/manifest/components/BbTextInput.json +1 -1
  128. package/dist/ai/manifest/components/BbTextInput.tree.json +1 -1
  129. package/dist/ai/manifest/components/BbTextarea.json +1 -1
  130. package/dist/ai/manifest/components/BbTextarea.tree.json +1 -1
  131. package/dist/ai/manifest/components/BbTimePicker.json +1 -1
  132. package/dist/ai/manifest/components/BbTimePickerInput.json +1 -1
  133. package/dist/ai/manifest/components/BbTimePickerInput.tree.json +1 -1
  134. package/dist/ai/manifest/components/BbToast.removed.json +2 -1
  135. package/dist/ai/manifest/components/BbTree.json +2 -2
  136. package/dist/ai/manifest/components/CommonFieldInput.tree.json +3 -3
  137. package/dist/ai/manifest/index.json +4 -4
  138. package/dist/ai/manifest/meta.json +5 -1
  139. package/dist/ai/manifest/types.advanced.json +9 -9
  140. package/dist/ai/manifest/types.api.json +6 -5
  141. package/dist/ai/recipes/inertia/approvals-inbox.md +23 -16
  142. package/dist/ai/recipes/inertia/inline-edit-workspace.md +12 -5
  143. package/dist/ai/recipes/inertia/layout-scaffold.md +5 -3
  144. package/dist/ai/recipes/inertia/onboarding.md +23 -12
  145. package/dist/ai/recipes/inertia/ownership-atlas.md +34 -18
  146. package/dist/ai/recipes/inertia/record-form.md +12 -8
  147. package/dist/ai/recipes/inertia/records-workspace.md +14 -7
  148. package/dist/ai/recipes/inertia/settings-workspace.md +75 -60
  149. package/dist/ai/recipes/inertia/upload-center.md +17 -9
  150. package/dist/ai/recipes/inertia/wizard-form.md +2 -2
  151. package/dist/ai/recipes/nuxt/approvals-inbox.md +23 -16
  152. package/dist/ai/recipes/nuxt/inline-edit-workspace.md +12 -5
  153. package/dist/ai/recipes/nuxt/layout-scaffold.md +5 -3
  154. package/dist/ai/recipes/nuxt/onboarding.md +5 -4
  155. package/dist/ai/recipes/nuxt/ownership-atlas.md +34 -18
  156. package/dist/ai/recipes/nuxt/record-form.md +14 -10
  157. package/dist/ai/recipes/nuxt/records-workspace.md +14 -7
  158. package/dist/ai/recipes/nuxt/settings-workspace.md +70 -60
  159. package/dist/ai/recipes/nuxt/upload-center.md +17 -9
  160. package/dist/ai/recipes/nuxt/wizard-form.md +4 -4
  161. package/dist/ai/recipes/vue/approvals-inbox.md +23 -16
  162. package/dist/ai/recipes/vue/inline-edit-workspace.md +12 -5
  163. package/dist/ai/recipes/vue/layout-scaffold.md +5 -3
  164. package/dist/ai/recipes/vue/onboarding.md +5 -4
  165. package/dist/ai/recipes/vue/ownership-atlas.md +34 -18
  166. package/dist/ai/recipes/vue/record-form.md +14 -10
  167. package/dist/ai/recipes/vue/records-workspace.md +14 -7
  168. package/dist/ai/recipes/vue/settings-workspace.md +70 -60
  169. package/dist/ai/recipes/vue/upload-center.md +17 -9
  170. package/dist/ai/recipes/vue/wizard-form.md +4 -4
  171. package/dist/ai/source/BbAccordion.md +50 -16
  172. package/dist/ai/source/BbBadge.md +420 -26
  173. package/dist/ai/source/BbBadgeButton.md +378 -12
  174. package/dist/ai/source/BbButton.md +205 -55
  175. package/dist/ai/source/BbCalendar.md +5 -0
  176. package/dist/ai/source/BbCheckboxGroup.md +38 -13
  177. package/dist/ai/source/BbConfigScope.md +19 -2
  178. package/dist/ai/source/BbConfirm.md +74 -80
  179. package/dist/ai/source/BbConfirmPortal.md +6 -6
  180. package/dist/ai/source/BbDatePicker.md +9 -2
  181. package/dist/ai/source/BbDatePickerInput.md +3 -1
  182. package/dist/ai/source/BbDialog.md +53 -2
  183. package/dist/ai/source/BbDropdown.md +350 -98
  184. package/dist/ai/source/BbDropdownButton.md +20 -12
  185. package/dist/ai/source/BbDropdownGroup.md +136 -58
  186. package/dist/ai/source/BbForm.md +144 -10
  187. package/dist/ai/source/BbOffCanvas.md +53 -2
  188. package/dist/ai/source/BbPagination.md +1 -1
  189. package/dist/ai/source/BbRadioGroup.md +72 -10
  190. package/dist/ai/source/BbRating.md +30 -22
  191. package/dist/ai/source/BbSelect.md +11 -1
  192. package/dist/ai/source/BbSelectPopover.md +105 -34
  193. package/dist/ai/source/BbSwitch.md +23 -8
  194. package/dist/ai/source/BbSwitchGroup.md +67 -21
  195. package/dist/ai/source/BbTable.md +359 -48
  196. package/dist/ai/source/BbTabs.md +6 -0
  197. package/dist/ai/source/BbTabsList.md +10 -0
  198. package/dist/ai/source/BbTabsPanels.md +6 -0
  199. package/dist/ai/source/BbTabsRoot.md +6 -0
  200. package/dist/ai/source/BbTree.md +14 -4
  201. package/dist/ai/source/CommonFieldInput.md +2 -1
  202. package/dist/components/BbAccordion/BbAccordion.vue.d.ts +7 -3
  203. package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +52 -38
  204. package/dist/components/BbAccordion/ptKeys.generated.d.ts +20 -0
  205. package/dist/components/BbAccordion/types.d.ts +21 -7
  206. package/dist/components/BbAccordion/types.js +1 -1
  207. package/dist/components/BbAlert/BbAlert.vue.d.ts +1 -1
  208. package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +5 -5
  209. package/dist/components/BbBadge/BbBadge.vue.d.ts +1 -1
  210. package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +65 -42
  211. package/dist/components/BbBadge/types.d.ts +15 -12
  212. package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +79 -73
  213. package/dist/components/BbButton/types.d.ts +7 -6
  214. package/dist/components/BbCalendar/BbCalendar.vue.d.ts +2 -1
  215. package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +2 -1
  216. package/dist/components/BbCalendar/types.d.ts +5 -0
  217. package/dist/components/BbCalendar/useCalendarGrid.js +1 -1
  218. package/dist/components/BbCalendar/useDayGrid.js +1 -1
  219. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +10 -4
  220. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +2 -2
  221. package/dist/components/BbCheckboxGroup/types.d.ts +2 -2
  222. package/dist/components/BbConfigScope/BbConfigScope.vue_vue_type_script_setup_true_lang.js +8 -8
  223. package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +71 -132
  224. package/dist/components/BbConfirm/ptKeys.generated.d.ts +5 -5
  225. package/dist/components/BbConfirm/types.d.ts +5 -5
  226. package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +2 -1
  227. package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +3 -0
  228. package/dist/components/BbDatePicker/types.d.ts +5 -0
  229. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +1 -1
  230. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +2 -0
  231. package/dist/components/BbDatePickerInput/types.d.ts +2 -1
  232. package/dist/components/BbDialog/BbDialog.vue.d.ts +3 -0
  233. package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +263 -235
  234. package/dist/components/BbDialog/overlayActions.js +94 -0
  235. package/dist/components/BbDialog/types.d.ts +24 -0
  236. package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +4 -3
  237. package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +382 -332
  238. package/dist/components/BbDropdown/dropdownHandle.js +6 -0
  239. package/dist/components/BbDropdown/normalizeGroups.js +58 -48
  240. package/dist/components/BbDropdown/types.d.ts +107 -48
  241. package/dist/components/BbDropdown/types.js +2 -2
  242. package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +71 -71
  243. package/dist/components/BbDropdownButton/types.d.ts +2 -4
  244. package/dist/components/BbForm/BbForm.vue.d.ts +2 -1
  245. package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +240 -198
  246. package/dist/components/BbForm/recognizeValidation.d.ts +9 -0
  247. package/dist/components/BbForm/recognizeValidation.js +55 -0
  248. package/dist/components/BbForm/validationError.d.ts +10 -0
  249. package/dist/components/BbForm/validationError.js +11 -0
  250. package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +3 -0
  251. package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +414 -389
  252. package/dist/components/BbOffCanvas/sheetAttrs.js +5 -5
  253. package/dist/components/BbOffCanvas/types.d.ts +24 -0
  254. package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +3 -3
  255. package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +10 -4
  256. package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +173 -157
  257. package/dist/components/BbRadioGroup/types.d.ts +9 -3
  258. package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +112 -103
  259. package/dist/components/BbRating/types.d.ts +3 -2
  260. package/dist/components/BbSelect/BbSelect.vue.d.ts +9 -8
  261. package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +3 -1
  262. package/dist/components/BbSelect/types.d.ts +8 -0
  263. package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +11 -4
  264. package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +513 -502
  265. package/dist/components/BbSelectPopover/types.d.ts +10 -2
  266. package/dist/components/BbSwitch/BbSwitch.vue.d.ts +2 -0
  267. package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +85 -73
  268. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +10 -4
  269. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +171 -152
  270. package/dist/components/BbSwitchGroup/types.d.ts +1 -1
  271. package/dist/components/BbTable/BbTable.vue.d.ts +36 -25
  272. package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +1338 -1215
  273. package/dist/components/BbTable/BbTableDataRow.js +2 -1
  274. package/dist/components/BbTable/BbTableRowMenu.js +36 -0
  275. package/dist/components/BbTable/types.d.ts +32 -17
  276. package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +2 -2
  277. package/dist/components/BbTabs/types.d.ts +6 -0
  278. package/dist/components/BbTextInput/BbTextInput.vue.d.ts +1 -1
  279. package/dist/components/BbTextarea/BbTextarea.vue.d.ts +1 -1
  280. package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +1 -1
  281. package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +88 -94
  282. package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +1 -1
  283. package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +9 -9
  284. package/dist/components/BbTree/types.d.ts +8 -2
  285. package/dist/components/CommonFieldInput/CommonFieldInput.vue_vue_type_script_setup_true_lang.js +39 -39
  286. package/dist/composables/formSubmitLock.js +15 -8
  287. package/dist/composables/overlayRegistry.d.ts +5 -0
  288. package/dist/composables/overlayRegistry.js +154 -148
  289. package/dist/composables/useBbDropdown.d.ts +8 -0
  290. package/dist/composables/useBbDropdown.js +3 -1
  291. package/dist/composables/useBbTabs.js +138 -138
  292. package/dist/composables/useConfirm.d.ts +63 -52
  293. package/dist/composables/useConfirm.js +22 -18
  294. package/dist/deprecation/ai-deprecations.json.js +1 -1
  295. package/dist/directives/bbDropdown.d.ts +7 -7
  296. package/dist/directives/bbDropdown.js +21 -14
  297. package/dist/directives/bbTooltip.d.ts +3 -3
  298. package/dist/directives/createPopoverDirective.js +57 -35
  299. package/dist/i18n/locales/ar.json +5 -1
  300. package/dist/i18n/locales/cs.json +5 -1
  301. package/dist/i18n/locales/da.json +5 -1
  302. package/dist/i18n/locales/de-CH.json +5 -1
  303. package/dist/i18n/locales/de.json +5 -1
  304. package/dist/i18n/locales/el.json +5 -1
  305. package/dist/i18n/locales/en-GB.json +5 -1
  306. package/dist/i18n/locales/en.json +5 -1
  307. package/dist/i18n/locales/es-MX.json +5 -1
  308. package/dist/i18n/locales/es.json +5 -1
  309. package/dist/i18n/locales/fa.json +5 -1
  310. package/dist/i18n/locales/fi.json +5 -1
  311. package/dist/i18n/locales/fr.json +5 -1
  312. package/dist/i18n/locales/he.json +5 -1
  313. package/dist/i18n/locales/hu.json +5 -1
  314. package/dist/i18n/locales/it.json +5 -1
  315. package/dist/i18n/locales/ja.json +5 -1
  316. package/dist/i18n/locales/ko.json +5 -1
  317. package/dist/i18n/locales/nb.json +5 -1
  318. package/dist/i18n/locales/nl.json +5 -1
  319. package/dist/i18n/locales/pl.json +5 -1
  320. package/dist/i18n/locales/pt-BR.json +5 -1
  321. package/dist/i18n/locales/pt-PT.json +5 -1
  322. package/dist/i18n/locales/ro.json +5 -1
  323. package/dist/i18n/locales/ru.json +5 -1
  324. package/dist/i18n/locales/sv.json +5 -1
  325. package/dist/i18n/locales/tr.json +5 -1
  326. package/dist/i18n/locales/uk.json +5 -1
  327. package/dist/i18n/locales/zh-CN.json +5 -1
  328. package/dist/i18n/locales/zh-HK.json +5 -1
  329. package/dist/i18n/locales/zh-TW.json +5 -1
  330. package/dist/index.d.ts +2 -0
  331. package/dist/index.js +4 -3
  332. package/dist/llms-full.txt +1984 -1145
  333. package/dist/llms-medium.txt +21 -18
  334. package/dist/llms.txt +2 -2
  335. package/dist/locale-blueprint.json +5 -1
  336. package/dist/plugin.js +17 -40
  337. package/dist/pluginCore.js +30 -0
  338. package/dist/styles.css +2 -2
  339. package/dist/types/ActionButton.d.ts +26 -5
  340. package/dist/types/ActionButton.js +11 -0
  341. package/dist/types/ConfigDefaults.d.ts +34 -3
  342. package/dist/types/ConfigDefaults.js +14 -8
  343. package/dist/types/ItemPath.d.ts +33 -4
  344. package/dist/types/ptComponentMap.d.ts +1 -1
  345. package/dist/utilities/functions/clickCount.js +14 -0
  346. package/dist/utils/versionCheck.js +1 -1
  347. package/llms.txt +2 -2
  348. package/package.json +11 -1
  349. package/scripts/README.md +31 -27
  350. package/scripts/lib/adoption-checklist.json +2 -2
  351. package/scripts/lib/eslint-disable.mjs +5 -3
  352. package/scripts/lib/eslint-plugin.d.ts +2 -0
  353. package/scripts/lib/eslint-plugin.mjs +213 -1
  354. package/scripts/lib/redundant-item-accessor.mjs +4 -1
  355. package/scripts/lib/release-results.mjs +32 -1
  356. package/scripts/lib/renamed-item-field.mjs +4 -1
  357. package/scripts/lib/tab-links.mjs +4 -1
  358. package/scripts/lib/tree-default-expandable.mjs +53 -0
  359. package/scripts/lib/validate-bb-markup.mjs +536 -52
@@ -74,8 +74,9 @@ With a `v-model`, the model owns visibility: bind a boolean and flip it.
74
74
  Without one, the dialog keeps its own open state, and you open it by its
75
75
  `id` instead (next section). The dialog dismisses itself on the header close button, the `Escape`
76
76
  key, and a backdrop click. The `default`, `header` and `footer` slots also
77
- receive a `close` callback, so a Cancel button in the footer is
78
- `<template #footer="{ close }">` with `@click="close"`. That `close` is a
77
+ receive a `close` callback. The Cancel button is one prop, `cancel` (see
78
+ [Footer buttons](#footer-buttons-ok-cancel-actions)); its click is a
79
+ **user** close, like the slots' `close`. That `close` is a
79
80
  **user** close, exactly like the ✕: a `persistent` dialog still closes on it,
80
81
  and `prevent-close` refuses it with the deny nudge. Setting the model to
81
82
  `false` is the forceful close and always works: close through the model
@@ -225,8 +226,8 @@ reads `data` in two places:
225
226
  `data` stays set until the close transition has run, so the content never
226
227
  flashes empty while the dialog fades out. The edit-record example in
227
228
  [Header, footer and body](#header-footer-and-body) below works this way: each
228
- row's Edit button passes its contact, the slots read it as `data`, and Save
229
- closes with `complete(data)`, handing the edited copy to the row's
229
+ row's Edit button passes its contact, the slots read it as `data`, and the
230
+ `ok` button closes with the edited copy, handing it to the row's
230
231
  `onComplete`.
231
232
 
232
233
  The rules:
@@ -293,7 +294,8 @@ turn it off. The directive's `onComplete` never spins.
293
294
 
294
295
  The tersest form, a trigger that hears the result itself. The form binds the
295
296
  opening's `data` directly: it is a copy (see [The data is a copy](#the-data-is-a-copy)),
296
- so Cancel throws the edits away and Save hands them back:
297
+ so Cancel throws the edits away. `ok` submits the form, and the record the
298
+ save resolves is the result:
297
299
 
298
300
  ```vue
299
301
  <script setup lang="ts">
@@ -320,18 +322,25 @@ const replace = (saved: Member) => {
320
322
  </BbButton>
321
323
  </li>
322
324
  </ul>
323
- <BbDialog id="edit-member" v-slot="{ data, complete }" title="Edit member">
324
- <BbForm :model="data" @submit="async () => complete(await save(data))">
325
+ <BbDialog
326
+ id="edit-member"
327
+ v-slot="{ data }"
328
+ cancel
329
+ ok="Save"
330
+ title="Edit member"
331
+ >
332
+ <BbForm :model="data" @submit="() => save(data)">
325
333
  <BbTextInput label="Name" name="name" />
326
- <BbButton type="submit">Save</BbButton>
327
334
  </BbForm>
328
335
  </BbDialog>
329
336
  </template>
330
337
  ```
331
338
 
332
- - `complete(value)` (the `default`, `header` and `footer` slots, and
333
- `useBbDialog(id).complete`) closes the dialog and resolves
334
- `{ completed: true, value }`. It wins over `prevent-close`, like `hide()`.
339
+ - `ok` completes for you: with what the form's save resolved (else the
340
+ form's values), or with `data` when there is no form.
341
+ `complete(value)` (the `default`, `header` and `footer` slots, and
342
+ `useBbDialog(id).complete`) does the same from code. It wins over
343
+ `prevent-close`, like `hide()`.
335
344
  - Every other close is a dismissal, `{ completed: false, reason }`:
336
345
 
337
346
  | `reason` | When |
@@ -359,91 +368,98 @@ const replace = (saved: Member) => {
359
368
  #### The page saves: a promise from `onComplete`
360
369
 
361
370
  When the page owns the save (it knows the endpoint, the list to update),
362
- `onComplete` returns the request's promise. `complete(value)` calls it first,
363
- and the dialog stays open and **locked** until it settles: the ✕, Cancel,
364
- Escape and the backdrop are refused, and a footer `BbButton` whose click
365
- returns `complete(value)` spins. Resolved, the dialog closes and the opening
366
- settles `{ completed: true, value }`; rejected, it stays open with its data
367
- and `complete()` rejects with the same error, so the dialog can show it.
371
+ `onComplete` returns the request's promise. Completing calls it first, and
372
+ the dialog stays open and **locked** until it settles: the ✕, Cancel, Escape
373
+ and the backdrop are refused, and the `ok` button spins. Resolved, the
374
+ dialog closes and the opening settles `{ completed: true, value }`.
368
375
 
369
376
  ```vue
370
377
  <template>
371
378
  <BbButton v-bb-dialog="{ id: 'rename', data: row, onComplete: save }">
372
379
  Rename
373
380
  </BbButton>
374
- <BbDialog id="rename" v-slot="{ data, complete }" title="Rename">
375
- <BbForm :model="data" @submit="() => complete(data)">
381
+ <BbDialog id="rename" v-slot="{ data }" cancel ok="Save" title="Rename">
382
+ <BbForm :model="data">
376
383
  <BbTextInput label="Name" name="name" />
377
- <BbButton type="submit">Save</BbButton>
378
384
  </BbForm>
379
385
  </BbDialog>
380
386
  </template>
381
387
  ```
382
388
 
389
+ - **`false` keeps it open.** A handler that returns (or resolves) `false`
390
+ leaves the dialog open with its data, and nothing is reported: the handler
391
+ already showed why.
392
+ - **A throw keeps it open too**, and the error is reported once (to
393
+ `app.config.errorHandler`), never as a validation answer.
394
+ - **One handler owns the save.** The other one only reacts (a toast, a
395
+ refresh).
396
+
383
397
  From code: `edit.show(row, { onComplete: save })` (both the id and the
384
- component handle). A `save` function passed in `data` is no longer needed.
385
- A sync `onComplete` (or none) closes at once, as before.
398
+ component handle). `onComplete` is just a function. A trigger inside a
399
+ child component gets the page's save the way your app already shares
400
+ things: a function prop (`:save="saveMember"`), a page `provide` / `inject`,
401
+ or a store action. Not an emit: an emit cannot return the promise.
386
402
 
387
- `onComplete` is just a function. A trigger inside a child component gets the
388
- page's save the way your app already shares things: a function prop
389
- (`:save="saveMember"`), a page `provide` / `inject`, or a store action. Not an
390
- emit: an emit cannot return the promise.
403
+ #### The dialog's own `@complete`
391
404
 
392
- To show a rejected save's field errors, keep them in a `ref` bound on the
393
- form, `<BbForm :field-errors="fieldErrors">` (BbForm § The page's errors
394
- object): the dialog stays open, and each message lands under its field until
395
- the user edits it.
405
+ A dialog written in the page has no opener to hear it. `@complete` is the
406
+ same hook on the dialog itself: it gets the same value, runs **before** the
407
+ opener's `onComplete`, and both are awaited; the dialog closes only when both
408
+ succeed.
396
409
 
397
410
  ```vue
398
- <script setup lang="ts">
399
- import { ref } from 'vue';
400
-
401
- const fieldErrors = ref<Record<string, string | string[]>>({});
402
- </script>
403
-
404
- <template>
405
- <BbDialog id="rename" v-slot="{ data, complete }" title="Rename">
406
- <BbForm
407
- :field-errors="fieldErrors"
408
- :model="data"
409
- @submit="
410
- () =>
411
- complete(data).catch((error) => {
412
- // Your save's rejection. With the Inertia helpers it IS the
413
- // error bag (messages by field path); an Error has no bag.
414
- fieldErrors = error instanceof Error ? {} : error;
415
- })
416
- "
417
- >
418
- <BbTextInput label="Name" name="name" />
419
- <BbButton type="submit">Save</BbButton>
420
- </BbForm>
421
- </BbDialog>
422
- </template>
411
+ <BbDialog
412
+ id="rename-session"
413
+ v-slot="{ data }"
414
+ cancel="Chiudi"
415
+ ok="Rinomina"
416
+ title="Rinomina sessione"
417
+ @complete="reloadSessions"
418
+ >
419
+ <BbForm :model="data" @submit="() => put(`/sessions/${data.id}`, data)">
420
+ <BbTextInput label="Nome" name="name" />
421
+ </BbForm>
422
+ </BbDialog>
423
423
  ```
424
424
 
425
- With Inertia, the page's `useForm().errors` is that object already; the
426
- record-form recipe (`ai/recipes/inertia/record-form.md`) binds
427
- `<BbForm :field-errors="form.errors">` the same way.
425
+ #### A save the server refuses
428
426
 
429
- An Inertia visit (`router.put`, `form.put`) returns no promise and never
430
- rejects on its own. Save through the Inertia helpers' `usePromiseRouter`
431
- (Inertia helpers guide § usePromiseRouter) instead: its promise resolves when
432
- the server answered (and on a visit another visit cut short, closing the
433
- dialog), and on a validation error it **rejects with the error bag itself**,
434
- `{ name: 'The name is taken.' }`, not `{ errors }`: the example above binds
435
- the rejection as it is. Anything else (an error page, a network error)
436
- rejects with an `Error`, which has no bag.
427
+ Let the save reject; the form reads the answer (BbForm § What the save's
428
+ answer means). A validation answer (a `BbValidationError`, or a 422 from
429
+ axios / `$fetch` in Laravel, FastAPI or API Platform shape) puts each
430
+ message under its field and keeps the dialog open, with nothing reported.
431
+ Any other failure keeps it open too and reaches `@submit-error` on the form,
432
+ else the app's error handler, once.
437
433
 
438
- ```ts
439
- import { usePromiseRouter } from '@/composables/inertia-helpers/usePromiseRouter';
434
+ With Inertia, `usePromiseForm` (Inertia helpers guide) rejects with a
435
+ `BbValidationError` on a 422, and the page's `form.errors` binds as
436
+ `field-errors`. The dialog is all markup:
440
437
 
441
- type User = { id: number; name: string };
438
+ ```vue
439
+ <BbDialog
440
+ id="platform-user-edit"
441
+ :title="title"
442
+ cancel="Chiudi"
443
+ :ok="isEditMode ? 'Salva modifiche' : 'Crea utente'"
444
+ @complete="refreshUsers"
445
+ >
446
+ <BbForm :model="form" :field-errors="form.errors" @submit="onSubmit">
447
+ <BbTextInput label="Email" name="email" type="email" />
448
+ </BbForm>
449
+ </BbDialog>
450
+ ```
442
451
 
443
- const { put } = usePromiseRouter();
444
- const save = (user: User) => put(`/users/${user.id}`, user);
452
+ ```ts
453
+ const { form, post, put } = usePromiseForm({ name: '', email: '' });
454
+ // Return the visit: no try/catch, no complete().
455
+ const onSubmit = () =>
456
+ user
457
+ ? put(route('users.update', { id: user.id }))
458
+ : post(route('users.store'));
445
459
  ```
446
460
 
461
+ A cancelled visit resolves `false`: the dialog stays open, nothing fires.
462
+
447
463
  #### The data is a copy
448
464
 
449
465
  Every opening holds its own **reactive copy** of the `data` it was given
@@ -457,9 +473,9 @@ a `File`, a `Map`) is the same object you passed. So:
457
473
  - **Cancel discards.** Every close but `complete` throws the copy away;
458
474
  reopening the same row starts from a fresh copy, with nothing to reset on
459
475
  `@show`.
460
- - **`complete(await save(data))`** is the default: hand back what the server
461
- saved. A dialog with no round trip (a local filters panel) returns the edit
462
- itself with `complete(data)`.
476
+ - **`ok` hands back what the server saved** (the save's resolved value). A
477
+ dialog with no round trip (a local filters panel) has no form save, and
478
+ `ok` returns the edit itself.
463
479
  - `data` is not the object you passed (`data !== row`), so compare by id, never
464
480
  by identity. The slots' `data` and `useBbDialog(id).data` are the
465
481
  same copy, and it is reactive: a title bound to `data.name` follows the
@@ -605,7 +621,7 @@ template too. Opened without data, the form starts from its own defaults:
605
621
  ```vue
606
622
  <!-- UserCreateDialog.vue -->
607
623
  <script setup lang="ts">
608
- import { BbButton, BbDialog, BbForm, BbTextInput } from 'bitboss-ui';
624
+ import { BbDialog, BbForm, BbTextInput } from 'bitboss-ui';
609
625
 
610
626
  type User = { id: number; name: string; team: string };
611
627
 
@@ -618,14 +634,16 @@ const save = async (values: Record<string, unknown>): Promise<User> => ({
618
634
  </script>
619
635
 
620
636
  <template>
621
- <BbDialog id="user-create" v-slot="{ data, complete }" title="New user">
622
- <BbForm
623
- :model="data"
624
- @submit="async (values) => complete(await save(values))"
625
- >
637
+ <BbDialog
638
+ id="user-create"
639
+ v-slot="{ data }"
640
+ cancel
641
+ ok="Create"
642
+ title="New user"
643
+ >
644
+ <BbForm :model="data" @submit="save">
626
645
  <BbTextInput label="Name" name="name" />
627
646
  <BbTextInput label="Team" name="team" />
628
- <BbButton type="submit">Create</BbButton>
629
647
  </BbForm>
630
648
  </BbDialog>
631
649
  </template>
@@ -675,8 +693,8 @@ const createForDesign = async () => {
675
693
  renders every confirm and toast too): nothing to mount. Without the plugin
676
694
  there is no host, and the opening waits a second, then settles
677
695
  `'unmounted'` with a dev warning.
678
- - **Results** are the dialog's own, as in the section above: `complete(value)`
679
- resolves `{ completed: true, value }`, every other close a dismissal, at
696
+ - **Results** are the dialog's own, as in the section above: `ok` (or
697
+ `complete(value)`) resolves `{ completed: true, value }`, every other close a dismissal, at
680
698
  close start. The instance unmounts after the close transition.
681
699
  - **It injects like its opener.** The directive's dialog takes the trigger's
682
700
  surroundings (a row's `provide`, a `<BbConfigScope>` around the button, an
@@ -713,19 +731,90 @@ const createForDesign = async () => {
713
731
  - **The server** opens nothing: a `show()` during a server render settles
714
732
  `'server'` at once, and the host renders empty, so it hydrates clean.
715
733
 
734
+ ### Footer buttons: `ok`, `cancel`, `actions`
735
+
736
+ Write the buttons as props; none render unless written, so an info dialog
737
+ grows no footer.
738
+
739
+ ```vue
740
+ <BbDialog
741
+ id="archive"
742
+ cancel="Keep"
743
+ :ok="{ text: 'Archive', variant: 'destructive' }"
744
+ title="Archive project?"
745
+ @complete="archive"
746
+ >
747
+ <template #default="{ data }">{{ data.name }} will be archived.</template>
748
+ </BbDialog>
749
+ ```
750
+
751
+ - **`cancel`, then `ok`**, in that order. Each takes `true` (the locale's
752
+ Cancel / OK: a bare `cancel` attribute), a label, or a button config
753
+ `{ text, variant, size, 'prepend:icon', 'append:icon', iconOnly, block,
754
+ onClick }`.
755
+ - **`ok`** runs its `onClick` when written, then completes. Without one, it
756
+ submits the `BbForm` inside (validation first; an invalid form stays
757
+ open), and a successful save completes with what it resolved, else the
758
+ form's values. Enter in a field completes the same way. No form, or two or
759
+ more: it completes with `data`.
760
+ - **`cancel`** runs its `onClick`, then closes as a dismissal
761
+ (`reason: 'close'`); refused while a save locks the dialog.
762
+ - **`actions`** replaces both: an array of button configs, each running its
763
+ `onClick`, then completing with `data`. `false`: none.
764
+ - **`false` from an `onClick`** keeps the dialog open; a throw keeps it open
765
+ and is reported once (a `BbValidationError` never is).
766
+ - **The `footer` slot replaces them all**, for a footer of your own.
767
+ - **Config styles them app-wide**:
768
+ `components: { BbDialog: { okProps: { variant: 'primary' }, cancelProps: { variant: 'outline' } } }`
769
+ (and `BbOffCanvas`, `BbConfirm`) takes the button config minus `onClick`,
770
+ merged under what a dialog writes; it never adds a button.
771
+ - **The phone sheet** renders the same buttons.
772
+
773
+ #### Steps in one dialog
774
+
775
+ `ok` belongs to the last step. Before it, hand `ok` a Next button whose
776
+ `onClick` moves on and returns `false` (the dialog stays open); on the last
777
+ step it is a plain label again, so it submits the form and completes:
778
+
779
+ ```vue
780
+ <BbDialog
781
+ id="wizard"
782
+ cancel
783
+ :ok="step < 3 ? { text: 'Next', onClick: next } : 'Finish'"
784
+ >
785
+ ```
786
+
787
+ ```ts
788
+ const step = ref(1);
789
+ const next = () => {
790
+ step.value++;
791
+ return false;
792
+ };
793
+ ```
794
+
795
+ - **Give the form `keep-values-on-unmount`**: steps shown with `v-if` unmount
796
+ their fields, and without it each field's value leaves `data` as its step
797
+ goes, so Back finds it empty and the result holds only the last step.
798
+ - **Each step's first field gets `autofocus`**: it fires when the field
799
+ mounts, so focus follows the step with no watcher (`focus-target` picks only
800
+ where the opening starts).
801
+ - **A final success step with no field is a status region**
802
+ (`role="status"`), announced as it appears, not a focus target.
803
+
716
804
  ### Header, footer and body
717
805
 
718
806
  A `title` prop renders the standard header (title text + close button) and wires
719
- `aria-labelledby` for you. Put form fields in the `default` slot and actions in
720
- the `footer` slot — keep exactly one primary action there. Slot the buttons
807
+ `aria-labelledby` for you. Put form fields in the `default` slot. Buttons are
808
+ the props above; the `footer` slot is for anything else — keep exactly one
809
+ primary action there. Slot the buttons
721
810
  straight in: the footer is a row that sits them at the end, 8px apart, and
722
811
  wraps on a narrow sheet; `class="me-auto"` on one pushes it to the start (a
723
812
  "Delete" opposite "Cancel / Save"). A single wrapping `<div>` of your own
724
813
  stretches to the full width and keeps whatever layout you give it. The body area scrolls internally when content overflows; header and
725
814
  footer stay pinned. This edit-record dialog is opened by id from each row
726
815
  with that row's `data` and edits it in place: `data` is the opening's own
727
- copy, so a canceled edit never reaches the row, and Save hands the copy back
728
- with `complete(data)` for the row's `onComplete`.
816
+ copy, so a canceled edit never reaches the row, and `ok` hands the copy back
817
+ for the row's `onComplete`.
729
818
 
730
819
  **Edit-record dialog with a footer action**
731
820
 
@@ -758,8 +847,15 @@ with `complete(data)` for the row's `onComplete`.
758
847
  </li>
759
848
  </ul>
760
849
  <!-- `data` is this opening's own copy of the contact: the fields edit it
761
- directly, Cancel throws it away, Save returns it. -->
762
- <BbDialog id="edit-contact" size="md" title="Edit contact">
850
+ directly, Cancel throws it away, Save hands it back (no form inside,
851
+ so ok completes with `data`). -->
852
+ <BbDialog
853
+ id="edit-contact"
854
+ cancel
855
+ ok="Save changes"
856
+ size="md"
857
+ title="Edit contact"
858
+ >
763
859
  <template #default="{ data }">
764
860
  <div class="grid gap-3">
765
861
  <BbTextInput v-model="data.name" compact label="Full name" />
@@ -774,12 +870,6 @@ with `complete(data)` for the row's `onComplete`.
774
870
  <BbSwitch v-model="data.subscribed" label="Subscribed to updates" />
775
871
  </div>
776
872
  </template>
777
- <template #footer="{ data, close, complete }">
778
- <BbButton variant="ghost" @click="close">Cancel</BbButton>
779
- <BbButton variant="primary" @click="complete(data)">
780
- Save changes
781
- </BbButton>
782
- </template>
783
873
  </BbDialog>
784
874
  </template>
785
875
 
@@ -906,12 +996,11 @@ the `title` slot, which receives `data` like the other slots (so does the
906
996
  <BbButton v-bb-dialog="{ id: 'rename', data: { name: 'Roadmap' } }">
907
997
  Rename
908
998
  </BbButton>
909
- <BbDialog id="rename">
999
+ <BbDialog id="rename" ok="Rename">
910
1000
  <template #title="{ data }">Rename “{{ data.name }}”</template>
911
- <template #default="{ data, complete }">
912
- <BbForm :model="data" @submit="complete(data)">
1001
+ <template #default="{ data }">
1002
+ <BbForm :model="data">
913
1003
  <BbTextInput label="Name" name="name" />
914
- <BbButton type="submit">Rename</BbButton>
915
1004
  </BbForm>
916
1005
  </template>
917
1006
  </BbDialog>
@@ -1020,77 +1109,53 @@ Two rules keep dialog forms honest:
1020
1109
  one: then only a `<BbForm :model="data">` starts blank, and anything reading
1021
1110
  `data.x` needs `default-data` (see
1022
1111
  [Create and edit in one dialog](#create-and-edit-in-one-dialog-default-data)).
1023
- - On success, do the work first, then close: `complete(await api.save(values))`
1024
- hands the saved record to whoever opened the dialog; `hide()` (or the model
1025
- set to `false`) closes with no result. The close transition runs while
1026
- your toast/refresh happens.
1112
+ - `ok` does the work, then closes: it submits the form, and the save's
1113
+ resolved record is the opener's result. Never call `complete` in a form
1114
+ dialog; `hide()` (or the model set to `false`) closes with no result.
1027
1115
 
1028
1116
  #### A failed save stays open
1029
1117
 
1030
- Close only when the save worked. When the server answers with field errors
1031
- (a 422), don't call `complete` or `hide`: hand the errors to the form with
1032
- `useBbForm(id).setErrors`, and the dialog stays open with each message
1033
- under its field and focus on the first one. The user fixes it and submits
1034
- again; Cancel still throws the copy away.
1118
+ Close only when the save worked, and that is the default: `ok` completes
1119
+ only on a successful submit. Return the request from `@submit` and let it
1120
+ reject (see [A save the server refuses](#a-save-the-server-refuses)):
1035
1121
 
1036
1122
  ```vue
1037
1123
  <script setup lang="ts">
1038
- import { BbButton, BbDialog, BbForm, BbTextInput, useBbForm } from 'bitboss-ui';
1039
-
1040
- type Member = { id: number; name: string; email: string };
1041
- type FieldErrors = Record<string, string[]>;
1042
-
1043
- // Your API call: the saved member, or the 422's field errors.
1044
- const save = async (member: Member): Promise<Member | FieldErrors> =>
1045
- member.email.endsWith('@example.com')
1046
- ? { ...member }
1047
- : { email: ['Use your work address.'] };
1048
-
1049
- const form = useBbForm('edit-member-form');
1124
+ import { BbDialog, BbForm, BbTextInput } from 'bitboss-ui';
1125
+
1126
+ type Role = { id?: number; name: string };
1127
+ const props = defineProps<{ role?: Role }>();
1128
+ // A 422 rejects with the field errors; the form shows them.
1129
+ const save = (values: Role) =>
1130
+ props.role
1131
+ ? api.put(`/roles/${props.role.id}`, values)
1132
+ : api.post('/roles', values);
1050
1133
  </script>
1051
1134
 
1052
1135
  <template>
1053
- <BbDialog id="edit-member" v-slot="{ data, complete }" title="Edit member">
1054
- <BbForm
1055
- id="edit-member-form"
1056
- :model="data"
1057
- @submit="
1058
- async () => {
1059
- const answer = await save(data);
1060
- if ('id' in answer) complete(answer);
1061
- else form.setErrors(answer);
1062
- }
1063
- "
1064
- >
1136
+ <BbDialog
1137
+ id="role-edit"
1138
+ v-slot="{ data }"
1139
+ cancel
1140
+ :ok="role ? 'Save' : 'Create role'"
1141
+ :default-data="{ name: '' }"
1142
+ title="Role"
1143
+ >
1144
+ <BbForm :model="data" @submit="save">
1065
1145
  <BbTextInput label="Name" name="name" />
1066
- <BbTextInput label="Email" name="email" type="email" />
1067
- <BbButton type="submit">Save</BbButton>
1068
1146
  </BbForm>
1069
1147
  </BbDialog>
1070
1148
  </template>
1071
1149
  ```
1072
1150
 
1073
- - **While it saves, the dialog refuses every user close** (the ✕, Cancel's
1074
- `close()`, Escape, the backdrop): the form locks it until the promise
1075
- settles, so the answer never lands on a closed dialog.
1151
+ - **While it saves, the dialog refuses every user close** (the ✕, Cancel,
1152
+ Escape, the backdrop): the form locks it until the promise settles, so the
1153
+ answer never lands on a closed dialog.
1076
1154
  - **The opener sees nothing until it completes.** A failed attempt settles
1077
- no result; `onComplete` (or `await show()`) gets the saved member once a
1078
- later attempt calls `complete`, or a dismissal if the user gives up.
1079
- - A message with no field (Laravel's `message`, a 403) goes under a key no
1080
- field uses, `form.setErrors({ ...errors, _request: [message] })`, and shows in
1081
- the form's `unmatchedErrors` (see BbForm § Server errors).
1082
-
1083
- #### Steps in one dialog
1084
-
1085
- - **Each step's first field gets `autofocus`**: it fires when the field
1086
- mounts, so focus follows the step with no watcher (`focus-target` picks only
1087
- where the opening starts).
1088
- - **A final success step with no field is a status region**
1089
- (`role="status"`), announced as it appears, not a focus target.
1090
- - **A footer button that changes type in place** (Next, `type="button"`,
1091
- becoming Accept, `type="submit"`, during its own click): give each its own
1092
- `key`. Unkeyed, Vue reuses the element, its type flips mid-click, and the
1093
- click on Next submits the form.
1155
+ no result; `onComplete` (or `await show()`) gets the saved record once a
1156
+ later attempt succeeds, or a dismissal if the user gives up.
1157
+ - A message with no field (Laravel's `message`) goes to the form's
1158
+ `unmatchedErrors` (see BbForm § Server errors).
1094
1159
 
1095
1160
  ### Lifecycle events and lazy content
1096
1161
 
@@ -1107,10 +1172,10 @@ Every way to close, side by side:
1107
1172
 
1108
1173
  | What | Who calls it | Can it be refused? | Result it settles | When it happens |
1109
1174
  | ------------------------------------------------------- | ------------ | ------------------------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------- |
1110
- | the ✕, the slots' `close()` | the user | yes: `prevent-close`, a saving form | `{ completed: false, reason: 'close' }` | on the click |
1175
+ | the ✕, `cancel`, `close()` | the user | yes: `prevent-close`, a saving form | `{ completed: false, reason: 'close' }` | on the click |
1111
1176
  | Escape, Back on a URL dialog, a backdrop click, a swipe | the user | yes: `persistent` too | `reason: 'escape'` / `'backdrop'` / `'swipe'` | on the key, Back, click or swipe |
1112
1177
  | `hide()` (handle), the model set to `false` | your code | no | `{ completed: false, reason: 'hide' }` | at once |
1113
- | `complete(value)` (slots, handle) | your code | no | `{ completed: true, value }` | at once |
1178
+ | `ok`, `complete(value)` | your code | no | `{ completed: true, value }` | at once |
1114
1179
  | `@hide` | the dialog | it reports a close, it can't stop one | emits it (the same object) | as any close above **starts** |
1115
1180
  | `@hidden` | the dialog | it reports a close, it can't stop one | already settled | after the close transition; focus returns, `data` clears and the body unmounts then |
1116
1181
 
@@ -1282,10 +1347,9 @@ import { BbButton, BbDialog, BbTextInput } from 'bitboss-ui';
1282
1347
  The busy case in practice: put the fields in a `BbForm` and return the save's
1283
1348
  promise from `@submit`. While it runs the form makes its fields read-only, its
1284
1349
  submit button spins, and the dialog refuses the backdrop, `Escape`, the ✕ and
1285
- Cancel (the slots' `close()`); no `saving` ref, no `prevent-close`, no
1286
- `:disabled`. Close with `complete(await save(data))` once the work resolves
1287
- (or `hide()` when nobody needs the result): the slot's `close()` there is the
1288
- user's close, still refused while the save runs. `disable-submit-lock` on the form keeps the
1350
+ Cancel; no `saving` ref, no `prevent-close`, no `:disabled`. `ok` closes
1351
+ once the save resolves (or `hide()` when nobody needs the result); Cancel is
1352
+ the user's close, still refused while the save runs. `disable-submit-lock` on the form keeps the
1289
1353
  fields editable and the dialog closable. The lock is the nearest surface's: a
1290
1354
  form in a popover inside the dialog does not lock the dialog.
1291
1355
 
@@ -1737,10 +1801,8 @@ A `pt` value written in `<script>` (a constant, a preset, a wrapper's
1737
1801
  `href`/`to` to the button.
1738
1802
  - **Don't toggle `v-model` from `@hide`/`@hidden` handlers** to "cancel" a
1739
1803
  close — use `persistent` instead; the close paths already guard correctly.
1740
- - **Catch `complete()` in a reusable dialog** whenever an opener may pass an
1741
- `onComplete` that rejects (`complete(data).catch(…)`, as in § The page
1742
- saves). Uncaught, the rejection travels through the form's `@submit` and
1743
- reaches `app.config.errorHandler`.
1804
+ - **Don't call `complete()` in a form dialog** — `ok` submits the form and
1805
+ completes on success; a failed save stays open by itself.
1744
1806
  - **Don't leave the `header` slot without a close control** — it replaces the
1745
1807
  default ×, so you must render your own wired to `close`.
1746
1808
  - **Don't query dialog content before it has opened, or after it has closed**,
@@ -1785,7 +1847,9 @@ A `pt` value written in `<script>` (a constant, a preset, a wrapper's
1785
1847
  | Prop | Type | Default | Required | Description |
1786
1848
  | --- | --- | --- | --- | --- |
1787
1849
  | `pt:<part>`, `pt:<part>:<state>`, `pt` | `PtValue` | | | Passthrough — a class list, or `{ class, style, attrs }`, bound to one named part of the component; the state form applies only while that state is on. Parts: `close`, `content`, `description`, `footer`, `header`, `root`, `sheet`, `title`. States: `fullscreen`, `open`. What each one is: _Passthrough parts and states_ below. `pt` is the object form with the same keys minus the prefix (`{ icon: '…', 'icon:loading': '…' }`). See `guides/passthrough.md`. In `<script>` a `pt` value is typed `BbDialogProps['pt']` (`PtValue` is not exported): § Typing `pt` in `<script>`. |
1850
+ | `actions` | `false \| readonly ActionButtonConfig[] \| undefined` | `undefined` | | Footer buttons replacing `ok` / `cancel`, in order: each runs its `onClick`, then completes the dialog with `data`. `false`: none. |
1788
1851
  | `adaptive` | `boolean \| undefined` | ``all.adaptive` (`true`)` | | On mobile, renders as a `BbOffCanvas` drawer instead of a centred dialog; the surface is chosen when the dialog opens and kept until it closes. Unset: the global `all.adaptive`. |
1852
+ | `cancel` | `BbAction \| undefined` | | | The dismiss button, before `ok`: `true` (the locale's Cancel), a label, or a button config. Clicked: its `onClick`, then the dialog closes as a dismissal (`reason: 'close'`). Unset: no button. |
1789
1853
  | `defaultData` | `Record<string, any> \| undefined` | | | What `data` is when an opening passes none (a create): an object, copied at once, so inputs bind `data.x` with no guard. An opening's data lays over it (`{ ...defaultData, ...row }`, one level). `reset()` restores its keys but keeps an edit's `id`; a close restores it. |
1790
1854
  | `description` | `string \| undefined` | | | One short line under the title, muted (the shadcn `DialogDescription` shape), and the only element `aria-describedby` points at. Keep it to a sentence; anything longer belongs in the body. |
1791
1855
  | `eager` | `boolean \| undefined` | `false` | | Keep the body mounted while closed, from before the first opening. Without it the body mounts per opening and unmounts after `@hidden`. `data` still clears while closed, so an eager body guards its reads. |
@@ -1796,6 +1860,7 @@ A `pt` value written in `<script>` (a constant, a preset, a wrapper's
1796
1860
  | `modelValue` | `boolean \| undefined` | `false` | | Used by v-model to open / close the dialog. A dialog with no `v-model` starts closed. |
1797
1861
  | `navigation` | `boolean \| undefined` | `false` | | Syncs the open state with the URL: opening writes `?<queryKey>=true`, closing removes it, a URL with the key opens the dialog on load, and Back closes it (refused whenever Escape is). Template dialogs only; keep a record id in your own query. |
1798
1862
  | `offCanvasProps` | `Partial<BbOffCanvasProps> \| undefined` | | | Props for the phone sheet (the `BbOffCanvas` that `adaptive` renders on mobile), spread over its defaults. A `pt` inside it styles only the sheet (passthrough guide § Inside the sheet). |
1863
+ | `ok` | `BbAction \| undefined` | | | The primary footer button: `true` (the locale's OK), a label, or a button config. Clicked: its `onClick`, else it submits the one `BbForm` inside, else `complete(data)`. Unset: no button. Config sets its look. |
1799
1864
  | `persistent` | `boolean \| undefined` | `false` | | Blocks closing by outside click or Escape. The header close (×) STILL closes a persistent dialog, the documented escape hatch: add `hideClose` to remove it, or use `preventClose` to block every dismissal. Programmatic close still works. |
1800
1865
  | `preventClose` | `boolean \| undefined` | ``undefined` (follows a saving form inside)` | | Refuses every user close (backdrop, Escape, the ✕, the slots' `close`) with the deny nudge; `v-model` still closes. Unset: locked while a `BbForm` inside saves (an async `@submit`). `true`: always; `false`: never, not even mid-save. Beside a form: `busy \|\| undefined`. |
1801
1866
  | `queryKey` | `string \| undefined` | `"dialog"` | | The query key `navigation` writes. |
@@ -1831,6 +1896,7 @@ States are listed in precedence order: when two are on at once and their entries
1831
1896
 
1832
1897
  ## Events
1833
1898
 
1899
+ - `complete` — `(value: any): void` — The dialog completes (`ok`, `complete(value)`): the same value as the opener's `onComplete`, before it. Return a promise to keep the dialog open and locked until it settles; `false` or a throw keeps it open.
1834
1900
  - `hidden` — `(): void` — Emitted after the close transition completes and the dialog is fully dismissed.
1835
1901
  - `hide` — `(result: BbDialogResult): void` — Emitted as soon as the dialog starts to close (model becomes false), with the opening's result: the same object its promise settles with, `{ completed: true, value }` or `{ completed: false, reason }`.
1836
1902
  - `show` — `(): void` — Emitted as soon as the dialog starts to open (model becomes true).