@tryghost/shade 0.1.0-alpha.6 → 0.1.0-alpha.61

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 (355) hide show
  1. package/README.md +16 -11
  2. package/es/app.js +2 -1
  3. package/es/assets/images/index.js +2 -2
  4. package/es/components/page-templates/list-page.js +1 -1
  5. package/es/components/page-templates/list-page.js.map +1 -1
  6. package/es/components/patterns/color-picker.js +79 -56
  7. package/es/components/patterns/color-picker.js.map +1 -1
  8. package/es/components/patterns/filter-bar.js +4 -6
  9. package/es/components/patterns/filter-bar.js.map +1 -1
  10. package/es/components/patterns/filters-sheet.js +180 -0
  11. package/es/components/patterns/filters-sheet.js.map +1 -0
  12. package/es/components/patterns/filters.js +200 -84
  13. package/es/components/patterns/filters.js.map +1 -1
  14. package/es/components/patterns/gh-chart.js +4 -3
  15. package/es/components/patterns/gh-chart.js.map +1 -1
  16. package/es/components/patterns/image-upload.js +21 -16
  17. package/es/components/patterns/image-upload.js.map +1 -1
  18. package/es/components/patterns/kpi-tabs.js +4 -1
  19. package/es/components/patterns/kpi-tabs.js.map +1 -1
  20. package/es/components/patterns/page-header.js +62 -60
  21. package/es/components/patterns/page-header.js.map +1 -1
  22. package/es/components/patterns/setting-group-variants.js +1 -1
  23. package/es/components/patterns/setting-group-variants.js.map +1 -1
  24. package/es/components/patterns/setting-group.js +5 -5
  25. package/es/components/patterns/setting-group.js.map +1 -1
  26. package/es/components/patterns/settings-modal-variants.js +3 -0
  27. package/es/components/patterns/settings-modal-variants.js.map +1 -1
  28. package/es/components/patterns/settings-modal.js +12 -5
  29. package/es/components/patterns/settings-modal.js.map +1 -1
  30. package/es/components/patterns/share-modal.js +5 -17
  31. package/es/components/patterns/share-modal.js.map +1 -1
  32. package/es/components/patterns/use-mobile-filters.js +20 -0
  33. package/es/components/patterns/use-mobile-filters.js.map +1 -0
  34. package/es/components/ui/alert-dialog.js +25 -15
  35. package/es/components/ui/alert-dialog.js.map +1 -1
  36. package/es/components/ui/avatar.js +3 -4
  37. package/es/components/ui/avatar.js.map +1 -1
  38. package/es/components/ui/badge-variants.js +2 -1
  39. package/es/components/ui/badge-variants.js.map +1 -1
  40. package/es/components/ui/banner-variants.js +13 -5
  41. package/es/components/ui/banner-variants.js.map +1 -1
  42. package/es/components/ui/banner.js +9 -3
  43. package/es/components/ui/banner.js.map +1 -1
  44. package/es/components/ui/breadcrumb.js +2 -0
  45. package/es/components/ui/breadcrumb.js.map +1 -1
  46. package/es/components/ui/button-variants.js +2 -33
  47. package/es/components/ui/button-variants.js.map +1 -1
  48. package/es/components/ui/button.js +18 -5
  49. package/es/components/ui/button.js.map +1 -1
  50. package/es/components/ui/calendar.js +5 -6
  51. package/es/components/ui/calendar.js.map +1 -1
  52. package/es/components/ui/card-variants.js +3 -2
  53. package/es/components/ui/card-variants.js.map +1 -1
  54. package/es/components/ui/card.js +7 -4
  55. package/es/components/ui/card.js.map +1 -1
  56. package/es/components/ui/chart.js +2 -29
  57. package/es/components/ui/chart.js.map +1 -1
  58. package/es/components/ui/checkbox.js +1 -1
  59. package/es/components/ui/checkbox.js.map +1 -1
  60. package/es/components/ui/code-editor-view.js +1 -1
  61. package/es/components/ui/code-editor-view.js.map +1 -1
  62. package/es/components/ui/combobox.js +1 -1
  63. package/es/components/ui/combobox.js.map +1 -1
  64. package/es/components/ui/command.js +1 -14
  65. package/es/components/ui/command.js.map +1 -1
  66. package/es/components/ui/context-menu.js +18 -8
  67. package/es/components/ui/context-menu.js.map +1 -1
  68. package/es/components/ui/copy-field.js +2 -4
  69. package/es/components/ui/copy-field.js.map +1 -1
  70. package/es/components/ui/data-list.js +2 -4
  71. package/es/components/ui/data-list.js.map +1 -1
  72. package/es/components/ui/dialog.js +53 -11
  73. package/es/components/ui/dialog.js.map +1 -1
  74. package/es/components/ui/dropdown-menu.js +20 -10
  75. package/es/components/ui/dropdown-menu.js.map +1 -1
  76. package/es/components/ui/dropzone-variants.js +26 -10
  77. package/es/components/ui/dropzone-variants.js.map +1 -1
  78. package/es/components/ui/dropzone.js +2 -2
  79. package/es/components/ui/dropzone.js.map +1 -1
  80. package/es/components/ui/field.js +4 -4
  81. package/es/components/ui/field.js.map +1 -1
  82. package/es/components/ui/flag.js.map +1 -1
  83. package/es/components/ui/floating-sidebar.js +83 -21
  84. package/es/components/ui/floating-sidebar.js.map +1 -1
  85. package/es/components/ui/hover-card.js +13 -7
  86. package/es/components/ui/hover-card.js.map +1 -1
  87. package/es/components/ui/icon.js +1 -1
  88. package/es/components/ui/image-overlay-button.js +2 -2
  89. package/es/components/ui/image-overlay-button.js.map +1 -1
  90. package/es/components/ui/indicator-variants.js +2 -2
  91. package/es/components/ui/indicator-variants.js.map +1 -1
  92. package/es/components/ui/input-group-variants.js +5 -5
  93. package/es/components/ui/input-group-variants.js.map +1 -1
  94. package/es/components/ui/input-group.js +4 -7
  95. package/es/components/ui/input-group.js.map +1 -1
  96. package/es/components/ui/input-surface.js +5 -4
  97. package/es/components/ui/input-surface.js.map +1 -1
  98. package/es/components/ui/input.js +1 -1
  99. package/es/components/ui/input.js.map +1 -1
  100. package/es/components/ui/list.js +94 -0
  101. package/es/components/ui/list.js.map +1 -0
  102. package/es/components/ui/navbar.js +1 -3
  103. package/es/components/ui/navbar.js.map +1 -1
  104. package/es/components/ui/pagemenu.js +51 -15
  105. package/es/components/ui/pagemenu.js.map +1 -1
  106. package/es/components/ui/popover.js +14 -8
  107. package/es/components/ui/popover.js.map +1 -1
  108. package/es/components/ui/radio-group-variants.js +1 -1
  109. package/es/components/ui/radio-group-variants.js.map +1 -1
  110. package/es/components/ui/row-primary-action.js +48 -0
  111. package/es/components/ui/row-primary-action.js.map +1 -0
  112. package/es/components/ui/row-surface.js +18 -0
  113. package/es/components/ui/row-surface.js.map +1 -0
  114. package/es/components/ui/select-variants.js +6 -14
  115. package/es/components/ui/select-variants.js.map +1 -1
  116. package/es/components/ui/select.js +26 -19
  117. package/es/components/ui/select.js.map +1 -1
  118. package/es/components/ui/sheet.js +32 -19
  119. package/es/components/ui/sheet.js.map +1 -1
  120. package/es/components/ui/sidebar.js +2 -2
  121. package/es/components/ui/simple-pagination.js +4 -7
  122. package/es/components/ui/simple-pagination.js.map +1 -1
  123. package/es/components/ui/sortable-list.js +110 -11
  124. package/es/components/ui/sortable-list.js.map +1 -1
  125. package/es/components/ui/sticky-footer.js +62 -22
  126. package/es/components/ui/sticky-footer.js.map +1 -1
  127. package/es/components/ui/table.js +20 -9
  128. package/es/components/ui/table.js.map +1 -1
  129. package/es/components/ui/tabs-variants.js +23 -1
  130. package/es/components/ui/tabs-variants.js.map +1 -1
  131. package/es/components/ui/tabs.js +145 -27
  132. package/es/components/ui/tabs.js.map +1 -1
  133. package/es/components/ui/textarea.js +1 -1
  134. package/es/components/ui/textarea.js.map +1 -1
  135. package/es/components/ui/toast.js +2 -0
  136. package/es/components/ui/toggle-group.js +1 -3
  137. package/es/components/ui/toggle-group.js.map +1 -1
  138. package/es/components/ui/toggle-variants.js +1 -7
  139. package/es/components/ui/toggle-variants.js.map +1 -1
  140. package/es/components/ui/toggle.js +1 -2
  141. package/es/components/ui/toggle.js.map +1 -1
  142. package/es/components/ui/token-field.js +3 -3
  143. package/es/components/ui/token-field.js.map +1 -1
  144. package/es/components/ui/tooltip.js +81 -40
  145. package/es/components/ui/tooltip.js.map +1 -1
  146. package/es/components/ui/trend-badge.js +46 -12
  147. package/es/components/ui/trend-badge.js.map +1 -1
  148. package/es/components.js +24 -21
  149. package/es/hooks/use-row-behavior.js +94 -0
  150. package/es/hooks/use-row-behavior.js.map +1 -0
  151. package/es/hooks/use-row-press.js +63 -0
  152. package/es/hooks/use-row-press.js.map +1 -0
  153. package/es/{icon-BJcGsQ4b.js → icon--CakqPdG.js} +15 -19
  154. package/es/icon--CakqPdG.js.map +1 -0
  155. package/es/{images-CUcakpOD.js → images-F6slcZrB.js} +16 -42
  156. package/es/images-F6slcZrB.js.map +1 -0
  157. package/es/index.js +43 -39
  158. package/es/lib/app-overlay.js +184 -0
  159. package/es/lib/app-overlay.js.map +1 -0
  160. package/es/lib/date-utils.js +151 -0
  161. package/es/lib/date-utils.js.map +1 -0
  162. package/es/lib/ds-utils.js +16 -72
  163. package/es/lib/ds-utils.js.map +1 -1
  164. package/es/lib/safe-area.js +168 -0
  165. package/es/lib/safe-area.js.map +1 -0
  166. package/es/lib/svg-graphic.js +32 -0
  167. package/es/lib/svg-graphic.js.map +1 -0
  168. package/es/lib/toast-press.js +11 -0
  169. package/es/lib/toast-press.js.map +1 -0
  170. package/es/lib/utils.js +3 -2
  171. package/es/patterns.js +2 -1
  172. package/es/providers/header-tooltip-provider.js +1 -4
  173. package/es/providers/header-tooltip-provider.js.map +1 -1
  174. package/es/providers/shade-context.js +2 -1
  175. package/es/providers/shade-context.js.map +1 -1
  176. package/es/providers/shade-provider.js +28 -13
  177. package/es/providers/shade-provider.js.map +1 -1
  178. package/es/shade-app.js +22 -6
  179. package/es/shade-app.js.map +1 -1
  180. package/es/shade-scope.js +3 -2
  181. package/es/shade-scope.js.map +1 -1
  182. package/es/tokens.js +66 -8
  183. package/es/tokens.js.map +1 -1
  184. package/es/utils.js +3 -2
  185. package/package.json +7 -7
  186. package/preflight.css +0 -10
  187. package/styles.css +485 -12
  188. package/tailwind.theme.css +241 -187
  189. package/theme-variables.css +215 -69
  190. package/types/app.d.ts +7 -5
  191. package/types/app.d.ts.map +1 -1
  192. package/types/assets/images/index.d.ts +3 -3
  193. package/types/assets/images/index.d.ts.map +1 -1
  194. package/types/components/page-templates/modal-page.d.ts +1 -1
  195. package/types/components/patterns/color-picker.d.ts +7 -2
  196. package/types/components/patterns/color-picker.d.ts.map +1 -1
  197. package/types/components/patterns/filter-bar.d.ts +2 -2
  198. package/types/components/patterns/filter-bar.d.ts.map +1 -1
  199. package/types/components/patterns/filters-helpers.d.ts +1 -1
  200. package/types/components/patterns/filters-sheet.d.ts +21 -0
  201. package/types/components/patterns/filters-sheet.d.ts.map +1 -0
  202. package/types/components/patterns/filters.d.ts +21 -7
  203. package/types/components/patterns/filters.d.ts.map +1 -1
  204. package/types/components/patterns/gh-chart.d.ts.map +1 -1
  205. package/types/components/patterns/image-upload.d.ts +3 -3
  206. package/types/components/patterns/image-upload.d.ts.map +1 -1
  207. package/types/components/patterns/kpi-tabs.d.ts +5 -2
  208. package/types/components/patterns/kpi-tabs.d.ts.map +1 -1
  209. package/types/components/patterns/page-header.d.ts +26 -17
  210. package/types/components/patterns/page-header.d.ts.map +1 -1
  211. package/types/components/patterns/setting-group.d.ts +8 -8
  212. package/types/components/patterns/setting-group.d.ts.map +1 -1
  213. package/types/components/patterns/settings-modal-variants.d.ts +3 -0
  214. package/types/components/patterns/settings-modal-variants.d.ts.map +1 -1
  215. package/types/components/patterns/settings-modal.d.ts +12 -3
  216. package/types/components/patterns/settings-modal.d.ts.map +1 -1
  217. package/types/components/patterns/share-modal.d.ts +3 -3
  218. package/types/components/patterns/share-modal.d.ts.map +1 -1
  219. package/types/components/patterns/use-dirty-confirmation.d.ts +1 -1
  220. package/types/components/patterns/use-mobile-filters.d.ts +2 -0
  221. package/types/components/patterns/use-mobile-filters.d.ts.map +1 -0
  222. package/types/components/ui/alert-dialog.d.ts +2 -2
  223. package/types/components/ui/alert-dialog.d.ts.map +1 -1
  224. package/types/components/ui/badge-variants.d.ts +1 -1
  225. package/types/components/ui/badge-variants.d.ts.map +1 -1
  226. package/types/components/ui/badge.d.ts +1 -1
  227. package/types/components/ui/banner-variants.d.ts +1 -1
  228. package/types/components/ui/banner-variants.d.ts.map +1 -1
  229. package/types/components/ui/banner.d.ts +3 -1
  230. package/types/components/ui/banner.d.ts.map +1 -1
  231. package/types/components/ui/breadcrumb.d.ts.map +1 -1
  232. package/types/components/ui/button-variants.d.ts +0 -1
  233. package/types/components/ui/button-variants.d.ts.map +1 -1
  234. package/types/components/ui/button.d.ts +7 -2
  235. package/types/components/ui/button.d.ts.map +1 -1
  236. package/types/components/ui/calendar.d.ts +1 -1
  237. package/types/components/ui/calendar.d.ts.map +1 -1
  238. package/types/components/ui/card-variants.d.ts +1 -1
  239. package/types/components/ui/card-variants.d.ts.map +1 -1
  240. package/types/components/ui/card.d.ts +1 -1
  241. package/types/components/ui/card.d.ts.map +1 -1
  242. package/types/components/ui/chart.d.ts +1 -17
  243. package/types/components/ui/chart.d.ts.map +1 -1
  244. package/types/components/ui/code-editor.d.ts +1 -1
  245. package/types/components/ui/command.d.ts +1 -6
  246. package/types/components/ui/command.d.ts.map +1 -1
  247. package/types/components/ui/context-menu.d.ts +1 -1
  248. package/types/components/ui/context-menu.d.ts.map +1 -1
  249. package/types/components/ui/copy-field.d.ts +1 -1
  250. package/types/components/ui/copy-field.d.ts.map +1 -1
  251. package/types/components/ui/data-list.d.ts.map +1 -1
  252. package/types/components/ui/dialog.d.ts +11 -2
  253. package/types/components/ui/dialog.d.ts.map +1 -1
  254. package/types/components/ui/dropdown-menu.d.ts +1 -1
  255. package/types/components/ui/dropdown-menu.d.ts.map +1 -1
  256. package/types/components/ui/dropzone-variants.d.ts +3 -2
  257. package/types/components/ui/dropzone-variants.d.ts.map +1 -1
  258. package/types/components/ui/dropzone.d.ts +1 -1
  259. package/types/components/ui/field.d.ts +1 -1
  260. package/types/components/ui/field.d.ts.map +1 -1
  261. package/types/components/ui/floating-sidebar.d.ts +12 -3
  262. package/types/components/ui/floating-sidebar.d.ts.map +1 -1
  263. package/types/components/ui/hover-card.d.ts.map +1 -1
  264. package/types/components/ui/icon.d.ts +2 -1
  265. package/types/components/ui/icon.d.ts.map +1 -1
  266. package/types/components/ui/image-overlay-button.d.ts +1 -1
  267. package/types/components/ui/image-overlay-button.d.ts.map +1 -1
  268. package/types/components/ui/indicator.d.ts +1 -1
  269. package/types/components/ui/input-group-variants.d.ts.map +1 -1
  270. package/types/components/ui/input-group.d.ts +2 -2
  271. package/types/components/ui/input-group.d.ts.map +1 -1
  272. package/types/components/ui/input-surface.d.ts +4 -3
  273. package/types/components/ui/input-surface.d.ts.map +1 -1
  274. package/types/components/ui/list.d.ts +28 -0
  275. package/types/components/ui/list.d.ts.map +1 -0
  276. package/types/components/ui/multi-select-combobox.d.ts +1 -1
  277. package/types/components/ui/navbar.d.ts.map +1 -1
  278. package/types/components/ui/pagemenu.d.ts +3 -0
  279. package/types/components/ui/pagemenu.d.ts.map +1 -1
  280. package/types/components/ui/popover.d.ts.map +1 -1
  281. package/types/components/ui/preview-chrome.d.ts +1 -1
  282. package/types/components/ui/row-primary-action.d.ts +8 -0
  283. package/types/components/ui/row-primary-action.d.ts.map +1 -0
  284. package/types/components/ui/row-surface.d.ts +11 -0
  285. package/types/components/ui/row-surface.d.ts.map +1 -0
  286. package/types/components/ui/select-variants.d.ts +0 -1
  287. package/types/components/ui/select-variants.d.ts.map +1 -1
  288. package/types/components/ui/select.d.ts +2 -2
  289. package/types/components/ui/select.d.ts.map +1 -1
  290. package/types/components/ui/sheet.d.ts +1 -1
  291. package/types/components/ui/sheet.d.ts.map +1 -1
  292. package/types/components/ui/sidebar.d.ts +2 -2
  293. package/types/components/ui/simple-pagination.d.ts.map +1 -1
  294. package/types/components/ui/sortable-list.d.ts +4 -1
  295. package/types/components/ui/sortable-list.d.ts.map +1 -1
  296. package/types/components/ui/sticky-footer.d.ts +9 -2
  297. package/types/components/ui/sticky-footer.d.ts.map +1 -1
  298. package/types/components/ui/table.d.ts +4 -1
  299. package/types/components/ui/table.d.ts.map +1 -1
  300. package/types/components/ui/tabs-variants.d.ts +5 -1
  301. package/types/components/ui/tabs-variants.d.ts.map +1 -1
  302. package/types/components/ui/tabs.d.ts.map +1 -1
  303. package/types/components/ui/toast.d.ts +2 -0
  304. package/types/components/ui/toast.d.ts.map +1 -0
  305. package/types/components/ui/toggle-group.d.ts +4 -6
  306. package/types/components/ui/toggle-group.d.ts.map +1 -1
  307. package/types/components/ui/toggle-variants.d.ts +0 -1
  308. package/types/components/ui/toggle-variants.d.ts.map +1 -1
  309. package/types/components/ui/toggle.d.ts +2 -3
  310. package/types/components/ui/toggle.d.ts.map +1 -1
  311. package/types/components/ui/token-field.d.ts +2 -2
  312. package/types/components/ui/token-field.d.ts.map +1 -1
  313. package/types/components/ui/tooltip.d.ts.map +1 -1
  314. package/types/components/ui/trend-badge.d.ts +1 -0
  315. package/types/components/ui/trend-badge.d.ts.map +1 -1
  316. package/types/components.d.ts +5 -2
  317. package/types/components.d.ts.map +1 -1
  318. package/types/hooks/use-row-behavior.d.ts +24 -0
  319. package/types/hooks/use-row-behavior.d.ts.map +1 -0
  320. package/types/hooks/use-row-press.d.ts +11 -0
  321. package/types/hooks/use-row-press.d.ts.map +1 -0
  322. package/types/lib/app-overlay.d.ts +63 -0
  323. package/types/lib/app-overlay.d.ts.map +1 -0
  324. package/types/lib/date-utils.d.ts +17 -0
  325. package/types/lib/date-utils.d.ts.map +1 -0
  326. package/types/lib/ds-utils.d.ts +2 -16
  327. package/types/lib/ds-utils.d.ts.map +1 -1
  328. package/types/lib/safe-area.d.ts +27 -0
  329. package/types/lib/safe-area.d.ts.map +1 -0
  330. package/types/lib/svg-graphic.d.ts +22 -0
  331. package/types/lib/svg-graphic.d.ts.map +1 -0
  332. package/types/lib/toast-press.d.ts +4 -0
  333. package/types/lib/toast-press.d.ts.map +1 -0
  334. package/types/lib/utils.d.ts +1 -0
  335. package/types/lib/utils.d.ts.map +1 -1
  336. package/types/patterns.d.ts +1 -0
  337. package/types/patterns.d.ts.map +1 -1
  338. package/types/providers/header-tooltip-provider.d.ts.map +1 -1
  339. package/types/providers/shade-context.d.ts +4 -1
  340. package/types/providers/shade-context.d.ts.map +1 -1
  341. package/types/providers/shade-provider.d.ts +5 -2
  342. package/types/providers/shade-provider.d.ts.map +1 -1
  343. package/types/shade-app.d.ts +11 -3
  344. package/types/shade-app.d.ts.map +1 -1
  345. package/types/shade-scope.d.ts.map +1 -1
  346. package/types/tokens.d.ts +1 -1
  347. package/types/tokens.d.ts.map +1 -1
  348. package/types/utils.d.ts +2 -1
  349. package/types/utils.d.ts.map +1 -1
  350. package/es/components/ui/action-list.js +0 -56
  351. package/es/components/ui/action-list.js.map +0 -1
  352. package/es/icon-BJcGsQ4b.js.map +0 -1
  353. package/es/images-CUcakpOD.js.map +0 -1
  354. package/types/components/ui/action-list.d.ts +0 -21
  355. package/types/components/ui/action-list.d.ts.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
2
  import { Separator } from "./separator.js";
3
3
  import { Menu } from "lucide-react";
4
- import { Fragment, useState } from "react";
4
+ import { Fragment, useRef, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
- import { DndContext, DragOverlay, closestCenter } from "@dnd-kit/core";
7
- import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
8
- import { CSS } from "@dnd-kit/utilities";
6
+ import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
7
+ import { SortableContext, hasSortableData, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
8
+ import { CSS, isKeyboardEvent } from "@dnd-kit/utilities";
9
9
  //#region src/components/ui/sortable-list.tsx
10
10
  var DragIndicator = ({ isDragging, dragHandleAttributes, dragHandleListeners, dragHandleClass, dragHandleLabel, className, ...props }) => /* @__PURE__ */ jsx("button", {
11
11
  "aria-label": dragHandleLabel || "Reorder",
@@ -48,14 +48,101 @@ var SortableItem = ({ id, children, separator, dragHandleClass, dragHandleLabel,
48
48
  });
49
49
  };
50
50
  /**
51
+ * Moves the dragged item one place per Up or Down arrow press. dnd-kit's
52
+ * `sortableKeyboardCoordinates` picks the next item by distance, which skips or sticks on rows of
53
+ * different heights. This picks it by index instead, and collision detection follows that pick
54
+ * during a keyboard drag. The dragged item moves to the slot it will drop into.
55
+ */
56
+ var createKeyboardMoves = () => {
57
+ let targetId = null;
58
+ const coordinateGetter = (event, { currentCoordinates, context: { active, droppableRects, droppableContainers } }) => {
59
+ if (!event.code.startsWith("Arrow")) return;
60
+ event.preventDefault();
61
+ const step = event.code === "ArrowDown" ? 1 : event.code === "ArrowUp" ? -1 : 0;
62
+ if (!step) return;
63
+ const activeContainer = active && droppableContainers.get(active.id);
64
+ const activeRect = active && droppableRects.get(active.id);
65
+ if (!active || !activeRect || !hasSortableData(activeContainer)) return;
66
+ const { items } = activeContainer.data.current.sortable;
67
+ const from = targetId === null ? -1 : items.indexOf(targetId);
68
+ const nextId = items[(from === -1 ? items.indexOf(active.id) : from) + step];
69
+ const nextRect = nextId === void 0 ? void 0 : droppableRects.get(nextId);
70
+ if (nextId === void 0 || !nextRect) return;
71
+ targetId = nextId;
72
+ const offset = items.indexOf(nextId) - items.indexOf(active.id);
73
+ const top = offset > 0 ? nextRect.top + nextRect.height - activeRect.height : offset < 0 ? nextRect.top : activeRect.top;
74
+ return {
75
+ x: currentCoordinates.x,
76
+ y: top
77
+ };
78
+ };
79
+ const collisionDetection = (args) => {
80
+ if (targetId === null || args.pointerCoordinates !== null) return closestCenter(args);
81
+ const pinnedId = targetId;
82
+ return args.droppableContainers.some(({ id }) => id === pinnedId) ? [{ id: pinnedId }] : [{ id: args.active.id }];
83
+ };
84
+ return {
85
+ keyboardSensorOptions: {
86
+ coordinateGetter,
87
+ scrollBehavior: "auto"
88
+ },
89
+ collisionDetection,
90
+ /** Where a keyboard drag will drop, so the drop doesn't wait on a scroll to update `over`. */
91
+ target: () => targetId,
92
+ /** A keyboard drag starts on its own row, so scrolling the list can't move it. */
93
+ reset: (id) => {
94
+ targetId = id;
95
+ }
96
+ };
97
+ };
98
+ var screenReaderInstructions = { draggable: "To pick up an item, press Space or Enter. Use the Up and Down arrow keys to move it. Press Space or Enter again to drop it in its new place, or press Escape to cancel." };
99
+ /**
51
100
  * A vertically sortable list. Items must keep stable IDs across renders.
52
101
  */
53
- var SortableList = ({ title, titleSeparator, hint, items, itemSeparator = true, dragHandleClass, getDragHandleLabel, onMove, renderItem, container = (props) => /* @__PURE__ */ jsx(DefaultContainer, { ...props }), wrapper: Wrapper = Fragment, dragOverlayWrapper, className, ...props }) => {
102
+ var SortableList = ({ title, titleSeparator, hint, items, itemSeparator = true, dragHandleClass, getItemLabel, getDragHandleLabel, onMove, renderItem, container = (props) => /* @__PURE__ */ jsx(DefaultContainer, { ...props }), wrapper: Wrapper = Fragment, dragOverlayWrapper, className, ...props }) => {
54
103
  const [draggingId, setDraggingId] = useState(null);
55
104
  const draggingItem = items.find(({ id }) => id === draggingId);
105
+ const lastOverId = useRef(null);
106
+ const [keyboardMoves] = useState(createKeyboardMoves);
107
+ const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, keyboardMoves.keyboardSensorOptions));
108
+ const handleLabel = (item) => {
109
+ const name = getItemLabel?.(item).trim();
110
+ return getDragHandleLabel?.(item) || (name ? `Reorder ${name}` : void 0);
111
+ };
112
+ const indexOf = (id) => items.findIndex((item) => item.id === String(id));
113
+ const nameOf = (id) => {
114
+ const item = items[indexOf(id)];
115
+ return item && (getItemLabel?.(item).trim() || getDragHandleLabel?.(item).trim()) || String(id);
116
+ };
117
+ const dropId = (active, over) => {
118
+ const target = keyboardMoves.target();
119
+ if (target === null) return over?.id ?? null;
120
+ return indexOf(target) === -1 ? active.id : target;
121
+ };
122
+ const removedMessage = "Moving cancelled. The item is no longer in the list.";
123
+ const positionOf = (id) => `position ${indexOf(id) + 1} of ${items.length}`;
124
+ const announcements = {
125
+ onDragStart: ({ active }) => {
126
+ lastOverId.current = active.id;
127
+ return `Picked up ${nameOf(active.id)}, ${positionOf(active.id)}.`;
128
+ },
129
+ onDragOver: ({ active, over }) => {
130
+ const overId = over?.id ?? null;
131
+ if (overId === lastOverId.current) return;
132
+ lastOverId.current = overId;
133
+ return overId === null ? `${nameOf(active.id)} is no longer over the list.` : `${nameOf(active.id)} moved to ${positionOf(overId)}.`;
134
+ },
135
+ onDragEnd: ({ active, over }) => {
136
+ const overId = dropId(active, over);
137
+ if (indexOf(active.id) === -1) return removedMessage;
138
+ return overId === null ? `${nameOf(active.id)} dropped. It stays at ${positionOf(active.id)}.` : `${nameOf(active.id)} dropped at ${positionOf(overId)}.`;
139
+ },
140
+ onDragCancel: ({ active }) => indexOf(active.id) === -1 ? removedMessage : `Moving cancelled. ${nameOf(active.id)} stays at ${positionOf(active.id)}.`
141
+ };
56
142
  if (!items.length) return null;
57
143
  return /* @__PURE__ */ jsxs("div", {
58
144
  className: cn("w-full", className),
145
+ "data-row-dragging": draggingId !== null ? "true" : void 0,
59
146
  ...props,
60
147
  children: [
61
148
  title && /* @__PURE__ */ jsxs("div", {
@@ -66,20 +153,32 @@ var SortableList = ({ title, titleSeparator, hint, items, itemSeparator = true,
66
153
  }), titleSeparator && /* @__PURE__ */ jsx(Separator, {})]
67
154
  }),
68
155
  /* @__PURE__ */ jsxs(DndContext, {
69
- collisionDetection: closestCenter,
156
+ accessibility: {
157
+ announcements,
158
+ screenReaderInstructions
159
+ },
160
+ collisionDetection: keyboardMoves.collisionDetection,
161
+ sensors,
70
162
  onDragCancel: () => setDraggingId(null),
71
163
  onDragEnd: (event) => {
72
- if (event.over) onMove(String(event.active.id), String(event.over.id));
73
- setDraggingId(null);
164
+ try {
165
+ const overId = dropId(event.active, event.over);
166
+ if (overId !== null && indexOf(event.active.id) !== -1) onMove(String(event.active.id), String(overId));
167
+ } finally {
168
+ setDraggingId(null);
169
+ }
170
+ },
171
+ onDragStart: (event) => {
172
+ keyboardMoves.reset(isKeyboardEvent(event.activatorEvent) ? event.active.id : null);
173
+ setDraggingId(String(event.active.id));
74
174
  },
75
- onDragStart: (event) => setDraggingId(String(event.active.id)),
76
175
  children: [/* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(SortableContext, {
77
176
  items,
78
177
  strategy: verticalListSortingStrategy,
79
178
  children: items.map((item) => /* @__PURE__ */ jsx(SortableItem, {
80
179
  container,
81
180
  dragHandleClass,
82
- dragHandleLabel: getDragHandleLabel?.(item),
181
+ dragHandleLabel: handleLabel(item),
83
182
  id: item.id,
84
183
  separator: itemSeparator,
85
184
  children: renderItem(item)
@@ -89,7 +188,7 @@ var SortableList = ({ title, titleSeparator, hint, items, itemSeparator = true,
89
188
  children: draggingItem ? container({
90
189
  id: draggingItem.id,
91
190
  isDragging: true,
92
- dragHandleLabel: getDragHandleLabel?.(draggingItem),
191
+ dragHandleLabel: handleLabel(draggingItem),
93
192
  children: renderItem(draggingItem)
94
193
  }) : null
95
194
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"sortable-list.js","names":[],"sources":["../../../src/components/ui/sortable-list.tsx"],"sourcesContent":["import {\n DndContext,\n DragOverlay,\n type DraggableAttributes,\n type DraggableSyntheticListeners,\n closestCenter,\n} from '@dnd-kit/core';\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { Menu } from 'lucide-react';\nimport {\n type CSSProperties,\n type ElementType,\n Fragment,\n type HTMLAttributes,\n type ReactNode,\n useState,\n} from 'react';\nimport { Separator } from './separator';\nimport { cn } from '@/lib/utils';\n\nexport interface SortableItemContainerProps {\n id: string;\n setRef?: (element: HTMLElement | null) => void;\n isDragging: boolean;\n dragHandleAttributes?: DraggableAttributes;\n dragHandleListeners?: DraggableSyntheticListeners;\n dragHandleClass?: string;\n dragHandleLabel?: string;\n style?: CSSProperties;\n children: ReactNode;\n separator?: boolean;\n}\n\nexport type DragIndicatorProps = Pick<\n SortableItemContainerProps,\n | 'isDragging'\n | 'dragHandleAttributes'\n | 'dragHandleListeners'\n | 'dragHandleClass'\n | 'dragHandleLabel'\n> &\n HTMLAttributes<HTMLButtonElement>;\n\nexport const DragIndicator = ({\n isDragging,\n dragHandleAttributes,\n dragHandleListeners,\n dragHandleClass,\n dragHandleLabel,\n className,\n ...props\n}: DragIndicatorProps) => (\n <button\n aria-label={dragHandleLabel || 'Reorder'}\n className={cn(\n 'inline-flex items-center justify-center text-muted-foreground opacity-50 transition-opacity group-hover:opacity-100',\n isDragging ? 'cursor-grabbing' : 'cursor-grab',\n dragHandleClass,\n className,\n )}\n type=\"button\"\n {...dragHandleAttributes}\n {...dragHandleListeners}\n {...props}\n >\n <Menu aria-hidden=\"true\" className=\"size-4\" />\n </button>\n);\n\nconst DefaultContainer = ({\n setRef,\n isDragging,\n style,\n separator,\n children,\n ...props\n}: SortableItemContainerProps) => (\n <div\n ref={setRef}\n className={cn(\n 'group flex w-full items-center gap-3 bg-background py-1',\n separator && 'border-b border-border',\n isDragging && 'opacity-75',\n )}\n style={style}\n >\n <DragIndicator className=\"h-7\" isDragging={isDragging} {...props} />\n {children}\n </div>\n);\n\nconst SortableItem = ({\n id,\n children,\n separator,\n dragHandleClass,\n dragHandleLabel,\n container,\n}: {\n id: string;\n children: ReactNode;\n separator?: boolean;\n dragHandleClass?: string;\n dragHandleLabel?: string;\n container: (props: SortableItemContainerProps) => ReactNode;\n}) => {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });\n\n return container({\n id,\n setRef: setNodeRef,\n isDragging: false,\n separator,\n dragHandleClass,\n dragHandleLabel,\n dragHandleAttributes: attributes,\n dragHandleListeners: listeners,\n style: {\n transform: CSS.Transform.toString(transform),\n transition,\n },\n children,\n });\n};\n\nexport interface SortableListProps<\n Item extends { id: string },\n> extends HTMLAttributes<HTMLDivElement> {\n title?: string;\n titleSeparator?: boolean;\n hint?: ReactNode;\n items: Item[];\n itemSeparator?: boolean;\n dragHandleClass?: string;\n getDragHandleLabel?: (item: Item) => string;\n onMove: (id: string, overId: string) => void;\n renderItem: (item: Item) => ReactNode;\n container?: (props: SortableItemContainerProps) => ReactNode;\n wrapper?: ElementType;\n dragOverlayWrapper?: keyof JSX.IntrinsicElements;\n}\n\n/**\n * A vertically sortable list. Items must keep stable IDs across renders.\n */\nexport const SortableList = <Item extends { id: string }>({\n title,\n titleSeparator,\n hint,\n items,\n itemSeparator = true,\n dragHandleClass,\n getDragHandleLabel,\n onMove,\n renderItem,\n container = (props) => <DefaultContainer {...props} />,\n wrapper: Wrapper = Fragment,\n dragOverlayWrapper,\n className,\n ...props\n}: SortableListProps<Item>) => {\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const draggingItem = items.find(({ id }) => id === draggingId);\n\n if (!items.length) {\n return null;\n }\n\n return (\n <div className={cn('w-full', className)} {...props}>\n {title && (\n <div className={cn('mb-2', titleSeparator && 'space-y-1')}>\n <h6 className=\"text-base font-semibold text-muted-foreground\">{title}</h6>\n {titleSeparator && <Separator />}\n </div>\n )}\n <DndContext\n collisionDetection={closestCenter}\n onDragCancel={() => setDraggingId(null)}\n onDragEnd={(event) => {\n if (event.over) {\n onMove(String(event.active.id), String(event.over.id));\n }\n setDraggingId(null);\n }}\n onDragStart={(event) => setDraggingId(String(event.active.id))}\n >\n <Wrapper>\n <SortableContext items={items} strategy={verticalListSortingStrategy}>\n {items.map((item) => (\n <SortableItem\n key={item.id}\n container={container}\n dragHandleClass={dragHandleClass}\n dragHandleLabel={getDragHandleLabel?.(item)}\n id={item.id}\n separator={itemSeparator}\n >\n {renderItem(item)}\n </SortableItem>\n ))}\n </SortableContext>\n </Wrapper>\n <DragOverlay wrapperElement={dragOverlayWrapper}>\n {draggingItem\n ? container({\n id: draggingItem.id,\n isDragging: true,\n dragHandleLabel: getDragHandleLabel?.(draggingItem),\n children: renderItem(draggingItem),\n })\n : null}\n </DragOverlay>\n </DndContext>\n {hint && (\n <div className=\"space-y-1 pt-1 text-sm text-muted-foreground\">\n {!itemSeparator && <Separator />}\n {hint}\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AA4CA,IAAa,iBAAiB,EAC5B,YACA,sBACA,qBACA,iBACA,iBACA,WACA,GAAG,YAEH,oBAAC,UAAD;CACE,cAAY,mBAAmB;CAC/B,WAAW,GACT,uHACA,aAAa,oBAAoB,eACjC,iBACA,SACF;CACA,MAAK;CACL,GAAI;CACJ,GAAI;CACJ,GAAI;WAEJ,oBAAC,MAAD;EAAM,eAAY;EAAO,WAAU;CAAU,CAAA;AACvC,CAAA;AAGV,IAAM,oBAAoB,EACxB,QACA,YACA,OACA,W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pB;IACA,cAAc,UAAU,cAAc,OAAO,MAAM,OAAO,EAAE,CAAC;cAT/D,CAWE,oBAAC,SAAD,EAAA,UACE,oBAAC,iBAAD;KAAwB;KAAO,UAAU;eACtC,MAAM,KAAK,SACV,oBAAC,cAAD;MAEa;MACM;MACjB,iBAAiB,qBAAqB,IAAI;MAC1C,IAAI,KAAK;MACT,WAAW;gBAEV,WAAW,IAAI;KACJ,GARP,KAAK,EAQE,CACf;IACc,CAAA,EACV,CAAA,GACT,oBAAC,aAAD;KAAa,gBAAgB;eAC1B,eACG,UAAU;MACR,IAAI,aAAa;MACjB,YAAY;MACZ,iBAAiB,qBAAqB,YAAY;MAClD,UAAU,WAAW,YAAY;KACnC,CAAC,IACD;IACO,CAAA,CACH;;GACX,QACC,qBAAC,OAAD;IAAK,WAAU;cAAf,CACG,CAAC,iBAAiB,oBAAC,WAAD,CAAY,CAAA,GAC9B,IACE;;EAEJ;;AAET"}
1
+ {"version":3,"file":"sortable-list.js","names":[],"sources":["../../../src/components/ui/sortable-list.tsx"],"sourcesContent":["import {\n type Announcements,\n type CollisionDetection,\n DndContext,\n DragOverlay,\n type DraggableAttributes,\n type DraggableSyntheticListeners,\n type KeyboardCoordinateGetter,\n KeyboardSensor,\n PointerSensor,\n type ScreenReaderInstructions,\n type UniqueIdentifier,\n closestCenter,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {\n SortableContext,\n hasSortableData,\n useSortable,\n verticalListSortingStrategy,\n} from '@dnd-kit/sortable';\nimport { CSS, isKeyboardEvent } from '@dnd-kit/utilities';\nimport { Menu } from 'lucide-react';\nimport {\n type CSSProperties,\n type ElementType,\n Fragment,\n type HTMLAttributes,\n type ReactNode,\n useRef,\n useState,\n} from 'react';\nimport { Separator } from './separator';\nimport { cn } from '@/lib/utils';\n\nexport interface SortableItemContainerProps {\n id: string;\n setRef?: (element: HTMLElement | null) => void;\n isDragging: boolean;\n dragHandleAttributes?: DraggableAttributes;\n dragHandleListeners?: DraggableSyntheticListeners;\n dragHandleClass?: string;\n dragHandleLabel?: string;\n style?: CSSProperties;\n children: ReactNode;\n separator?: boolean;\n}\n\nexport type DragIndicatorProps = Pick<\n SortableItemContainerProps,\n | 'isDragging'\n | 'dragHandleAttributes'\n | 'dragHandleListeners'\n | 'dragHandleClass'\n | 'dragHandleLabel'\n> &\n HTMLAttributes<HTMLButtonElement>;\n\nexport const DragIndicator = ({\n isDragging,\n dragHandleAttributes,\n dragHandleListeners,\n dragHandleClass,\n dragHandleLabel,\n className,\n ...props\n}: DragIndicatorProps) => (\n <button\n aria-label={dragHandleLabel || 'Reorder'}\n className={cn(\n 'inline-flex items-center justify-center text-muted-foreground opacity-50 transition-opacity group-hover:opacity-100',\n isDragging ? 'cursor-grabbing' : 'cursor-grab',\n dragHandleClass,\n className,\n )}\n type=\"button\"\n {...dragHandleAttributes}\n {...dragHandleListeners}\n {...props}\n >\n <Menu aria-hidden=\"true\" className=\"size-4\" />\n </button>\n);\n\nconst DefaultContainer = ({\n setRef,\n isDragging,\n style,\n separator,\n children,\n ...props\n}: SortableItemContainerProps) => (\n <div\n ref={setRef}\n className={cn(\n 'group flex w-full items-center gap-3 bg-background py-1',\n separator && 'border-b border-border',\n isDragging && 'opacity-75',\n )}\n style={style}\n >\n <DragIndicator className=\"h-7\" isDragging={isDragging} {...props} />\n {children}\n </div>\n);\n\nconst SortableItem = ({\n id,\n children,\n separator,\n dragHandleClass,\n dragHandleLabel,\n container,\n}: {\n id: string;\n children: ReactNode;\n separator?: boolean;\n dragHandleClass?: string;\n dragHandleLabel?: string;\n container: (props: SortableItemContainerProps) => ReactNode;\n}) => {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id });\n\n return container({\n id,\n setRef: setNodeRef,\n isDragging: false,\n separator,\n dragHandleClass,\n dragHandleLabel,\n dragHandleAttributes: attributes,\n dragHandleListeners: listeners,\n style: {\n transform: CSS.Transform.toString(transform),\n transition,\n },\n children,\n });\n};\n\n/**\n * Moves the dragged item one place per Up or Down arrow press. dnd-kit's\n * `sortableKeyboardCoordinates` picks the next item by distance, which skips or sticks on rows of\n * different heights. This picks it by index instead, and collision detection follows that pick\n * during a keyboard drag. The dragged item moves to the slot it will drop into.\n */\nconst createKeyboardMoves = () => {\n let targetId: UniqueIdentifier | null = null;\n\n const coordinateGetter: KeyboardCoordinateGetter = (\n event,\n { currentCoordinates, context: { active, droppableRects, droppableContainers } },\n ) => {\n if (!event.code.startsWith('Arrow')) {\n return undefined;\n }\n event.preventDefault();\n const step = event.code === 'ArrowDown' ? 1 : event.code === 'ArrowUp' ? -1 : 0;\n if (!step) {\n return undefined;\n }\n\n const activeContainer = active && droppableContainers.get(active.id);\n const activeRect = active && droppableRects.get(active.id);\n if (!active || !activeRect || !hasSortableData(activeContainer)) {\n return undefined;\n }\n const { items } = activeContainer.data.current.sortable;\n // Carry on from the active item if the target has left the list mid-drag.\n const from = targetId === null ? -1 : items.indexOf(targetId);\n const nextId = items[(from === -1 ? items.indexOf(active.id) : from) + step];\n const nextRect = nextId === undefined ? undefined : droppableRects.get(nextId);\n if (nextId === undefined || !nextRect) {\n return undefined;\n }\n targetId = nextId;\n\n const offset = items.indexOf(nextId) - items.indexOf(active.id);\n const top =\n offset > 0\n ? nextRect.top + nextRect.height - activeRect.height\n : offset < 0\n ? nextRect.top\n : activeRect.top;\n return { x: currentCoordinates.x, y: top };\n };\n\n // If the target leaves the list mid-drag, the lifted item stays where it started.\n const collisionDetection: CollisionDetection = (args) => {\n if (targetId === null || args.pointerCoordinates !== null) {\n return closestCenter(args);\n }\n const pinnedId = targetId;\n return args.droppableContainers.some(({ id }) => id === pinnedId)\n ? [{ id: pinnedId }]\n : [{ id: args.active.id }];\n };\n\n return {\n // One options object, so the sensors and handle listeners stay the same across renders.\n // Scrolls instantly, so a key pressed mid-scroll can't leave the lifted item off its slot.\n keyboardSensorOptions: { coordinateGetter, scrollBehavior: 'auto' as const },\n collisionDetection,\n /** Where a keyboard drag will drop, so the drop doesn't wait on a scroll to update `over`. */\n target: () => targetId,\n /** A keyboard drag starts on its own row, so scrolling the list can't move it. */\n reset: (id: UniqueIdentifier | null) => {\n targetId = id;\n },\n };\n};\n\nconst screenReaderInstructions: ScreenReaderInstructions = {\n draggable:\n 'To pick up an item, press Space or Enter. Use the Up and Down arrow keys to move it. Press Space or Enter again to drop it in its new place, or press Escape to cancel.',\n};\n\nexport interface SortableListProps<\n Item extends { id: string },\n> extends HTMLAttributes<HTMLDivElement> {\n title?: string;\n titleSeparator?: boolean;\n hint?: ReactNode;\n items: Item[];\n itemSeparator?: boolean;\n dragHandleClass?: string;\n /** The item's name, which screen readers announce while it's dragged. Defaults to `getDragHandleLabel`, then the id. */\n getItemLabel?: (item: Item) => string;\n /** The drag handle's accessible name. Defaults to `Reorder <item label>` when `getItemLabel` is set. */\n getDragHandleLabel?: (item: Item) => string;\n onMove: (id: string, overId: string) => void;\n renderItem: (item: Item) => ReactNode;\n container?: (props: SortableItemContainerProps) => ReactNode;\n wrapper?: ElementType;\n dragOverlayWrapper?: keyof JSX.IntrinsicElements;\n}\n\n/**\n * A vertically sortable list. Items must keep stable IDs across renders.\n */\nexport const SortableList = <Item extends { id: string }>({\n title,\n titleSeparator,\n hint,\n items,\n itemSeparator = true,\n dragHandleClass,\n getItemLabel,\n getDragHandleLabel,\n onMove,\n renderItem,\n container = (props) => <DefaultContainer {...props} />,\n wrapper: Wrapper = Fragment,\n dragOverlayWrapper,\n className,\n ...props\n}: SortableListProps<Item>) => {\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const draggingItem = items.find(({ id }) => id === draggingId);\n // dnd-kit reports the row over itself as soon as it's picked up; only a change of place is a move.\n const lastOverId = useRef<UniqueIdentifier | null>(null);\n const [keyboardMoves] = useState(createKeyboardMoves);\n // dnd-kit's default keyboard sensor moves 25px per press; this one moves to the next item.\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, keyboardMoves.keyboardSensorOptions),\n );\n\n const handleLabel = (item: Item) => {\n const name = getItemLabel?.(item).trim();\n return getDragHandleLabel?.(item) || (name ? `Reorder ${name}` : undefined);\n };\n const indexOf = (id: UniqueIdentifier) => items.findIndex((item) => item.id === String(id));\n const nameOf = (id: UniqueIdentifier) => {\n const item = items[indexOf(id)];\n return (\n (item && (getItemLabel?.(item).trim() || getDragHandleLabel?.(item).trim())) || String(id)\n );\n };\n const dropId = (active: { id: UniqueIdentifier }, over: { id: UniqueIdentifier } | null) => {\n const target = keyboardMoves.target();\n if (target === null) {\n return over?.id ?? null;\n }\n return indexOf(target) === -1 ? active.id : target;\n };\n const removedMessage = 'Moving cancelled. The item is no longer in the list.';\n const positionOf = (id: UniqueIdentifier) => `position ${indexOf(id) + 1} of ${items.length}`;\n const announcements: Announcements = {\n onDragStart: ({ active }) => {\n lastOverId.current = active.id;\n return `Picked up ${nameOf(active.id)}, ${positionOf(active.id)}.`;\n },\n onDragOver: ({ active, over }) => {\n const overId = over?.id ?? null;\n if (overId === lastOverId.current) {\n return undefined;\n }\n lastOverId.current = overId;\n return overId === null\n ? `${nameOf(active.id)} is no longer over the list.`\n : `${nameOf(active.id)} moved to ${positionOf(overId)}.`;\n },\n onDragEnd: ({ active, over }) => {\n const overId = dropId(active, over);\n if (indexOf(active.id) === -1) {\n return removedMessage;\n }\n return overId === null\n ? `${nameOf(active.id)} dropped. It stays at ${positionOf(active.id)}.`\n : `${nameOf(active.id)} dropped at ${positionOf(overId)}.`;\n },\n onDragCancel: ({ active }) =>\n indexOf(active.id) === -1\n ? removedMessage\n : `Moving cancelled. ${nameOf(active.id)} stays at ${positionOf(active.id)}.`,\n };\n\n if (!items.length) {\n return null;\n }\n\n return (\n <div\n className={cn('w-full', className)}\n data-row-dragging={draggingId !== null ? 'true' : undefined}\n {...props}\n >\n {title && (\n <div className={cn('mb-2', titleSeparator && 'space-y-1')}>\n <h6 className=\"text-base font-semibold text-muted-foreground\">{title}</h6>\n {titleSeparator && <Separator />}\n </div>\n )}\n <DndContext\n accessibility={{ announcements, screenReaderInstructions }}\n collisionDetection={keyboardMoves.collisionDetection}\n sensors={sensors}\n onDragCancel={() => setDraggingId(null)}\n onDragEnd={(event) => {\n try {\n const overId = dropId(event.active, event.over);\n // The lifted item may have been removed from the list during the drag.\n if (overId !== null && indexOf(event.active.id) !== -1) {\n onMove(String(event.active.id), String(overId));\n }\n } finally {\n setDraggingId(null);\n }\n }}\n onDragStart={(event) => {\n // A drag keeps its target until the next one starts, so the drop announcement can read it.\n keyboardMoves.reset(isKeyboardEvent(event.activatorEvent) ? event.active.id : null);\n setDraggingId(String(event.active.id));\n }}\n >\n <Wrapper>\n <SortableContext items={items} strategy={verticalListSortingStrategy}>\n {items.map((item) => (\n <SortableItem\n key={item.id}\n container={container}\n dragHandleClass={dragHandleClass}\n dragHandleLabel={handleLabel(item)}\n id={item.id}\n separator={itemSeparator}\n >\n {renderItem(item)}\n </SortableItem>\n ))}\n </SortableContext>\n </Wrapper>\n <DragOverlay wrapperElement={dragOverlayWrapper}>\n {draggingItem\n ? container({\n id: draggingItem.id,\n isDragging: true,\n dragHandleLabel: handleLabel(draggingItem),\n children: renderItem(draggingItem),\n })\n : null}\n </DragOverlay>\n </DndContext>\n {hint && (\n <div className=\"space-y-1 pt-1 text-sm text-muted-foreground\">\n {!itemSeparator && <Separator />}\n {hint}\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AA2DA,IAAa,iBAAiB,EAC5B,YACA,sBACA,qBACA,iBACA,iBACA,WACA,GAAG,YAEH,oBAAC,UAAD;CACE,cAAY,mBAAmB;CAC/B,WAAW,GACT,uHACA,aAAa,oBAAoB,eACjC,iBACA,SACF;CACA,MAAK;CACL,GAAI;CACJ,GAAI;CACJ,GAAI;WAEJ,oBAAC,MAAD;EAAM,eAAY;EAAO,WAAU;CAAU,CAAA;AACvC,CAAA;AAGV,IAAM,oBAAoB,EACxB,QACA,YACA,OACA,WACA,UACA,GAAG,YAEH,qBAAC,OAAD;CACE,KAAK;CACL,WAAW,GACT,2DACA,aAAa,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IACE;;EAEJ;;AAET"}
@@ -1,28 +1,68 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
+ import { useLayoutEffect, useRef } from "react";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  //#region src/components/ui/sticky-footer.tsx
4
- /** Keeps actions visible at the bottom of a scrolling surface. */
5
- var StickyFooter = ({ shiftY, height = 96, children, className, contentClassName, style, ...props }) => /* @__PURE__ */ jsxs("div", {
6
- className: cn("sticky z-[297] m-0 box-border w-full p-0", className),
7
- style: {
8
- bottom: shiftY ? `calc(${shiftY} - 24px)` : "-24px",
9
- height: `${height + 24}px`,
10
- ...style
11
- },
12
- ...props,
13
- children: [
14
- /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 z-[298] block h-6 bg-background" }),
15
- /* @__PURE__ */ jsx("div", {
16
- className: cn("sticky bottom-0 z-[299] -mb-6 flex items-center justify-between bg-background", contentClassName),
17
- style: { height },
18
- children
19
- }),
20
- /* @__PURE__ */ jsx("div", {
21
- className: "sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--color-border)_25%,transparent),0_-8px_16px_-3px_color-mix(in_oklab,var(--color-foreground)_8%,transparent)]",
22
- style: { bottom: shiftY ? `calc(${shiftY} + ${height - 24}px)` : `${height - 24}px` }
23
- })
24
- ]
25
- });
5
+ var isScrollContainer = (element) => {
6
+ const { overflowY } = getComputedStyle(element);
7
+ return overflowY === "auto" || overflowY === "scroll" || overflowY === "hidden";
8
+ };
9
+ /**
10
+ * Keeps actions visible at the bottom of a scrolling surface.
11
+ *
12
+ * The footer takes its background from `--sticky-footer-background`, which
13
+ * Shade's Dialog sets to its own surface; anywhere else it falls back to
14
+ * `--background`. When the scroll container has bottom padding, the footer
15
+ * fills it so content doesn't show beneath the footer.
16
+ */
17
+ var StickyFooter = ({ shiftY, height = 96, children, className, contentClassName, style, ...props }) => {
18
+ const ref = useRef(null);
19
+ useLayoutEffect(() => {
20
+ const footer = ref.current;
21
+ let container = footer?.parentElement ?? null;
22
+ while (container && !isScrollContainer(container)) container = container.parentElement;
23
+ if (!footer) return;
24
+ if (!container || container === footer.ownerDocument.documentElement) footer.style.setProperty("--sticky-footer-bottom", "var(--ghost-safe-area-inset-bottom, 0px)");
25
+ if (!container) return;
26
+ const scrollContainer = container;
27
+ const update = () => {
28
+ footer.style.setProperty("--sticky-footer-inset", getComputedStyle(scrollContainer).paddingBottom);
29
+ };
30
+ update();
31
+ window.addEventListener("resize", update);
32
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
33
+ observer?.observe(scrollContainer);
34
+ return () => {
35
+ window.removeEventListener("resize", update);
36
+ observer?.disconnect();
37
+ };
38
+ }, []);
39
+ const bottom = (offset) => `calc(${shiftY ? `${shiftY} + ` : ""}${offset} + var(--sticky-footer-bottom, 0px))`;
40
+ return /* @__PURE__ */ jsxs("div", {
41
+ ref,
42
+ className: cn("sticky z-[297] m-0 box-border w-full p-0 [--sticky-footer-bg:var(--sticky-footer-background,var(--background))]", className),
43
+ style: {
44
+ bottom: bottom("-24px"),
45
+ height: `${height + 24}px`,
46
+ ...style
47
+ },
48
+ ...props,
49
+ children: [
50
+ /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 z-[298] block h-6 bg-(--sticky-footer-bg)" }),
51
+ /* @__PURE__ */ jsxs("div", {
52
+ className: cn("sticky bottom-[var(--sticky-footer-bottom,0px)] z-[299] -mb-6 flex items-center justify-between bg-(--sticky-footer-bg)", contentClassName),
53
+ style: { height },
54
+ children: [children, /* @__PURE__ */ jsx("div", {
55
+ "aria-hidden": "true",
56
+ className: "pointer-events-none absolute inset-x-0 top-full h-[var(--sticky-footer-inset,0px)] bg-(--sticky-footer-bg)"
57
+ })]
58
+ }),
59
+ /* @__PURE__ */ jsx("div", {
60
+ className: "sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--border)_25%,transparent),0_-8px_16px_-3px_color-mix(in_oklab,var(--foreground)_8%,transparent)]",
61
+ style: { bottom: bottom(`${height - 24}px`) }
62
+ })
63
+ ]
64
+ });
65
+ };
26
66
  //#endregion
27
67
  export { StickyFooter };
28
68
 
@@ -1 +1 @@
1
- {"version":3,"file":"sticky-footer.js","names":[],"sources":["../../../src/components/ui/sticky-footer.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface StickyFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n shiftY?: string;\n height?: number;\n children?: ReactNode;\n contentClassName?: string;\n}\n\n/** Keeps actions visible at the bottom of a scrolling surface. */\nexport const StickyFooter = ({\n shiftY,\n height = 96,\n children,\n className,\n contentClassName,\n style,\n ...props\n}: StickyFooterProps) => (\n <div\n className={cn('sticky z-[297] m-0 box-border w-full p-0', className)}\n style={{\n bottom: shiftY ? `calc(${shiftY} - 24px)` : '-24px',\n height: `${height + 24}px`,\n ...style,\n }}\n {...props}\n >\n <div className=\"sticky bottom-0 z-[298] block h-6 bg-background\" />\n <div\n className={cn(\n 'sticky bottom-0 z-[299] -mb-6 flex items-center justify-between bg-background',\n contentClassName,\n )}\n style={{ height }}\n >\n {children}\n </div>\n <div\n className=\"sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--color-border)_25%,transparent),0_-8px_16px_-3px_color-mix(in_oklab,var(--color-foreground)_8%,transparent)]\"\n style={{ bottom: shiftY ? `calc(${shiftY} + ${height - 24}px)` : `${height - 24}px` }}\n />\n </div>\n);\n"],"mappings":";;;;AAWA,IAAa,gBAAgB,EAC3B,QACA,SAAS,IACT,UACA,WACA,kBACA,OACA,GAAG,YAEH,qBAAC,OAAD;CACE,WAAW,GAAG,4CAA4C,SAAS;CACnE,OAAO;EACL,QAAQ,SAAS,QAAQ,OAAO,YAAY;EAC5C,QAAQ,GAAG,SAAS,GAAG;EACvB,GAAG;CACL;CACA,GAAI;WAPN;EASE,oBAAC,OAAD,EAAK,WAAU,kDAAmD,CAAA;EAClE,oBAAC,OAAD;GACE,WAAW,GACT,iFACA,gBACF;GACA,OAAO,EAAE,OAAO;GAEf;EACE,CAAA;EACL,oBAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,QAAQ,SAAS,QAAQ,OAAO,KAAK,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI;EACrF,CAAA;CACE"}
1
+ {"version":3,"file":"sticky-footer.js","names":[],"sources":["../../../src/components/ui/sticky-footer.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface StickyFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n shiftY?: string;\n height?: number;\n children?: ReactNode;\n contentClassName?: string;\n}\n\n// The element sticky positioning measures against. `hidden` makes one too;\n// `clip` doesn't.\nconst isScrollContainer = (element: HTMLElement) => {\n const { overflowY } = getComputedStyle(element);\n return overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'hidden';\n};\n\n/**\n * Keeps actions visible at the bottom of a scrolling surface.\n *\n * The footer takes its background from `--sticky-footer-background`, which\n * Shade's Dialog sets to its own surface; anywhere else it falls back to\n * `--background`. When the scroll container has bottom padding, the footer\n * fills it so content doesn't show beneath the footer.\n */\nexport const StickyFooter = ({\n shiftY,\n height = 96,\n children,\n className,\n contentClassName,\n style,\n ...props\n}: StickyFooterProps) => {\n const ref = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n const footer = ref.current;\n let container = footer?.parentElement ?? null;\n while (container && !isScrollContainer(container)) {\n container = container.parentElement;\n }\n if (!footer) {\n return;\n }\n if (!container || container === footer.ownerDocument.documentElement) {\n // In an app, the window's bottom is under Admin's chrome.\n footer.style.setProperty(\n '--sticky-footer-bottom',\n 'var(--ghost-safe-area-inset-bottom, 0px)',\n );\n }\n if (!container) {\n return;\n }\n\n const scrollContainer = container;\n const update = () => {\n footer.style.setProperty(\n '--sticky-footer-inset',\n getComputedStyle(scrollContainer).paddingBottom,\n );\n };\n update();\n\n // Responsive padding follows the window or the container's size, and a\n // breakpoint can change the padding without resizing the content box.\n window.addEventListener('resize', update);\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(update);\n observer?.observe(scrollContainer);\n\n return () => {\n window.removeEventListener('resize', update);\n observer?.disconnect();\n };\n }, []);\n\n const bottom = (offset: string) =>\n `calc(${shiftY ? `${shiftY} + ` : ''}${offset} + var(--sticky-footer-bottom, 0px))`;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'sticky z-[297] m-0 box-border w-full p-0 [--sticky-footer-bg:var(--sticky-footer-background,var(--background))]',\n className,\n )}\n style={{\n bottom: bottom('-24px'),\n height: `${height + 24}px`,\n ...style,\n }}\n {...props}\n >\n <div className=\"sticky bottom-0 z-[298] block h-6 bg-(--sticky-footer-bg)\" />\n <div\n className={cn(\n 'sticky bottom-[var(--sticky-footer-bottom,0px)] z-[299] -mb-6 flex items-center justify-between bg-(--sticky-footer-bg)',\n contentClassName,\n )}\n style={{ height }}\n >\n {children}\n {/* Fills the scroll container's bottom padding below the footer. */}\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-x-0 top-full h-[var(--sticky-footer-inset,0px)] bg-(--sticky-footer-bg)\"\n />\n </div>\n <div\n className=\"sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--border)_25%,transparent),0_-8px_16px_-3px_color-mix(in_oklab,var(--foreground)_8%,transparent)]\"\n style={{ bottom: bottom(`${height - 24}px`) }}\n />\n </div>\n );\n};\n"],"mappings":";;;;AAYA,IAAM,qBAAqB,YAAyB;CAClD,MAAM,EAAE,cAAc,iBAAiB,OAAO;CAC9C,OAAO,cAAc,UAAU,cAAc,YAAY,cAAc;AACzE;;;;;;;;;AAUA,IAAa,gBAAgB,EAC3B,QACA,SAAS,IACT,UACA,WACA,kBACA,OACA,GAAG,YACoB;CACvB,MAAM,MAAM,OAAuB,IAAI;CAEvC,sBAAsB;EACpB,MAAM,SAAS,IAAI;EACnB,IAAI,YAAY,QAAQ,iBAAiB;EACzC,OAAO,aAAa,CAAC,kBAAkB,SAAS,GAC9C,YAAY,UAAU;EAExB,IAAI,CAAC,QACH;EAEF,IAAI,CAAC,aAAa,cAAc,OAAO,cAAc,iBAEnD,OAAO,MAAM,YACX,0BACA,0CACF;EAEF,IAAI,CAAC,WACH;EAGF,MAAM,kBAAkB;EACxB,MAAM,eAAe;GACnB,OAAO,MAAM,YACX,yBACA,iBAAiB,eAAe,CAAC,CAAC,aACpC;EACF;EACA,OAAO;EAIP,OAAO,iBAAiB,UAAU,MAAM;EACxC,MAAM,WAAW,OAAO,mBAAmB,cAAc,OAAO,IAAI,eAAe,MAAM;EACzF,UAAU,QAAQ,eAAe;EAEjC,aAAa;GACX,OAAO,oBAAoB,UAAU,MAAM;GAC3C,UAAU,WAAW;EACvB;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,WACd,QAAQ,SAAS,GAAG,OAAO,OAAO,KAAK,OAAO;CAEhD,OACE,qBAAC,OAAD;EACO;EACL,WAAW,GACT,mHACA,SACF;EACA,OAAO;GACL,QAAQ,OAAO,OAAO;GACtB,QAAQ,GAAG,SAAS,GAAG;GACvB,GAAG;EACL;EACA,GAAI;YAXN;GAaE,oBAAC,OAAD,EAAK,WAAU,4DAA6D,CAAA;GAC5E,qBAAC,OAAD;IACE,WAAW,GACT,2HACA,gBACF;IACA,OAAO,EAAE,OAAO;cALlB,CAOG,UAED,oBAAC,OAAD;KACE,eAAY;KACZ,WAAU;IACX,CAAA,CACE;;GACL,oBAAC,OAAD;IACE,WAAU;IACV,OAAO,EAAE,QAAQ,OAAO,GAAG,SAAS,GAAG,GAAG,EAAE;GAC7C,CAAA;EACE;;AAET"}
@@ -1,5 +1,7 @@
1
1
  import { cn } from "../../lib/ds-utils.js";
2
2
  import { Button } from "./button.js";
3
+ import { rowSurface } from "./row-surface.js";
4
+ import { useRowBehavior } from "../../hooks/use-row-behavior.js";
3
5
  import * as React$1 from "react";
4
6
  import { jsx } from "react/jsx-runtime";
5
7
  import { cva } from "class-variance-authority";
@@ -15,7 +17,7 @@ var Table = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
15
17
  Table.displayName = "Table";
16
18
  var TableHeader = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", {
17
19
  ref,
18
- className: cn("[&_tr:hover:before]:bg-transparent", className),
20
+ className,
19
21
  ...props
20
22
  }));
21
23
  TableHeader.displayName = "TableHeader";
@@ -31,15 +33,24 @@ var TableFooter = React$1.forwardRef(({ className, ...props }, ref) => /* @__PUR
31
33
  ...props
32
34
  }));
33
35
  TableFooter.displayName = "TableFooter";
34
- var TableRow = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", {
35
- ref,
36
- className: cn("group relative border-b data-[state=selected]:bg-muted", className),
37
- ...props
38
- }));
36
+ var TableRow = React$1.forwardRef(({ className, interactive, onClick, ...props }, ref) => {
37
+ const isInteractive = interactive ?? (onClick ? true : void 0);
38
+ const behavior = useRowBehavior({
39
+ ...props,
40
+ onClick
41
+ }, isInteractive);
42
+ return /* @__PURE__ */ jsx("tr", {
43
+ ref,
44
+ className: cn("group relative border-b", rowSurface(isInteractive === false ? "static" : isInteractive ? "interactive" : "auto"), className),
45
+ onClick,
46
+ ...props,
47
+ ...behavior
48
+ });
49
+ });
39
50
  TableRow.displayName = "TableRow";
40
51
  var headVariants = cva("relative align-middle", {
41
52
  variants: { variant: {
42
- default: "h-(--control-height) px-2 text-left text-sm font-medium tracking-wide text-text-secondary [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
53
+ default: "column-label h-(--control-height) px-2 text-left text-sm font-medium tracking-wide text-text-secondary [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
43
54
  cardhead: "text-base font-normal [&>div]:px-0"
44
55
  } },
45
56
  defaultVariants: { variant: "default" }
@@ -55,7 +66,7 @@ var TableHead = React$1.forwardRef(({ className, variant, ...props }, ref) => /*
55
66
  TableHead.displayName = "TableHead";
56
67
  var TableHeadButton = ({ className, children, ...props }) => {
57
68
  return /* @__PURE__ */ jsx(Button, {
58
- className: cn("gap-1 px-0 text-right text-sm leading-4 tracking-wide text-text-secondary uppercase hover:bg-transparent [&_svg]:size-4", className),
69
+ className: cn("column-label gap-1 px-0 text-right text-sm leading-4 tracking-wide text-text-secondary uppercase hover:bg-transparent [&_svg]:size-4", className),
59
70
  size: "sm",
60
71
  variant: "ghost",
61
72
  ...props,
@@ -65,7 +76,7 @@ var TableHeadButton = ({ className, children, ...props }) => {
65
76
  TableHeadButton.displayName = "TableHeadButton";
66
77
  var TableCell = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("td", {
67
78
  ref,
68
- className: cn("relative p-2.5 align-middle group-hover:bg-table-row-hover [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
79
+ className: cn("relative p-2.5 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
69
80
  ...props
70
81
  }));
71
82
  TableCell.displayName = "TableCell";
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","names":[],"sources":["../../../src/components/ui/table.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\nimport { Button } from './button';\nimport { cva, VariantProps } from 'class-variance-authority';\n\nconst Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className, ...props }, ref) => (\n <div className=\"relative w-full\">\n <table ref={ref} className={cn('w-full caption-bottom text-base', className)} {...props} />\n </div>\n ),\n);\nTable.displayName = 'Table';\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead ref={ref} className={cn('[&_tr:hover:before]:bg-transparent', className)} {...props} />\n));\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => <tbody ref={ref} className={cn('', className)} {...props} />);\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn('border-b bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn('group relative border-b data-[state=selected]:bg-muted', className)}\n {...props}\n />\n ),\n);\nTableRow.displayName = 'TableRow';\n\nconst headVariants = cva('relative align-middle', {\n variants: {\n variant: {\n default:\n 'h-(--control-height) px-2 text-left text-sm font-medium tracking-wide text-text-secondary [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',\n cardhead: 'text-base font-normal [&>div]:px-0',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport interface TableHeadProps\n extends React.ThHTMLAttributes<HTMLTableCellElement>, VariantProps<typeof headVariants> {\n asChild?: boolean;\n}\n\nconst TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className, variant, ...props }, ref) => (\n <th ref={ref} className={cn(headVariants({ variant, className }))} {...props} />\n ),\n);\nTableHead.displayName = 'TableHead';\n\ntype TableHeadButtonProps = React.ComponentProps<typeof Button>;\n\nconst TableHeadButton: React.FC<TableHeadButtonProps> = ({ className, children, ...props }) => {\n const buttonClassName = cn(\n 'gap-1 px-0 text-right text-sm leading-4 tracking-wide text-text-secondary uppercase hover:bg-transparent [&_svg]:size-4',\n className,\n );\n return (\n <Button className={buttonClassName} size=\"sm\" variant=\"ghost\" {...props}>\n {children}\n </Button>\n );\n};\nTableHeadButton.displayName = 'TableHeadButton';\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn(\n 'relative p-2.5 align-middle group-hover:bg-table-row-hover [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',\n className,\n )}\n {...props}\n />\n));\nTableCell.displayName = 'TableCell';\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption ref={ref} className={cn('mt-4 text-base text-muted-foreground', className)} {...props} />\n));\nTableCaption.displayName = 'TableCaption';\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableHeadButton,\n TableRow,\n TableCell,\n TableCaption,\n};\n"],"mappings":";;;;;;AAMA,IAAM,QAAQ,QAAM,YACjB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,OAAD;CAAK,WAAU;WACb,oBAAC,SAAD;EAAY;EAAK,WAAW,GAAG,mCAAmC,SAAS;EAAG,GAAI;CAAQ,CAAA;AACvF,CAAA,CAET;AACA,MAAM,cAAc;AAEpB,IAAM,cAAc,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,SAAD;CAAY;CAAK,WAAW,GAAG,sCAAsC,SAAS;CAAG,GAAI;AAAQ,CAAA,CAC9F;AACD,YAAY,cAAc;AAE1B,IAAM,YAAY,QAAM,YAGrB,EAAE,WAAW,GAAG,SAAS,QAAQ,oBAAC,SAAD;CAAY;CAAK,WAAW,GAAG,IAAI,SAAS;CAAG,GAAI;AAAQ,CAAA,CAAC;AAChG,UAAU,cAAc;AAExB,IAAM,cAAc,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,SAAD;CACO;CACL,WAAW,GAAG,2DAA2D,SAAS;CAClF,GAAI;AACL,CAAA,CACF;AACD,YAAY,cAAc;AAE1B,IAAM,WAAW,QAAM,YACpB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,MAAD;CACO;CACL,WAAW,GAAG,0DAA0D,SAAS;CACjF,GAAI;AACL,CAAA,CAEL;AACA,SAAS,cAAc;AAEvB,IAAM,eAAe,IAAI,yBAAyB;CAChD,UAAU,EACR,SAAS;EACP,SACE;EACF,UAAU;CACZ,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AAOD,IAAM,YAAY,QAAM,YACrB,EAAE,WAAW,SAAS,GAAG,SAAS,QACjC,oBAAC,MAAD;CAAS;CAAK,WAAW,GAAG,aAAa;EAAE;EAAS;CAAU,CAAC,CAAC;CAAG,GAAI;AAAQ,CAAA,CAEnF;AACA,UAAU,cAAc;AAIxB,IAAM,mBAAmD,EAAE,WAAW,UAAU,GAAG,YAAY;CAK7F,OACE,oBAAC,QAAD;EAAQ,WALc,GACtB,2HACA,SAGmB;EAAiB,MAAK;EAAK,SAAQ;EAAQ,GAAI;EAC/D;CACK,CAAA;AAEZ;AACA,gBAAgB,cAAc;AAE9B,IAAM,YAAY,QAAM,YAGrB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CACO;CACL,WAAW,GACT,kIACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,UAAU,cAAc;AAExB,IAAM,eAAe,QAAM,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,WAAD;CAAc;CAAK,WAAW,GAAG,wCAAwC,SAAS;CAAG,GAAI;AAAQ,CAAA,CAClG;AACD,aAAa,cAAc"}
1
+ {"version":3,"file":"table.js","names":[],"sources":["../../../src/components/ui/table.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\nimport { Button } from './button';\nimport { cva, VariantProps } from 'class-variance-authority';\nimport { rowSurface } from '@/components/ui/row-surface';\nimport { useRowBehavior } from '@/hooks/use-row-behavior';\n\nconst Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className, ...props }, ref) => (\n <div className=\"relative w-full\">\n <table ref={ref} className={cn('w-full caption-bottom text-base', className)} {...props} />\n </div>\n ),\n);\nTable.displayName = 'Table';\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => <thead ref={ref} className={className} {...props} />);\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => <tbody ref={ref} className={cn('', className)} {...props} />);\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn('border-b bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\ninterface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n interactive?: boolean;\n}\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ className, interactive, onClick, ...props }, ref) => {\n const isInteractive = interactive ?? (onClick ? true : undefined);\n const behavior = useRowBehavior({ ...props, onClick }, isInteractive);\n return (\n <tr\n ref={ref}\n className={cn(\n 'group relative border-b',\n rowSurface(isInteractive === false ? 'static' : isInteractive ? 'interactive' : 'auto'),\n className,\n )}\n onClick={onClick}\n {...props}\n {...behavior}\n />\n );\n },\n);\nTableRow.displayName = 'TableRow';\n\nconst headVariants = cva('relative align-middle', {\n variants: {\n variant: {\n default:\n 'column-label h-(--control-height) px-2 text-left text-sm font-medium tracking-wide text-text-secondary [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',\n cardhead: 'text-base font-normal [&>div]:px-0',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport interface TableHeadProps\n extends React.ThHTMLAttributes<HTMLTableCellElement>, VariantProps<typeof headVariants> {\n asChild?: boolean;\n}\n\nconst TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className, variant, ...props }, ref) => (\n <th ref={ref} className={cn(headVariants({ variant, className }))} {...props} />\n ),\n);\nTableHead.displayName = 'TableHead';\n\ntype TableHeadButtonProps = React.ComponentProps<typeof Button>;\n\nconst TableHeadButton: React.FC<TableHeadButtonProps> = ({ className, children, ...props }) => {\n const buttonClassName = cn(\n 'column-label gap-1 px-0 text-right text-sm leading-4 tracking-wide text-text-secondary uppercase hover:bg-transparent [&_svg]:size-4',\n className,\n );\n return (\n <Button className={buttonClassName} size=\"sm\" variant=\"ghost\" {...props}>\n {children}\n </Button>\n );\n};\nTableHeadButton.displayName = 'TableHeadButton';\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn(\n 'relative p-2.5 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',\n className,\n )}\n {...props}\n />\n));\nTableCell.displayName = 'TableCell';\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption ref={ref} className={cn('mt-4 text-base text-muted-foreground', className)} {...props} />\n));\nTableCaption.displayName = 'TableCaption';\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableHeadButton,\n TableRow,\n TableCell,\n TableCaption,\n};\n"],"mappings":";;;;;;;;AAQA,IAAM,QAAQ,QAAM,YACjB,EAAE,WAAW,GAAG,SAAS,QACxB,oBAAC,OAAD;CAAK,WAAU;WACb,oBAAC,SAAD;EAAY;EAAK,WAAW,GAAG,mCAAmC,SAAS;EAAG,GAAI;CAAQ,CAAA;AACvF,CAAA,CAET;AACA,MAAM,cAAc;AAEpB,IAAM,cAAc,QAA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K;EAAK,SAAQ;EAAQ,GAAI;EAC/D;CACK,CAAA;AAEZ;AACA,gBAAgB,cAAc;AAE9B,IAAM,YAAY,QAAM,YAGrB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,MAAD;CACO;CACL,WAAW,GACT,mGACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,UAAU,cAAc;AAExB,IAAM,eAAe,QAAM,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,WAAD;CAAc;CAAK,WAAW,GAAG,wCAAwC,SAAS;CAAG,GAAI;AAAQ,CAAA,CAClG;AACD,aAAa,cAAc"}
@@ -1,5 +1,27 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  //#region src/components/ui/tabs-variants.ts
3
+ var tabSurfaceVariants = cva("", {
4
+ variants: {
5
+ admin7Design: {
6
+ true: "rounded-full border border-border bg-transparent text-foreground hover:bg-tab-hover hover:text-foreground enabled:active:bg-button-ghost-hover enabled:aria-expanded:bg-button-ghost-hover enabled:aria-expanded:text-foreground data-[state=active]:border-transparent data-[state=active]:bg-tab-inactive data-[state=active]:text-foreground data-[state=active]:hover:bg-tab-inactive data-[state=active]:hover:text-foreground data-[state=active]:enabled:active:bg-button-ghost-hover data-[state=active]:enabled:aria-expanded:bg-button-ghost-hover data-[state=active]:enabled:aria-expanded:text-foreground",
7
+ false: ""
8
+ },
9
+ size: {
10
+ default: "",
11
+ compact: ""
12
+ }
13
+ },
14
+ compoundVariants: [{
15
+ admin7Design: true,
16
+ size: "default",
17
+ className: "px-4"
18
+ }, {
19
+ admin7Design: true,
20
+ size: "compact",
21
+ className: "px-3"
22
+ }],
23
+ defaultVariants: { size: "default" }
24
+ });
3
25
  var tabsVariants = cva("", {
4
26
  variants: { variant: {
5
27
  segmented: "",
@@ -14,6 +36,6 @@ var tabsVariants = cva("", {
14
36
  defaultVariants: { variant: "segmented" }
15
37
  });
16
38
  //#endregion
17
- export { tabsVariants };
39
+ export { tabSurfaceVariants, tabsVariants };
18
40
 
19
41
  //# sourceMappingURL=tabs-variants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabs-variants.js","names":[],"sources":["../../../src/components/ui/tabs-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst tabsVariants = cva('', {\n variants: {\n variant: {\n segmented: '',\n 'segmented-sm': '',\n button: '',\n 'button-sm': '',\n underline: '',\n navbar: '',\n pill: '',\n kpis: '',\n },\n },\n defaultVariants: {\n variant: 'segmented',\n },\n});\n\nexport { tabsVariants };\n"],"mappings":";;AAEA,IAAM,eAAe,IAAI,IAAI;CAC3B,UAAU,EACR,SAAS;EACP,WAAW;EACX,gBAAgB;EAChB,QAAQ;EACR,aAAa;EACb,WAAW;EACX,QAAQ;EACR,MAAM;EACN,MAAM;CACR,EACF;CACA,iBAAiB,EACf,SAAS,YACX;AACF,CAAC"}
1
+ {"version":3,"file":"tabs-variants.js","names":[],"sources":["../../../src/components/ui/tabs-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\n// Shared by button tabs, including Settings previews, and PageMenu navigation.\nconst tabSurfaceVariants = cva('', {\n variants: {\n admin7Design: {\n true: 'rounded-full border border-border bg-transparent text-foreground hover:bg-tab-hover hover:text-foreground enabled:active:bg-button-ghost-hover enabled:aria-expanded:bg-button-ghost-hover enabled:aria-expanded:text-foreground data-[state=active]:border-transparent data-[state=active]:bg-tab-inactive data-[state=active]:text-foreground data-[state=active]:hover:bg-tab-inactive data-[state=active]:hover:text-foreground data-[state=active]:enabled:active:bg-button-ghost-hover data-[state=active]:enabled:aria-expanded:bg-button-ghost-hover data-[state=active]:enabled:aria-expanded:text-foreground',\n false: '',\n },\n size: {\n default: '',\n compact: '',\n },\n },\n compoundVariants: [\n { admin7Design: true, size: 'default', className: 'px-4' },\n { admin7Design: true, size: 'compact', className: 'px-3' },\n ],\n defaultVariants: { size: 'default' },\n});\n\nconst tabsVariants = cva('', {\n variants: {\n variant: {\n segmented: '',\n 'segmented-sm': '',\n button: '',\n 'button-sm': '',\n underline: '',\n navbar: '',\n pill: '',\n kpis: '',\n },\n },\n defaultVariants: {\n variant: 'segmented',\n },\n});\n\nexport { tabsVariants, tabSurfaceVariants };\n"],"mappings":";;AAGA,IAAM,qBAAqB,IAAI,IAAI;CACjC,UAAU;EACR,cAAc;GACZ,MAAM;GACN,OAAO;EACT;EACA,MAAM;GACJ,SAAS;GACT,SAAS;EACX;CACF;CACA,kBAAkB,CAChB;EAAE,cAAc;EAAM,MAAM;EAAW,WAAW;CAAO,GACzD;EAAE,cAAc;EAAM,MAAM;EAAW,WAAW;CAAO,CAC3D;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAED,IAAM,eAAe,IAAI,IAAI;CAC3B,UAAU,EACR,SAAS;EACP,WAAW;EACX,gBAAgB;EAChB,QAAQ;EACR,aAAa;EACb,WAAW;EACX,QAAQ;EACR,MAAM;EACN,MAAM;CACR,EACF;CACA,iBAAiB,EACf,SAAS,YACX;AACF,CAAC"}