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