@jcsoftdev/ui 0.5.0 → 0.7.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 (392) hide show
  1. package/CHANGELOG.md +361 -0
  2. package/README.md +31 -5
  3. package/bin/ui-theme.mjs +40 -6
  4. package/dist/ai/code-block/code-block.js +1 -1
  5. package/dist/atoms/avatar/avatar.d.ts +6 -1
  6. package/dist/atoms/avatar/avatar.js +3 -2
  7. package/dist/atoms/big-date/big-date.js +2 -2
  8. package/dist/atoms/button/button.d.ts +6 -1
  9. package/dist/atoms/button/button.js +2 -2
  10. package/dist/atoms/chip/chip.d.ts +5 -0
  11. package/dist/atoms/chip/chip.js +3 -3
  12. package/dist/atoms/icon-button/icon-button.js +1 -1
  13. package/dist/atoms/internal/hit-area.d.ts +5 -4
  14. package/dist/atoms/internal/hit-area.js +1 -1
  15. package/dist/atoms/progress/index.d.ts +1 -1
  16. package/dist/atoms/progress/index.js +4 -1
  17. package/dist/atoms/progress/progress.d.ts +6 -1
  18. package/dist/atoms/progress/progress.js +19 -1
  19. package/dist/atoms/radio-group/radio-group.js +1 -1
  20. package/dist/atoms/status-pill/status-pill.d.ts +16 -5
  21. package/dist/atoms/status-pill/status-pill.js +43 -18
  22. package/dist/brand/logo-forge.js +1 -1
  23. package/dist/charts/candlestick-chart/candlestick-chart.js +2 -2
  24. package/dist/charts/chart-grid/chart-grid.js +2 -2
  25. package/dist/charts/chord-chart/chord-chart.js +1 -1
  26. package/dist/charts/core/axes.js +2 -2
  27. package/dist/charts/core/cartesian/annotations.js +2 -2
  28. package/dist/charts/core/cartesian/marks.js +1 -1
  29. package/dist/charts/core/distribution/marks.js +1 -1
  30. package/dist/charts/core/distribution/xy-points.js +1 -1
  31. package/dist/charts/core/export-menu.js +1 -1
  32. package/dist/charts/funnel-chart/funnel-chart.js +1 -1
  33. package/dist/charts/gantt-chart/gantt-chart.js +4 -4
  34. package/dist/charts/gantt-chart/gantt-marks.js +3 -3
  35. package/dist/charts/index.d.ts +2 -0
  36. package/dist/charts/index.js +2 -0
  37. package/dist/charts/maps/geo/map-data-table.js +1 -1
  38. package/dist/charts/polar-area-chart/polar-area-chart.js +1 -1
  39. package/dist/charts/radar-chart/radar-chart.js +1 -1
  40. package/dist/charts/stock-chart/stock-chart.js +1 -1
  41. package/dist/charts/stock-chart/stock-drawing-layer.js +3 -3
  42. package/dist/charts/stock-chart/stock-plot.js +2 -2
  43. package/dist/containers/chat-thread/chat-thread.d.ts +98 -0
  44. package/dist/containers/chat-thread/chat-thread.js +219 -0
  45. package/dist/containers/chat-thread/format.d.ts +20 -0
  46. package/dist/containers/chat-thread/format.js +50 -0
  47. package/dist/containers/chat-thread/index.d.ts +1 -0
  48. package/dist/containers/chat-thread/index.js +8 -0
  49. package/dist/containers/cols/cols.d.ts +1 -1
  50. package/dist/containers/cols/cols.js +7 -0
  51. package/dist/containers/comment/comment.js +1 -1
  52. package/dist/containers/context-rail/context-rail.d.ts +62 -0
  53. package/dist/containers/context-rail/context-rail.js +175 -0
  54. package/dist/containers/context-rail/index.d.ts +1 -0
  55. package/dist/containers/context-rail/index.js +6 -0
  56. package/dist/containers/dashboard/dashboard.d.ts +40 -0
  57. package/dist/containers/dashboard/dashboard.js +84 -0
  58. package/dist/containers/dashboard/index.d.ts +1 -0
  59. package/dist/containers/dashboard/index.js +14 -0
  60. package/dist/containers/data-grid/data-grid.demos.js +4 -4
  61. package/dist/containers/data-grid/data-grid.js +6 -6
  62. package/dist/containers/data-grid/filter-builder-editor.js +2 -2
  63. package/dist/containers/data-grid/grid-toolbar.js +1 -1
  64. package/dist/containers/data-grid/spreadsheet.demos.d.ts +1 -1
  65. package/dist/containers/data-grid/spreadsheet.demos.js +1 -1
  66. package/dist/containers/detail-header/detail-header.d.ts +24 -0
  67. package/dist/containers/detail-header/detail-header.js +32 -0
  68. package/dist/containers/detail-header/index.d.ts +1 -0
  69. package/dist/containers/detail-header/index.js +6 -0
  70. package/dist/containers/facts/facts.js +1 -1
  71. package/dist/containers/filter-bar/filter-bar.d.ts +58 -0
  72. package/dist/containers/filter-bar/filter-bar.js +123 -0
  73. package/dist/containers/filter-bar/index.d.ts +1 -0
  74. package/dist/containers/filter-bar/index.js +6 -0
  75. package/dist/containers/hbars/hbars.js +2 -2
  76. package/dist/containers/index.d.ts +9 -0
  77. package/dist/containers/index.js +9 -0
  78. package/dist/containers/kanban/kanban.d.ts +23 -2
  79. package/dist/containers/kanban/kanban.js +103 -21
  80. package/dist/containers/kanban/model.d.ts +12 -0
  81. package/dist/containers/kanban/model.js +8 -0
  82. package/dist/containers/kpi/kpi.js +1 -1
  83. package/dist/containers/kpi-group/kpi-group.d.ts +6 -1
  84. package/dist/containers/kpi-group/kpi-group.js +6 -2
  85. package/dist/containers/list-detail/index.d.ts +1 -1
  86. package/dist/containers/list-detail/index.js +4 -0
  87. package/dist/containers/list-detail/list-detail.d.ts +51 -3
  88. package/dist/containers/list-detail/list-detail.js +111 -15
  89. package/dist/containers/page/page.d.ts +17 -4
  90. package/dist/containers/page/page.js +33 -4
  91. package/dist/containers/page-header/back.d.ts +10 -0
  92. package/dist/containers/page-header/back.js +28 -0
  93. package/dist/containers/page-header/index.d.ts +1 -0
  94. package/dist/containers/page-header/index.js +1 -0
  95. package/dist/containers/page-header/page-header.d.ts +19 -2
  96. package/dist/containers/page-header/page-header.js +26 -2
  97. package/dist/containers/pagination/cursor-pagination.d.ts +28 -0
  98. package/dist/containers/pagination/cursor-pagination.js +48 -0
  99. package/dist/containers/pagination/index.d.ts +3 -0
  100. package/dist/containers/pagination/index.js +10 -0
  101. package/dist/containers/pagination/pagination.d.ts +52 -0
  102. package/dist/containers/pagination/pagination.js +216 -0
  103. package/dist/containers/pagination/range.d.ts +29 -0
  104. package/dist/containers/pagination/range.js +42 -0
  105. package/dist/containers/pagination/use-pagination.d.ts +18 -0
  106. package/dist/containers/pagination/use-pagination.js +22 -0
  107. package/dist/containers/responsive-list/responsive-list.d.ts +29 -3
  108. package/dist/containers/responsive-list/responsive-list.js +202 -82
  109. package/dist/containers/row-actions/index.d.ts +1 -0
  110. package/dist/containers/row-actions/index.js +4 -0
  111. package/dist/containers/row-actions/row-actions.d.ts +26 -0
  112. package/dist/containers/row-actions/row-actions.js +78 -0
  113. package/dist/containers/selectable-card/index.d.ts +1 -0
  114. package/dist/containers/selectable-card/index.js +6 -0
  115. package/dist/containers/selectable-card/selectable-card.d.ts +26 -0
  116. package/dist/containers/selectable-card/selectable-card.js +57 -0
  117. package/dist/containers/settings-layout/settings-layout.d.ts +24 -7
  118. package/dist/containers/settings-layout/settings-layout.js +63 -8
  119. package/dist/containers/shortcuts/shortcuts.js +1 -1
  120. package/dist/containers/table/cell-padding.d.ts +2 -0
  121. package/dist/containers/table/cell-padding.js +4 -0
  122. package/dist/containers/table/index.d.ts +1 -0
  123. package/dist/containers/table/index.js +8 -0
  124. package/dist/containers/table/sort.d.ts +14 -0
  125. package/dist/containers/table/sort.js +11 -0
  126. package/dist/containers/table/table-parts.d.ts +24 -0
  127. package/dist/containers/table/table-parts.js +52 -0
  128. package/dist/containers/table/table.d.ts +37 -3
  129. package/dist/containers/table/table.js +120 -19
  130. package/dist/containers/table-columns-menu/index.d.ts +1 -0
  131. package/dist/containers/table-columns-menu/index.js +6 -0
  132. package/dist/containers/table-columns-menu/table-columns-menu.d.ts +14 -0
  133. package/dist/containers/table-columns-menu/table-columns-menu.js +46 -0
  134. package/dist/dashboards/layout.d.ts +1 -27
  135. package/dist/dashboards/layout.js +8 -40
  136. package/dist/forms/chip-group/chip-group.d.ts +5 -0
  137. package/dist/forms/chip-group/chip-group.js +3 -1
  138. package/dist/forms/combobox/combobox.js +1 -1
  139. package/dist/forms/copy-field/copy-field.js +1 -1
  140. package/dist/forms/date-picker/date-picker.d.ts +3 -1
  141. package/dist/forms/date-picker/date-picker.js +4 -2
  142. package/dist/forms/date-picker/date-time-picker.d.ts +8 -2
  143. package/dist/forms/date-picker/date-time-picker.js +13 -2
  144. package/dist/forms/field/field.d.ts +9 -2
  145. package/dist/forms/field/field.js +18 -4
  146. package/dist/forms/fieldset/fieldset.d.ts +11 -0
  147. package/dist/forms/fieldset/fieldset.js +12 -0
  148. package/dist/forms/fieldset/index.d.ts +1 -0
  149. package/dist/forms/fieldset/index.js +4 -0
  150. package/dist/forms/form-footer/form-footer.d.ts +26 -0
  151. package/dist/forms/form-footer/form-footer.js +44 -0
  152. package/dist/forms/form-footer/index.d.ts +1 -0
  153. package/dist/forms/form-footer/index.js +4 -0
  154. package/dist/forms/form-grid/form-grid.d.ts +21 -4
  155. package/dist/forms/form-grid/form-grid.js +20 -3
  156. package/dist/forms/form-grid/index.d.ts +1 -1
  157. package/dist/forms/form-grid/index.js +6 -2
  158. package/dist/forms/form-section/form-section.d.ts +12 -0
  159. package/dist/forms/form-section/form-section.js +30 -0
  160. package/dist/forms/form-section/index.d.ts +1 -0
  161. package/dist/forms/form-section/index.js +4 -0
  162. package/dist/forms/index.d.ts +3 -0
  163. package/dist/forms/index.js +3 -0
  164. package/dist/forms/input/input.d.ts +6 -2
  165. package/dist/forms/input/input.js +4 -1
  166. package/dist/forms/internal/listbox-items.d.ts +1 -1
  167. package/dist/forms/internal/listbox-items.js +3 -2
  168. package/dist/forms/native-select/native-select.js +1 -1
  169. package/dist/forms/number-stepper/index.d.ts +1 -1
  170. package/dist/forms/number-stepper/number-stepper.d.ts +7 -0
  171. package/dist/forms/number-stepper/number-stepper.js +37 -6
  172. package/dist/forms/select/index.d.ts +1 -1
  173. package/dist/forms/select/select.d.ts +5 -2
  174. package/dist/forms/select/select.js +7 -2
  175. package/dist/forms/select-menu/select-menu.js +1 -1
  176. package/dist/forms/time-input/time-input.d.ts +4 -2
  177. package/dist/forms/time-input/time-input.js +3 -1
  178. package/dist/i18n/strings.d.ts +94 -0
  179. package/dist/i18n/strings.js +50 -0
  180. package/dist/motion/count-up.d.ts +20 -0
  181. package/dist/motion/count-up.js +59 -0
  182. package/dist/motion/cross-fade.d.ts +21 -0
  183. package/dist/motion/cross-fade.js +86 -0
  184. package/dist/motion/index.d.ts +5 -0
  185. package/dist/motion/index.js +14 -0
  186. package/dist/motion/model.d.ts +15 -0
  187. package/dist/motion/model.js +68 -0
  188. package/dist/motion/motion-styles.d.ts +1 -0
  189. package/dist/motion/motion-styles.js +35 -0
  190. package/dist/motion/reveal.d.ts +37 -0
  191. package/dist/motion/reveal.js +69 -0
  192. package/dist/motion/use-enter-phase.d.ts +11 -0
  193. package/dist/motion/use-enter-phase.js +40 -0
  194. package/dist/motion/use-highlight-row.d.ts +22 -0
  195. package/dist/motion/use-highlight-row.js +38 -0
  196. package/dist/navigation/tabs/tabs.js +1 -1
  197. package/dist/navigation/wizard/wizard.d.ts +4 -1
  198. package/dist/navigation/wizard/wizard.js +3 -0
  199. package/dist/overlays/alert-dialog/alert-dialog.js +8 -1
  200. package/dist/overlays/context-menu/context-menu.js +3 -1
  201. package/dist/overlays/dialog/dialog.d.ts +1 -0
  202. package/dist/overlays/dialog/dialog.js +11 -3
  203. package/dist/overlays/drawer/drawer.d.ts +18 -4
  204. package/dist/overlays/drawer/drawer.js +53 -4
  205. package/dist/overlays/drawer/index.d.ts +1 -1
  206. package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +1 -1
  207. package/dist/overlays/dropdown-menu/dropdown-menu.js +5 -4
  208. package/dist/overlays/hover-card/hover-card.js +2 -0
  209. package/dist/overlays/popover/popover.js +2 -0
  210. package/dist/overlays/toaster/index.d.ts +1 -1
  211. package/dist/overlays/toaster/toast-store.d.ts +2 -0
  212. package/dist/overlays/toaster/toast-store.js +6 -1
  213. package/dist/overlays/toaster/toaster.d.ts +28 -2
  214. package/dist/overlays/toaster/toaster.js +86 -29
  215. package/dist/overlays/tooltip/tooltip.js +2 -0
  216. package/dist/primitives/use-presence.js +9 -0
  217. package/dist/shell/app-shell/app-shell.d.ts +8 -1
  218. package/dist/shell/app-shell/app-shell.js +50 -3
  219. package/dist/shell/index.d.ts +1 -0
  220. package/dist/shell/index.js +1 -0
  221. package/dist/shell/sidebar/sidebar.d.ts +17 -1
  222. package/dist/shell/sidebar/sidebar.js +126 -76
  223. package/dist/shell/topbar/topbar.d.ts +4 -2
  224. package/dist/shell/topbar/topbar.js +2 -0
  225. package/dist/showcase/operations-bento.js +2 -2
  226. package/dist/states/empty-state/empty-state.d.ts +10 -3
  227. package/dist/states/empty-state/empty-state.js +46 -5
  228. package/dist/states/error-state/error-state.js +1 -1
  229. package/dist/states/skeleton/skeleton.d.ts +16 -1
  230. package/dist/states/skeleton/skeleton.js +13 -5
  231. package/dist/utils/class-tokens.generated.js +4 -6
  232. package/dist/utils/focus-chain.d.ts +11 -0
  233. package/dist/utils/focus-chain.js +39 -0
  234. package/dist/utils/focus-rescue.d.ts +13 -0
  235. package/dist/utils/focus-rescue.js +48 -0
  236. package/dist/utils/list-navigation.d.ts +14 -0
  237. package/dist/utils/list-navigation.js +44 -0
  238. package/dist/utils/overlay-motion.d.ts +12 -0
  239. package/dist/utils/overlay-motion.js +14 -0
  240. package/dist/utils/use-container-width.d.ts +6 -0
  241. package/dist/utils/use-container-width.js +19 -0
  242. package/package.json +2 -2
  243. package/scripts/build-theme.mjs +46 -5
  244. package/src/ai/code-block/code-block.tsx +1 -1
  245. package/src/atoms/avatar/avatar.tsx +8 -2
  246. package/src/atoms/big-date/big-date.tsx +2 -2
  247. package/src/atoms/button/button.tsx +8 -3
  248. package/src/atoms/chip/chip.tsx +8 -3
  249. package/src/atoms/icon-button/icon-button.tsx +1 -1
  250. package/src/atoms/internal/hit-area.ts +5 -4
  251. package/src/atoms/progress/index.ts +8 -1
  252. package/src/atoms/progress/progress.tsx +30 -1
  253. package/src/atoms/radio-group/radio-group.tsx +1 -1
  254. package/src/atoms/status-pill/status-pill.tsx +59 -18
  255. package/src/brand/logo-forge.tsx +1 -1
  256. package/src/charts/candlestick-chart/candlestick-chart.tsx +2 -2
  257. package/src/charts/chart-grid/chart-grid.tsx +2 -2
  258. package/src/charts/chord-chart/chord-chart.tsx +1 -1
  259. package/src/charts/core/axes.tsx +2 -2
  260. package/src/charts/core/cartesian/annotations.tsx +2 -2
  261. package/src/charts/core/cartesian/marks.tsx +1 -1
  262. package/src/charts/core/distribution/marks.tsx +1 -1
  263. package/src/charts/core/distribution/xy-points.tsx +1 -1
  264. package/src/charts/core/export-menu.tsx +1 -1
  265. package/src/charts/funnel-chart/funnel-chart.tsx +1 -1
  266. package/src/charts/gantt-chart/gantt-chart.tsx +4 -4
  267. package/src/charts/gantt-chart/gantt-marks.tsx +3 -3
  268. package/src/charts/index.ts +2 -0
  269. package/src/charts/maps/geo/map-data-table.tsx +1 -1
  270. package/src/charts/polar-area-chart/polar-area-chart.tsx +1 -1
  271. package/src/charts/radar-chart/radar-chart.tsx +1 -1
  272. package/src/charts/stock-chart/stock-chart.tsx +1 -1
  273. package/src/charts/stock-chart/stock-drawing-layer.tsx +3 -3
  274. package/src/charts/stock-chart/stock-plot.tsx +2 -2
  275. package/src/containers/chat-thread/chat-thread.tsx +331 -0
  276. package/src/containers/chat-thread/format.ts +67 -0
  277. package/src/containers/chat-thread/index.ts +12 -0
  278. package/src/containers/cols/cols.tsx +13 -1
  279. package/src/containers/comment/comment.tsx +1 -1
  280. package/src/containers/context-rail/context-rail.tsx +229 -0
  281. package/src/containers/context-rail/index.ts +7 -0
  282. package/src/containers/dashboard/dashboard.tsx +142 -0
  283. package/src/containers/dashboard/index.ts +12 -0
  284. package/src/containers/data-grid/data-grid.demos.tsx +4 -4
  285. package/src/containers/data-grid/data-grid.tsx +6 -6
  286. package/src/containers/data-grid/filter-builder-editor.tsx +2 -2
  287. package/src/containers/data-grid/grid-toolbar.tsx +1 -1
  288. package/src/containers/data-grid/spreadsheet.demos.tsx +1 -1
  289. package/src/containers/detail-header/detail-header.tsx +64 -0
  290. package/src/containers/detail-header/index.ts +5 -0
  291. package/src/containers/facts/facts.tsx +1 -1
  292. package/src/containers/filter-bar/filter-bar.tsx +201 -0
  293. package/src/containers/filter-bar/index.ts +7 -0
  294. package/src/containers/hbars/hbars.tsx +2 -2
  295. package/src/containers/index.ts +9 -0
  296. package/src/containers/kanban/kanban.tsx +148 -39
  297. package/src/containers/kanban/model.ts +20 -0
  298. package/src/containers/kpi/kpi.tsx +1 -1
  299. package/src/containers/kpi-group/kpi-group.tsx +17 -2
  300. package/src/containers/list-detail/index.ts +5 -0
  301. package/src/containers/list-detail/list-detail.tsx +159 -9
  302. package/src/containers/page/page.tsx +61 -7
  303. package/src/containers/page-header/back.tsx +42 -0
  304. package/src/containers/page-header/index.ts +1 -0
  305. package/src/containers/page-header/page-header.tsx +49 -3
  306. package/src/containers/pagination/cursor-pagination.tsx +79 -0
  307. package/src/containers/pagination/index.ts +7 -0
  308. package/src/containers/pagination/pagination.tsx +266 -0
  309. package/src/containers/pagination/range.ts +68 -0
  310. package/src/containers/pagination/use-pagination.ts +44 -0
  311. package/src/containers/responsive-list/responsive-list.tsx +190 -47
  312. package/src/containers/row-actions/index.ts +1 -0
  313. package/src/containers/row-actions/row-actions.tsx +114 -0
  314. package/src/containers/selectable-card/index.ts +5 -0
  315. package/src/containers/selectable-card/selectable-card.tsx +84 -0
  316. package/src/containers/settings-layout/settings-layout.tsx +104 -13
  317. package/src/containers/shortcuts/shortcuts.tsx +1 -1
  318. package/src/containers/table/cell-padding.ts +2 -0
  319. package/src/containers/table/index.ts +6 -0
  320. package/src/containers/table/sort.ts +23 -0
  321. package/src/containers/table/table-parts.tsx +81 -0
  322. package/src/containers/table/table.tsx +212 -45
  323. package/src/containers/table-columns-menu/index.ts +5 -0
  324. package/src/containers/table-columns-menu/table-columns-menu.tsx +68 -0
  325. package/src/dashboards/layout.tsx +8 -75
  326. package/src/forms/chip-group/chip-group.tsx +8 -1
  327. package/src/forms/combobox/combobox.tsx +1 -1
  328. package/src/forms/copy-field/copy-field.tsx +1 -1
  329. package/src/forms/date-picker/date-picker.tsx +7 -2
  330. package/src/forms/date-picker/date-time-picker.tsx +28 -2
  331. package/src/forms/field/field.tsx +30 -3
  332. package/src/forms/fieldset/fieldset.tsx +22 -0
  333. package/src/forms/fieldset/index.ts +1 -0
  334. package/src/forms/form-footer/form-footer.tsx +74 -0
  335. package/src/forms/form-footer/index.ts +1 -0
  336. package/src/forms/form-grid/form-grid.tsx +42 -5
  337. package/src/forms/form-grid/index.ts +8 -1
  338. package/src/forms/form-section/form-section.tsx +41 -0
  339. package/src/forms/form-section/index.ts +1 -0
  340. package/src/forms/index.ts +3 -0
  341. package/src/forms/input/input.tsx +10 -3
  342. package/src/forms/internal/listbox-items.tsx +3 -4
  343. package/src/forms/native-select/native-select.tsx +1 -1
  344. package/src/forms/number-stepper/index.ts +1 -0
  345. package/src/forms/number-stepper/number-stepper.tsx +51 -6
  346. package/src/forms/select/index.ts +1 -1
  347. package/src/forms/select/select.tsx +14 -3
  348. package/src/forms/select-menu/select-menu.tsx +1 -1
  349. package/src/forms/time-input/time-input.tsx +6 -2
  350. package/src/i18n/strings.ts +94 -0
  351. package/src/motion/count-up.tsx +83 -0
  352. package/src/motion/cross-fade.tsx +139 -0
  353. package/src/motion/index.ts +5 -0
  354. package/src/motion/model.ts +86 -0
  355. package/src/motion/motion-styles.tsx +47 -0
  356. package/src/motion/reveal.tsx +115 -0
  357. package/src/motion/use-enter-phase.ts +50 -0
  358. package/src/motion/use-highlight-row.ts +63 -0
  359. package/src/navigation/tabs/tabs.tsx +1 -1
  360. package/src/navigation/wizard/wizard.tsx +6 -1
  361. package/src/overlays/alert-dialog/alert-dialog.tsx +5 -1
  362. package/src/overlays/context-menu/context-menu.tsx +3 -2
  363. package/src/overlays/dialog/dialog.tsx +9 -3
  364. package/src/overlays/drawer/drawer.tsx +68 -6
  365. package/src/overlays/drawer/index.ts +1 -0
  366. package/src/overlays/dropdown-menu/dropdown-menu.tsx +5 -4
  367. package/src/overlays/hover-card/hover-card.tsx +2 -0
  368. package/src/overlays/popover/popover.tsx +2 -0
  369. package/src/overlays/toaster/index.ts +2 -0
  370. package/src/overlays/toaster/toast-store.ts +8 -0
  371. package/src/overlays/toaster/toaster.tsx +127 -17
  372. package/src/overlays/tooltip/tooltip.tsx +2 -0
  373. package/src/primitives/use-presence.ts +13 -0
  374. package/src/shell/app-shell/app-shell.tsx +54 -2
  375. package/src/shell/index.ts +1 -0
  376. package/src/shell/sidebar/sidebar.tsx +154 -75
  377. package/src/shell/topbar/topbar.tsx +8 -0
  378. package/src/showcase/operations-bento.tsx +2 -2
  379. package/src/states/empty-state/empty-state.tsx +52 -9
  380. package/src/states/error-state/error-state.tsx +1 -1
  381. package/src/states/skeleton/skeleton.tsx +33 -5
  382. package/src/utils/class-tokens.generated.ts +4 -6
  383. package/src/utils/focus-chain.ts +53 -0
  384. package/src/utils/focus-rescue.ts +68 -0
  385. package/src/utils/list-navigation.ts +63 -0
  386. package/src/utils/overlay-motion.ts +33 -0
  387. package/src/utils/use-container-width.ts +24 -0
  388. package/styles/Theme.kt +15 -18
  389. package/styles/tailwind.css +29 -28
  390. package/styles/theme.css +29 -28
  391. package/styles/tokens.css +46 -0
  392. package/tokens/default.json +51 -29
@@ -1,4 +1,4 @@
1
- import type { ComponentPropsWithoutRef } from "react";
1
+ import { type ComponentPropsWithoutRef } from "react";
2
2
  import * as DialogPrimitive from "../../primitives/dialog/dialog.js";
3
3
  import type { ClassNames } from "../../utils/class-names.js";
4
4
  import { type Material } from "../../utils/material.js";
@@ -11,7 +11,10 @@ export declare const DrawerTrigger: typeof DialogPrimitive.Trigger;
11
11
  export declare const DrawerClose: typeof DialogPrimitive.Close;
12
12
  export declare function DrawerTitle({ className, ...props }: ComponentPropsWithoutRef<typeof DialogPrimitive.Title>): import("react").JSX.Element;
13
13
  export declare function DrawerDescription({ className, ...props }: ComponentPropsWithoutRef<typeof DialogPrimitive.Description>): import("react").JSX.Element;
14
- export type DrawerContentPart = "root" | "overlay" | "close";
14
+ export type DrawerContentPart = "root" | "overlay" | "close" | "handle";
15
+ export type DrawerSide = "right" | "bottom";
16
+ /** Classes of the content box for a side; exported for tests and for wrappers that restyle it. */
17
+ export declare function drawerSideClass(side: DrawerSide): string;
15
18
  export interface DrawerContentProps extends DialogPrimitive.DialogContentProps {
16
19
  /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the content and is merged last. */
17
20
  classNames?: ClassNames<DrawerContentPart>;
@@ -26,6 +29,17 @@ export interface DrawerContentProps extends DialogPrimitive.DialogContentProps {
26
29
  blocking?: boolean;
27
30
  /** Accessible label of the close button. */
28
31
  closeLabel?: string;
32
+ /**
33
+ * Edge the panel is anchored to. `"right"` (default) is a side panel up to 430 px wide;
34
+ * `"bottom"` is a bottom sheet across the width, padded by the safe-area inset and capped at
35
+ * 85dvh with its own scroll. Focus is trapped and Escape closes it on both.
36
+ */
37
+ side?: DrawerSide;
38
+ /**
39
+ * Shows a grab handle at the top of a `side="bottom"` sheet. It is decorative (hidden from
40
+ * assistive tech); dragging it down closes the sheet unless `blocking`. Ignored on other sides.
41
+ */
42
+ handle?: boolean;
29
43
  }
30
- /** Right-anchored side panel for secondary flows. */
31
- export declare function DrawerContent({ className, classNames, material, blocking, closeLabel, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }: DrawerContentProps): import("react").JSX.Element;
44
+ /** Side panel (right) or bottom sheet for secondary flows. */
45
+ export declare function DrawerContent({ className, classNames, material, blocking, closeLabel, side, handle, children, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }: DrawerContentProps): import("react").JSX.Element;
@@ -1,10 +1,12 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useRef } from "react";
3
4
  import { useUiStrings } from "../../i18n/index.js";
4
5
  import { X } from "../../icons/index.js";
5
6
  import * as DialogPrimitive from "../../primitives/dialog/dialog.js";
6
7
  import { cn } from "../../utils/cn.js";
7
8
  import { materialClass } from "../../utils/material.js";
9
+ import { DRAWER_MOTION, OVERLAY_MOTION, SHEET_MOTION } from "../../utils/overlay-motion.js";
8
10
  import {
9
11
  PreviousFocusProvider,
10
12
  restoreFocusOnClose,
@@ -29,12 +31,22 @@ function DrawerDescription({
29
31
  }) {
30
32
  return /* @__PURE__ */ jsx(DialogPrimitive.Description, { className: cn("m-0 text-ink-2", className), ...props });
31
33
  }
34
+ const SWIPE_CLOSE_PX = 60;
35
+ const sideClasses = {
36
+ right: "inset-y-0 right-0 h-full w-[min(430px,100%)] max-w-full",
37
+ bottom: "inset-x-0 bottom-0 max-h-[min(85dvh,100%)] w-full rounded-t-card pb-[env(safe-area-inset-bottom)]"
38
+ };
39
+ function drawerSideClass(side) {
40
+ return sideClasses[side];
41
+ }
32
42
  function DrawerContent({
33
43
  className,
34
44
  classNames,
35
45
  material,
36
46
  blocking = false,
37
47
  closeLabel,
48
+ side = "right",
49
+ handle = false,
38
50
  children,
39
51
  onEscapeKeyDown,
40
52
  onPointerDownOutside,
@@ -44,13 +56,35 @@ function DrawerContent({
44
56
  }) {
45
57
  const previousFocusRef = usePreviousFocus();
46
58
  const strings = useUiStrings();
59
+ const closeRef = useRef(null);
60
+ const swipe = useRef(null);
61
+ const bottom = side === "bottom";
62
+ const showHandle = bottom && handle;
63
+ const swipeStart = (event) => {
64
+ swipe.current = event.clientY;
65
+ event.currentTarget.setPointerCapture?.(event.pointerId);
66
+ };
67
+ const swipeEnd = (event) => {
68
+ const from = swipe.current;
69
+ swipe.current = null;
70
+ if (from !== null && !blocking && event.clientY - from >= SWIPE_CLOSE_PX) {
71
+ closeRef.current?.click();
72
+ }
73
+ };
47
74
  return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { children: [
48
- /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: cn("fixed inset-0 z-70 bg-scrim", classNames?.overlay) }),
75
+ /* @__PURE__ */ jsx(
76
+ DialogPrimitive.Overlay,
77
+ {
78
+ className: cn("fixed inset-0 z-70 bg-scrim", OVERLAY_MOTION, classNames?.overlay)
79
+ }
80
+ ),
49
81
  /* @__PURE__ */ jsxs(
50
82
  DialogPrimitive.Content,
51
83
  {
52
84
  className: cn(
53
- "@container/drawer fixed inset-y-0 right-0 z-70 flex h-full w-[min(430px,100%)] max-w-full flex-col overflow-y-auto outline-none surface-overlay shadow-overlay",
85
+ "@container/drawer fixed z-70 flex flex-col overflow-y-auto outline-none surface-overlay shadow-overlay",
86
+ sideClasses[side],
87
+ side === "bottom" ? SHEET_MOTION : DRAWER_MOTION,
54
88
  materialClass(material, "surface-solid"),
55
89
  classNames?.root,
56
90
  className
@@ -73,13 +107,27 @@ function DrawerContent({
73
107
  },
74
108
  ...props,
75
109
  children: [
110
+ showHandle ? /* @__PURE__ */ jsx(
111
+ "div",
112
+ {
113
+ "aria-hidden": "true",
114
+ onPointerDown: swipeStart,
115
+ onPointerUp: swipeEnd,
116
+ onPointerCancel: () => {
117
+ swipe.current = null;
118
+ },
119
+ className: cn("flex shrink-0 touch-none justify-center pt-2 pb-1", classNames?.handle),
120
+ children: /* @__PURE__ */ jsx("span", { className: "h-1 w-9 rounded-pill bg-line-strong" })
121
+ }
122
+ ) : null,
76
123
  children,
77
124
  !blocking && /* @__PURE__ */ jsx(
78
125
  DialogPrimitive.Close,
79
126
  {
127
+ ref: closeRef,
80
128
  "aria-label": closeLabel ?? strings.close,
81
129
  className: cn(
82
- "absolute top-3 right-3 rounded-event p-1 text-ink-3 hover:text-ink in-data-[density=touch]:top-0.5 in-data-[density=touch]:right-0.5 in-data-[density=touch]:p-3.5",
130
+ "absolute top-[calc(0.5625rem-0.4375rem*var(--touch))] right-[calc(0.5625rem-0.4375rem*var(--touch))] flex size-control-sm items-center justify-center rounded-event text-ink-3 hover:text-ink",
83
131
  classNames?.close
84
132
  ),
85
133
  children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-4" })
@@ -96,5 +144,6 @@ export {
96
144
  DrawerContent,
97
145
  DrawerDescription,
98
146
  DrawerTitle,
99
- DrawerTrigger
147
+ DrawerTrigger,
148
+ drawerSideClass
100
149
  };
@@ -1 +1 @@
1
- export { Drawer, DrawerClose, DrawerContent, type DrawerContentPart, type DrawerContentProps, DrawerDescription, DrawerTitle, DrawerTrigger, } from "./drawer.js";
1
+ export { Drawer, DrawerClose, DrawerContent, type DrawerContentPart, type DrawerContentProps, DrawerDescription, type DrawerSide, DrawerTitle, DrawerTrigger, } from "./drawer.js";
@@ -15,7 +15,7 @@ export declare const DropdownMenuAnchor: typeof MenuPrimitive.Anchor;
15
15
  /** The default look of a menu panel: radius, surface, padding and shadow. */
16
16
  export declare const dropdownMenuSurfaceClasses = "rounded-popover surface-overlay p-1.5 shadow-overlay";
17
17
  /** The default look of a menu item, for your own `DropdownMenuItem asChild` or `MenuPrimitive.Item`. */
18
- export declare const dropdownMenuItemClasses = "flex w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
18
+ export declare const dropdownMenuItemClasses = "flex min-h-(--touch-target) w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
19
19
  export interface DropdownMenuContentProps extends MenuPrimitive.MenuContentProps {
20
20
  /** Portal target. Defaults to `document.body`; pass an element to keep a scoped `data-style`. */
21
21
  container?: HTMLElement | null;
@@ -4,6 +4,7 @@ import { Check, ChevronRight } from "../../icons/index.js";
4
4
  import * as MenuPrimitive from "../../primitives/menu/menu.js";
5
5
  import { cn } from "../../utils/cn.js";
6
6
  import { materialClass } from "../../utils/material.js";
7
+ import { ITEM_MOTION, POPPER_MOTION } from "../../utils/overlay-motion.js";
7
8
  const DropdownMenu = MenuPrimitive.Root;
8
9
  const DropdownMenuTrigger = MenuPrimitive.Trigger;
9
10
  const DropdownMenuRadioGroup = MenuPrimitive.RadioGroup;
@@ -13,9 +14,9 @@ const DropdownMenuArrow = MenuPrimitive.Arrow;
13
14
  const DropdownMenuAnchor = MenuPrimitive.Anchor;
14
15
  const placement = "z-85 min-w-[min(14.375rem,var(--ui-popper-available-width))] max-h-(--ui-popper-available-height) max-w-(--ui-popper-available-width) overflow-y-auto";
15
16
  const dropdownMenuSurfaceClasses = "rounded-popover surface-overlay p-1.5 shadow-overlay";
16
- const dropdownMenuItemClasses = "flex w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
17
- const surface = `${placement} ${dropdownMenuSurfaceClasses}`;
18
- const itemBase = dropdownMenuItemClasses;
17
+ const dropdownMenuItemClasses = "flex min-h-(--touch-target) w-full cursor-pointer items-center gap-2 rounded-event px-2.5 py-1.75 text-body text-ink outline-none data-highlighted:bg-surface-2";
18
+ const surface = `${placement} ${POPPER_MOTION} ${dropdownMenuSurfaceClasses}`;
19
+ const itemBase = `${dropdownMenuItemClasses} ${ITEM_MOTION}`;
19
20
  function DropdownMenuContent({
20
21
  className,
21
22
  sideOffset = 6,
@@ -30,7 +31,7 @@ function DropdownMenuContent({
30
31
  {
31
32
  sideOffset,
32
33
  collisionPadding,
33
- className: bare ? cn(placement, className) : cn(surface, materialClass(material, "surface-solid"), className),
34
+ className: bare ? cn(placement, POPPER_MOTION, className) : cn(surface, materialClass(material, "surface-solid"), className),
34
35
  ...props
35
36
  }
36
37
  ) });
@@ -13,6 +13,7 @@ import {
13
13
  import * as PopoverPrimitive from "../../primitives/popover/popover.js";
14
14
  import { cn } from "../../utils/cn.js";
15
15
  import { materialClass } from "../../utils/material.js";
16
+ import { POPPER_MOTION } from "../../utils/overlay-motion.js";
16
17
  import { Slot } from "../../utils/slot.js";
17
18
  const HoverCardContext = createContext(null);
18
19
  function useHoverCard() {
@@ -122,6 +123,7 @@ function HoverCardContent({
122
123
  },
123
124
  className: cn(
124
125
  "z-85 w-72 max-w-(--ui-popper-available-width) rounded-popover border-card surface-overlay p-card text-body text-ink shadow-overlay",
126
+ POPPER_MOTION,
125
127
  materialClass(material, "surface-solid"),
126
128
  className
127
129
  ),
@@ -3,6 +3,7 @@ import { jsx } from "react/jsx-runtime";
3
3
  import * as PopoverPrimitive from "../../primitives/popover/popover.js";
4
4
  import { cn } from "../../utils/cn.js";
5
5
  import { materialClass } from "../../utils/material.js";
6
+ import { POPPER_MOTION } from "../../utils/overlay-motion.js";
6
7
  const Popover = PopoverPrimitive.Root;
7
8
  const PopoverTrigger = PopoverPrimitive.Trigger;
8
9
  const PopoverClose = PopoverPrimitive.Close;
@@ -23,6 +24,7 @@ function PopoverContent({
23
24
  collisionPadding,
24
25
  className: cn(
25
26
  "z-85 min-w-[min(14.375rem,var(--ui-popper-available-width))] max-h-(--ui-popper-available-height) max-w-(--ui-popper-available-width) overflow-y-auto rounded-popover surface-overlay p-1.5 text-ink shadow-overlay",
27
+ POPPER_MOTION,
26
28
  materialClass(material, "surface-solid"),
27
29
  className
28
30
  ),
@@ -1,2 +1,2 @@
1
1
  export type { ToastTone } from "./toast-store.js";
2
- export { type ToastAction, Toaster, type ToasterPart, type ToasterPosition, type ToasterProps, type ToastOptions, toast, toastToneClasses, } from "./toaster.js";
2
+ export { type ToastAction, Toaster, type ToasterOffset, type ToasterPart, type ToasterPosition, type ToasterProps, type ToasterResponsivePosition, type ToastOptions, toast, toastToneClasses, } from "./toaster.js";
@@ -24,6 +24,8 @@ export interface ToastRecord extends Omit<ToastOptions, "id"> {
24
24
  state: "open" | "closed";
25
25
  /** Bumped on every update so timers restart. */
26
26
  revision: number;
27
+ /** Where focus was, nearest first, when the toast was published; focus returns there once the toast leaves. */
28
+ origin: readonly HTMLElement[];
27
29
  }
28
30
  export declare function subscribe(listener: () => void): () => void;
29
31
  export declare function getSnapshot(): readonly ToastRecord[];
@@ -1,3 +1,4 @@
1
+ import { focusChain } from "../../utils/focus-chain.js";
1
2
  const EMPTY = [];
2
3
  let toasts = EMPTY;
3
4
  let counter = 0;
@@ -18,6 +19,9 @@ function getSnapshot() {
18
19
  function getServerSnapshot() {
19
20
  return EMPTY;
20
21
  }
22
+ function currentFocusChain() {
23
+ return typeof document === "undefined" ? [] : focusChain(document.activeElement);
24
+ }
21
25
  function publish(message, tone, options = {}) {
22
26
  const id = options.id ?? `toast-${++counter}`;
23
27
  const existing = toasts.find((t) => t.id === id);
@@ -27,7 +31,8 @@ function publish(message, tone, options = {}) {
27
31
  message,
28
32
  tone,
29
33
  state: "open",
30
- revision: (existing?.revision ?? 0) + 1
34
+ revision: (existing?.revision ?? 0) + 1,
35
+ origin: existing?.origin ?? currentFocusChain()
31
36
  };
32
37
  commit(existing ? toasts.map((t) => t.id === id ? record : t) : [...toasts, record]);
33
38
  return id;
@@ -1,13 +1,33 @@
1
+ import { type CSSProperties } from "react";
1
2
  import type { ClassNames } from "../../utils/class-names.js";
2
3
  import { type ToastTone } from "./toast-store.js";
3
4
  export type { ToastAction, ToastOptions } from "./toast.js";
4
5
  export { toast } from "./toast.js";
5
6
  export type ToasterPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
7
+ /**
8
+ * One position, or one per viewport width: `base` always applies, `sm` from 640 px and `lg` from
9
+ * 1024 px of viewport width (a toast is anchored to the viewport, so these are media queries).
10
+ */
11
+ export type ToasterResponsivePosition = ToasterPosition | {
12
+ base: ToasterPosition;
13
+ sm?: ToasterPosition;
14
+ lg?: ToasterPosition;
15
+ };
16
+ /** Distance from the viewport edges: a number is px, a string is any CSS length (`calc(env(safe-area-inset-bottom) + 4rem)`). */
17
+ export type ToasterOffset = number | string | {
18
+ x?: number | string;
19
+ y?: number | string;
20
+ };
6
21
  export type ToasterPart = "root" | "list" | "toast" | "title" | "description" | "action";
7
22
  export interface ToasterProps {
8
23
  /** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
9
24
  classNames?: ClassNames<ToasterPart>;
10
- position?: ToasterPosition;
25
+ position?: ToasterResponsivePosition;
26
+ /**
27
+ * Distance from the edges the region is anchored to. Defaults to 1rem on both axes; `y` is
28
+ * measured from the top or the bottom edge, whichever the position uses.
29
+ */
30
+ offset?: ToasterOffset;
11
31
  /** Default auto dismiss delay in ms; `Infinity` disables it. */
12
32
  duration?: number;
13
33
  /** Toasts shown at once; older ones wait until a newer one leaves. */
@@ -25,8 +45,14 @@ export interface ToasterProps {
25
45
  }
26
46
  /** Class map behind each tone. `default` is the inverted neutral toast; the others tint the surface. */
27
47
  export declare const toastToneClasses: Readonly<Record<ToastTone, string>>;
48
+ /** Region classes, list direction and offset variables for a position and an offset. */
49
+ export declare function toasterPlacement(position: ToasterResponsivePosition, offset?: ToasterOffset): {
50
+ region: string;
51
+ list: string;
52
+ style: CSSProperties;
53
+ };
28
54
  /**
29
55
  * Ephemeral, non-critical confirmations. Pass `action: { label, onClick }` to
30
56
  * `toast()` for an undo button. Critical messages belong in a banner instead.
31
57
  */
32
- export declare function Toaster({ position, duration, visibleToasts, className, classNames, label, container, dir, }: ToasterProps): import("react").JSX.Element;
58
+ export declare function Toaster({ position, offset, duration, visibleToasts, className, classNames, label, container, dir, }: ToasterProps): import("react").JSX.Element;
@@ -2,6 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import {
4
4
  useEffect,
5
+ useLayoutEffect,
5
6
  useRef,
6
7
  useState,
7
8
  useSyncExternalStore
@@ -10,6 +11,7 @@ import { statusIcon } from "../../atoms/internal/status-icons.js";
10
11
  import { useUiStrings } from "../../i18n/ui-strings-provider.js";
11
12
  import { Portal } from "../../primitives/portal.js";
12
13
  import { cn } from "../../utils/cn.js";
14
+ import { restoreFocusFromChain } from "../../utils/focus-chain.js";
13
15
  import { usePrefersReducedMotion } from "../../utils/reduced-motion.js";
14
16
  import {
15
17
  dismiss,
@@ -50,13 +52,64 @@ const toneGlyphColor = {
50
52
  const EXIT_MS = 200;
51
53
  const SWIPE_THRESHOLD = 60;
52
54
  const POSITION = {
53
- "top-left": "top-4 left-4 items-start",
54
- "top-center": "top-4 left-1/2 -translate-x-1/2 items-center",
55
- "top-right": "top-4 right-4 items-end",
56
- "bottom-left": "bottom-4 left-4 items-start",
57
- "bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center",
58
- "bottom-right": "bottom-4 right-4 items-end"
55
+ "top-left": "top-[var(--toast-y,1rem)] bottom-auto left-[var(--toast-x,1rem)] right-auto translate-x-0 items-start",
56
+ "top-center": "top-[var(--toast-y,1rem)] bottom-auto left-1/2 right-auto -translate-x-1/2 items-center",
57
+ "top-right": "top-[var(--toast-y,1rem)] bottom-auto right-[var(--toast-x,1rem)] left-auto translate-x-0 items-end",
58
+ "bottom-left": "bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] top-auto left-[var(--toast-x,1rem)] right-auto translate-x-0 items-start",
59
+ "bottom-center": "bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] top-auto left-1/2 right-auto -translate-x-1/2 items-center",
60
+ "bottom-right": "bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] top-auto right-[var(--toast-x,1rem)] left-auto translate-x-0 items-end"
59
61
  };
62
+ const POSITION_SM = {
63
+ "top-left": "min-[640px]:top-[var(--toast-y,1rem)] min-[640px]:bottom-auto min-[640px]:left-[var(--toast-x,1rem)] min-[640px]:right-auto min-[640px]:translate-x-0 min-[640px]:items-start",
64
+ "top-center": "min-[640px]:top-[var(--toast-y,1rem)] min-[640px]:bottom-auto min-[640px]:left-1/2 min-[640px]:right-auto min-[640px]:-translate-x-1/2 min-[640px]:items-center",
65
+ "top-right": "min-[640px]:top-[var(--toast-y,1rem)] min-[640px]:bottom-auto min-[640px]:right-[var(--toast-x,1rem)] min-[640px]:left-auto min-[640px]:translate-x-0 min-[640px]:items-end",
66
+ "bottom-left": "min-[640px]:bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] min-[640px]:top-auto min-[640px]:left-[var(--toast-x,1rem)] min-[640px]:right-auto min-[640px]:translate-x-0 min-[640px]:items-start",
67
+ "bottom-center": "min-[640px]:bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] min-[640px]:top-auto min-[640px]:left-1/2 min-[640px]:right-auto min-[640px]:-translate-x-1/2 min-[640px]:items-center",
68
+ "bottom-right": "min-[640px]:bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] min-[640px]:top-auto min-[640px]:right-[var(--toast-x,1rem)] min-[640px]:left-auto min-[640px]:translate-x-0 min-[640px]:items-end"
69
+ };
70
+ const POSITION_LG = {
71
+ "top-left": "min-[1024px]:top-[var(--toast-y,1rem)] min-[1024px]:bottom-auto min-[1024px]:left-[var(--toast-x,1rem)] min-[1024px]:right-auto min-[1024px]:translate-x-0 min-[1024px]:items-start",
72
+ "top-center": "min-[1024px]:top-[var(--toast-y,1rem)] min-[1024px]:bottom-auto min-[1024px]:left-1/2 min-[1024px]:right-auto min-[1024px]:-translate-x-1/2 min-[1024px]:items-center",
73
+ "top-right": "min-[1024px]:top-[var(--toast-y,1rem)] min-[1024px]:bottom-auto min-[1024px]:right-[var(--toast-x,1rem)] min-[1024px]:left-auto min-[1024px]:translate-x-0 min-[1024px]:items-end",
74
+ "bottom-left": "min-[1024px]:bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] min-[1024px]:top-auto min-[1024px]:left-[var(--toast-x,1rem)] min-[1024px]:right-auto min-[1024px]:translate-x-0 min-[1024px]:items-start",
75
+ "bottom-center": "min-[1024px]:bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] min-[1024px]:top-auto min-[1024px]:left-1/2 min-[1024px]:right-auto min-[1024px]:-translate-x-1/2 min-[1024px]:items-center",
76
+ "bottom-right": "min-[1024px]:bottom-[var(--toast-y,calc(var(--app-bottom-bar,0px)_+_1rem))] min-[1024px]:top-auto min-[1024px]:right-[var(--toast-x,1rem)] min-[1024px]:left-auto min-[1024px]:translate-x-0 min-[1024px]:items-end"
77
+ };
78
+ const LIST_ORDER = {
79
+ top: "flex-col-reverse",
80
+ bottom: "flex-col"
81
+ };
82
+ const LIST_ORDER_SM = {
83
+ top: "min-[640px]:flex-col-reverse",
84
+ bottom: "min-[640px]:flex-col"
85
+ };
86
+ const LIST_ORDER_LG = {
87
+ top: "min-[1024px]:flex-col-reverse",
88
+ bottom: "min-[1024px]:flex-col"
89
+ };
90
+ const verticalOf = (position) => position.startsWith("top") ? "top" : "bottom";
91
+ function sideValue(value) {
92
+ return typeof value === "number" ? `${value}px` : value;
93
+ }
94
+ function toasterPlacement(position, offset) {
95
+ const base = typeof position === "string" ? position : position.base;
96
+ const sm = typeof position === "string" ? void 0 : position.sm;
97
+ const lg = typeof position === "string" ? void 0 : position.lg;
98
+ const x = sideValue(typeof offset === "object" ? offset.x : offset);
99
+ const y = sideValue(typeof offset === "object" ? offset.y : offset);
100
+ return {
101
+ region: cn(POSITION[base], sm && POSITION_SM[sm], lg && POSITION_LG[lg]),
102
+ list: cn(
103
+ LIST_ORDER[verticalOf(base)],
104
+ sm && LIST_ORDER_SM[verticalOf(sm)],
105
+ lg && LIST_ORDER_LG[verticalOf(lg)]
106
+ ),
107
+ style: {
108
+ ...x !== void 0 ? { "--toast-x": x } : {},
109
+ ...y !== void 0 ? { "--toast-y": y } : {}
110
+ }
111
+ };
112
+ }
60
113
  function documentDir() {
61
114
  if (typeof document === "undefined") return void 0;
62
115
  const value = document.documentElement.getAttribute("dir");
@@ -97,9 +150,19 @@ function ToastItem({ record, duration, reducedMotion, classNames }) {
97
150
  const [entered, setEntered] = useState(false);
98
151
  const [dragX, setDragX] = useState(0);
99
152
  const drag = useRef(null);
153
+ const rootRef = useRef(null);
100
154
  const hidden = useDocumentHidden();
101
155
  const effectiveDuration = record.duration ?? duration;
102
156
  useDismissTimer(record, effectiveDuration, hovered || focused || hidden);
157
+ const originRef = useRef(record.origin);
158
+ originRef.current = record.origin;
159
+ useLayoutEffect(
160
+ () => () => {
161
+ const current = document.activeElement;
162
+ if (current && rootRef.current?.contains(current)) restoreFocusFromChain(originRef.current);
163
+ },
164
+ []
165
+ );
103
166
  useEffect(() => {
104
167
  const frame = requestAnimationFrame(() => setEntered(true));
105
168
  return () => cancelAnimationFrame(frame);
@@ -143,6 +206,7 @@ function ToastItem({ record, duration, reducedMotion, classNames }) {
143
206
  /* @__PURE__ */ jsxs(
144
207
  "div",
145
208
  {
209
+ ref: rootRef,
146
210
  role: isError ? "alert" : "status",
147
211
  "aria-live": isError ? "assertive" : "polite",
148
212
  "aria-atomic": "true",
@@ -181,7 +245,7 @@ function ToastItem({ record, duration, reducedMotion, classNames }) {
181
245
  {
182
246
  type: "button",
183
247
  className: cn(
184
- "h-8 shrink-0 rounded-button px-3 font-bold focus-ring",
248
+ "h-8 shrink-0 rounded-button px-3 font-bold focus-visible:focus-ring",
185
249
  toneActionClasses[tone],
186
250
  classNames?.action
187
251
  ),
@@ -199,6 +263,7 @@ function ToastItem({ record, duration, reducedMotion, classNames }) {
199
263
  }
200
264
  function Toaster({
201
265
  position = "bottom-center",
266
+ offset,
202
267
  duration = 6e3,
203
268
  visibleToasts = 2,
204
269
  className,
@@ -212,7 +277,7 @@ function Toaster({
212
277
  const records = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
213
278
  const regionRef = useRef(null);
214
279
  const shown = selectVisible(records, visibleToasts);
215
- const fromTop = position.startsWith("top");
280
+ const placement = toasterPlacement(position, offset);
216
281
  useEffect(() => {
217
282
  const onKey = (event) => {
218
283
  if (event.altKey && event.code === "KeyT") regionRef.current?.focus();
@@ -229,37 +294,29 @@ function Toaster({
229
294
  "data-ui-layer-branch": "",
230
295
  "aria-label": label ?? strings.notifications,
231
296
  tabIndex: -1,
297
+ style: placement.style,
232
298
  className: cn(
233
299
  "pointer-events-none fixed z-[1000] flex outline-none",
234
- POSITION[position],
300
+ placement.region,
235
301
  classNames?.root,
236
302
  className
237
303
  ),
238
- children: /* @__PURE__ */ jsx(
239
- "div",
304
+ children: /* @__PURE__ */ jsx("div", { className: cn("m-0 flex list-none gap-2 p-0", placement.list, classNames?.list), children: shown.map((record) => /* @__PURE__ */ jsx(
305
+ ToastItem,
240
306
  {
241
- className: cn(
242
- "m-0 flex list-none gap-2 p-0",
243
- fromTop ? "flex-col-reverse" : "flex-col",
244
- classNames?.list
245
- ),
246
- children: shown.map((record) => /* @__PURE__ */ jsx(
247
- ToastItem,
248
- {
249
- record,
250
- duration,
251
- reducedMotion,
252
- classNames
253
- },
254
- record.id
255
- ))
256
- }
257
- )
307
+ record,
308
+ duration,
309
+ reducedMotion,
310
+ classNames
311
+ },
312
+ record.id
313
+ )) })
258
314
  }
259
315
  ) });
260
316
  }
261
317
  export {
262
318
  Toaster,
263
319
  toast,
264
- toastToneClasses
320
+ toastToneClasses,
321
+ toasterPlacement
265
322
  };
@@ -10,6 +10,7 @@ import { Kbd } from "../../atoms/kbd/kbd.js";
10
10
  import * as PopoverPrimitive from "../../primitives/popover/popover.js";
11
11
  import { cn } from "../../utils/cn.js";
12
12
  import { materialClass } from "../../utils/material.js";
13
+ import { POPPER_MOTION } from "../../utils/overlay-motion.js";
13
14
  import { Slot } from "../../utils/slot.js";
14
15
  import { useControllableState } from "../../utils/use-controllable-state.js";
15
16
  import { opensOnFocus, opensOnHover } from "./model.js";
@@ -99,6 +100,7 @@ function Tooltip({
99
100
  onMouseLeave: () => schedule(false, closeDelay),
100
101
  className: cn(
101
102
  "z-85 flex w-max max-w-[min(16rem,var(--ui-popper-available-width))] items-center gap-2 rounded-popover surface-overlay px-2.5 py-1.5 text-meta text-ink shadow-overlay",
103
+ POPPER_MOTION,
102
104
  materialClass(material, "surface-solid"),
103
105
  classNames?.content,
104
106
  className
@@ -49,6 +49,14 @@ function exitDuration(node) {
49
49
  );
50
50
  return Math.max(animated, transitioned);
51
51
  }
52
+ function stillRunning(node) {
53
+ if (typeof node.getAnimations !== "function") return false;
54
+ return node.getAnimations().some((animation) => {
55
+ if (animation.playState !== "running") return false;
56
+ const property = animation.transitionProperty;
57
+ return property === void 0 || EXIT_PROPERTIES.has(property);
58
+ });
59
+ }
52
60
  function prefersReducedMotion() {
53
61
  return typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : false;
54
62
  }
@@ -68,6 +76,7 @@ function usePresence(present, ref) {
68
76
  if (event.target !== node) return;
69
77
  const property = event.propertyName;
70
78
  if (event.type === "transitionend" && !EXIT_PROPERTIES.has(property)) return;
79
+ if (stillRunning(node)) return;
71
80
  finish();
72
81
  };
73
82
  node.addEventListener("animationend", onEnd);
@@ -25,6 +25,13 @@ export declare const AppShellContext: import("react").Context<AppShellStore | nu
25
25
  export declare function useAppShell(): AppShellState | null;
26
26
  export interface AppShellProps extends ComponentPropsWithRef<"div"> {
27
27
  children: ReactNode;
28
+ /**
29
+ * Phone navigation, usually a `BottomNav`. Rendered after the children and fixed to the bottom
30
+ * edge; while the shell is compact it reserves the bar's height and safe-area inset at the
31
+ * bottom and publishes it as the `--app-bottom-bar` CSS variable (on the shell and on the
32
+ * document root), so sticky bars and the `Toaster` stay above it.
33
+ */
34
+ bottomBar?: ReactNode;
28
35
  }
29
36
  /**
30
37
  * Root of the app frame (sidebar + topbar + page). It is the `app` container: the sidebar turns
@@ -36,5 +43,5 @@ export interface AppShellProps extends ComponentPropsWithRef<"div"> {
36
43
  * the measure arrives, so nothing above a still-dehydrated Suspense boundary re-renders during
37
44
  * hydration (a provider value that changed there made Next.js client-render those boundaries).
38
45
  */
39
- export declare function AppShell({ children, className, ref: forwardedRef, ...props }: AppShellProps): import("react").JSX.Element;
46
+ export declare function AppShell({ children, bottomBar, className, ref: forwardedRef, ...props }: AppShellProps): import("react").JSX.Element;
40
47
  export {};
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import {
4
4
  createContext,
5
5
  useContext,
@@ -67,12 +67,59 @@ function useAppShell() {
67
67
  );
68
68
  return useMemo(() => store ? { compact } : null, [store, compact]);
69
69
  }
70
- function AppShell({ children, className, ref: forwardedRef, ...props }) {
70
+ const BOTTOM_BAR_HEIGHT = "calc(3.5rem + env(safe-area-inset-bottom))";
71
+ function reserveBottomBar(element, compact) {
72
+ for (const target of [element, document.documentElement]) {
73
+ if (compact) target.style.setProperty("--app-bottom-bar", BOTTOM_BAR_HEIGHT);
74
+ else target.style.removeProperty("--app-bottom-bar");
75
+ }
76
+ }
77
+ function AppShell({
78
+ children,
79
+ bottomBar,
80
+ className,
81
+ ref: forwardedRef,
82
+ ...props
83
+ }) {
71
84
  const ref = useRef(null);
72
85
  const [store] = useState(createAppShellStore);
73
86
  const composedRef = useComposedRefs(ref, forwardedRef);
87
+ const hasBottomBar = bottomBar != null && bottomBar !== false;
74
88
  useEffect(() => ref.current ? store.observe(ref.current) : void 0, [store]);
75
- return /* @__PURE__ */ jsx(AppShellContext.Provider, { value: store, children: /* @__PURE__ */ jsx("div", { ref: composedRef, ...props, className: cn("@container/app flex min-w-0", className), children }) });
89
+ useEffect(() => {
90
+ const element = ref.current;
91
+ if (!hasBottomBar || !element) return;
92
+ const sync = () => reserveBottomBar(element, store.getSnapshot());
93
+ sync();
94
+ const unsubscribe = store.subscribe(sync);
95
+ return () => {
96
+ unsubscribe();
97
+ reserveBottomBar(element, false);
98
+ };
99
+ }, [store, hasBottomBar]);
100
+ return /* @__PURE__ */ jsx(AppShellContext.Provider, { value: store, children: /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ ref: composedRef,
104
+ ...props,
105
+ className: cn(
106
+ "@container/app flex min-w-0",
107
+ hasBottomBar && "pb-(--app-bottom-bar,0px)",
108
+ className
109
+ ),
110
+ children: [
111
+ children,
112
+ hasBottomBar ? /* @__PURE__ */ jsx(
113
+ "div",
114
+ {
115
+ "data-app-bottom-bar": "",
116
+ className: "fixed inset-x-0 bottom-0 z-40 @min-[900px]/app:hidden",
117
+ children: bottomBar
118
+ }
119
+ ) : null
120
+ ]
121
+ }
122
+ ) });
76
123
  }
77
124
  export {
78
125
  APP_SHELL_BREAKPOINT,
@@ -1,3 +1,4 @@
1
1
  export * from "./app-shell/index.js";
2
+ export * from "./bottom-nav/index.js";
2
3
  export * from "./sidebar/index.js";
3
4
  export * from "./topbar/index.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./app-shell/index.js";
2
+ export * from "./bottom-nav/index.js";
2
3
  export * from "./sidebar/index.js";
3
4
  export * from "./topbar/index.js";