@jcsoftdev/ui 0.5.0 → 0.6.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 (373) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +25 -3
  3. package/bin/ui-theme.mjs +40 -6
  4. package/dist/ai/code-block/code-block.js +1 -1
  5. package/dist/atoms/big-date/big-date.js +2 -2
  6. package/dist/atoms/button/button.d.ts +6 -1
  7. package/dist/atoms/button/button.js +2 -2
  8. package/dist/atoms/chip/chip.d.ts +5 -0
  9. package/dist/atoms/chip/chip.js +3 -3
  10. package/dist/atoms/icon-button/icon-button.js +1 -1
  11. package/dist/atoms/internal/hit-area.d.ts +5 -4
  12. package/dist/atoms/internal/hit-area.js +1 -1
  13. package/dist/atoms/progress/index.d.ts +1 -1
  14. package/dist/atoms/progress/index.js +4 -1
  15. package/dist/atoms/progress/progress.d.ts +6 -1
  16. package/dist/atoms/progress/progress.js +19 -1
  17. package/dist/atoms/radio-group/radio-group.js +1 -1
  18. package/dist/atoms/status-pill/status-pill.d.ts +16 -5
  19. package/dist/atoms/status-pill/status-pill.js +43 -18
  20. package/dist/brand/logo-forge.js +1 -1
  21. package/dist/charts/candlestick-chart/candlestick-chart.js +2 -2
  22. package/dist/charts/chart-grid/chart-grid.js +2 -2
  23. package/dist/charts/chord-chart/chord-chart.js +1 -1
  24. package/dist/charts/core/axes.js +2 -2
  25. package/dist/charts/core/cartesian/annotations.js +2 -2
  26. package/dist/charts/core/cartesian/marks.js +1 -1
  27. package/dist/charts/core/distribution/marks.js +1 -1
  28. package/dist/charts/core/distribution/xy-points.js +1 -1
  29. package/dist/charts/core/export-menu.js +1 -1
  30. package/dist/charts/funnel-chart/funnel-chart.js +1 -1
  31. package/dist/charts/gantt-chart/gantt-chart.js +4 -4
  32. package/dist/charts/gantt-chart/gantt-marks.js +3 -3
  33. package/dist/charts/index.d.ts +2 -0
  34. package/dist/charts/index.js +2 -0
  35. package/dist/charts/maps/geo/map-data-table.js +1 -1
  36. package/dist/charts/polar-area-chart/polar-area-chart.js +1 -1
  37. package/dist/charts/radar-chart/radar-chart.js +1 -1
  38. package/dist/charts/stock-chart/stock-chart.js +1 -1
  39. package/dist/charts/stock-chart/stock-drawing-layer.js +3 -3
  40. package/dist/charts/stock-chart/stock-plot.js +2 -2
  41. package/dist/containers/chat-thread/chat-thread.d.ts +98 -0
  42. package/dist/containers/chat-thread/chat-thread.js +219 -0
  43. package/dist/containers/chat-thread/format.d.ts +20 -0
  44. package/dist/containers/chat-thread/format.js +50 -0
  45. package/dist/containers/chat-thread/index.d.ts +1 -0
  46. package/dist/containers/chat-thread/index.js +8 -0
  47. package/dist/containers/cols/cols.d.ts +1 -1
  48. package/dist/containers/cols/cols.js +7 -0
  49. package/dist/containers/comment/comment.js +1 -1
  50. package/dist/containers/context-rail/context-rail.d.ts +62 -0
  51. package/dist/containers/context-rail/context-rail.js +175 -0
  52. package/dist/containers/context-rail/index.d.ts +1 -0
  53. package/dist/containers/context-rail/index.js +6 -0
  54. package/dist/containers/dashboard/dashboard.d.ts +40 -0
  55. package/dist/containers/dashboard/dashboard.js +84 -0
  56. package/dist/containers/dashboard/index.d.ts +1 -0
  57. package/dist/containers/dashboard/index.js +14 -0
  58. package/dist/containers/data-grid/data-grid.demos.js +4 -4
  59. package/dist/containers/data-grid/data-grid.js +6 -6
  60. package/dist/containers/data-grid/filter-builder-editor.js +2 -2
  61. package/dist/containers/data-grid/grid-toolbar.js +1 -1
  62. package/dist/containers/data-grid/spreadsheet.demos.d.ts +1 -1
  63. package/dist/containers/data-grid/spreadsheet.demos.js +1 -1
  64. package/dist/containers/detail-header/detail-header.d.ts +24 -0
  65. package/dist/containers/detail-header/detail-header.js +32 -0
  66. package/dist/containers/detail-header/index.d.ts +1 -0
  67. package/dist/containers/detail-header/index.js +6 -0
  68. package/dist/containers/facts/facts.js +1 -1
  69. package/dist/containers/filter-bar/filter-bar.d.ts +58 -0
  70. package/dist/containers/filter-bar/filter-bar.js +123 -0
  71. package/dist/containers/filter-bar/index.d.ts +1 -0
  72. package/dist/containers/filter-bar/index.js +6 -0
  73. package/dist/containers/hbars/hbars.js +2 -2
  74. package/dist/containers/index.d.ts +9 -0
  75. package/dist/containers/index.js +9 -0
  76. package/dist/containers/kanban/kanban.d.ts +23 -2
  77. package/dist/containers/kanban/kanban.js +101 -21
  78. package/dist/containers/kanban/model.d.ts +12 -0
  79. package/dist/containers/kanban/model.js +8 -0
  80. package/dist/containers/kpi/kpi.js +1 -1
  81. package/dist/containers/kpi-group/kpi-group.d.ts +6 -1
  82. package/dist/containers/kpi-group/kpi-group.js +6 -2
  83. package/dist/containers/list-detail/index.d.ts +1 -1
  84. package/dist/containers/list-detail/index.js +4 -0
  85. package/dist/containers/list-detail/list-detail.d.ts +51 -3
  86. package/dist/containers/list-detail/list-detail.js +109 -15
  87. package/dist/containers/page/page.d.ts +17 -4
  88. package/dist/containers/page/page.js +33 -4
  89. package/dist/containers/page-header/back.d.ts +10 -0
  90. package/dist/containers/page-header/back.js +28 -0
  91. package/dist/containers/page-header/index.d.ts +1 -0
  92. package/dist/containers/page-header/index.js +1 -0
  93. package/dist/containers/page-header/page-header.d.ts +19 -2
  94. package/dist/containers/page-header/page-header.js +26 -2
  95. package/dist/containers/pagination/cursor-pagination.d.ts +28 -0
  96. package/dist/containers/pagination/cursor-pagination.js +48 -0
  97. package/dist/containers/pagination/index.d.ts +3 -0
  98. package/dist/containers/pagination/index.js +10 -0
  99. package/dist/containers/pagination/pagination.d.ts +52 -0
  100. package/dist/containers/pagination/pagination.js +216 -0
  101. package/dist/containers/pagination/range.d.ts +29 -0
  102. package/dist/containers/pagination/range.js +42 -0
  103. package/dist/containers/pagination/use-pagination.d.ts +18 -0
  104. package/dist/containers/pagination/use-pagination.js +22 -0
  105. package/dist/containers/responsive-list/responsive-list.d.ts +28 -2
  106. package/dist/containers/responsive-list/responsive-list.js +134 -25
  107. package/dist/containers/row-actions/index.d.ts +1 -0
  108. package/dist/containers/row-actions/index.js +4 -0
  109. package/dist/containers/row-actions/row-actions.d.ts +26 -0
  110. package/dist/containers/row-actions/row-actions.js +78 -0
  111. package/dist/containers/selectable-card/index.d.ts +1 -0
  112. package/dist/containers/selectable-card/index.js +6 -0
  113. package/dist/containers/selectable-card/selectable-card.d.ts +26 -0
  114. package/dist/containers/selectable-card/selectable-card.js +57 -0
  115. package/dist/containers/settings-layout/settings-layout.d.ts +24 -7
  116. package/dist/containers/settings-layout/settings-layout.js +63 -8
  117. package/dist/containers/shortcuts/shortcuts.js +1 -1
  118. package/dist/containers/table/cell-padding.d.ts +2 -0
  119. package/dist/containers/table/cell-padding.js +4 -0
  120. package/dist/containers/table/index.d.ts +1 -0
  121. package/dist/containers/table/index.js +8 -0
  122. package/dist/containers/table/sort.d.ts +14 -0
  123. package/dist/containers/table/sort.js +11 -0
  124. package/dist/containers/table/table-parts.d.ts +24 -0
  125. package/dist/containers/table/table-parts.js +52 -0
  126. package/dist/containers/table/table.d.ts +37 -3
  127. package/dist/containers/table/table.js +120 -19
  128. package/dist/containers/table-columns-menu/index.d.ts +1 -0
  129. package/dist/containers/table-columns-menu/index.js +6 -0
  130. package/dist/containers/table-columns-menu/table-columns-menu.d.ts +14 -0
  131. package/dist/containers/table-columns-menu/table-columns-menu.js +46 -0
  132. package/dist/dashboards/layout.d.ts +1 -27
  133. package/dist/dashboards/layout.js +8 -40
  134. package/dist/forms/chip-group/chip-group.d.ts +5 -0
  135. package/dist/forms/chip-group/chip-group.js +3 -1
  136. package/dist/forms/combobox/combobox.js +1 -1
  137. package/dist/forms/copy-field/copy-field.js +1 -1
  138. package/dist/forms/date-picker/date-picker.d.ts +3 -1
  139. package/dist/forms/date-picker/date-picker.js +4 -2
  140. package/dist/forms/date-picker/date-time-picker.d.ts +8 -2
  141. package/dist/forms/date-picker/date-time-picker.js +13 -2
  142. package/dist/forms/field/field.d.ts +9 -2
  143. package/dist/forms/field/field.js +18 -4
  144. package/dist/forms/fieldset/fieldset.d.ts +11 -0
  145. package/dist/forms/fieldset/fieldset.js +12 -0
  146. package/dist/forms/fieldset/index.d.ts +1 -0
  147. package/dist/forms/fieldset/index.js +4 -0
  148. package/dist/forms/form-footer/form-footer.d.ts +26 -0
  149. package/dist/forms/form-footer/form-footer.js +44 -0
  150. package/dist/forms/form-footer/index.d.ts +1 -0
  151. package/dist/forms/form-footer/index.js +4 -0
  152. package/dist/forms/form-grid/form-grid.d.ts +21 -4
  153. package/dist/forms/form-grid/form-grid.js +20 -3
  154. package/dist/forms/form-grid/index.d.ts +1 -1
  155. package/dist/forms/form-grid/index.js +6 -2
  156. package/dist/forms/form-section/form-section.d.ts +12 -0
  157. package/dist/forms/form-section/form-section.js +30 -0
  158. package/dist/forms/form-section/index.d.ts +1 -0
  159. package/dist/forms/form-section/index.js +4 -0
  160. package/dist/forms/index.d.ts +3 -0
  161. package/dist/forms/index.js +3 -0
  162. package/dist/forms/input/input.d.ts +6 -2
  163. package/dist/forms/input/input.js +4 -1
  164. package/dist/forms/internal/listbox-items.d.ts +1 -1
  165. package/dist/forms/internal/listbox-items.js +3 -2
  166. package/dist/forms/native-select/native-select.js +1 -1
  167. package/dist/forms/select/index.d.ts +1 -1
  168. package/dist/forms/select/select.d.ts +5 -2
  169. package/dist/forms/select/select.js +7 -2
  170. package/dist/forms/select-menu/select-menu.js +1 -1
  171. package/dist/forms/time-input/time-input.d.ts +4 -2
  172. package/dist/forms/time-input/time-input.js +3 -1
  173. package/dist/i18n/strings.d.ts +86 -0
  174. package/dist/i18n/strings.js +46 -0
  175. package/dist/motion/count-up.d.ts +20 -0
  176. package/dist/motion/count-up.js +59 -0
  177. package/dist/motion/cross-fade.d.ts +21 -0
  178. package/dist/motion/cross-fade.js +86 -0
  179. package/dist/motion/index.d.ts +5 -0
  180. package/dist/motion/index.js +14 -0
  181. package/dist/motion/model.d.ts +15 -0
  182. package/dist/motion/model.js +68 -0
  183. package/dist/motion/motion-styles.d.ts +1 -0
  184. package/dist/motion/motion-styles.js +35 -0
  185. package/dist/motion/reveal.d.ts +37 -0
  186. package/dist/motion/reveal.js +69 -0
  187. package/dist/motion/use-enter-phase.d.ts +11 -0
  188. package/dist/motion/use-enter-phase.js +40 -0
  189. package/dist/motion/use-highlight-row.d.ts +22 -0
  190. package/dist/motion/use-highlight-row.js +38 -0
  191. package/dist/navigation/tabs/tabs.js +1 -1
  192. package/dist/navigation/wizard/wizard.d.ts +4 -1
  193. package/dist/navigation/wizard/wizard.js +3 -0
  194. package/dist/overlays/alert-dialog/alert-dialog.js +8 -1
  195. package/dist/overlays/context-menu/context-menu.js +3 -1
  196. package/dist/overlays/dialog/dialog.js +10 -2
  197. package/dist/overlays/drawer/drawer.d.ts +18 -4
  198. package/dist/overlays/drawer/drawer.js +53 -4
  199. package/dist/overlays/drawer/index.d.ts +1 -1
  200. package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +1 -1
  201. package/dist/overlays/dropdown-menu/dropdown-menu.js +5 -4
  202. package/dist/overlays/hover-card/hover-card.js +2 -0
  203. package/dist/overlays/popover/popover.js +2 -0
  204. package/dist/overlays/toaster/index.d.ts +1 -1
  205. package/dist/overlays/toaster/toaster.d.ts +28 -2
  206. package/dist/overlays/toaster/toaster.js +73 -29
  207. package/dist/overlays/tooltip/tooltip.js +2 -0
  208. package/dist/primitives/use-presence.js +9 -0
  209. package/dist/shell/app-shell/app-shell.d.ts +8 -1
  210. package/dist/shell/app-shell/app-shell.js +50 -3
  211. package/dist/shell/index.d.ts +1 -0
  212. package/dist/shell/index.js +1 -0
  213. package/dist/shell/sidebar/sidebar.d.ts +17 -1
  214. package/dist/shell/sidebar/sidebar.js +126 -76
  215. package/dist/shell/topbar/topbar.d.ts +4 -2
  216. package/dist/shell/topbar/topbar.js +2 -0
  217. package/dist/showcase/operations-bento.js +2 -2
  218. package/dist/states/empty-state/empty-state.d.ts +10 -3
  219. package/dist/states/empty-state/empty-state.js +46 -5
  220. package/dist/states/error-state/error-state.js +1 -1
  221. package/dist/states/skeleton/skeleton.js +1 -1
  222. package/dist/utils/class-tokens.generated.js +4 -6
  223. package/dist/utils/list-navigation.d.ts +14 -0
  224. package/dist/utils/list-navigation.js +44 -0
  225. package/dist/utils/overlay-motion.d.ts +12 -0
  226. package/dist/utils/overlay-motion.js +14 -0
  227. package/dist/utils/use-container-width.d.ts +6 -0
  228. package/dist/utils/use-container-width.js +19 -0
  229. package/package.json +2 -2
  230. package/scripts/build-theme.mjs +46 -5
  231. package/src/ai/code-block/code-block.tsx +1 -1
  232. package/src/atoms/big-date/big-date.tsx +2 -2
  233. package/src/atoms/button/button.tsx +8 -3
  234. package/src/atoms/chip/chip.tsx +8 -3
  235. package/src/atoms/icon-button/icon-button.tsx +1 -1
  236. package/src/atoms/internal/hit-area.ts +5 -4
  237. package/src/atoms/progress/index.ts +8 -1
  238. package/src/atoms/progress/progress.tsx +30 -1
  239. package/src/atoms/radio-group/radio-group.tsx +1 -1
  240. package/src/atoms/status-pill/status-pill.tsx +59 -18
  241. package/src/brand/logo-forge.tsx +1 -1
  242. package/src/charts/candlestick-chart/candlestick-chart.tsx +2 -2
  243. package/src/charts/chart-grid/chart-grid.tsx +2 -2
  244. package/src/charts/chord-chart/chord-chart.tsx +1 -1
  245. package/src/charts/core/axes.tsx +2 -2
  246. package/src/charts/core/cartesian/annotations.tsx +2 -2
  247. package/src/charts/core/cartesian/marks.tsx +1 -1
  248. package/src/charts/core/distribution/marks.tsx +1 -1
  249. package/src/charts/core/distribution/xy-points.tsx +1 -1
  250. package/src/charts/core/export-menu.tsx +1 -1
  251. package/src/charts/funnel-chart/funnel-chart.tsx +1 -1
  252. package/src/charts/gantt-chart/gantt-chart.tsx +4 -4
  253. package/src/charts/gantt-chart/gantt-marks.tsx +3 -3
  254. package/src/charts/index.ts +2 -0
  255. package/src/charts/maps/geo/map-data-table.tsx +1 -1
  256. package/src/charts/polar-area-chart/polar-area-chart.tsx +1 -1
  257. package/src/charts/radar-chart/radar-chart.tsx +1 -1
  258. package/src/charts/stock-chart/stock-chart.tsx +1 -1
  259. package/src/charts/stock-chart/stock-drawing-layer.tsx +3 -3
  260. package/src/charts/stock-chart/stock-plot.tsx +2 -2
  261. package/src/containers/chat-thread/chat-thread.tsx +331 -0
  262. package/src/containers/chat-thread/format.ts +67 -0
  263. package/src/containers/chat-thread/index.ts +12 -0
  264. package/src/containers/cols/cols.tsx +13 -1
  265. package/src/containers/comment/comment.tsx +1 -1
  266. package/src/containers/context-rail/context-rail.tsx +229 -0
  267. package/src/containers/context-rail/index.ts +7 -0
  268. package/src/containers/dashboard/dashboard.tsx +142 -0
  269. package/src/containers/dashboard/index.ts +12 -0
  270. package/src/containers/data-grid/data-grid.demos.tsx +4 -4
  271. package/src/containers/data-grid/data-grid.tsx +6 -6
  272. package/src/containers/data-grid/filter-builder-editor.tsx +2 -2
  273. package/src/containers/data-grid/grid-toolbar.tsx +1 -1
  274. package/src/containers/data-grid/spreadsheet.demos.tsx +1 -1
  275. package/src/containers/detail-header/detail-header.tsx +64 -0
  276. package/src/containers/detail-header/index.ts +5 -0
  277. package/src/containers/facts/facts.tsx +1 -1
  278. package/src/containers/filter-bar/filter-bar.tsx +201 -0
  279. package/src/containers/filter-bar/index.ts +7 -0
  280. package/src/containers/hbars/hbars.tsx +2 -2
  281. package/src/containers/index.ts +9 -0
  282. package/src/containers/kanban/kanban.tsx +146 -39
  283. package/src/containers/kanban/model.ts +20 -0
  284. package/src/containers/kpi/kpi.tsx +1 -1
  285. package/src/containers/kpi-group/kpi-group.tsx +17 -2
  286. package/src/containers/list-detail/index.ts +5 -0
  287. package/src/containers/list-detail/list-detail.tsx +157 -9
  288. package/src/containers/page/page.tsx +61 -7
  289. package/src/containers/page-header/back.tsx +42 -0
  290. package/src/containers/page-header/index.ts +1 -0
  291. package/src/containers/page-header/page-header.tsx +49 -3
  292. package/src/containers/pagination/cursor-pagination.tsx +79 -0
  293. package/src/containers/pagination/index.ts +7 -0
  294. package/src/containers/pagination/pagination.tsx +266 -0
  295. package/src/containers/pagination/range.ts +68 -0
  296. package/src/containers/pagination/use-pagination.ts +44 -0
  297. package/src/containers/responsive-list/responsive-list.tsx +183 -46
  298. package/src/containers/row-actions/index.ts +1 -0
  299. package/src/containers/row-actions/row-actions.tsx +114 -0
  300. package/src/containers/selectable-card/index.ts +5 -0
  301. package/src/containers/selectable-card/selectable-card.tsx +84 -0
  302. package/src/containers/settings-layout/settings-layout.tsx +104 -13
  303. package/src/containers/shortcuts/shortcuts.tsx +1 -1
  304. package/src/containers/table/cell-padding.ts +2 -0
  305. package/src/containers/table/index.ts +6 -0
  306. package/src/containers/table/sort.ts +23 -0
  307. package/src/containers/table/table-parts.tsx +81 -0
  308. package/src/containers/table/table.tsx +212 -45
  309. package/src/containers/table-columns-menu/index.ts +5 -0
  310. package/src/containers/table-columns-menu/table-columns-menu.tsx +68 -0
  311. package/src/dashboards/layout.tsx +8 -75
  312. package/src/forms/chip-group/chip-group.tsx +8 -1
  313. package/src/forms/combobox/combobox.tsx +1 -1
  314. package/src/forms/copy-field/copy-field.tsx +1 -1
  315. package/src/forms/date-picker/date-picker.tsx +7 -2
  316. package/src/forms/date-picker/date-time-picker.tsx +28 -2
  317. package/src/forms/field/field.tsx +30 -3
  318. package/src/forms/fieldset/fieldset.tsx +22 -0
  319. package/src/forms/fieldset/index.ts +1 -0
  320. package/src/forms/form-footer/form-footer.tsx +74 -0
  321. package/src/forms/form-footer/index.ts +1 -0
  322. package/src/forms/form-grid/form-grid.tsx +42 -5
  323. package/src/forms/form-grid/index.ts +8 -1
  324. package/src/forms/form-section/form-section.tsx +41 -0
  325. package/src/forms/form-section/index.ts +1 -0
  326. package/src/forms/index.ts +3 -0
  327. package/src/forms/input/input.tsx +10 -3
  328. package/src/forms/internal/listbox-items.tsx +3 -4
  329. package/src/forms/native-select/native-select.tsx +1 -1
  330. package/src/forms/select/index.ts +1 -1
  331. package/src/forms/select/select.tsx +14 -3
  332. package/src/forms/select-menu/select-menu.tsx +1 -1
  333. package/src/forms/time-input/time-input.tsx +6 -2
  334. package/src/i18n/strings.ts +86 -0
  335. package/src/motion/count-up.tsx +83 -0
  336. package/src/motion/cross-fade.tsx +139 -0
  337. package/src/motion/index.ts +5 -0
  338. package/src/motion/model.ts +86 -0
  339. package/src/motion/motion-styles.tsx +47 -0
  340. package/src/motion/reveal.tsx +115 -0
  341. package/src/motion/use-enter-phase.ts +50 -0
  342. package/src/motion/use-highlight-row.ts +63 -0
  343. package/src/navigation/tabs/tabs.tsx +1 -1
  344. package/src/navigation/wizard/wizard.tsx +6 -1
  345. package/src/overlays/alert-dialog/alert-dialog.tsx +5 -1
  346. package/src/overlays/context-menu/context-menu.tsx +3 -2
  347. package/src/overlays/dialog/dialog.tsx +7 -2
  348. package/src/overlays/drawer/drawer.tsx +68 -6
  349. package/src/overlays/drawer/index.ts +1 -0
  350. package/src/overlays/dropdown-menu/dropdown-menu.tsx +5 -4
  351. package/src/overlays/hover-card/hover-card.tsx +2 -0
  352. package/src/overlays/popover/popover.tsx +2 -0
  353. package/src/overlays/toaster/index.ts +2 -0
  354. package/src/overlays/toaster/toaster.tsx +113 -17
  355. package/src/overlays/tooltip/tooltip.tsx +2 -0
  356. package/src/primitives/use-presence.ts +13 -0
  357. package/src/shell/app-shell/app-shell.tsx +54 -2
  358. package/src/shell/index.ts +1 -0
  359. package/src/shell/sidebar/sidebar.tsx +154 -75
  360. package/src/shell/topbar/topbar.tsx +8 -0
  361. package/src/showcase/operations-bento.tsx +2 -2
  362. package/src/states/empty-state/empty-state.tsx +52 -9
  363. package/src/states/error-state/error-state.tsx +1 -1
  364. package/src/states/skeleton/skeleton.tsx +1 -1
  365. package/src/utils/class-tokens.generated.ts +4 -6
  366. package/src/utils/list-navigation.ts +63 -0
  367. package/src/utils/overlay-motion.ts +33 -0
  368. package/src/utils/use-container-width.ts +24 -0
  369. package/styles/Theme.kt +15 -18
  370. package/styles/tailwind.css +29 -28
  371. package/styles/theme.css +29 -28
  372. package/styles/tokens.css +46 -0
  373. package/tokens/default.json +51 -29
@@ -105,6 +105,23 @@ export function useAppShell(): AppShellState | null {
105
105
 
106
106
  export interface AppShellProps extends ComponentPropsWithRef<"div"> {
107
107
  children: ReactNode;
108
+ /**
109
+ * Phone navigation, usually a `BottomNav`. Rendered after the children and fixed to the bottom
110
+ * edge; while the shell is compact it reserves the bar's height and safe-area inset at the
111
+ * bottom and publishes it as the `--app-bottom-bar` CSS variable (on the shell and on the
112
+ * document root), so sticky bars and the `Toaster` stay above it.
113
+ */
114
+ bottomBar?: ReactNode;
115
+ }
116
+
117
+ const BOTTOM_BAR_HEIGHT = "calc(3.5rem + env(safe-area-inset-bottom))";
118
+
119
+ /** Publishes `--app-bottom-bar` on the shell and the document root while the shell is compact. */
120
+ function reserveBottomBar(element: HTMLElement, compact: boolean) {
121
+ for (const target of [element, document.documentElement]) {
122
+ if (compact) target.style.setProperty("--app-bottom-bar", BOTTOM_BAR_HEIGHT);
123
+ else target.style.removeProperty("--app-bottom-bar");
124
+ }
108
125
  }
109
126
 
110
127
  /**
@@ -117,17 +134,52 @@ export interface AppShellProps extends ComponentPropsWithRef<"div"> {
117
134
  * the measure arrives, so nothing above a still-dehydrated Suspense boundary re-renders during
118
135
  * hydration (a provider value that changed there made Next.js client-render those boundaries).
119
136
  */
120
- export function AppShell({ children, className, ref: forwardedRef, ...props }: AppShellProps) {
137
+ export function AppShell({
138
+ children,
139
+ bottomBar,
140
+ className,
141
+ ref: forwardedRef,
142
+ ...props
143
+ }: AppShellProps) {
121
144
  const ref = useRef<HTMLDivElement>(null);
122
145
  const [store] = useState(createAppShellStore);
123
146
  const composedRef = useComposedRefs(ref, forwardedRef);
147
+ const hasBottomBar = bottomBar != null && bottomBar !== false;
124
148
 
125
149
  useEffect(() => (ref.current ? store.observe(ref.current) : undefined), [store]);
126
150
 
151
+ useEffect(() => {
152
+ const element = ref.current;
153
+ if (!hasBottomBar || !element) return;
154
+ const sync = () => reserveBottomBar(element, store.getSnapshot());
155
+ sync();
156
+ const unsubscribe = store.subscribe(sync);
157
+ return () => {
158
+ unsubscribe();
159
+ reserveBottomBar(element, false);
160
+ };
161
+ }, [store, hasBottomBar]);
162
+
127
163
  return (
128
164
  <AppShellContext.Provider value={store}>
129
- <div ref={composedRef} {...props} className={cn("@container/app flex min-w-0", className)}>
165
+ <div
166
+ ref={composedRef}
167
+ {...props}
168
+ className={cn(
169
+ "@container/app flex min-w-0",
170
+ hasBottomBar && "pb-(--app-bottom-bar,0px)",
171
+ className,
172
+ )}
173
+ >
130
174
  {children}
175
+ {hasBottomBar ? (
176
+ <div
177
+ data-app-bottom-bar=""
178
+ className="fixed inset-x-0 bottom-0 z-40 @min-[900px]/app:hidden"
179
+ >
180
+ {bottomBar}
181
+ </div>
182
+ ) : null}
131
183
  </div>
132
184
  </AppShellContext.Provider>
133
185
  );
@@ -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,9 +1,11 @@
1
1
  "use client";
2
2
 
3
- import { type CSSProperties, type ReactNode, useEffect, useRef } from "react";
3
+ import { type CSSProperties, type ReactNode, useEffect, useId, useRef } from "react";
4
+ import { ChevronDown } from "../../icons/index.js";
4
5
  import type { ClassNames } from "../../utils/class-names.js";
5
6
  import { cn } from "../../utils/cn.js";
6
7
  import { type Material, materialClass } from "../../utils/material.js";
8
+ import { useControllableState } from "../../utils/use-controllable-state.js";
7
9
  import { useAppShell, useCompactContainer } from "../app-shell/app-shell.js";
8
10
 
9
11
  export interface SidebarLinkProps {
@@ -35,12 +37,28 @@ export interface SidebarGroup {
35
37
  id: string;
36
38
  label: string;
37
39
  items: SidebarItem[];
40
+ /**
41
+ * Turns the group label into a button that shows or hides the items (`aria-expanded`). Ignored
42
+ * in rail mode, where every item stays visible.
43
+ */
44
+ collapsible?: boolean;
45
+ /**
46
+ * Starts collapsed when `collapsible`. A group that contains the active item starts open
47
+ * regardless, and an uncontrolled group opens when one of its items becomes active later, so
48
+ * the current page is never hidden.
49
+ */
50
+ defaultCollapsed?: boolean;
51
+ /** Controlled collapsed state of a `collapsible` group. */
52
+ collapsed?: boolean;
53
+ onCollapsedChange?: (collapsed: boolean) => void;
38
54
  }
39
55
 
40
56
  export type SidebarPart =
41
57
  | "root"
42
58
  | "group"
43
59
  | "groupLabel"
60
+ | "groupToggle"
61
+ | "groupItems"
44
62
  | "item"
45
63
  | "link"
46
64
  | "label"
@@ -81,6 +99,135 @@ const defaultRenderLink: SidebarRenderLink = ({ children, ...props }) => (
81
99
  <a {...props}>{children}</a>
82
100
  );
83
101
 
102
+ interface SidebarGroupSectionProps {
103
+ group: SidebarGroup;
104
+ rail: boolean;
105
+ renderLink: SidebarRenderLink;
106
+ classNames: ClassNames<SidebarPart> | undefined;
107
+ }
108
+
109
+ /** Whether an uncontrolled group must open: one of its items just became the active page. */
110
+ export function opensOnActivation(
111
+ wasActive: boolean,
112
+ isActive: boolean,
113
+ controlled: boolean,
114
+ ): boolean {
115
+ return isActive && !wasActive && !controlled;
116
+ }
117
+
118
+ function SidebarGroupSection({ group, rail, renderLink, classNames }: SidebarGroupSectionProps) {
119
+ const itemsId = useId();
120
+ const collapsible = group.collapsible === true && !rail;
121
+ const holdsActive = group.items.some((item) => item.active);
122
+ const [collapsedState, setCollapsed] = useControllableState<boolean>({
123
+ prop: group.collapsed,
124
+ defaultProp: (group.defaultCollapsed ?? false) && !holdsActive,
125
+ onChange: group.onCollapsedChange,
126
+ });
127
+ const collapsed = collapsible && collapsedState;
128
+ const wasActive = useRef(holdsActive);
129
+ const uncontrolled = group.collapsed === undefined;
130
+ useEffect(() => {
131
+ if (opensOnActivation(wasActive.current, holdsActive, !uncontrolled)) setCollapsed(false);
132
+ wasActive.current = holdsActive;
133
+ }, [holdsActive, uncontrolled, setCollapsed]);
134
+ return (
135
+ <nav aria-label={group.label} className={cn("flex flex-col gap-px", classNames?.group)}>
136
+ {collapsible ? (
137
+ <button
138
+ type="button"
139
+ aria-expanded={!collapsed}
140
+ aria-controls={itemsId}
141
+ onClick={() => setCollapsed(!collapsed)}
142
+ className={cn(
143
+ "flex w-full items-center gap-1 rounded-control px-2.5 pb-1.5 text-left text-overline text-ink-3 hover:text-ink focus-visible:focus-ring",
144
+ classNames?.groupLabel,
145
+ classNames?.groupToggle,
146
+ )}
147
+ >
148
+ <span className="min-w-0 flex-1 truncate">{group.label}</span>
149
+ <ChevronDown
150
+ aria-hidden="true"
151
+ className={cn("size-3.5 shrink-0 transition-transform", collapsed && "-rotate-90")}
152
+ />
153
+ </button>
154
+ ) : (
155
+ <div
156
+ className={cn(
157
+ "px-2.5 pb-1.5 text-overline text-ink-3",
158
+ rail && "sr-only",
159
+ classNames?.groupLabel,
160
+ )}
161
+ >
162
+ {group.label}
163
+ </div>
164
+ )}
165
+ <div
166
+ id={itemsId}
167
+ hidden={collapsed}
168
+ className={cn("flex flex-col gap-px", classNames?.groupItems)}
169
+ >
170
+ {group.items.map((item) => {
171
+ const badgeTone =
172
+ item.badgeTone === "danger" ? "bg-danger-soft text-danger" : "bg-surface-2 text-ink-2";
173
+ return (
174
+ <div key={item.id} className={classNames?.item}>
175
+ {renderLink({
176
+ href: item.href,
177
+ "aria-current": item.active ? "page" : undefined,
178
+ title: rail ? item.label : undefined,
179
+ className: cn(
180
+ "flex min-h-(--touch-target) items-center gap-2.5 rounded-control px-2.5 py-2 text-control text-ink-2 hover:bg-surface-2 hover:text-ink [&_svg]:size-4.25 [&_svg]:shrink-0",
181
+ rail && "relative justify-center",
182
+ item.active && "bg-accent-soft font-bold text-accent-ink",
183
+ classNames?.link,
184
+ ),
185
+ children: (
186
+ <>
187
+ {item.icon}
188
+ <span className={cn("min-w-0 truncate", rail && "sr-only", classNames?.label)}>
189
+ {item.label}
190
+ </span>
191
+ {item.badge !== undefined && rail ? (
192
+ <>
193
+ <span
194
+ aria-hidden="true"
195
+ className={cn(
196
+ "absolute top-1 right-1 size-2 rounded-full ring-2 ring-surface",
197
+ item.badgeTone === "danger" ? "bg-danger" : "bg-accent",
198
+ classNames?.badge,
199
+ )}
200
+ />
201
+ <span className="sr-only">
202
+ {item.badge}
203
+ {item.badgeLabel ? ` ${item.badgeLabel}` : null}
204
+ </span>
205
+ </>
206
+ ) : item.badge !== undefined ? (
207
+ <span
208
+ className={cn(
209
+ "ml-auto shrink-0 rounded-chip px-1.5 py-0.75 text-count",
210
+ badgeTone,
211
+ classNames?.badge,
212
+ )}
213
+ >
214
+ {item.badge}
215
+ {item.badgeLabel ? (
216
+ <span className="sr-only"> {item.badgeLabel}</span>
217
+ ) : null}
218
+ </span>
219
+ ) : null}
220
+ </>
221
+ ),
222
+ })}
223
+ </div>
224
+ );
225
+ })}
226
+ </div>
227
+ </nav>
228
+ );
229
+ }
230
+
84
231
  /**
85
232
  * Main navigation. Always visible when its app container is wide; an off-canvas drawer under
86
233
  * 900 px of container width, `inert` while closed so it is not reachable by keyboard.
@@ -153,81 +300,13 @@ export function Sidebar({
153
300
  >
154
301
  {header}
155
302
  {groups.map((group) => (
156
- <nav
303
+ <SidebarGroupSection
157
304
  key={group.id}
158
- aria-label={group.label}
159
- className={cn("flex flex-col gap-px", classNames?.group)}
160
- >
161
- <div
162
- className={cn(
163
- "px-2.5 pb-1.5 text-overline text-ink-3",
164
- rail && "sr-only",
165
- classNames?.groupLabel,
166
- )}
167
- >
168
- {group.label}
169
- </div>
170
- {group.items.map((item) => {
171
- const badgeTone =
172
- item.badgeTone === "danger"
173
- ? "bg-danger-soft text-danger"
174
- : "bg-surface-2 text-ink-2";
175
- return (
176
- <div key={item.id} className={classNames?.item}>
177
- {renderLink({
178
- href: item.href,
179
- "aria-current": item.active ? "page" : undefined,
180
- title: rail ? item.label : undefined,
181
- className: cn(
182
- "flex items-center gap-2.5 rounded-control px-2.5 py-2 text-control text-ink-2 hover:bg-surface-2 hover:text-ink [&_svg]:size-4.25 [&_svg]:shrink-0",
183
- rail && "relative justify-center in-data-[density=touch]:min-h-11",
184
- item.active && "bg-accent-soft font-bold text-accent-ink",
185
- classNames?.link,
186
- ),
187
- children: (
188
- <>
189
- {item.icon}
190
- <span
191
- className={cn("min-w-0 truncate", rail && "sr-only", classNames?.label)}
192
- >
193
- {item.label}
194
- </span>
195
- {item.badge !== undefined && rail ? (
196
- <>
197
- <span
198
- aria-hidden="true"
199
- className={cn(
200
- "absolute top-1 right-1 size-2 rounded-full ring-2 ring-surface",
201
- item.badgeTone === "danger" ? "bg-danger" : "bg-accent",
202
- classNames?.badge,
203
- )}
204
- />
205
- <span className="sr-only">
206
- {item.badge}
207
- {item.badgeLabel ? ` ${item.badgeLabel}` : null}
208
- </span>
209
- </>
210
- ) : item.badge !== undefined ? (
211
- <span
212
- className={cn(
213
- "ml-auto shrink-0 rounded-chip px-1.5 py-0.75 text-count",
214
- badgeTone,
215
- classNames?.badge,
216
- )}
217
- >
218
- {item.badge}
219
- {item.badgeLabel ? (
220
- <span className="sr-only"> {item.badgeLabel}</span>
221
- ) : null}
222
- </span>
223
- ) : null}
224
- </>
225
- ),
226
- })}
227
- </div>
228
- );
229
- })}
230
- </nav>
305
+ group={group}
306
+ rail={rail}
307
+ renderLink={renderLink}
308
+ classNames={classNames}
309
+ />
231
310
  ))}
232
311
  {footer ? <div className={cn("mt-auto", classNames?.footer)}>{footer}</div> : null}
233
312
  </aside>
@@ -15,6 +15,7 @@ export type TopbarPart =
15
15
  | "root"
16
16
  | "inner"
17
17
  | "menuButton"
18
+ | "start"
18
19
  | "breadcrumbs"
19
20
  | "crumb"
20
21
  | "separator"
@@ -24,6 +25,8 @@ export type TopbarPart =
24
25
  | "shortcut";
25
26
 
26
27
  export interface TopbarProps {
28
+ /** Slot at the far start, after the menu button and before the breadcrumbs (a logo, a venue switcher). */
29
+ start?: ReactNode;
27
30
  /** Breadcrumb trail in order; the last entry is the current view. Nothing renders when absent or empty. */
28
31
  breadcrumbs?: string[];
29
32
  /** Accessible name of the breadcrumb landmark. */
@@ -57,6 +60,7 @@ export interface TopbarProps {
57
60
  }
58
61
 
59
62
  export function Topbar({
63
+ start,
60
64
  breadcrumbs,
61
65
  breadcrumbsLabel,
62
66
  onOpenMenu,
@@ -124,6 +128,10 @@ export function Topbar({
124
128
  </button>
125
129
  ) : null}
126
130
 
131
+ {start ? (
132
+ <div className={cn("flex shrink-0 items-center", classNames?.start)}>{start}</div>
133
+ ) : null}
134
+
127
135
  {trail.length > 0 ? (
128
136
  <nav
129
137
  aria-label={breadcrumbsLabel}
@@ -395,7 +395,7 @@ export function OperationsBento() {
395
395
  rows={4}
396
396
  index={0}
397
397
  flush
398
- aside={<StatusPill status="success" label="Caja abierta" />}
398
+ aside={<StatusPill status="success" label="Caja abierta" collapseLabel />}
399
399
  >
400
400
  <div className="h-full pl-3">
401
401
  <WeekView
@@ -443,7 +443,7 @@ export function OperationsBento() {
443
443
  </div>
444
444
  <Progress value={barbero.carga} aria-label={`Carga de ${barbero.name}`} />
445
445
  </div>
446
- <StatusPill status={barbero.estado} label={barbero.texto} />
446
+ <StatusPill status={barbero.estado} label={barbero.texto} collapseLabel />
447
447
  </li>
448
448
  ))}
449
449
  </ul>
@@ -1,49 +1,92 @@
1
1
  import type { ReactNode } from "react";
2
+ import { Inbox, Lock, Search } from "../../icons/index.js";
2
3
  import { cn } from "../../utils/cn.js";
3
4
 
5
+ /** Domain icons shipped with the state: nothing yet, nothing found, not allowed. */
6
+ export type EmptyStateIconName = "inbox" | "search" | "lock";
7
+
8
+ const DOMAIN_ICONS = { inbox: Inbox, search: Search, lock: Lock } as const;
9
+
4
10
  export interface EmptyStateProps {
5
- /** Decorative icon; hidden from screen readers. */
6
- icon?: ReactNode;
11
+ /** Decorative icon (hidden from screen readers): a node, or `"inbox"`, `"search"`, `"lock"`. */
12
+ icon?: ReactNode | EmptyStateIconName;
7
13
  title: ReactNode;
8
14
  description?: ReactNode;
9
15
  /** Primary call to action. */
10
16
  action?: ReactNode;
11
17
  /** `outlined` draws a dashed border around the state. */
12
18
  variant?: "plain" | "outlined";
19
+ /**
20
+ * `md` (default) is the centered block state. `sm` is the inline state for a list, a table cell
21
+ * or a card body: one muted row (icon, title, description) with the action after it.
22
+ */
23
+ size?: "sm" | "md";
13
24
  className?: string;
14
25
  }
15
26
 
27
+ function renderIcon(icon: EmptyStateProps["icon"], iconClass: string): ReactNode {
28
+ if (typeof icon === "string" && icon in DOMAIN_ICONS) {
29
+ const Domain = DOMAIN_ICONS[icon as EmptyStateIconName];
30
+ return <Domain className={iconClass} />;
31
+ }
32
+ return icon;
33
+ }
34
+
16
35
  export function EmptyState({
17
36
  icon,
18
37
  title,
19
38
  description,
20
39
  action,
21
40
  variant = "plain",
41
+ size = "md",
22
42
  className,
23
43
  }: EmptyStateProps) {
44
+ const small = size === "sm";
45
+ const iconNode = icon ? renderIcon(icon, small ? "size-4" : "size-8") : null;
24
46
  return (
25
47
  <div
48
+ data-size={size}
26
49
  className={cn(
27
- "@container/empty flex min-w-0 flex-col items-center gap-2 px-4 py-8 text-center @min-[360px]/empty:px-6 @min-[360px]/empty:py-12",
50
+ "@container/empty flex min-w-0",
51
+ small
52
+ ? "flex-wrap items-center gap-x-2 gap-y-1 px-1 py-2 text-fs-130 text-ink-3"
53
+ : "flex-col items-center gap-2 px-4 py-8 text-center @min-[360px]/empty:px-6 @min-[360px]/empty:py-12",
28
54
  variant === "outlined" && "rounded-card border border-line-control border-dashed",
29
55
  className,
30
56
  )}
31
57
  >
32
- {icon ? (
33
- <span aria-hidden="true" className="text-ink-3">
34
- {icon}
58
+ {iconNode ? (
59
+ <span aria-hidden="true" className="shrink-0 text-ink-3">
60
+ {iconNode}
35
61
  </span>
36
62
  ) : null}
37
- <p className="max-w-full font-semibold text-fs-140 text-ink [overflow-wrap:anywhere]">
63
+ <p
64
+ className={cn(
65
+ "max-w-full [overflow-wrap:anywhere]",
66
+ small ? "font-medium" : "font-semibold text-fs-140 text-ink",
67
+ )}
68
+ >
38
69
  {title}
39
70
  </p>
40
71
  {description ? (
41
- <p className="max-w-[42ch] text-fs-130 text-ink-3 [overflow-wrap:anywhere]">
72
+ <p
73
+ className={cn(
74
+ "[overflow-wrap:anywhere]",
75
+ small ? "min-w-0" : "max-w-[42ch] text-fs-130 text-ink-3",
76
+ )}
77
+ >
42
78
  {description}
43
79
  </p>
44
80
  ) : null}
45
81
  {action ? (
46
- <div className="mt-2 flex max-w-full flex-wrap justify-center gap-2">{action}</div>
82
+ <div
83
+ className={cn(
84
+ "flex max-w-full flex-wrap gap-2",
85
+ small ? "ms-1 items-center" : "mt-2 justify-center",
86
+ )}
87
+ >
88
+ {action}
89
+ </div>
47
90
  ) : null}
48
91
  </div>
49
92
  );
@@ -59,7 +59,7 @@ export function ErrorState({
59
59
  <p className="max-w-[42ch] text-fs-130 text-ink-3 [overflow-wrap:anywhere]">{detail}</p>
60
60
  ) : null}
61
61
  {correlationId ? (
62
- <p className="max-w-full text-fs-115 text-ink-3 tabular-nums [overflow-wrap:anywhere]">
62
+ <p className="max-w-full text-fs-120 text-ink-3 tabular-nums [overflow-wrap:anywhere]">
63
63
  {correlationLabel ?? strings.correlationPrefix} {correlationId}
64
64
  </p>
65
65
  ) : null}
@@ -80,7 +80,7 @@ export function Skeleton({
80
80
  {items(count, (id, index) => (
81
81
  <div
82
82
  key={id}
83
- className="grid min-h-11 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-b-divider py-2.5 in-data-[density=touch]:min-h-14"
83
+ className="grid min-h-[calc(2.75rem+0.75rem*var(--touch))] grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-b-divider py-2.5"
84
84
  >
85
85
  <span className="flex flex-col gap-1.5">
86
86
  <Bar className={index % 2 === 0 ? "w-2/5" : "w-1/2"} />
@@ -22,19 +22,15 @@ export const TEXT_SIZES: readonly string[] = [
22
22
  "m-body",
23
23
  "m-button",
24
24
  "m-meta",
25
- "fs-95",
26
25
  "fs-100",
27
- "fs-105",
28
26
  "fs-110",
29
- "fs-115",
30
27
  "fs-120",
31
- "fs-125",
32
28
  "fs-130",
33
29
  "fs-140",
34
30
  "fs-150",
35
31
  "fs-160",
36
- "fs-220",
37
- "fs-300",
32
+ "fs-200",
33
+ "fs-240",
38
34
  "fs-440",
39
35
  ];
40
36
 
@@ -81,6 +77,7 @@ export const SPACINGS: readonly string[] = [
81
77
  "top-height",
82
78
  "control-height",
83
79
  "control-height-sm",
80
+ "control-height-md",
84
81
  "control-height-lg",
85
82
  "input-height",
86
83
  "agenda-hour",
@@ -91,6 +88,7 @@ export const SPACINGS: readonly string[] = [
91
88
  "m-hour",
92
89
  "control",
93
90
  "control-sm",
91
+ "control-md",
94
92
  "control-lg",
95
93
  "input",
96
94
  "control-x",
@@ -0,0 +1,63 @@
1
+ export type ListNavigationKey = "ArrowUp" | "ArrowDown" | "Home" | "End";
2
+
3
+ const NAVIGATION_KEYS: readonly string[] = ["ArrowUp", "ArrowDown", "Home", "End"];
4
+
5
+ export function isListNavigationKey(key: string): key is ListNavigationKey {
6
+ return NAVIGATION_KEYS.includes(key);
7
+ }
8
+
9
+ /**
10
+ * The key a navigation key lands on, given the keys in DOM order and the current one.
11
+ * Returns `undefined` for other keys, an unknown current key past the ends, or when nothing moves.
12
+ */
13
+ export function listNavigationTarget(
14
+ keys: readonly string[],
15
+ current: string | null | undefined,
16
+ key: string,
17
+ ): string | undefined {
18
+ if (!isListNavigationKey(key) || keys.length === 0) return undefined;
19
+ const index = current == null ? -1 : keys.indexOf(current);
20
+ let next: number;
21
+ if (key === "Home") next = 0;
22
+ else if (key === "End") next = keys.length - 1;
23
+ else if (key === "ArrowDown") next = Math.min(keys.length - 1, index + 1);
24
+ else next = index < 0 ? 0 : Math.max(0, index - 1);
25
+ const target = keys[next];
26
+ return target === current ? undefined : target;
27
+ }
28
+
29
+ const ROW_ATTR = "data-row-key";
30
+
31
+ function rowElements(container: Element): HTMLElement[] {
32
+ return Array.from(container.querySelectorAll<HTMLElement>(`[${ROW_ATTR}]`)).filter(
33
+ (el) => el.closest("[data-row-scope]") === container && el.getClientRects().length > 0,
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Moves focus between the `data-row-key` rows of a `data-row-scope` container for a navigation
39
+ * key. Returns the row focused, or `undefined` when the key is not handled.
40
+ */
41
+ export function focusRowByKey(
42
+ container: Element,
43
+ current: Element,
44
+ key: string,
45
+ ): HTMLElement | undefined {
46
+ const rows = rowElements(container);
47
+ const keys = rows.map((row) => row.getAttribute(ROW_ATTR) ?? "");
48
+ const from = current.getAttribute(ROW_ATTR);
49
+ const target = listNavigationTarget(keys, from, key);
50
+ if (target === undefined) return undefined;
51
+ const row = rows[keys.indexOf(target)];
52
+ row?.focus();
53
+ return row;
54
+ }
55
+
56
+ /** Focuses the visible row whose `data-row-key` equals `key` under `root`; returns it. */
57
+ export function focusRowWithKey(root: Element, key: string): HTMLElement | undefined {
58
+ const row = Array.from(root.querySelectorAll<HTMLElement>(`[${ROW_ATTR}]`)).find(
59
+ (el) => el.getAttribute(ROW_ATTR) === key && el.getClientRects().length > 0,
60
+ );
61
+ row?.focus();
62
+ return row;
63
+ }
@@ -0,0 +1,33 @@
1
+ // Enter and exit motion of the overlays, as Tailwind classes written out in full so the consumer's
2
+ // Tailwind build (which scans this package's dist) generates them; no stylesheet to import.
3
+ //
4
+ // Enter uses `@starting-style` (`starting:`): the surface starts transparent and a little smaller and
5
+ // transitions in. Exit uses the primitives' `data-state="closed"`: `usePresence` keeps the node
6
+ // mounted until the transition ends. Durations and easing come from the theme's `--motion-duration`
7
+ // and `--motion-ease`, so a style preset (and a `[data-motion]` override) retunes every overlay; the
8
+ // exit runs at two thirds of the enter. Under `prefers-reduced-motion` nothing moves: the transition
9
+ // is dropped and `usePresence` unmounts at once.
10
+
11
+ /** Anchored surfaces (menus, popovers, listboxes, tooltips, hover cards): grow from the anchor side. */
12
+ export const POPPER_MOTION =
13
+ "origin-(--ui-popper-transform-origin) transition-[opacity,scale,translate] duration-(--motion-duration) ease-(--motion-ease) starting:scale-96 starting:opacity-0 starting:data-[side=bottom]:-translate-y-1 starting:data-[side=left]:translate-x-1 starting:data-[side=right]:-translate-x-1 starting:data-[side=top]:translate-y-1 data-[state=closed]:scale-96 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] data-[state=closed]:data-[side=bottom]:-translate-y-1 data-[state=closed]:data-[side=left]:translate-x-1 data-[state=closed]:data-[side=right]:-translate-x-1 data-[state=closed]:data-[side=top]:translate-y-1 motion-reduce:transition-none";
14
+
15
+ /** The scrim behind a dialog or drawer: a plain fade. */
16
+ export const OVERLAY_MOTION =
17
+ "transition-opacity duration-(--motion-duration) ease-(--motion-ease) starting:opacity-0 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
18
+
19
+ /** A centred dialog: fades in while it settles from 97% to full size. */
20
+ export const DIALOG_MOTION =
21
+ "transition-[opacity,scale] duration-(--motion-duration) ease-(--motion-ease) starting:scale-97 starting:opacity-0 data-[state=closed]:scale-97 data-[state=closed]:opacity-0 data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
22
+
23
+ /** A drawer on the inline end: slides in from that edge. */
24
+ export const DRAWER_MOTION =
25
+ "transition-[translate] duration-(--motion-duration) ease-(--motion-ease) starting:translate-x-full data-[state=closed]:translate-x-full data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
26
+
27
+ /** Highlight of a menu item or listbox option: 120ms at the default 180ms motion duration. */
28
+ export const ITEM_MOTION =
29
+ "transition-colors duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";
30
+
31
+ /** A bottom sheet: slides up from the bottom edge. */
32
+ export const SHEET_MOTION =
33
+ "transition-[translate] duration-(--motion-duration) ease-(--motion-ease) starting:translate-y-full data-[state=closed]:translate-y-full data-[state=closed]:duration-[calc(var(--motion-duration)*2/3)] motion-reduce:transition-none";