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