@justanarthur/modo-ui 0.5.0 → 0.6.0-canary.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 (461) hide show
  1. package/DESIGN.md +608 -0
  2. package/README.md +61 -39
  3. package/blocks/sidebar-app/examples.mdx +33 -0
  4. package/blocks/sidebar-app/index.tsx +218 -0
  5. package/blocks/sidebar-app/inset-topbar.tsx +25 -0
  6. package/blocks/sidebar-app/menu-grid.ts +26 -0
  7. package/blocks/sidebar-app/nav-data.ts +36 -0
  8. package/blocks/sidebar-app/search-field.tsx +48 -0
  9. package/blocks/sidebar-app/user-footer.tsx +67 -0
  10. package/blocks/sidebar-app/workspace-header.tsx +129 -0
  11. package/components/AI/input-message/examples.mdx +124 -0
  12. package/components/AI/input-message/file-thumbnail.tsx +173 -0
  13. package/components/AI/input-message/index.tsx +1383 -0
  14. package/components/AI/thinking-indicator/examples.mdx +27 -0
  15. package/components/AI/thinking-indicator/index.tsx +210 -0
  16. package/components/accordion/examples.mdx +148 -0
  17. package/components/accordion/index.tsx +1034 -0
  18. package/components/avatar/examples.mdx +95 -0
  19. package/components/avatar/index.tsx +129 -0
  20. package/components/badge/change-demo.tsx +29 -0
  21. package/components/badge/examples.mdx +120 -0
  22. package/components/badge/index.tsx +225 -0
  23. package/components/badge/variants.ts +73 -0
  24. package/components/button/examples.mdx +164 -0
  25. package/components/button/index.tsx +416 -0
  26. package/components/button/loading-demo.tsx +25 -0
  27. package/components/button/variants.ts +166 -0
  28. package/components/card/examples.mdx +212 -0
  29. package/components/card/index.tsx +1037 -0
  30. package/components/copy/examples.mdx +87 -0
  31. package/components/copy/index.tsx +482 -0
  32. package/components/inputs/checkbox/examples.mdx +83 -0
  33. package/components/inputs/checkbox/index.tsx +611 -0
  34. package/components/inputs/checkbox/select-all-demo.tsx +48 -0
  35. package/components/inputs/color-picker/examples.mdx +72 -0
  36. package/components/inputs/color-picker/index.tsx +1955 -0
  37. package/components/inputs/color-picker/variants.ts +401 -0
  38. package/components/inputs/combobox/examples.mdx +273 -0
  39. package/components/inputs/combobox/index.tsx +1436 -0
  40. package/components/inputs/combobox/remote-demo.tsx +101 -0
  41. package/components/inputs/date-time/calendar/examples.mdx +34 -0
  42. package/components/inputs/date-time/calendar/index.tsx +351 -0
  43. package/components/inputs/date-time/calendar/use-month-window.ts +163 -0
  44. package/components/inputs/date-time/date-picker/examples.mdx +166 -0
  45. package/components/inputs/date-time/date-picker/index.tsx +385 -0
  46. package/components/inputs/date-time/date-picker/masked-date-input.tsx +336 -0
  47. package/components/inputs/date-time/date-range-picker/examples.mdx +29 -0
  48. package/components/inputs/date-time/date-range-picker/index.tsx +217 -0
  49. package/components/inputs/date-time/duration-picker/examples.mdx +16 -0
  50. package/components/inputs/date-time/duration-picker/index.tsx +189 -0
  51. package/components/inputs/date-time/month-picker/examples.mdx +16 -0
  52. package/components/inputs/date-time/month-picker/index.tsx +190 -0
  53. package/components/inputs/date-time/picker-shell.tsx +395 -0
  54. package/components/inputs/date-time/time-columns.tsx +91 -0
  55. package/components/inputs/date-time/time-picker/examples.mdx +26 -0
  56. package/components/inputs/date-time/time-picker/index.tsx +166 -0
  57. package/components/inputs/field/examples.mdx +113 -0
  58. package/components/inputs/field/index.tsx +267 -0
  59. package/components/inputs/file-dropzone/examples.mdx +73 -0
  60. package/components/inputs/file-dropzone/file-row.tsx +201 -0
  61. package/components/inputs/file-dropzone/index.tsx +296 -0
  62. package/components/inputs/file-dropzone/upload-demo.tsx +67 -0
  63. package/components/inputs/file-dropzone/variants.ts +94 -0
  64. package/components/inputs/input/examples.mdx +135 -0
  65. package/components/inputs/input/index.tsx +494 -0
  66. package/components/inputs/input/password-demo.tsx +30 -0
  67. package/components/inputs/label/examples.mdx +67 -0
  68. package/components/inputs/label/index.tsx +85 -0
  69. package/components/inputs/number-input/examples.mdx +56 -0
  70. package/components/inputs/number-input/index.tsx +214 -0
  71. package/components/inputs/radio/examples.mdx +77 -0
  72. package/components/inputs/radio/index.tsx +636 -0
  73. package/components/inputs/search/examples.mdx +74 -0
  74. package/components/inputs/search/index.tsx +333 -0
  75. package/components/inputs/select/examples.mdx +218 -0
  76. package/components/inputs/select/index.tsx +862 -0
  77. package/components/inputs/select/variants.ts +32 -0
  78. package/components/inputs/slider/examples.mdx +127 -0
  79. package/components/inputs/slider/index.tsx +1725 -0
  80. package/components/inputs/switch/examples.mdx +94 -0
  81. package/components/inputs/switch/index.tsx +504 -0
  82. package/components/inputs/textarea/examples.mdx +88 -0
  83. package/components/inputs/textarea/index.tsx +161 -0
  84. package/components/navigation/navigation-menu/examples.mdx +109 -0
  85. package/components/navigation/navigation-menu/index.tsx +613 -0
  86. package/components/navigation/pagination/examples.mdx +64 -0
  87. package/components/navigation/pagination/index.tsx +395 -0
  88. package/components/navigation/sidebar/examples.mdx +319 -0
  89. package/components/navigation/sidebar/index.tsx +453 -0
  90. package/components/navigation/sidebar/sidebar-core.tsx +1408 -0
  91. package/components/navigation/sidebar/sidebar-menu.tsx +1495 -0
  92. package/components/navigation/sidebar/sidebar.css +74 -0
  93. package/components/navigation/sidebar/variants.ts +55 -0
  94. package/components/navigation/tabs/examples.mdx +89 -0
  95. package/components/navigation/tabs/index.tsx +494 -0
  96. package/components/navigation/tabs-subtle/examples.mdx +49 -0
  97. package/components/navigation/tabs-subtle/index.tsx +512 -0
  98. package/components/overlays/alert-dialog/examples.mdx +123 -0
  99. package/components/overlays/alert-dialog/index.tsx +258 -0
  100. package/components/overlays/alert-dialog/pending-demo.tsx +36 -0
  101. package/components/overlays/command/examples.mdx +113 -0
  102. package/components/overlays/command/index.tsx +416 -0
  103. package/components/overlays/context-menu/examples.mdx +56 -0
  104. package/components/overlays/context-menu/index.tsx +279 -0
  105. package/components/overlays/dialog/examples.mdx +144 -0
  106. package/components/overlays/dialog/index.tsx +366 -0
  107. package/components/overlays/dropdown/dropdown-search.tsx +395 -0
  108. package/components/overlays/dropdown/examples.mdx +294 -0
  109. package/components/overlays/dropdown/index.tsx +1168 -0
  110. package/components/overlays/dropdown/menu-item.tsx +464 -0
  111. package/components/overlays/dropdown/menu-parts.tsx +660 -0
  112. package/components/overlays/popover/anchored-demo.tsx +59 -0
  113. package/components/overlays/popover/examples.mdx +180 -0
  114. package/components/overlays/popover/index.tsx +315 -0
  115. package/components/overlays/preview-card/examples.mdx +61 -0
  116. package/components/overlays/preview-card/index.tsx +204 -0
  117. package/components/overlays/sheet/examples.mdx +89 -0
  118. package/components/overlays/sheet/index.tsx +247 -0
  119. package/components/overlays/toast/examples.mdx +68 -0
  120. package/components/overlays/toast/global-demo.tsx +72 -0
  121. package/components/overlays/toast/index.tsx +474 -0
  122. package/components/overlays/toast/manager.ts +193 -0
  123. package/components/overlays/tooltip/examples.mdx +106 -0
  124. package/components/overlays/tooltip/index.tsx +519 -0
  125. package/components/progress/examples.mdx +59 -0
  126. package/components/progress/index.tsx +174 -0
  127. package/components/progress/progress.css +49 -0
  128. package/components/progress/step-demo.tsx +27 -0
  129. package/components/table/examples.mdx +184 -0
  130. package/components/table/index.tsx +510 -0
  131. package/components/table/sort-demo.tsx +61 -0
  132. package/dist/base.css +100 -0
  133. package/dist/blocks/sidebar-app/index.js +39 -26
  134. package/dist/components/AI/input-message/index.js +22 -16
  135. package/dist/components/AI/thinking-indicator/index.js +9 -6
  136. package/dist/components/accordion/index.js +16 -13
  137. package/dist/components/avatar/index.d.ts +46 -0
  138. package/dist/components/avatar/index.js +18 -0
  139. package/dist/components/badge/index.d.ts +18 -11
  140. package/dist/components/badge/index.js +11 -7
  141. package/dist/components/badge/variants.d.ts +33 -0
  142. package/dist/components/badge/variants.js +10 -0
  143. package/dist/components/button/index.d.ts +53 -17
  144. package/dist/components/button/index.js +10 -6
  145. package/dist/components/button/variants.d.ts +39 -0
  146. package/dist/components/button/variants.js +8 -0
  147. package/dist/components/card/index.d.ts +16 -3
  148. package/dist/components/card/index.js +16 -11
  149. package/dist/components/copy/index.js +13 -9
  150. package/dist/components/inputs/checkbox/index.d.ts +28 -9
  151. package/dist/components/inputs/checkbox/index.js +17 -13
  152. package/dist/components/inputs/color-picker/index.d.ts +13 -13
  153. package/dist/components/inputs/color-picker/index.js +25 -18
  154. package/dist/components/inputs/color-picker/variants.d.ts +61 -0
  155. package/dist/components/inputs/color-picker/variants.js +28 -0
  156. package/dist/components/inputs/combobox/index.d.ts +60 -17
  157. package/dist/components/inputs/combobox/index.js +26 -18
  158. package/dist/components/inputs/date-time/calendar/index.js +14 -11
  159. package/dist/components/inputs/date-time/date-picker/index.d.ts +53 -11
  160. package/dist/components/inputs/date-time/date-picker/index.js +33 -25
  161. package/dist/components/inputs/date-time/date-range-picker/index.d.ts +3 -3
  162. package/dist/components/inputs/date-time/date-range-picker/index.js +32 -24
  163. package/dist/components/inputs/date-time/duration-picker/index.d.ts +3 -3
  164. package/dist/components/inputs/date-time/duration-picker/index.js +32 -24
  165. package/dist/components/inputs/date-time/month-picker/index.d.ts +3 -3
  166. package/dist/components/inputs/date-time/month-picker/index.js +31 -23
  167. package/dist/components/inputs/date-time/time-picker/index.d.ts +3 -3
  168. package/dist/components/inputs/date-time/time-picker/index.js +32 -24
  169. package/dist/components/inputs/field/index.d.ts +116 -0
  170. package/dist/components/inputs/field/index.js +28 -0
  171. package/dist/components/inputs/file-dropzone/index.d.ts +165 -0
  172. package/dist/components/inputs/file-dropzone/index.js +32 -0
  173. package/dist/components/inputs/file-dropzone/variants.d.ts +35 -0
  174. package/dist/components/inputs/file-dropzone/variants.js +12 -0
  175. package/dist/components/inputs/input/index.d.ts +95 -13
  176. package/dist/components/inputs/input/index.js +17 -9
  177. package/dist/components/inputs/label/index.d.ts +32 -0
  178. package/dist/components/inputs/label/index.js +11 -0
  179. package/dist/components/inputs/number-input/index.d.ts +84 -0
  180. package/dist/components/inputs/number-input/index.js +20 -0
  181. package/dist/components/inputs/radio/index.d.ts +20 -5
  182. package/dist/components/inputs/radio/index.js +15 -12
  183. package/dist/components/inputs/search/index.js +25 -18
  184. package/dist/components/inputs/select/index.d.ts +41 -11
  185. package/dist/components/inputs/select/index.js +27 -14
  186. package/dist/components/inputs/select/variants.d.ts +5 -0
  187. package/dist/components/inputs/select/variants.js +6 -0
  188. package/dist/components/inputs/slider/index.js +7 -5
  189. package/dist/components/inputs/switch/index.d.ts +8 -2
  190. package/dist/components/inputs/switch/index.js +14 -12
  191. package/dist/components/inputs/textarea/index.d.ts +4 -0
  192. package/dist/components/inputs/textarea/index.js +8 -6
  193. package/dist/components/navigation/navigation-menu/index.d.ts +114 -0
  194. package/dist/components/navigation/navigation-menu/index.js +40 -0
  195. package/dist/components/navigation/pagination/index.d.ts +73 -0
  196. package/dist/components/navigation/pagination/index.js +39 -0
  197. package/dist/components/navigation/sidebar/index.d.ts +44 -21
  198. package/dist/components/navigation/sidebar/index.js +41 -31
  199. package/dist/components/navigation/sidebar/variants.d.ts +25 -0
  200. package/dist/components/navigation/sidebar/variants.js +28 -0
  201. package/dist/components/navigation/tabs/index.d.ts +8 -2
  202. package/dist/components/navigation/tabs/index.js +14 -10
  203. package/dist/components/navigation/tabs-subtle/index.js +12 -10
  204. package/dist/components/overlays/alert-dialog/index.d.ts +121 -15
  205. package/dist/components/overlays/alert-dialog/index.js +22 -13
  206. package/dist/components/overlays/command/index.js +24 -17
  207. package/dist/components/overlays/context-menu/index.d.ts +33 -17
  208. package/dist/components/overlays/context-menu/index.js +27 -18
  209. package/dist/components/overlays/dialog/index.js +17 -12
  210. package/dist/components/overlays/dropdown/index.d.ts +257 -31
  211. package/dist/components/overlays/dropdown/index.js +42 -17
  212. package/dist/components/overlays/popover/index.d.ts +31 -9
  213. package/dist/components/overlays/popover/index.js +12 -9
  214. package/dist/components/overlays/preview-card/index.js +11 -8
  215. package/dist/components/overlays/sheet/index.js +18 -13
  216. package/dist/components/overlays/toast/index.d.ts +123 -47
  217. package/dist/components/overlays/toast/index.js +18 -10
  218. package/dist/components/overlays/tooltip/index.d.ts +113 -21
  219. package/dist/components/overlays/tooltip/index.js +15 -6
  220. package/dist/components/progress/index.d.ts +56 -0
  221. package/dist/components/progress/index.js +15 -0
  222. package/dist/components/table/index.d.ts +63 -8
  223. package/dist/components/table/index.js +19 -9
  224. package/dist/index.d.ts +2201 -736
  225. package/dist/index.js +223 -82
  226. package/dist/lib/date-locale.d.ts +14 -0
  227. package/dist/lib/date-locale.js +16 -0
  228. package/dist/lib/field-classes.d.ts +144 -0
  229. package/dist/lib/field-classes.js +40 -0
  230. package/dist/lib/field-variants.d.ts +47 -0
  231. package/dist/lib/field-variants.js +26 -0
  232. package/dist/lib/fluid-hover-highlight.d.ts +112 -0
  233. package/dist/lib/fluid-hover-highlight.js +17 -0
  234. package/dist/lib/focus-ring.d.ts +18 -0
  235. package/dist/lib/focus-ring.js +10 -0
  236. package/dist/lib/goo-indicator.d.ts +46 -0
  237. package/dist/lib/goo-indicator.js +14 -0
  238. package/dist/lib/icon-context.d.ts +30 -0
  239. package/dist/lib/icon-context.js +12 -0
  240. package/dist/lib/inert.d.ts +9 -0
  241. package/dist/lib/inert.js +8 -0
  242. package/dist/lib/morph-layers.d.ts +93 -0
  243. package/dist/lib/morph-layers.js +13 -0
  244. package/dist/lib/morph-part.d.ts +21 -0
  245. package/dist/lib/morph-part.js +12 -0
  246. package/dist/lib/popup.d.ts +20 -0
  247. package/dist/lib/popup.js +12 -0
  248. package/dist/lib/reduced-motion.d.ts +9 -0
  249. package/dist/lib/reduced-motion.js +6 -0
  250. package/dist/lib/row-index.d.ts +10 -0
  251. package/dist/lib/row-index.js +8 -0
  252. package/dist/lib/row-order.d.ts +28 -0
  253. package/dist/lib/row-order.js +10 -0
  254. package/dist/lib/scroll-column.d.ts +27 -0
  255. package/dist/lib/scroll-column.js +18 -0
  256. package/dist/lib/shape-context.d.ts +30 -0
  257. package/dist/lib/shape-context.js +12 -0
  258. package/dist/lib/size-context.d.ts +94 -0
  259. package/dist/lib/size-context.js +20 -0
  260. package/dist/lib/size-scale.d.ts +79 -0
  261. package/dist/lib/size-scale.js +8 -0
  262. package/dist/lib/slot.d.ts +12 -0
  263. package/dist/lib/slot.js +6 -0
  264. package/dist/lib/springs.d.ts +44 -0
  265. package/dist/lib/springs.js +8 -0
  266. package/dist/lib/surface-classes.d.ts +19 -0
  267. package/dist/lib/surface-classes.js +10 -0
  268. package/dist/lib/surface-context.d.ts +9 -0
  269. package/dist/lib/surface-context.js +8 -0
  270. package/dist/lib/use-controllable-state.d.ts +2 -0
  271. package/dist/lib/use-controllable-state.js +6 -0
  272. package/dist/lib/use-fluid-hover.d.ts +138 -0
  273. package/dist/lib/use-fluid-hover.js +14 -0
  274. package/dist/lib/use-is-mobile.d.ts +2 -0
  275. package/dist/lib/use-is-mobile.js +6 -0
  276. package/dist/lib/use-keyboard-nav-gate.d.ts +20 -0
  277. package/dist/lib/use-keyboard-nav-gate.js +7 -0
  278. package/dist/lib/use-merge-split.d.ts +47 -0
  279. package/dist/lib/use-merge-split.js +15 -0
  280. package/dist/lib/use-morph.d.ts +101 -0
  281. package/dist/lib/use-morph.js +20 -0
  282. package/dist/lib/use-touch-primary.d.ts +2 -0
  283. package/dist/lib/use-touch-primary.js +6 -0
  284. package/dist/lib/utils.d.ts +3 -0
  285. package/dist/lib/utils.js +6 -0
  286. package/dist/preset.d.ts +17 -0
  287. package/dist/preset.js +22 -2
  288. package/dist/primitives/code/index.js +7 -5
  289. package/dist/primitives/craft/index.js +9 -6
  290. package/dist/primitives/fluid-hover/index.js +9 -8
  291. package/dist/primitives/morph/index.js +15 -10
  292. package/dist/primitives/motion/index.js +10 -8
  293. package/dist/primitives/scroll-area/index.js +4 -3
  294. package/dist/primitives/separator/index.d.ts +25 -0
  295. package/dist/primitives/separator/index.js +9 -0
  296. package/dist/primitives/sizes/index.js +6 -4
  297. package/dist/primitives/skeleton/index.d.ts +35 -0
  298. package/dist/primitives/skeleton/index.js +12 -0
  299. package/dist/primitives/surface/index.js +6 -4
  300. package/dist/shared/{components-3mkepka5.js → components-0jmqhx2k.js} +28 -25
  301. package/dist/shared/components-124epb7f.js +53 -0
  302. package/dist/shared/{components-gz8zf3ec.js → components-1k0wv53d.js} +15 -43
  303. package/dist/shared/components-26snnbs9.js +322 -0
  304. package/dist/shared/{components-2dxkv6zm.js → components-2c0qcfx4.js} +8 -7
  305. package/dist/shared/{components-473g814w.js → components-2mt9te6d.js} +243 -137
  306. package/dist/shared/{components-hawvy2qz.js → components-2z48g4fp.js} +9 -30
  307. package/dist/shared/components-34txk9rj.js +35 -0
  308. package/dist/shared/components-3h92d94m.js +23 -0
  309. package/dist/shared/{components-zfnmn5d4.js → components-3sp623ae.js} +36 -31
  310. package/dist/shared/{components-jwst3vtj.js → components-3wxkjgqn.js} +186 -76
  311. package/dist/shared/{components-s2bz1xpk.js → components-49bsynbw.js} +8 -5
  312. package/dist/shared/components-4bwsd46w.js +71 -0
  313. package/dist/shared/components-4n4f5m3e.js +297 -0
  314. package/dist/shared/{components-0q0sqfh4.js → components-4y816hwp.js} +27 -49
  315. package/dist/shared/components-52ngsgca.js +399 -0
  316. package/dist/shared/{components-y9y0g8er.js → components-52r5763g.js} +22 -19
  317. package/dist/shared/components-559tf7yb.js +28 -0
  318. package/dist/shared/components-5mkga9hj.js +440 -0
  319. package/dist/shared/{components-kwa6mrf9.js → components-5s0nfqvw.js} +14 -9
  320. package/dist/shared/{components-dk0gjr5a.js → components-60atskhp.js} +19 -18
  321. package/dist/shared/{components-rr7a6ja9.js → components-658b26nb.js} +21 -18
  322. package/dist/shared/{components-xxvdw7k1.js → components-65vwfjs6.js} +37 -34
  323. package/dist/shared/{components-frw34b65.js → components-6j2fh74k.js} +114 -123
  324. package/dist/shared/components-6zg1yft7.js +167 -0
  325. package/dist/shared/components-6zng858q.js +53 -0
  326. package/dist/shared/components-72w4ge68.js +64 -0
  327. package/dist/shared/{components-cv16mryv.js → components-78x40gee.js} +13 -7
  328. package/dist/shared/{components-b2wyq2cq.js → components-7d4r7hh1.js} +39 -57
  329. package/dist/shared/components-7ntvvegr.js +316 -0
  330. package/dist/shared/components-8nwsqjn8.js +34 -0
  331. package/dist/shared/{components-5xc2j8jz.js → components-8tt3xbb5.js} +19 -18
  332. package/dist/shared/{components-vc7vq5nz.js → components-9as3rf68.js} +6 -3
  333. package/dist/shared/components-9mys9jna.js +255 -0
  334. package/dist/shared/components-adkarj8n.js +35 -0
  335. package/dist/shared/{components-b3c5et5b.js → components-ae9fncz4.js} +32 -31
  336. package/dist/shared/{components-hqeq3w9q.js → components-awra5sff.js} +24 -16
  337. package/dist/shared/components-b1e239g3.js +28 -0
  338. package/dist/shared/{components-q5xj5c16.js → components-b1f2bjf1.js} +9 -8
  339. package/dist/shared/{components-qmmjx1qw.js → components-bn42vq6d.js} +71 -72
  340. package/dist/shared/components-c96g82th.js +1444 -0
  341. package/dist/shared/components-c9yr4ed1.js +44 -0
  342. package/dist/shared/components-d3shbwqq.js +95 -0
  343. package/dist/shared/{components-jjw69c4c.js → components-dcc02hs2.js} +7 -4
  344. package/dist/shared/{components-men63rwj.js → components-de99ykt7.js} +3 -2
  345. package/dist/shared/components-dhgk6mbt.js +16 -0
  346. package/dist/shared/components-drxrtnp2.js +25 -0
  347. package/dist/shared/{components-6p8tfcd6.js → components-ds9fqat9.js} +21 -18
  348. package/dist/shared/{components-mjthm1kf.js → components-egy4tyjt.js} +11 -8
  349. package/dist/shared/components-f0xfpkhh.js +82 -0
  350. package/dist/shared/components-f7h57m6t.js +59 -0
  351. package/dist/shared/{components-d6xtjht3.js → components-fjkpbg6n.js} +33 -30
  352. package/dist/shared/{components-gc5vtq2f.js → components-gh0qeey3.js} +63 -29
  353. package/dist/shared/{components-39jq9va1.js → components-gvbapfen.js} +29 -24
  354. package/dist/shared/{components-5vgpnxgy.js → components-gzesg7hy.js} +19 -16
  355. package/dist/shared/components-h6p86be3.js +19 -0
  356. package/dist/shared/components-h83az0bz.js +33 -0
  357. package/dist/shared/components-jjrj6ymn.js +104 -0
  358. package/dist/shared/{components-wvp1m52g.js → components-jp5v0m0f.js} +15 -14
  359. package/dist/shared/{components-zrkzcayz.js → components-jqpefjsn.js} +54 -6
  360. package/dist/shared/{components-1z6tdadk.js → components-k74j4hwh.js} +20 -17
  361. package/dist/shared/components-kswxnm3h.js +24 -0
  362. package/dist/shared/{components-jbbmdr74.js → components-mkkbbgb7.js} +36 -17
  363. package/dist/shared/{components-pbmqctfa.js → components-mpw667rb.js} +169 -65
  364. package/dist/shared/{components-s5ngg32c.js → components-paa08427.js} +121 -47
  365. package/dist/shared/{components-vfbhxf5r.js → components-pd42emw3.js} +6 -5
  366. package/dist/shared/{components-hw9yk32z.js → components-pmfszv7a.js} +35 -23
  367. package/dist/shared/{components-chacnk61.js → components-pw06rbxq.js} +19 -19
  368. package/dist/shared/components-q03cktx8.js +246 -0
  369. package/dist/shared/{components-kvr7f9hy.js → components-qdm3yh26.js} +19 -10
  370. package/dist/shared/{components-27nnvrwe.js → components-qs4rkqsj.js} +15 -14
  371. package/dist/shared/{components-s083f38z.js → components-r6gbmkew.js} +22 -21
  372. package/dist/shared/{components-ta7shw28.js → components-r8eqs7gz.js} +4 -4
  373. package/dist/shared/{components-sn1rxx1d.js → components-rm02h9nt.js} +12 -11
  374. package/dist/shared/{components-c6s6b43g.js → components-rrbpmfx4.js} +3 -2
  375. package/dist/shared/{components-n7mjr357.js → components-tz1fv35x.js} +3 -2
  376. package/dist/shared/components-tz4gaf1v.js +23 -0
  377. package/dist/shared/{components-zx6b6yby.js → components-vf45j12c.js} +4 -18
  378. package/dist/shared/{components-3ky44908.js → components-vfjc9jzz.js} +2 -3
  379. package/dist/shared/{components-39vmfq9s.js → components-vsa625vk.js} +21 -20
  380. package/dist/shared/components-wawnmkph.js +500 -0
  381. package/dist/shared/components-wktrrb4m.js +38 -0
  382. package/dist/shared/{components-8snj490h.js → components-wwd363me.js} +78 -32
  383. package/dist/shared/{components-5pnw8183.js → components-xcwvgcrd.js} +23 -22
  384. package/dist/shared/components-xdqmt6ed.js +20 -0
  385. package/dist/shared/{components-h2ajmhwn.js → components-y1w3a6wx.js} +107 -35
  386. package/dist/shared/{components-ar66gnt0.js → components-y6578b8h.js} +37 -34
  387. package/dist/shared/{components-59efxjd9.js → components-yhgq0qxx.js} +13 -12
  388. package/dist/shared/{components-jthe1pwb.js → components-yz84gpkq.js} +101 -404
  389. package/dist/shared/components-z3v0n0de.js +11 -0
  390. package/dist/shared/{components-7r3etddy.js → components-z9n19fyk.js} +19 -54
  391. package/dist/shared/components-zbvjzh1p.js +141 -0
  392. package/dist/styles.css +241 -16
  393. package/dist/tailwind.css +13 -0
  394. package/dist/tokens.css +34 -0
  395. package/index.ts +60 -0
  396. package/lib/date-locale.ts +50 -0
  397. package/lib/field-classes.ts +115 -0
  398. package/lib/field-variants.ts +117 -0
  399. package/lib/fluid-hover-highlight.tsx +139 -0
  400. package/lib/focus-ring.tsx +46 -0
  401. package/lib/goo-indicator.tsx +261 -0
  402. package/lib/icon-context.tsx +310 -0
  403. package/lib/inert.ts +22 -0
  404. package/lib/morph-layers.tsx +102 -0
  405. package/lib/morph-part.tsx +49 -0
  406. package/lib/popup.ts +52 -0
  407. package/lib/reduced-motion.ts +19 -0
  408. package/lib/row-index.tsx +29 -0
  409. package/lib/row-order.tsx +115 -0
  410. package/lib/scroll-column.tsx +244 -0
  411. package/lib/shape-context.tsx +124 -0
  412. package/lib/size-context.tsx +66 -0
  413. package/lib/size-scale.ts +115 -0
  414. package/lib/slot.ts +25 -0
  415. package/lib/springs.ts +62 -0
  416. package/lib/surface-classes.ts +58 -0
  417. package/lib/surface-context.tsx +21 -0
  418. package/lib/use-controllable-state.ts +44 -0
  419. package/lib/use-fluid-hover.ts +541 -0
  420. package/lib/use-is-mobile.ts +25 -0
  421. package/lib/use-keyboard-nav-gate.ts +45 -0
  422. package/lib/use-merge-split.tsx +209 -0
  423. package/lib/use-morph.ts +557 -0
  424. package/lib/use-touch-primary.tsx +43 -0
  425. package/lib/utils.ts +37 -0
  426. package/package.json +177 -4
  427. package/preset.ts +196 -0
  428. package/primitives/code/examples.mdx +27 -0
  429. package/primitives/code/index.tsx +80 -0
  430. package/primitives/craft/demos.tsx +173 -0
  431. package/primitives/craft/examples.mdx +138 -0
  432. package/primitives/craft/index.tsx +76 -0
  433. package/primitives/fluid-hover/examples.mdx +84 -0
  434. package/primitives/fluid-hover/index.tsx +316 -0
  435. package/primitives/morph/examples.mdx +135 -0
  436. package/primitives/morph/index.tsx +192 -0
  437. package/primitives/motion/examples.mdx +100 -0
  438. package/primitives/motion/index.tsx +160 -0
  439. package/primitives/scroll-area/examples.mdx +58 -0
  440. package/primitives/scroll-area/index.tsx +200 -0
  441. package/primitives/separator/examples.mdx +30 -0
  442. package/primitives/separator/index.tsx +53 -0
  443. package/primitives/sizes/examples.mdx +167 -0
  444. package/primitives/sizes/index.tsx +89 -0
  445. package/primitives/skeleton/examples.mdx +51 -0
  446. package/primitives/skeleton/index.tsx +72 -0
  447. package/primitives/skeleton/skeleton.css +15 -0
  448. package/primitives/surface/examples.mdx +173 -0
  449. package/primitives/surface/index.tsx +109 -0
  450. package/primitives/surface/surface.css +176 -0
  451. package/dist/shared/components-0sn7ypjw.js +0 -61
  452. package/dist/shared/components-1434p1mh.js +0 -123
  453. package/dist/shared/components-a86dytt0.js +0 -986
  454. package/dist/shared/components-gf5s6ap9.js +0 -42
  455. package/dist/shared/components-hyq23phv.js +0 -310
  456. package/dist/shared/components-ng72k97e.js +0 -128
  457. package/dist/shared/components-raknhppb.js +0 -64
  458. package/dist/shared/components-vynjtrk6.js +0 -19
  459. package/dist/shared/components-wy9jpqny.js +0 -146
  460. /package/dist/shared/{components-1v7rxytx.js → components-3ey0hzpb.js} +0 -0
  461. /package/dist/shared/{components-ezxhrmer.js → components-jcnjay5g.js} +0 -0
@@ -0,0 +1,1037 @@
1
+ // biome-ignore-all lint: vendored upstream code keeps its own patterns (see the header)
2
+ /*
3
+ * Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
4
+ * `registry/default/card.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
5
+ * MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
6
+ * Local modifications:
7
+ * - `"use client"` dropped; `@/lib/*`, `@/hooks/*` and
8
+ * `@/components/ui/fluid-hover-highlight` → `../../lib/*`, except
9
+ * `SizeProvider` → `../../primitives/sizes`.
10
+ * - `next/link` replaced with plain anchors (no Next.js in modo) — the
11
+ * stretched card link and CardButton's `href` form.
12
+ * - Prop JSDoc on CardProps rewritten from the FF docs API table (`children`
13
+ * re-declared so it is documented); modo TSDoc and examples on `Card`.
14
+ * - Compound statics `Card.Group/.Header/.Title/.Description/.Action/
15
+ * .Content/.Footer/.Media/.Image/.Eyebrow/.Feature/.Button` attached with
16
+ * `Object.assign`, typed through a `CardComponent` cast on the forwardRef.
17
+ * Upstream's named exports are kept.
18
+ * - Styling reads DS tokens (AGENTS.md styling): `text-[Npx]` →
19
+ * `text-<role>[-compact]`; inline `fontVariationSettings` → `weight-*`; the
20
+ * hex focus-ring fallback → `ring-focus-ring` / `border-focus-ring`;
21
+ * `rounded-[Npx]` → radius tokens; `duration-80|120|160` and tier-length JS
22
+ * durations → `duration-<tier>` / `spring.*`.
23
+ * - `border` on a standalone Card (local): `"outlined"` draws the same hairline
24
+ * frame an outlined Card.Group gives its tiles; inside a group the group's
25
+ * `border` still decides. Borderless stays the default.
26
+ * - `Card.Divider` / `CardDivider` (local): a hairline across the card between
27
+ * its parts (full-bleed, spaced like the parts), vertical in an inline card;
28
+ * the Separator primitive in the card's divider tone.
29
+ */
30
+
31
+ import {
32
+ Children,
33
+ cloneElement,
34
+ createContext,
35
+ type ForwardRefExoticComponent,
36
+ forwardRef,
37
+ type HTMLAttributes,
38
+ isValidElement,
39
+ type ReactElement,
40
+ type ReactNode,
41
+ type RefAttributes,
42
+ useContext,
43
+ useMemo,
44
+ useRef,
45
+ } from 'react'
46
+ import { FluidHoverHighlight } from '../../lib/fluid-hover-highlight'
47
+ import { type IconComponent, useIcon } from '../../lib/icon-context'
48
+ import { useShape } from '../../lib/shape-context'
49
+ import { type SizeVariant, useSize } from '../../lib/size-context'
50
+ import { useFluidHover, useRegisterFluidHoverItem } from '../../lib/use-fluid-hover'
51
+ import { cn } from '../../lib/utils'
52
+ import Separator, { type SeparatorProps } from '../../primitives/separator'
53
+ import { SizeProvider } from '../../primitives/sizes'
54
+
55
+ // ---------------------------------------------------------------------------
56
+ // Card is shadcn/ui's compositional card — the same parts and `data-slot`
57
+ // contract (Card, CardHeader, CardTitle, CardDescription, CardAction,
58
+ // CardContent, CardFooter) — with the Fluid Functionalism layer on top:
59
+ // design tokens, a weight-animated title, and a sibling CardGroup that owns
60
+ // layout (stacked list, inline rows, or grid) plus the magnetic fluid hover
61
+ // highlight that previews where a click will land.
62
+ //
63
+ // Unlike stock shadcn, the surface is transparent and borderless by default:
64
+ // cards inherit whatever substrate their parent provides (see the Surfaces
65
+ // system) and lean on hairline dividers / the fluid hover highlight rather than
66
+ // a drawn frame. A Card renders fine on its own; inside a CardGroup it
67
+ // registers itself so the group's highlight can find it.
68
+ // ---------------------------------------------------------------------------
69
+
70
+ type CardOrientation = 'card' | 'inline'
71
+ type CardBorder = 'none' | 'outlined'
72
+
73
+ // ── Group context ────────────────────────────────────────
74
+
75
+ interface CardGroupContextValue {
76
+ registerItem: (index: number, element: HTMLElement | null) => void
77
+ activeIndex: number | null
78
+ /** Index of the persistently-selected card, or -1. Its neighbours drop the
79
+ * hairline that would otherwise cut across the selection fill. */
80
+ selectedIndex: number
81
+ orientation: CardOrientation
82
+ columns: number
83
+ count: number
84
+ /** Individual cards carry their own border/tile shape (separated grids). */
85
+ separated: boolean
86
+ /** Inner hairline dividers are drawn between adjacent cards. */
87
+ divided: boolean
88
+ outlined: boolean
89
+ }
90
+
91
+ const CardGroupContext = createContext<CardGroupContextValue | null>(null)
92
+
93
+ // ── Per-card context ─────────────────────────────────────
94
+ // Lets the compositional parts (title, header, footer…) adapt to the card
95
+ // they're inside without threading props: the title reads `emphasized` to
96
+ // animate its weight; parts read `orientation` to switch padding/flow.
97
+
98
+ interface CardContextValue {
99
+ emphasized: boolean
100
+ orientation: CardOrientation
101
+ clickable: boolean
102
+ /** An inline card holding a full CardImage centres its text + actions in a
103
+ * column beside the image, so the footer drops below the text (hugged and
104
+ * vertically centred) instead of trailing to the right. */
105
+ hasImage: boolean
106
+ }
107
+
108
+ const CardContext = createContext<CardContextValue>({
109
+ emphasized: false,
110
+ orientation: 'card',
111
+ clickable: false,
112
+ hasImage: false,
113
+ })
114
+
115
+ // ── CardGroup ────────────────────────────────────────────
116
+
117
+ interface CardGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onDrag'> {
118
+ /** How each card lays its own content out.
119
+ * "card" — stacked vertically (media/header on top). "inline" — a
120
+ * horizontal row (leading media, trailing footer), like a Table row.
121
+ * @default "card" */
122
+ orientation?: CardOrientation
123
+ /** Number of grid columns. >1 enables 2-D fluid hover across rows and columns.
124
+ * @default 1 */
125
+ columns?: number
126
+ /** "none" — borderless (default), separated only by subtle dividers.
127
+ * "outlined" — draws a border: one shared frame when grouped, or one per
128
+ * card when `separated`. @default "none" */
129
+ border?: CardBorder
130
+ /** Split the group into individually-shaped cards with a gap between them
131
+ * (a grid of tiles) instead of one continuous divided block. @default false */
132
+ separated?: boolean
133
+ /** Enable the magnetic fluid-hover highlight. @default true */
134
+ fluidHover?: boolean
135
+ }
136
+
137
+ const CardGroup = forwardRef<HTMLDivElement, CardGroupProps>(
138
+ (
139
+ {
140
+ orientation = 'card',
141
+ columns = 1,
142
+ border = 'none',
143
+ separated = false,
144
+ fluidHover = true,
145
+ className,
146
+ children,
147
+ ...props
148
+ },
149
+ ref,
150
+ ) => {
151
+ const containerRef = useRef<HTMLDivElement>(null)
152
+ const shape = useShape()
153
+
154
+ // >1 column wraps into a grid, where nearest-item must be resolved in two
155
+ // dimensions; a single column is a plain vertical list.
156
+ const axis = columns > 1 ? 'xy' : 'y'
157
+ // A card grid has generous whitespace, so a gap click only routes when it
158
+ // lands within a hand's width of the highlighted card.
159
+ const hover = useFluidHover(containerRef, { axis, gapClick: { maxDistance: 16 } })
160
+ const { activeIndex, handlers, registerItem } = hover
161
+
162
+ // Assign each valid child a stable fluid hover index so callers never thread
163
+ // one through by hand (Table asks for it; here the group owns it).
164
+ const childArray = Children.toArray(children).filter(isValidElement)
165
+ const count = childArray.length
166
+ const indexed = childArray.map((child, i) => cloneElement(child as ReactElement<{ index?: number }>, { index: i }))
167
+ // Which card is selected — so its neighbours can drop the divider that
168
+ // would otherwise slice through the selection fill.
169
+ const selectedIndex = childArray.findIndex(child => (child.props as { selected?: boolean }).selected)
170
+
171
+ const outlined = border === 'outlined'
172
+ const divided = !separated
173
+
174
+ const contextValue = useMemo<CardGroupContextValue>(
175
+ () => ({
176
+ registerItem,
177
+ activeIndex,
178
+ selectedIndex,
179
+ orientation,
180
+ columns,
181
+ count,
182
+ separated,
183
+ divided,
184
+ outlined,
185
+ }),
186
+ [registerItem, activeIndex, selectedIndex, orientation, columns, count, separated, divided, outlined],
187
+ )
188
+
189
+ return (
190
+ <CardGroupContext.Provider value={contextValue}>
191
+ <div
192
+ ref={node => {
193
+ ;(containerRef as React.MutableRefObject<HTMLDivElement | null>).current = node
194
+ if (typeof ref === 'function') ref(node)
195
+ else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node
196
+ }}
197
+ {...props}
198
+ data-slot="card-group"
199
+ data-orientation={orientation}
200
+ className={cn(
201
+ 'relative grid',
202
+ // A shared frame clips the highlight + dividers to its rounded
203
+ // corners; separated tiles clip themselves.
204
+ outlined && !separated && `border border-border/60 overflow-hidden ${shape.container}`,
205
+ separated ? 'gap-2' : 'gap-0',
206
+ className,
207
+ )}
208
+ style={{
209
+ gridTemplateColumns: `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`,
210
+ }}
211
+ onMouseEnter={fluidHover ? handlers.onMouseEnter : undefined}
212
+ onMouseMove={fluidHover ? handlers.onMouseMove : undefined}
213
+ onMouseLeave={fluidHover ? handlers.onMouseLeave : undefined}
214
+ onClick={fluidHover ? handlers.onClick : undefined}
215
+ >
216
+ {/* Fluid hover highlight — a single magnetic layer that springs to the
217
+ card nearest the cursor, previewing where a click will land. */}
218
+ <FluidHoverHighlight hover={hover} hidden={!fluidHover} className={cn('z-0', shape.container)} />
219
+
220
+ {indexed}
221
+ </div>
222
+ </CardGroupContext.Provider>
223
+ )
224
+ },
225
+ )
226
+
227
+ CardGroup.displayName = 'CardGroup'
228
+
229
+ // ── Card ─────────────────────────────────────────────────
230
+
231
+ interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
232
+ /** Compositional parts: Card.Image, Card.Media, Card.Header, Card.Content, Card.Footer. */
233
+ children?: ReactNode
234
+ /** Makes the whole card a clickable target (stretched button); fluid hover previews it. */
235
+ onClick?: () => void
236
+ /** Makes the whole card a link (stretched anchor). */
237
+ href?: string
238
+ /** Opens href in a new tab. Defaults to `false`. */
239
+ external?: boolean
240
+ /** Accessible name for the stretched link/button when the whole card is clickable (the visible title isn't wired up automatically). */
241
+ label?: string
242
+ /** Persistent selected fill + title emphasis, on top of fluid hover. The group drops the hairline dividers around the selected card so the fill reads clean. Defaults to `false`. */
243
+ selected?: boolean
244
+ /** Dims and disables the card. Defaults to `false`. */
245
+ disabled?: boolean
246
+ /** Shows a dismiss (✕) button, revealed on hover or focus by default. Defaults to `false`. */
247
+ dismissible?: boolean
248
+ /** Keeps the dismiss control hidden until the card is hovered or holds focus. Pass false for an always-visible ✕. Defaults to `true`. */
249
+ dismissOnHover?: boolean
250
+ /** Called when the dismiss button is pressed. */
251
+ onDismiss?: () => void
252
+ /** Pins the card to one step of the size ladder — compact tightens type and padding. Omitted, it follows the surrounding SizeProvider. */
253
+ size?: SizeVariant
254
+ /** Frame of a standalone card: `"outlined"` draws a hairline around it, like an outlined group's tiles. Inside a Card.Group the group's `border` decides. Defaults to `"none"`. */
255
+ border?: CardBorder
256
+ /** Injected by Card.Group — do not set by hand. */
257
+ index?: number
258
+ }
259
+
260
+ type CardComponent = ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement>> & {
261
+ Group: typeof CardGroup
262
+ Header: typeof CardHeader
263
+ Title: typeof CardTitle
264
+ Description: typeof CardDescription
265
+ Action: typeof CardAction
266
+ Content: typeof CardContent
267
+ Footer: typeof CardFooter
268
+ Divider: typeof CardDivider
269
+ Media: typeof CardMedia
270
+ Image: typeof CardImage
271
+ Eyebrow: typeof CardEyebrow
272
+ Feature: typeof CardFeature
273
+ Button: typeof CardButton
274
+ }
275
+
276
+ /**
277
+ * shadcn's compositional card, dressed in Fluid Functionalism. Stacked,
278
+ * inline, or grid — borderless by default with fluid hover that previews
279
+ * where a click will land.
280
+ *
281
+ * The same parts and data-slot contract as shadcn's Card, on a transparent,
282
+ * borderless surface: a card inherits its parent's substrate and leans on
283
+ * hairline dividers rather than a drawn frame (a standalone card opts into
284
+ * one with `border="outlined"`). Card.Group owns the layout (a
285
+ * stacked list, inline rows or a grid) and assigns every child its fluid
286
+ * hover index; only a clickable card (`onClick` or `href`) joins the magnetic
287
+ * highlight. A clickable card is one stretched button or link, while footer
288
+ * actions and Card.Action stay independently clickable above it.
289
+ *
290
+ * Statics: Card.Group (orientation "card" | "inline", columns, border "none"
291
+ * | "outlined", separated, fluidHover), Card.Header (title + description
292
+ * grid, pins Card.Action top-right), Card.Title (weight-animates when the card
293
+ * is selected), Card.Description, Card.Action, Card.Content, Card.Footer (the
294
+ * actions row; it wraps), Card.Divider (a hairline across the card between
295
+ * its parts, vertical in an inline card), Card.Media (an icon tile, a logo or a [logoA, logoB] pair),
296
+ * Card.Image (full-bleed banner, or a leading image when inline),
297
+ * Card.Eyebrow (small uppercase label), Card.Feature (icon + title +
298
+ * description row) and Card.Button (primary | secondary | ghost | link
299
+ * action; an anchor when given `href`).
300
+ *
301
+ * @example {@include ./examples.mdx}
302
+ */
303
+ const Card = forwardRef<HTMLDivElement, CardProps>(
304
+ (
305
+ {
306
+ onClick,
307
+ href,
308
+ external,
309
+ label,
310
+ selected = false,
311
+ disabled = false,
312
+ dismissible = false,
313
+ dismissOnHover = true,
314
+ onDismiss,
315
+ size,
316
+ border = 'none',
317
+ index,
318
+ className,
319
+ children,
320
+ ...props
321
+ },
322
+ ref,
323
+ ) => {
324
+ const internalRef = useRef<HTMLDivElement>(null)
325
+ const shape = useShape()
326
+ // Resolve against the explicit prop first so this card's own padding and
327
+ // gaps agree with the SizeProvider it renders for its children.
328
+ const sizeClasses = useSize(size)
329
+ const compact = sizeClasses.variant === 'compact'
330
+ const group = useContext(CardGroupContext)
331
+ const XIcon = useIcon('x')
332
+
333
+ const orientation = group?.orientation ?? 'card'
334
+ const columns = group?.columns ?? 1
335
+ const count = group?.count ?? 1
336
+ const separated = group?.separated ?? true
337
+ const divided = group?.divided ?? false
338
+ const outlined = group?.outlined ?? false
339
+ const activeIndex = group?.activeIndex ?? null
340
+ const selectedIndex = group?.selectedIndex ?? -1
341
+
342
+ // Depend on the stable registerItem callback, not the whole group context —
343
+ // the context object's identity changes on every hover/selection frame,
344
+ // which would otherwise re-register every card each frame.
345
+ // Only a card that can be clicked joins the highlight: a highlight on an
346
+ // informational card would promise a click that has nowhere to land.
347
+ const registerItem = href || onClick ? group?.registerItem : undefined
348
+ useRegisterFluidHoverItem(registerItem, index, internalRef)
349
+
350
+ // Divider geometry: draw a hairline toward the neighbour below / to the
351
+ // right, but drop it next to the active OR selected card so the highlight
352
+ // and selection fill read clean (the same trick Table uses on row borders).
353
+ const col = index !== undefined ? index % columns : 0
354
+ const hasBelow = index !== undefined && index + columns < count
355
+ const hasRight = index !== undefined && col < columns - 1 && index + 1 < count
356
+ const self = index ?? -1
357
+ const touchesBelow = (i: number) => i === self || i === self + columns
358
+ const touchesRight = (i: number) => i === self || i === self + 1
359
+ const showBottom = divided && hasBelow && !(touchesBelow(activeIndex ?? -1) || touchesBelow(selectedIndex))
360
+ const showRight = divided && hasRight && !(touchesRight(activeIndex ?? -1) || touchesRight(selectedIndex))
361
+
362
+ const isInline = orientation === 'inline'
363
+ // An inline card with a full-bleed image reflows so its actions stack under
364
+ // the text (see the body wrapper below + CardHeader/CardFooter). Match the
365
+ // image child by identity OR displayName so detection and the split below
366
+ // agree even when module identity drifts (e.g. HMR duplication).
367
+ const isCardImage = (child: ReactNode) =>
368
+ isValidElement(child) &&
369
+ (child.type === CardImage || (child.type as { displayName?: string })?.displayName === 'CardImage')
370
+ const hasImage = Children.toArray(children).some(isCardImage)
371
+ const inlineImage = isInline && hasImage
372
+ const clickable = !!href || !!onClick
373
+ // Title weight follows the persistent selected state only — fluid hover
374
+ // previews via the highlight fill, not by bolding the label.
375
+ const emphasized = selected
376
+
377
+ // A standalone card (no group) is its own tile — always rounded + clipped.
378
+ // Inside a group, a separated tile carries its own rounding + clip only when
379
+ // it draws a visible frame; a borderless separated tile has no surface to
380
+ // hug, so it stays unclipped and its media reads as a plain square, and a
381
+ // card in a continuous block leans on the shared group frame for both.
382
+ const tileShape = !group
383
+ ? cn(shape.container, 'overflow-hidden', border === 'outlined' && 'border border-border/60')
384
+ : separated && outlined
385
+ ? cn(shape.container, 'overflow-hidden border border-border/60')
386
+ : ''
387
+
388
+ // Stretched overlay makes the whole card the click target while keeping
389
+ // action buttons (higher z) independently clickable — the accessible
390
+ // alternative to nesting interactive elements inside a button/anchor. A
391
+ // disabled card drops the overlay entirely so it can't be tabbed to or
392
+ // activated by keyboard (pointer-events-none only blocks the mouse).
393
+ const overlay =
394
+ clickable && !disabled ? (
395
+ href ? (
396
+ <a
397
+ href={href}
398
+ onClick={onClick}
399
+ target={external ? '_blank' : undefined}
400
+ rel={external ? 'noopener noreferrer' : undefined}
401
+ aria-label={label}
402
+ className="absolute inset-0 z-20 outline-none focus-visible:ring-1 focus-visible:ring-focus-ring rounded-[inherit]"
403
+ />
404
+ ) : (
405
+ <button
406
+ type="button"
407
+ onClick={onClick}
408
+ aria-label={label}
409
+ aria-pressed={selected || undefined}
410
+ className="absolute inset-0 z-20 outline-none focus-visible:ring-1 focus-visible:ring-focus-ring rounded-[inherit]"
411
+ />
412
+ )
413
+ ) : null
414
+
415
+ const cardContext = useMemo<CardContextValue>(
416
+ () => ({ emphasized, orientation, clickable, hasImage }),
417
+ [emphasized, orientation, clickable, hasImage],
418
+ )
419
+
420
+ // Inline image cards wrap their non-image parts in a centred column so the
421
+ // title, description, and actions hug together and sit vertically centred
422
+ // against the image instead of stretching to its full height.
423
+ let body: ReactNode = children
424
+ if (inlineImage) {
425
+ const parts = Children.toArray(children)
426
+ const image = parts.find(isCardImage)
427
+ const rest = parts.filter(part => part !== image)
428
+ body = (
429
+ <>
430
+ {image}
431
+ <div
432
+ className={cn('flex min-w-0 flex-1 flex-col justify-center gap-2', compact ? 'py-2.5 pr-3' : 'py-3.5 pr-4')}
433
+ >
434
+ {rest}
435
+ </div>
436
+ </>
437
+ )
438
+ }
439
+
440
+ const card = (
441
+ <CardContext.Provider value={cardContext}>
442
+ <div
443
+ ref={node => {
444
+ ;(internalRef as React.MutableRefObject<HTMLDivElement | null>).current = node
445
+ if (typeof ref === 'function') ref(node)
446
+ else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node
447
+ }}
448
+ data-slot="card"
449
+ data-fluid-hover-index={index}
450
+ data-selected={selected || undefined}
451
+ data-orientation={orientation}
452
+ aria-disabled={disabled || undefined}
453
+ className={cn(
454
+ 'group/card relative z-10 min-w-0 min-h-[60px]',
455
+ inlineImage
456
+ ? // Image on the left; the text + actions ride in a centred
457
+ // column beside it (see the wrapper in the body below).
458
+ cn('flex flex-row items-center', compact ? 'gap-2.5' : 'gap-3')
459
+ : isInline
460
+ ? cn('flex flex-row items-center', compact ? 'gap-2.5 pl-3' : 'gap-3 pl-4')
461
+ : cn('flex flex-col', compact ? 'pb-3' : 'pb-4'),
462
+ // Standalone (no group) cards can't lean on the group highlight, so
463
+ // they carry their own hover tint when interactive.
464
+ !group && clickable && !disabled && 'transition-colors duration-fast hover:bg-hover',
465
+ // Inline rows are single-line, so the corner dismiss would sit on
466
+ // the title's tail: the header yields right padding whenever the
467
+ // control is present — only while it's revealed in the on-hover
468
+ // case, so the resting text keeps the full row (the group-header
469
+ // gutter-swap pattern; instant, not transitioned).
470
+ dismissible &&
471
+ isInline &&
472
+ (dismissOnHover
473
+ ? '[&:hover_[data-slot=card-header]]:pr-10 [&:focus-within_[data-slot=card-header]]:pr-10'
474
+ : '[&_[data-slot=card-header]]:pr-10'),
475
+ tileShape,
476
+ disabled && 'opacity-50 pointer-events-none',
477
+ className,
478
+ )}
479
+ {...props}
480
+ >
481
+ {/* Persistent selected fill + dividers sit behind the static content
482
+ (-z-10); the stretched overlay (z-20) sits above content so the
483
+ whole card is clickable, and actions/dismiss (z-30) rise above the
484
+ overlay to stay independently interactive. */}
485
+ {selected && (
486
+ <span aria-hidden className={cn('absolute inset-0 -z-10 bg-active pointer-events-none', shape.container)} />
487
+ )}
488
+
489
+ {/* Dividers between borderless neighbours. Where both hairlines meet,
490
+ the vertical one stops 1px short so the horizontal hairline owns
491
+ the crossing pixel — two 60% lines would otherwise stack there and
492
+ read brighter than the rest of the grid. */}
493
+ {showBottom && (
494
+ <span aria-hidden className="absolute inset-x-0 bottom-0 h-px bg-border/60 pointer-events-none -z-10" />
495
+ )}
496
+ {showRight && (
497
+ <span
498
+ aria-hidden
499
+ className={cn(
500
+ 'absolute top-0 right-0 w-px bg-border/60 pointer-events-none -z-10',
501
+ showBottom ? 'bottom-px' : 'bottom-0',
502
+ )}
503
+ />
504
+ )}
505
+
506
+ {overlay}
507
+
508
+ {body}
509
+
510
+ {/* Dismiss control sits above the stretched overlay. */}
511
+ {dismissible && (
512
+ <button
513
+ type="button"
514
+ onClick={onDismiss}
515
+ aria-label="Dismiss"
516
+ className={cn(
517
+ 'absolute right-2 top-2 z-30 flex h-7 w-7 items-center justify-center text-muted-foreground hover:text-foreground cursor-pointer outline-none transition-colors duration-fast focus-visible:ring-1 focus-visible:ring-focus-ring',
518
+ // Over media the control needs its own ground, or the icon
519
+ // reads against whatever the image happens to be. Elsewhere
520
+ // the usual hover fill is enough. The chip takes the button
521
+ // radius either way.
522
+ hasImage ? 'bg-card/70 backdrop-blur-sm hover:bg-card' : 'hover:bg-hover',
523
+ // Revealed on hover / focus. focus-visible covers the keyboard
524
+ // path, since the control is the only way to dismiss.
525
+ // pointer-events gates alongside opacity: an invisible
526
+ // control must not swallow taps meant for the card (touch has
527
+ // no hover to reveal it). Keyboard focus still reaches it —
528
+ // pointer-events never blocks tabbing.
529
+ dismissOnHover &&
530
+ 'pointer-events-none opacity-0 transition-opacity duration-fast group-hover/card:pointer-events-auto group-hover/card:opacity-100 group-focus-within/card:pointer-events-auto group-focus-within/card:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100',
531
+ shape.button,
532
+ )}
533
+ >
534
+ <XIcon size={compact ? 13 : 15} strokeWidth={1.5} />
535
+ </button>
536
+ )}
537
+ </div>
538
+ </CardContext.Provider>
539
+ )
540
+
541
+ // A size prop pins the card (and everything ladder-aware inside it) to one
542
+ // ladder step; the parts read the context.
543
+ return size ? <SizeProvider size={size}>{card}</SizeProvider> : card
544
+ },
545
+ ) as CardComponent
546
+
547
+ Card.displayName = 'Card'
548
+
549
+ // ── CardHeader ───────────────────────────────────────────
550
+ // shadcn's header grid: title + description stack, with CardAction pinned to
551
+ // the top-right column. In an inline card it becomes the flexible text column
552
+ // between the leading media and trailing footer.
553
+
554
+ const CardHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {
555
+ const { orientation, hasImage } = useContext(CardContext)
556
+ const inlineImage = orientation === 'inline' && hasImage
557
+ const sizeClasses = useSize()
558
+ const compact = sizeClasses.variant === 'compact'
559
+ return (
560
+ <div
561
+ ref={ref}
562
+ data-slot="card-header"
563
+ className={cn(
564
+ 'grid auto-rows-min items-start gap-1 has-data-[slot=card-action]:grid-cols-[1fr_auto]',
565
+ inlineImage
566
+ ? 'min-w-0'
567
+ : orientation === 'inline'
568
+ ? cn('min-w-0 flex-1', compact ? 'py-2.5' : 'py-3.5')
569
+ : compact
570
+ ? 'px-3 pt-3'
571
+ : 'px-4 pt-4',
572
+ className,
573
+ )}
574
+ {...props}
575
+ />
576
+ )
577
+ })
578
+
579
+ CardHeader.displayName = 'CardHeader'
580
+
581
+ // ── CardTitle ────────────────────────────────────────────
582
+
583
+ const CardTitle = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(
584
+ ({ className, children, ...props }, ref) => {
585
+ const { emphasized, orientation } = useContext(CardContext)
586
+ const sizeClasses = useSize()
587
+ const compact = sizeClasses.variant === 'compact'
588
+ // Inline rows trim the title to cap height so it centres tightly against
589
+ // the media/actions; stacked cards keep the natural line box.
590
+ const trim = orientation === 'inline' ? '[text-box:trim-both_cap_alphabetic]' : ''
591
+ // Ghost-span pattern: an invisible semibold copy reserves the width so the
592
+ // resting→active weight animation never reflows the row.
593
+ //
594
+ // Truncation support: a consumer's `truncate` lands on this grid, whose
595
+ // text-overflow can't ellipsize (only a block's own line boxes can — grid
596
+ // children just clip). The nowrap it sets inherits into the cell spans,
597
+ // so giving those spans overflow-hidden + ellipsis renders the … there
598
+ // instead; minmax(0,1fr) clamps the implicit track to the clipped grid's
599
+ // width so the ellipsis falls inside the visible box. All of it is inert
600
+ // while titles wrap normally.
601
+ return (
602
+ <span
603
+ ref={ref}
604
+ data-slot="card-title"
605
+ className={cn(
606
+ 'inline-grid grid-cols-[minmax(0,1fr)] leading-snug',
607
+ compact ? 'text-subtitle-compact' : 'text-subtitle',
608
+ className,
609
+ )}
610
+ {...props}
611
+ >
612
+ <span
613
+ className={cn(
614
+ 'col-start-1 row-start-1 invisible min-w-0 overflow-hidden text-ellipsis',
615
+ trim,
616
+ 'weight-semibold',
617
+ )}
618
+ aria-hidden="true"
619
+ >
620
+ {children}
621
+ </span>
622
+ <span
623
+ className={cn(
624
+ 'col-start-1 row-start-1 min-w-0 overflow-hidden text-ellipsis text-foreground transition-[font-variation-settings] duration-fast',
625
+ trim,
626
+ // normal → semibold on emphasis, matching nav-item / menu-item /
627
+ // table (the opsz-paired tokens keep the advance width ~constant).
628
+ emphasized ? 'weight-semibold' : 'weight-normal',
629
+ )}
630
+ >
631
+ {children}
632
+ </span>
633
+ </span>
634
+ )
635
+ },
636
+ )
637
+
638
+ CardTitle.displayName = 'CardTitle'
639
+
640
+ // ── CardDescription ──────────────────────────────────────
641
+
642
+ const CardDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(
643
+ ({ className, ...props }, ref) => {
644
+ const sizeClasses = useSize()
645
+ const compact = sizeClasses.variant === 'compact'
646
+ return (
647
+ <p
648
+ ref={ref}
649
+ data-slot="card-description"
650
+ className={cn(
651
+ 'leading-normal text-muted-foreground',
652
+ compact ? 'text-subtitle-compact' : 'text-subtitle',
653
+ className,
654
+ )}
655
+ {...props}
656
+ />
657
+ )
658
+ },
659
+ )
660
+
661
+ CardDescription.displayName = 'CardDescription'
662
+
663
+ // ── CardAction ───────────────────────────────────────────
664
+ // Pinned to the header's top-right column (shadcn's slot). Sits above the
665
+ // stretched overlay so any control inside stays independently clickable.
666
+
667
+ const CardAction = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
668
+ <div
669
+ ref={ref}
670
+ data-slot="card-action"
671
+ className={cn('relative z-30 col-start-2 row-span-2 row-start-1 self-start justify-self-end', className)}
672
+ {...props}
673
+ />
674
+ ))
675
+
676
+ CardAction.displayName = 'CardAction'
677
+
678
+ // ── CardContent ──────────────────────────────────────────
679
+
680
+ const CardContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {
681
+ const { orientation } = useContext(CardContext)
682
+ const sizeClasses = useSize()
683
+ const compact = sizeClasses.variant === 'compact'
684
+ return (
685
+ <div
686
+ ref={ref}
687
+ data-slot="card-content"
688
+ className={cn(orientation === 'inline' ? '' : compact ? 'px-3 pt-2.5' : 'px-4 pt-3', className)}
689
+ {...props}
690
+ />
691
+ )
692
+ })
693
+
694
+ CardContent.displayName = 'CardContent'
695
+
696
+ // ── CardFooter ───────────────────────────────────────────
697
+ // Actions row. Rises above the stretched overlay (z-30) so buttons stay
698
+ // clickable. In an inline card it becomes the trailing, right-aligned slot.
699
+
700
+ const CardFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {
701
+ const { orientation, hasImage } = useContext(CardContext)
702
+ const inlineImage = orientation === 'inline' && hasImage
703
+ const sizeClasses = useSize()
704
+ const compact = sizeClasses.variant === 'compact'
705
+ return (
706
+ <div
707
+ ref={ref}
708
+ data-slot="card-footer"
709
+ className={cn(
710
+ 'relative z-30 flex items-center gap-1',
711
+ inlineImage
712
+ ? // Under the text, left-aligned in natural order (the inline
713
+ // wrapper owns the spacing).
714
+ 'flex-wrap'
715
+ : orientation === 'inline'
716
+ ? cn('shrink-0 ml-auto', compact ? 'pr-3' : 'pr-4')
717
+ : cn('flex-wrap', compact ? 'px-3 pt-2.5' : 'px-4 pt-3'),
718
+ className,
719
+ )}
720
+ {...props}
721
+ />
722
+ )
723
+ })
724
+
725
+ CardFooter.displayName = 'CardFooter'
726
+
727
+ // ── CardDivider ──────────────────────────────────────────
728
+ // Local: a hairline across the card between two parts. The card has no
729
+ // padding of its own, so a direct child runs edge to edge; its top margin
730
+ // matches the parts' top padding, so the gap reads the same on both sides.
731
+
732
+ const CardDivider = forwardRef<HTMLDivElement, SeparatorProps>(({ className, orientation, ...props }, ref) => {
733
+ const { orientation: cardOrientation } = useContext(CardContext)
734
+ const compact = useSize().variant === 'compact'
735
+ const vertical = (orientation ?? (cardOrientation === 'inline' ? 'vertical' : 'horizontal')) === 'vertical'
736
+ return (
737
+ <Separator
738
+ ref={ref}
739
+ data-slot="card-divider"
740
+ {...props}
741
+ orientation={vertical ? 'vertical' : 'horizontal'}
742
+ className={cn(
743
+ 'bg-border/60',
744
+ vertical ? (compact ? 'my-2.5' : 'my-3.5') : compact ? 'mt-2.5' : 'mt-3',
745
+ className,
746
+ )}
747
+ />
748
+ )
749
+ })
750
+
751
+ CardDivider.displayName = 'CardDivider'
752
+
753
+ // ── CardMedia ────────────────────────────────────────────
754
+ // FF addition: a leading icon or brand logo(s). Not part of shadcn's anatomy,
755
+ // but the connective tissue most product cards need. A tuple renders a
756
+ // connected logo pair (e.g. a trigger — target).
757
+
758
+ type CardLogo = string | [string, string]
759
+
760
+ interface CardMediaProps {
761
+ logo?: CardLogo
762
+ logoAlt?: string
763
+ icon?: IconComponent
764
+ size?: number
765
+ className?: string
766
+ }
767
+
768
+ function CardMedia({ logo, logoAlt, icon: Icon, size = 22, className }: CardMediaProps) {
769
+ const { orientation } = useContext(CardContext)
770
+ const shape = useShape()
771
+ const sizeClasses = useSize()
772
+ const compact = sizeClasses.variant === 'compact'
773
+ // Stacked: sits in the header grid; add an extra 8px so the gap below the
774
+ // icon reads 12px (header gap-1 + mb-2). Inline: leading slot — the card owns
775
+ // the left inset, so no extra padding here.
776
+ const wrap = cn(orientation === 'inline' ? '' : 'mb-2', className)
777
+
778
+ if (logo) {
779
+ const logos = Array.isArray(logo) ? logo : [logo]
780
+ return (
781
+ <span data-slot="card-media" className={cn('inline-flex items-center gap-1.5 shrink-0', wrap)}>
782
+ {logos.map((src, i) => (
783
+ <span key={i} className="inline-flex items-center gap-1.5">
784
+ {i > 0 && <span aria-hidden className="w-2 h-px bg-border" />}
785
+ {/* eslint-disable-next-line @next/next/no-img-element */}
786
+ <img
787
+ src={src}
788
+ alt={logoAlt ?? ''}
789
+ width={size}
790
+ height={size}
791
+ className={cn('object-contain', shape.bg)}
792
+ style={{ width: size, height: size }}
793
+ />
794
+ </span>
795
+ ))}
796
+ </span>
797
+ )
798
+ }
799
+ if (Icon) {
800
+ // The icon sits in a 32×32 tinted tile so it reads as a media slot rather
801
+ // than a bare glyph. The tile is an overlay tint (not a solid surface) so it
802
+ // blends over whatever is behind it — the substrate or the hover highlight.
803
+ return (
804
+ <span
805
+ data-slot="card-media"
806
+ className={cn('inline-flex items-center justify-center shrink-0 size-8 bg-hover', shape.bg, wrap)}
807
+ >
808
+ <Icon size={compact ? 16 : 18} strokeWidth={1.5} className="text-muted-foreground" />
809
+ </span>
810
+ )
811
+ }
812
+ return null
813
+ }
814
+
815
+ // ── CardImage ────────────────────────────────────────────
816
+ // FF addition: the prominent, full-bleed image (distinct from a small logo).
817
+ // Stacked → a top banner; inline → a full-height leading image on the left that
818
+ // bleeds past the card's left inset to sit flush against the edge.
819
+
820
+ interface CardImageProps {
821
+ src: string
822
+ alt?: string
823
+ className?: string
824
+ }
825
+
826
+ function CardImage({ src, alt, className }: CardImageProps) {
827
+ const { orientation } = useContext(CardContext)
828
+ return (
829
+ // eslint-disable-next-line @next/next/no-img-element
830
+ <img
831
+ src={src}
832
+ alt={alt ?? ''}
833
+ data-slot="card-image"
834
+ // The image keeps a fixed 2px corner radius in every state — stacked or
835
+ // inline, framed or borderless — rather than inheriting a frame's larger
836
+ // clip. (A framed tile still clips the surrounding surface as before.)
837
+ className={cn(
838
+ 'object-cover rounded-xs',
839
+ orientation === 'inline' ? 'size-40 shrink-0' : 'w-full aspect-[16/9]',
840
+ className,
841
+ )}
842
+ />
843
+ )
844
+ }
845
+
846
+ // A stable marker so the Card can recognise an image child by name, surviving
847
+ // module-identity mismatches (e.g. HMR duplication) that break `type ===`.
848
+ CardImage.displayName = 'CardImage'
849
+
850
+ // ── CardEyebrow ──────────────────────────────────────────
851
+ // Small uppercase label above the title (e.g. "New Model"). Typographically
852
+ // it's the caption role of the type scale in uppercase — see /docs/sizes.
853
+
854
+ const CardEyebrow = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(({ className, ...props }, ref) => {
855
+ const compact = useSize().variant === 'compact'
856
+ return (
857
+ <span
858
+ ref={ref}
859
+ data-slot="card-eyebrow"
860
+ className={cn(
861
+ compact ? 'text-caption-compact' : 'text-caption',
862
+ 'uppercase tracking-wide text-muted-foreground',
863
+ 'weight-semibold',
864
+ className,
865
+ )}
866
+ {...props}
867
+ />
868
+ )
869
+ })
870
+
871
+ CardEyebrow.displayName = 'CardEyebrow'
872
+
873
+ // ── CardFeature ──────────────────────────────────────────
874
+ // FF addition: an icon + title + description row, for feature lists inside
875
+ // CardContent.
876
+
877
+ interface CardFeatureProps {
878
+ icon?: IconComponent
879
+ title: string
880
+ description?: string
881
+ }
882
+
883
+ function CardFeature({ icon: Icon, title, description }: CardFeatureProps) {
884
+ const sizeClasses = useSize()
885
+ const compact = sizeClasses.variant === 'compact'
886
+ return (
887
+ <div data-slot="card-feature" className={cn('flex items-start', sizeClasses.gap)}>
888
+ {Icon && <Icon size={sizeClasses.icon} strokeWidth={1.5} className="mt-0.5 shrink-0 text-muted-foreground" />}
889
+ <div className="flex flex-col gap-0.5 min-w-0">
890
+ <span className={cn('text-foreground [text-box:trim-both_cap_alphabetic]', sizeClasses.text, 'weight-medium')}>
891
+ {title}
892
+ </span>
893
+ {description && (
894
+ <span
895
+ className={cn('leading-relaxed text-muted-foreground', compact ? 'text-caption-compact' : 'text-caption')}
896
+ >
897
+ {description}
898
+ </span>
899
+ )}
900
+ </div>
901
+ </div>
902
+ )
903
+ }
904
+
905
+ // ── CardButton ───────────────────────────────────────────
906
+ // Self-contained action button for the footer (keeps Card free of a Button
907
+ // dependency, so it installs standalone). Renders an anchor when `href` is set.
908
+
909
+ type CardButtonVariant = 'primary' | 'secondary' | 'ghost' | 'link'
910
+
911
+ const CARD_BUTTON_VARIANTS: Record<CardButtonVariant, string> = {
912
+ primary: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',
913
+ secondary: 'bg-accent text-foreground hover:bg-accent/80 active:bg-accent',
914
+ ghost: 'text-muted-foreground hover:text-foreground hover:bg-hover active:bg-active',
915
+ link: 'text-foreground underline-offset-4 hover:underline !px-0 !h-auto',
916
+ }
917
+
918
+ interface CardButtonProps {
919
+ children: React.ReactNode
920
+ onClick?: () => void
921
+ href?: string
922
+ variant?: CardButtonVariant
923
+ icon?: IconComponent
924
+ iconPosition?: 'start' | 'end'
925
+ /** Opens the href in a new tab and appends an outward arrow glyph. */
926
+ external?: boolean
927
+ disabled?: boolean
928
+ }
929
+
930
+ function CardButton({
931
+ children,
932
+ onClick,
933
+ href,
934
+ variant = 'ghost',
935
+ icon: Icon,
936
+ iconPosition,
937
+ external = false,
938
+ disabled = false,
939
+ }: CardButtonProps) {
940
+ const shape = useShape()
941
+ const ArrowRight = useIcon('arrow-right')
942
+ const sizeClasses = useSize()
943
+ const compact = sizeClasses.variant === 'compact'
944
+ const position = iconPosition ?? (external ? 'end' : 'start')
945
+
946
+ const glyph = Icon ? (
947
+ <Icon
948
+ size={compact ? 12 : 14}
949
+ strokeWidth={1.5}
950
+ className="shrink-0 transition-[stroke-width] duration-fast group-hover/action:stroke-[2]"
951
+ />
952
+ ) : null
953
+ const externalGlyph = external ? (
954
+ <ArrowRight
955
+ size={13}
956
+ strokeWidth={1.5}
957
+ className="shrink-0 -rotate-45 transition-[stroke-width] duration-fast group-hover/action:stroke-[2]"
958
+ />
959
+ ) : null
960
+
961
+ const inner = (
962
+ <>
963
+ {position === 'start' && glyph}
964
+ <span className="[text-box:trim-both_cap_alphabetic]">{children}</span>
965
+ {position === 'end' && glyph}
966
+ {externalGlyph}
967
+ </>
968
+ )
969
+
970
+ const classes = cn(
971
+ 'group/action relative z-30 inline-flex items-center justify-center gap-1.5 h-7 px-2.5 cursor-pointer outline-none',
972
+ compact ? 'text-caption-compact' : 'text-caption',
973
+ 'weight-medium',
974
+ 'transition-colors duration-fast',
975
+ 'focus-visible:ring-1 focus-visible:ring-focus-ring',
976
+ 'disabled:opacity-50 disabled:pointer-events-none',
977
+ shape.button,
978
+ CARD_BUTTON_VARIANTS[variant],
979
+ )
980
+
981
+ if (href) {
982
+ return (
983
+ <a
984
+ href={href}
985
+ onClick={onClick}
986
+ target={external ? '_blank' : undefined}
987
+ rel={external ? 'noopener noreferrer' : undefined}
988
+ className={classes}
989
+ >
990
+ {inner}
991
+ </a>
992
+ )
993
+ }
994
+
995
+ return (
996
+ <button type="button" onClick={onClick} disabled={disabled} className={classes}>
997
+ {inner}
998
+ </button>
999
+ )
1000
+ }
1001
+
1002
+ // Compound statics: `<Card.Group>`, `<Card.Header>`, … (typed by the
1003
+ // CardComponent cast on the forwardRef above).
1004
+ Object.assign(Card, {
1005
+ Group: CardGroup,
1006
+ Header: CardHeader,
1007
+ Title: CardTitle,
1008
+ Description: CardDescription,
1009
+ Action: CardAction,
1010
+ Content: CardContent,
1011
+ Footer: CardFooter,
1012
+ Divider: CardDivider,
1013
+ Media: CardMedia,
1014
+ Image: CardImage,
1015
+ Eyebrow: CardEyebrow,
1016
+ Feature: CardFeature,
1017
+ Button: CardButton,
1018
+ })
1019
+
1020
+ export type { CardBorder, CardButtonProps, CardButtonVariant, CardGroupProps, CardLogo, CardProps }
1021
+ export {
1022
+ Card,
1023
+ CardAction,
1024
+ CardButton,
1025
+ CardContent,
1026
+ CardDescription,
1027
+ CardDivider,
1028
+ CardEyebrow,
1029
+ CardFeature,
1030
+ CardFooter,
1031
+ CardGroup,
1032
+ CardHeader,
1033
+ CardImage,
1034
+ CardMedia,
1035
+ CardTitle,
1036
+ }
1037
+ export default Card