@eifi1/ui-kit 0.11.0 → 0.13.0

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 (397) hide show
  1. package/README.md +59 -34
  2. package/dist/chart.d.ts +3 -1
  3. package/dist/chart.js +2 -0
  4. package/dist/chart.js.map +1 -1
  5. package/dist/components/account-settings-labels.d.ts +105 -0
  6. package/dist/components/account-settings-labels.js +81 -0
  7. package/dist/components/account-settings-labels.js.map +1 -0
  8. package/dist/components/account-settings.d.ts +36 -52
  9. package/dist/components/account-settings.js +44 -8
  10. package/dist/components/account-settings.js.map +1 -1
  11. package/dist/components/amount-input.d.ts +40 -4
  12. package/dist/components/amount-input.js +50 -12
  13. package/dist/components/amount-input.js.map +1 -1
  14. package/dist/components/authed-image.d.ts +68 -0
  15. package/dist/components/authed-image.js +117 -0
  16. package/dist/components/authed-image.js.map +1 -0
  17. package/dist/components/breadcrumbs.d.ts +2 -1
  18. package/dist/components/breadcrumbs.js +5 -2
  19. package/dist/components/breadcrumbs.js.map +1 -1
  20. package/dist/components/bulk-action-bar.d.ts +10 -2
  21. package/dist/components/bulk-action-bar.js.map +1 -1
  22. package/dist/components/button-group.d.ts +51 -2
  23. package/dist/components/button-group.js +5 -1
  24. package/dist/components/button-group.js.map +1 -1
  25. package/dist/components/calculator.d.ts +15 -4
  26. package/dist/components/calendar-heatmap.d.ts +41 -3
  27. package/dist/components/calendar-heatmap.js +48 -7
  28. package/dist/components/calendar-heatmap.js.map +1 -1
  29. package/dist/components/chart.js +14 -8
  30. package/dist/components/chart.js.map +1 -1
  31. package/dist/components/chip.d.ts +2 -1
  32. package/dist/components/chip.js +26 -18
  33. package/dist/components/chip.js.map +1 -1
  34. package/dist/components/choice-card.d.ts +35 -3
  35. package/dist/components/choice-card.js +83 -25
  36. package/dist/components/choice-card.js.map +1 -1
  37. package/dist/components/combobox-core.d.ts +3 -1
  38. package/dist/components/combobox-core.js +18 -5
  39. package/dist/components/combobox-core.js.map +1 -1
  40. package/dist/components/combobox.d.ts +2 -2
  41. package/dist/components/combobox.js +31 -9
  42. package/dist/components/combobox.js.map +1 -1
  43. package/dist/components/copy-button.d.ts +51 -70
  44. package/dist/components/copy-button.js +1 -1
  45. package/dist/components/copy-button.js.map +1 -1
  46. package/dist/components/data-table-cells.d.ts +63 -0
  47. package/dist/components/data-table-cells.js +64 -0
  48. package/dist/components/data-table-cells.js.map +1 -0
  49. package/dist/components/data-table-filter-popover.d.ts +1 -1
  50. package/dist/components/data-table-filter-popover.js +8 -1
  51. package/dist/components/data-table-filter-popover.js.map +1 -1
  52. package/dist/components/data-table-filters.d.ts +1 -1
  53. package/dist/components/data-table-filters.js +31 -1
  54. package/dist/components/data-table-filters.js.map +1 -1
  55. package/dist/components/data-table-labels.d.ts +13 -0
  56. package/dist/components/data-table-labels.js +8 -1
  57. package/dist/components/data-table-labels.js.map +1 -1
  58. package/dist/components/data-table.d.ts +1 -1
  59. package/dist/components/data-table.js +125 -27
  60. package/dist/components/data-table.js.map +1 -1
  61. package/dist/components/date-picker.d.ts +3 -1
  62. package/dist/components/date-picker.js +15 -2
  63. package/dist/components/date-picker.js.map +1 -1
  64. package/dist/components/description-list.d.ts +23 -3
  65. package/dist/components/description-list.js +23 -3
  66. package/dist/components/description-list.js.map +1 -1
  67. package/dist/components/dialog-frame.d.ts +1 -0
  68. package/dist/components/entity-combobox.d.ts +1 -1
  69. package/dist/components/entity-combobox.js +40 -20
  70. package/dist/components/entity-combobox.js.map +1 -1
  71. package/dist/components/error-boundary.d.ts +281 -0
  72. package/dist/components/error-boundary.js +302 -0
  73. package/dist/components/error-boundary.js.map +1 -0
  74. package/dist/components/field-sync.js +90 -83
  75. package/dist/components/field-sync.js.map +1 -1
  76. package/dist/components/field.d.ts +30 -4
  77. package/dist/components/field.js +40 -17
  78. package/dist/components/field.js.map +1 -1
  79. package/dist/components/file-button.d.ts +50 -208
  80. package/dist/components/file-dropzone.d.ts +49 -2
  81. package/dist/components/floating-panel.d.ts +13 -4
  82. package/dist/components/floating-panel.js +7 -3
  83. package/dist/components/floating-panel.js.map +1 -1
  84. package/dist/components/form-actions.d.ts +53 -0
  85. package/dist/components/form-actions.js +98 -0
  86. package/dist/components/form-actions.js.map +1 -0
  87. package/dist/components/full-bleed-dialog.js +4 -0
  88. package/dist/components/full-bleed-dialog.js.map +1 -1
  89. package/dist/components/hover-menu.js +64 -56
  90. package/dist/components/hover-menu.js.map +1 -1
  91. package/dist/components/image-grid.d.ts +67 -0
  92. package/dist/components/image-grid.js +112 -0
  93. package/dist/components/image-grid.js.map +1 -0
  94. package/dist/components/lightbox.d.ts +104 -0
  95. package/dist/components/lightbox.js +229 -0
  96. package/dist/components/lightbox.js.map +1 -0
  97. package/dist/components/line-items.d.ts +114 -0
  98. package/dist/components/line-items.js +238 -0
  99. package/dist/components/line-items.js.map +1 -0
  100. package/dist/components/list.d.ts +37 -4
  101. package/dist/components/list.js +35 -14
  102. package/dist/components/list.js.map +1 -1
  103. package/dist/components/loading-state.d.ts +24 -0
  104. package/dist/components/loading-state.js +32 -0
  105. package/dist/components/loading-state.js.map +1 -0
  106. package/dist/components/menu-item.d.ts +2 -1
  107. package/dist/components/menu-item.js +5 -1
  108. package/dist/components/menu-item.js.map +1 -1
  109. package/dist/components/mini-calendar.d.ts +13 -1
  110. package/dist/components/mini-calendar.js +46 -2
  111. package/dist/components/mini-calendar.js.map +1 -1
  112. package/dist/components/modal.d.ts +20 -1
  113. package/dist/components/modal.js +26 -2
  114. package/dist/components/modal.js.map +1 -1
  115. package/dist/components/month-picker.d.ts +21 -1
  116. package/dist/components/month-picker.js +139 -26
  117. package/dist/components/month-picker.js.map +1 -1
  118. package/dist/components/multi-entity-combobox.d.ts +1 -1
  119. package/dist/components/multi-entity-combobox.js +42 -20
  120. package/dist/components/multi-entity-combobox.js.map +1 -1
  121. package/dist/components/nav-pills.d.ts +2 -1
  122. package/dist/components/nav-pills.js +5 -1
  123. package/dist/components/nav-pills.js.map +1 -1
  124. package/dist/components/number-field.d.ts +24 -5
  125. package/dist/components/number-field.js +5 -7
  126. package/dist/components/number-field.js.map +1 -1
  127. package/dist/components/number-input.d.ts +25 -5
  128. package/dist/components/number-input.js +7 -1
  129. package/dist/components/number-input.js.map +1 -1
  130. package/dist/components/numpad-sheet.d.ts +20 -5
  131. package/dist/components/numpad-sheet.js +3 -2
  132. package/dist/components/numpad-sheet.js.map +1 -1
  133. package/dist/components/page-header.d.ts +35 -6
  134. package/dist/components/page-header.js +7 -1
  135. package/dist/components/page-header.js.map +1 -1
  136. package/dist/components/passkeys-setting.d.ts +67 -0
  137. package/dist/components/passkeys-setting.js +214 -0
  138. package/dist/components/passkeys-setting.js.map +1 -0
  139. package/dist/components/picker-sheet.js +5 -1
  140. package/dist/components/picker-sheet.js.map +1 -1
  141. package/dist/components/pie-chart-labels.d.ts +20 -0
  142. package/dist/components/pie-chart-labels.js +12 -0
  143. package/dist/components/pie-chart-labels.js.map +1 -0
  144. package/dist/components/pie-chart.d.ts +101 -0
  145. package/dist/components/pie-chart.js +283 -0
  146. package/dist/components/pie-chart.js.map +1 -0
  147. package/dist/components/popover.js +3 -0
  148. package/dist/components/popover.js.map +1 -1
  149. package/dist/components/progress-bar.d.ts +44 -3
  150. package/dist/components/progress-bar.js +58 -22
  151. package/dist/components/progress-bar.js.map +1 -1
  152. package/dist/components/qr-code.d.ts +34 -0
  153. package/dist/components/qr-code.js +57 -0
  154. package/dist/components/qr-code.js.map +1 -0
  155. package/dist/components/search-field.d.ts +15 -3
  156. package/dist/components/search-field.js +5 -1
  157. package/dist/components/search-field.js.map +1 -1
  158. package/dist/components/settings-fields.d.ts +49 -1
  159. package/dist/components/signed-amount.d.ts +122 -0
  160. package/dist/components/signed-amount.js +152 -0
  161. package/dist/components/signed-amount.js.map +1 -0
  162. package/dist/components/skeleton.d.ts +10 -3
  163. package/dist/components/skeleton.js +12 -2
  164. package/dist/components/skeleton.js.map +1 -1
  165. package/dist/components/stat-tile.d.ts +2 -1
  166. package/dist/components/stat-tile.js +6 -3
  167. package/dist/components/stat-tile.js.map +1 -1
  168. package/dist/components/swipeable-row.js +4 -3
  169. package/dist/components/swipeable-row.js.map +1 -1
  170. package/dist/components/table.d.ts +39 -5
  171. package/dist/components/table.js +45 -11
  172. package/dist/components/table.js.map +1 -1
  173. package/dist/components/text-link.d.ts +238 -0
  174. package/dist/components/text-link.js +144 -0
  175. package/dist/components/text-link.js.map +1 -0
  176. package/dist/components/text.d.ts +26 -2
  177. package/dist/components/text.js +16 -2
  178. package/dist/components/text.js.map +1 -1
  179. package/dist/components/time-input.d.ts +49 -1
  180. package/dist/components/toggle-group.d.ts +35 -0
  181. package/dist/components/toggle-group.js +43 -14
  182. package/dist/components/toggle-group.js.map +1 -1
  183. package/dist/components/toggle-legend.d.ts +53 -3
  184. package/dist/components/toggle-legend.js +54 -1
  185. package/dist/components/toggle-legend.js.map +1 -1
  186. package/dist/components/tooltip.d.ts +51 -1
  187. package/dist/components/tooltip.js +59 -35
  188. package/dist/components/tooltip.js.map +1 -1
  189. package/dist/components/ui.d.ts +51 -779
  190. package/dist/components/ui.js +364 -34
  191. package/dist/components/ui.js.map +1 -1
  192. package/dist/components/use-table-state.d.ts +3 -52
  193. package/dist/components/use-table-state.js +128 -30
  194. package/dist/components/use-table-state.js.map +1 -1
  195. package/dist/{data-table-filters-Dh9uF_S-.d.ts → data-table-Drun8Fk9.d.ts} +305 -61
  196. package/dist/data-table.d.ts +2 -1
  197. package/dist/data-table.js +5 -1
  198. package/dist/data-table.js.map +1 -1
  199. package/dist/feedback/feedback-attachment.js +4 -6
  200. package/dist/feedback/feedback-attachment.js.map +1 -1
  201. package/dist/feedback/feedback-dialog.d.ts +26 -3
  202. package/dist/feedback/feedback-dialog.js +21 -5
  203. package/dist/feedback/feedback-dialog.js.map +1 -1
  204. package/dist/feedback/feedback-inbox.js +86 -75
  205. package/dist/feedback/feedback-inbox.js.map +1 -1
  206. package/dist/feedback/feedback-thread.d.ts +173 -0
  207. package/dist/feedback/feedback-thread.js +264 -0
  208. package/dist/feedback/feedback-thread.js.map +1 -0
  209. package/dist/feedback.d.ts +2 -1
  210. package/dist/feedback.js +1 -0
  211. package/dist/feedback.js.map +1 -1
  212. package/dist/hooks/use-authed-src.d.ts +71 -0
  213. package/dist/hooks/use-authed-src.js +63 -0
  214. package/dist/hooks/use-authed-src.js.map +1 -0
  215. package/dist/hooks/use-file-drop.d.ts +49 -2
  216. package/dist/hooks/use-hotkey.d.ts +59 -0
  217. package/dist/hooks/use-hotkey.js +105 -0
  218. package/dist/hooks/use-hotkey.js.map +1 -0
  219. package/dist/hooks/use-search-param-state.d.ts +83 -0
  220. package/dist/hooks/use-search-param-state.js +94 -0
  221. package/dist/hooks/use-search-param-state.js.map +1 -0
  222. package/dist/i18n/defaults.d.ts +15 -4
  223. package/dist/i18n/defaults.js +31 -1
  224. package/dist/i18n/defaults.js.map +1 -1
  225. package/dist/i18n/kit-labels.d.ts +46 -312
  226. package/dist/i18n/kit-labels.js +20 -5
  227. package/dist/i18n/kit-labels.js.map +1 -1
  228. package/dist/i18n/locales/de-CH-informal.d.ts +15 -4
  229. package/dist/i18n/locales/de-CH.d.ts +15 -4
  230. package/dist/i18n/locales/de-informal.d.ts +15 -4
  231. package/dist/i18n/locales/de.d.ts +15 -4
  232. package/dist/i18n/locales/de.js +164 -3
  233. package/dist/i18n/locales/de.js.map +1 -1
  234. package/dist/i18n/locales/es.d.ts +15 -4
  235. package/dist/i18n/locales/es.js +161 -3
  236. package/dist/i18n/locales/es.js.map +1 -1
  237. package/dist/i18n/locales/fr.d.ts +15 -4
  238. package/dist/i18n/locales/fr.js +161 -3
  239. package/dist/i18n/locales/fr.js.map +1 -1
  240. package/dist/i18n/locales/hu.d.ts +15 -4
  241. package/dist/i18n/locales/hu.js +161 -3
  242. package/dist/i18n/locales/hu.js.map +1 -1
  243. package/dist/i18n/locales/it.d.ts +15 -4
  244. package/dist/i18n/locales/it.js +161 -3
  245. package/dist/i18n/locales/it.js.map +1 -1
  246. package/dist/i18n/locales/zh.d.ts +15 -4
  247. package/dist/i18n/locales/zh.js +161 -3
  248. package/dist/i18n/locales/zh.js.map +1 -1
  249. package/dist/index.d.ts +39 -19
  250. package/dist/index.js +40 -1
  251. package/dist/index.js.map +1 -1
  252. package/dist/kit-labels-Mz8zZHIF.d.ts +1744 -0
  253. package/dist/lib/format.d.ts +162 -0
  254. package/dist/lib/format.js +151 -0
  255. package/dist/lib/format.js.map +1 -0
  256. package/dist/lib/qr-encode.d.ts +44 -0
  257. package/dist/lib/qr-encode.js +338 -0
  258. package/dist/lib/qr-encode.js.map +1 -0
  259. package/dist/rhf/fields.d.ts +283 -0
  260. package/dist/rhf/fields.js +631 -0
  261. package/dist/rhf/fields.js.map +1 -0
  262. package/dist/rhf/form.d.ts +49 -1
  263. package/dist/rhf/line-items.d.ts +31 -0
  264. package/dist/rhf/line-items.js +59 -0
  265. package/dist/rhf/line-items.js.map +1 -0
  266. package/dist/rhf.d.ts +61 -1
  267. package/dist/rhf.js +2 -0
  268. package/dist/rhf.js.map +1 -1
  269. package/dist/search/command-palette.js +20 -14
  270. package/dist/search/command-palette.js.map +1 -1
  271. package/dist/shell/app-shell.d.ts +99 -2
  272. package/dist/shell/app-shell.js +120 -57
  273. package/dist/shell/app-shell.js.map +1 -1
  274. package/dist/shell/auth-layout.d.ts +74 -0
  275. package/dist/shell/auth-layout.js +97 -0
  276. package/dist/shell/auth-layout.js.map +1 -0
  277. package/dist/shell/top-bar-brand.d.ts +81 -0
  278. package/dist/shell/top-bar-brand.js +47 -0
  279. package/dist/shell/top-bar-brand.js.map +1 -0
  280. package/dist/shell/topbar-action-menu.d.ts +21 -4
  281. package/dist/shell/topbar-action-menu.js +18 -2
  282. package/dist/shell/topbar-action-menu.js.map +1 -1
  283. package/dist/shell.d.ts +56 -1
  284. package/dist/shell.js +2 -0
  285. package/dist/shell.js.map +1 -1
  286. package/dist/tour/tour.js +10 -4
  287. package/dist/tour/tour.js.map +1 -1
  288. package/dist/wizard/stepper-nav.d.ts +48 -1
  289. package/dist/wizard/use-wizard.js +4 -2
  290. package/dist/wizard/use-wizard.js.map +1 -1
  291. package/dist/wizard/wizard-context.d.ts +24 -1
  292. package/dist/wizard/wizard-context.js +19 -2
  293. package/dist/wizard/wizard-context.js.map +1 -1
  294. package/dist/wizard/wizard-step.d.ts +30 -5
  295. package/dist/wizard/wizard-step.js +34 -3
  296. package/dist/wizard/wizard-step.js.map +1 -1
  297. package/dist/wizard.d.ts +50 -3
  298. package/package.json +6 -6
  299. package/src/chart.ts +4 -0
  300. package/src/components/account-settings-labels.ts +190 -0
  301. package/src/components/account-settings.tsx +110 -63
  302. package/src/components/amount-input.tsx +109 -10
  303. package/src/components/authed-image.tsx +190 -0
  304. package/src/components/breadcrumbs.tsx +8 -2
  305. package/src/components/bulk-action-bar.tsx +16 -3
  306. package/src/components/button-group.tsx +7 -2
  307. package/src/components/calendar-heatmap.tsx +105 -10
  308. package/src/components/chart.tsx +19 -8
  309. package/src/components/chip.tsx +14 -4
  310. package/src/components/choice-card.tsx +136 -25
  311. package/src/components/combobox-core.tsx +33 -9
  312. package/src/components/combobox.tsx +33 -9
  313. package/src/components/copy-button.tsx +3 -2
  314. package/src/components/data-table-cells.tsx +119 -0
  315. package/src/components/data-table-filter-popover.tsx +13 -5
  316. package/src/components/data-table-filters.ts +77 -0
  317. package/src/components/data-table-labels.ts +23 -0
  318. package/src/components/data-table.tsx +230 -13
  319. package/src/components/date-picker.tsx +19 -3
  320. package/src/components/description-list.tsx +52 -3
  321. package/src/components/entity-combobox.tsx +25 -7
  322. package/src/components/error-boundary.tsx +640 -0
  323. package/src/components/field-sync.tsx +48 -40
  324. package/src/components/field.tsx +56 -5
  325. package/src/components/floating-panel.tsx +20 -7
  326. package/src/components/form-actions.tsx +191 -0
  327. package/src/components/full-bleed-dialog.tsx +4 -0
  328. package/src/components/hover-menu.tsx +26 -17
  329. package/src/components/image-grid.tsx +181 -0
  330. package/src/components/lightbox.tsx +374 -0
  331. package/src/components/line-items.tsx +385 -0
  332. package/src/components/list.tsx +82 -19
  333. package/src/components/loading-state.tsx +47 -0
  334. package/src/components/menu-item.tsx +7 -2
  335. package/src/components/mini-calendar.tsx +72 -3
  336. package/src/components/modal.tsx +65 -3
  337. package/src/components/month-picker.tsx +181 -26
  338. package/src/components/multi-entity-combobox.tsx +27 -7
  339. package/src/components/nav-pills.tsx +8 -1
  340. package/src/components/number-field.tsx +15 -10
  341. package/src/components/number-input.tsx +17 -1
  342. package/src/components/numpad-sheet.tsx +6 -1
  343. package/src/components/page-header.tsx +42 -5
  344. package/src/components/passkeys-setting.tsx +331 -0
  345. package/src/components/picker-sheet.tsx +10 -1
  346. package/src/components/pie-chart-labels.ts +32 -0
  347. package/src/components/pie-chart.tsx +479 -0
  348. package/src/components/popover.tsx +3 -0
  349. package/src/components/progress-bar.tsx +129 -19
  350. package/src/components/qr-code.tsx +83 -0
  351. package/src/components/search-field.tsx +20 -4
  352. package/src/components/signed-amount.tsx +295 -0
  353. package/src/components/skeleton.tsx +21 -3
  354. package/src/components/stat-tile.tsx +11 -3
  355. package/src/components/swipeable-row.tsx +7 -7
  356. package/src/components/table.tsx +102 -13
  357. package/src/components/text-link.tsx +356 -0
  358. package/src/components/text.tsx +46 -2
  359. package/src/components/toggle-group.tsx +93 -20
  360. package/src/components/toggle-legend.tsx +108 -2
  361. package/src/components/tooltip.tsx +79 -8
  362. package/src/components/ui.tsx +707 -49
  363. package/src/components/use-table-state.ts +265 -33
  364. package/src/data-table.ts +10 -0
  365. package/src/feedback/feedback-attachment.tsx +10 -7
  366. package/src/feedback/feedback-dialog.tsx +49 -7
  367. package/src/feedback/feedback-inbox.tsx +7 -0
  368. package/src/feedback/feedback-thread.tsx +510 -0
  369. package/src/feedback.ts +1 -0
  370. package/src/hooks/use-authed-src.ts +161 -0
  371. package/src/hooks/use-hotkey.ts +172 -0
  372. package/src/hooks/use-search-param-state.ts +187 -0
  373. package/src/i18n/defaults.ts +30 -0
  374. package/src/i18n/kit-labels.tsx +118 -8
  375. package/src/i18n/locales/de.ts +161 -0
  376. package/src/i18n/locales/es.ts +158 -0
  377. package/src/i18n/locales/fr.ts +161 -0
  378. package/src/i18n/locales/hu.ts +159 -0
  379. package/src/i18n/locales/it.ts +159 -0
  380. package/src/i18n/locales/zh.ts +158 -0
  381. package/src/index.ts +59 -0
  382. package/src/lib/format.ts +348 -0
  383. package/src/lib/qr-encode.ts +420 -0
  384. package/src/rhf/fields.tsx +1135 -0
  385. package/src/rhf/line-items.tsx +130 -0
  386. package/src/rhf.ts +6 -0
  387. package/src/search/command-palette.tsx +29 -19
  388. package/src/shell/app-shell.tsx +153 -3
  389. package/src/shell/auth-layout.tsx +190 -0
  390. package/src/shell/top-bar-brand.tsx +76 -0
  391. package/src/shell/topbar-action-menu.tsx +32 -4
  392. package/src/shell.ts +2 -0
  393. package/src/tour/tour.tsx +16 -5
  394. package/src/wizard/use-wizard.ts +8 -4
  395. package/src/wizard/wizard-context.tsx +41 -1
  396. package/src/wizard/wizard-step.tsx +75 -6
  397. package/tokens.css +12 -0
@@ -1,7 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { MenuItemTone } from '../components/menu-item.js';
4
+ import { UserAvatarBadge } from '../components/user-avatar.js';
4
5
  import 'lucide-react';
6
+ import '../components/status-dot.js';
7
+ import '../components/progress-bar.js';
8
+ import '../components/chip.js';
5
9
 
6
10
  /**
7
11
  * One row of a {@link TopBarActionMenu}. An `action` (default) runs `onSelect`, a
@@ -51,9 +55,15 @@ interface TopBarMenuHeader {
51
55
  title: ReactNode;
52
56
  /** The muted second line — an email, a role. */
53
57
  subtitle?: ReactNode;
54
- /** Anything below — a role chip. A link or button here stays out of the arrow keys
55
- * and in the Tab order, like the footer's. */
56
- extra?: ReactNode;
58
+ /**
59
+ * Anything below — a role chip. A link or button here stays out of the arrow keys
60
+ * and in the Tab order, like the footer's.
61
+ *
62
+ * Pass a function to get `close`, as `footer` does — keksdose F7: its admin role
63
+ * chip links to the admin area, and a router link does not unmount the menu, so
64
+ * without `close` the panel stayed open over the page it had just navigated to.
65
+ */
66
+ extra?: ReactNode | ((close: () => void) => ReactNode);
57
67
  }
58
68
  /**
59
69
  * A top-bar icon button that opens a {@link HoverMenu} of actions and/or links,
@@ -67,9 +77,16 @@ interface TopBarMenuHeader {
67
77
  * custom `trigger` (the avatar), a `header` (name + role / email), the rows, and a
68
78
  * free-content `footer` (the legal links).
69
79
  */
70
- declare function TopBarActionMenu({ icon, trigger, triggerClassName, ariaLabel, heading, header, entries, children, footer, footerLabel, align, panelClassName, }: {
80
+ declare function TopBarActionMenu({ icon, iconBadge, trigger, triggerClassName, ariaLabel, heading, header, entries, children, footer, footerLabel, align, panelClassName, }: {
71
81
  /** The trigger's face for the usual icon button. Ignored when `trigger` is given. */
72
82
  icon?: ReactNode;
83
+ /**
84
+ * A status dot in the top-end corner of `icon` — keksdose's unread-support dot on the
85
+ * feedback trigger. Like `UserAvatar`'s `badge`, its `label` joins the trigger's name
86
+ * ("Send feedback 2 unread"), so the dot is not something only the eye is told about.
87
+ * Ignored with `trigger`: give the face its own badge there.
88
+ */
89
+ iconBadge?: UserAvatarBadge | null;
73
90
  /**
74
91
  * A face of your own for the trigger — the account menu's `UserAvatar`. It is drawn
75
92
  * INSIDE the kit's button, which keeps the wiring: `aria-haspopup`, `aria-expanded`,
@@ -5,6 +5,7 @@ import { Link } from "react-router";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { HoverMenu } from "../components/hover-menu.js";
7
7
  import { MenuItem } from "../components/menu-item.js";
8
+ import { StatusDot } from "../components/status-dot.js";
8
9
  import { TOPBAR_TRIGGER_CLASS } from "./topbar-controls.js";
9
10
  const SECTION_CONTROLS = "a[href]:not([role]),button:not([role])";
10
11
  const TABBABLE = "a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]";
@@ -32,6 +33,7 @@ function keepTabInsidePanel(e) {
32
33
  }
33
34
  function TopBarActionMenu({
34
35
  icon,
36
+ iconBadge,
35
37
  trigger,
36
38
  triggerClassName,
37
39
  ariaLabel,
@@ -53,7 +55,20 @@ function TopBarActionMenu({
53
55
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: ariaLabel }),
54
56
  " ",
55
57
  trigger({ open })
56
- ] }) : /* @__PURE__ */ jsx(
58
+ ] }) : iconBadge ? (
59
+ // Named by its content, like the custom-trigger branch, so the badge label is
60
+ // part of the name; an `aria-label` would have hidden it.
61
+ /* @__PURE__ */ jsxs("button", { type: "button", onClick: toggle, className: cn(TOPBAR_TRIGGER_CLASS, "relative", triggerClassName), children: [
62
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: ariaLabel }),
63
+ " ",
64
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative inline-flex", children: [
65
+ icon,
66
+ /* @__PURE__ */ jsx(StatusDot, { ring: true, tone: iconBadge.tone ?? "danger", className: "absolute -end-0.5 -top-0.5" })
67
+ ] }),
68
+ " ",
69
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: iconBadge.label })
70
+ ] })
71
+ ) : /* @__PURE__ */ jsx(
57
72
  "button",
58
73
  {
59
74
  type: "button",
@@ -65,6 +80,7 @@ function TopBarActionMenu({
65
80
  ),
66
81
  children: (close) => {
67
82
  const footerBody = typeof footer === "function" ? footer(close) : footer;
83
+ const headerExtra = typeof header?.extra === "function" ? header.extra(close) : header?.extra;
68
84
  const footerClass = "flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--text-muted)] [&_a:hover]:text-[var(--text-primary)] [&_a]:rounded-sm [&_a:focus-visible]:outline-none [&_a:focus-visible]:ring-2 [&_a:focus-visible]:ring-[var(--brand)]";
69
85
  return (
70
86
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a Tab bubbling up from a row or footer link, see keepTabInsidePanel
@@ -72,7 +88,7 @@ function TopBarActionMenu({
72
88
  header && /* @__PURE__ */ jsxs(MenuSection, { className: "mb-1 border-b border-[var(--border)] px-3 py-2", children: [
73
89
  /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-medium text-[var(--text-primary)]", children: header.title }),
74
90
  header.subtitle != null && /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-[var(--text-muted)]", children: header.subtitle }),
75
- header.extra != null && /* @__PURE__ */ jsx("div", { className: "mt-1", children: header.extra })
91
+ headerExtra != null && headerExtra !== false && /* @__PURE__ */ jsx("div", { className: "mt-1", children: headerExtra })
76
92
  ] }),
77
93
  heading && /* @__PURE__ */ jsx("li", { className: "px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]", children: heading }),
78
94
  entries.map((entry) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/shell/topbar-action-menu.tsx"],"sourcesContent":["import { useLayoutEffect, useRef } from \"react\";\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from \"react\";\nimport { Link } from \"react-router\";\nimport { cn } from \"../lib/cn\";\nimport { HoverMenu } from \"../components/hover-menu\";\nimport { MenuItem } from \"../components/menu-item\";\nimport type { MenuItemTone } from \"../components/menu-item\";\nimport { TOPBAR_TRIGGER_CLASS } from \"./topbar-controls\";\n\n/**\n * One row of a {@link TopBarActionMenu}. An `action` (default) runs `onSelect`, a\n * `link` navigates via react-router, and a `divider` draws a rule. Non-divider\n * rows close the menu automatically when chosen. `kind` may be omitted for\n * actions, keeping the common case terse.\n *\n * The rows are {@link MenuItem}s, so they take its options: `tone: \"danger\"` for the\n * log-out row, `checked` (+ `checkable`) for a choice, `current` for the link to the\n * page already open, `disabled`.\n */\nexport type TopBarMenuEntry =\n | {\n kind?: \"action\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n onSelect: () => void;\n tone?: MenuItemTone;\n /** Makes the row a choice (`menuitemradio`, or `menuitemcheckbox` with\n * `checkable: \"checkbox\"`) and says whether it is chosen. */\n checked?: boolean;\n checkable?: \"radio\" | \"checkbox\";\n disabled?: boolean;\n }\n | {\n kind: \"link\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n to: string;\n tone?: MenuItemTone;\n /** The link to the page already open: `aria-current=\"page\"` and a check mark. */\n current?: boolean;\n disabled?: boolean;\n }\n | { kind: \"divider\"; key: string };\n\n/**\n * The non-interactive identity block at the top of an account menu — kastlan's name +\n * role, keksdose's display name + email + role chip. It is text, not a `menuitem`: the\n * arrow keys pass over it.\n */\nexport interface TopBarMenuHeader {\n /** The first line — the user's name. */\n title: ReactNode;\n /** The muted second line — an email, a role. */\n subtitle?: ReactNode;\n /** Anything below — a role chip. A link or button here stays out of the arrow keys\n * and in the Tab order, like the footer's. */\n extra?: ReactNode;\n}\n\n/** What a control is, as far as `HoverMenu` is concerned, when it lives in the header\n * or the footer: not a menu row. */\nconst SECTION_CONTROLS = \"a[href]:not([role]),button:not([role])\";\nconst TABBABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]';\n\n/**\n * A header or footer inside the menu panel.\n *\n * `HoverMenu` promotes EVERY role-less button and link in its panel to a `menuitem` out\n * of the Tab order, and turns every list into `role=\"none\"` — right for the rows, wrong\n * for a footer of legal links, which would join the arrow-key cycle and drop out of Tab.\n * So before it looks (a child's layout effect runs before its parent's), the controls\n * in here get their own role spelled out, which `HoverMenu` leaves alone, and any list\n * keeps its list semantics.\n */\nfunction MenuSection({ className, children }: { className: string; children: ReactNode }) {\n const ref = useRef<HTMLLIElement>(null);\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n for (const c of el.querySelectorAll<HTMLElement>(SECTION_CONTROLS)) {\n c.setAttribute(\"role\", c.tagName === \"A\" ? \"link\" : \"button\");\n }\n for (const l of el.querySelectorAll<HTMLElement>(\"ul:not([role]),ol:not([role])\")) l.setAttribute(\"role\", \"list\");\n for (const l of el.querySelectorAll<HTMLElement>(\"li:not([role])\")) l.setAttribute(\"role\", \"listitem\");\n });\n return (\n <li ref={ref} role=\"none\" className={className}>\n {children}\n </li>\n );\n}\n\n/**\n * `HoverMenu` closes on any Tab inside the panel — right when Tab leaves it, wrong when\n * Tab is on its way from a row to a footer link, or from one footer link to the next:\n * the panel would unmount under the focus. So a Tab whose next stop is still inside the\n * panel stops here and the browser moves focus; one that leaves reaches `HoverMenu`,\n * which closes.\n */\nfunction keepTabInsidePanel(e: ReactKeyboardEvent<HTMLUListElement>) {\n if (e.key !== \"Tab\") return;\n const from = e.target as HTMLElement;\n const stops = Array.from(e.currentTarget.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (el) => el.getAttribute(\"tabindex\") !== \"-1\",\n );\n const way = e.shiftKey ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING;\n if (stops.some((el) => el !== from && from.compareDocumentPosition(el) & way)) e.stopPropagation();\n}\n\n/**\n * A top-bar icon button that opens a {@link HoverMenu} of actions and/or links,\n * with an optional uppercase heading and divider rules. Generic glue over the\n * shared top-bar chrome — e.g. the feedback launcher or the guided-tours menu —\n * so those call sites describe their rows as data instead of rebuilding the\n * trigger + list markup. For a checkmarked value-switcher use\n * {@link OptionSwitcherMenu} instead.\n *\n * It is also the ACCOUNT menu kastlan and keksdose each hand-build on `HoverMenu`: a\n * custom `trigger` (the avatar), a `header` (name + role / email), the rows, and a\n * free-content `footer` (the legal links).\n */\nexport function TopBarActionMenu({\n icon,\n trigger,\n triggerClassName,\n ariaLabel,\n heading,\n header,\n entries,\n children,\n footer,\n footerLabel,\n align,\n panelClassName,\n}: {\n /** The trigger's face for the usual icon button. Ignored when `trigger` is given. */\n icon?: ReactNode;\n /**\n * A face of your own for the trigger — the account menu's `UserAvatar`. It is drawn\n * INSIDE the kit's button, which keeps the wiring: `aria-haspopup`, `aria-expanded`,\n * the toggle, the keyboard. `open` is there for a chevron that turns.\n *\n * The button is named by `ariaLabel` followed by any readable text in the face — a\n * `UserAvatar` `badge` label reaches a screen reader that way (\"Account menu 3\n * unread\"), where an `aria-label` on the button would have hidden it. A\n * `UserAvatar`'s initials are `aria-hidden`, so the person's name is only in the\n * name if `ariaLabel` carries it (\"Marcel Eifert, account menu\").\n */\n trigger?: (state: { open: boolean }) => ReactNode;\n /** Extra classes for the trigger button — `rounded-full` round an avatar. */\n triggerClassName?: string;\n /** Names the trigger and the menu. */\n ariaLabel: string;\n heading?: string;\n /** A non-interactive identity block above the rows. */\n header?: TopBarMenuHeader;\n entries: TopBarMenuEntry[];\n /**\n * Rows the entry data cannot describe (a `Disclosure` sub-list, an app's own\n * section), after `entries`. Render `<li>`s holding `MenuItem`s or plain controls;\n * `close` shuts the menu.\n */\n children?: (close: () => void) => ReactNode;\n /**\n * Free content below the rows, behind a rule — the legal links. Its links and\n * buttons are NOT menu rows: the arrow keys skip them and Tab reaches them. Pass a\n * function to get `close` for the links' `onClick`.\n */\n footer?: ReactNode | ((close: () => void) => ReactNode);\n /** Wraps the footer in a `<nav>` with this name (\"Legal\"). Without it, a plain block. */\n footerLabel?: string;\n /** Which edge of the trigger the panel lines up with (see `HoverMenu`). Default `end`. */\n align?: \"start\" | \"end\" | \"left\" | \"right\";\n panelClassName?: string;\n}) {\n return (\n <HoverMenu\n ariaLabel={ariaLabel}\n align={align}\n trigger={({ open, toggle }) =>\n trigger ? (\n <button type=\"button\" onClick={toggle} className={cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName)}>\n <span className=\"sr-only\">{ariaLabel}</span>\n {/* The space keeps the name from running into the face's text (\"Account\n menu3 unread\"); as a flex item it takes no room. */}\n {\" \"}\n {trigger({ open })}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={toggle}\n aria-label={ariaLabel}\n className={cn(TOPBAR_TRIGGER_CLASS, triggerClassName)}\n >\n {icon}\n </button>\n )\n }\n >\n {(close) => {\n const footerBody = typeof footer === \"function\" ? footer(close) : footer;\n const footerClass =\n \"flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--text-muted)] [&_a:hover]:text-[var(--text-primary)] [&_a]:rounded-sm [&_a:focus-visible]:outline-none [&_a:focus-visible]:ring-2 [&_a:focus-visible]:ring-[var(--brand)]\";\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a Tab bubbling up from a row or footer link, see keepTabInsidePanel\n <ul className={cn(\"py-1\", panelClassName)} onKeyDown={keepTabInsidePanel}>\n {header && (\n <MenuSection className=\"mb-1 border-b border-[var(--border)] px-3 py-2\">\n <div className=\"truncate text-sm font-medium text-[var(--text-primary)]\">{header.title}</div>\n {header.subtitle != null && (\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{header.subtitle}</div>\n )}\n {header.extra != null && <div className=\"mt-1\">{header.extra}</div>}\n </MenuSection>\n )}\n {heading && (\n <li className=\"px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]\">\n {heading}\n </li>\n )}\n {entries.map((entry) => {\n if (entry.kind === \"divider\") {\n return <li key={entry.key} className=\"my-1 border-t border-[var(--border)]\" />;\n }\n return (\n <li key={entry.key}>\n {entry.kind === \"link\" ? (\n <MenuItem\n href={entry.to}\n renderLink={({ href, ...p }) => <Link to={href} {...p} />}\n onClick={close}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n current={entry.current}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n ) : (\n <MenuItem\n onClick={() => {\n entry.onSelect();\n close();\n }}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n checked={entry.checked}\n checkable={entry.checkable}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n )}\n </li>\n );\n })}\n {children?.(close)}\n {footerBody != null && footerBody !== false && (\n <MenuSection className=\"mt-1 border-t border-[var(--border)] px-3 py-2\">\n {footerLabel ? (\n <nav aria-label={footerLabel} className={footerClass}>\n {footerBody}\n </nav>\n ) : (\n <div className={footerClass}>{footerBody}</div>\n )}\n </MenuSection>\n )}\n </ul>\n );\n }}\n </HoverMenu>\n );\n}\n"],"mappings":";AA0F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,MAAM;AAAA,kBAChB,MAAM,MAAM;AAAA,kBACZ,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAEf,gBAAM;AAAA;AAAA,cACT,IAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,SAAS,MAAM;AACb,0BAAM,SAAS;AACf,0BAAM;AAAA,kBACR;AAAA,kBACA,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAChB,MAAM,MAAM;AAAA,kBACZ,SAAS,MAAM;AAAA,kBACf,WAAW,MAAM;AAAA,kBACjB,UAAU,MAAM;AAAA,kBAEf,gBAAM;AAAA;AAAA,cACT,KA5BK,MAAM,GA8Bf;AAAA,YAEJ,CAAC;AAAA,YACA,WAAW,KAAK;AAAA,YAChB,cAAc,QAAQ,eAAe,SACpC,oBAAC,eAAY,WAAU,kDACpB,wBACC,oBAAC,SAAI,cAAY,aAAa,WAAW,aACtC,sBACH,IAEA,oBAAC,SAAI,WAAW,aAAc,sBAAW,GAE7C;AAAA,aAEJ;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/shell/topbar-action-menu.tsx"],"sourcesContent":["import { useLayoutEffect, useRef } from \"react\";\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from \"react\";\nimport { Link } from \"react-router\";\nimport { cn } from \"../lib/cn\";\nimport { HoverMenu } from \"../components/hover-menu\";\nimport { MenuItem } from \"../components/menu-item\";\nimport type { MenuItemTone } from \"../components/menu-item\";\nimport { StatusDot } from \"../components/status-dot\";\nimport type { UserAvatarBadge } from \"../components/user-avatar\";\nimport { TOPBAR_TRIGGER_CLASS } from \"./topbar-controls\";\n\n/**\n * One row of a {@link TopBarActionMenu}. An `action` (default) runs `onSelect`, a\n * `link` navigates via react-router, and a `divider` draws a rule. Non-divider\n * rows close the menu automatically when chosen. `kind` may be omitted for\n * actions, keeping the common case terse.\n *\n * The rows are {@link MenuItem}s, so they take its options: `tone: \"danger\"` for the\n * log-out row, `checked` (+ `checkable`) for a choice, `current` for the link to the\n * page already open, `disabled`.\n */\nexport type TopBarMenuEntry =\n | {\n kind?: \"action\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n onSelect: () => void;\n tone?: MenuItemTone;\n /** Makes the row a choice (`menuitemradio`, or `menuitemcheckbox` with\n * `checkable: \"checkbox\"`) and says whether it is chosen. */\n checked?: boolean;\n checkable?: \"radio\" | \"checkbox\";\n disabled?: boolean;\n }\n | {\n kind: \"link\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n to: string;\n tone?: MenuItemTone;\n /** The link to the page already open: `aria-current=\"page\"` and a check mark. */\n current?: boolean;\n disabled?: boolean;\n }\n | { kind: \"divider\"; key: string };\n\n/**\n * The non-interactive identity block at the top of an account menu — kastlan's name +\n * role, keksdose's display name + email + role chip. It is text, not a `menuitem`: the\n * arrow keys pass over it.\n */\nexport interface TopBarMenuHeader {\n /** The first line — the user's name. */\n title: ReactNode;\n /** The muted second line — an email, a role. */\n subtitle?: ReactNode;\n /**\n * Anything below — a role chip. A link or button here stays out of the arrow keys\n * and in the Tab order, like the footer's.\n *\n * Pass a function to get `close`, as `footer` does — keksdose F7: its admin role\n * chip links to the admin area, and a router link does not unmount the menu, so\n * without `close` the panel stayed open over the page it had just navigated to.\n */\n extra?: ReactNode | ((close: () => void) => ReactNode);\n}\n\n/** What a control is, as far as `HoverMenu` is concerned, when it lives in the header\n * or the footer: not a menu row. */\nconst SECTION_CONTROLS = \"a[href]:not([role]),button:not([role])\";\nconst TABBABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]';\n\n/**\n * A header or footer inside the menu panel.\n *\n * `HoverMenu` promotes EVERY role-less button and link in its panel to a `menuitem` out\n * of the Tab order, and turns every list into `role=\"none\"` — right for the rows, wrong\n * for a footer of legal links, which would join the arrow-key cycle and drop out of Tab.\n * So before it looks (a child's layout effect runs before its parent's), the controls\n * in here get their own role spelled out, which `HoverMenu` leaves alone, and any list\n * keeps its list semantics.\n */\nfunction MenuSection({ className, children }: { className: string; children: ReactNode }) {\n const ref = useRef<HTMLLIElement>(null);\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n for (const c of el.querySelectorAll<HTMLElement>(SECTION_CONTROLS)) {\n c.setAttribute(\"role\", c.tagName === \"A\" ? \"link\" : \"button\");\n }\n for (const l of el.querySelectorAll<HTMLElement>(\"ul:not([role]),ol:not([role])\")) l.setAttribute(\"role\", \"list\");\n for (const l of el.querySelectorAll<HTMLElement>(\"li:not([role])\")) l.setAttribute(\"role\", \"listitem\");\n });\n return (\n <li ref={ref} role=\"none\" className={className}>\n {children}\n </li>\n );\n}\n\n/**\n * `HoverMenu` closes on any Tab inside the panel — right when Tab leaves it, wrong when\n * Tab is on its way from a row to a footer link, or from one footer link to the next:\n * the panel would unmount under the focus. So a Tab whose next stop is still inside the\n * panel stops here and the browser moves focus; one that leaves reaches `HoverMenu`,\n * which closes.\n */\nfunction keepTabInsidePanel(e: ReactKeyboardEvent<HTMLUListElement>) {\n if (e.key !== \"Tab\") return;\n const from = e.target as HTMLElement;\n const stops = Array.from(e.currentTarget.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (el) => el.getAttribute(\"tabindex\") !== \"-1\",\n );\n const way = e.shiftKey ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING;\n if (stops.some((el) => el !== from && from.compareDocumentPosition(el) & way)) e.stopPropagation();\n}\n\n/**\n * A top-bar icon button that opens a {@link HoverMenu} of actions and/or links,\n * with an optional uppercase heading and divider rules. Generic glue over the\n * shared top-bar chrome — e.g. the feedback launcher or the guided-tours menu —\n * so those call sites describe their rows as data instead of rebuilding the\n * trigger + list markup. For a checkmarked value-switcher use\n * {@link OptionSwitcherMenu} instead.\n *\n * It is also the ACCOUNT menu kastlan and keksdose each hand-build on `HoverMenu`: a\n * custom `trigger` (the avatar), a `header` (name + role / email), the rows, and a\n * free-content `footer` (the legal links).\n */\nexport function TopBarActionMenu({\n icon,\n iconBadge,\n trigger,\n triggerClassName,\n ariaLabel,\n heading,\n header,\n entries,\n children,\n footer,\n footerLabel,\n align,\n panelClassName,\n}: {\n /** The trigger's face for the usual icon button. Ignored when `trigger` is given. */\n icon?: ReactNode;\n /**\n * A status dot in the top-end corner of `icon` — keksdose's unread-support dot on the\n * feedback trigger. Like `UserAvatar`'s `badge`, its `label` joins the trigger's name\n * (\"Send feedback 2 unread\"), so the dot is not something only the eye is told about.\n * Ignored with `trigger`: give the face its own badge there.\n */\n iconBadge?: UserAvatarBadge | null;\n /**\n * A face of your own for the trigger — the account menu's `UserAvatar`. It is drawn\n * INSIDE the kit's button, which keeps the wiring: `aria-haspopup`, `aria-expanded`,\n * the toggle, the keyboard. `open` is there for a chevron that turns.\n *\n * The button is named by `ariaLabel` followed by any readable text in the face — a\n * `UserAvatar` `badge` label reaches a screen reader that way (\"Account menu 3\n * unread\"), where an `aria-label` on the button would have hidden it. A\n * `UserAvatar`'s initials are `aria-hidden`, so the person's name is only in the\n * name if `ariaLabel` carries it (\"Marcel Eifert, account menu\").\n */\n trigger?: (state: { open: boolean }) => ReactNode;\n /** Extra classes for the trigger button — `rounded-full` round an avatar. */\n triggerClassName?: string;\n /** Names the trigger and the menu. */\n ariaLabel: string;\n heading?: string;\n /** A non-interactive identity block above the rows. */\n header?: TopBarMenuHeader;\n entries: TopBarMenuEntry[];\n /**\n * Rows the entry data cannot describe (a `Disclosure` sub-list, an app's own\n * section), after `entries`. Render `<li>`s holding `MenuItem`s or plain controls;\n * `close` shuts the menu.\n */\n children?: (close: () => void) => ReactNode;\n /**\n * Free content below the rows, behind a rule — the legal links. Its links and\n * buttons are NOT menu rows: the arrow keys skip them and Tab reaches them. Pass a\n * function to get `close` for the links' `onClick`.\n */\n footer?: ReactNode | ((close: () => void) => ReactNode);\n /** Wraps the footer in a `<nav>` with this name (\"Legal\"). Without it, a plain block. */\n footerLabel?: string;\n /** Which edge of the trigger the panel lines up with (see `HoverMenu`). Default `end`. */\n align?: \"start\" | \"end\" | \"left\" | \"right\";\n panelClassName?: string;\n}) {\n return (\n <HoverMenu\n ariaLabel={ariaLabel}\n align={align}\n trigger={({ open, toggle }) =>\n trigger ? (\n <button type=\"button\" onClick={toggle} className={cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName)}>\n <span className=\"sr-only\">{ariaLabel}</span>\n {/* The space keeps the name from running into the face's text (\"Account\n menu3 unread\"); as a flex item it takes no room. */}\n {\" \"}\n {trigger({ open })}\n </button>\n ) : iconBadge ? (\n // Named by its content, like the custom-trigger branch, so the badge label is\n // part of the name; an `aria-label` would have hidden it.\n <button type=\"button\" onClick={toggle} className={cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName)}>\n <span className=\"sr-only\">{ariaLabel}</span>{\" \"}\n <span aria-hidden className=\"relative inline-flex\">\n {icon}\n <StatusDot ring tone={iconBadge.tone ?? \"danger\"} className=\"absolute -end-0.5 -top-0.5\" />\n </span>{\" \"}\n <span className=\"sr-only\">{iconBadge.label}</span>\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={toggle}\n aria-label={ariaLabel}\n className={cn(TOPBAR_TRIGGER_CLASS, triggerClassName)}\n >\n {icon}\n </button>\n )\n }\n >\n {(close) => {\n const footerBody = typeof footer === \"function\" ? footer(close) : footer;\n const headerExtra = typeof header?.extra === \"function\" ? header.extra(close) : header?.extra;\n const footerClass =\n \"flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--text-muted)] [&_a:hover]:text-[var(--text-primary)] [&_a]:rounded-sm [&_a:focus-visible]:outline-none [&_a:focus-visible]:ring-2 [&_a:focus-visible]:ring-[var(--brand)]\";\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a Tab bubbling up from a row or footer link, see keepTabInsidePanel\n <ul className={cn(\"py-1\", panelClassName)} onKeyDown={keepTabInsidePanel}>\n {header && (\n <MenuSection className=\"mb-1 border-b border-[var(--border)] px-3 py-2\">\n <div className=\"truncate text-sm font-medium text-[var(--text-primary)]\">{header.title}</div>\n {header.subtitle != null && (\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{header.subtitle}</div>\n )}\n {headerExtra != null && headerExtra !== false && <div className=\"mt-1\">{headerExtra}</div>}\n </MenuSection>\n )}\n {heading && (\n <li className=\"px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]\">\n {heading}\n </li>\n )}\n {entries.map((entry) => {\n if (entry.kind === \"divider\") {\n return <li key={entry.key} className=\"my-1 border-t border-[var(--border)]\" />;\n }\n return (\n <li key={entry.key}>\n {entry.kind === \"link\" ? (\n <MenuItem\n href={entry.to}\n renderLink={({ href, ...p }) => <Link to={href} {...p} />}\n onClick={close}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n current={entry.current}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n ) : (\n <MenuItem\n onClick={() => {\n entry.onSelect();\n close();\n }}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n checked={entry.checked}\n checkable={entry.checkable}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n )}\n </li>\n );\n })}\n {children?.(close)}\n {footerBody != null && footerBody !== false && (\n <MenuSection className=\"mt-1 border-t border-[var(--border)] px-3 py-2\">\n {footerLabel ? (\n <nav aria-label={footerLabel} className={footerClass}>\n {footerBody}\n </nav>\n ) : (\n <div className={footerClass}>{footerBody}</div>\n )}\n </MenuSection>\n )}\n </ul>\n );\n }}\n </HoverMenu>\n );\n}\n"],"mappings":";AAkGI,cAuGM,YAvGN;AAlGJ,SAAS,iBAAiB,cAAc;AAExC,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAE1B,SAAS,4BAA4B;AAgErC,MAAM,mBAAmB;AACzB,MAAM,WAAW;AA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C,QAAmB,WAAU,0CAArB,MAAM,GAAsD;AAAA,cAC9E;AACA,qBACE,oBAAC,QACE,gBAAM,SAAS,SACd;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,MAAM;AAAA,kBACZ,YAAY,CAAC,EAAE,MAAM,GAAG,EAAE,MAAM,oBAAC,QAAK,IAAI,MAAO,GAAG,GAAG;AAAA,kBACvD,SAAS;AAAA,kBACT,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAChB,MAAM,MAAM;AAAA,kBACZ,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAEf,gBAAM;AAAA;AAAA,cACT,IAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,SAAS,MAAM;AACb,0BAAM,SAAS;AACf,0BAAM;AAAA,kBACR;AAAA,kBACA,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAChB,MAAM,MAAM;AAAA,kBACZ,SAAS,MAAM;AAAA,kBACf,WAAW,MAAM;AAAA,kBACjB,UAAU,MAAM;AAAA,kBAEf,gBAAM;AAAA;AAAA,cACT,KA5BK,MAAM,GA8Bf;AAAA,YAEJ,CAAC;AAAA,YACA,WAAW,KAAK;AAAA,YAChB,cAAc,QAAQ,eAAe,SACpC,oBAAC,eAAY,WAAU,kDACpB,wBACC,oBAAC,SAAI,cAAY,aAAa,WAAW,aACtC,sBACH,IAEA,oBAAC,SAAI,WAAW,aAAc,sBAAW,GAE7C;AAAA,aAEJ;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":[]}
package/dist/shell.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export { LanguageMenu, LanguageOption, PaletteMenu, TOPBAR_MENU_ITEM_CLASS, TOPBAR_TRIGGER_CLASS, ThemeToggle } from './shell/topbar-controls.js';
2
2
  export { TopBar, TopBarProps } from './shell/top-bar.js';
3
- export { AppShell, AppShellNavItem, AppShellProps, AppShellSubItem } from './shell/app-shell.js';
3
+ export { AppShell, AppShellNavItem, AppShellProps, AppShellSidebarFooterItem, AppShellSubItem } from './shell/app-shell.js';
4
4
  export { OptionSwitcherMenu, OptionSwitcherOption } from './shell/option-switcher-menu.js';
5
5
  export { RoleSwitcher, RoleSwitcherProps } from './shell/role-switcher.js';
6
6
  export { TopBarActionMenu, TopBarMenuEntry, TopBarMenuHeader } from './shell/topbar-action-menu.js';
7
+ export { TopBarBrand, TopBarBrandProps } from './shell/top-bar-brand.js';
8
+ export { AuthLayout, AuthLayoutProps } from './shell/auth-layout.js';
7
9
  import 'react';
8
10
  import './theme/palette-presets.js';
9
11
  import './theme/chart-palette.js';
@@ -11,4 +13,57 @@ import './theme/theme-store.js';
11
13
  import 'zustand/middleware';
12
14
  import 'zustand';
13
15
  import 'lucide-react';
16
+ import './kit-labels-Mz8zZHIF.js';
17
+ import './components/data-table-labels.js';
18
+ import './components/mini-calendar.js';
19
+ import './components/calendar-heatmap.js';
20
+ import './components/popover.js';
21
+ import './components/chip.js';
22
+ import './components/field-sync.js';
23
+ import './components/tooltip.js';
24
+ import './hooks/use-anchored-rect.js';
25
+ import './lib/clipping.js';
26
+ import './wizard/types.js';
27
+ import './tour/tour.js';
28
+ import './search/command-palette.js';
29
+ import './search/global-search.js';
30
+ import './search/search-index.js';
31
+ import './components/month-picker.js';
32
+ import './components/page-contents.js';
33
+ import './components/series-chart-labels.js';
34
+ import './components/pie-chart-labels.js';
35
+ import './components/sparkline.js';
36
+ import './components/stat-tile.js';
37
+ import './components/signature-pad.js';
38
+ import './components/password-strength.js';
39
+ import './components/danger-confirm.js';
40
+ import './components/swatch-picker.js';
41
+ import './components/tile-radio.js';
42
+ import './components/icon-picker.js';
43
+ import './components/dialog-frame.js';
44
+ import './components/modal.js';
45
+ import './hooks/use-search-param-state.js';
46
+ import './components/measured-grid.js';
47
+ import './feedback/feedback-attachment.js';
48
+ import './feedback/feedback-dialog.js';
49
+ import './feedback/feedback-thread.js';
50
+ import './feedback/feedback-inbox.js';
51
+ import './components/account-settings-labels.js';
52
+ import './components/confirm-dialog.js';
53
+ import './components/floating-panel.js';
54
+ import './components/bulk-action-bar.js';
55
+ import './components/list.js';
56
+ import './components/breadcrumbs.js';
57
+ import './components/toast.js';
58
+ import './components/description-list.js';
59
+ import './components/line-items.js';
60
+ import './components/progress-bar.js';
61
+ import './components/signed-amount.js';
62
+ import './components/error-boundary.js';
63
+ import './components/authed-image.js';
64
+ import './hooks/use-authed-src.js';
65
+ import './components/image-grid.js';
66
+ import './components/lightbox.js';
14
67
  import './components/menu-item.js';
68
+ import './components/user-avatar.js';
69
+ import './components/status-dot.js';
package/dist/shell.js CHANGED
@@ -5,4 +5,6 @@ export * from "./shell/app-shell.js";
5
5
  export * from "./shell/option-switcher-menu.js";
6
6
  export * from "./shell/role-switcher.js";
7
7
  export * from "./shell/topbar-action-menu.js";
8
+ export * from "./shell/top-bar-brand.js";
9
+ export * from "./shell/auth-layout.js";
8
10
  //# sourceMappingURL=shell.js.map
package/dist/shell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shell.ts"],"sourcesContent":["// `@eifi1/ui-kit/shell` — the composable app chrome.\n//\n// A re-slicing of the main barrel, not a new API. This entry point requires\n// `react-router`: AppShell renders NavLink and TopBarActionMenu renders Link.\nexport * from \"./shell/topbar-controls\";\nexport * from \"./shell/top-bar\";\nexport * from \"./shell/app-shell\";\nexport * from \"./shell/option-switcher-menu\";\nexport * from \"./shell/role-switcher\";\nexport * from \"./shell/topbar-action-menu\";\n"],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/shell.ts"],"sourcesContent":["// `@eifi1/ui-kit/shell` — the composable app chrome.\n//\n// A re-slicing of the main barrel, not a new API. This entry point requires\n// `react-router`: AppShell renders NavLink and TopBarActionMenu renders Link.\nexport * from \"./shell/topbar-controls\";\nexport * from \"./shell/top-bar\";\nexport * from \"./shell/app-shell\";\nexport * from \"./shell/option-switcher-menu\";\nexport * from \"./shell/role-switcher\";\nexport * from \"./shell/topbar-action-menu\";\nexport * from \"./shell/top-bar-brand\";\nexport * from \"./shell/auth-layout\";\n"],"mappings":";AAIA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
package/dist/tour/tour.js CHANGED
@@ -42,9 +42,11 @@ function TourProvider({
42
42
  const [activeId, setActiveId] = useState(null);
43
43
  const optsRef = useRef({});
44
44
  const stepsRef = useRef(null);
45
- stepsRef.current = steps;
46
45
  const indexRef = useRef(0);
47
- indexRef.current = index;
46
+ useLayoutEffect(() => {
47
+ stepsRef.current = steps;
48
+ indexRef.current = index;
49
+ }, [steps, index]);
48
50
  const active = !!steps && steps.length > 0;
49
51
  const total = steps?.length ?? 0;
50
52
  const start = useCallback((s, opts) => {
@@ -128,13 +130,17 @@ function TourOverlay({
128
130
  const isLast = index === steps.length - 1;
129
131
  const [rect, setRect] = useState(null);
130
132
  const [ready, setReady] = useState(false);
133
+ const [locating, setLocating] = useState({ index, step });
134
+ if (locating.index !== index || locating.step !== step) {
135
+ setLocating({ index, step });
136
+ setReady(false);
137
+ setRect(null);
138
+ }
131
139
  const [dir, setDir] = useState(() => dirOf(null));
132
140
  const rootRef = useRef(null);
133
141
  useEffect(() => {
134
142
  let cancelled = false;
135
143
  let raf = 0;
136
- setReady(false);
137
- setRect(null);
138
144
  void (async () => {
139
145
  await step.beforeStep?.();
140
146
  if (cancelled) return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/tour/tour.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { Button } from \"../components/ui\";\nimport { useFocusTrap } from \"../hooks/use-focus-trap\";\nimport { dirOf, horizontalStep } from \"../lib/direction\";\nimport type { Direction } from \"../lib/direction\";\n\n/**\n * `start`/`end` follow the reading direction (`end` is the right side in LTR and the\n * left side in RTL) and are what a translated app wants. `left`/`right` stay physical\n * for the steps that genuinely mean a screen side.\n */\nexport type TourPlacement = \"top\" | \"right\" | \"bottom\" | \"left\" | \"start\" | \"end\" | \"center\";\n\nexport interface TourStep {\n /** CSS selector for the element to spotlight. Omit for a centered step\n * (welcome/finish). If the target isn't found/visible, the step centers. */\n target?: string;\n title: string;\n body: ReactNode;\n /** Extra footer content, e.g. a \"load sample data\" shortcut. */\n action?: ReactNode;\n /** Spotlight padding around the target, px (default 8). */\n padding?: number;\n /** Where the card sits relative to the target. Omit for auto placement\n * (below → above → centered). \"center\" ignores the target and centers on\n * screen. \"start\"/\"end\" are the logical sides and flip in RTL; \"left\"/\"right\"\n * are physical. An explicit side flips to the opposite side if it would\n * overflow, then clamps into the viewport. */\n placement?: TourPlacement;\n /** Advance only when the user clicks the spotlighted target itself (not the\n * card's Next button). Requires `target`: the real control's own handler runs\n * first, then the tour steps forward on a microtask. The spotlight hole stays\n * click-through to the target; the rest of the page does not. */\n awaitClick?: boolean;\n /** Runs before the step is shown — e.g. navigate to a route, open a panel.\n * May be async; the step waits for it, then locates the target. */\n beforeStep?: () => void | Promise<void>;\n}\n\nexport interface TourLabels {\n next: string;\n back: string;\n skip: string;\n done: string;\n /** Shown in place of the Next button on an `awaitClick` step. */\n awaitClickHint: string;\n /** Step counter, e.g. (2, 7) => \"2 / 7\". */\n step: (current: number, total: number) => string;\n}\n\nexport const DEFAULT_TOUR_LABELS: TourLabels = {\n next: \"Next\",\n back: \"Back\",\n skip: \"Skip\",\n done: \"Done\",\n awaitClickHint: \"Click the highlighted element to continue\",\n step: (c, t) => `${c} / ${t}`,\n};\n\ninterface StartOptions {\n /** Stable id of the tour, surfaced as `activeId` so the app can mirror it to\n * the URL (deep-link / evaluation tracking) and record completion. */\n id?: string;\n /** Start at this step index instead of 0 (clamped) — for URL/deep-link resume. */\n startIndex?: number;\n /** Fires synchronously when the tour starts (e.g. enable a mock interceptor). */\n onStart?: () => void;\n onFinish?: () => void;\n onSkip?: () => void;\n}\n\ninterface TourContextValue {\n active: boolean;\n /** Id of the running tour (from {@link StartOptions.id}), else null. */\n activeId: string | null;\n /** Start a tour with the given steps. */\n start: (steps: TourStep[], opts?: StartOptions) => void;\n /** End the current tour (no callbacks fire). */\n stop: () => void;\n /** Advance one step; past the last step it finishes the tour (fires onFinish). */\n next: () => void;\n /** Go back one step (no-op on the first). */\n prev: () => void;\n /** Jump to a step by index, clamped to range — e.g. for URL/deep-link resume. */\n goToStep: (index: number) => void;\n /** Current step (0-based; 0 while inactive). */\n index: number;\n /** Total steps (0 while inactive). */\n total: number;\n}\n\nconst TourContext = createContext<TourContextValue | null>(null);\n\nexport function useTour(): TourContextValue {\n const ctx = useContext(TourContext);\n if (!ctx) throw new Error(\"useTour must be used within <TourProvider>\");\n return ctx;\n}\n\n/**\n * The tour engine if it is there, `null` if it is not — for a control that is a\n * DECORATION rather than a participant.\n *\n * {@link useTour}'s throw is correct and stays: a component that runs a tour cannot do\n * its job without the provider, and failing loudly is how that gets fixed. But the\n * throw's blast radius is whatever error boundary is above it, and for a launcher in\n * the app shell that is the whole app.\n *\n * Keksdose feedback dev#524 is what that costs: an `@hb/ui` module was edited while a\n * dev server was running, vite re-evaluated it, and the module's freshly created\n * context object was no longer the one the mounted provider was providing. React's\n * `useContext` then answers `null` for a provider that is, structurally, right there —\n * and the top bar's tour menu took the entire shell down with it. **Build-time module\n * graphs cannot produce that**, so it is a development-only failure; a menu that\n * disappears for a second is the proportionate response to it either way.\n *\n * Only for controls that can honestly render nothing. If a component would show a\n * broken half of itself without the tour, it wants {@link useTour}.\n */\nexport function useTourOptional(): TourContextValue | null {\n return useContext(TourContext);\n}\n\n/**\n * Provides the guided-tour engine: a dimmed spotlight overlay + step card driven\n * by a list of {@link TourStep}s. Domain-free — the app supplies the steps (copy,\n * selectors, per-step navigation, placement) and the translated {@link TourLabels}.\n * Mount once inside the router; start a tour from anywhere via {@link useTour},\n * which also exposes step control (`next`/`prev`/`goToStep`) and the current\n * `index`/`total` for URL mirroring, `awaitClick` and deep-link resume.\n */\nexport function TourProvider({\n children,\n labels,\n}: {\n children: ReactNode;\n labels?: Partial<TourLabels>;\n}) {\n // `labels` over the provider's `tour` over English. Resolved once here and handed\n // down: the step card is portalled, but context crosses portals anyway — this is\n // simply the one place that already owned the merge.\n const merged = useKitLabels(\"tour\", DEFAULT_TOUR_LABELS, labels);\n const [steps, setSteps] = useState<TourStep[] | null>(null);\n const [index, setIndex] = useState(0);\n const [activeId, setActiveId] = useState<string | null>(null);\n const optsRef = useRef<StartOptions>({});\n // Live mirrors so the step-control callbacks can stay stable (identity-safe for\n // consumers) while still reading the current steps/index.\n const stepsRef = useRef<TourStep[] | null>(null);\n stepsRef.current = steps;\n const indexRef = useRef(0);\n indexRef.current = index;\n const active = !!steps && steps.length > 0;\n const total = steps?.length ?? 0;\n\n const start = useCallback((s: TourStep[], opts?: StartOptions) => {\n optsRef.current = opts ?? {};\n optsRef.current.onStart?.();\n setIndex(Math.min(Math.max(0, opts?.startIndex ?? 0), Math.max(0, s.length - 1)));\n setActiveId(opts?.id ?? null);\n setSteps(s);\n }, []);\n const stop = useCallback(() => {\n setSteps(null);\n setActiveId(null);\n }, []);\n const finish = useCallback(() => {\n optsRef.current.onFinish?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n const skip = useCallback(() => {\n optsRef.current.onSkip?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n\n const goToStep = useCallback((i: number) => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n setIndex(Math.min(Math.max(0, i), len - 1));\n }, []);\n const next = useCallback(() => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n if (indexRef.current >= len - 1) finish();\n else setIndex(indexRef.current + 1);\n }, [finish]);\n const prev = useCallback(() => {\n if (indexRef.current > 0) setIndex(indexRef.current - 1);\n }, []);\n\n return (\n <TourContext.Provider value={{ active, activeId, start, stop, next, prev, goToStep, index, total }}>\n {children}\n {active && (\n <TourOverlay\n steps={steps!}\n index={index}\n labels={merged}\n onNext={next}\n onPrev={prev}\n onSkip={skip}\n />\n )}\n </TourContext.Provider>\n );\n}\n\ninterface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nfunction isVisible(el: Element): boolean {\n // A non-zero box already rules out display:none on the element or any ancestor\n // (an unrendered element measures 0x0). We deliberately do NOT test\n // offsetParent: it is null for position:fixed elements even when fully visible,\n // which made the mobile bottom-nav bar (fixed) un-highlightable on mobile\n // (feedback #313). visibility:hidden keeps a box, so check it explicitly.\n const r = el.getBoundingClientRect();\n if (r.width <= 0 || r.height <= 0) return false;\n const style = getComputedStyle(el);\n return style.visibility !== \"hidden\" && style.display !== \"none\";\n}\n\n// The first VISIBLE element matching the selector, not merely the first in DOM\n// order. This lets a step target the same control across layouts with one\n// combined selector — e.g. the desktop sidebar link AND the mobile bottom-bar\n// link — where the off-layout copy is present but `display:none` (feedback\n// #313). Returns null while none is visible so the finder keeps retrying.\nfunction queryVisibleTarget(selector: string): Element | null {\n const els = document.querySelectorAll(selector);\n for (const el of els) {\n if (isVisible(el)) return el;\n }\n return null;\n}\n\nfunction sameRect(a: Rect | null, b: Rect | null): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;\n}\n\nfunction TourOverlay({\n steps,\n index,\n labels,\n onNext,\n onPrev,\n onSkip,\n}: {\n steps: TourStep[];\n index: number;\n labels: TourLabels;\n onNext: () => void;\n onPrev: () => void;\n onSkip: () => void;\n}) {\n const step = steps[index];\n const isFirst = index === 0;\n const isLast = index === steps.length - 1;\n const [rect, setRect] = useState<Rect | null>(null);\n const [ready, setReady] = useState(false);\n // The overlay is portalled to <body>, out of whatever `dir` subtree the app set, so it\n // takes the direction of the element it spotlights (the document's for a centered\n // step). Arrow keys and start/end placement read it.\n const [dir, setDir] = useState<Direction>(() => dirOf(null));\n const rootRef = useRef<HTMLDivElement>(null);\n\n // Run beforeStep, then locate the target (retrying across route/render lag).\n useEffect(() => {\n let cancelled = false;\n let raf = 0;\n setReady(false);\n setRect(null);\n void (async () => {\n await step.beforeStep?.();\n if (cancelled) return;\n if (!step.target) {\n setDir(dirOf(null));\n setReady(true);\n return;\n }\n let tries = 0;\n const find = () => {\n if (cancelled) return;\n const el = queryVisibleTarget(step.target!);\n if (el) {\n el.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n const r = el.getBoundingClientRect();\n setRect({ top: r.top, left: r.left, width: r.width, height: r.height });\n setDir(dirOf(el));\n setReady(true);\n return;\n }\n if (tries++ < 45) raf = requestAnimationFrame(find);\n else {\n setDir(dirOf(null));\n setReady(true); // give up → render centered\n }\n };\n find();\n })();\n return () => {\n cancelled = true;\n cancelAnimationFrame(raf);\n };\n }, [index, step]);\n\n // Follow the target as the page scrolls / reflows.\n useEffect(() => {\n if (!step.target) return;\n const update = () => {\n const el = queryVisibleTarget(step.target!);\n if (el) {\n const r = el.getBoundingClientRect();\n const next = { top: r.top, left: r.left, width: r.width, height: r.height };\n setRect((prev) => (sameRect(prev, next) ? prev : next));\n }\n };\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n const id = window.setInterval(update, 250);\n return () => {\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n clearInterval(id);\n };\n }, [index, step]);\n\n // awaitClick: advance when the *real* target is clicked. The spotlight hole is\n // click-through (see the shields in the render below) so the element's own\n // handler runs first; we step forward on the next macrotask.\n useEffect(() => {\n if (!ready || !step.awaitClick || !step.target) return;\n const el = queryVisibleTarget(step.target);\n if (!el) return;\n const onClick = () => window.setTimeout(() => onNext(), 0);\n el.addEventListener(\"click\", onClick, { once: true });\n return () => el.removeEventListener(\"click\", onClick);\n }, [ready, index, step, onNext]);\n\n // Keyboard: Esc skips, Enter and the reading-direction arrow advance (→ in LTR,\n // ← in RTL), the other arrow goes back. On awaitClick steps Enter is ignored (it\n // would fire the target's click AND advance) — the forward arrow stays as an escape\n // hatch.\n //\n // Enter on a focused control belongs to that control. This used to advance from\n // anywhere, so Enter on a focused Skip or Back ran the button's own click AND stepped\n // forward: Back moved nowhere, Skip skipped and then called `next` on a dead tour.\n // The same goes for arrows in a text field a step's `action` might contain.\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n onSkip();\n return;\n }\n if (e.key === \"Enter\") {\n if (step.awaitClick || ownsKey(e.target, \"Enter\")) return;\n e.preventDefault();\n onNext();\n return;\n }\n if (ownsKey(e.target, e.key)) return;\n // The overlay root carries `dir`; before it paints, the document's answers.\n const delta = horizontalStep(e.key, rootRef.current);\n if (delta === 1) {\n e.preventDefault();\n onNext();\n } else if (delta === -1) {\n if (!isFirst) onPrev();\n }\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [isFirst, step, onNext, onPrev, onSkip]);\n\n if (!ready) return null;\n\n const pad = step.padding ?? 8;\n const spot: Rect | null = rect\n ? { top: rect.top - pad, left: rect.left - pad, width: rect.width + pad * 2, height: rect.height + pad * 2 }\n : null;\n\n // `aria-modal` promises the page behind is out of reach, and the card's focus trap\n // keeps that promise for the keyboard. The pointer used to get no such treatment: the\n // root is `pointer-events-none` so that the spotlight hole can stay live for\n // `awaitClick`, and the scrim is a box-shadow, which takes no clicks — so every\n // control on the dimmed page stayed clickable. Four shields now tile the viewport\n // around the hole: the page is blocked, the card and the spotlighted target are not.\n // Keeping `aria-modal` (rather than dropping it) is the coherent half: the tour\n // really is modal — focus is trapped and Esc/Skip is the way out.\n return createPortal(\n <div\n ref={rootRef}\n className=\"pointer-events-none fixed inset-0 z-[60]\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.title}\n dir={dir}\n >\n {spot && <SpotlightShields spot={spot} />}\n {spot ? (\n <div\n className=\"pointer-events-none fixed rounded-lg transition-all duration-200 ease-out\"\n style={{\n top: spot.top,\n left: spot.left,\n width: spot.width,\n height: spot.height,\n // A two-tone frame, not a single translucent ring.\n //\n // The old treatment was `ring-2 ring-white/80` over a 55% scrim, and it\n // \"was barely visible\" on the app's blue-tinted surfaces. Two reasons,\n // and a single ring can't fix either: at 55% the surround stays bright\n // enough that the un-dimmed hole barely reads AS a hole, and a 80%-white\n // ring sitting on the edge of a light card is white-on-near-white.\n //\n // So: an opaque white band immediately around the target, a dark keyline\n // outside it, then the scrim. Whatever the target's own colour is, one of\n // the two bands is always in contrast with it and the other is always in\n // contrast with the dimmed surround — there is no background that can\n // swallow both. The blurred layer between them softens the step so the\n // frame reads as lighting rather than as a pasted-on rectangle.\n boxShadow: [\n \"0 0 0 3px rgba(255,255,255,0.98)\",\n \"0 0 0 5px rgba(15,23,42,0.92)\",\n \"0 0 18px 6px rgba(15,23,42,0.45)\",\n \"0 0 0 9999px rgba(15,23,42,0.70)\",\n ].join(\", \"),\n }}\n />\n ) : (\n <div className=\"pointer-events-auto fixed inset-0 bg-black/70\" />\n )}\n <TourCard\n step={step}\n index={index}\n total={steps.length}\n labels={labels}\n isFirst={isFirst}\n isLast={isLast}\n rect={spot}\n dir={dir}\n onBack={onPrev}\n onNext={onNext}\n onSkip={onSkip}\n />\n </div>,\n document.body,\n );\n}\n\n/** Does the focused element handle `key` itself? Enter on a button or link, and any\n * editing key in a text field or select, is the control's — not the tour's. */\nfunction ownsKey(target: EventTarget | null, key: string): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n if (tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (tag === \"INPUT\") {\n const type = (target as HTMLInputElement).type;\n // Enter on a checkbox does nothing natively, but ←/→ on a radio moves it.\n return key !== \"Enter\" || type !== \"checkbox\";\n }\n if (key !== \"Enter\") return false;\n return (\n tag === \"BUTTON\" ||\n (tag === \"A\" && target.hasAttribute(\"href\")) ||\n target.getAttribute(\"role\") === \"button\" ||\n target.getAttribute(\"role\") === \"link\"\n );\n}\n\n/**\n * Transparent pointer blockers tiling the viewport around the spotlight hole: one\n * full-width band above and below, one on each side at the hole's own height. The hole\n * itself stays uncovered, so the target keeps its clicks.\n */\nfunction SpotlightShields({ spot }: { spot: Rect }) {\n const shield = \"pointer-events-auto fixed\";\n const bottom = spot.top + spot.height;\n return (\n <>\n <div data-tour-shield=\"\" className={shield} style={{ top: 0, left: 0, right: 0, height: Math.max(0, spot.top) }} />\n <div data-tour-shield=\"\" className={shield} style={{ top: bottom, left: 0, right: 0, bottom: 0 }} />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: 0, width: Math.max(0, spot.left), height: spot.height }}\n />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: spot.left + spot.width, right: 0, height: spot.height }}\n />\n </>\n );\n}\n\n/**\n * Card position (viewport px) for the given placement relative to the padded\n * spotlight `rect`. Omitted placement keeps the original auto behavior\n * (below → above → vertically centered); an explicit side flips to its opposite\n * if it would overflow, then clamps into the viewport. \"center\" (or no rect)\n * centers on screen.\n */\nfunction placeCard(\n rect: Rect | null,\n cw: number,\n ch: number,\n vw: number,\n vh: number,\n m: number,\n placement?: TourPlacement,\n dir: Direction = \"ltr\",\n): { top: number; left: number } {\n // The logical sides resolve to a physical one here, and only here.\n if (placement === \"start\") placement = dir === \"rtl\" ? \"right\" : \"left\";\n else if (placement === \"end\") placement = dir === \"rtl\" ? \"left\" : \"right\";\n if (!rect || placement === \"center\") {\n return { top: Math.max(m, (vh - ch) / 2), left: Math.max(m, (vw - cw) / 2) };\n }\n const clampX = (x: number) => Math.min(Math.max(m, x), Math.max(m, vw - cw - m));\n const clampY = (y: number) => Math.min(Math.max(m, y), Math.max(m, vh - ch - m));\n const centerX = clampX(rect.left + rect.width / 2 - cw / 2);\n const centerY = clampY(rect.top + rect.height / 2 - ch / 2);\n const belowTop = rect.top + rect.height + m;\n const aboveTop = rect.top - ch - m;\n const rightLeft = rect.left + rect.width + m;\n const leftLeft = rect.left - cw - m;\n const fitsBelow = belowTop + ch <= vh;\n const fitsAbove = aboveTop >= 0;\n const fitsRight = rightLeft + cw <= vw;\n const fitsLeft = leftLeft >= 0;\n\n switch (placement) {\n case \"top\":\n return { top: fitsAbove ? aboveTop : fitsBelow ? belowTop : clampY(aboveTop), left: centerX };\n case \"bottom\":\n return { top: fitsBelow ? belowTop : fitsAbove ? aboveTop : clampY(belowTop), left: centerX };\n case \"right\":\n return { top: centerY, left: fitsRight ? rightLeft : fitsLeft ? leftLeft : clampX(rightLeft) };\n case \"left\":\n return { top: centerY, left: fitsLeft ? leftLeft : fitsRight ? rightLeft : clampX(leftLeft) };\n default:\n if (fitsBelow) return { top: belowTop, left: centerX };\n if (fitsAbove) return { top: aboveTop, left: centerX };\n return { top: Math.max(m, (vh - ch) / 2), left: centerX };\n }\n}\n\nfunction TourCard({\n step,\n index,\n total,\n labels,\n isFirst,\n isLast,\n rect,\n dir,\n onBack,\n onNext,\n onSkip,\n}: {\n step: TourStep;\n index: number;\n total: number;\n labels: TourLabels;\n isFirst: boolean;\n isLast: boolean;\n rect: Rect | null;\n dir: Direction;\n onBack: () => void;\n onNext: () => void;\n onSkip: () => void;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const [style, setStyle] = useState<CSSProperties>({ opacity: 0 });\n\n /**\n * The card holds the focus, because the card is what the tour IS.\n *\n * The overlay above declares `role=\"dialog\" aria-modal=\"true\"` — it always has — and\n * then left focus wherever the page had put it. For a tour that is the most pointed\n * version of the audit's *\"Only Modal manages focus\"*: the whole component exists to\n * say \"look here\", and for a keyboard user \"here\" is the focus ring. They were told\n * the page was hidden, given no way to reach the Next button without Tabbing through\n * it, and left on a control the screen reader would no longer describe.\n *\n * It re-engages on every step, without any bookkeeping here, because `TourOverlay`\n * returns null while it re-locates the next target: the card genuinely unmounts and\n * remounts between steps. That is what keeps focus honest when the BUTTONS change —\n * \"Back\" does not exist on the first step, so stepping back onto it destroys the\n * control the press came from, and focus would otherwise fall to `<body>`, outside\n * this trap's own listener, where Tab walks straight into the page the overlay claims\n * to have hidden.\n *\n * **The cost, written down:** on an `awaitClick` step the user is asked to click the\n * spotlighted element, and they can no longer Tab to it. ArrowRight still advances\n * (the key handler in `TourOverlay` is on the document and does not care where focus\n * is), which is the escape hatch that step already documents for the case where the\n * target cannot be found. Containment is worth that: an `awaitClick` step is a\n * minority of steps, while focus stranded behind `aria-modal` is every step.\n */\n useFocusTrap(ref, { active: true });\n\n useLayoutEffect(() => {\n const card = ref.current;\n if (!card) return;\n setStyle(\n placeCard(rect, card.offsetWidth, card.offsetHeight, window.innerWidth, window.innerHeight, 12, step.placement, dir),\n );\n }, [rect, index, step.placement, dir]);\n\n return (\n <div\n ref={ref}\n // Focusable but not tabbable: the trap above focuses the card itself rather than\n // its first button, so a screen reader reads the step's title and body before it\n // reads \"Next\" — and without this the container cannot take focus at all and the\n // trap silently does nothing.\n tabIndex={-1}\n style={style}\n className=\"pointer-events-auto fixed z-[61] w-80 max-w-[calc(100vw-1.5rem)] rounded-lg border border-[var(--border)] bg-[var(--bg-surface)] p-4 shadow-xl outline-none transition-all duration-200 ease-out\"\n >\n <div className=\"text-sm font-semibold text-[var(--text-primary)]\">{step.title}</div>\n <div className=\"mt-1 text-sm leading-relaxed text-[var(--text-secondary)]\">{step.body}</div>\n {step.action && <div className=\"mt-3\">{step.action}</div>}\n <div className=\"mt-4 space-y-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <button\n type=\"button\"\n onClick={onSkip}\n className=\"text-xs text-[var(--text-placeholder)] hover:text-[var(--text-secondary)]\"\n >\n {labels.skip}\n </button>\n <div className=\"flex items-center gap-2\">\n <span className=\"whitespace-nowrap text-xs tabular-nums text-[var(--text-placeholder)]\">\n {labels.step(index + 1, total)}\n </span>\n {!isFirst && (\n <Button variant=\"secondary\" onClick={onBack} className=\"px-2.5 py-1 text-xs\">\n {labels.back}\n </Button>\n )}\n {/* On an awaitClick step the Next button is replaced by a hint on its\n own row below, so it doesn't cram the counter + buttons and wrap.\n Only when the target was actually FOUND, though — `rect` is null\n when the finder gave up, and the click listener early-returns on\n the same absence. Keyed on `step.target` alone this hid the only\n way forward on any step whose anchor happens not to be rendered\n for this user (a guest sees no \"add account\" button), leaving the\n undocumented ArrowRight key as the sole escape. */}\n {!(step.awaitClick && step.target && rect) && (\n <Button variant=\"brand\" onClick={onNext} className={cn(\"px-2.5 py-1 text-xs\")}>\n {isLast ? labels.done : labels.next}\n </Button>\n )}\n </div>\n </div>\n {step.awaitClick && step.target && rect && (\n <div className=\"text-center text-xs italic text-[var(--text-placeholder)]\">\n {labels.awaitClickHint}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AA6MI,SAsSA,UAnSI,KAHJ;AA7MJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,OAAO,sBAAsB;AA+C/B,MAAM,sBAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;AAC7B;AAkCA,MAAM,cAAc,cAAuC,IAAI;AAExD,SAAS,UAA4B;AAC1C,QAAM,MAAM,WAAW,WAAW;AAClC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAO;AACT;AAsBO,SAAS,kBAA2C;AACzD,SAAO,WAAW,WAAW;AAC/B;AAUO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AAID,QAAM,SAAS,aAAa,QAAQ,qBAAqB,MAAM;AAC/D,QAAM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AAI,WAAU,QAAQ,eAAK,QAAO;AAAA,QACnD,qBAAC,SAAI,WAAU,kBACb;AAAA,+BAAC,SAAI,WAAU,2CACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,WAAU;AAAA,gBAET,iBAAO;AAAA;AAAA,YACV;AAAA,YACA,qBAAC,SAAI,WAAU,2BACb;AAAA,kCAAC,UAAK,WAAU,yEACb,iBAAO,KAAK,QAAQ,GAAG,KAAK,GAC/B;AAAA,cACC,CAAC,WACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,QAAQ,WAAU,uBACpD,iBAAO,MACV;AAAA,cAUD,EAAE,KAAK,cAAc,KAAK,UAAU,SACnC,oBAAC,UAAO,SAAQ,SAAQ,SAAS,QAAQ,WAAW,GAAG,qBAAqB,GACzE,mBAAS,OAAO,OAAO,OAAO,MACjC;AAAA,eAEJ;AAAA,aACF;AAAA,UACC,KAAK,cAAc,KAAK,UAAU,QACjC,oBAAC,SAAI,WAAU,6DACZ,iBAAO,gBACV;AAAA,WAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/tour/tour.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { Button } from \"../components/ui\";\nimport { useFocusTrap } from \"../hooks/use-focus-trap\";\nimport { dirOf, horizontalStep } from \"../lib/direction\";\nimport type { Direction } from \"../lib/direction\";\n\n/**\n * `start`/`end` follow the reading direction (`end` is the right side in LTR and the\n * left side in RTL) and are what a translated app wants. `left`/`right` stay physical\n * for the steps that genuinely mean a screen side.\n */\nexport type TourPlacement = \"top\" | \"right\" | \"bottom\" | \"left\" | \"start\" | \"end\" | \"center\";\n\nexport interface TourStep {\n /** CSS selector for the element to spotlight. Omit for a centered step\n * (welcome/finish). If the target isn't found/visible, the step centers. */\n target?: string;\n title: string;\n body: ReactNode;\n /** Extra footer content, e.g. a \"load sample data\" shortcut. */\n action?: ReactNode;\n /** Spotlight padding around the target, px (default 8). */\n padding?: number;\n /** Where the card sits relative to the target. Omit for auto placement\n * (below → above → centered). \"center\" ignores the target and centers on\n * screen. \"start\"/\"end\" are the logical sides and flip in RTL; \"left\"/\"right\"\n * are physical. An explicit side flips to the opposite side if it would\n * overflow, then clamps into the viewport. */\n placement?: TourPlacement;\n /** Advance only when the user clicks the spotlighted target itself (not the\n * card's Next button). Requires `target`: the real control's own handler runs\n * first, then the tour steps forward on a microtask. The spotlight hole stays\n * click-through to the target; the rest of the page does not. */\n awaitClick?: boolean;\n /** Runs before the step is shown — e.g. navigate to a route, open a panel.\n * May be async; the step waits for it, then locates the target. */\n beforeStep?: () => void | Promise<void>;\n}\n\nexport interface TourLabels {\n next: string;\n back: string;\n skip: string;\n done: string;\n /** Shown in place of the Next button on an `awaitClick` step. */\n awaitClickHint: string;\n /** Step counter, e.g. (2, 7) => \"2 / 7\". */\n step: (current: number, total: number) => string;\n}\n\nexport const DEFAULT_TOUR_LABELS: TourLabels = {\n next: \"Next\",\n back: \"Back\",\n skip: \"Skip\",\n done: \"Done\",\n awaitClickHint: \"Click the highlighted element to continue\",\n step: (c, t) => `${c} / ${t}`,\n};\n\ninterface StartOptions {\n /** Stable id of the tour, surfaced as `activeId` so the app can mirror it to\n * the URL (deep-link / evaluation tracking) and record completion. */\n id?: string;\n /** Start at this step index instead of 0 (clamped) — for URL/deep-link resume. */\n startIndex?: number;\n /** Fires synchronously when the tour starts (e.g. enable a mock interceptor). */\n onStart?: () => void;\n onFinish?: () => void;\n onSkip?: () => void;\n}\n\ninterface TourContextValue {\n active: boolean;\n /** Id of the running tour (from {@link StartOptions.id}), else null. */\n activeId: string | null;\n /** Start a tour with the given steps. */\n start: (steps: TourStep[], opts?: StartOptions) => void;\n /** End the current tour (no callbacks fire). */\n stop: () => void;\n /** Advance one step; past the last step it finishes the tour (fires onFinish). */\n next: () => void;\n /** Go back one step (no-op on the first). */\n prev: () => void;\n /** Jump to a step by index, clamped to range — e.g. for URL/deep-link resume. */\n goToStep: (index: number) => void;\n /** Current step (0-based; 0 while inactive). */\n index: number;\n /** Total steps (0 while inactive). */\n total: number;\n}\n\nconst TourContext = createContext<TourContextValue | null>(null);\n\nexport function useTour(): TourContextValue {\n const ctx = useContext(TourContext);\n if (!ctx) throw new Error(\"useTour must be used within <TourProvider>\");\n return ctx;\n}\n\n/**\n * The tour engine if it is there, `null` if it is not — for a control that is a\n * DECORATION rather than a participant.\n *\n * {@link useTour}'s throw is correct and stays: a component that runs a tour cannot do\n * its job without the provider, and failing loudly is how that gets fixed. But the\n * throw's blast radius is whatever error boundary is above it, and for a launcher in\n * the app shell that is the whole app.\n *\n * Keksdose feedback dev#524 is what that costs: an `@hb/ui` module was edited while a\n * dev server was running, vite re-evaluated it, and the module's freshly created\n * context object was no longer the one the mounted provider was providing. React's\n * `useContext` then answers `null` for a provider that is, structurally, right there —\n * and the top bar's tour menu took the entire shell down with it. **Build-time module\n * graphs cannot produce that**, so it is a development-only failure; a menu that\n * disappears for a second is the proportionate response to it either way.\n *\n * Only for controls that can honestly render nothing. If a component would show a\n * broken half of itself without the tour, it wants {@link useTour}.\n */\nexport function useTourOptional(): TourContextValue | null {\n return useContext(TourContext);\n}\n\n/**\n * Provides the guided-tour engine: a dimmed spotlight overlay + step card driven\n * by a list of {@link TourStep}s. Domain-free — the app supplies the steps (copy,\n * selectors, per-step navigation, placement) and the translated {@link TourLabels}.\n * Mount once inside the router; start a tour from anywhere via {@link useTour},\n * which also exposes step control (`next`/`prev`/`goToStep`) and the current\n * `index`/`total` for URL mirroring, `awaitClick` and deep-link resume.\n */\nexport function TourProvider({\n children,\n labels,\n}: {\n children: ReactNode;\n labels?: Partial<TourLabels>;\n}) {\n // `labels` over the provider's `tour` over English. Resolved once here and handed\n // down: the step card is portalled, but context crosses portals anyway — this is\n // simply the one place that already owned the merge.\n const merged = useKitLabels(\"tour\", DEFAULT_TOUR_LABELS, labels);\n const [steps, setSteps] = useState<TourStep[] | null>(null);\n const [index, setIndex] = useState(0);\n const [activeId, setActiveId] = useState<string | null>(null);\n const optsRef = useRef<StartOptions>({});\n // Live mirrors so the step-control callbacks can stay stable (identity-safe for\n // consumers) while still reading the current steps/index. Synced in a layout\n // effect — after the commit, before paint and before any passive effect or event\n // can call them — rather than written during render.\n const stepsRef = useRef<TourStep[] | null>(null);\n const indexRef = useRef(0);\n useLayoutEffect(() => {\n stepsRef.current = steps;\n indexRef.current = index;\n }, [steps, index]);\n const active = !!steps && steps.length > 0;\n const total = steps?.length ?? 0;\n\n const start = useCallback((s: TourStep[], opts?: StartOptions) => {\n optsRef.current = opts ?? {};\n optsRef.current.onStart?.();\n setIndex(Math.min(Math.max(0, opts?.startIndex ?? 0), Math.max(0, s.length - 1)));\n setActiveId(opts?.id ?? null);\n setSteps(s);\n }, []);\n const stop = useCallback(() => {\n setSteps(null);\n setActiveId(null);\n }, []);\n const finish = useCallback(() => {\n optsRef.current.onFinish?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n const skip = useCallback(() => {\n optsRef.current.onSkip?.();\n setSteps(null);\n setActiveId(null);\n }, []);\n\n const goToStep = useCallback((i: number) => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n setIndex(Math.min(Math.max(0, i), len - 1));\n }, []);\n const next = useCallback(() => {\n const len = stepsRef.current?.length ?? 0;\n if (len === 0) return;\n if (indexRef.current >= len - 1) finish();\n else setIndex(indexRef.current + 1);\n }, [finish]);\n const prev = useCallback(() => {\n if (indexRef.current > 0) setIndex(indexRef.current - 1);\n }, []);\n\n return (\n <TourContext.Provider value={{ active, activeId, start, stop, next, prev, goToStep, index, total }}>\n {children}\n {active && (\n <TourOverlay\n steps={steps!}\n index={index}\n labels={merged}\n onNext={next}\n onPrev={prev}\n onSkip={skip}\n />\n )}\n </TourContext.Provider>\n );\n}\n\ninterface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nfunction isVisible(el: Element): boolean {\n // A non-zero box already rules out display:none on the element or any ancestor\n // (an unrendered element measures 0x0). We deliberately do NOT test\n // offsetParent: it is null for position:fixed elements even when fully visible,\n // which made the mobile bottom-nav bar (fixed) un-highlightable on mobile\n // (feedback #313). visibility:hidden keeps a box, so check it explicitly.\n const r = el.getBoundingClientRect();\n if (r.width <= 0 || r.height <= 0) return false;\n const style = getComputedStyle(el);\n return style.visibility !== \"hidden\" && style.display !== \"none\";\n}\n\n// The first VISIBLE element matching the selector, not merely the first in DOM\n// order. This lets a step target the same control across layouts with one\n// combined selector — e.g. the desktop sidebar link AND the mobile bottom-bar\n// link — where the off-layout copy is present but `display:none` (feedback\n// #313). Returns null while none is visible so the finder keeps retrying.\nfunction queryVisibleTarget(selector: string): Element | null {\n const els = document.querySelectorAll(selector);\n for (const el of els) {\n if (isVisible(el)) return el;\n }\n return null;\n}\n\nfunction sameRect(a: Rect | null, b: Rect | null): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;\n}\n\nfunction TourOverlay({\n steps,\n index,\n labels,\n onNext,\n onPrev,\n onSkip,\n}: {\n steps: TourStep[];\n index: number;\n labels: TourLabels;\n onNext: () => void;\n onPrev: () => void;\n onSkip: () => void;\n}) {\n const step = steps[index];\n const isFirst = index === 0;\n const isLast = index === steps.length - 1;\n const [rect, setRect] = useState<Rect | null>(null);\n const [ready, setReady] = useState(false);\n // A new step starts unlocated: reset during render when the step changes, so the\n // previous step's spotlight never paints over the new one. The effect below then\n // locates it.\n const [locating, setLocating] = useState({ index, step });\n if (locating.index !== index || locating.step !== step) {\n setLocating({ index, step });\n setReady(false);\n setRect(null);\n }\n // The overlay is portalled to <body>, out of whatever `dir` subtree the app set, so it\n // takes the direction of the element it spotlights (the document's for a centered\n // step). Arrow keys and start/end placement read it.\n const [dir, setDir] = useState<Direction>(() => dirOf(null));\n const rootRef = useRef<HTMLDivElement>(null);\n\n // Run beforeStep, then locate the target (retrying across route/render lag).\n useEffect(() => {\n let cancelled = false;\n let raf = 0;\n void (async () => {\n await step.beforeStep?.();\n if (cancelled) return;\n if (!step.target) {\n setDir(dirOf(null));\n setReady(true);\n return;\n }\n let tries = 0;\n const find = () => {\n if (cancelled) return;\n const el = queryVisibleTarget(step.target!);\n if (el) {\n el.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n const r = el.getBoundingClientRect();\n setRect({ top: r.top, left: r.left, width: r.width, height: r.height });\n setDir(dirOf(el));\n setReady(true);\n return;\n }\n if (tries++ < 45) raf = requestAnimationFrame(find);\n else {\n setDir(dirOf(null));\n setReady(true); // give up → render centered\n }\n };\n find();\n })();\n return () => {\n cancelled = true;\n cancelAnimationFrame(raf);\n };\n }, [index, step]);\n\n // Follow the target as the page scrolls / reflows.\n useEffect(() => {\n if (!step.target) return;\n const update = () => {\n const el = queryVisibleTarget(step.target!);\n if (el) {\n const r = el.getBoundingClientRect();\n const next = { top: r.top, left: r.left, width: r.width, height: r.height };\n setRect((prev) => (sameRect(prev, next) ? prev : next));\n }\n };\n window.addEventListener(\"scroll\", update, true);\n window.addEventListener(\"resize\", update);\n const id = window.setInterval(update, 250);\n return () => {\n window.removeEventListener(\"scroll\", update, true);\n window.removeEventListener(\"resize\", update);\n clearInterval(id);\n };\n }, [index, step]);\n\n // awaitClick: advance when the *real* target is clicked. The spotlight hole is\n // click-through (see the shields in the render below) so the element's own\n // handler runs first; we step forward on the next macrotask.\n useEffect(() => {\n if (!ready || !step.awaitClick || !step.target) return;\n const el = queryVisibleTarget(step.target);\n if (!el) return;\n const onClick = () => window.setTimeout(() => onNext(), 0);\n el.addEventListener(\"click\", onClick, { once: true });\n return () => el.removeEventListener(\"click\", onClick);\n }, [ready, index, step, onNext]);\n\n // Keyboard: Esc skips, Enter and the reading-direction arrow advance (→ in LTR,\n // ← in RTL), the other arrow goes back. On awaitClick steps Enter is ignored (it\n // would fire the target's click AND advance) — the forward arrow stays as an escape\n // hatch.\n //\n // Enter on a focused control belongs to that control. This used to advance from\n // anywhere, so Enter on a focused Skip or Back ran the button's own click AND stepped\n // forward: Back moved nowhere, Skip skipped and then called `next` on a dead tour.\n // The same goes for arrows in a text field a step's `action` might contain.\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n onSkip();\n return;\n }\n if (e.key === \"Enter\") {\n if (step.awaitClick || ownsKey(e.target, \"Enter\")) return;\n e.preventDefault();\n onNext();\n return;\n }\n if (ownsKey(e.target, e.key)) return;\n // The overlay root carries `dir`; before it paints, the document's answers.\n const delta = horizontalStep(e.key, rootRef.current);\n if (delta === 1) {\n e.preventDefault();\n onNext();\n } else if (delta === -1) {\n if (!isFirst) onPrev();\n }\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [isFirst, step, onNext, onPrev, onSkip]);\n\n if (!ready) return null;\n\n const pad = step.padding ?? 8;\n const spot: Rect | null = rect\n ? { top: rect.top - pad, left: rect.left - pad, width: rect.width + pad * 2, height: rect.height + pad * 2 }\n : null;\n\n // `aria-modal` promises the page behind is out of reach, and the card's focus trap\n // keeps that promise for the keyboard. The pointer used to get no such treatment: the\n // root is `pointer-events-none` so that the spotlight hole can stay live for\n // `awaitClick`, and the scrim is a box-shadow, which takes no clicks — so every\n // control on the dimmed page stayed clickable. Four shields now tile the viewport\n // around the hole: the page is blocked, the card and the spotlighted target are not.\n // Keeping `aria-modal` (rather than dropping it) is the coherent half: the tour\n // really is modal — focus is trapped and Esc/Skip is the way out.\n return createPortal(\n <div\n ref={rootRef}\n className=\"pointer-events-none fixed inset-0 z-[60]\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.title}\n dir={dir}\n >\n {spot && <SpotlightShields spot={spot} />}\n {spot ? (\n <div\n className=\"pointer-events-none fixed rounded-lg transition-all duration-200 ease-out\"\n style={{\n top: spot.top,\n left: spot.left,\n width: spot.width,\n height: spot.height,\n // A two-tone frame, not a single translucent ring.\n //\n // The old treatment was `ring-2 ring-white/80` over a 55% scrim, and it\n // \"was barely visible\" on the app's blue-tinted surfaces. Two reasons,\n // and a single ring can't fix either: at 55% the surround stays bright\n // enough that the un-dimmed hole barely reads AS a hole, and a 80%-white\n // ring sitting on the edge of a light card is white-on-near-white.\n //\n // So: an opaque white band immediately around the target, a dark keyline\n // outside it, then the scrim. Whatever the target's own colour is, one of\n // the two bands is always in contrast with it and the other is always in\n // contrast with the dimmed surround — there is no background that can\n // swallow both. The blurred layer between them softens the step so the\n // frame reads as lighting rather than as a pasted-on rectangle.\n boxShadow: [\n \"0 0 0 3px rgba(255,255,255,0.98)\",\n \"0 0 0 5px rgba(15,23,42,0.92)\",\n \"0 0 18px 6px rgba(15,23,42,0.45)\",\n \"0 0 0 9999px rgba(15,23,42,0.70)\",\n ].join(\", \"),\n }}\n />\n ) : (\n <div className=\"pointer-events-auto fixed inset-0 bg-black/70\" />\n )}\n <TourCard\n step={step}\n index={index}\n total={steps.length}\n labels={labels}\n isFirst={isFirst}\n isLast={isLast}\n rect={spot}\n dir={dir}\n onBack={onPrev}\n onNext={onNext}\n onSkip={onSkip}\n />\n </div>,\n document.body,\n );\n}\n\n/** Does the focused element handle `key` itself? Enter on a button or link, and any\n * editing key in a text field or select, is the control's — not the tour's. */\nfunction ownsKey(target: EventTarget | null, key: string): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n if (tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (tag === \"INPUT\") {\n const type = (target as HTMLInputElement).type;\n // Enter on a checkbox does nothing natively, but ←/→ on a radio moves it.\n return key !== \"Enter\" || type !== \"checkbox\";\n }\n if (key !== \"Enter\") return false;\n return (\n tag === \"BUTTON\" ||\n (tag === \"A\" && target.hasAttribute(\"href\")) ||\n target.getAttribute(\"role\") === \"button\" ||\n target.getAttribute(\"role\") === \"link\"\n );\n}\n\n/**\n * Transparent pointer blockers tiling the viewport around the spotlight hole: one\n * full-width band above and below, one on each side at the hole's own height. The hole\n * itself stays uncovered, so the target keeps its clicks.\n */\nfunction SpotlightShields({ spot }: { spot: Rect }) {\n const shield = \"pointer-events-auto fixed\";\n const bottom = spot.top + spot.height;\n return (\n <>\n <div data-tour-shield=\"\" className={shield} style={{ top: 0, left: 0, right: 0, height: Math.max(0, spot.top) }} />\n <div data-tour-shield=\"\" className={shield} style={{ top: bottom, left: 0, right: 0, bottom: 0 }} />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: 0, width: Math.max(0, spot.left), height: spot.height }}\n />\n <div\n data-tour-shield=\"\"\n className={shield}\n style={{ top: spot.top, left: spot.left + spot.width, right: 0, height: spot.height }}\n />\n </>\n );\n}\n\n/**\n * Card position (viewport px) for the given placement relative to the padded\n * spotlight `rect`. Omitted placement keeps the original auto behavior\n * (below → above → vertically centered); an explicit side flips to its opposite\n * if it would overflow, then clamps into the viewport. \"center\" (or no rect)\n * centers on screen.\n */\nfunction placeCard(\n rect: Rect | null,\n cw: number,\n ch: number,\n vw: number,\n vh: number,\n m: number,\n placement?: TourPlacement,\n dir: Direction = \"ltr\",\n): { top: number; left: number } {\n // The logical sides resolve to a physical one here, and only here.\n if (placement === \"start\") placement = dir === \"rtl\" ? \"right\" : \"left\";\n else if (placement === \"end\") placement = dir === \"rtl\" ? \"left\" : \"right\";\n if (!rect || placement === \"center\") {\n return { top: Math.max(m, (vh - ch) / 2), left: Math.max(m, (vw - cw) / 2) };\n }\n const clampX = (x: number) => Math.min(Math.max(m, x), Math.max(m, vw - cw - m));\n const clampY = (y: number) => Math.min(Math.max(m, y), Math.max(m, vh - ch - m));\n const centerX = clampX(rect.left + rect.width / 2 - cw / 2);\n const centerY = clampY(rect.top + rect.height / 2 - ch / 2);\n const belowTop = rect.top + rect.height + m;\n const aboveTop = rect.top - ch - m;\n const rightLeft = rect.left + rect.width + m;\n const leftLeft = rect.left - cw - m;\n const fitsBelow = belowTop + ch <= vh;\n const fitsAbove = aboveTop >= 0;\n const fitsRight = rightLeft + cw <= vw;\n const fitsLeft = leftLeft >= 0;\n\n switch (placement) {\n case \"top\":\n return { top: fitsAbove ? aboveTop : fitsBelow ? belowTop : clampY(aboveTop), left: centerX };\n case \"bottom\":\n return { top: fitsBelow ? belowTop : fitsAbove ? aboveTop : clampY(belowTop), left: centerX };\n case \"right\":\n return { top: centerY, left: fitsRight ? rightLeft : fitsLeft ? leftLeft : clampX(rightLeft) };\n case \"left\":\n return { top: centerY, left: fitsLeft ? leftLeft : fitsRight ? rightLeft : clampX(leftLeft) };\n default:\n if (fitsBelow) return { top: belowTop, left: centerX };\n if (fitsAbove) return { top: aboveTop, left: centerX };\n return { top: Math.max(m, (vh - ch) / 2), left: centerX };\n }\n}\n\nfunction TourCard({\n step,\n index,\n total,\n labels,\n isFirst,\n isLast,\n rect,\n dir,\n onBack,\n onNext,\n onSkip,\n}: {\n step: TourStep;\n index: number;\n total: number;\n labels: TourLabels;\n isFirst: boolean;\n isLast: boolean;\n rect: Rect | null;\n dir: Direction;\n onBack: () => void;\n onNext: () => void;\n onSkip: () => void;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const [style, setStyle] = useState<CSSProperties>({ opacity: 0 });\n\n /**\n * The card holds the focus, because the card is what the tour IS.\n *\n * The overlay above declares `role=\"dialog\" aria-modal=\"true\"` — it always has — and\n * then left focus wherever the page had put it. For a tour that is the most pointed\n * version of the audit's *\"Only Modal manages focus\"*: the whole component exists to\n * say \"look here\", and for a keyboard user \"here\" is the focus ring. They were told\n * the page was hidden, given no way to reach the Next button without Tabbing through\n * it, and left on a control the screen reader would no longer describe.\n *\n * It re-engages on every step, without any bookkeeping here, because `TourOverlay`\n * returns null while it re-locates the next target: the card genuinely unmounts and\n * remounts between steps. That is what keeps focus honest when the BUTTONS change —\n * \"Back\" does not exist on the first step, so stepping back onto it destroys the\n * control the press came from, and focus would otherwise fall to `<body>`, outside\n * this trap's own listener, where Tab walks straight into the page the overlay claims\n * to have hidden.\n *\n * **The cost, written down:** on an `awaitClick` step the user is asked to click the\n * spotlighted element, and they can no longer Tab to it. ArrowRight still advances\n * (the key handler in `TourOverlay` is on the document and does not care where focus\n * is), which is the escape hatch that step already documents for the case where the\n * target cannot be found. Containment is worth that: an `awaitClick` step is a\n * minority of steps, while focus stranded behind `aria-modal` is every step.\n */\n useFocusTrap(ref, { active: true });\n\n useLayoutEffect(() => {\n const card = ref.current;\n if (!card) return;\n setStyle(\n placeCard(rect, card.offsetWidth, card.offsetHeight, window.innerWidth, window.innerHeight, 12, step.placement, dir),\n );\n }, [rect, index, step.placement, dir]);\n\n return (\n <div\n ref={ref}\n // Focusable but not tabbable: the trap above focuses the card itself rather than\n // its first button, so a screen reader reads the step's title and body before it\n // reads \"Next\" — and without this the container cannot take focus at all and the\n // trap silently does nothing.\n tabIndex={-1}\n style={style}\n className=\"pointer-events-auto fixed z-[61] w-80 max-w-[calc(100vw-1.5rem)] rounded-lg border border-[var(--border)] bg-[var(--bg-surface)] p-4 shadow-xl outline-none transition-all duration-200 ease-out\"\n >\n <div className=\"text-sm font-semibold text-[var(--text-primary)]\">{step.title}</div>\n <div className=\"mt-1 text-sm leading-relaxed text-[var(--text-secondary)]\">{step.body}</div>\n {step.action && <div className=\"mt-3\">{step.action}</div>}\n <div className=\"mt-4 space-y-2\">\n <div className=\"flex items-center justify-between gap-2\">\n <button\n type=\"button\"\n onClick={onSkip}\n className=\"text-xs text-[var(--text-placeholder)] hover:text-[var(--text-secondary)]\"\n >\n {labels.skip}\n </button>\n <div className=\"flex items-center gap-2\">\n <span className=\"whitespace-nowrap text-xs tabular-nums text-[var(--text-placeholder)]\">\n {labels.step(index + 1, total)}\n </span>\n {!isFirst && (\n <Button variant=\"secondary\" onClick={onBack} className=\"px-2.5 py-1 text-xs\">\n {labels.back}\n </Button>\n )}\n {/* On an awaitClick step the Next button is replaced by a hint on its\n own row below, so it doesn't cram the counter + buttons and wrap.\n Only when the target was actually FOUND, though — `rect` is null\n when the finder gave up, and the click listener early-returns on\n the same absence. Keyed on `step.target` alone this hid the only\n way forward on any step whose anchor happens not to be rendered\n for this user (a guest sees no \"add account\" button), leaving the\n undocumented ArrowRight key as the sole escape. */}\n {!(step.awaitClick && step.target && rect) && (\n <Button variant=\"brand\" onClick={onNext} className={cn(\"px-2.5 py-1 text-xs\")}>\n {isLast ? labels.done : labels.next}\n </Button>\n )}\n </div>\n </div>\n {step.awaitClick && step.target && rect && (\n <div className=\"text-center text-xs italic text-[var(--text-placeholder)]\">\n {labels.awaitClickHint}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AAiNI,SA6SA,UA1SI,KAHJ;AAjNJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,OAAO,sBAAsB;AA+C/B,MAAM,sBAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;AAC7B;AAkCA,MAAM,cAAc,cAAuC,IAAI;AAExD,SAAS,UAA4B;AAC1C,QAAM,MAAM,WAAW,WAAW;AAClC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,4CAA4C;AACtE,SAAO;AACT;AAsBO,SAAS,kBAA2C;AACzD,SAAO,WAAW,WAAW;AAC/B;AAUO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AACF,GAGG;AAID,QAAM,SAAS,aAAa,QAAQ,qBAAqB,MAAM;AAC/D,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA4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,MACC;AAAA,MAKA,UAAU;AAAA,MACV;AAAA,MACA,WAAU;AAAA,MAEV;AAAA,4BAAC,SAAI,WAAU,oDAAoD,eAAK,OAAM;AAAA,QAC9E,oBAAC,SAAI,WAAU,6DAA6D,eAAK,MAAK;AAAA,QACrF,KAAK,UAAU,oBAAC,SAAI,WAAU,QAAQ,eAAK,QAAO;AAAA,QACnD,qBAAC,SAAI,WAAU,kBACb;AAAA,+BAAC,SAAI,WAAU,2CACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,WAAU;AAAA,gBAET,iBAAO;AAAA;AAAA,YACV;AAAA,YACA,qBAAC,SAAI,WAAU,2BACb;AAAA,kCAAC,UAAK,WAAU,yEACb,iBAAO,KAAK,QAAQ,GAAG,KAAK,GAC/B;AAAA,cACC,CAAC,WACA,oBAAC,UAAO,SAAQ,aAAY,SAAS,QAAQ,WAAU,uBACpD,iBAAO,MACV;AAAA,cAUD,EAAE,KAAK,cAAc,KAAK,UAAU,SACnC,oBAAC,UAAO,SAAQ,SAAQ,SAAS,QAAQ,WAAW,GAAG,qBAAqB,GACzE,mBAAS,OAAO,OAAO,OAAO,MACjC;AAAA,eAEJ;AAAA,aACF;AAAA,UACC,KAAK,cAAc,KAAK,UAAU,QACjC,oBAAC,SAAI,WAAU,6DACZ,iBAAO,gBACV;AAAA,WAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,10 +1,57 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { ButtonVariant } from '../components/ui.js';
3
+ import { f as ButtonVariant } from '../kit-labels-Mz8zZHIF.js';
4
4
  import { UseWizardReturn, WizardLabels } from './types.js';
5
+ import '../components/data-table-labels.js';
6
+ import '../components/mini-calendar.js';
7
+ import '../components/calendar-heatmap.js';
8
+ import '../components/popover.js';
9
+ import '../components/chip.js';
10
+ import 'lucide-react';
11
+ import '../components/field-sync.js';
5
12
  import '../components/tooltip.js';
6
13
  import '../hooks/use-anchored-rect.js';
7
14
  import '../lib/clipping.js';
15
+ import '../tour/tour.js';
16
+ import '../search/command-palette.js';
17
+ import '../search/global-search.js';
18
+ import '../search/search-index.js';
19
+ import '../components/month-picker.js';
20
+ import '../components/page-contents.js';
21
+ import '../components/series-chart-labels.js';
22
+ import '../components/pie-chart-labels.js';
23
+ import '../components/sparkline.js';
24
+ import '../components/stat-tile.js';
25
+ import '../components/signature-pad.js';
26
+ import '../components/password-strength.js';
27
+ import '../components/danger-confirm.js';
28
+ import '../components/swatch-picker.js';
29
+ import '../components/tile-radio.js';
30
+ import '../components/icon-picker.js';
31
+ import '../components/dialog-frame.js';
32
+ import '../components/modal.js';
33
+ import '../hooks/use-search-param-state.js';
34
+ import '../components/measured-grid.js';
35
+ import '../feedback/feedback-attachment.js';
36
+ import '../feedback/feedback-dialog.js';
37
+ import '../feedback/feedback-thread.js';
38
+ import '../feedback/feedback-inbox.js';
39
+ import '../components/account-settings-labels.js';
40
+ import '../components/confirm-dialog.js';
41
+ import '../components/floating-panel.js';
42
+ import '../components/bulk-action-bar.js';
43
+ import '../components/list.js';
44
+ import '../components/breadcrumbs.js';
45
+ import '../components/toast.js';
46
+ import '../components/description-list.js';
47
+ import '../components/line-items.js';
48
+ import '../components/progress-bar.js';
49
+ import '../components/signed-amount.js';
50
+ import '../components/error-boundary.js';
51
+ import '../components/authed-image.js';
52
+ import '../hooks/use-authed-src.js';
53
+ import '../components/image-grid.js';
54
+ import '../components/lightbox.js';
8
55
 
9
56
  /**
10
57
  * The chrome around a wizard: the step indicator, the step content, and the
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCallback, useEffect, useReducer, useRef, useState } from "react";
2
+ import { useCallback, useEffect, useLayoutEffect, useReducer, useRef, useState } from "react";
3
3
  import { useSearchParams } from "react-router";
4
4
  import { useKitLabels } from "../i18n/kit-labels.js";
5
5
  import { DEFAULT_WIZARD_LABELS } from "./types.js";
@@ -91,7 +91,9 @@ function useWizard(options) {
91
91
  onValidationFailed
92
92
  } = options;
93
93
  const stepsRef = useRef(steps);
94
- stepsRef.current = steps;
94
+ useLayoutEffect(() => {
95
+ stepsRef.current = steps;
96
+ }, [steps]);
95
97
  const wizardLabels = useKitLabels("wizard", DEFAULT_WIZARD_LABELS, {
96
98
  missingRequired: missingRequiredMessage
97
99
  });