bitboss-ui 3.0.0-beta.4 → 3.0.0-beta.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (937) hide show
  1. package/README.md +317 -98
  2. package/bin/bitboss-ui-mcp.mjs +1566 -75
  3. package/bin/bitboss-ui.mjs +716 -72
  4. package/dist/ai/BbAccordion.md +178 -56
  5. package/dist/ai/BbAlert.md +140 -28
  6. package/dist/ai/BbAsterisk.md +61 -4
  7. package/dist/ai/BbAvatar.md +194 -53
  8. package/dist/ai/BbBadge.md +250 -50
  9. package/dist/ai/BbBadgeButton.md +74 -21
  10. package/dist/ai/BbBaseButton.md +132 -51
  11. package/dist/ai/BbBaseCheckboxIcon.md +118 -26
  12. package/dist/ai/BbBaseRadioIcon.md +115 -26
  13. package/dist/ai/BbBaseSwitchIcon.md +123 -28
  14. package/dist/ai/BbBreadcrumbs.md +221 -51
  15. package/dist/ai/BbButton.md +389 -107
  16. package/dist/ai/BbCalendar.md +667 -0
  17. package/dist/ai/BbCheckbox.md +242 -80
  18. package/dist/ai/BbCheckboxGroup.md +575 -66
  19. package/dist/ai/BbCollapsible.md +158 -39
  20. package/dist/ai/BbColorInput.md +322 -82
  21. package/dist/ai/BbColorPalette.md +261 -61
  22. package/dist/ai/BbConfirm.md +220 -51
  23. package/dist/ai/BbConfirmPortal.md +1 -1
  24. package/dist/ai/BbDatePicker.md +272 -37
  25. package/dist/ai/BbDatePickerInput.md +321 -92
  26. package/dist/ai/BbDialog.md +492 -87
  27. package/dist/ai/BbDropdown.md +1182 -104
  28. package/dist/ai/BbDropdownButton.md +239 -61
  29. package/dist/ai/BbDropdownGroup.md +5 -5
  30. package/dist/ai/BbDropzone.md +140 -36
  31. package/dist/ai/BbForm.md +1165 -40
  32. package/dist/ai/BbIcon.md +100 -33
  33. package/dist/ai/BbIndicator.md +79 -12
  34. package/dist/ai/BbNumberInput.md +257 -87
  35. package/dist/ai/BbOffCanvas.md +396 -91
  36. package/dist/ai/BbPagination.md +199 -32
  37. package/dist/ai/BbPopover.md +219 -54
  38. package/dist/ai/BbProgress.md +137 -71
  39. package/dist/ai/BbPtScope.md +136 -0
  40. package/dist/ai/BbRadio.md +234 -43
  41. package/dist/ai/BbRadioGroup.md +529 -91
  42. package/dist/ai/BbRating.md +243 -61
  43. package/dist/ai/BbSelect.md +690 -120
  44. package/dist/ai/BbSelectPopover.md +434 -122
  45. package/dist/ai/BbSlider.md +275 -79
  46. package/dist/ai/BbSmoothHeight.md +142 -34
  47. package/dist/ai/BbSpinner.md +179 -81
  48. package/dist/ai/BbSwitch.md +249 -63
  49. package/dist/ai/BbSwitchGroup.md +394 -65
  50. package/dist/ai/BbTable.md +1666 -222
  51. package/dist/ai/BbTabs.md +898 -178
  52. package/dist/ai/BbTabsList.md +81 -7
  53. package/dist/ai/BbTabsPanels.md +77 -0
  54. package/dist/ai/BbTabsRoot.md +16 -15
  55. package/dist/ai/BbTag.md +256 -76
  56. package/dist/ai/BbTextInput.md +480 -102
  57. package/dist/ai/BbTextarea.md +310 -96
  58. package/dist/ai/BbTimePicker.md +159 -24
  59. package/dist/ai/BbTimePickerInput.md +277 -46
  60. package/dist/ai/BbToast.md +286 -40
  61. package/dist/ai/BbToastPortal.md +3 -3
  62. package/dist/ai/BbTooltip.md +187 -34
  63. package/dist/ai/BbTree.md +260 -85
  64. package/dist/ai/ChipsBox.md +43 -2
  65. package/dist/ai/ClearableButton.md +12 -0
  66. package/dist/ai/CommaBox.md +2 -1
  67. package/dist/ai/CommonField.md +63 -0
  68. package/dist/ai/CommonFieldInput.md +90 -0
  69. package/dist/ai/CommonPopover.md +17 -12
  70. package/dist/ai/CommonTimeSelector.md +63 -0
  71. package/dist/ai/ErrorIcon.md +20 -0
  72. package/dist/ai/FlatListBox.md +41 -11
  73. package/dist/ai/GroupedListBox.md +42 -12
  74. package/dist/ai/ListBox.md +46 -11
  75. package/dist/ai/OptionsContainer.md +13 -10
  76. package/dist/ai/WarningIcon.md +20 -0
  77. package/dist/ai/changelog.json +4025 -141
  78. package/dist/ai/components.json +51872 -10136
  79. package/dist/ai/composables/useBbConfig.md +72 -11
  80. package/dist/ai/composables/useBbDropdownContext.md +168 -0
  81. package/dist/ai/composables/useBbFormContext.md +51 -24
  82. package/dist/ai/composables/useBbFormField.md +134 -0
  83. package/dist/ai/composables/useBbTableContext.md +41 -19
  84. package/dist/ai/composables/useConfirm.md +16 -8
  85. package/dist/ai/composables/useCountdown.md +1 -1
  86. package/dist/ai/composables/useId.md +10 -10
  87. package/dist/ai/composables/useMobile.md +17 -10
  88. package/dist/ai/composables/useToast.md +25 -19
  89. package/dist/ai/design-tokens.json +940 -0
  90. package/dist/ai/design-tokens.manifest.yaml +175 -0
  91. package/dist/ai/guides/agent-contract.md +168 -22
  92. package/dist/ai/guides/ai-router.md +79 -40
  93. package/dist/ai/guides/app-layout.md +8 -4
  94. package/dist/ai/guides/coherence-playbook.md +8 -8
  95. package/dist/ai/guides/component-picker.md +42 -34
  96. package/dist/ai/guides/design-language.md +274 -97
  97. package/dist/ai/guides/design-tokens.md +493 -105
  98. package/dist/ai/guides/fetch-items-playbook.md +22 -16
  99. package/dist/ai/guides/icons-policy.md +67 -35
  100. package/dist/ai/guides/inertia-helpers.md +4 -1
  101. package/dist/ai/guides/inline-edit-playbook.md +13 -6
  102. package/dist/ai/guides/installation-and-plugin-setup.md +817 -73
  103. package/dist/ai/guides/migration/components/bb-accordion.md +37 -0
  104. package/dist/ai/guides/migration/components/bb-alert.md +2 -2
  105. package/dist/ai/guides/migration/components/bb-avatar.md +13 -14
  106. package/dist/ai/guides/migration/components/bb-badge.md +5 -5
  107. package/dist/ai/guides/migration/components/bb-breadcrumbs.md +9 -8
  108. package/dist/ai/guides/migration/components/bb-button.md +80 -20
  109. package/dist/ai/guides/migration/components/bb-checkbox-group.md +116 -29
  110. package/dist/ai/guides/migration/components/bb-checkbox.md +53 -10
  111. package/dist/ai/guides/migration/components/bb-chip.md +6 -6
  112. package/dist/ai/guides/migration/components/bb-collapsible.md +5 -5
  113. package/dist/ai/guides/migration/components/bb-color-input.md +5 -5
  114. package/dist/ai/guides/migration/components/bb-color-palette.md +16 -9
  115. package/dist/ai/guides/migration/components/bb-date-picker-input.md +45 -35
  116. package/dist/ai/guides/migration/components/bb-dialog.md +69 -36
  117. package/dist/ai/guides/migration/components/bb-dropdown-button.md +7 -1
  118. package/dist/ai/guides/migration/components/bb-dropdown.md +31 -8
  119. package/dist/ai/guides/migration/components/bb-dropzone.md +8 -0
  120. package/dist/ai/guides/migration/components/bb-icon.md +7 -7
  121. package/dist/ai/guides/migration/components/bb-intersection.md +1 -1
  122. package/dist/ai/guides/migration/components/bb-offcanvas.md +29 -31
  123. package/dist/ai/guides/migration/components/bb-pagination.md +10 -0
  124. package/dist/ai/guides/migration/components/bb-popover.md +19 -11
  125. package/dist/ai/guides/migration/components/bb-radio-group.md +14 -0
  126. package/dist/ai/guides/migration/components/bb-rating.md +61 -24
  127. package/dist/ai/guides/migration/components/bb-select-popover.md +9 -1
  128. package/dist/ai/guides/migration/components/bb-select.md +21 -4
  129. package/dist/ai/guides/migration/components/bb-slider.md +14 -6
  130. package/dist/ai/guides/migration/components/bb-switch-group.md +14 -0
  131. package/dist/ai/guides/migration/components/bb-table.md +574 -33
  132. package/dist/ai/guides/migration/components/bb-tabs.md +91 -41
  133. package/dist/ai/guides/migration/components/bb-tag.md +9 -7
  134. package/dist/ai/guides/migration/components/bb-text-input.md +12 -12
  135. package/dist/ai/guides/migration/components/bb-toast.md +2 -2
  136. package/dist/ai/guides/migration/components/bb-tooltip.md +18 -0
  137. package/dist/ai/guides/migration/components/bb-tree.md +11 -9
  138. package/dist/ai/guides/migration/components/use-confirm.md +9 -1
  139. package/dist/ai/guides/migration/v2-to-v3.md +828 -240
  140. package/dist/ai/guides/migration/v3-beta-css-classes.md +751 -0
  141. package/dist/ai/guides/migration/v3-beta-tooling.md +119 -0
  142. package/dist/ai/guides/options-items-playbook.md +161 -12
  143. package/dist/ai/guides/page-shell.md +1 -1
  144. package/dist/ai/guides/passthrough.md +958 -0
  145. package/dist/ai/guides/preset-components.md +361 -0
  146. package/dist/ai/guides/ssr-prefill.md +127 -0
  147. package/dist/ai/guides/validated-forms.md +466 -55
  148. package/dist/ai/guides/validation-libraries.md +171 -0
  149. package/dist/ai/guides/validation-providers.md +113 -0
  150. package/dist/ai/index.md +45 -44
  151. package/dist/ai/recipes/inertia/approvals-inbox.md +26 -10
  152. package/dist/ai/recipes/inertia/command-palette.md +2 -2
  153. package/dist/ai/recipes/inertia/inline-edit-workspace.md +46 -30
  154. package/dist/ai/recipes/inertia/layout-scaffold.md +6 -2
  155. package/dist/ai/recipes/inertia/onboarding.md +30 -8
  156. package/dist/ai/recipes/inertia/ownership-atlas.md +72 -49
  157. package/dist/ai/recipes/inertia/record-form.md +53 -19
  158. package/dist/ai/recipes/inertia/records-workspace.md +201 -49
  159. package/dist/ai/recipes/inertia/settings-workspace.md +3809 -0
  160. package/dist/ai/recipes/inertia/upload-center.md +54 -43
  161. package/dist/ai/recipes/inertia/wizard-form.md +98 -14
  162. package/dist/ai/recipes/nuxt/approvals-inbox.md +26 -10
  163. package/dist/ai/recipes/nuxt/command-palette.md +2 -2
  164. package/dist/ai/recipes/nuxt/inline-edit-workspace.md +68 -52
  165. package/dist/ai/recipes/nuxt/layout-scaffold.md +6 -2
  166. package/dist/ai/recipes/nuxt/onboarding.md +30 -8
  167. package/dist/ai/recipes/nuxt/record-form.md +66 -22
  168. package/dist/ai/recipes/nuxt/records-workspace.md +199 -48
  169. package/dist/ai/recipes/nuxt/settings-workspace.md +3898 -0
  170. package/dist/ai/recipes/nuxt/upload-center.md +52 -41
  171. package/dist/ai/recipes/nuxt/wizard-form.md +98 -14
  172. package/dist/ai/recipes/vue/approvals-inbox.md +28 -12
  173. package/dist/ai/recipes/vue/command-palette.md +2 -2
  174. package/dist/ai/recipes/vue/inline-edit-workspace.md +69 -53
  175. package/dist/ai/recipes/vue/layout-scaffold.md +6 -2
  176. package/dist/ai/recipes/vue/onboarding.md +32 -8
  177. package/dist/ai/recipes/vue/record-form.md +81 -54
  178. package/dist/ai/recipes/vue/records-workspace.md +198 -49
  179. package/dist/ai/recipes/vue/settings-workspace.md +3836 -0
  180. package/dist/ai/recipes/vue/upload-center.md +53 -42
  181. package/dist/ai/recipes/vue/wizard-form.md +97 -14
  182. package/dist/ai/source/BbAccordion.md +90 -24
  183. package/dist/ai/source/BbAlert.md +209 -62
  184. package/dist/ai/source/BbAsterisk.md +54 -4
  185. package/dist/ai/source/BbAvatar.md +73 -16
  186. package/dist/ai/source/BbBadge.md +265 -97
  187. package/dist/ai/source/BbBadgeButton.md +218 -79
  188. package/dist/ai/source/BbBaseButton.md +108 -12
  189. package/dist/ai/source/BbBaseCheckboxIcon.md +151 -36
  190. package/dist/ai/source/BbBaseRadioIcon.md +121 -17
  191. package/dist/ai/source/BbBaseSwitchIcon.md +138 -28
  192. package/dist/ai/source/BbBreadcrumbs.md +363 -69
  193. package/dist/ai/source/BbButton.md +563 -174
  194. package/dist/ai/source/BbCalendar.md +1744 -0
  195. package/dist/ai/source/BbCheckbox.md +470 -68
  196. package/dist/ai/source/BbCheckboxGroup.md +976 -95
  197. package/dist/ai/source/BbCollapsible.md +96 -8
  198. package/dist/ai/source/BbColorInput.md +597 -67
  199. package/dist/ai/source/BbColorPalette.md +1284 -65
  200. package/dist/ai/source/BbConfirm.md +149 -7
  201. package/dist/ai/source/BbConfirmPortal.md +89 -3
  202. package/dist/ai/source/BbDatePicker.md +527 -381
  203. package/dist/ai/source/BbDatePickerInput.md +2015 -118
  204. package/dist/ai/source/BbDialog.md +531 -64
  205. package/dist/ai/source/BbDropdown.md +885 -175
  206. package/dist/ai/source/BbDropdownButton.md +377 -79
  207. package/dist/ai/source/BbDropdownGroup.md +687 -96
  208. package/dist/ai/source/BbDropzone.md +140 -31
  209. package/dist/ai/source/BbForm.md +875 -17
  210. package/dist/ai/source/BbIcon.md +130 -52
  211. package/dist/ai/source/BbIndicator.md +117 -60
  212. package/dist/ai/source/BbNumberInput.md +667 -84
  213. package/dist/ai/source/BbOffCanvas.md +1007 -261
  214. package/dist/ai/source/BbPagination.md +203 -31
  215. package/dist/ai/source/BbPopover.md +267 -90
  216. package/dist/ai/source/BbProgress.md +88 -26
  217. package/dist/ai/source/BbPtScope.md +54 -0
  218. package/dist/ai/source/BbRadio.md +388 -58
  219. package/dist/ai/source/BbRadioGroup.md +940 -109
  220. package/dist/ai/source/BbRating.md +736 -84
  221. package/dist/ai/source/BbSelect.md +1096 -96
  222. package/dist/ai/source/BbSelectPopover.md +807 -114
  223. package/dist/ai/source/BbSlider.md +1390 -98
  224. package/dist/ai/source/BbSmoothHeight.md +48 -2
  225. package/dist/ai/source/BbSpinner.md +62 -6
  226. package/dist/ai/source/BbSwitch.md +297 -60
  227. package/dist/ai/source/BbSwitchGroup.md +761 -83
  228. package/dist/ai/source/BbTable.md +6950 -1864
  229. package/dist/ai/source/BbTabs.md +368 -111
  230. package/dist/ai/source/BbTabsList.md +503 -146
  231. package/dist/ai/source/BbTabsPanels.md +625 -0
  232. package/dist/ai/source/BbTabsRoot.md +319 -100
  233. package/dist/ai/source/BbTag.md +796 -87
  234. package/dist/ai/source/BbTextInput.md +497 -68
  235. package/dist/ai/source/BbTextarea.md +550 -65
  236. package/dist/ai/source/BbTimePicker.md +395 -69
  237. package/dist/ai/source/BbTimePickerInput.md +1233 -106
  238. package/dist/ai/source/BbToast.md +250 -74
  239. package/dist/ai/source/BbToastPortal.md +210 -66
  240. package/dist/ai/source/BbTooltip.md +181 -30
  241. package/dist/ai/source/BbTree.md +76 -11
  242. package/dist/ai/source/ChipsBox.md +25 -5
  243. package/dist/ai/source/CommaBox.md +21 -6
  244. package/dist/ai/source/{BbBaseInputContainer.md → CommonField.md} +467 -250
  245. package/dist/ai/source/CommonFieldInput.md +848 -0
  246. package/dist/ai/source/CommonPopover.md +116 -30
  247. package/dist/ai/source/CommonTimeSelector.md +726 -0
  248. package/dist/ai/source/ErrorIcon.md +2 -2
  249. package/dist/ai/source/FlatListBox.md +188 -17
  250. package/dist/ai/source/GroupedListBox.md +236 -44
  251. package/dist/ai/source/GuidesComponent.md +14 -7
  252. package/dist/ai/source/ListBox.md +46 -8
  253. package/dist/ai/source/OptionsContainer.md +288 -60
  254. package/dist/ai/source/WarningIcon.md +2 -2
  255. package/dist/assets/css/reset.css_inline.js +1 -1
  256. package/dist/assets/svgs/star.svg_raw.js +4 -0
  257. package/dist/components/BbAccordion/BbAccordion.vue_vue_type_script_setup_true_lang.js +49 -32
  258. package/dist/components/BbAccordion/types.d.ts +35 -3
  259. package/dist/components/BbAccordion/types.js +11 -0
  260. package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +46 -30
  261. package/dist/components/BbAlert/types.d.ts +37 -3
  262. package/dist/components/BbAlert/types.js +13 -0
  263. package/dist/components/BbAsterisk/BbAsterisk.vue.d.ts +3 -1
  264. package/dist/components/BbAsterisk/BbAsterisk.vue_vue_type_script_setup_true_lang.js +23 -8
  265. package/dist/components/BbAsterisk/types.d.ts +18 -0
  266. package/dist/components/BbAsterisk/types.js +7 -0
  267. package/dist/components/BbAvatar/BbAvatar.vue.d.ts +1 -1
  268. package/dist/components/BbAvatar/BbAvatar.vue_vue_type_script_setup_true_lang.js +57 -44
  269. package/dist/components/BbAvatar/types.d.ts +23 -0
  270. package/dist/components/BbAvatar/types.js +7 -0
  271. package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +24 -18
  272. package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +96 -53
  273. package/dist/components/BbBadge/BbBadgeButton.vue_vue_type_script_setup_true_lang.js +27 -8
  274. package/dist/components/BbBadge/badgeButtonContext.d.ts +25 -8
  275. package/dist/components/BbBadge/types.d.ts +46 -3
  276. package/dist/components/BbBadge/types.js +13 -0
  277. package/dist/components/BbBaseButton/BbBaseButton.vue_vue_type_script_setup_true_lang.js +109 -96
  278. package/dist/components/BbBaseButton/RouterComponent.vue_vue_type_script_setup_true_lang.js +11 -11
  279. package/dist/components/BbBaseButton/types.d.ts +33 -3
  280. package/dist/components/BbBaseButton/types.js +9 -2
  281. package/dist/components/BbBaseCheckboxIcon/BbBaseCheckboxIcon.vue_vue_type_script_setup_true_lang.js +50 -18
  282. package/dist/components/BbBaseCheckboxIcon/types.d.ts +31 -2
  283. package/dist/components/BbBaseCheckboxIcon/types.js +8 -0
  284. package/dist/components/BbBaseRadioIcon/BbBaseRadioIcon.vue_vue_type_script_setup_true_lang.js +45 -15
  285. package/dist/components/BbBaseRadioIcon/types.d.ts +31 -2
  286. package/dist/components/BbBaseRadioIcon/types.js +8 -0
  287. package/dist/components/BbBaseSwitchIcon/BbBaseSwitchIcon.vue_vue_type_script_setup_true_lang.js +48 -16
  288. package/dist/components/BbBaseSwitchIcon/types.d.ts +31 -2
  289. package/dist/components/BbBaseSwitchIcon/types.js +8 -0
  290. package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +187 -132
  291. package/dist/components/BbBreadcrumbs/types.d.ts +45 -3
  292. package/dist/components/BbBreadcrumbs/types.js +12 -0
  293. package/dist/components/BbButton/BbButton.vue.d.ts +5 -0
  294. package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +107 -81
  295. package/dist/components/BbButton/types.d.ts +113 -2
  296. package/dist/components/BbButton/types.js +12 -0
  297. package/dist/components/BbCalendar/BbCalendar.vue.d.ts +34 -0
  298. package/dist/components/BbCalendar/BbCalendar.vue.js +6 -0
  299. package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +608 -0
  300. package/dist/components/BbCalendar/CalendarMonthPanel.vue.js +5 -0
  301. package/dist/components/BbCalendar/CalendarMonthPanel.vue_vue_type_script_setup_true_lang.js +124 -0
  302. package/dist/components/BbCalendar/CalendarYearPanel.vue.js +5 -0
  303. package/dist/components/BbCalendar/CalendarYearPanel.vue_vue_type_script_setup_true_lang.js +126 -0
  304. package/dist/components/BbCalendar/calendarHost.d.ts +29 -0
  305. package/dist/components/BbCalendar/calendarHost.js +10 -0
  306. package/dist/components/BbCalendar/types.d.ts +225 -0
  307. package/dist/components/BbCalendar/types.js +29 -0
  308. package/dist/components/{BbBaseDatePicker/useDatePickerContext.d.ts → BbCalendar/useCalendarContext.d.ts} +10 -7
  309. package/dist/components/BbCalendar/useCalendarContext.js +11 -0
  310. package/dist/components/BbCalendar/useCalendarGrid.d.ts +208 -0
  311. package/dist/components/BbCalendar/useCalendarGrid.js +274 -0
  312. package/dist/components/BbCalendar/useDayGrid.d.ts +79 -0
  313. package/dist/components/BbCalendar/useDayGrid.js +204 -0
  314. package/dist/components/BbCalendar/useToday.d.ts +23 -0
  315. package/dist/components/BbCalendar/useToday.js +21 -0
  316. package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +7 -7
  317. package/dist/components/BbCheckbox/BbCheckbox.vue_vue_type_script_setup_true_lang.js +214 -72
  318. package/dist/components/BbCheckbox/types.d.ts +180 -13
  319. package/dist/components/BbCheckbox/types.js +8 -0
  320. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +15 -3
  321. package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +338 -90
  322. package/dist/components/BbCheckboxGroup/types.d.ts +195 -20
  323. package/dist/components/BbCheckboxGroup/types.js +10 -0
  324. package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +2 -1
  325. package/dist/components/BbCollapsible/BbCollapsible.vue_vue_type_script_setup_true_lang.js +41 -19
  326. package/dist/components/BbCollapsible/types.d.ts +44 -1
  327. package/dist/components/BbCollapsible/types.js +7 -0
  328. package/dist/components/BbColorInput/BbColorInput.vue.d.ts +17 -7
  329. package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +330 -86
  330. package/dist/components/BbColorInput/types.d.ts +230 -12
  331. package/dist/components/BbColorInput/types.js +24 -0
  332. package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +10 -2
  333. package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +515 -108
  334. package/dist/components/BbColorPalette/types.d.ts +76 -7
  335. package/dist/components/BbColorPalette/types.js +12 -0
  336. package/dist/components/BbConfirm/BbConfirm.vue.d.ts +2 -1
  337. package/dist/components/BbConfirm/BbConfirm.vue_vue_type_script_setup_true_lang.js +125 -76
  338. package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +1 -0
  339. package/dist/components/BbConfirm/types.d.ts +49 -0
  340. package/dist/components/BbConfirm/types.js +17 -0
  341. package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +16 -10
  342. package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +320 -223
  343. package/dist/components/BbDatePicker/types.d.ts +111 -17
  344. package/dist/components/BbDatePicker/types.js +33 -0
  345. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +16 -4
  346. package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +1172 -87
  347. package/dist/components/BbDatePickerInput/types.d.ts +224 -19
  348. package/dist/components/BbDatePickerInput/types.js +39 -0
  349. package/dist/components/BbDialog/BbDialog.vue.d.ts +3 -3
  350. package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +227 -136
  351. package/dist/components/BbDialog/types.d.ts +92 -3
  352. package/dist/components/BbDialog/types.js +16 -0
  353. package/dist/components/BbDialog/useDialogStack.d.ts +12 -0
  354. package/dist/components/BbDialog/useDialogStack.js +9 -2
  355. package/dist/components/BbDropdown/AdaptiveDropdown.vue.d.ts +2 -0
  356. package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +108 -96
  357. package/dist/components/BbDropdown/BbDropdown.vue.d.ts +10 -2
  358. package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +337 -268
  359. package/dist/components/BbDropdown/BbDropdownGroup.vue.d.ts +5 -1
  360. package/dist/components/BbDropdown/BbDropdownList.vue.d.ts +8 -2
  361. package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +377 -293
  362. package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +129 -118
  363. package/dist/components/BbDropdown/normalizeGroups.js +55 -31
  364. package/dist/components/BbDropdown/types.d.ts +288 -30
  365. package/dist/components/BbDropdown/types.js +21 -2
  366. package/dist/components/BbDropdown/useDropdownContext.d.ts +10 -4
  367. package/dist/components/BbDropdown/useDropdownGroupRegistry.d.ts +1 -0
  368. package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +18 -3
  369. package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +172 -40
  370. package/dist/components/BbDropdownButton/types.d.ts +137 -8
  371. package/dist/components/BbDropdownButton/types.js +35 -0
  372. package/dist/components/BbDropzone/BbDropzone.vue.d.ts +2 -2
  373. package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +186 -144
  374. package/dist/components/BbDropzone/types.d.ts +38 -4
  375. package/dist/components/BbDropzone/types.js +16 -0
  376. package/dist/components/BbForm/BbForm.vue.d.ts +94 -0
  377. package/dist/{validated → components/BbForm}/BbForm.vue.js +1 -1
  378. package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +317 -0
  379. package/dist/components/BbForm/BbFormCustomField.d.ts +14 -0
  380. package/dist/components/BbForm/BbFormCustomField.js +43 -0
  381. package/dist/components/BbForm/bindFormField.d.ts +16 -0
  382. package/dist/components/BbForm/bindFormField.js +85 -0
  383. package/dist/components/BbForm/formFields.d.ts +64 -0
  384. package/dist/components/BbForm/formFields.js +11 -0
  385. package/dist/components/BbForm/formSchema.d.ts +56 -0
  386. package/dist/components/BbForm/formSchema.js +196 -0
  387. package/dist/components/BbForm/standardSchema.d.ts +59 -0
  388. package/dist/components/BbIcon/BbIcon.vue_vue_type_script_setup_true_lang.js +58 -48
  389. package/dist/components/BbIcon/iconCache.d.ts +63 -0
  390. package/dist/components/BbIcon/iconCache.js +35 -0
  391. package/dist/components/BbIcon/types.d.ts +22 -2
  392. package/dist/components/BbIcon/types.js +7 -0
  393. package/dist/components/BbIndicator/BbIndicator.vue_vue_type_script_setup_true_lang.js +34 -21
  394. package/dist/components/BbIndicator/types.d.ts +24 -0
  395. package/dist/components/BbIndicator/types.js +7 -0
  396. package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +12 -8
  397. package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +308 -85
  398. package/dist/components/BbNumberInput/types.d.ts +201 -18
  399. package/dist/components/BbNumberInput/types.js +8 -0
  400. package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +3 -3
  401. package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +311 -210
  402. package/dist/components/BbOffCanvas/types.d.ts +79 -6
  403. package/dist/components/BbOffCanvas/types.js +15 -0
  404. package/dist/components/BbPagination/BbPagination.vue.d.ts +2 -2
  405. package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +125 -90
  406. package/dist/components/BbPagination/types.d.ts +38 -0
  407. package/dist/components/BbPagination/types.js +13 -0
  408. package/dist/components/BbPopover/BbPopover.vue.d.ts +4 -4
  409. package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +219 -179
  410. package/dist/components/BbPopover/types.d.ts +51 -5
  411. package/dist/components/BbPopover/types.js +14 -0
  412. package/dist/components/BbProgress/BbProgress.vue_vue_type_script_setup_true_lang.js +29 -16
  413. package/dist/components/BbProgress/types.d.ts +25 -0
  414. package/dist/components/BbProgress/types.js +7 -0
  415. package/dist/components/BbPtScope/BbPtScope.vue.d.ts +12 -0
  416. package/dist/components/BbPtScope/BbPtScope.vue.js +5 -0
  417. package/dist/components/BbPtScope/BbPtScope.vue_vue_type_script_setup_true_lang.js +13 -0
  418. package/dist/components/BbPtScope/types.d.ts +15 -0
  419. package/dist/components/BbRadio/BbRadio.vue.d.ts +7 -7
  420. package/dist/components/BbRadio/BbRadio.vue_vue_type_script_setup_true_lang.js +172 -59
  421. package/dist/components/BbRadio/types.d.ts +152 -13
  422. package/dist/components/BbRadio/types.js +8 -0
  423. package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +14 -2
  424. package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +319 -92
  425. package/dist/components/BbRadioGroup/types.d.ts +198 -22
  426. package/dist/components/BbRadioGroup/types.js +10 -0
  427. package/dist/components/BbRating/BbRating.vue.d.ts +10 -8
  428. package/dist/components/BbRating/BbRating.vue_vue_type_script_setup_true_lang.js +259 -78
  429. package/dist/components/BbRating/types.d.ts +174 -13
  430. package/dist/components/BbRating/types.js +21 -0
  431. package/dist/components/BbSelect/BbSelect.vue.d.ts +17 -3
  432. package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +553 -83
  433. package/dist/components/BbSelect/types.d.ts +235 -20
  434. package/dist/components/BbSelect/types.js +41 -0
  435. package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +15 -1
  436. package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +541 -391
  437. package/dist/components/BbSelectPopover/types.d.ts +124 -8
  438. package/dist/components/BbSelectPopover/types.js +24 -0
  439. package/dist/components/BbSlider/BbSlider.vue.d.ts +13 -8
  440. package/dist/components/BbSlider/BbSlider.vue_vue_type_script_setup_true_lang.js +472 -96
  441. package/dist/components/BbSlider/types.d.ts +202 -13
  442. package/dist/components/BbSlider/types.js +26 -0
  443. package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +1 -1
  444. package/dist/components/BbSmoothHeight/BbSmoothHeight.vue_vue_type_script_setup_true_lang.js +60 -48
  445. package/dist/components/BbSmoothHeight/types.d.ts +19 -0
  446. package/dist/components/BbSmoothHeight/types.js +7 -0
  447. package/dist/components/BbSpinner/BbSpinner.vue_vue_type_script_setup_true_lang.js +27 -14
  448. package/dist/components/BbSpinner/types.d.ts +22 -1
  449. package/dist/components/BbSpinner/types.js +7 -0
  450. package/dist/components/BbSwitch/BbSwitch.vue.d.ts +7 -7
  451. package/dist/components/BbSwitch/BbSwitch.vue_vue_type_script_setup_true_lang.js +220 -78
  452. package/dist/components/BbSwitch/types.d.ts +25 -10
  453. package/dist/components/BbSwitch/types.js +5 -0
  454. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue.d.ts +14 -2
  455. package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +338 -90
  456. package/dist/components/BbSwitchGroup/types.d.ts +30 -7
  457. package/dist/components/BbSwitchGroup/types.js +5 -0
  458. package/dist/components/BbTable/BbTable.vue.d.ts +27 -6
  459. package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +2013 -685
  460. package/dist/components/BbTable/BbTableDataRow.d.ts +196 -0
  461. package/dist/components/BbTable/BbTableDataRow.js +151 -0
  462. package/dist/components/BbTable/BbTableExpandRow.d.ts +84 -0
  463. package/dist/components/BbTable/BbTableExpandRow.js +62 -0
  464. package/dist/components/BbTable/BbTableSelectToggle.d.ts +120 -0
  465. package/dist/components/BbTable/BbTableSelectToggle.js +122 -0
  466. package/dist/components/BbTable/gridWidgets.d.ts +30 -0
  467. package/dist/components/BbTable/gridWidgets.js +14 -0
  468. package/dist/components/BbTable/types.d.ts +473 -123
  469. package/dist/components/BbTable/types.js +31 -0
  470. package/dist/components/BbTable/utils.d.ts +145 -4
  471. package/dist/components/BbTable/utils.js +154 -37
  472. package/dist/components/BbTabs/BbTabs.vue.d.ts +3 -1
  473. package/dist/components/BbTabs/BbTabs.vue_vue_type_script_setup_true_lang.js +62 -26
  474. package/dist/components/BbTabs/BbTabsList.vue.d.ts +3 -10
  475. package/dist/components/BbTabs/BbTabsList.vue_vue_type_script_setup_true_lang.js +143 -81
  476. package/dist/components/BbTabs/BbTabsPanels.vue.d.ts +12 -0
  477. package/dist/components/{BbBaseSwitch/BbBaseSwitch.vue.js → BbTabs/BbTabsPanels.vue.js} +2 -2
  478. package/dist/components/BbTabs/BbTabsPanels.vue_vue_type_script_setup_true_lang.js +59 -0
  479. package/dist/components/BbTabs/BbTabsRoot.vue.d.ts +3 -1
  480. package/dist/components/BbTabs/BbTabsRoot.vue_vue_type_script_setup_true_lang.js +2 -1
  481. package/dist/components/BbTabs/types.d.ts +183 -23
  482. package/dist/components/BbTabs/types.js +34 -0
  483. package/dist/components/BbTag/BbTag.vue.d.ts +13 -10
  484. package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +383 -92
  485. package/dist/components/BbTag/types.d.ts +139 -14
  486. package/dist/components/BbTag/types.js +22 -0
  487. package/dist/components/BbTextInput/BbTextInput.vue.d.ts +10 -8
  488. package/dist/components/BbTextInput/BbTextInput.vue_vue_type_script_setup_true_lang.js +257 -84
  489. package/dist/components/BbTextInput/types.d.ts +168 -13
  490. package/dist/components/BbTextInput/types.js +8 -0
  491. package/dist/components/BbTextarea/BbTextarea.vue.d.ts +7 -7
  492. package/dist/components/BbTextarea/BbTextarea.vue_vue_type_script_setup_true_lang.js +291 -94
  493. package/dist/components/BbTextarea/types.d.ts +158 -14
  494. package/dist/components/BbTextarea/types.js +8 -0
  495. package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +12 -4
  496. package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +199 -122
  497. package/dist/components/BbTimePicker/types.d.ts +94 -7
  498. package/dist/components/BbTimePicker/types.js +18 -0
  499. package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +14 -4
  500. package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +749 -86
  501. package/dist/components/BbTimePickerInput/types.d.ts +171 -22
  502. package/dist/components/BbTimePickerInput/types.js +25 -0
  503. package/dist/components/BbToast/BbToast.vue_vue_type_script_setup_true_lang.js +63 -25
  504. package/dist/components/BbToast/BbToastMessage.vue.d.ts +4 -1
  505. package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +79 -76
  506. package/dist/components/BbToast/BbToastPortal.vue.d.ts +1 -0
  507. package/dist/components/BbToast/BbToastRegion.vue.d.ts +4 -1
  508. package/dist/components/BbToast/BbToastRegion.vue_vue_type_script_setup_true_lang.js +72 -64
  509. package/dist/components/BbToast/types.d.ts +54 -1
  510. package/dist/components/BbToast/types.js +28 -0
  511. package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +104 -87
  512. package/dist/components/BbTooltip/types.d.ts +40 -2
  513. package/dist/components/BbTooltip/types.js +7 -0
  514. package/dist/components/BbTree/BbTree.vue.d.ts +15 -3
  515. package/dist/components/BbTree/BbTree.vue_vue_type_script_setup_true_lang.js +51 -29
  516. package/dist/components/BbTree/BbTreeLevel.vue.d.ts +1 -1
  517. package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +17 -16
  518. package/dist/components/BbTree/context.d.ts +9 -1
  519. package/dist/components/BbTree/types.d.ts +40 -5
  520. package/dist/components/BbTree/types.js +7 -0
  521. package/dist/components/ChipsBox/ChipsBox.vue_vue_type_script_setup_true_lang.js +46 -44
  522. package/dist/components/ChipsBox/types.d.ts +7 -0
  523. package/dist/components/ClearableButton/ClearableButton.vue_vue_type_script_setup_true_lang.js +5 -5
  524. package/dist/components/CommaBox/CommaBox.vue_vue_type_script_setup_true_lang.js +11 -7
  525. package/dist/components/CommaBox/types.d.ts +7 -0
  526. package/dist/components/{BbBaseInputContainer/BbBaseInputContainer.vue.d.ts → CommonField/CommonField.vue.d.ts} +5 -5
  527. package/dist/components/{BbBaseRadio/BbBaseRadio.vue.js → CommonField/CommonField.vue.js} +2 -2
  528. package/dist/components/CommonField/CommonField.vue_vue_type_script_setup_true_lang.js +189 -0
  529. package/dist/components/CommonField/messageHeightMatrix.d.ts +2 -0
  530. package/dist/components/{BbBaseInputContainer → CommonField}/types.d.ts +52 -16
  531. package/dist/components/{CommonInputWrapper/CommonInputWrapper.vue.d.ts → CommonFieldInput/CommonFieldInput.vue.d.ts} +5 -4
  532. package/dist/components/{BbBaseRadioGroup/BbBaseRadioGroup.vue.js → CommonFieldInput/CommonFieldInput.vue.js} +2 -2
  533. package/dist/components/CommonFieldInput/CommonFieldInput.vue_vue_type_script_setup_true_lang.js +120 -0
  534. package/dist/components/CommonFieldInput/boxBorderMatrix.d.ts +10 -0
  535. package/dist/components/{CommonInputWrapper → CommonFieldInput}/types.d.ts +27 -8
  536. package/dist/components/CommonPopover/CommonPopover.vue.d.ts +11 -2
  537. package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +76 -63
  538. package/dist/components/CommonPopover/types.d.ts +27 -8
  539. package/dist/components/{BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.d.ts → CommonTimeSelector/CommonTimeSelector.vue.d.ts} +21 -2
  540. package/dist/components/{BbBaseColorPalette/BbBaseColorPalette.vue.js → CommonTimeSelector/CommonTimeSelector.vue.js} +2 -2
  541. package/dist/components/CommonTimeSelector/CommonTimeSelector.vue_vue_type_script_setup_true_lang.js +232 -0
  542. package/dist/components/CommonTimeSelector/types.d.ts +6 -0
  543. package/dist/components/FlatListBox/FlatListBox.vue.d.ts +5 -1
  544. package/dist/components/FlatListBox/FlatListBox.vue_vue_type_script_setup_true_lang.js +165 -95
  545. package/dist/components/FlatListBox/types.d.ts +24 -2
  546. package/dist/components/GroupedListBox/GroupedListBox.vue.d.ts +5 -1
  547. package/dist/components/GroupedListBox/GroupedListBox.vue_vue_type_script_setup_true_lang.js +217 -134
  548. package/dist/components/GroupedListBox/types.d.ts +24 -2
  549. package/dist/components/ListBox/ListBox.vue.d.ts +5 -1
  550. package/dist/components/ListBox/ListBox.vue_vue_type_script_setup_true_lang.js +95 -69
  551. package/dist/components/ListBox/types.d.ts +24 -2
  552. package/dist/components/OptionsContainer/OptionsContainer.vue.d.ts +1 -1
  553. package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +109 -37
  554. package/dist/components/OptionsContainer/types.d.ts +53 -9
  555. package/dist/components/Transitions/ScaleFade.vue_vue_type_script_setup_true_lang.js +8 -8
  556. package/dist/components/Transitions/Slide.vue.js +1 -1
  557. package/dist/composables/useBaseOptions.d.ts +12 -1
  558. package/dist/composables/useBaseOptions.js +77 -37
  559. package/dist/composables/useBbConfig.d.ts +27 -6
  560. package/dist/composables/useBbConfig.js +8 -2
  561. package/dist/composables/useBbDropdownContext.d.ts +5 -0
  562. package/dist/composables/useBbFormContext.d.ts +131 -8
  563. package/dist/composables/useBbFormContext.js +49 -30
  564. package/dist/composables/useBbFormField.d.ts +40 -0
  565. package/dist/composables/useBbFormField.js +39 -0
  566. package/dist/composables/useBbTableContext.d.ts +45 -1
  567. package/dist/composables/useBbTableContext.js +93 -87
  568. package/dist/composables/useBbTabsContext.d.ts +15 -9
  569. package/dist/composables/useBbTabsContext.js +121 -90
  570. package/dist/composables/useClosingInert.d.ts +4 -4
  571. package/dist/composables/useCoarsePointer.js +7 -10
  572. package/dist/composables/useCoherence.js +1 -1
  573. package/dist/composables/useConfig.d.ts +59 -0
  574. package/dist/composables/useConfig.js +15 -0
  575. package/dist/composables/useConfirm.d.ts +39 -7
  576. package/dist/composables/useConfirm.js +50 -41
  577. package/dist/composables/useEscapeStackEntry.d.ts +13 -0
  578. package/dist/composables/useEscapeStackEntry.js +16 -0
  579. package/dist/composables/useFormBinding.d.ts +116 -0
  580. package/dist/composables/useFormBinding.js +34 -0
  581. package/dist/composables/useHydrated.d.ts +18 -0
  582. package/dist/composables/useHydrated.js +13 -7
  583. package/dist/composables/useId.d.ts +4 -3
  584. package/dist/composables/useId.js +1 -7
  585. package/dist/composables/useItemsGetter.d.ts +11 -0
  586. package/dist/composables/useItemsGetter.js +44 -18
  587. package/dist/composables/useKeyboardInset.d.ts +28 -0
  588. package/dist/composables/useKeyboardInset.js +32 -0
  589. package/dist/composables/useLocale.js +10 -7
  590. package/dist/composables/useMobile.js +7 -10
  591. package/dist/composables/usePassthrough.d.ts +228 -0
  592. package/dist/composables/usePassthrough.js +247 -0
  593. package/dist/composables/usePrefill.d.ts +22 -2
  594. package/dist/composables/usePrefill.js +35 -19
  595. package/dist/composables/useSafeAreaInternal.js +1 -1
  596. package/dist/composables/useSegmentedFields.d.ts +2 -2
  597. package/dist/composables/useSsrState.d.ts +20 -0
  598. package/dist/composables/useSsrState.js +13 -0
  599. package/dist/composables/useTableWidthContext.d.ts +24 -4
  600. package/dist/composables/useTableWidthContext.js +31 -28
  601. package/dist/composables/useToast.d.ts +18 -1
  602. package/dist/composables/useToast.js +31 -18
  603. package/dist/composables/useToggleInput.d.ts +44 -0
  604. package/dist/composables/useToggleInput.js +39 -0
  605. package/dist/composables/useViewportWidth.d.ts +5 -25
  606. package/dist/composables/useViewportWidth.js +14 -7
  607. package/dist/deprecation/ai-deprecations.json.d.ts +1977 -289
  608. package/dist/deprecation/ai-deprecations.json.js +1 -1
  609. package/dist/deprecation/removedProps.js +9 -4
  610. package/dist/directives/bbDropdown.d.ts +15 -4
  611. package/dist/directives/bbDropdown.js +31 -9
  612. package/dist/directives/bbTooltip.d.ts +6 -0
  613. package/dist/directives/createPopoverDirective.d.ts +62 -0
  614. package/dist/directives/createPopoverDirective.js +92 -37
  615. package/dist/i18n/index.d.ts +10 -16
  616. package/dist/i18n/locales/cs.json +9 -5
  617. package/dist/i18n/locales/da.json +9 -5
  618. package/dist/i18n/locales/de.json +9 -5
  619. package/dist/i18n/locales/el.json +9 -5
  620. package/dist/i18n/locales/en.json +9 -5
  621. package/dist/i18n/locales/es.json +9 -5
  622. package/dist/i18n/locales/fi.json +9 -5
  623. package/dist/i18n/locales/fr.json +9 -5
  624. package/dist/i18n/locales/hu.json +9 -5
  625. package/dist/i18n/locales/it.json +9 -5
  626. package/dist/i18n/locales/ja.json +9 -5
  627. package/dist/i18n/locales/ko.json +9 -5
  628. package/dist/i18n/locales/nb.json +9 -5
  629. package/dist/i18n/locales/nl.json +9 -5
  630. package/dist/i18n/locales/pl.json +9 -5
  631. package/dist/i18n/locales/pt.json +9 -5
  632. package/dist/i18n/locales/ro.json +9 -5
  633. package/dist/i18n/locales/ru.json +9 -5
  634. package/dist/i18n/locales/sv.json +9 -5
  635. package/dist/i18n/locales/tr.json +9 -5
  636. package/dist/i18n/locales/uk.json +9 -5
  637. package/dist/i18n/locales/zh-cn.json +9 -5
  638. package/dist/icon-scan.d.ts +276 -0
  639. package/dist/icon-scan.js +485 -0
  640. package/dist/icons-whitelist.d.ts +5 -4
  641. package/dist/index.d.ts +40 -21
  642. package/dist/index.js +78 -71
  643. package/dist/llms-full.txt +61164 -27972
  644. package/dist/llms-medium.txt +1482 -366
  645. package/dist/llms.txt +32 -15
  646. package/dist/locale-blueprint.json +9 -5
  647. package/dist/nuxt-auto-imports.d.ts +76 -0
  648. package/dist/nuxt-auto-imports.js +32 -0
  649. package/dist/nuxt-module.d.ts +30 -15
  650. package/dist/nuxt.js +35 -9
  651. package/dist/passthrough-deduper.js +5 -0
  652. package/dist/plugin.d.ts +10 -1
  653. package/dist/plugin.js +29 -19
  654. package/dist/project-dts.d.ts +84 -0
  655. package/dist/project-dts.js +170 -0
  656. package/dist/reset.css +1 -1
  657. package/dist/runtime/nuxt-plugin.js +34 -21
  658. package/dist/styles.css +3 -2
  659. package/dist/types/AlertVariant.d.ts +10 -1
  660. package/dist/types/BadgeVariant.d.ts +16 -5
  661. package/dist/types/ButtonVariant.d.ts +12 -1
  662. package/dist/types/ColumnName.d.ts +30 -3
  663. package/dist/types/CommonProps.d.ts +2 -2
  664. package/dist/types/Config.d.ts +94 -1
  665. package/dist/types/ConfirmVariant.d.ts +8 -1
  666. package/dist/types/DropdownItemVariant.d.ts +8 -1
  667. package/dist/types/FieldLayout.d.ts +32 -0
  668. package/dist/types/IndicatorVariant.d.ts +11 -1
  669. package/dist/types/InputVariant.d.ts +30 -0
  670. package/dist/types/ItemProps.d.ts +50 -0
  671. package/dist/types/Option.d.ts +6 -0
  672. package/dist/types/PtScope.d.ts +15 -0
  673. package/dist/types/RegistryKey.d.ts +10 -0
  674. package/dist/types/TabsVariant.d.ts +25 -0
  675. package/dist/types/ToastVariant.d.ts +12 -2
  676. package/dist/types/TooltipVariant.d.ts +8 -1
  677. package/dist/types/passthrough.d.ts +362 -0
  678. package/dist/types/passthrough.js +78 -0
  679. package/dist/types/ptComponentMap.d.ts +62 -0
  680. package/dist/utilities/functions/hasVnodeListener.d.ts +16 -0
  681. package/dist/utilities/functions/hasVnodeListener.js +12 -0
  682. package/dist/utilities/functions/isImeComposing.d.ts +7 -0
  683. package/dist/utilities/functions/isImeComposing.js +4 -0
  684. package/dist/utilities/functions/itemProps.d.ts +46 -0
  685. package/dist/utilities/functions/itemProps.js +47 -0
  686. package/dist/utilities/functions/slotKey.d.ts +13 -8
  687. package/dist/utilities/functions/slotKey.js +78 -2
  688. package/dist/utilities/functions/snapToStep.js +2 -1
  689. package/dist/utilities/functions/toggleInput.d.ts +98 -0
  690. package/dist/utilities/functions/toggleInput.js +56 -0
  691. package/dist/utilities/functions/warnRemovedAttrs.d.ts +27 -1
  692. package/dist/utilities/functions/warnRemovedAttrs.js +75 -14
  693. package/dist/utilities/misc/listboxMetrics.d.ts +9 -3
  694. package/dist/utilities/misc/listboxMetrics.js +5 -2
  695. package/dist/utilities/misc/ssrStateInjectionKey.d.ts +42 -0
  696. package/dist/utilities/misc/ssrStateInjectionKey.js +4 -0
  697. package/dist/utils/cssLayers.d.ts +91 -0
  698. package/dist/utils/cssLayers.js +43 -0
  699. package/dist/utils/injectLibraryStyles.d.ts +3 -1
  700. package/dist/utils/injectLibraryStyles.js +24 -23
  701. package/dist/utils/overlayEscapeStack.d.ts +10 -0
  702. package/dist/utils/overlayEscapeStack.js +5 -3
  703. package/dist/utils/passthrough.d.ts +67 -0
  704. package/dist/utils/passthrough.js +100 -0
  705. package/dist/utils/passthroughDeduper.d.ts +2 -0
  706. package/dist/utils/ptScope.d.ts +8 -0
  707. package/dist/utils/ptScope.js +4 -0
  708. package/dist/utils/versionCheck.d.ts +19 -0
  709. package/dist/utils/versionCheck.js +18 -0
  710. package/dist/vite-plugin.d.ts +301 -53
  711. package/dist/vite.js +547 -375
  712. package/llms.txt +33 -16
  713. package/package.json +49 -27
  714. package/scripts/lib/check-fix.mjs +129 -0
  715. package/scripts/lib/component-attr-targets.ts +123 -0
  716. package/scripts/lib/component-tree.ts +648 -0
  717. package/scripts/lib/css-class-check.mjs +326 -0
  718. package/scripts/lib/css-class-surface.mjs +292 -0
  719. package/scripts/lib/css-color-resolve.mjs +172 -0
  720. package/scripts/lib/css-local-check.mjs +267 -0
  721. package/scripts/lib/design-token-manifest.mjs +499 -0
  722. package/scripts/lib/doc-sections.mjs +248 -0
  723. package/scripts/lib/ensure-manifest.mjs +28 -5
  724. package/scripts/lib/eslint-disable.mjs +141 -0
  725. package/scripts/lib/eslint-plugin.d.ts +64 -1
  726. package/scripts/lib/eslint-plugin.mjs +1285 -30
  727. package/scripts/lib/hand-imported-styles.mjs +326 -0
  728. package/scripts/lib/hand-roll-hints.mjs +50 -6
  729. package/scripts/lib/html-attributes.mjs +353 -0
  730. package/scripts/lib/local-components.mjs +177 -0
  731. package/scripts/lib/mcp-config.mjs +87 -58
  732. package/scripts/lib/migrate-fix.mjs +62 -3
  733. package/scripts/lib/project-variant-dts.mjs +122 -0
  734. package/scripts/lib/public-type-exports.mjs +273 -0
  735. package/scripts/lib/slot-key.mjs +147 -0
  736. package/scripts/lib/slot-renames.mjs +46 -0
  737. package/scripts/lib/squashed-slot-words.mjs +133 -0
  738. package/scripts/lib/validate-bb-markup.mjs +2213 -76
  739. package/scripts/lib/wrapper-props.mjs +188 -0
  740. package/dist/ai/BbBaseCheckbox.md +0 -49
  741. package/dist/ai/BbBaseCheckboxGroup.md +0 -64
  742. package/dist/ai/BbBaseColorInput.md +0 -65
  743. package/dist/ai/BbBaseColorPalette.md +0 -39
  744. package/dist/ai/BbBaseDatePicker.md +0 -43
  745. package/dist/ai/BbBaseDatePickerInput.md +0 -73
  746. package/dist/ai/BbBaseInputContainer.md +0 -48
  747. package/dist/ai/BbBaseNumberInput.md +0 -71
  748. package/dist/ai/BbBaseRadio.md +0 -46
  749. package/dist/ai/BbBaseRadioGroup.md +0 -64
  750. package/dist/ai/BbBaseRating.md +0 -52
  751. package/dist/ai/BbBaseSelect.md +0 -88
  752. package/dist/ai/BbBaseSlider.md +0 -56
  753. package/dist/ai/BbBaseSwitch.md +0 -49
  754. package/dist/ai/BbBaseSwitchGroup.md +0 -64
  755. package/dist/ai/BbBaseTag.md +0 -68
  756. package/dist/ai/BbBaseTextInput.md +0 -75
  757. package/dist/ai/BbBaseTextarea.md +0 -62
  758. package/dist/ai/BbBaseTimePickerInput.md +0 -62
  759. package/dist/ai/BbTabsPanes.md +0 -27
  760. package/dist/ai/CommonInputWrapper.md +0 -42
  761. package/dist/ai/source/BbBaseCheckbox.md +0 -461
  762. package/dist/ai/source/BbBaseCheckboxGroup.md +0 -554
  763. package/dist/ai/source/BbBaseColorInput.md +0 -431
  764. package/dist/ai/source/BbBaseColorPalette.md +0 -942
  765. package/dist/ai/source/BbBaseDatePicker.md +0 -1448
  766. package/dist/ai/source/BbBaseDatePickerInput.md +0 -1940
  767. package/dist/ai/source/BbBaseNumberInput.md +0 -617
  768. package/dist/ai/source/BbBaseRadio.md +0 -381
  769. package/dist/ai/source/BbBaseRadioGroup.md +0 -539
  770. package/dist/ai/source/BbBaseRating.md +0 -607
  771. package/dist/ai/source/BbBaseSelect.md +0 -945
  772. package/dist/ai/source/BbBaseSlider.md +0 -1144
  773. package/dist/ai/source/BbBaseSwitch.md +0 -246
  774. package/dist/ai/source/BbBaseSwitchGroup.md +0 -302
  775. package/dist/ai/source/BbBaseTag.md +0 -694
  776. package/dist/ai/source/BbBaseTextInput.md +0 -511
  777. package/dist/ai/source/BbBaseTextarea.md +0 -504
  778. package/dist/ai/source/BbBaseTimePickerInput.md +0 -1037
  779. package/dist/ai/source/BbTabsPanes.md +0 -377
  780. package/dist/ai/source/CommonInputWrapper.md +0 -584
  781. package/dist/alert-variants.d.ts +0 -19
  782. package/dist/assets/svgs/sort.svg_raw.js +0 -4
  783. package/dist/badge-variants.d.ts +0 -19
  784. package/dist/button-variants.d.ts +0 -21
  785. package/dist/components/BbBadge/BadgeAppendIcon.vue.d.ts +0 -3
  786. package/dist/components/BbBadge/BadgeAppendIcon.vue.js +0 -5
  787. package/dist/components/BbBadge/BadgeAppendIcon.vue_vue_type_script_setup_true_lang.js +0 -22
  788. package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.d.ts +0 -40
  789. package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue.js +0 -6
  790. package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue_vue_type_script_setup_true_lang.js +0 -145
  791. package/dist/components/BbBaseCheckbox/types.d.ts +0 -224
  792. package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.d.ts +0 -19
  793. package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue.js +0 -6
  794. package/dist/components/BbBaseCheckboxGroup/BbBaseCheckboxGroup.vue_vue_type_script_setup_true_lang.js +0 -190
  795. package/dist/components/BbBaseCheckboxGroup/types.d.ts +0 -257
  796. package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.d.ts +0 -43
  797. package/dist/components/BbBaseColorInput/BbBaseColorInput.vue.js +0 -6
  798. package/dist/components/BbBaseColorInput/BbBaseColorInput.vue_vue_type_script_setup_true_lang.js +0 -184
  799. package/dist/components/BbBaseColorInput/types.d.ts +0 -219
  800. package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue.d.ts +0 -13
  801. package/dist/components/BbBaseColorPalette/BbBaseColorPalette.vue_vue_type_script_setup_true_lang.js +0 -395
  802. package/dist/components/BbBaseColorPalette/types.d.ts +0 -40
  803. package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue.d.ts +0 -20
  804. package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue.js +0 -6
  805. package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue_vue_type_script_setup_true_lang.js +0 -407
  806. package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.d.ts +0 -47
  807. package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue.js +0 -5
  808. package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue_vue_type_script_setup_true_lang.js +0 -318
  809. package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.js +0 -5
  810. package/dist/components/BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue_vue_type_script_setup_true_lang.js +0 -115
  811. package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.js +0 -5
  812. package/dist/components/BbBaseDatePicker/BbBaseDatePickerYearSelector.vue_vue_type_script_setup_true_lang.js +0 -116
  813. package/dist/components/BbBaseDatePicker/types.d.ts +0 -108
  814. package/dist/components/BbBaseDatePicker/useDatePickerContext.js +0 -11
  815. package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.d.ts +0 -31
  816. package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue.js +0 -6
  817. package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue_vue_type_script_setup_true_lang.js +0 -737
  818. package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue.js +0 -6
  819. package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerTimeSelector.vue_vue_type_script_setup_true_lang.js +0 -204
  820. package/dist/components/BbBaseDatePickerInput/types.d.ts +0 -325
  821. package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.js +0 -6
  822. package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue_vue_type_script_setup_true_lang.js +0 -190
  823. package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.d.ts +0 -52
  824. package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue.js +0 -6
  825. package/dist/components/BbBaseNumberInput/BbBaseNumberInput.vue_vue_type_script_setup_true_lang.js +0 -215
  826. package/dist/components/BbBaseNumberInput/types.d.ts +0 -211
  827. package/dist/components/BbBaseRadio/BbBaseRadio.vue.d.ts +0 -33
  828. package/dist/components/BbBaseRadio/BbBaseRadio.vue_vue_type_script_setup_true_lang.js +0 -113
  829. package/dist/components/BbBaseRadio/types.d.ts +0 -179
  830. package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue.d.ts +0 -19
  831. package/dist/components/BbBaseRadioGroup/BbBaseRadioGroup.vue_vue_type_script_setup_true_lang.js +0 -179
  832. package/dist/components/BbBaseRadioGroup/types.d.ts +0 -223
  833. package/dist/components/BbBaseRating/BbBaseRating.vue.d.ts +0 -38
  834. package/dist/components/BbBaseRating/BbBaseRating.vue.js +0 -6
  835. package/dist/components/BbBaseRating/BbBaseRating.vue_vue_type_script_setup_true_lang.js +0 -192
  836. package/dist/components/BbBaseRating/types.d.ts +0 -176
  837. package/dist/components/BbBaseSelect/BbBaseSelect.vue.d.ts +0 -19
  838. package/dist/components/BbBaseSelect/BbBaseSelect.vue.js +0 -6
  839. package/dist/components/BbBaseSelect/BbBaseSelect.vue_vue_type_script_setup_true_lang.js +0 -311
  840. package/dist/components/BbBaseSelect/types.d.ts +0 -297
  841. package/dist/components/BbBaseSlider/BbBaseSlider.vue.d.ts +0 -35
  842. package/dist/components/BbBaseSlider/BbBaseSlider.vue.js +0 -6
  843. package/dist/components/BbBaseSlider/BbBaseSlider.vue_vue_type_script_setup_true_lang.js +0 -340
  844. package/dist/components/BbBaseSlider/types.d.ts +0 -200
  845. package/dist/components/BbBaseSwitch/BbBaseSwitch.vue.d.ts +0 -35
  846. package/dist/components/BbBaseSwitch/BbBaseSwitch.vue_vue_type_script_setup_true_lang.js +0 -146
  847. package/dist/components/BbBaseSwitch/types.d.ts +0 -10
  848. package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.d.ts +0 -19
  849. package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue.js +0 -6
  850. package/dist/components/BbBaseSwitchGroup/BbBaseSwitchGroup.vue_vue_type_script_setup_true_lang.js +0 -190
  851. package/dist/components/BbBaseSwitchGroup/types.d.ts +0 -8
  852. package/dist/components/BbBaseTag/BbBaseTag.vue.d.ts +0 -50
  853. package/dist/components/BbBaseTag/BbBaseTag.vue.js +0 -6
  854. package/dist/components/BbBaseTag/BbBaseTag.vue_vue_type_script_setup_true_lang.js +0 -266
  855. package/dist/components/BbBaseTag/types.d.ts +0 -160
  856. package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.d.ts +0 -45
  857. package/dist/components/BbBaseTextInput/BbBaseTextInput.vue.js +0 -6
  858. package/dist/components/BbBaseTextInput/BbBaseTextInput.vue_vue_type_script_setup_true_lang.js +0 -200
  859. package/dist/components/BbBaseTextInput/types.d.ts +0 -209
  860. package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.d.ts +0 -39
  861. package/dist/components/BbBaseTextarea/BbBaseTextarea.vue.js +0 -6
  862. package/dist/components/BbBaseTextarea/BbBaseTextarea.vue_vue_type_script_setup_true_lang.js +0 -187
  863. package/dist/components/BbBaseTextarea/types.d.ts +0 -170
  864. package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.d.ts +0 -27
  865. package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue.js +0 -6
  866. package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue_vue_type_script_setup_true_lang.js +0 -519
  867. package/dist/components/BbBaseTimePickerInput/types.d.ts +0 -151
  868. package/dist/components/BbTabs/BbTabsPanes.vue.d.ts +0 -16
  869. package/dist/components/BbTabs/BbTabsPanes.vue.js +0 -6
  870. package/dist/components/BbTabs/BbTabsPanes.vue_vue_type_script_setup_true_lang.js +0 -35
  871. package/dist/components/CommonInputWrapper/CommonInputWrapper.vue.js +0 -6
  872. package/dist/components/CommonInputWrapper/CommonInputWrapper.vue_vue_type_script_setup_true_lang.js +0 -107
  873. package/dist/confirm-variants.d.ts +0 -17
  874. package/dist/dropdown-item-variants.d.ts +0 -17
  875. package/dist/indicator-variants.d.ts +0 -20
  876. package/dist/locale-registry.d.ts +0 -37
  877. package/dist/toast-variants.d.ts +0 -20
  878. package/dist/tooltip-variants.d.ts +0 -17
  879. package/dist/types/InputDirection.d.ts +0 -15
  880. package/dist/validated/BbCheckbox.vue.d.ts +0 -29
  881. package/dist/validated/BbCheckbox.vue.js +0 -5
  882. package/dist/validated/BbCheckbox.vue_vue_type_script_setup_true_lang.js +0 -75
  883. package/dist/validated/BbCheckboxGroup.vue.d.ts +0 -34
  884. package/dist/validated/BbCheckboxGroup.vue.js +0 -5
  885. package/dist/validated/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +0 -82
  886. package/dist/validated/BbColorInput.vue.d.ts +0 -37
  887. package/dist/validated/BbColorInput.vue.js +0 -5
  888. package/dist/validated/BbColorInput.vue_vue_type_script_setup_true_lang.js +0 -75
  889. package/dist/validated/BbDatePickerInput.vue.d.ts +0 -41
  890. package/dist/validated/BbDatePickerInput.vue.js +0 -5
  891. package/dist/validated/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +0 -90
  892. package/dist/validated/BbDropzone.vue.d.ts +0 -24
  893. package/dist/validated/BbDropzone.vue.js +0 -5
  894. package/dist/validated/BbDropzone.vue_vue_type_script_setup_true_lang.js +0 -45
  895. package/dist/validated/BbForm.vue.d.ts +0 -28
  896. package/dist/validated/BbForm.vue_vue_type_script_setup_true_lang.js +0 -42
  897. package/dist/validated/BbNumberInput.vue.d.ts +0 -36
  898. package/dist/validated/BbNumberInput.vue.js +0 -5
  899. package/dist/validated/BbNumberInput.vue_vue_type_script_setup_true_lang.js +0 -72
  900. package/dist/validated/BbRadioGroup.vue.d.ts +0 -34
  901. package/dist/validated/BbRadioGroup.vue.js +0 -5
  902. package/dist/validated/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +0 -78
  903. package/dist/validated/BbRating.vue.d.ts +0 -30
  904. package/dist/validated/BbRating.vue.js +0 -5
  905. package/dist/validated/BbRating.vue_vue_type_script_setup_true_lang.js +0 -63
  906. package/dist/validated/BbSelect.vue.d.ts +0 -46
  907. package/dist/validated/BbSelect.vue.js +0 -5
  908. package/dist/validated/BbSelect.vue_vue_type_script_setup_true_lang.js +0 -109
  909. package/dist/validated/BbSlider.vue.d.ts +0 -36
  910. package/dist/validated/BbSlider.vue.js +0 -5
  911. package/dist/validated/BbSlider.vue_vue_type_script_setup_true_lang.js +0 -69
  912. package/dist/validated/BbSwitch.vue.d.ts +0 -29
  913. package/dist/validated/BbSwitch.vue.js +0 -5
  914. package/dist/validated/BbSwitch.vue_vue_type_script_setup_true_lang.js +0 -75
  915. package/dist/validated/BbSwitchGroup.vue.d.ts +0 -34
  916. package/dist/validated/BbSwitchGroup.vue.js +0 -5
  917. package/dist/validated/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +0 -82
  918. package/dist/validated/BbTag.vue.d.ts +0 -36
  919. package/dist/validated/BbTag.vue.js +0 -5
  920. package/dist/validated/BbTag.vue_vue_type_script_setup_true_lang.js +0 -72
  921. package/dist/validated/BbTextInput.vue.d.ts +0 -36
  922. package/dist/validated/BbTextInput.vue.js +0 -5
  923. package/dist/validated/BbTextInput.vue_vue_type_script_setup_true_lang.js +0 -72
  924. package/dist/validated/BbTextarea.vue.d.ts +0 -36
  925. package/dist/validated/BbTextarea.vue.js +0 -5
  926. package/dist/validated/BbTextarea.vue_vue_type_script_setup_true_lang.js +0 -70
  927. package/dist/validated/BbTimePickerInput.vue.d.ts +0 -37
  928. package/dist/validated/BbTimePickerInput.vue.js +0 -5
  929. package/dist/validated/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +0 -81
  930. package/dist/validated/index.d.ts +0 -43
  931. package/dist/validated/useValidatedField.d.ts +0 -93
  932. package/dist/validated/useValidatedField.js +0 -51
  933. package/dist/validated.js +0 -21
  934. /package/dist/components/{BbBaseDatePicker/BbBaseDatePickerMonthSelector.vue.d.ts → BbCalendar/CalendarMonthPanel.vue.d.ts} +0 -0
  935. /package/dist/components/{BbBaseDatePicker/BbBaseDatePickerYearSelector.vue.d.ts → BbCalendar/CalendarYearPanel.vue.d.ts} +0 -0
  936. /package/dist/{components/BbBaseDatePicker/typeahead.d.ts → composables/useTypeahead.d.ts} +0 -0
  937. /package/dist/{components/BbBaseDatePicker/typeahead.js → composables/useTypeahead.js} +0 -0
@@ -0,0 +1,3898 @@
1
+ ---
2
+ title: Settings Workspace (Nuxt)
3
+ summary: Full settings area for Nuxt — one BbTabs side nav deep-linked through ?section= (a scrolling strip on a phone), SSR-rendered sections read with useFetch and awaited before render, $fetch writes with FetchError 422s through BbForm setErrors and a 409 revert, an explicit-save Zod profile with a leave guard, instant notification toggles, members with one-click roles, read-only billing, reveal-once API keys and a typed-name danger zone, all through one coopting page context.
4
+ ---
5
+
6
+ # Recipe: Settings Workspace (Nuxt)
7
+
8
+ The settings area adapted for **Nuxt**: the same six sections, side nav,
9
+ save models, copy and leaves as the Vue recipe. Each section is read with
10
+ `useFetch` so the server renders real data, the page awaits the reads before
11
+ its first render (the profile draft is seeded on both sides, no hydration
12
+ mismatch), and every write is a `$fetch`.
13
+
14
+ Sibling recipes: [Vue](../vue/settings-workspace.md) · [Inertia](../inertia/settings-workspace.md).
15
+
16
+ ## Prerequisites
17
+
18
+ - **[Layout Scaffold](./layout-scaffold.md) — build it first.** This recipe imports `PageShell` from your own app (`@/components/layout/PageShell.vue`); it is not a package export.
19
+ - `<BbConfirm />` and `<BbToast />` mounted once in `app.vue`, never in a page.
20
+ - `BbForm` with its `vee-validate` peer, and `zod` for the schemas ([Validated Forms](../../guides/validated-forms.md)). No adapter package: BbForm takes a Standard Schema as it is.
21
+ - The soft badge palette registered (`badgeVariants: ['soft-gray', 'soft-blue', 'soft-green', 'soft-amber', 'soft-red']` plus its CSS, [design-language](../../guides/design-language.md) § The soft status palette).
22
+ - `@vueuse/core` for `useEventListener` (the `beforeunload` half of the leave guard).
23
+ - Server routes under `/api/settings`: `GET workspace | profile | notifications
24
+ | members | billing | api-keys`; `PATCH profile`; `PUT avatar` (the raw
25
+ image as the body) and `DELETE avatar`; `PUT notifications` (a 409
26
+ `{ message }` for a refusal only the server can know); `POST members/invite`,
27
+ `PATCH|DELETE members/:id`, `POST members/:id/resend|transfer`;
28
+ `POST api-keys` → `{ key, secret }`, `DELETE api-keys/:id`;
29
+ `POST workspace/delete`. A validation failure is a 422 whose body is
30
+ `{ message, errors: { field: [message] } }` — return it (`setResponseStatus`),
31
+ do not throw it, or ofetch nests the bag one level deeper.
32
+
33
+ ## Key ideas
34
+
35
+ - **One BbTabs is the whole section nav.** `direction="vertical"` beside the
36
+ panel on desktop, `horizontal` (a scrolling strip) under the mobile
37
+ breakpoint, `variant="none"` plus its own component tokens set inline
38
+ through `:pt` (`SECTION_NAV_PT`) make it a quiet sidebar (no strip, a soft
39
+ wash under the current section). `navigation` +
40
+ `query-key="section"` + `replace` puts the section in the URL (deep links
41
+ from emails, docs, support) without one Back entry per click.
42
+ - **One coopting page context.** `provideSettingsWorkspace()` joins the three
43
+ form contexts the chrome drives from outside their forms
44
+ (`useBbFormContext`: the profile, the invite dialog, the create-key dialog),
45
+ owns every section's data and every action. Leaves call
46
+ `useSettingsWorkspace()` and nothing else.
47
+ - **`useFetch` per section, awaited once.** Six keyed `useFetch` reads run on
48
+ the server and hydrate from the payload; `ctx.ready` settles them all, the
49
+ page `await`s it, and the profile draft is seeded right there, on the
50
+ server and the client alike. A watcher would not run during SSR, and the
51
+ draft would hydrate empty against a filled server render.
52
+ - **Two save models, side by side, each where it belongs.** The Profile fields
53
+ are an explicit save (BbForm + a Zod `schema`, a server 422 through
54
+ `setErrors`, Discard, a leave guard); notifications, roles and the avatar
55
+ save instantly, optimistic, reverted on failure. See _Which save model,
56
+ when_ below.
57
+ - **Dirty means "differs from what is saved".** The context keeps the draft and
58
+ compares a snapshot of it with the last saved profile; BbForm's own `dirty`
59
+ measures against the values it mounted with and would stay true after an
60
+ in-place save. The Profile tab shows a dot while the draft is unsaved, and
61
+ the panel is `eager` so the draft survives a look at Billing.
62
+ - **Cards only where they mark a save.** A settings card (title, body, footer)
63
+ is one unit of saving; lists that save instantly are hairline lists with no
64
+ footer; the danger zone is its own quarantined block, last.
65
+ - **Every destructive action asks.** Remove, revoke, transfer: `useConfirm`
66
+ with the consequence in the sentence. Deleting the workspace is typed-name
67
+ (a yes/no is one reflexive click from disaster).
68
+ - **Settings archetype, so rows 4, 5 (as filters), 7, 8 and 9 of the standard
69
+ anatomy don't apply**: no filter rail, no pagination, no selection bar, no
70
+ peek (every record here is edited in place). The topbar breadcrumb names
71
+ the current section; the members search lives in its own section.
72
+
73
+ ## Which save model, when
74
+
75
+ A settings page has two kinds of input, and each earns a different commit. Pick
76
+ per field, and never mix both inside one card.
77
+
78
+ | | Explicit save (Profile fields) | Instant save (notifications, roles, avatar) |
79
+ | ---------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
80
+ | What it is | Typed text, several fields that belong together | One discrete choice: a switch, a checkbox, a role, a file |
81
+ | Commit | A **Save** button in the card footer, disabled until something changed | The change itself. No button anywhere |
82
+ | While saving | The button spins (`isSubmitting`); the fields stay editable | The control goes `readonly` so a second flip cannot race the first |
83
+ | On success | A toast; the dirty state rebaselines to what was saved | A quiet toast (`Delivery channels saved.`) |
84
+ | On failure | Server messages land on their fields (`setErrors`); focus moves to the first one; nothing is lost | The control **snaps back** and the toast says why (`Slack needs reconnecting…`) |
85
+ | Leaving | Unsaved work raises a dot on the section tab, and leaving asks first | Nothing can be unsaved, so nothing asks |
86
+ | Real-world model | Vercel, Stripe and GitHub profile forms | Linear's notification settings, GitHub's avatar |
87
+
88
+ Rules of thumb:
89
+
90
+ - **Typed text is never saved on its own.** Half a name or half an email is not
91
+ a state worth persisting; a keystroke-save is also one request per letter.
92
+ - **A single discrete choice is its own commit.** Making the user find a Save
93
+ button for a switch they just flipped is a trap: they leave, and the flip is
94
+ lost without a word.
95
+ - **A file is its own commit.** Picking a picture is already a decision; upload
96
+ it at once (GitHub's model), even inside the Profile section.
97
+ - **Destructive or irreversible is neither**: it goes through a confirm
98
+ (`useConfirm`), and the irreversible one makes you type the name.
99
+ - **The card is the save boundary.** An explicit-save card has a footer with
100
+ the hint and the button; an instant-save card has no footer at all, so there
101
+ is no button to look for.
102
+
103
+ ## Page anatomy
104
+
105
+ ```
106
+ SettingsWorkspace/
107
+ pages/settings.vue ← assembly (Nuxt: every .vue under pages/ is a route, so the leaves live in components/SettingsWorkspace/)
108
+ context.ts ← the coopting page context (form contexts + data + actions + guard)
109
+ settings-workspace.css ← two shared layout classes + the phone strip's layout
110
+ SectionHeader.vue ← scope line, title, consequence, section actions
111
+ SettingsCard.vue ← one save boundary (head, body, commit footer)
112
+ ProfileSection.vue ← explicit save: BbForm + Zod, 422s, dirty footer
113
+ AvatarField.vue ← instant save: BbDropzone + BbAvatar
114
+ NotificationsSection.vue← instant save: channels card + matrix card
115
+ ChannelSwitches.vue ← BbSwitchGroup settings list
116
+ EventMatrix.vue ← one BbCheckboxGroup per event
117
+ notifications.ts ← the channel and event catalog
118
+ MembersSection.vue ← search, seats, BbTable, empty state
119
+ MemberRoleCell.vue ← one-click role (BbSelectPopover)
120
+ MemberRowActions.vue ← row menu (v-bb-dropdown)
121
+ InviteMembersDialog.vue ← BbDialog + BbForm (BbTag + BbRadioGroup)
122
+ BillingSection.vue ← read-only summary + invoice history
123
+ ApiKeysSection.vue ← masked keys table, revoke, empty state
124
+ CreateApiKeyDialog.vue ← create form, then the reveal
125
+ ApiKeyReveal.vue ← the one-time secret + copy
126
+ DangerZoneSection.vue ← transfer ownership, delete
127
+ DeleteWorkspaceDialog.vue ← typed-name confirmation
128
+ format.ts ← stateless formatters
129
+ ```
130
+
131
+ Chrome assumed from the guides: [App Layout](../../guides/app-layout.md) and
132
+ [Page Shell](../../guides/page-shell.md) (the `PageShell` from the
133
+ [Layout Scaffold](./layout-scaffold.md)). The dialogs mount in the shell's
134
+ `#dialogs` slot; the confirms render through the app-wide `useConfirm` host.
135
+
136
+ ## Action inventory
137
+
138
+ | # | Action | Trigger | Mechanism |
139
+ | --- | ---------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------- |
140
+ | 1 | Switch section | side nav / phone strip (arrow keys move between sections) | BbTabs `navigation` + `replace` → `?section=` |
141
+ | 2 | Upload a profile picture | drop on the zone, or **Upload** | instant: `$fetch` on pick, spinner on the avatar, toast |
142
+ | 3 | Remove the picture | ghost under the zone | instant: `$fetch` + toast |
143
+ | 4 | Edit name, title, email, time zone | Profile fields | local draft (context), dirty dot on the tab |
144
+ | 5 | Save profile | card footer, the section's `primary` | BbForm submit (Zod) → `$fetch`; 422 → `setErrors` + focus |
145
+ | 6 | Discard changes | card footer ghost (only while dirty) | draft ← last saved |
146
+ | 7 | Leave with unsaved changes | any navigation / closing the tab | `onBeforeRouteLeave` confirm; `beforeunload` |
147
+ | 8 | Turn a delivery channel on or off | switch row | instant, optimistic, `readonly` in flight, revert + toast on refusal |
148
+ | 9 | Pick channels per event | matrix checkboxes | instant, same writer as #8; a channel that is off disables its column |
149
+ | 10 | Search members | toolbar input | local filter (context), empty state with **Clear search** |
150
+ | 11 | Change a member's role | role cell | one-click BbSelectPopover → `$fetch`, spinner in the cell |
151
+ | 12 | Invite people | **Invite people** (`primary`) → dialog | BbForm (Zod) submitted from the dialog footer; 422 (taken, seats) → `setErrors` |
152
+ | 13 | Resend / revoke an invitation | row `…` menu | `$fetch` + toast / `useConfirm` (destructive) |
153
+ | 14 | Copy a member's email | row `…` menu | clipboard + toast |
154
+ | 15 | Remove a member | row `…` menu | `useConfirm` (destructive) → `$fetch` + toast |
155
+ | 16 | Add seats (when full) | link beside the seat bar | switches to Billing |
156
+ | 17 | Open the billing portal | **Manage billing** | external link, new tab |
157
+ | 18 | Download an invoice PDF | invoice row | file link (`target="_blank"`) |
158
+ | 19 | Create an API key | **Create key** (`primary`) → dialog | BbForm (Zod) → `$fetch`; the secret shown once |
159
+ | 20 | Copy the new secret | reveal dialog | clipboard + toast; dialog `persistent` while shown |
160
+ | 21 | Revoke a key | key row | `useConfirm` (destructive) → `$fetch` + toast |
161
+ | 22 | Transfer ownership | danger zone → pick an admin | BbSelectPopover pick → `useConfirm` (destructive) |
162
+ | 23 | Delete the workspace | danger zone → dialog | typed-name gate, re-checked by the server → leave the page |
163
+
164
+ One `variant="primary"` per **section** (only one section is ever on screen):
165
+ Save profile, Invite people, Create key.
166
+
167
+ ## The code
168
+
169
+ Components used, each verified against its contract:
170
+ [BbTabs](../../BbTabs.md), [BbForm](../../BbForm.md),
171
+ [BbTextInput](../../BbTextInput.md), [BbSelect](../../BbSelect.md),
172
+ [BbDropzone](../../BbDropzone.md), [BbAvatar](../../BbAvatar.md),
173
+ [BbSwitchGroup](../../BbSwitchGroup.md),
174
+ [BbCheckboxGroup](../../BbCheckboxGroup.md), [BbTable](../../BbTable.md),
175
+ [BbSelectPopover](../../BbSelectPopover.md), [BbDialog](../../BbDialog.md),
176
+ [BbTag](../../BbTag.md), [BbRadioGroup](../../BbRadioGroup.md),
177
+ [BbBadge](../../BbBadge.md), [BbProgress](../../BbProgress.md),
178
+ [BbAlert](../../BbAlert.md), [BbBreadcrumbs](../../BbBreadcrumbs.md), and the
179
+ composables [useBbFormContext](../../composables/useBbFormContext.md),
180
+ [useConfirm](../../composables/useConfirm.md),
181
+ [useToast](../../composables/useToast.md) and
182
+ [useMobile](../../composables/useMobile.md).
183
+
184
+ ### context.ts
185
+
186
+ ```ts
187
+ // SettingsWorkspace/context.ts — the Nuxt port of the Settings Workspace
188
+ // recipe (ai/recipes/nuxt/settings-workspace.md).
189
+ //
190
+ // Anatomy, copy, leaves and the context SHAPE are the Vue page's, verbatim.
191
+ // Only the data layer differs:
192
+ // 1. Each section is read with `useFetch` (SSR-rendered, hydrated from the
193
+ // payload), and the page awaits `ctx.ready` so the server renders real
194
+ // data and the profile draft is seeded before the first render on BOTH
195
+ // sides (a watcher would not run during SSR: a hydration mismatch).
196
+ // 2. Writes are `$fetch`; a 422 is `FetchError` with `statusCode === 422`
197
+ // and the bag on `error.data.errors`, a 409 carries `error.data.message`.
198
+ // 3. Leaving after the delete is `navigateTo('/')`.
199
+ //
200
+ // It coopts the three form contexts the page's chrome drives from outside
201
+ // their forms (the profile's 422s, the invite and create-key dialog footers), owns
202
+ // every section's data, and holds every action. Leaves call
203
+ // `useSettingsWorkspace()` and nothing else.
204
+ //
205
+ // Two save models live here, side by side, on purpose:
206
+ // • EXPLICIT (Profile fields): a draft, a dirty snapshot against what is
207
+ // SAVED, a Save that maps a 422 through `setErrors`, a Discard, and a leave
208
+ // guard. Typed text is never saved on its own.
209
+ // • INSTANT (notifications, member roles, the avatar file): the click IS the
210
+ // commit. Optimistic, `readonly` while in flight, reverted and toasted on
211
+ // failure.
212
+ //
213
+ import {
214
+ computed,
215
+ inject,
216
+ nextTick,
217
+ provide,
218
+ reactive,
219
+ ref,
220
+ type ComputedRef,
221
+ type InjectionKey,
222
+ type Ref,
223
+ } from 'vue';
224
+ import { onBeforeRouteLeave } from 'vue-router';
225
+ import { useEventListener } from '@vueuse/core';
226
+ import { FetchError } from 'ofetch';
227
+ import {
228
+ type BbFormContextHandle,
229
+ useBbFormContext,
230
+ useConfirm,
231
+ useToast,
232
+ } from 'bitboss-ui';
233
+ import type {
234
+ ApiKey,
235
+ ApiKeyDraft,
236
+ BillingSummary,
237
+ InvitableRole,
238
+ NotificationChannel,
239
+ NotificationEvent,
240
+ NotificationPrefs,
241
+ Profile,
242
+ ProfileDraft,
243
+ Workspace,
244
+ WorkspaceMember,
245
+ } from './types';
246
+
247
+ /** The 422 bag of a `$fetch` failure, or `{}`. */
248
+ const validationErrors = (error: unknown): Record<string, string[]> =>
249
+ error instanceof FetchError && error.statusCode === 422
250
+ ? (error.data?.errors ?? {})
251
+ : {};
252
+
253
+ /** The server's own sentence on a refused write (a 409), if it sent one. */
254
+ const serverMessage = (error: unknown): string | undefined =>
255
+ error instanceof FetchError ? error.data?.message : undefined;
256
+
257
+ export type SettingsSection =
258
+ | 'profile'
259
+ | 'notifications'
260
+ | 'members'
261
+ | 'billing'
262
+ | 'api-keys'
263
+ | 'danger-zone';
264
+
265
+ /** Form ids the page reads from outside the forms (useBbFormContext). */
266
+ export const PROFILE_FORM = 'settings-profile';
267
+ export const INVITE_FORM = 'settings-invite';
268
+ export const API_KEY_FORM = 'settings-api-key';
269
+
270
+ export const ROLE_OPTIONS: Array<{
271
+ value: InvitableRole;
272
+ label: string;
273
+ description: string;
274
+ }> = [
275
+ {
276
+ value: 'admin',
277
+ label: 'Admin',
278
+ description: 'Everything, members and billing included.',
279
+ },
280
+ {
281
+ value: 'member',
282
+ label: 'Member',
283
+ description: 'Create, send and chase invoices.',
284
+ },
285
+ {
286
+ value: 'accountant',
287
+ label: 'Accountant',
288
+ description: 'Read-only books, exports and payouts.',
289
+ },
290
+ ];
291
+
292
+ export const ROLE_LABEL: Record<WorkspaceMember['role'], string> = {
293
+ owner: 'Owner',
294
+ admin: 'Admin',
295
+ member: 'Member',
296
+ accountant: 'Accountant',
297
+ };
298
+
299
+ export interface SettingsWorkspaceContext {
300
+ // -- Coopted contexts ------------------------------------------------------
301
+ /** The Profile card's form: `setErrors` for the 422. */
302
+ profileForm: BbFormContextHandle;
303
+ /** The invite dialog's form: its footer submits it from outside. */
304
+ inviteForm: BbFormContextHandle;
305
+ /** The create-key dialog's form, same reason. */
306
+ apiKeyForm: BbFormContextHandle;
307
+ // -- Page-owned state ------------------------------------------------------
308
+ /** Resolves once every section's first read landed (the page awaits it). */
309
+ ready: Promise<void>;
310
+ /** The active section — BbTabs' model, mirrored into `?section=`. */
311
+ section: Ref<SettingsSection>;
312
+ workspace: Ref<Workspace | null>;
313
+ profile: Ref<Profile | null>;
314
+ /** The editable copy the Profile fields bind to (explicit save). */
315
+ profileDraft: ProfileDraft;
316
+ /** Draft differs from what the server last SAVED (not from first mount). */
317
+ profileDirty: ComputedRef<boolean>;
318
+ avatarUploading: Ref<boolean>;
319
+ notifications: Ref<NotificationPrefs | null>;
320
+ /** True while a notification write is in flight: every toggle goes readonly. */
321
+ notificationsSaving: Ref<boolean>;
322
+ members: Ref<WorkspaceMember[] | null>;
323
+ memberSearch: Ref<string>;
324
+ visibleMembers: ComputedRef<WorkspaceMember[]>;
325
+ seats: ComputedRef<{ used: number; included: number } | null>;
326
+ billing: Ref<BillingSummary | null>;
327
+ apiKeys: Ref<ApiKey[] | null>;
328
+ /** Open-state of the page's dialogs. */
329
+ dialogs: {
330
+ invite: Ref<boolean>;
331
+ createKey: Ref<boolean>;
332
+ deleteWorkspace: Ref<boolean>;
333
+ };
334
+ // -- Actions (complete: API + state + toast) --------------------------------
335
+ saveProfile: (values: ProfileDraft) => Promise<boolean>;
336
+ discardProfile: () => void;
337
+ uploadAvatar: (file: File) => Promise<void>;
338
+ removeAvatar: () => Promise<void>;
339
+ setChannels: (next: NotificationChannel[]) => Promise<void>;
340
+ setEventChannels: (
341
+ event: NotificationEvent,
342
+ next: NotificationChannel[]
343
+ ) => Promise<void>;
344
+ changeRole: (member: WorkspaceMember, role: InvitableRole) => Promise<void>;
345
+ inviteMembers: (emails: string[], role: InvitableRole) => Promise<boolean>;
346
+ resendInvite: (member: WorkspaceMember) => Promise<void>;
347
+ removeMember: (member: WorkspaceMember) => Promise<void>;
348
+ transferOwnership: (member: WorkspaceMember) => Promise<void>;
349
+ /** Resolves with the one-time secret, or null when the server refused. */
350
+ createApiKey: (draft: ApiKeyDraft) => Promise<string | null>;
351
+ revokeApiKey: (key: ApiKey) => Promise<void>;
352
+ /** Resolves with the server's message for the field, or null on success. */
353
+ deleteWorkspace: (typedName: string) => Promise<string | null>;
354
+ /** Clipboard write + the confirming toast; resolves whether it worked. */
355
+ copy: (text: string, what: string) => Promise<boolean>;
356
+ }
357
+
358
+ const key: InjectionKey<SettingsWorkspaceContext> =
359
+ Symbol('settings-workspace');
360
+
361
+ /** The comparable shape of a draft: emptied fields (`null`) equal `''`. */
362
+ const snapshot = (draft: ProfileDraft | null) =>
363
+ draft
364
+ ? JSON.stringify([
365
+ draft.name?.trim() ?? '',
366
+ draft.email?.trim().toLowerCase() ?? '',
367
+ draft.title?.trim() ?? '',
368
+ draft.timezone ?? '',
369
+ ])
370
+ : '';
371
+
372
+ const toDraft = (profile: Profile): ProfileDraft => ({
373
+ name: profile.name,
374
+ email: profile.email,
375
+ title: profile.title,
376
+ timezone: profile.timezone,
377
+ });
378
+
379
+ export function provideSettingsWorkspace(): SettingsWorkspaceContext {
380
+ const { toast } = useToast();
381
+ const { confirm } = useConfirm();
382
+
383
+ // -- Coopt: the form contexts, joined once, by id. ---------------------------
384
+ const profileForm = useBbFormContext(PROFILE_FORM);
385
+ const inviteForm = useBbFormContext(INVITE_FORM);
386
+ const apiKeyForm = useBbFormContext(API_KEY_FORM);
387
+
388
+ // -- Data: one `useFetch` per section, keyed, SSR-rendered and hydrated from
389
+ // the payload. `default: () => null` keeps the Vue page's `T | null` shape.
390
+ const read = <T>(key: string, url: string) =>
391
+ useFetch<T>(url, { key: `settings-${key}`, default: () => null });
392
+ const workspaceRead = read<Workspace>('workspace', '/api/settings/workspace');
393
+ const profileRead = read<Profile>('profile', '/api/settings/profile');
394
+ const notificationsRead = read<NotificationPrefs>(
395
+ 'notifications',
396
+ '/api/settings/notifications'
397
+ );
398
+ const membersRead = read<WorkspaceMember[]>(
399
+ 'members',
400
+ '/api/settings/members'
401
+ );
402
+ const billingRead = read<BillingSummary>('billing', '/api/settings/billing');
403
+ const apiKeysRead = read<ApiKey[]>('api-keys', '/api/settings/api-keys');
404
+
405
+ const section = ref<SettingsSection>('profile');
406
+ const workspace = workspaceRead.data as Ref<Workspace | null>;
407
+ const profile = profileRead.data as Ref<Profile | null>;
408
+ const profileDraft = reactive<ProfileDraft>({
409
+ name: '',
410
+ email: '',
411
+ title: null,
412
+ timezone: '',
413
+ });
414
+ const avatarUploading = ref(false);
415
+ const notifications = notificationsRead.data as Ref<NotificationPrefs | null>;
416
+ const notificationsSaving = ref(false);
417
+ const members = membersRead.data as Ref<WorkspaceMember[] | null>;
418
+ const memberSearch = ref('');
419
+ const billing = billingRead.data as Ref<BillingSummary | null>;
420
+ const apiKeys = apiKeysRead.data as Ref<ApiKey[] | null>;
421
+ const dialogs = {
422
+ invite: ref(false),
423
+ createKey: ref(false),
424
+ deleteWorkspace: ref(false),
425
+ };
426
+
427
+ const profileDirty = computed(
428
+ () =>
429
+ profile.value !== null &&
430
+ snapshot(profileDraft) !== snapshot(toDraft(profile.value))
431
+ );
432
+
433
+ const visibleMembers = computed(() => {
434
+ const needle = memberSearch.value.trim().toLowerCase();
435
+ const all = members.value ?? [];
436
+ if (!needle) return all;
437
+ return all.filter(
438
+ (m) =>
439
+ m.name.toLowerCase().includes(needle) ||
440
+ m.email.toLowerCase().includes(needle)
441
+ );
442
+ });
443
+
444
+ // Seats follow the live roster, so an invite or removal updates Members and
445
+ // Billing at once: one number, two sections, one source.
446
+ const seats = computed(() =>
447
+ billing.value && members.value
448
+ ? { used: members.value.length, included: billing.value.seats.included }
449
+ : null
450
+ );
451
+
452
+ // Every read settles in parallel; then the draft is seeded ONCE, on the
453
+ // server and on the client alike, before the page renders.
454
+ const reads: Array<[string, { error: Ref<unknown> }]> = [
455
+ ['the workspace', workspaceRead],
456
+ ['your profile', profileRead],
457
+ ['notification settings', notificationsRead],
458
+ ['members', membersRead],
459
+ ['billing', billingRead],
460
+ ['API keys', apiKeysRead],
461
+ ];
462
+ const ready = Promise.all([
463
+ workspaceRead,
464
+ profileRead,
465
+ notificationsRead,
466
+ membersRead,
467
+ billingRead,
468
+ apiKeysRead,
469
+ ]).then(() => {
470
+ if (profile.value) Object.assign(profileDraft, toDraft(profile.value));
471
+ if (import.meta.server) return;
472
+ for (const [what, request] of reads)
473
+ if (request.error.value)
474
+ toast({
475
+ title: `Could not load ${what}.`,
476
+ text: 'Refresh the page to try again.',
477
+ variant: 'destructive',
478
+ icon: 'lucide:circle-x',
479
+ });
480
+ });
481
+
482
+ // -- Profile: explicit save ---------------------------------------------------
483
+ const saveProfile = async (values: ProfileDraft): Promise<boolean> => {
484
+ try {
485
+ const saved = await $fetch<Profile>('/api/settings/profile', {
486
+ method: 'PATCH',
487
+ body: values,
488
+ });
489
+ const emailChanged = saved.email !== profile.value?.email;
490
+ profile.value = saved;
491
+ Object.assign(profileDraft, toDraft(saved));
492
+ toast({
493
+ title: 'Profile saved.',
494
+ text: emailChanged
495
+ ? `We sent a confirmation link to ${saved.email}.`
496
+ : undefined,
497
+ variant: 'success',
498
+ icon: 'lucide:circle-check',
499
+ });
500
+ return true;
501
+ } catch (error) {
502
+ const errors = validationErrors(error);
503
+ if (Object.keys(errors).length) {
504
+ // Laravel's `{ field: [message] }` lands on the fields by name.
505
+ profileForm.setErrors(errors);
506
+ return false;
507
+ }
508
+ toast({
509
+ title: 'Could not save your profile.',
510
+ text: 'Your changes are still here. Try again.',
511
+ variant: 'destructive',
512
+ icon: 'lucide:circle-x',
513
+ });
514
+ return false;
515
+ }
516
+ };
517
+
518
+ const discardProfile = () => {
519
+ if (profile.value) Object.assign(profileDraft, toDraft(profile.value));
520
+ };
521
+
522
+ // -- Avatar: instant (a file is its own commit) -------------------------------
523
+ const uploadAvatar = async (file: File) => {
524
+ avatarUploading.value = true;
525
+ try {
526
+ const saved = await $fetch<Profile>('/api/settings/avatar', {
527
+ method: 'PUT',
528
+ body: file,
529
+ headers: { 'Content-Type': file.type },
530
+ });
531
+ if (profile.value) profile.value.avatarUrl = saved.avatarUrl;
532
+ toast({
533
+ title: 'Profile picture updated.',
534
+ variant: 'success',
535
+ icon: 'lucide:circle-check',
536
+ });
537
+ } catch (error) {
538
+ toast({
539
+ title: 'Could not upload that picture.',
540
+ text:
541
+ validationErrors(error).avatar?.[0] ??
542
+ 'Check your connection and try again.',
543
+ variant: 'destructive',
544
+ icon: 'lucide:circle-x',
545
+ });
546
+ } finally {
547
+ avatarUploading.value = false;
548
+ }
549
+ };
550
+
551
+ const removeAvatar = async () => {
552
+ const saved = await $fetch<Profile>('/api/settings/avatar', {
553
+ method: 'DELETE',
554
+ });
555
+ if (profile.value) profile.value.avatarUrl = saved.avatarUrl;
556
+ toast({
557
+ title: 'Profile picture removed.',
558
+ variant: 'success',
559
+ icon: 'lucide:circle-check',
560
+ });
561
+ };
562
+
563
+ // -- Notifications: instant, optimistic, reverted on failure -----------------
564
+ // One writer for both controls, so a channel flip and an event flip can never
565
+ // race each other: `notificationsSaving` holds every toggle readonly.
566
+ const writeNotifications = async (next: NotificationPrefs, what: string) => {
567
+ const previous = notifications.value;
568
+ notifications.value = next;
569
+ notificationsSaving.value = true;
570
+ try {
571
+ notifications.value = await $fetch<NotificationPrefs>(
572
+ '/api/settings/notifications',
573
+ { method: 'PUT', body: next }
574
+ );
575
+ toast({ title: `${what} saved.`, icon: 'lucide:check' });
576
+ } catch (error) {
577
+ notifications.value = previous;
578
+ const message =
579
+ serverMessage(error) ?? Object.values(validationErrors(error))[0]?.[0];
580
+ toast({
581
+ title: `${what} not saved.`,
582
+ text: message ?? 'Your previous setting is back. Try again.',
583
+ variant: 'destructive',
584
+ icon: 'lucide:circle-x',
585
+ });
586
+ } finally {
587
+ notificationsSaving.value = false;
588
+ }
589
+ };
590
+
591
+ const setChannels = (next: NotificationChannel[]) =>
592
+ notifications.value
593
+ ? writeNotifications(
594
+ { ...notifications.value, channels: next },
595
+ 'Delivery channels'
596
+ )
597
+ : Promise.resolve();
598
+
599
+ const setEventChannels = (
600
+ event: NotificationEvent,
601
+ next: NotificationChannel[]
602
+ ) =>
603
+ notifications.value
604
+ ? writeNotifications(
605
+ {
606
+ ...notifications.value,
607
+ events: { ...notifications.value.events, [event]: next },
608
+ },
609
+ 'Notification preference'
610
+ )
611
+ : Promise.resolve();
612
+
613
+ // -- Members ----------------------------------------------------------------------
614
+ const replaceMember = (updated: WorkspaceMember) => {
615
+ if (!members.value) return;
616
+ members.value = members.value.map((m) =>
617
+ m.id === updated.id ? updated : m
618
+ );
619
+ };
620
+
621
+ // Instant: the pick IS the commit. The cell owns its spinner (rung 1).
622
+ const changeRole = async (member: WorkspaceMember, role: InvitableRole) => {
623
+ if (member.role === role) return;
624
+ try {
625
+ replaceMember(
626
+ await $fetch<WorkspaceMember>(`/api/settings/members/${member.id}`, {
627
+ method: 'PATCH',
628
+ body: { role },
629
+ })
630
+ );
631
+ toast({
632
+ title: `${member.name} is now ${role === 'member' ? 'a' : 'an'} ${ROLE_LABEL[role].toLowerCase()}.`,
633
+ variant: 'success',
634
+ icon: 'lucide:circle-check',
635
+ });
636
+ } catch (error) {
637
+ toast({
638
+ title: `Could not change ${member.name}'s role.`,
639
+ text: validationErrors(error).role?.[0] ?? 'Try again.',
640
+ variant: 'destructive',
641
+ icon: 'lucide:circle-x',
642
+ });
643
+ }
644
+ };
645
+
646
+ const inviteMembers = async (
647
+ emails: string[],
648
+ role: InvitableRole
649
+ ): Promise<boolean> => {
650
+ try {
651
+ const invited = await $fetch<WorkspaceMember[]>(
652
+ '/api/settings/members/invite',
653
+ { method: 'POST', body: { emails, role } }
654
+ );
655
+ members.value = [...(members.value ?? []), ...invited];
656
+ dialogs.invite.value = false;
657
+ toast({
658
+ title:
659
+ invited.length === 1
660
+ ? `Invitation sent to ${invited[0]!.email}.`
661
+ : `${invited.length} invitations sent.`,
662
+ variant: 'success',
663
+ icon: 'lucide:circle-check',
664
+ });
665
+ return true;
666
+ } catch (error) {
667
+ const errors = validationErrors(error);
668
+ if (Object.keys(errors).length) {
669
+ inviteForm.setErrors(errors);
670
+ return false;
671
+ }
672
+ toast({
673
+ title: 'Invitations not sent.',
674
+ text: 'Try again in a moment.',
675
+ variant: 'destructive',
676
+ icon: 'lucide:circle-x',
677
+ });
678
+ return false;
679
+ }
680
+ };
681
+
682
+ const resendInvite = async (member: WorkspaceMember) => {
683
+ replaceMember(
684
+ await $fetch<WorkspaceMember>(
685
+ `/api/settings/members/${member.id}/resend`,
686
+ { method: 'POST' }
687
+ )
688
+ );
689
+ toast({
690
+ title: `Invitation re-sent to ${member.email}.`,
691
+ variant: 'success',
692
+ icon: 'lucide:circle-check',
693
+ });
694
+ };
695
+
696
+ const removeMember = async (member: WorkspaceMember) => {
697
+ const invited = member.status === 'invited';
698
+ const ok = await confirm({
699
+ variant: 'destructive',
700
+ title: invited ? 'Revoke invitation' : `Remove ${member.name}`,
701
+ text: invited
702
+ ? `The link sent to ${member.email} stops working. You can invite them again later.`
703
+ : `${member.name} loses access to Fennel & Hart immediately. Invoices they created stay.`,
704
+ yes: invited ? 'Revoke invitation' : 'Remove member',
705
+ no: 'Cancel',
706
+ });
707
+ if (!ok) return;
708
+ await $fetch(`/api/settings/members/${member.id}`, { method: 'DELETE' });
709
+ members.value = (members.value ?? []).filter((m) => m.id !== member.id);
710
+ toast({
711
+ title: invited
712
+ ? `Invitation to ${member.email} revoked.`
713
+ : `${member.name} was removed.`,
714
+ variant: 'success',
715
+ icon: 'lucide:circle-check',
716
+ });
717
+ };
718
+
719
+ const transferOwnership = async (member: WorkspaceMember) => {
720
+ const ok = await confirm({
721
+ variant: 'destructive',
722
+ title: `Make ${member.name} the owner`,
723
+ text: `${member.name} gets full control of Fennel & Hart, including deleting it. You stay on as an admin, and only the new owner can undo this.`,
724
+ yes: 'Transfer ownership',
725
+ no: 'Cancel',
726
+ });
727
+ if (!ok) return;
728
+ members.value = await $fetch<WorkspaceMember[]>(
729
+ `/api/settings/members/${member.id}/transfer`,
730
+ { method: 'POST' }
731
+ );
732
+ toast({
733
+ title: `${member.name} now owns Fennel & Hart.`,
734
+ variant: 'success',
735
+ icon: 'lucide:circle-check',
736
+ });
737
+ };
738
+
739
+ // -- API keys ---------------------------------------------------------------------
740
+ const createApiKey = async (draft: ApiKeyDraft): Promise<string | null> => {
741
+ try {
742
+ const created = await $fetch<{ key: ApiKey; secret: string }>(
743
+ '/api/settings/api-keys',
744
+ { method: 'POST', body: draft }
745
+ );
746
+ apiKeys.value = [created.key, ...(apiKeys.value ?? [])];
747
+ return created.secret;
748
+ } catch (error) {
749
+ const errors = validationErrors(error);
750
+ if (Object.keys(errors).length) apiKeyForm.setErrors(errors);
751
+ else
752
+ toast({
753
+ title: 'Key not created.',
754
+ text: 'Try again in a moment.',
755
+ variant: 'destructive',
756
+ icon: 'lucide:circle-x',
757
+ });
758
+ return null;
759
+ }
760
+ };
761
+
762
+ const revokeApiKey = async (apiKey: ApiKey) => {
763
+ const ok = await confirm({
764
+ variant: 'destructive',
765
+ title: `Revoke ${apiKey.name}`,
766
+ text: `Requests signed with ${apiKey.preview} start failing immediately. This cannot be undone.`,
767
+ yes: 'Revoke key',
768
+ no: 'Cancel',
769
+ });
770
+ if (!ok) return;
771
+ await $fetch(`/api/settings/api-keys/${apiKey.id}`, { method: 'DELETE' });
772
+ apiKeys.value = (apiKeys.value ?? []).filter((k) => k.id !== apiKey.id);
773
+ toast({
774
+ title: `${apiKey.name} revoked.`,
775
+ variant: 'success',
776
+ icon: 'lucide:circle-check',
777
+ });
778
+ };
779
+
780
+ // -- Danger zone ------------------------------------------------------------------
781
+ const deleteWorkspace = async (typedName: string): Promise<string | null> => {
782
+ try {
783
+ const { message } = await $fetch<{ message: string }>(
784
+ '/api/settings/workspace/delete',
785
+ { method: 'POST', body: { confirm: typedName } }
786
+ );
787
+ dialogs.deleteWorkspace.value = false;
788
+ // Nothing is left to protect: skip the leave guard on the way out.
789
+ Object.assign(profileDraft, profile.value ? toDraft(profile.value) : {});
790
+ toast({
791
+ title: message,
792
+ variant: 'success',
793
+ icon: 'lucide:circle-check',
794
+ });
795
+ await navigateTo('/');
796
+ return null;
797
+ } catch (error) {
798
+ return (
799
+ validationErrors(error).confirm?.[0] ??
800
+ 'The workspace was not deleted. Try again.'
801
+ );
802
+ }
803
+ };
804
+
805
+ const copy = async (text: string, what: string) => {
806
+ try {
807
+ await navigator.clipboard.writeText(text);
808
+ toast({ title: `${what} copied.`, icon: 'lucide:clipboard-check' });
809
+ return true;
810
+ } catch {
811
+ // Clipboard access can be refused (permissions, an insecure origin).
812
+ toast({
813
+ title: `Could not copy the ${what.toLowerCase()}.`,
814
+ text: 'Select it and copy it by hand.',
815
+ variant: 'warning',
816
+ icon: 'lucide:triangle-alert',
817
+ });
818
+ return false;
819
+ }
820
+ };
821
+
822
+ // -- Leave guard: only the explicit-save card can hold unsaved work ----------
823
+ onBeforeRouteLeave(async () => {
824
+ if (!profileDirty.value) return true;
825
+ return confirm({
826
+ variant: 'destructive',
827
+ title: 'Discard unsaved changes',
828
+ text: 'Your profile has changes that are not saved yet. Leave anyway?',
829
+ yes: 'Discard changes',
830
+ no: 'Keep editing',
831
+ });
832
+ });
833
+ // Closing the tab or reloading: the browser's own prompt (it ignores copy).
834
+ useEventListener('beforeunload', (event: BeforeUnloadEvent) => {
835
+ if (profileDirty.value) event.preventDefault();
836
+ });
837
+
838
+ const ctx: SettingsWorkspaceContext = {
839
+ profileForm,
840
+ inviteForm,
841
+ apiKeyForm,
842
+ ready,
843
+ section,
844
+ workspace,
845
+ profile,
846
+ profileDraft,
847
+ profileDirty,
848
+ avatarUploading,
849
+ notifications,
850
+ notificationsSaving,
851
+ members,
852
+ memberSearch,
853
+ visibleMembers,
854
+ seats,
855
+ billing,
856
+ apiKeys,
857
+ dialogs,
858
+ saveProfile,
859
+ discardProfile,
860
+ uploadAvatar,
861
+ removeAvatar,
862
+ setChannels,
863
+ setEventChannels,
864
+ changeRole,
865
+ inviteMembers,
866
+ resendInvite,
867
+ removeMember,
868
+ transferOwnership,
869
+ createApiKey,
870
+ revokeApiKey,
871
+ deleteWorkspace,
872
+ copy,
873
+ };
874
+ provide(key, ctx);
875
+ return ctx;
876
+ }
877
+
878
+ export function useSettingsWorkspace(): SettingsWorkspaceContext {
879
+ const ctx = inject(key);
880
+ if (!ctx)
881
+ throw new Error('useSettingsWorkspace() called outside SettingsWorkspace');
882
+ return ctx;
883
+ }
884
+
885
+ /** Focus the first field the server just flagged (setErrors does not move focus). */
886
+ export async function focusFirstServerError(root: HTMLElement | null) {
887
+ await nextTick();
888
+ root?.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus();
889
+ }
890
+ ```
891
+
892
+ ### pages/settings.vue — the assembly
893
+
894
+ ```vue
895
+ <!-- pages/settings/index.vue — the assembly: shell slots, the section tabs, provide.
896
+ Nuxt port of fixtures/vue/pages/SettingsWorkspace/Index.vue: leaves live in
897
+ app/components/SettingsWorkspace/ (every .vue under pages/ is a route), and
898
+ setup awaits ctx.ready so SSR renders real data. -->
899
+ <template>
900
+ <PageShell>
901
+ <template #topbar>
902
+ <div
903
+ class="flex min-h-(--app-bar-row-h,2.75rem) items-center gap-4 border-b px-4 py-(--app-bar-py,0.25rem)"
904
+ >
905
+ <BbBreadcrumbs
906
+ class="min-w-0"
907
+ :items="[
908
+ { key: 'workspace', text: 'Fennel & Hart', to: '/' },
909
+ { key: 'settings', text: 'Settings', to: '/settings' },
910
+ { key: 'section', text: currentLabel },
911
+ ]"
912
+ style="--flex-grow: 1"
913
+ />
914
+ </div>
915
+ </template>
916
+
917
+ <div class="settings-workspace" data-test="recipe-settings-workspace">
918
+ <header class="settings-workspace__header">
919
+ <h1 class="settings-workspace__title">Settings</h1>
920
+ <p class="settings-workspace__lede">
921
+ Your account, and how
922
+ {{ ctx.workspace.value?.name ?? 'your workspace' }} works for everyone
923
+ in it.
924
+ </p>
925
+ </header>
926
+
927
+ <!-- One BbTabs is the whole section nav: a side column on desktop, a
928
+ scrolling strip on a phone. `navigation` + `replace` keeps the
929
+ section in `?section=` (deep links from emails and docs) without
930
+ adding one Back entry per click. Sections do not slide: they are
931
+ places, not views of one thing. -->
932
+ <BbTabs
933
+ v-model="ctx.section.value"
934
+ class="settings-workspace__tabs"
935
+ data-test="settings-sections"
936
+ :direction="isMobile ? 'horizontal' : 'vertical'"
937
+ disable-animate-x
938
+ disable-animate-y
939
+ :items="sections"
940
+ navigation
941
+ :pt="SECTION_NAV_PT"
942
+ query-key="section"
943
+ replace
944
+ variant="none"
945
+ >
946
+ <template #label="{ value, text }">
947
+ <span
948
+ class="settings-nav__label"
949
+ :class="{ 'settings-nav__label--column': !isMobile }"
950
+ >
951
+ <BbIcon aria-hidden="true" :icon="SECTION_ICONS[value]" size="16" />
952
+ <span>{{ text }}</span>
953
+ <span
954
+ v-if="value === 'profile' && ctx.profileDirty.value"
955
+ class="settings-nav__dot"
956
+ data-test="profile-unsaved-dot"
957
+ >
958
+ <span class="sr-only">(unsaved changes)</span>
959
+ </span>
960
+ <span
961
+ v-else-if="value === 'members' && ctx.members.value"
962
+ class="settings-nav__count"
963
+ >
964
+ {{ ctx.members.value.length }}
965
+ </span>
966
+ <span
967
+ v-else-if="value === 'api-keys' && ctx.apiKeys.value"
968
+ class="settings-nav__count"
969
+ >
970
+ {{ ctx.apiKeys.value.length }}
971
+ </span>
972
+ </span>
973
+ </template>
974
+
975
+ <template #profile><ProfileSection /></template>
976
+ <template #notifications><NotificationsSection /></template>
977
+ <template #members><MembersSection /></template>
978
+ <template #billing><BillingSection /></template>
979
+ <template #api-keys><ApiKeysSection /></template>
980
+ <template #danger-zone><DangerZoneSection /></template>
981
+ </BbTabs>
982
+ </div>
983
+
984
+ <template #dialogs>
985
+ <InviteMembersDialog />
986
+ <CreateApiKeyDialog />
987
+ <DeleteWorkspaceDialog />
988
+ </template>
989
+ </PageShell>
990
+ </template>
991
+
992
+ <script setup lang="ts">
993
+ import { computed } from 'vue';
994
+ import { BbBreadcrumbs, BbIcon, BbTabs, useMobile } from 'bitboss-ui';
995
+ import type { BbTabsItem, BbTabsProps } from 'bitboss-ui';
996
+ import PageShell from '~/components/PageShell.vue';
997
+ import {
998
+ provideSettingsWorkspace,
999
+ type SettingsSection,
1000
+ } from '~/components/SettingsWorkspace/context';
1001
+ import ApiKeysSection from '~/components/SettingsWorkspace/ApiKeysSection.vue';
1002
+ import BillingSection from '~/components/SettingsWorkspace/BillingSection.vue';
1003
+ import CreateApiKeyDialog from '~/components/SettingsWorkspace/CreateApiKeyDialog.vue';
1004
+ import DangerZoneSection from '~/components/SettingsWorkspace/DangerZoneSection.vue';
1005
+ import DeleteWorkspaceDialog from '~/components/SettingsWorkspace/DeleteWorkspaceDialog.vue';
1006
+ import InviteMembersDialog from '~/components/SettingsWorkspace/InviteMembersDialog.vue';
1007
+ import MembersSection from '~/components/SettingsWorkspace/MembersSection.vue';
1008
+ import NotificationsSection from '~/components/SettingsWorkspace/NotificationsSection.vue';
1009
+ import ProfileSection from '~/components/SettingsWorkspace/ProfileSection.vue';
1010
+ import '~/components/SettingsWorkspace/settings-workspace.css';
1011
+
1012
+ const ctx = provideSettingsWorkspace();
1013
+ const { isMobile } = useMobile();
1014
+
1015
+ // `eager` on Profile: a half-edited draft must survive a look at Billing.
1016
+ const sections: Array<BbTabsItem<SettingsSection>> = [
1017
+ { key: 'profile', label: 'Profile', eager: true },
1018
+ { key: 'notifications', label: 'Notifications' },
1019
+ { key: 'members', label: 'Members' },
1020
+ { key: 'billing', label: 'Billing' },
1021
+ { key: 'api-keys', label: 'API keys' },
1022
+ { key: 'danger-zone', label: 'Danger zone' },
1023
+ ];
1024
+
1025
+ // Full literals: the production icon scanner only bundles names it can see.
1026
+ const SECTION_ICONS: Record<SettingsSection, string> = {
1027
+ profile: 'lucide:circle-user-round',
1028
+ notifications: 'lucide:bell',
1029
+ members: 'lucide:users',
1030
+ billing: 'lucide:credit-card',
1031
+ 'api-keys': 'lucide:key-round',
1032
+ 'danger-zone': 'lucide:triangle-alert',
1033
+ };
1034
+
1035
+ /**
1036
+ * The section nav's look: `variant="none"` (behaviour, no paint) plus the
1037
+ * strip's own tokens, set INLINE on the tablist through `wrapper.style`. A
1038
+ * look of your own starts from `none`, never from a new variant, and inline
1039
+ * custom properties beat the `none` tokens with no stylesheet: no scoped
1040
+ * style to miss the tablist, no layer or selector weight to win. The classes
1041
+ * only carry the phone strip's layout (settings-workspace.css).
1042
+ */
1043
+ const SECTION_NAV_PT: BbTabsProps<SettingsSection>['pt'] = {
1044
+ list: 'settings-nav__list',
1045
+ panels: 'settings-workspace__panels',
1046
+ wrapper: {
1047
+ class: 'settings-nav',
1048
+ style: {
1049
+ '--trigger-r': 'var(--bb-radius)',
1050
+ '--trigger-px': '0.625rem',
1051
+ '--trigger-min-h': '2rem',
1052
+ '--trigger-gap': '1px',
1053
+ '--list-fg': 'var(--bb-text-muted)',
1054
+ '--hover-fg': 'var(--bb-text)',
1055
+ '--active-fg': 'var(--bb-text)',
1056
+ '--indicator-bg': 'color-mix(in oklab, var(--bb-text) 8%, transparent)',
1057
+ '--indicator-r': 'var(--bb-radius)',
1058
+ },
1059
+ },
1060
+ };
1061
+
1062
+ const currentLabel = computed(
1063
+ () => sections.find((s) => s.key === ctx.section.value)?.label ?? 'Profile'
1064
+ );
1065
+
1066
+ // Nuxt: render (on the server and at hydration) only once every section read
1067
+ // landed and the profile draft is seeded. See context.ts.
1068
+ await ctx.ready;
1069
+ </script>
1070
+
1071
+ <style scoped>
1072
+ .settings-workspace {
1073
+ display: flex;
1074
+ flex-direction: column;
1075
+ gap: 1.25rem;
1076
+ margin-inline: auto;
1077
+ max-width: 68rem;
1078
+ padding: 1.5rem 1rem 4rem;
1079
+ width: 100%;
1080
+ }
1081
+
1082
+ .settings-workspace__header {
1083
+ display: flex;
1084
+ flex-direction: column;
1085
+ gap: 0.25rem;
1086
+ }
1087
+
1088
+ .settings-workspace__title {
1089
+ font-size: 1.375rem;
1090
+ font-weight: 600;
1091
+ letter-spacing: -0.015em;
1092
+ line-height: 1.2;
1093
+ }
1094
+
1095
+ .settings-workspace__lede {
1096
+ color: var(--bb-text-muted);
1097
+ font-size: 0.875rem;
1098
+ }
1099
+
1100
+ :deep(.settings-workspace__panels) {
1101
+ min-width: 0;
1102
+ }
1103
+
1104
+ .settings-nav__label {
1105
+ align-items: center;
1106
+ display: inline-flex;
1107
+ gap: 0.625rem;
1108
+ }
1109
+
1110
+ /* In the side column every row is one width, so counts line up on the right
1111
+ edge (the trigger sizes to its label; the label sets the column). */
1112
+ .settings-nav__label--column {
1113
+ min-width: 11.5rem;
1114
+ }
1115
+
1116
+ .settings-nav__count {
1117
+ color: var(--bb-text-muted);
1118
+ font-size: 0.75rem;
1119
+ font-variant-numeric: tabular-nums;
1120
+ font-weight: 500;
1121
+ margin-inline-start: auto;
1122
+ }
1123
+
1124
+ /* Unsaved marker: a dot, not a word, so the label does not jump. */
1125
+ .settings-nav__dot {
1126
+ background: var(--bb-warn);
1127
+ border-radius: 999px;
1128
+ height: 0.4375rem;
1129
+ margin-inline-start: auto;
1130
+ width: 0.4375rem;
1131
+ }
1132
+ </style>
1133
+ ```
1134
+
1135
+ ### settings-workspace.css
1136
+
1137
+ The two shared layout classes and the phone strip's layout.
1138
+
1139
+ ```css
1140
+ /* SettingsWorkspace/settings-workspace.css — the two layout classes every
1141
+ section shares, authored once (imported by Index.vue), never copy-pasted into
1142
+ six scoped blocks. Token-only, so both themes follow. */
1143
+
1144
+ .settings-section {
1145
+ display: flex;
1146
+ flex-direction: column;
1147
+ min-width: 0;
1148
+ }
1149
+
1150
+ /* The section nav's look is its tokens, set inline through `SECTION_NAV_PT`
1151
+ (Index.vue). What is left here is the phone strip's layout on the
1152
+ `settings-nav` classes, which a plain (non-scoped) stylesheet reaches. */
1153
+
1154
+ /* Phone: the strip runs edge to edge, so a section cut off at the screen edge
1155
+ says "scroll for more" without an arrow. `pt:list` lands this class on the
1156
+ scrolling list. */
1157
+ @media (max-width: 767.98px) {
1158
+ .bb-tabs-list.settings-nav > .settings-nav__list {
1159
+ margin-inline: -1rem;
1160
+ padding-inline: 1rem;
1161
+ scroll-padding-inline: 1rem;
1162
+ }
1163
+
1164
+ /* A scrolling flex row drops its end padding from the scroll area: this
1165
+ spacer keeps the last section clear of the screen edge. */
1166
+ .bb-tabs-list.settings-nav > .settings-nav__list::after {
1167
+ content: '';
1168
+ flex: 0 0 1rem;
1169
+ }
1170
+ }
1171
+
1172
+ .settings-section__stack {
1173
+ display: flex;
1174
+ flex-direction: column;
1175
+ gap: 1rem;
1176
+ }
1177
+ ```
1178
+
1179
+ ### SectionHeader.vue
1180
+
1181
+ Scope line, title, consequence sentence, section actions.
1182
+
1183
+ ```vue
1184
+ <!-- SettingsWorkspace/SectionHeader.vue — a section's title, scope and one-line consequence. -->
1185
+ <template>
1186
+ <header class="section-header">
1187
+ <div class="section-header__text">
1188
+ <p class="section-header__scope">{{ scope }}</p>
1189
+ <h2 class="section-header__title">{{ title }}</h2>
1190
+ <p class="section-header__description">{{ description }}</p>
1191
+ </div>
1192
+ <div v-if="$slots.default" class="section-header__actions">
1193
+ <slot />
1194
+ </div>
1195
+ </header>
1196
+ </template>
1197
+
1198
+ <script setup lang="ts">
1199
+ defineProps<{
1200
+ /** Whose settings these are: "Your account" or the workspace name. */
1201
+ scope: string;
1202
+ title: string;
1203
+ description: string;
1204
+ }>();
1205
+ </script>
1206
+
1207
+ <style scoped>
1208
+ .section-header {
1209
+ align-items: flex-end;
1210
+ display: flex;
1211
+ flex-wrap: wrap;
1212
+ gap: 0.75rem 1rem;
1213
+ justify-content: space-between;
1214
+ padding-block-end: 1rem;
1215
+ }
1216
+
1217
+ .section-header__text {
1218
+ display: flex;
1219
+ flex: 1 1 18rem;
1220
+ flex-direction: column;
1221
+ gap: 0.125rem;
1222
+ min-width: 0;
1223
+ }
1224
+
1225
+ /* The scope line replaces the grouped nav headings BbTabs cannot draw: it
1226
+ says whether a change touches you or everyone. */
1227
+ .section-header__scope {
1228
+ color: var(--bb-text-muted);
1229
+ font-size: 0.75rem;
1230
+ font-weight: 500;
1231
+ }
1232
+
1233
+ .section-header__title {
1234
+ font-size: 1rem;
1235
+ font-weight: 600;
1236
+ letter-spacing: -0.01em;
1237
+ line-height: 1.35;
1238
+ }
1239
+
1240
+ .section-header__description {
1241
+ color: var(--bb-text-muted);
1242
+ font-size: 0.8125rem;
1243
+ line-height: 1.45;
1244
+ max-width: 62ch;
1245
+ }
1246
+
1247
+ .section-header__actions {
1248
+ align-items: center;
1249
+ display: flex;
1250
+ flex-shrink: 0;
1251
+ gap: 0.5rem;
1252
+ }
1253
+ </style>
1254
+ ```
1255
+
1256
+ ### SettingsCard.vue
1257
+
1258
+ One SAVE boundary: head, body, the footer that commits it.
1259
+
1260
+ ```vue
1261
+ <!-- SettingsWorkspace/SettingsCard.vue — one save boundary: title, body, and the footer that commits it. -->
1262
+ <template>
1263
+ <section :aria-labelledby="titleId" class="settings-card">
1264
+ <div class="settings-card__head">
1265
+ <h3 :id="titleId" class="settings-card__title">{{ title }}</h3>
1266
+ <p v-if="description" class="settings-card__description">
1267
+ {{ description }}
1268
+ </p>
1269
+ </div>
1270
+ <div class="settings-card__body">
1271
+ <slot />
1272
+ </div>
1273
+ <!-- Only an explicit-save card has a footer: an instant-save list has
1274
+ nothing to commit, so it gets no button to look for. -->
1275
+ <footer v-if="$slots.footer" class="settings-card__footer">
1276
+ <slot name="footer" />
1277
+ </footer>
1278
+ </section>
1279
+ </template>
1280
+
1281
+ <script setup lang="ts">
1282
+ import { useId } from 'vue';
1283
+
1284
+ defineProps<{ title: string; description?: string }>();
1285
+
1286
+ const titleId = useId();
1287
+ </script>
1288
+
1289
+ <style scoped>
1290
+ .settings-card {
1291
+ background: var(--bb-panel);
1292
+ border: var(--bb-border-w) solid var(--bb-border);
1293
+ border-radius: var(--bb-radius-surface);
1294
+ display: flex;
1295
+ flex-direction: column;
1296
+ overflow: clip;
1297
+ }
1298
+
1299
+ .settings-card__head {
1300
+ display: flex;
1301
+ flex-direction: column;
1302
+ gap: 0.125rem;
1303
+ padding: 1rem 1.25rem 0;
1304
+ }
1305
+
1306
+ .settings-card__title {
1307
+ font-size: 0.875rem;
1308
+ font-weight: 600;
1309
+ line-height: 1.4;
1310
+ }
1311
+
1312
+ .settings-card__description {
1313
+ color: var(--bb-text-muted);
1314
+ font-size: 0.8125rem;
1315
+ line-height: 1.45;
1316
+ max-width: 62ch;
1317
+ }
1318
+
1319
+ .settings-card__body {
1320
+ padding: 1rem 1.25rem 1.25rem;
1321
+ }
1322
+
1323
+ /* The commit strip: hint left, actions right, one step darker than the card
1324
+ so the save boundary reads without a heavier border. */
1325
+ .settings-card__footer {
1326
+ align-items: center;
1327
+ background: color-mix(in oklab, var(--bb-text) 3%, var(--bb-panel));
1328
+ border-block-start: var(--bb-border-w) solid var(--bb-border);
1329
+ display: flex;
1330
+ flex-wrap: wrap;
1331
+ gap: 0.5rem 0.75rem;
1332
+ justify-content: flex-end;
1333
+ padding: 0.625rem 1.25rem;
1334
+ }
1335
+
1336
+ @media (max-width: 767.98px) {
1337
+ .settings-card__head {
1338
+ padding-inline: 1rem;
1339
+ }
1340
+ .settings-card__body {
1341
+ padding-inline: 1rem;
1342
+ }
1343
+ .settings-card__footer {
1344
+ padding-inline: 1rem;
1345
+ }
1346
+ }
1347
+ </style>
1348
+ ```
1349
+
1350
+ ### ProfileSection.vue
1351
+
1352
+ The explicit-save section: Zod schema, 422s, dirty footer.
1353
+
1354
+ ```vue
1355
+ <!-- SettingsWorkspace/ProfileSection.vue — the explicit-save section: Zod-validated fields, 422s, dirty footer. -->
1356
+ <template>
1357
+ <section class="settings-section" data-test="section-profile">
1358
+ <SectionHeader
1359
+ description="How you appear to teammates, and on the invoices and reminders you send."
1360
+ scope="Your account"
1361
+ title="Profile"
1362
+ />
1363
+
1364
+ <div class="settings-section__stack">
1365
+ <SettingsCard
1366
+ description="Shown beside your name everywhere. It saves as soon as you pick it."
1367
+ title="Profile picture"
1368
+ >
1369
+ <AvatarField />
1370
+ </SettingsCard>
1371
+
1372
+ <!-- Loading: the card's own shape, so nothing jumps when data lands. -->
1373
+ <SettingsCard
1374
+ v-if="!ctx.profile.value"
1375
+ description="Your name, work email and the zone your dates are shown in."
1376
+ title="Personal details"
1377
+ >
1378
+ <div
1379
+ aria-busy="true"
1380
+ class="profile-skeleton"
1381
+ data-test="profile-loading"
1382
+ >
1383
+ <span class="sr-only">Loading your profile…</span>
1384
+ <span v-for="n in 4" :key="n" class="profile-skeleton__field" />
1385
+ </div>
1386
+ </SettingsCard>
1387
+
1388
+ <div v-else ref="formRoot">
1389
+ <!-- BbForm owns validation (the Zod schema) and the server's 422
1390
+ (setErrors, through the coopted form context). The page context
1391
+ owns WHAT IS SAVED, so "dirty" means "differs from the server",
1392
+ not "differs from the values this form mounted with". -->
1393
+ <BbForm
1394
+ :id="PROFILE_FORM"
1395
+ v-slot="{ isSubmitting }"
1396
+ v-model="ctx.profileDraft"
1397
+ :schema="profileSchema"
1398
+ @submit="onSubmit"
1399
+ >
1400
+ <SettingsCard
1401
+ description="Your name, work email and the zone your dates are shown in."
1402
+ title="Personal details"
1403
+ >
1404
+ <div class="profile-grid">
1405
+ <BbTextInput autocomplete="name" label="Full name" name="name" />
1406
+ <!-- Paired so each row's fields share a shape: the two plain
1407
+ fields first, the two with a consequence line second. -->
1408
+ <BbTextInput
1409
+ autocomplete="organization-title"
1410
+ label="Job title (optional)"
1411
+ name="title"
1412
+ placeholder="Shown under your name on invoices"
1413
+ validation-label="Job title"
1414
+ />
1415
+ <BbTextInput
1416
+ autocomplete="email"
1417
+ description="A new address gets a confirmation link."
1418
+ label="Work email"
1419
+ name="email"
1420
+ type="email"
1421
+ />
1422
+ <BbSelect
1423
+ description="Due dates and reminders follow this zone."
1424
+ item-text="label"
1425
+ item-value="value"
1426
+ :items="TIMEZONES"
1427
+ label="Time zone"
1428
+ name="timezone"
1429
+ />
1430
+ </div>
1431
+
1432
+ <template #footer>
1433
+ <p
1434
+ class="settings-card__hint"
1435
+ :class="{
1436
+ 'settings-card__hint--dirty': ctx.profileDirty.value,
1437
+ }"
1438
+ data-test="profile-hint"
1439
+ role="status"
1440
+ >
1441
+ {{
1442
+ ctx.profileDirty.value
1443
+ ? 'You have unsaved changes.'
1444
+ : 'All changes saved.'
1445
+ }}
1446
+ </p>
1447
+ <BbButton
1448
+ v-if="ctx.profileDirty.value"
1449
+ data-test="profile-discard"
1450
+ variant="ghost"
1451
+ @click="ctx.discardProfile"
1452
+ >
1453
+ Discard
1454
+ </BbButton>
1455
+ <!-- Disabled until there is something to save: the hint beside
1456
+ it says why, so the state is never a mystery. -->
1457
+ <BbButton
1458
+ data-test="profile-save"
1459
+ :disabled="!ctx.profileDirty.value"
1460
+ :loading="isSubmitting"
1461
+ type="submit"
1462
+ variant="primary"
1463
+ >
1464
+ Save profile
1465
+ </BbButton>
1466
+ </template>
1467
+ </SettingsCard>
1468
+ </BbForm>
1469
+ </div>
1470
+ </div>
1471
+ </section>
1472
+ </template>
1473
+
1474
+ <script setup lang="ts">
1475
+ import { useTemplateRef } from 'vue';
1476
+ import { z } from 'zod';
1477
+ import { BbButton, BbForm, BbSelect, BbTextInput } from 'bitboss-ui';
1478
+ import AvatarField from './AvatarField.vue';
1479
+ import SectionHeader from './SectionHeader.vue';
1480
+ import SettingsCard from './SettingsCard.vue';
1481
+ import {
1482
+ PROFILE_FORM,
1483
+ focusFirstServerError,
1484
+ useSettingsWorkspace,
1485
+ } from './context';
1486
+
1487
+ const ctx = useSettingsWorkspace();
1488
+ const formRoot = useTemplateRef<HTMLElement>('formRoot');
1489
+
1490
+ // The client half of the rules. An emptied text field holds `null`, so each
1491
+ // string carries its message on the type too. The server re-checks all of it,
1492
+ // plus what only it can know (the address belongs to a teammate).
1493
+ const profileSchema = z.object({
1494
+ name: z
1495
+ .string('Enter your full name.')
1496
+ .trim()
1497
+ .min(2, 'Enter your full name.')
1498
+ .max(80, 'Keep your name under 80 characters.'),
1499
+ title: z
1500
+ .string()
1501
+ .trim()
1502
+ .max(60, 'Keep your title under 60 characters.')
1503
+ .nullable()
1504
+ .transform((title) => title || null),
1505
+ email: z.email('Enter a valid email address.').trim().toLowerCase(),
1506
+ timezone: z.string('Pick your time zone.'),
1507
+ });
1508
+
1509
+ // Returning the promise keeps the Save button's spinner up until it settles.
1510
+ const onSubmit = async (values: z.output<typeof profileSchema>) => {
1511
+ const saved = await ctx.saveProfile(values);
1512
+ // setErrors does not move focus; a keyboard user lands on the problem.
1513
+ if (!saved) await focusFirstServerError(formRoot.value);
1514
+ };
1515
+
1516
+ const TIMEZONES = [
1517
+ { value: 'America/Los_Angeles', label: 'Los Angeles (GMT−7)' },
1518
+ { value: 'America/New_York', label: 'New York (GMT−4)' },
1519
+ { value: 'America/Sao_Paulo', label: 'São Paulo (GMT−3)' },
1520
+ { value: 'Europe/London', label: 'London (GMT+1)' },
1521
+ { value: 'Europe/Lisbon', label: 'Lisbon (GMT+1)' },
1522
+ { value: 'Europe/Berlin', label: 'Berlin (GMT+2)' },
1523
+ { value: 'Europe/Rome', label: 'Rome (GMT+2)' },
1524
+ { value: 'Asia/Dubai', label: 'Dubai (GMT+4)' },
1525
+ { value: 'Asia/Singapore', label: 'Singapore (GMT+8)' },
1526
+ { value: 'Asia/Tokyo', label: 'Tokyo (GMT+9)' },
1527
+ { value: 'Australia/Sydney', label: 'Sydney (GMT+10)' },
1528
+ ];
1529
+ </script>
1530
+
1531
+ <style scoped>
1532
+ .profile-grid,
1533
+ .profile-skeleton {
1534
+ display: grid;
1535
+ gap: 1.125rem 1.25rem;
1536
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1537
+ }
1538
+
1539
+ @media (max-width: 767.98px) {
1540
+ .profile-grid,
1541
+ .profile-skeleton {
1542
+ grid-template-columns: minmax(0, 1fr);
1543
+ }
1544
+ }
1545
+
1546
+ .profile-skeleton__field {
1547
+ animation: settings-pulse 1.4s ease-in-out infinite;
1548
+ background: color-mix(in oklab, var(--bb-text) 7%, var(--bb-panel));
1549
+ border-radius: var(--bb-radius);
1550
+ height: calc(var(--bb-control-h) + 1.25rem);
1551
+ }
1552
+
1553
+ .settings-card__hint {
1554
+ color: var(--bb-text-muted);
1555
+ font-size: 0.8125rem;
1556
+ margin-inline-end: auto;
1557
+ }
1558
+
1559
+ .settings-card__hint--dirty {
1560
+ color: var(--bb-text);
1561
+ font-weight: 500;
1562
+ }
1563
+
1564
+ @keyframes settings-pulse {
1565
+ 50% {
1566
+ opacity: 0.55;
1567
+ }
1568
+ }
1569
+
1570
+ @media (prefers-reduced-motion: reduce) {
1571
+ .profile-skeleton__field {
1572
+ animation: none;
1573
+ }
1574
+ }
1575
+ </style>
1576
+ ```
1577
+
1578
+ ### AvatarField.vue
1579
+
1580
+ The instant-save avatar: drop or browse, uploaded on pick.
1581
+
1582
+ ```vue
1583
+ <!-- SettingsWorkspace/AvatarField.vue — the instant-save avatar: drop or browse, uploaded on pick. -->
1584
+ <template>
1585
+ <div class="avatar-field">
1586
+ <!-- The dropzone captures; the context uploads the moment a valid file
1587
+ lands (a picture is its own commit, like GitHub's). The model is
1588
+ cleared after each pick so the same file can be chosen again. -->
1589
+ <BbDropzone
1590
+ :accept="['image/png', 'image/jpeg', 'image/webp']"
1591
+ data-test="avatar-dropzone"
1592
+ :disabled="ctx.avatarUploading.value || !ctx.profile.value"
1593
+ :errors="rejection"
1594
+ :max-size="2 * 1024 * 1024"
1595
+ :model-value="null"
1596
+ @error="onReject"
1597
+ @update:model-value="onPick"
1598
+ >
1599
+ <template #default="{ dragging, focused, open, labelId }">
1600
+ <div
1601
+ class="avatar-field__zone"
1602
+ :class="{
1603
+ 'avatar-field__zone--dragging': dragging,
1604
+ 'avatar-field__zone--focused': focused,
1605
+ }"
1606
+ >
1607
+ <span class="avatar-field__avatar">
1608
+ <BbAvatar
1609
+ :alt="ctx.profile.value?.name ?? ''"
1610
+ size="56"
1611
+ :src="ctx.profile.value?.avatarUrl ?? undefined"
1612
+ >
1613
+ {{ ctx.profile.value ? initials(ctx.profile.value.name) : '' }}
1614
+ </BbAvatar>
1615
+ <span
1616
+ v-if="ctx.avatarUploading.value"
1617
+ class="avatar-field__busy"
1618
+ data-test="avatar-uploading"
1619
+ >
1620
+ <BbSpinner size="sm" />
1621
+ </span>
1622
+ </span>
1623
+ <span class="avatar-field__copy">
1624
+ <span :id="labelId" class="avatar-field__headline">
1625
+ {{
1626
+ dragging ? 'Drop to use this picture' : 'Drag a picture here'
1627
+ }}
1628
+ </span>
1629
+ <span class="avatar-field__hint">
1630
+ Square works best. PNG, JPEG or WebP, up to 2 MB.
1631
+ </span>
1632
+ </span>
1633
+ <span class="avatar-field__actions">
1634
+ <BbButton
1635
+ data-test="avatar-browse"
1636
+ prepend:icon="lucide:upload"
1637
+ variant="outline"
1638
+ @click="open"
1639
+ >
1640
+ Upload
1641
+ </BbButton>
1642
+ </span>
1643
+ </div>
1644
+ </template>
1645
+ </BbDropzone>
1646
+ <!-- Outside the label: a button inside the drop area would also open the
1647
+ file picker. -->
1648
+ <BbButton
1649
+ v-if="ctx.profile.value?.avatarUrl"
1650
+ class="avatar-field__remove"
1651
+ data-test="avatar-remove"
1652
+ :disabled="ctx.avatarUploading.value"
1653
+ variant="ghost"
1654
+ @click="ctx.removeAvatar"
1655
+ >
1656
+ Remove picture
1657
+ </BbButton>
1658
+ </div>
1659
+ </template>
1660
+
1661
+ <script setup lang="ts">
1662
+ import { ref } from 'vue';
1663
+ import { BbAvatar, BbButton, BbDropzone, BbSpinner } from 'bitboss-ui';
1664
+ import type { DropZoneError } from 'bitboss-ui';
1665
+ import { useSettingsWorkspace } from './context';
1666
+ import { initials } from './format';
1667
+
1668
+ const ctx = useSettingsWorkspace();
1669
+
1670
+ // Rung 1: only this leaf shows the reject message.
1671
+ const rejection = ref('');
1672
+
1673
+ const onPick = (file: File | File[] | null) => {
1674
+ const picked = Array.isArray(file) ? file[0] : file;
1675
+ if (!picked) return;
1676
+ rejection.value = '';
1677
+ void ctx.uploadAvatar(picked);
1678
+ };
1679
+
1680
+ // Rejects never reach the model: turn the typed error into the sentence.
1681
+ const onReject = (error: DropZoneError) => {
1682
+ rejection.value =
1683
+ error.type === 'maxSize'
1684
+ ? `${error.filename} is ${error.formattedSize}. The limit is ${error.formattedMaxSize}.`
1685
+ : error.type === 'accept'
1686
+ ? `${error.filename} is not a PNG, JPEG or WebP image.`
1687
+ : `${error.filename} could not be used.`;
1688
+ };
1689
+ </script>
1690
+
1691
+ <style scoped>
1692
+ .avatar-field {
1693
+ align-items: flex-start;
1694
+ display: flex;
1695
+ flex-direction: column;
1696
+ gap: 0.5rem;
1697
+ }
1698
+
1699
+ .avatar-field > :first-child {
1700
+ width: 100%;
1701
+ }
1702
+
1703
+ .avatar-field__zone {
1704
+ align-items: center;
1705
+ border: var(--bb-border-w) solid var(--bb-border);
1706
+ border-radius: var(--bb-radius);
1707
+ cursor: pointer;
1708
+ display: flex;
1709
+ flex-wrap: wrap;
1710
+ gap: 0.875rem 1rem;
1711
+ padding: 0.75rem;
1712
+ transition:
1713
+ background-color var(--bb-transition-fast) var(--bb-ease),
1714
+ border-color var(--bb-transition-fast) var(--bb-ease);
1715
+ }
1716
+
1717
+ .avatar-field__zone:hover,
1718
+ .avatar-field__zone--dragging {
1719
+ background: color-mix(in oklab, var(--bb-primary) 5%, var(--bb-panel));
1720
+ border-color: color-mix(in oklab, var(--bb-primary) 35%, var(--bb-border));
1721
+ }
1722
+
1723
+ /* The real input is visually hidden: its focus shows on our surface. */
1724
+ .avatar-field__zone--focused {
1725
+ box-shadow: 0 0 0 var(--bb-ring-size) var(--bb-ring);
1726
+ }
1727
+
1728
+ .avatar-field__avatar {
1729
+ display: inline-flex;
1730
+ flex-shrink: 0;
1731
+ position: relative;
1732
+ }
1733
+
1734
+ .avatar-field__busy {
1735
+ align-items: center;
1736
+ background: color-mix(in oklab, var(--bb-panel) 70%, transparent);
1737
+ border-radius: 999px;
1738
+ display: flex;
1739
+ inset: 0;
1740
+ justify-content: center;
1741
+ position: absolute;
1742
+ }
1743
+
1744
+ .avatar-field__copy {
1745
+ display: flex;
1746
+ flex: 1 1 12rem;
1747
+ flex-direction: column;
1748
+ gap: 0.125rem;
1749
+ min-width: 0;
1750
+ }
1751
+
1752
+ .avatar-field__headline {
1753
+ font-size: 0.875rem;
1754
+ font-weight: 500;
1755
+ }
1756
+
1757
+ .avatar-field__hint {
1758
+ color: var(--bb-text-muted);
1759
+ font-size: 0.8125rem;
1760
+ }
1761
+
1762
+ .avatar-field__actions {
1763
+ flex-shrink: 0;
1764
+ }
1765
+ </style>
1766
+ ```
1767
+
1768
+ ### NotificationsSection.vue
1769
+
1770
+ The instant-save section: two cards, skeletons.
1771
+
1772
+ ```vue
1773
+ <!-- SettingsWorkspace/NotificationsSection.vue — the instant-save section: channel switches + event matrix. -->
1774
+ <template>
1775
+ <section class="settings-section" data-test="section-notifications">
1776
+ <SectionHeader
1777
+ description="Every change saves the moment you make it. Nothing to submit here."
1778
+ scope="Your account"
1779
+ title="Notifications"
1780
+ />
1781
+
1782
+ <div class="settings-section__stack">
1783
+ <SettingsCard
1784
+ description="Where notifications can reach you. A channel that is off is skipped for every event below."
1785
+ title="Delivery channels"
1786
+ >
1787
+ <div v-if="!prefs" aria-busy="true" class="notif-skeleton">
1788
+ <span class="sr-only">Loading notification settings…</span>
1789
+ <span v-for="n in 3" :key="n" class="notif-skeleton__row" />
1790
+ </div>
1791
+ <ChannelSwitches v-else />
1792
+ </SettingsCard>
1793
+
1794
+ <SettingsCard
1795
+ description="Pick, per event, which of your channels it uses."
1796
+ title="What you hear about"
1797
+ >
1798
+ <div v-if="!prefs" aria-busy="true" class="notif-skeleton">
1799
+ <span v-for="n in 5" :key="n" class="notif-skeleton__row" />
1800
+ </div>
1801
+ <EventMatrix v-else />
1802
+ </SettingsCard>
1803
+ </div>
1804
+ </section>
1805
+ </template>
1806
+
1807
+ <script setup lang="ts">
1808
+ import { computed } from 'vue';
1809
+ import ChannelSwitches from './ChannelSwitches.vue';
1810
+ import EventMatrix from './EventMatrix.vue';
1811
+ import SectionHeader from './SectionHeader.vue';
1812
+ import SettingsCard from './SettingsCard.vue';
1813
+ import { useSettingsWorkspace } from './context';
1814
+
1815
+ const ctx = useSettingsWorkspace();
1816
+ const prefs = computed(() => ctx.notifications.value);
1817
+ </script>
1818
+
1819
+ <style scoped>
1820
+ .notif-skeleton {
1821
+ display: flex;
1822
+ flex-direction: column;
1823
+ gap: 0.75rem;
1824
+ }
1825
+
1826
+ .notif-skeleton__row {
1827
+ animation: settings-pulse 1.4s ease-in-out infinite;
1828
+ background: color-mix(in oklab, var(--bb-text) 7%, var(--bb-panel));
1829
+ border-radius: var(--bb-radius);
1830
+ height: 2.25rem;
1831
+ }
1832
+
1833
+ @keyframes settings-pulse {
1834
+ 50% {
1835
+ opacity: 0.55;
1836
+ }
1837
+ }
1838
+
1839
+ @media (prefers-reduced-motion: reduce) {
1840
+ .notif-skeleton__row {
1841
+ animation: none;
1842
+ }
1843
+ }
1844
+ </style>
1845
+ ```
1846
+
1847
+ ### notifications.ts
1848
+
1849
+ The static channel and event catalog.
1850
+
1851
+ ```ts
1852
+ // SettingsWorkspace/notifications.ts — the static notification catalog
1853
+ // (presentation data with two readers, the channel switches and the matrix).
1854
+ import type { NotificationChannel, NotificationEvent } from './types';
1855
+
1856
+ export const CHANNELS: Array<{
1857
+ id: NotificationChannel;
1858
+ name: string;
1859
+ description: string;
1860
+ }> = [
1861
+ {
1862
+ id: 'email',
1863
+ name: 'Email',
1864
+ description: 'To sofia@fennelhart.co, batched when several land at once.',
1865
+ },
1866
+ {
1867
+ id: 'push',
1868
+ name: 'Desktop push',
1869
+ description: 'On this browser, only while you are signed in.',
1870
+ },
1871
+ {
1872
+ id: 'slack',
1873
+ name: 'Slack',
1874
+ description: 'Direct messages from the Northwind app in your Slack.',
1875
+ },
1876
+ ];
1877
+
1878
+ export const EVENTS: Array<{
1879
+ id: NotificationEvent;
1880
+ name: string;
1881
+ description: string;
1882
+ }> = [
1883
+ {
1884
+ id: 'invoice-paid',
1885
+ name: 'Invoice paid',
1886
+ description: 'Including partial payments and refunds.',
1887
+ },
1888
+ {
1889
+ id: 'invoice-overdue',
1890
+ name: 'Invoice overdue',
1891
+ description: 'The morning after the due date passes.',
1892
+ },
1893
+ {
1894
+ id: 'payment-failed',
1895
+ name: 'Card payment failed',
1896
+ description: 'Owners always get this one by email.',
1897
+ },
1898
+ {
1899
+ id: 'member-joined',
1900
+ name: 'Someone joins',
1901
+ description: 'When an invitation is accepted.',
1902
+ },
1903
+ {
1904
+ id: 'mentioned',
1905
+ name: 'You are mentioned',
1906
+ description: 'In an invoice note or a comment.',
1907
+ },
1908
+ {
1909
+ id: 'weekly-summary',
1910
+ name: 'Weekly summary',
1911
+ description: 'Revenue, outstanding and overdue, Mondays at 08:00.',
1912
+ },
1913
+ ];
1914
+ ```
1915
+
1916
+ ### ChannelSwitches.vue
1917
+
1918
+ Delivery channels: a BbSwitchGroup settings list.
1919
+
1920
+ ```vue
1921
+ <!-- SettingsWorkspace/ChannelSwitches.vue — the delivery channels, one switch each, saved on flip. -->
1922
+ <template>
1923
+ <!-- The settings-list layout from the BbSwitchGroup guide: label first,
1924
+ switch on the trailing edge, a rule between rows. Controlled, so a
1925
+ refused write (Slack's expired token) snaps the switch back. -->
1926
+ <BbSwitchGroup
1927
+ v-if="ctx.notifications.value"
1928
+ data-test="notification-channels"
1929
+ hide-legend
1930
+ item-layout="label-fill"
1931
+ :item-props="{ description: 'description' }"
1932
+ item-reverse
1933
+ item-text="name"
1934
+ item-value="id"
1935
+ :items="CHANNELS"
1936
+ legend="Delivery channels"
1937
+ list-layout="vertical-stretch"
1938
+ :model-value="ctx.notifications.value.channels"
1939
+ name="notification-channels"
1940
+ pt:item="py-3"
1941
+ pt:list="[--row-gap:0px] divide-y divide-(--bb-border)"
1942
+ :readonly="ctx.notificationsSaving.value"
1943
+ @update:model-value="ctx.setChannels"
1944
+ />
1945
+ </template>
1946
+
1947
+ <script setup lang="ts">
1948
+ import { BbSwitchGroup } from 'bitboss-ui';
1949
+ import { useSettingsWorkspace } from './context';
1950
+ import { CHANNELS } from './notifications';
1951
+
1952
+ const ctx = useSettingsWorkspace();
1953
+ </script>
1954
+ ```
1955
+
1956
+ ### EventMatrix.vue
1957
+
1958
+ Events × channels: one BbCheckboxGroup per event.
1959
+
1960
+ ```vue
1961
+ <!-- SettingsWorkspace/EventMatrix.vue — events × channels, one checkbox group per event, saved on tick. -->
1962
+ <template>
1963
+ <div v-if="prefs" class="event-matrix" data-test="notification-matrix">
1964
+ <!-- Column heads for sighted users; each checkbox keeps its own
1965
+ accessible name ("Email") inside its event's fieldset, so a screen
1966
+ reader hears "Invoice paid, group. Email, checkbox, checked". -->
1967
+ <div aria-hidden="true" class="event-matrix__head">
1968
+ <span />
1969
+ <span
1970
+ v-for="channel in CHANNELS"
1971
+ :key="channel.id"
1972
+ class="event-matrix__column"
1973
+ :class="{ 'event-matrix__column--off': !isOn(channel.id) }"
1974
+ >
1975
+ {{ channel.id === 'push' ? 'Push' : channel.name }}
1976
+ </span>
1977
+ </div>
1978
+
1979
+ <BbCheckboxGroup
1980
+ v-for="event in EVENTS"
1981
+ :key="event.id"
1982
+ class="event-matrix__row"
1983
+ :data-test="`event-row:${event.id}`"
1984
+ :description="event.description"
1985
+ item-text="name"
1986
+ item-value="id"
1987
+ :items="CHANNELS"
1988
+ layout="label-fill"
1989
+ :legend="event.name"
1990
+ list-layout="horizontal"
1991
+ :model-value="prefs.events[event.id]"
1992
+ :name="`events-${event.id}`"
1993
+ pt:item="event-matrix__cell"
1994
+ pt:label="sr-only"
1995
+ pt:list="event-matrix__cells"
1996
+ :readonly="ctx.notificationsSaving.value"
1997
+ :selectable="(channel) => isSelectable(event.id, channel.id)"
1998
+ @update:model-value="(next) => ctx.setEventChannels(event.id, next)"
1999
+ />
2000
+ </div>
2001
+ </template>
2002
+
2003
+ <script setup lang="ts">
2004
+ import { computed } from 'vue';
2005
+ import { BbCheckboxGroup } from 'bitboss-ui';
2006
+ import type { NotificationChannel, NotificationEvent } from './types';
2007
+ import { useSettingsWorkspace } from './context';
2008
+ import { CHANNELS, EVENTS } from './notifications';
2009
+
2010
+ const ctx = useSettingsWorkspace();
2011
+ const prefs = computed(() => ctx.notifications.value);
2012
+
2013
+ const isOn = (channel: NotificationChannel) =>
2014
+ prefs.value?.channels.includes(channel) ?? false;
2015
+
2016
+ // A channel that is off greys out its whole column; the owner's
2017
+ // payment-failure email is locked on (the server enforces it too).
2018
+ const isSelectable = (event: NotificationEvent, channel: NotificationChannel) =>
2019
+ isOn(channel) && !(event === 'payment-failed' && channel === 'email');
2020
+ </script>
2021
+
2022
+ <style scoped>
2023
+ .event-matrix {
2024
+ --cell-w: 4.25rem;
2025
+ display: flex;
2026
+ flex-direction: column;
2027
+ }
2028
+
2029
+ .event-matrix__head {
2030
+ color: var(--bb-text-muted);
2031
+ display: grid;
2032
+ font-size: 0.75rem;
2033
+ font-weight: 500;
2034
+ grid-template-columns: 1fr repeat(3, var(--cell-w));
2035
+ padding-block-end: 0.5rem;
2036
+ }
2037
+
2038
+ .event-matrix__column {
2039
+ text-align: center;
2040
+ }
2041
+
2042
+ .event-matrix__column--off {
2043
+ opacity: 0.55;
2044
+ }
2045
+
2046
+ .event-matrix__row {
2047
+ border-block-start: var(--bb-border-w) solid var(--bb-border);
2048
+ padding-block: 0.75rem;
2049
+ }
2050
+
2051
+ /* The list's own gap token, zeroed: the fixed-width cells ARE the spacing,
2052
+ so each checkbox sits centred under its column head. */
2053
+ :deep(.event-matrix__cells) {
2054
+ --gap: 0px;
2055
+ flex-wrap: nowrap;
2056
+ }
2057
+
2058
+ :deep(.event-matrix__cell) {
2059
+ justify-content: center;
2060
+ width: var(--cell-w);
2061
+ }
2062
+
2063
+ @media (max-width: 767.98px) {
2064
+ .event-matrix {
2065
+ --cell-w: 3.25rem;
2066
+ }
2067
+ }
2068
+ </style>
2069
+ ```
2070
+
2071
+ ### MembersSection.vue
2072
+
2073
+ Roster: search, seats, table, empty state.
2074
+
2075
+ ```vue
2076
+ <!-- SettingsWorkspace/MembersSection.vue — the roster: seats, search, one-click roles, invite, remove. -->
2077
+ <template>
2078
+ <section class="settings-section" data-test="section-members">
2079
+ <SectionHeader
2080
+ description="People who can sign in to this workspace. A role decides what they see and change, and it applies the moment you pick it."
2081
+ :scope="ctx.workspace.value?.name ?? 'Workspace'"
2082
+ title="Members"
2083
+ >
2084
+ <BbButton
2085
+ data-test="invite-open"
2086
+ :disabled="seatsLeft === 0"
2087
+ prepend:icon="lucide:user-plus"
2088
+ variant="primary"
2089
+ @click="() => (ctx.dialogs.invite.value = true)"
2090
+ >
2091
+ Invite people
2092
+ </BbButton>
2093
+ </SectionHeader>
2094
+
2095
+ <div class="members-toolbar">
2096
+ <BbTextInput
2097
+ v-model="ctx.memberSearch.value"
2098
+ class="members-toolbar__search"
2099
+ clearable
2100
+ compact
2101
+ data-test="member-search"
2102
+ hide-label
2103
+ label="Search members"
2104
+ placeholder="Search by name or email"
2105
+ prepend:icon="lucide:search"
2106
+ />
2107
+ <div
2108
+ v-if="ctx.seats.value"
2109
+ class="members-seats"
2110
+ data-test="member-seats"
2111
+ >
2112
+ <span class="members-seats__text">
2113
+ <strong>{{ ctx.seats.value.used }}</strong> of
2114
+ {{ ctx.seats.value.included }} seats used
2115
+ </span>
2116
+ <BbProgress
2117
+ aria-label="Seats used"
2118
+ class="members-seats__bar"
2119
+ :max="ctx.seats.value.included"
2120
+ :model-value="ctx.seats.value.used"
2121
+ />
2122
+ <!-- The disabled Invite button's reason, and the way out of it. -->
2123
+ <BbButton
2124
+ v-if="seatsLeft === 0"
2125
+ data-test="seats-full"
2126
+ size="sm"
2127
+ variant="link"
2128
+ @click="() => (ctx.section.value = 'billing')"
2129
+ >
2130
+ No seats left. Add seats
2131
+ </BbButton>
2132
+ </div>
2133
+ </div>
2134
+
2135
+ <BbTable
2136
+ caption="Workspace members"
2137
+ class="members-table"
2138
+ :columns="columns"
2139
+ compact
2140
+ data-test="members-table"
2141
+ item-value="id"
2142
+ :items="ctx.visibleMembers.value"
2143
+ :loading="!ctx.members.value"
2144
+ loading-text="Loading members…"
2145
+ >
2146
+ <template #name="{ item }">
2147
+ <span class="member-identity">
2148
+ <BbAvatar :alt="item.name" class="member-avatar" size="28">{{
2149
+ initials(item.name)
2150
+ }}</BbAvatar>
2151
+ <span class="member-identity__text">
2152
+ <span class="member-identity__name">
2153
+ {{ item.name }}
2154
+ <span
2155
+ v-if="item.id === ctx.profile.value?.id"
2156
+ class="member-identity__you"
2157
+ >You</span
2158
+ >
2159
+ </span>
2160
+ <span class="member-identity__email">{{ item.email }}</span>
2161
+ <!-- On a phone the activity column is hidden; its fact moves here. -->
2162
+ <span v-if="isMobile" class="member-identity__email">
2163
+ {{ activity(item) }}
2164
+ </span>
2165
+ </span>
2166
+ </span>
2167
+ </template>
2168
+
2169
+ <template #role="{ item }">
2170
+ <MemberRoleCell :member="item" />
2171
+ </template>
2172
+
2173
+ <template #last-active-at="{ item }">
2174
+ <BbBadge
2175
+ v-if="item.status === 'invited'"
2176
+ :data-test="`member-invited:${item.id}`"
2177
+ variant="soft-amber"
2178
+ >
2179
+ Invited
2180
+ </BbBadge>
2181
+ <span v-else class="member-activity">{{ activity(item) }}</span>
2182
+ </template>
2183
+
2184
+ <template #actions="{ item }">
2185
+ <MemberRowActions :member="item" />
2186
+ </template>
2187
+
2188
+ <template #empty>
2189
+ <div class="members-empty" data-test="members-empty">
2190
+ <p class="members-empty__title">
2191
+ No one matches “{{ ctx.memberSearch.value }}”
2192
+ </p>
2193
+ <p class="members-empty__hint">
2194
+ Search looks at names and email addresses.
2195
+ </p>
2196
+ <BbButton
2197
+ variant="outline"
2198
+ @click="() => (ctx.memberSearch.value = '')"
2199
+ >
2200
+ Clear search
2201
+ </BbButton>
2202
+ </div>
2203
+ </template>
2204
+ </BbTable>
2205
+ </section>
2206
+ </template>
2207
+
2208
+ <script setup lang="ts">
2209
+ import { computed } from 'vue';
2210
+ import {
2211
+ BbAvatar,
2212
+ BbBadge,
2213
+ BbButton,
2214
+ BbProgress,
2215
+ BbTable,
2216
+ BbTextInput,
2217
+ useMobile,
2218
+ } from 'bitboss-ui';
2219
+ import type { BbTableColumn } from 'bitboss-ui';
2220
+ import type { WorkspaceMember } from './types';
2221
+ import MemberRoleCell from './MemberRoleCell.vue';
2222
+ import MemberRowActions from './MemberRowActions.vue';
2223
+ import SectionHeader from './SectionHeader.vue';
2224
+ import { useSettingsWorkspace } from './context';
2225
+ import { formatRelative, initials } from './format';
2226
+
2227
+ const ctx = useSettingsWorkspace();
2228
+ const { isMobile } = useMobile();
2229
+
2230
+ const seatsLeft = computed(() =>
2231
+ ctx.seats.value ? ctx.seats.value.included - ctx.seats.value.used : null
2232
+ );
2233
+
2234
+ // Rank the columns: identity + role stay on a phone; activity folds into the
2235
+ // identity cell (the BbTable guide's "hide columns, don't scroll").
2236
+ const columns = computed<Array<BbTableColumn<WorkspaceMember>>>(() => [
2237
+ // On a phone the identity track may shrink (long emails ellipse) instead of
2238
+ // pushing the row menu off screen.
2239
+ {
2240
+ key: 'name',
2241
+ label: 'Member',
2242
+ skeleton: 'avatar-text',
2243
+ width: isMobile.value ? '1fr' : undefined,
2244
+ tdClass: 'member-cell',
2245
+ },
2246
+ {
2247
+ key: 'role',
2248
+ label: 'Role',
2249
+ width: isMobile.value ? undefined : '10rem',
2250
+ skeleton: 'badge',
2251
+ },
2252
+ {
2253
+ key: 'lastActiveAt',
2254
+ label: 'Last active',
2255
+ width: '9rem',
2256
+ hidden: isMobile.value,
2257
+ },
2258
+ ]);
2259
+
2260
+ const activity = (member: WorkspaceMember) =>
2261
+ member.status === 'invited'
2262
+ ? `Invited ${formatRelative(member.invitedAt)}`
2263
+ : formatRelative(member.lastActiveAt, 'Not signed in yet');
2264
+ </script>
2265
+
2266
+ <style scoped>
2267
+ .members-toolbar {
2268
+ align-items: center;
2269
+ display: flex;
2270
+ flex-wrap: wrap;
2271
+ gap: 0.75rem 1.5rem;
2272
+ justify-content: space-between;
2273
+ padding-block-end: 0.75rem;
2274
+ }
2275
+
2276
+ .members-toolbar__search {
2277
+ flex: 1 1 16rem;
2278
+ max-width: 22rem;
2279
+ }
2280
+
2281
+ .members-seats {
2282
+ align-items: center;
2283
+ display: flex;
2284
+ gap: 0.75rem;
2285
+ }
2286
+
2287
+ .members-seats__text {
2288
+ color: var(--bb-text-muted);
2289
+ font-size: 0.8125rem;
2290
+ white-space: nowrap;
2291
+ }
2292
+
2293
+ .members-seats__text strong {
2294
+ color: var(--bb-text);
2295
+ font-weight: 600;
2296
+ }
2297
+
2298
+ .members-seats__bar {
2299
+ width: 7rem;
2300
+ }
2301
+
2302
+ .members-table {
2303
+ border: var(--bb-border-w) solid var(--bb-border);
2304
+ border-radius: var(--bb-radius-surface);
2305
+ }
2306
+
2307
+ /* The identity cell may shrink below its content (min-width: 0), so a long
2308
+ email ellipses instead of widening the track. */
2309
+ :deep(.member-cell) {
2310
+ min-width: 0;
2311
+ overflow: hidden;
2312
+ }
2313
+
2314
+ .member-identity {
2315
+ align-items: center;
2316
+ display: flex;
2317
+ gap: 0.625rem;
2318
+ min-width: 0;
2319
+ }
2320
+
2321
+ /* A roster of nine solid primary discs shouts; initials sit on a quiet
2322
+ neutral here, through the avatar's own fallback locals. */
2323
+ .member-avatar {
2324
+ flex-shrink: 0;
2325
+ --bg: color-mix(in oklab, var(--bb-text) 9%, var(--bb-panel));
2326
+ --fg: var(--bb-text);
2327
+ font-size: 0.6875rem;
2328
+ font-weight: 600;
2329
+ }
2330
+
2331
+ .member-identity__text {
2332
+ display: flex;
2333
+ flex-direction: column;
2334
+ min-width: 0;
2335
+ }
2336
+
2337
+ .member-identity__name {
2338
+ align-items: center;
2339
+ display: flex;
2340
+ font-weight: 500;
2341
+ gap: 0.375rem;
2342
+ }
2343
+
2344
+ .member-identity__you {
2345
+ color: var(--bb-text-muted);
2346
+ font-size: 0.75rem;
2347
+ font-weight: 500;
2348
+ }
2349
+
2350
+ .member-identity__email {
2351
+ color: var(--bb-text-muted);
2352
+ font-size: 0.75rem;
2353
+ overflow: hidden;
2354
+ text-overflow: ellipsis;
2355
+ white-space: nowrap;
2356
+ }
2357
+
2358
+ .member-activity {
2359
+ color: var(--bb-text-muted);
2360
+ font-size: 0.8125rem;
2361
+ }
2362
+
2363
+ .members-empty {
2364
+ align-items: center;
2365
+ display: flex;
2366
+ flex-direction: column;
2367
+ gap: 0.375rem;
2368
+ padding: 1.5rem 1rem;
2369
+ text-align: center;
2370
+ }
2371
+
2372
+ .members-empty__title {
2373
+ font-weight: 600;
2374
+ }
2375
+
2376
+ .members-empty__hint {
2377
+ color: var(--bb-text-muted);
2378
+ font-size: 0.8125rem;
2379
+ padding-block-end: 0.375rem;
2380
+ }
2381
+ </style>
2382
+ ```
2383
+
2384
+ ### MemberRoleCell.vue
2385
+
2386
+ One-click role picker (BbSelectPopover).
2387
+
2388
+ ```vue
2389
+ <!-- SettingsWorkspace/MemberRoleCell.vue — one-click role picker; the pick IS the save. -->
2390
+ <template>
2391
+ <!-- The owner's role moves only through "Transfer ownership", and nobody
2392
+ demotes themselves from a table cell: both read as plain text. -->
2393
+ <span
2394
+ v-if="member.role === 'owner' || isYou"
2395
+ class="role-static"
2396
+ :data-test="`member-role:${member.id}`"
2397
+ >
2398
+ {{ ROLE_LABEL[member.role] }}
2399
+ </span>
2400
+ <BbSelectPopover
2401
+ v-else
2402
+ :item-props="{ description: 'description' }"
2403
+ item-text="label"
2404
+ item-value="value"
2405
+ :items="ROLE_OPTIONS"
2406
+ :model-value="member.role"
2407
+ width="280"
2408
+ @update:model-value="pick"
2409
+ >
2410
+ <template #activator="{ props: activatorProps, shown }">
2411
+ <BbButton
2412
+ v-bind="activatorProps"
2413
+ append:icon="lucide:chevron-down"
2414
+ :aria-label="`Role for ${member.name}: ${ROLE_LABEL[member.role]}`"
2415
+ class="role-trigger"
2416
+ :class="{ 'role-trigger--open': shown }"
2417
+ :data-test="`member-role:${member.id}`"
2418
+ :loading="saving"
2419
+ size="sm"
2420
+ variant="ghost"
2421
+ >
2422
+ {{ ROLE_LABEL[member.role] }}
2423
+ </BbButton>
2424
+ </template>
2425
+ </BbSelectPopover>
2426
+ </template>
2427
+
2428
+ <script setup lang="ts">
2429
+ import { computed, ref } from 'vue';
2430
+ import { BbButton, BbSelectPopover } from 'bitboss-ui';
2431
+ import type { InvitableRole, WorkspaceMember } from './types';
2432
+ import { ROLE_LABEL, ROLE_OPTIONS, useSettingsWorkspace } from './context';
2433
+
2434
+ const props = defineProps<{ member: WorkspaceMember }>();
2435
+
2436
+ const ctx = useSettingsWorkspace();
2437
+ const isYou = computed(() => props.member.id === ctx.profile.value?.id);
2438
+
2439
+ // Rung 1: the spinner is this cell's alone.
2440
+ const saving = ref(false);
2441
+ const pick = async (role: InvitableRole) => {
2442
+ saving.value = true;
2443
+ try {
2444
+ await ctx.changeRole(props.member, role);
2445
+ } finally {
2446
+ saving.value = false;
2447
+ }
2448
+ };
2449
+ </script>
2450
+
2451
+ <style scoped>
2452
+ .role-static {
2453
+ color: var(--bb-text-muted);
2454
+ font-size: 0.8125rem;
2455
+ padding-inline: 0.5rem;
2456
+ }
2457
+
2458
+ /* Ghost at rest so a column of roles reads as text; the chevron says "pick". */
2459
+ .role-trigger {
2460
+ margin-inline-start: -0.125rem;
2461
+ }
2462
+
2463
+ .role-trigger--open {
2464
+ background: color-mix(in oklab, var(--bb-text) 8%, transparent);
2465
+ }
2466
+ </style>
2467
+ ```
2468
+
2469
+ ### MemberRowActions.vue
2470
+
2471
+ The row menu (v-bb-dropdown).
2472
+
2473
+ ```vue
2474
+ <!-- SettingsWorkspace/MemberRowActions.vue — the row's "…" menu (resend, copy, transfer, remove). -->
2475
+ <template>
2476
+ <!-- A plain items menu on a trigger we already have: the directive, not a
2477
+ BbDropdown wrapper. The owner and you get no menu at all. -->
2478
+ <BbButton
2479
+ v-if="items.length"
2480
+ v-bb-dropdown:bottom-end="{ items, width: 220 }"
2481
+ :data-test="`member-actions:${member.id}`"
2482
+ icon="lucide:ellipsis"
2483
+ size="sm"
2484
+ variant="ghost"
2485
+ >
2486
+ Actions for {{ member.name }}
2487
+ </BbButton>
2488
+ </template>
2489
+
2490
+ <script setup lang="ts">
2491
+ import { computed } from 'vue';
2492
+ import { BbButton } from 'bitboss-ui';
2493
+ import type { BbDropdownItem } from 'bitboss-ui';
2494
+ import type { WorkspaceMember } from './types';
2495
+ import { useSettingsWorkspace } from './context';
2496
+
2497
+ const props = defineProps<{ member: WorkspaceMember }>();
2498
+
2499
+ const ctx = useSettingsWorkspace();
2500
+
2501
+ const items = computed<BbDropdownItem[]>(() => {
2502
+ const m = props.member;
2503
+ if (m.role === 'owner' || m.id === ctx.profile.value?.id) return [];
2504
+ if (m.status === 'invited')
2505
+ return [
2506
+ {
2507
+ key: 'resend',
2508
+ text: 'Resend invitation',
2509
+ 'prepend:icon': 'lucide:send',
2510
+ onClick: () => ctx.resendInvite(m),
2511
+ },
2512
+ {
2513
+ key: 'copy',
2514
+ text: 'Copy email',
2515
+ 'prepend:icon': 'lucide:copy',
2516
+ onClick: () => ctx.copy(m.email, 'Email address'),
2517
+ },
2518
+ [
2519
+ {
2520
+ key: 'revoke',
2521
+ text: 'Revoke invitation',
2522
+ 'prepend:icon': 'lucide:user-x',
2523
+ variant: 'destructive',
2524
+ onClick: () => ctx.removeMember(m),
2525
+ },
2526
+ ],
2527
+ ];
2528
+ return [
2529
+ {
2530
+ key: 'copy',
2531
+ text: 'Copy email',
2532
+ 'prepend:icon': 'lucide:copy',
2533
+ onClick: () => ctx.copy(m.email, 'Email address'),
2534
+ },
2535
+ [
2536
+ {
2537
+ key: 'remove',
2538
+ text: 'Remove from workspace',
2539
+ 'prepend:icon': 'lucide:user-minus',
2540
+ variant: 'destructive',
2541
+ onClick: () => ctx.removeMember(m),
2542
+ },
2543
+ ],
2544
+ ];
2545
+ });
2546
+ </script>
2547
+ ```
2548
+
2549
+ ### InviteMembersDialog.vue
2550
+
2551
+ Invite by email: BbTag + role radios, footer submits from outside.
2552
+
2553
+ ```vue
2554
+ <!-- SettingsWorkspace/InviteMembersDialog.vue — invite by email: several addresses, one role. -->
2555
+ <template>
2556
+ <BbDialog
2557
+ v-model="ctx.dialogs.invite.value"
2558
+ data-test="invite-dialog"
2559
+ :description="seatLine"
2560
+ size="md"
2561
+ title="Invite people"
2562
+ >
2563
+ <!-- The footer lives outside the <form>: it submits through the coopted
2564
+ form context, so validation still gates the send in one place. -->
2565
+ <BbForm
2566
+ :id="INVITE_FORM"
2567
+ v-model="invite"
2568
+ :schema="inviteSchema"
2569
+ @submit="(values) => ctx.inviteMembers(values.emails, values.role)"
2570
+ >
2571
+ <div class="invite-form">
2572
+ <BbTag
2573
+ description="Press Enter, a comma or a space after each address."
2574
+ :divider="['Enter', ',', ' ']"
2575
+ label="Email addresses"
2576
+ :max="10"
2577
+ name="emails"
2578
+ placeholder="name@company.com"
2579
+ prepend:icon="lucide:mail"
2580
+ />
2581
+ <BbRadioGroup
2582
+ :item-props="{ description: 'description' }"
2583
+ item-text="label"
2584
+ item-value="value"
2585
+ :items="ROLE_OPTIONS"
2586
+ legend="Role"
2587
+ list-layout="vertical"
2588
+ name="role"
2589
+ />
2590
+ </div>
2591
+ </BbForm>
2592
+
2593
+ <template #footer>
2594
+ <BbButton
2595
+ variant="ghost"
2596
+ @click="() => (ctx.dialogs.invite.value = false)"
2597
+ >
2598
+ Cancel
2599
+ </BbButton>
2600
+ <BbButton
2601
+ data-test="invite-send"
2602
+ :loading="ctx.inviteForm.submitting.value"
2603
+ prepend:icon="lucide:send"
2604
+ variant="primary"
2605
+ @click="ctx.inviteForm.submit"
2606
+ >
2607
+ {{
2608
+ invite.emails.length > 1
2609
+ ? `Send ${invite.emails.length} invitations`
2610
+ : 'Send invitation'
2611
+ }}
2612
+ </BbButton>
2613
+ </template>
2614
+ </BbDialog>
2615
+ </template>
2616
+
2617
+ <script setup lang="ts">
2618
+ import { computed, reactive, watch } from 'vue';
2619
+ import { z } from 'zod';
2620
+ import { BbButton, BbDialog, BbForm, BbRadioGroup, BbTag } from 'bitboss-ui';
2621
+ import type { InvitableRole } from './types';
2622
+ import { INVITE_FORM, ROLE_OPTIONS, useSettingsWorkspace } from './context';
2623
+
2624
+ const ctx = useSettingsWorkspace();
2625
+
2626
+ // Draft state only this dialog reads: rung 1. The form is bound to it, so a
2627
+ // reset on every open resets the fields too.
2628
+ const blankInvite = () => ({
2629
+ emails: [] as string[],
2630
+ role: 'member' as InvitableRole,
2631
+ });
2632
+ const invite = reactive(blankInvite());
2633
+ watch(ctx.dialogs.invite, (open) => {
2634
+ if (open) Object.assign(invite, blankInvite());
2635
+ });
2636
+
2637
+ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2638
+
2639
+ // One message on `emails` (not one per index): a per-item issue would land on
2640
+ // `emails.0`, a path no field has, and show nowhere.
2641
+ const inviteSchema = z.object({
2642
+ emails: z
2643
+ .array(z.string())
2644
+ .min(1, 'Add at least one email address.')
2645
+ .max(10, 'Invite up to 10 people at a time.')
2646
+ .superRefine((list, issue) => {
2647
+ const bad = list.filter((email) => !EMAIL.test(email));
2648
+ if (bad.length)
2649
+ issue.addIssue({
2650
+ code: 'custom',
2651
+ message: `${bad.join(', ')} ${bad.length === 1 ? 'is' : 'are'} not a valid address.`,
2652
+ });
2653
+ }),
2654
+ role: z.enum(['admin', 'member', 'accountant'], 'Pick a role.'),
2655
+ });
2656
+
2657
+ const seatLine = computed(() => {
2658
+ const seats = ctx.seats.value;
2659
+ if (!seats) return 'They get an email with a link to join.';
2660
+ const left = seats.included - seats.used;
2661
+ return `They get an email with a link to join. ${left} seat${left === 1 ? '' : 's'} left on your plan.`;
2662
+ });
2663
+ </script>
2664
+
2665
+ <style scoped>
2666
+ .invite-form {
2667
+ display: flex;
2668
+ flex-direction: column;
2669
+ gap: 1.25rem;
2670
+ }
2671
+ </style>
2672
+ ```
2673
+
2674
+ ### BillingSection.vue
2675
+
2676
+ Read-only plan, seats, payment method, invoice history.
2677
+
2678
+ ```vue
2679
+ <!-- SettingsWorkspace/BillingSection.vue — read-only plan summary + invoice history. -->
2680
+ <template>
2681
+ <section class="settings-section" data-test="section-billing">
2682
+ <SectionHeader
2683
+ description="Your plan, seats and invoices. Payment details are changed in the billing portal."
2684
+ :scope="ctx.workspace.value?.name ?? 'Workspace'"
2685
+ title="Billing"
2686
+ >
2687
+ <!-- An external destination: a real link, opened in a new tab. -->
2688
+ <BbButton
2689
+ append:icon="lucide:arrow-up-right"
2690
+ data-test="billing-portal"
2691
+ href="https://billing.stripe.com/p/login/test_fennel_hart"
2692
+ target="_blank"
2693
+ variant="outline"
2694
+ >
2695
+ Manage billing
2696
+ </BbButton>
2697
+ </SectionHeader>
2698
+
2699
+ <div class="settings-section__stack">
2700
+ <div
2701
+ v-if="!billing"
2702
+ aria-busy="true"
2703
+ class="billing-summary billing-summary--loading"
2704
+ >
2705
+ <span class="sr-only">Loading billing…</span>
2706
+ <span v-for="n in 3" :key="n" class="billing-skeleton" />
2707
+ </div>
2708
+
2709
+ <dl v-else class="billing-summary" data-test="billing-summary">
2710
+ <div class="billing-summary__cell">
2711
+ <dt>Plan</dt>
2712
+ <dd class="billing-summary__plan">
2713
+ <span class="billing-summary__value">{{ billing.plan }}</span>
2714
+ <BbBadge variant="soft-gray">
2715
+ {{ billing.interval === 'yearly' ? 'Yearly' : 'Monthly' }}
2716
+ </BbBadge>
2717
+ <BbBadge :variant="STATUS_BADGE[billing.status].variant">
2718
+ {{ STATUS_BADGE[billing.status].label }}
2719
+ </BbBadge>
2720
+ </dd>
2721
+ <dd class="billing-summary__meta">
2722
+ {{ formatMoney(billing.pricePerSeat, billing.currency) }} per seat
2723
+ per month. Renews {{ formatDate(billing.renewsAt) }} for
2724
+ {{ formatMoney(billing.nextInvoiceAmount, billing.currency) }}.
2725
+ </dd>
2726
+ </div>
2727
+
2728
+ <div class="billing-summary__cell">
2729
+ <dt>Seats</dt>
2730
+ <dd class="billing-summary__value tabular-nums">
2731
+ {{ seats?.used ?? billing.seats.used }}
2732
+ <span class="billing-summary__of"
2733
+ >of {{ billing.seats.included }}</span
2734
+ >
2735
+ </dd>
2736
+ <dd>
2737
+ <BbProgress
2738
+ aria-label="Seats used"
2739
+ :max="billing.seats.included"
2740
+ :model-value="seats?.used ?? billing.seats.used"
2741
+ />
2742
+ </dd>
2743
+ <dd class="billing-summary__meta">
2744
+ Pending invitations hold a seat until they expire.
2745
+ </dd>
2746
+ </div>
2747
+
2748
+ <div class="billing-summary__cell">
2749
+ <dt>Payment method</dt>
2750
+ <dd class="billing-summary__value">
2751
+ <BbIcon aria-hidden="true" icon="lucide:credit-card" size="16" />
2752
+ {{ billing.paymentMethod.brand }} ending
2753
+ {{ billing.paymentMethod.last4 }}
2754
+ </dd>
2755
+ <dd class="billing-summary__meta">
2756
+ Expires
2757
+ {{ String(billing.paymentMethod.expMonth).padStart(2, '0') }}/{{
2758
+ billing.paymentMethod.expYear
2759
+ }}. Receipts go to {{ billing.billingEmail }}.
2760
+ </dd>
2761
+ </div>
2762
+ </dl>
2763
+
2764
+ <div class="billing-history">
2765
+ <h3 class="billing-history__title">Invoice history</h3>
2766
+ <BbTable
2767
+ caption="Invoice history"
2768
+ class="billing-table"
2769
+ :columns="columns"
2770
+ compact
2771
+ data-test="billing-invoices"
2772
+ item-value="id"
2773
+ :items="billing?.invoices ?? []"
2774
+ :loading="!billing"
2775
+ loading-text="Loading invoices…"
2776
+ >
2777
+ <template #number="{ item }">
2778
+ <span class="billing-table__number">{{ item.number }}</span>
2779
+ </template>
2780
+ <template #status="{ item }">
2781
+ <BbBadge :variant="INVOICE_BADGE[item.status].variant">
2782
+ {{ INVOICE_BADGE[item.status].label }}
2783
+ </BbBadge>
2784
+ </template>
2785
+ <template #actions="{ item }">
2786
+ <!-- A file, not a page: `target` keeps it a plain download
2787
+ under every router. -->
2788
+ <BbButton
2789
+ :href="item.pdfUrl"
2790
+ prepend:icon="lucide:file-down"
2791
+ size="sm"
2792
+ target="_blank"
2793
+ variant="ghost"
2794
+ >
2795
+ PDF
2796
+ </BbButton>
2797
+ </template>
2798
+ </BbTable>
2799
+ </div>
2800
+ </div>
2801
+ </section>
2802
+ </template>
2803
+
2804
+ <script setup lang="ts">
2805
+ import { computed } from 'vue';
2806
+ import {
2807
+ BbBadge,
2808
+ BbButton,
2809
+ BbIcon,
2810
+ BbProgress,
2811
+ BbTable,
2812
+ useMobile,
2813
+ } from 'bitboss-ui';
2814
+ import type { BadgeVariantType, BbTableColumn } from 'bitboss-ui';
2815
+ import type { BillingInvoice, BillingSummary } from './types';
2816
+ import SectionHeader from './SectionHeader.vue';
2817
+ import { useSettingsWorkspace } from './context';
2818
+ import { formatDate, formatMoney } from './format';
2819
+
2820
+ const ctx = useSettingsWorkspace();
2821
+ const { isMobile } = useMobile();
2822
+ const billing = computed(() => ctx.billing.value);
2823
+ const seats = computed(() => ctx.seats.value);
2824
+
2825
+ const STATUS_BADGE: Record<
2826
+ BillingSummary['status'],
2827
+ { label: string; variant: BadgeVariantType }
2828
+ > = {
2829
+ active: { label: 'Active', variant: 'soft-green' },
2830
+ trialing: { label: 'Trial', variant: 'soft-blue' },
2831
+ past_due: { label: 'Past due', variant: 'soft-red' },
2832
+ };
2833
+
2834
+ const INVOICE_BADGE: Record<
2835
+ BillingInvoice['status'],
2836
+ { label: string; variant: BadgeVariantType }
2837
+ > = {
2838
+ paid: { label: 'Paid', variant: 'soft-green' },
2839
+ open: { label: 'Open', variant: 'soft-amber' },
2840
+ refunded: { label: 'Refunded', variant: 'soft-gray' },
2841
+ };
2842
+
2843
+ const columns = computed<Array<BbTableColumn<BillingInvoice>>>(() => [
2844
+ { key: 'number', label: 'Invoice' },
2845
+ {
2846
+ key: 'date',
2847
+ label: 'Date',
2848
+ formatter: (date) => formatDate(String(date)),
2849
+ hidden: isMobile.value,
2850
+ },
2851
+ {
2852
+ key: 'amount',
2853
+ label: 'Amount',
2854
+ align: 'right',
2855
+ formatter: (amount) =>
2856
+ formatMoney(Number(amount), ctx.billing.value?.currency ?? 'EUR'),
2857
+ tdClass: 'tabular-nums',
2858
+ },
2859
+ { key: 'status', label: 'Status', skeleton: 'badge', width: '7rem' },
2860
+ ]);
2861
+ </script>
2862
+
2863
+ <style scoped>
2864
+ .billing-summary {
2865
+ background: var(--bb-panel);
2866
+ border: var(--bb-border-w) solid var(--bb-border);
2867
+ border-radius: var(--bb-radius-surface);
2868
+ display: grid;
2869
+ grid-template-columns: repeat(3, minmax(0, 1fr));
2870
+ }
2871
+
2872
+ .billing-summary__cell {
2873
+ display: flex;
2874
+ flex-direction: column;
2875
+ gap: 0.375rem;
2876
+ padding: 1rem 1.25rem;
2877
+ }
2878
+
2879
+ .billing-summary__cell + .billing-summary__cell {
2880
+ border-inline-start: var(--bb-border-w) solid var(--bb-border);
2881
+ }
2882
+
2883
+ .billing-summary dt {
2884
+ color: var(--bb-text-muted);
2885
+ font-size: 0.75rem;
2886
+ font-weight: 500;
2887
+ }
2888
+
2889
+ .billing-summary__plan {
2890
+ align-items: center;
2891
+ display: flex;
2892
+ flex-wrap: wrap;
2893
+ gap: 0.375rem;
2894
+ }
2895
+
2896
+ .billing-summary__value {
2897
+ align-items: center;
2898
+ display: inline-flex;
2899
+ font-size: 1rem;
2900
+ font-weight: 600;
2901
+ gap: 0.375rem;
2902
+ letter-spacing: -0.01em;
2903
+ }
2904
+
2905
+ .billing-summary__of {
2906
+ color: var(--bb-text-muted);
2907
+ font-weight: 500;
2908
+ }
2909
+
2910
+ .billing-summary__meta {
2911
+ color: var(--bb-text-muted);
2912
+ font-size: 0.8125rem;
2913
+ line-height: 1.45;
2914
+ }
2915
+
2916
+ .billing-summary--loading {
2917
+ min-height: 8.5rem;
2918
+ }
2919
+
2920
+ .billing-skeleton {
2921
+ animation: settings-pulse 1.4s ease-in-out infinite;
2922
+ background: color-mix(in oklab, var(--bb-text) 6%, var(--bb-panel));
2923
+ border-radius: var(--bb-radius);
2924
+ margin: 1rem 1.25rem;
2925
+ }
2926
+
2927
+ .billing-history {
2928
+ display: flex;
2929
+ flex-direction: column;
2930
+ gap: 0.5rem;
2931
+ }
2932
+
2933
+ .billing-history__title {
2934
+ font-size: 0.875rem;
2935
+ font-weight: 600;
2936
+ }
2937
+
2938
+ .billing-table {
2939
+ border: var(--bb-border-w) solid var(--bb-border);
2940
+ border-radius: var(--bb-radius-surface);
2941
+ }
2942
+
2943
+ .billing-table__number {
2944
+ font-weight: 500;
2945
+ white-space: nowrap;
2946
+ }
2947
+
2948
+ @keyframes settings-pulse {
2949
+ 50% {
2950
+ opacity: 0.55;
2951
+ }
2952
+ }
2953
+
2954
+ @media (max-width: 767.98px) {
2955
+ /* Stacked cells: the rule moves from beside to above. */
2956
+ .billing-summary {
2957
+ grid-template-columns: minmax(0, 1fr);
2958
+ }
2959
+ .billing-summary__cell + .billing-summary__cell {
2960
+ border-block-start: var(--bb-border-w) solid var(--bb-border);
2961
+ border-inline-start: 0;
2962
+ }
2963
+ }
2964
+
2965
+ @media (prefers-reduced-motion: reduce) {
2966
+ .billing-skeleton {
2967
+ animation: none;
2968
+ }
2969
+ }
2970
+ </style>
2971
+ ```
2972
+
2973
+ ### ApiKeysSection.vue
2974
+
2975
+ Masked keys, scopes, last used, revoke, empty state.
2976
+
2977
+ ```vue
2978
+ <!-- SettingsWorkspace/ApiKeysSection.vue — the key list: masked previews, scopes, last used, revoke. -->
2979
+ <template>
2980
+ <section class="settings-section" data-test="section-api-keys">
2981
+ <SectionHeader
2982
+ description="Keys let your servers and tools call the Northwind API as this workspace. Treat them like passwords."
2983
+ :scope="ctx.workspace.value?.name ?? 'Workspace'"
2984
+ title="API keys"
2985
+ >
2986
+ <BbButton
2987
+ data-test="api-key-create-open"
2988
+ prepend:icon="lucide:plus"
2989
+ variant="primary"
2990
+ @click="() => (ctx.dialogs.createKey.value = true)"
2991
+ >
2992
+ Create key
2993
+ </BbButton>
2994
+ </SectionHeader>
2995
+
2996
+ <BbTable
2997
+ caption="API keys"
2998
+ class="keys-table"
2999
+ :columns="columns"
3000
+ compact
3001
+ data-test="api-keys-table"
3002
+ item-value="id"
3003
+ :items="ctx.apiKeys.value ?? []"
3004
+ :loading="!ctx.apiKeys.value"
3005
+ loading-text="Loading API keys…"
3006
+ >
3007
+ <template #name="{ item }">
3008
+ <span class="key-identity">
3009
+ <span class="key-identity__name">{{ item.name }}</span>
3010
+ <code class="key-identity__preview">{{ item.preview }}</code>
3011
+ </span>
3012
+ </template>
3013
+
3014
+ <template #scope="{ item }">
3015
+ <BbBadge :variant="SCOPE_BADGE[item.scope].variant">
3016
+ {{ SCOPE_BADGE[item.scope].label }}
3017
+ </BbBadge>
3018
+ </template>
3019
+
3020
+ <template #created-at="{ item }">
3021
+ <span class="key-meta">
3022
+ {{ formatDate(item.createdAt) }}
3023
+ <span class="key-meta__sub">by {{ item.createdBy }}</span>
3024
+ </span>
3025
+ </template>
3026
+
3027
+ <template #last-used-at="{ item }">
3028
+ <span class="key-meta">
3029
+ {{ formatRelative(item.lastUsedAt) }}
3030
+ <span v-if="item.expiresAt" class="key-meta__sub">
3031
+ Expires {{ formatDate(item.expiresAt) }}
3032
+ </span>
3033
+ </span>
3034
+ </template>
3035
+
3036
+ <template #actions="{ item }">
3037
+ <BbButton
3038
+ :data-test="`api-key-revoke:${item.id}`"
3039
+ size="sm"
3040
+ variant="ghost"
3041
+ @click="() => ctx.revokeApiKey(item)"
3042
+ >
3043
+ Revoke
3044
+ </BbButton>
3045
+ </template>
3046
+
3047
+ <template #empty>
3048
+ <div class="keys-empty" data-test="api-keys-empty">
3049
+ <BbIcon
3050
+ aria-hidden="true"
3051
+ class="keys-empty__icon"
3052
+ icon="lucide:key-round"
3053
+ size="24"
3054
+ />
3055
+ <p class="keys-empty__title">No API keys yet</p>
3056
+ <p class="keys-empty__hint">
3057
+ Create one to send invoices from your own backend, or to sync
3058
+ payments into your books.
3059
+ </p>
3060
+ <BbButton
3061
+ prepend:icon="lucide:plus"
3062
+ variant="outline"
3063
+ @click="() => (ctx.dialogs.createKey.value = true)"
3064
+ >
3065
+ Create your first key
3066
+ </BbButton>
3067
+ </div>
3068
+ </template>
3069
+ </BbTable>
3070
+ </section>
3071
+ </template>
3072
+
3073
+ <script setup lang="ts">
3074
+ import { computed } from 'vue';
3075
+ import { BbBadge, BbButton, BbIcon, BbTable, useMobile } from 'bitboss-ui';
3076
+ import type { BadgeVariantType, BbTableColumn } from 'bitboss-ui';
3077
+ import type { ApiKey, ApiKeyScope } from './types';
3078
+ import SectionHeader from './SectionHeader.vue';
3079
+ import { useSettingsWorkspace } from './context';
3080
+ import { formatDate, formatRelative } from './format';
3081
+
3082
+ const ctx = useSettingsWorkspace();
3083
+ const { isMobile } = useMobile();
3084
+
3085
+ const SCOPE_BADGE: Record<
3086
+ ApiKeyScope,
3087
+ { label: string; variant: BadgeVariantType }
3088
+ > = {
3089
+ read: { label: 'Read only', variant: 'soft-gray' },
3090
+ write: { label: 'Read and write', variant: 'soft-blue' },
3091
+ admin: { label: 'Full access', variant: 'soft-amber' },
3092
+ };
3093
+
3094
+ const columns = computed<Array<BbTableColumn<ApiKey>>>(() => [
3095
+ { key: 'name', label: 'Key' },
3096
+ { key: 'scope', label: 'Access', skeleton: 'badge', width: '9rem' },
3097
+ { key: 'createdAt', label: 'Created', hidden: isMobile.value },
3098
+ { key: 'lastUsedAt', label: 'Last used', hidden: isMobile.value },
3099
+ ]);
3100
+ </script>
3101
+
3102
+ <style scoped>
3103
+ .keys-table {
3104
+ border: var(--bb-border-w) solid var(--bb-border);
3105
+ border-radius: var(--bb-radius-surface);
3106
+ }
3107
+
3108
+ .key-identity {
3109
+ display: flex;
3110
+ flex-direction: column;
3111
+ min-width: 0;
3112
+ }
3113
+
3114
+ .key-identity__name {
3115
+ font-weight: 500;
3116
+ }
3117
+
3118
+ /* The preview is data you compare against a config file: monospace earns its
3119
+ place here. */
3120
+ .key-identity__preview {
3121
+ color: var(--bb-text-muted);
3122
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
3123
+ font-size: 0.75rem;
3124
+ }
3125
+
3126
+ .key-meta {
3127
+ display: flex;
3128
+ flex-direction: column;
3129
+ font-size: 0.8125rem;
3130
+ }
3131
+
3132
+ .key-meta__sub {
3133
+ color: var(--bb-text-muted);
3134
+ font-size: 0.75rem;
3135
+ }
3136
+
3137
+ .keys-empty {
3138
+ align-items: center;
3139
+ display: flex;
3140
+ flex-direction: column;
3141
+ gap: 0.375rem;
3142
+ padding: 2rem 1rem;
3143
+ text-align: center;
3144
+ }
3145
+
3146
+ .keys-empty__icon {
3147
+ color: var(--bb-text-muted);
3148
+ margin-block-end: 0.25rem;
3149
+ }
3150
+
3151
+ .keys-empty__title {
3152
+ font-weight: 600;
3153
+ }
3154
+
3155
+ .keys-empty__hint {
3156
+ color: var(--bb-text-muted);
3157
+ font-size: 0.8125rem;
3158
+ max-width: 44ch;
3159
+ padding-block-end: 0.5rem;
3160
+ }
3161
+ </style>
3162
+ ```
3163
+
3164
+ ### CreateApiKeyDialog.vue
3165
+
3166
+ Create, then reveal once (persistent while shown).
3167
+
3168
+ ```vue
3169
+ <!-- SettingsWorkspace/CreateApiKeyDialog.vue — create a key, then show its secret exactly once. -->
3170
+ <template>
3171
+ <!-- Persistent while the secret is on screen: a stray backdrop click must
3172
+ not throw away the only copy the user will ever see. -->
3173
+ <BbDialog
3174
+ v-model="ctx.dialogs.createKey.value"
3175
+ data-test="api-key-dialog"
3176
+ :description="
3177
+ secret
3178
+ ? 'Copy it into your secrets manager now. For your safety we only store a fingerprint, so this is the one time it is shown.'
3179
+ : 'Name it after where it runs, so you know what breaks when you revoke it.'
3180
+ "
3181
+ :persistent="!!secret"
3182
+ size="md"
3183
+ :title="secret ? 'Your new API key' : 'Create API key'"
3184
+ >
3185
+ <ApiKeyReveal v-if="secret" :secret="secret" />
3186
+
3187
+ <BbForm
3188
+ v-else
3189
+ :id="API_KEY_FORM"
3190
+ v-model="draft"
3191
+ :schema="keySchema"
3192
+ @submit="create"
3193
+ >
3194
+ <div class="key-form">
3195
+ <BbTextInput label="Name" name="name" placeholder="Production server" />
3196
+ <BbRadioGroup
3197
+ :item-props="{ description: 'description' }"
3198
+ item-text="label"
3199
+ item-value="value"
3200
+ :items="SCOPES"
3201
+ legend="Access"
3202
+ list-layout="vertical"
3203
+ name="scope"
3204
+ />
3205
+ <BbSelect
3206
+ description="Short-lived keys limit the damage of a leak."
3207
+ item-text="label"
3208
+ item-value="value"
3209
+ :items="EXPIRIES"
3210
+ label="Expires"
3211
+ name="expiresIn"
3212
+ />
3213
+ </div>
3214
+ </BbForm>
3215
+
3216
+ <template #footer>
3217
+ <template v-if="secret">
3218
+ <BbButton data-test="api-key-done" variant="primary" @click="close">
3219
+ Done
3220
+ </BbButton>
3221
+ </template>
3222
+ <template v-else>
3223
+ <BbButton variant="ghost" @click="close">Cancel</BbButton>
3224
+ <BbButton
3225
+ data-test="api-key-create"
3226
+ :loading="ctx.apiKeyForm.submitting.value"
3227
+ variant="primary"
3228
+ @click="ctx.apiKeyForm.submit"
3229
+ >
3230
+ Create key
3231
+ </BbButton>
3232
+ </template>
3233
+ </template>
3234
+ </BbDialog>
3235
+ </template>
3236
+
3237
+ <script setup lang="ts">
3238
+ import { reactive, ref, watch } from 'vue';
3239
+ import { z } from 'zod';
3240
+ import {
3241
+ BbButton,
3242
+ BbDialog,
3243
+ BbForm,
3244
+ BbRadioGroup,
3245
+ BbSelect,
3246
+ BbTextInput,
3247
+ } from 'bitboss-ui';
3248
+ import type { ApiKeyExpiry, ApiKeyScope } from './types';
3249
+ import ApiKeyReveal from './ApiKeyReveal.vue';
3250
+ import { API_KEY_FORM, useSettingsWorkspace } from './context';
3251
+
3252
+ const ctx = useSettingsWorkspace();
3253
+
3254
+ // The draft and the one-time secret are this dialog's alone (rung 1). The
3255
+ // secret never enters the page context: nothing else may read it.
3256
+ const blankKey = () => ({
3257
+ name: '',
3258
+ scope: 'read' as ApiKeyScope,
3259
+ expiresIn: '90d' as ApiKeyExpiry,
3260
+ });
3261
+ const draft = reactive(blankKey());
3262
+ const secret = ref<string | null>(null);
3263
+
3264
+ watch(ctx.dialogs.createKey, (open) => {
3265
+ if (!open) return;
3266
+ Object.assign(draft, blankKey());
3267
+ secret.value = null;
3268
+ });
3269
+
3270
+ const keySchema = z.object({
3271
+ name: z
3272
+ .string('Name the key after where it runs.')
3273
+ .trim()
3274
+ .min(3, 'Name the key after where it runs.')
3275
+ .max(40, 'Keep the name under 40 characters.'),
3276
+ scope: z.enum(['read', 'write', 'admin'], 'Pick what this key can do.'),
3277
+ expiresIn: z.enum(['30d', '90d', '1y', 'never'], 'Pick when it expires.'),
3278
+ });
3279
+
3280
+ const create = async (values: z.output<typeof keySchema>) => {
3281
+ secret.value = await ctx.createApiKey(values);
3282
+ };
3283
+
3284
+ const close = () => {
3285
+ ctx.dialogs.createKey.value = false;
3286
+ };
3287
+
3288
+ const SCOPES: Array<{
3289
+ value: ApiKeyScope;
3290
+ label: string;
3291
+ description: string;
3292
+ }> = [
3293
+ {
3294
+ value: 'read',
3295
+ label: 'Read only',
3296
+ description: 'Fetch invoices, customers and payouts.',
3297
+ },
3298
+ {
3299
+ value: 'write',
3300
+ label: 'Read and write',
3301
+ description: 'Also create, send and update invoices.',
3302
+ },
3303
+ {
3304
+ value: 'admin',
3305
+ label: 'Full access',
3306
+ description: 'Everything, including refunds and webhooks.',
3307
+ },
3308
+ ];
3309
+
3310
+ const EXPIRIES: Array<{ value: ApiKeyExpiry; label: string }> = [
3311
+ { value: '30d', label: 'In 30 days' },
3312
+ { value: '90d', label: 'In 90 days' },
3313
+ { value: '1y', label: 'In 1 year' },
3314
+ { value: 'never', label: 'Never' },
3315
+ ];
3316
+ </script>
3317
+
3318
+ <style scoped>
3319
+ .key-form {
3320
+ display: flex;
3321
+ flex-direction: column;
3322
+ gap: 1.25rem;
3323
+ }
3324
+ </style>
3325
+ ```
3326
+
3327
+ ### ApiKeyReveal.vue
3328
+
3329
+ The one-time secret: read-only field + copy.
3330
+
3331
+ ```vue
3332
+ <!-- SettingsWorkspace/ApiKeyReveal.vue — the one-time secret: read-only field + copy. -->
3333
+ <template>
3334
+ <div class="key-reveal" data-test="api-key-reveal">
3335
+ <BbAlert
3336
+ hide-close
3337
+ icon="lucide:triangle-alert"
3338
+ text="You won't be able to see this key again."
3339
+ variant="warning"
3340
+ />
3341
+ <div class="key-reveal__row">
3342
+ <!-- Outside any BbForm: a plain, read-only field. -->
3343
+ <BbTextInput
3344
+ class="key-reveal__field"
3345
+ data-test="api-key-secret"
3346
+ label="Secret key"
3347
+ :model-value="secret"
3348
+ name="api-key-secret"
3349
+ pt:input="font-mono text-[0.8125rem]"
3350
+ readonly
3351
+ />
3352
+ <BbButton
3353
+ data-test="api-key-copy"
3354
+ :prepend:icon="copied ? 'lucide:check' : 'lucide:copy'"
3355
+ variant="outline"
3356
+ @click="copySecret"
3357
+ >
3358
+ {{ copied ? 'Copied' : 'Copy' }}
3359
+ </BbButton>
3360
+ </div>
3361
+ </div>
3362
+ </template>
3363
+
3364
+ <script setup lang="ts">
3365
+ import { ref } from 'vue';
3366
+ import { BbAlert, BbButton, BbTextInput } from 'bitboss-ui';
3367
+ import { useSettingsWorkspace } from './context';
3368
+
3369
+ const props = defineProps<{ secret: string }>();
3370
+
3371
+ const ctx = useSettingsWorkspace();
3372
+ const copied = ref(false);
3373
+
3374
+ const copySecret = async () => {
3375
+ copied.value = await ctx.copy(props.secret, 'API key');
3376
+ };
3377
+ </script>
3378
+
3379
+ <style scoped>
3380
+ .key-reveal {
3381
+ display: flex;
3382
+ flex-direction: column;
3383
+ gap: 1.25rem;
3384
+ }
3385
+
3386
+ .key-reveal__row {
3387
+ align-items: flex-end;
3388
+ display: flex;
3389
+ gap: 0.5rem;
3390
+ }
3391
+
3392
+ .key-reveal__field {
3393
+ flex: 1;
3394
+ min-width: 0;
3395
+ }
3396
+ </style>
3397
+ ```
3398
+
3399
+ ### DangerZoneSection.vue
3400
+
3401
+ Transfer ownership + delete, quarantined.
3402
+
3403
+ ```vue
3404
+ <!-- SettingsWorkspace/DangerZoneSection.vue — the quarantined, owner-only actions. -->
3405
+ <template>
3406
+ <section class="settings-section" data-test="section-danger-zone">
3407
+ <SectionHeader
3408
+ description="Actions that change who controls this workspace, or remove it. Each one asks before it runs."
3409
+ :scope="workspaceName"
3410
+ title="Danger zone"
3411
+ />
3412
+
3413
+ <p v-if="ctx.members.value && !isOwner" class="danger-note" role="note">
3414
+ Only the owner of {{ workspaceName }} can use these actions.
3415
+ </p>
3416
+
3417
+ <div class="danger-zone">
3418
+ <div class="danger-zone__row">
3419
+ <div class="danger-zone__text">
3420
+ <h3 class="danger-zone__title">Transfer ownership</h3>
3421
+ <p class="danger-zone__description">
3422
+ Hand {{ workspaceName }} to one of its admins. You stay on as an
3423
+ admin; only the new owner can hand it back.
3424
+ </p>
3425
+ </div>
3426
+ <!-- Pick the admin in place: the pick opens the confirm, the confirm
3427
+ commits. No page, no extra dialog. -->
3428
+ <BbSelectPopover
3429
+ :disabled="!isOwner || admins.length === 0"
3430
+ :item-props="{ description: 'email' }"
3431
+ item-text="name"
3432
+ item-value="id"
3433
+ :items="admins"
3434
+ :model-value="null"
3435
+ width="280"
3436
+ @update:model-value="onTransfer"
3437
+ >
3438
+ <template #activator="{ props: activatorProps, disabled }">
3439
+ <BbButton
3440
+ v-bind="activatorProps"
3441
+ append:icon="lucide:chevron-down"
3442
+ data-test="transfer-open"
3443
+ :disabled="disabled"
3444
+ variant="outline"
3445
+ >
3446
+ Transfer to…
3447
+ </BbButton>
3448
+ </template>
3449
+ </BbSelectPopover>
3450
+ </div>
3451
+
3452
+ <div class="danger-zone__row">
3453
+ <div class="danger-zone__text">
3454
+ <h3 class="danger-zone__title">Delete this workspace</h3>
3455
+ <p class="danger-zone__description">
3456
+ Permanently deletes every invoice, customer, API key and member of
3457
+ {{ workspaceName }}. Customers keep the invoices already emailed to
3458
+ them. Nothing else can be recovered.
3459
+ </p>
3460
+ </div>
3461
+ <BbButton
3462
+ data-test="delete-workspace-open"
3463
+ :disabled="!isOwner"
3464
+ prepend:icon="lucide:trash-2"
3465
+ variant="destructive"
3466
+ @click="() => (ctx.dialogs.deleteWorkspace.value = true)"
3467
+ >
3468
+ Delete workspace
3469
+ </BbButton>
3470
+ </div>
3471
+ </div>
3472
+ </section>
3473
+ </template>
3474
+
3475
+ <script setup lang="ts">
3476
+ import { computed } from 'vue';
3477
+ import { BbButton, BbSelectPopover } from 'bitboss-ui';
3478
+ import SectionHeader from './SectionHeader.vue';
3479
+ import { useSettingsWorkspace } from './context';
3480
+
3481
+ const ctx = useSettingsWorkspace();
3482
+
3483
+ const workspaceName = computed(
3484
+ () => ctx.workspace.value?.name ?? 'this workspace'
3485
+ );
3486
+ const isOwner = computed(
3487
+ () =>
3488
+ ctx.members.value?.find((m) => m.id === ctx.profile.value?.id)?.role ===
3489
+ 'owner'
3490
+ );
3491
+ const admins = computed(() =>
3492
+ (ctx.members.value ?? []).filter(
3493
+ (m) => m.role === 'admin' && m.status === 'active'
3494
+ )
3495
+ );
3496
+
3497
+ const onTransfer = (id: string | null) => {
3498
+ const next = admins.value.find((m) => m.id === id);
3499
+ if (next) void ctx.transferOwnership(next);
3500
+ };
3501
+ </script>
3502
+
3503
+ <style scoped>
3504
+ /* Quarantine by colour, not weight: a danger hairline around the block and
3505
+ between rows, the page's only red outside the destructive button. */
3506
+ .danger-zone {
3507
+ --danger-line: color-mix(in oklab, var(--bb-danger) 40%, var(--bb-border));
3508
+ background: var(--bb-panel);
3509
+ border: var(--bb-border-w) solid var(--danger-line);
3510
+ border-radius: var(--bb-radius-surface);
3511
+ display: flex;
3512
+ flex-direction: column;
3513
+ }
3514
+
3515
+ .danger-zone__row {
3516
+ align-items: center;
3517
+ display: flex;
3518
+ flex-wrap: wrap;
3519
+ gap: 0.75rem 1.5rem;
3520
+ justify-content: space-between;
3521
+ padding: 1rem 1.25rem;
3522
+ }
3523
+
3524
+ .danger-zone__row + .danger-zone__row {
3525
+ border-block-start: var(--bb-border-w) solid var(--danger-line);
3526
+ }
3527
+
3528
+ .danger-zone__text {
3529
+ display: flex;
3530
+ flex: 1 1 20rem;
3531
+ flex-direction: column;
3532
+ gap: 0.125rem;
3533
+ min-width: 0;
3534
+ }
3535
+
3536
+ .danger-zone__title {
3537
+ font-size: 0.875rem;
3538
+ font-weight: 600;
3539
+ }
3540
+
3541
+ .danger-zone__description {
3542
+ color: var(--bb-text-muted);
3543
+ font-size: 0.8125rem;
3544
+ line-height: 1.45;
3545
+ max-width: 62ch;
3546
+ }
3547
+
3548
+ .danger-note {
3549
+ color: var(--bb-text-muted);
3550
+ font-size: 0.8125rem;
3551
+ padding-block-end: 0.75rem;
3552
+ }
3553
+
3554
+ @media (max-width: 767.98px) {
3555
+ .danger-zone__row {
3556
+ padding-inline: 1rem;
3557
+ }
3558
+ }
3559
+ </style>
3560
+ ```
3561
+
3562
+ ### DeleteWorkspaceDialog.vue
3563
+
3564
+ Irreversible delete confirmed by typing the name.
3565
+
3566
+ ```vue
3567
+ <!-- SettingsWorkspace/DeleteWorkspaceDialog.vue — irreversible delete, confirmed by typing the name. -->
3568
+ <template>
3569
+ <!-- Not useConfirm: a yes/no is one reflexive click away from disaster.
3570
+ Typing the name forces the user to read which workspace this is
3571
+ (GitHub's and Vercel's pattern). -->
3572
+ <BbDialog
3573
+ v-model="ctx.dialogs.deleteWorkspace.value"
3574
+ data-test="delete-workspace-dialog"
3575
+ description="This deletes every invoice, customer, API key and member. It cannot be undone."
3576
+ size="md"
3577
+ :title="`Delete ${name}`"
3578
+ >
3579
+ <form class="delete-form" novalidate @submit.prevent="submit">
3580
+ <ul class="delete-form__list">
3581
+ <li>Scheduled reminders and recurring invoices stop.</li>
3582
+ <li>All {{ memberCount }} members lose access immediately.</li>
3583
+ <li>All {{ keyCount }} API keys stop working.</li>
3584
+ </ul>
3585
+ <BbTextInput
3586
+ v-model="typed"
3587
+ autocomplete="off"
3588
+ data-test="delete-workspace-confirm"
3589
+ :errors="error"
3590
+ :label="`Type ${name} to confirm`"
3591
+ name="confirm-workspace-name"
3592
+ @update:model-value="() => (error = '')"
3593
+ />
3594
+ </form>
3595
+
3596
+ <template #footer>
3597
+ <BbButton
3598
+ variant="ghost"
3599
+ @click="() => (ctx.dialogs.deleteWorkspace.value = false)"
3600
+ >
3601
+ Cancel
3602
+ </BbButton>
3603
+ <!-- Disabled until the name matches exactly: the gate is UX. The server
3604
+ re-checks it, and its answer lands on the field. -->
3605
+ <BbButton
3606
+ data-test="delete-workspace-submit"
3607
+ :disabled="typed !== name"
3608
+ :loading="deleting"
3609
+ variant="destructive"
3610
+ @click="submit"
3611
+ >
3612
+ Delete workspace
3613
+ </BbButton>
3614
+ </template>
3615
+ </BbDialog>
3616
+ </template>
3617
+
3618
+ <script setup lang="ts">
3619
+ import { computed, ref, watch } from 'vue';
3620
+ import { BbButton, BbDialog, BbTextInput } from 'bitboss-ui';
3621
+ import { useSettingsWorkspace } from './context';
3622
+
3623
+ const ctx = useSettingsWorkspace();
3624
+
3625
+ const name = computed(() => ctx.workspace.value?.name ?? '');
3626
+ const memberCount = computed(() => ctx.members.value?.length ?? 0);
3627
+ const keyCount = computed(() => ctx.apiKeys.value?.length ?? 0);
3628
+
3629
+ // Rung 1: the typed text and the in-flight flag are this dialog's.
3630
+ const typed = ref<string | null>('');
3631
+ const error = ref('');
3632
+ const deleting = ref(false);
3633
+
3634
+ watch(ctx.dialogs.deleteWorkspace, (open) => {
3635
+ if (open) {
3636
+ typed.value = '';
3637
+ error.value = '';
3638
+ }
3639
+ });
3640
+
3641
+ const submit = async () => {
3642
+ if (typed.value !== name.value || deleting.value) return;
3643
+ deleting.value = true;
3644
+ try {
3645
+ error.value = (await ctx.deleteWorkspace(typed.value)) ?? '';
3646
+ } finally {
3647
+ deleting.value = false;
3648
+ }
3649
+ };
3650
+ </script>
3651
+
3652
+ <style scoped>
3653
+ .delete-form {
3654
+ display: flex;
3655
+ flex-direction: column;
3656
+ gap: 1rem;
3657
+ }
3658
+
3659
+ .delete-form__list {
3660
+ color: var(--bb-text-muted);
3661
+ display: flex;
3662
+ flex-direction: column;
3663
+ font-size: 0.8125rem;
3664
+ gap: 0.25rem;
3665
+ list-style: disc;
3666
+ padding-inline-start: 1.125rem;
3667
+ }
3668
+ </style>
3669
+ ```
3670
+
3671
+ ### format.ts
3672
+
3673
+ Stateless date, money and initials helpers.
3674
+
3675
+ ```ts
3676
+ // SettingsWorkspace/format.ts — stateless display helpers (no state, no
3677
+ // context: a formatter is not a store).
3678
+
3679
+ const dateFormat = new Intl.DateTimeFormat('en-US', {
3680
+ day: 'numeric',
3681
+ month: 'short',
3682
+ year: 'numeric',
3683
+ });
3684
+
3685
+ /** `Jan 14, 2027`. */
3686
+ export const formatDate = (iso: string) => dateFormat.format(new Date(iso));
3687
+
3688
+ const relative = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });
3689
+
3690
+ /** `4 minutes ago`, `yesterday`, `11 days ago`; absolute past a month. */
3691
+ export function formatRelative(iso: string | null, never = 'Never'): string {
3692
+ if (!iso) return never;
3693
+ const seconds = Math.round((new Date(iso).getTime() - Date.now()) / 1000);
3694
+ const abs = Math.abs(seconds);
3695
+ if (abs < 60) return 'Just now';
3696
+ if (abs < 3600) return relative.format(Math.round(seconds / 60), 'minute');
3697
+ if (abs < 86_400) return relative.format(Math.round(seconds / 3600), 'hour');
3698
+ if (abs < 30 * 86_400)
3699
+ return relative.format(Math.round(seconds / 86_400), 'day');
3700
+ return formatDate(iso);
3701
+ }
3702
+
3703
+ /** `€1,440.00`. */
3704
+ export const formatMoney = (amount: number, currency: string) =>
3705
+ new Intl.NumberFormat('en-IE', { style: 'currency', currency }).format(
3706
+ amount
3707
+ );
3708
+
3709
+ /** Two-letter initials for the avatar fallback: `Sofia Reyes` → `SR`. */
3710
+ export const initials = (name: string) =>
3711
+ name
3712
+ .split(/\s+/)
3713
+ .filter(Boolean)
3714
+ .slice(0, 2)
3715
+ .map((part) => part[0]!.toUpperCase())
3716
+ .join('');
3717
+ ```
3718
+
3719
+ ### Types
3720
+
3721
+ `SettingsWorkspace/types.ts` (colocated; import it as `./types`) — the whole domain, as `type` aliases (an Inertia payload needs an implicit index signature, and one shape across the three platforms keeps the recipes identical).
3722
+
3723
+ ```ts
3724
+ export type Workspace = {
3725
+ id: string;
3726
+ name: string;
3727
+ slug: string;
3728
+ createdAt: string;
3729
+ };
3730
+
3731
+ export type Profile = {
3732
+ id: string;
3733
+ name: string;
3734
+ email: string;
3735
+ title: string | null;
3736
+ /** IANA zone, e.g. `Europe/Lisbon`. */
3737
+ timezone: string;
3738
+ avatarUrl: string | null;
3739
+ };
3740
+
3741
+ /** What the explicit-save Profile card sends (the Zod schema's output). */
3742
+ export type ProfileDraft = {
3743
+ name: string;
3744
+ email: string;
3745
+ title: string | null;
3746
+ timezone: string;
3747
+ };
3748
+
3749
+ export type NotificationChannel = 'email' | 'push' | 'slack';
3750
+ export type NotificationEvent =
3751
+ | 'invoice-paid'
3752
+ | 'invoice-overdue'
3753
+ | 'payment-failed'
3754
+ | 'member-joined'
3755
+ | 'mentioned'
3756
+ | 'weekly-summary';
3757
+
3758
+ export type NotificationPrefs = {
3759
+ /** The delivery channels switched on. */
3760
+ channels: NotificationChannel[];
3761
+ /** Per event, the channels it is delivered on. */
3762
+ events: Record<NotificationEvent, NotificationChannel[]>;
3763
+ };
3764
+
3765
+ export type MemberRole = 'owner' | 'admin' | 'member' | 'accountant';
3766
+ export type InvitableRole = Exclude<MemberRole, 'owner'>;
3767
+
3768
+ export type WorkspaceMember = {
3769
+ id: string;
3770
+ name: string;
3771
+ email: string;
3772
+ role: MemberRole;
3773
+ status: 'active' | 'invited';
3774
+ lastActiveAt: string | null;
3775
+ joinedAt: string | null;
3776
+ invitedAt: string | null;
3777
+ };
3778
+
3779
+ export type BillingInvoice = {
3780
+ id: string;
3781
+ number: string;
3782
+ date: string;
3783
+ amount: number;
3784
+ status: 'paid' | 'refunded' | 'open';
3785
+ pdfUrl: string;
3786
+ };
3787
+
3788
+ export type BillingSummary = {
3789
+ plan: string;
3790
+ interval: 'monthly' | 'yearly';
3791
+ status: 'active' | 'trialing' | 'past_due';
3792
+ pricePerSeat: number;
3793
+ currency: string;
3794
+ renewsAt: string;
3795
+ nextInvoiceAmount: number;
3796
+ seats: { used: number; included: number };
3797
+ paymentMethod: {
3798
+ brand: string;
3799
+ last4: string;
3800
+ expMonth: number;
3801
+ expYear: number;
3802
+ };
3803
+ billingEmail: string;
3804
+ invoices: BillingInvoice[];
3805
+ };
3806
+
3807
+ export type ApiKeyScope = 'read' | 'write' | 'admin';
3808
+ export type ApiKeyExpiry = '30d' | '90d' | '1y' | 'never';
3809
+
3810
+ export type ApiKey = {
3811
+ id: string;
3812
+ name: string;
3813
+ /** Prefix + last four only (`nw_live_…9f2c`); the secret never comes back. */
3814
+ preview: string;
3815
+ scope: ApiKeyScope;
3816
+ createdAt: string;
3817
+ createdBy: string;
3818
+ lastUsedAt: string | null;
3819
+ expiresAt: string | null;
3820
+ };
3821
+
3822
+ export type ApiKeyDraft = {
3823
+ name: string;
3824
+ scope: ApiKeyScope;
3825
+ expiresIn: ApiKeyExpiry;
3826
+ };
3827
+ ```
3828
+
3829
+ ## Why it is built this way
3830
+
3831
+ - **Tabs, not a link side nav.** The six sections are peers of one subject and
3832
+ share one page context: the seat count feeds Members and Billing, the leave
3833
+ guard protects one draft, toasts come from one place. BbTabs brings roving
3834
+ arrow-key focus and `tablist` semantics for free, and `navigation` keeps
3835
+ the URL honest. What it costs: BbTabs draws one flat list, so the
3836
+ account/workspace split that Linear shows as headings is said instead by the
3837
+ scope line over each section title (`Your account` / `Fennel & Hart`).
3838
+ - **The nav look is `variant="none"` plus the component's own tokens.** A
3839
+ look of your own starts from `none`, never from a new variant. The tokens
3840
+ go inline on the tablist through `SECTION_NAV_PT.wrapper.style`, so they
3841
+ beat the `none` tokens with no stylesheet: nothing depends on a scoped
3842
+ style reaching inside `BbTabs` (it never does). No `.bb-*__*` internals are restyled, and dark mode follows
3843
+ because every value mixes from `--bb-*` tokens. The line variant was tried
3844
+ first and read as heavy side tabs.
3845
+ - **The phone strip shows where you are.** The strip runs edge to edge (a cut
3846
+ item at the screen edge says "scroll"), and the active section is scrolled
3847
+ into view on load and on every change, so a deep link to `?section=api-keys`
3848
+ is not a strip that starts at Profile.
3849
+ - **BbForm owns validation, the context owns what is saved.** The Zod schema is
3850
+ the client half of the rules (messages on the types too: an emptied field
3851
+ holds `null`); the server re-checks and adds what only it can know (the
3852
+ address belongs to a teammate), and `setErrors` puts that on the field.
3853
+ `setErrors` does not move focus, so the leaf moves it to the first
3854
+ `aria-invalid` field: a keyboard or screen-reader user lands on the problem.
3855
+ - **Form contexts are coopted like table contexts.** The invite and create-key
3856
+ dialogs submit from their footers, outside the `<form>`, through
3857
+ `useBbFormContext(id)`, and the context calls `setErrors` on the same
3858
+ handles. No template refs, no events relayed up.
3859
+ - **The instant writer is one function.** Channel switches and matrix
3860
+ checkboxes both go through `writeNotifications`: optimistic, one flag
3861
+ holding every toggle `readonly`, one revert. Two writers could race and
3862
+ revert each other.
3863
+ - **The secret never enters page state.** It lives in the create-key dialog's
3864
+ own ref and dies with it; the list only ever holds the
3865
+ prefix and the last four characters, and the dialog is `persistent` while
3866
+ the secret is on screen so a stray backdrop click cannot lose it.
3867
+ - **Every state is designed.** Skeletons in each card's own shape while a
3868
+ section loads (on Nuxt the server renders data, so they show only on a client refresh); a members empty state that
3869
+ echoes the search; an API keys empty state that says what a key is for; the
3870
+ disabled Invite button explains itself (no seats left, and a way to add some).
3871
+ - **The state ladder, rung by rung.** Local refs: a cell's spinner, a dialog's
3872
+ draft, the typed confirmation, the secret. Form contexts: validation and
3873
+ server errors. Page context: section data, the draft, dialogs, actions.
3874
+ Nothing outlives the page, so there is no store.
3875
+ - **Copy says the consequence.** Every section and card has one sentence that
3876
+ says what the setting does ("Due dates and reminders follow this zone"),
3877
+ buttons are verbs, errors say the fix, and no visible string uses an em
3878
+ dash.
3879
+ - **Sizing:** `md` buttons everywhere except the dense table cells (`sm` role
3880
+ triggers, row menus, revoke). Inputs are full size in forms and `compact`
3881
+ in the members toolbar and tables.
3882
+
3883
+ ## Variations
3884
+
3885
+ - **One route per section** (Linear, GitHub): when sections grow into pages of
3886
+ their own (audit logs, SSO), give each its own route under a layout that
3887
+ renders the same side nav as links, and move the leave guard into the
3888
+ Profile page. The leaves and the context split per section unchanged.
3889
+ - **Grouped nav**: until BbTabs can draw group headings, two stacked lists
3890
+ (Account, Workspace) of `BbBaseButton` links with `aria-current` are the
3891
+ honest version; keep `?section=` so deep links survive.
3892
+ - **Autosave the profile too** (Linear): drop the footer, commit each field on
3893
+ `@change` (blur or Enter, never per keystroke) and show a "Saved" mark per
3894
+ field; the leave guard goes away with the draft.
3895
+ - **Per-workspace notifications**: key the matrix by workspace and add a
3896
+ workspace switcher in the section header; the writer stays one function.
3897
+ - **Seats as a real purchase**: turn "Add seats" into a quantity dialog that
3898
+ previews the prorated charge before it confirms.