@slipstream-ui/core 0.7.0 → 0.9.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 (383) hide show
  1. package/dist/index.d.mts +317 -21
  2. package/dist/index.d.ts +317 -21
  3. package/dist/index.js +2004 -1069
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1998 -1068
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/manifests/accordion.manifest.json +8 -2
  8. package/dist/manifests/alert.manifest.json +1 -1
  9. package/dist/manifests/announcement-bar.manifest.json +1 -1
  10. package/dist/manifests/app-shell.manifest.json +1 -1
  11. package/dist/manifests/applied-filters.manifest.json +1 -1
  12. package/dist/manifests/article-card.manifest.json +1 -1
  13. package/dist/manifests/auth-layout.manifest.json +19 -1
  14. package/dist/manifests/autocomplete.manifest.json +1 -1
  15. package/dist/manifests/avatar.manifest.json +1 -1
  16. package/dist/manifests/badge.manifest.json +13 -1
  17. package/dist/manifests/block.manifest.json +1 -1
  18. package/dist/manifests/bottom-nav.manifest.json +130 -0
  19. package/dist/manifests/breadcrumb.manifest.json +1 -1
  20. package/dist/manifests/button-group.manifest.json +1 -1
  21. package/dist/manifests/button.manifest.json +1 -1
  22. package/dist/manifests/calendar.manifest.json +175 -0
  23. package/dist/manifests/card.manifest.json +1 -1
  24. package/dist/manifests/checkbox.manifest.json +1 -1
  25. package/dist/manifests/comparison-table.manifest.json +1 -1
  26. package/dist/manifests/confirm-dialog.manifest.json +1 -1
  27. package/dist/manifests/contact-strip.manifest.json +1 -1
  28. package/dist/manifests/container.manifest.json +1 -1
  29. package/dist/manifests/cta-section.manifest.json +1 -1
  30. package/dist/manifests/data-table.manifest.json +8 -1
  31. package/dist/manifests/date-picker-popover.manifest.json +202 -0
  32. package/dist/manifests/date-picker.manifest.json +1 -1
  33. package/dist/manifests/date-range-picker.manifest.json +1 -1
  34. package/dist/manifests/deal-card.manifest.json +1 -1
  35. package/dist/manifests/dialog.manifest.json +1 -1
  36. package/dist/manifests/document-card.manifest.json +1 -1
  37. package/dist/manifests/drawer.manifest.json +48 -2
  38. package/dist/manifests/empty-state.manifest.json +1 -1
  39. package/dist/manifests/entity-card.manifest.json +1 -1
  40. package/dist/manifests/feature-grid.manifest.json +1 -1
  41. package/dist/manifests/feature-row.manifest.json +1 -1
  42. package/dist/manifests/fieldset.manifest.json +1 -1
  43. package/dist/manifests/file-upload.manifest.json +1 -1
  44. package/dist/manifests/filter-bar.manifest.json +1 -1
  45. package/dist/manifests/filter-chips.manifest.json +1 -1
  46. package/dist/manifests/filter-panel.manifest.json +1 -1
  47. package/dist/manifests/flex.manifest.json +1 -1
  48. package/dist/manifests/form-field.manifest.json +1 -1
  49. package/dist/manifests/form-layout.manifest.json +1 -1
  50. package/dist/manifests/form.manifest.json +1 -1
  51. package/dist/manifests/grid.manifest.json +1 -1
  52. package/dist/manifests/heading.manifest.json +1 -1
  53. package/dist/manifests/hero.manifest.json +1 -1
  54. package/dist/manifests/image.manifest.json +142 -0
  55. package/dist/manifests/input-group.manifest.json +1 -1
  56. package/dist/manifests/input.manifest.json +1 -1
  57. package/dist/manifests/label.manifest.json +1 -1
  58. package/dist/manifests/link-tabs.manifest.json +1 -1
  59. package/dist/manifests/link.manifest.json +1 -1
  60. package/dist/manifests/list.manifest.json +1 -1
  61. package/dist/manifests/load-more.manifest.json +1 -1
  62. package/dist/manifests/logo-cloud.manifest.json +1 -1
  63. package/dist/manifests/menu.manifest.json +1 -1
  64. package/dist/manifests/metric-card.manifest.json +36 -4
  65. package/dist/manifests/multi-select.manifest.json +1 -1
  66. package/dist/manifests/newsletter.manifest.json +1 -1
  67. package/dist/manifests/page-header.manifest.json +7 -1
  68. package/dist/manifests/pagination.manifest.json +1 -1
  69. package/dist/manifests/password-input.manifest.json +1 -1
  70. package/dist/manifests/popover.manifest.json +86 -4
  71. package/dist/manifests/process-steps.manifest.json +1 -1
  72. package/dist/manifests/progress.manifest.json +1 -1
  73. package/dist/manifests/prose.manifest.json +1 -1
  74. package/dist/manifests/radio.manifest.json +1 -1
  75. package/dist/manifests/range-slider.manifest.json +1 -1
  76. package/dist/manifests/search.manifest.json +1 -1
  77. package/dist/manifests/section-heading.manifest.json +1 -1
  78. package/dist/manifests/section.manifest.json +1 -1
  79. package/dist/manifests/segmented-control.manifest.json +1 -1
  80. package/dist/manifests/select-menu.manifest.json +1 -1
  81. package/dist/manifests/select.manifest.json +1 -1
  82. package/dist/manifests/separator.manifest.json +1 -1
  83. package/dist/manifests/site-footer.manifest.json +1 -1
  84. package/dist/manifests/site-header.manifest.json +13 -3
  85. package/dist/manifests/skeleton.manifest.json +1 -1
  86. package/dist/manifests/spinner.manifest.json +1 -1
  87. package/dist/manifests/stat-band.manifest.json +1 -1
  88. package/dist/manifests/stepper.manifest.json +7 -1
  89. package/dist/manifests/switch.manifest.json +1 -1
  90. package/dist/manifests/table-card.manifest.json +1 -1
  91. package/dist/manifests/table-of-contents.manifest.json +1 -1
  92. package/dist/manifests/table.manifest.json +1 -1
  93. package/dist/manifests/tabs.manifest.json +1 -1
  94. package/dist/manifests/testimonial.manifest.json +1 -1
  95. package/dist/manifests/text.manifest.json +1 -1
  96. package/dist/manifests/textarea.manifest.json +1 -1
  97. package/dist/manifests/theme-toggle.manifest.json +1 -1
  98. package/dist/manifests/time-picker.manifest.json +1 -1
  99. package/dist/manifests/timeline.manifest.json +1 -1
  100. package/dist/manifests/toast.manifest.json +1 -1
  101. package/dist/manifests/tombstone-card.manifest.json +1 -1
  102. package/dist/manifests/tooltip.manifest.json +1 -1
  103. package/dist/src/components/accordion/Accordion.d.ts +17 -1
  104. package/dist/src/components/accordion/Accordion.js +5 -1
  105. package/dist/src/components/accordion/Accordion.js.map +1 -1
  106. package/dist/src/components/accordion/Accordion.mjs +5 -1
  107. package/dist/src/components/accordion/Accordion.mjs.map +1 -1
  108. package/dist/src/components/alert/Alert.js +1 -1
  109. package/dist/src/components/alert/Alert.js.map +1 -1
  110. package/dist/src/components/alert/Alert.mjs +1 -1
  111. package/dist/src/components/alert/Alert.mjs.map +1 -1
  112. package/dist/src/components/app-shell/AppShell.js +1 -1
  113. package/dist/src/components/app-shell/AppShell.js.map +1 -1
  114. package/dist/src/components/app-shell/AppShell.mjs +1 -1
  115. package/dist/src/components/app-shell/AppShell.mjs.map +1 -1
  116. package/dist/src/components/article-card/ArticleCard.js +2 -2
  117. package/dist/src/components/article-card/ArticleCard.js.map +1 -1
  118. package/dist/src/components/article-card/ArticleCard.mjs +2 -2
  119. package/dist/src/components/article-card/ArticleCard.mjs.map +1 -1
  120. package/dist/src/components/auth-layout/AuthLayout.d.ts +14 -2
  121. package/dist/src/components/auth-layout/AuthLayout.js +10 -2
  122. package/dist/src/components/auth-layout/AuthLayout.js.map +1 -1
  123. package/dist/src/components/auth-layout/AuthLayout.mjs +10 -2
  124. package/dist/src/components/auth-layout/AuthLayout.mjs.map +1 -1
  125. package/dist/src/components/badge/Badge.d.ts +2 -0
  126. package/dist/src/components/badge/Badge.js +9 -3
  127. package/dist/src/components/badge/Badge.js.map +1 -1
  128. package/dist/src/components/badge/Badge.mjs +9 -3
  129. package/dist/src/components/badge/Badge.mjs.map +1 -1
  130. package/dist/src/components/bottom-nav/BottomNav.d.ts +36 -0
  131. package/dist/src/components/bottom-nav/BottomNav.js +90 -0
  132. package/dist/src/components/bottom-nav/BottomNav.js.map +1 -0
  133. package/dist/src/components/bottom-nav/BottomNav.mjs +66 -0
  134. package/dist/src/components/bottom-nav/BottomNav.mjs.map +1 -0
  135. package/dist/src/components/bottom-nav/index.d.ts +1 -0
  136. package/dist/src/components/bottom-nav/index.js +23 -0
  137. package/dist/src/components/bottom-nav/index.js.map +1 -0
  138. package/dist/src/components/bottom-nav/index.mjs +2 -0
  139. package/dist/src/components/bottom-nav/index.mjs.map +1 -0
  140. package/dist/src/components/calendar/Calendar.d.ts +34 -0
  141. package/dist/src/components/calendar/Calendar.js +233 -0
  142. package/dist/src/components/calendar/Calendar.js.map +1 -0
  143. package/dist/src/components/calendar/Calendar.mjs +208 -0
  144. package/dist/src/components/calendar/Calendar.mjs.map +1 -0
  145. package/dist/src/components/calendar/index.d.ts +1 -0
  146. package/dist/src/components/calendar/index.js +23 -0
  147. package/dist/src/components/calendar/index.js.map +1 -0
  148. package/dist/src/components/calendar/index.mjs +2 -0
  149. package/dist/src/components/calendar/index.mjs.map +1 -0
  150. package/dist/src/components/comparison-table/ComparisonTable.js +1 -1
  151. package/dist/src/components/comparison-table/ComparisonTable.js.map +1 -1
  152. package/dist/src/components/comparison-table/ComparisonTable.mjs +1 -1
  153. package/dist/src/components/comparison-table/ComparisonTable.mjs.map +1 -1
  154. package/dist/src/components/cta-section/CTASection.js +1 -1
  155. package/dist/src/components/cta-section/CTASection.js.map +1 -1
  156. package/dist/src/components/cta-section/CTASection.mjs +1 -1
  157. package/dist/src/components/cta-section/CTASection.mjs.map +1 -1
  158. package/dist/src/components/data-table/DataTable.d.ts +3 -1
  159. package/dist/src/components/data-table/DataTable.js +2 -4
  160. package/dist/src/components/data-table/DataTable.js.map +1 -1
  161. package/dist/src/components/data-table/DataTable.mjs +2 -4
  162. package/dist/src/components/data-table/DataTable.mjs.map +1 -1
  163. package/dist/src/components/date-picker-popover/DatePickerPopover.d.ts +33 -0
  164. package/dist/src/components/date-picker-popover/DatePickerPopover.js +117 -0
  165. package/dist/src/components/date-picker-popover/DatePickerPopover.js.map +1 -0
  166. package/dist/src/components/date-picker-popover/DatePickerPopover.mjs +83 -0
  167. package/dist/src/components/date-picker-popover/DatePickerPopover.mjs.map +1 -0
  168. package/dist/src/components/date-picker-popover/index.d.ts +1 -0
  169. package/dist/src/components/date-picker-popover/index.js +23 -0
  170. package/dist/src/components/date-picker-popover/index.js.map +1 -0
  171. package/dist/src/components/date-picker-popover/index.mjs +2 -0
  172. package/dist/src/components/date-picker-popover/index.mjs.map +1 -0
  173. package/dist/src/components/drawer/Drawer.d.ts +25 -2
  174. package/dist/src/components/drawer/Drawer.js +97 -6
  175. package/dist/src/components/drawer/Drawer.js.map +1 -1
  176. package/dist/src/components/drawer/Drawer.mjs +97 -6
  177. package/dist/src/components/drawer/Drawer.mjs.map +1 -1
  178. package/dist/src/components/empty-state/EmptyState.d.ts +13 -4
  179. package/dist/src/components/empty-state/EmptyState.js +13 -1
  180. package/dist/src/components/empty-state/EmptyState.js.map +1 -1
  181. package/dist/src/components/empty-state/EmptyState.mjs +13 -1
  182. package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
  183. package/dist/src/components/image/Image.d.ts +34 -0
  184. package/dist/src/components/image/Image.js +75 -0
  185. package/dist/src/components/image/Image.js.map +1 -0
  186. package/dist/src/components/image/Image.mjs +41 -0
  187. package/dist/src/components/image/Image.mjs.map +1 -0
  188. package/dist/src/components/image/index.d.ts +1 -0
  189. package/dist/src/components/image/index.js +29 -0
  190. package/dist/src/components/image/index.js.map +1 -0
  191. package/dist/src/components/image/index.mjs +5 -0
  192. package/dist/src/components/image/index.mjs.map +1 -0
  193. package/dist/src/components/link/Link.js +4 -4
  194. package/dist/src/components/link/Link.js.map +1 -1
  195. package/dist/src/components/link/Link.mjs +4 -4
  196. package/dist/src/components/link/Link.mjs.map +1 -1
  197. package/dist/src/components/metric-card/MetricCard.d.ts +23 -4
  198. package/dist/src/components/metric-card/MetricCard.js +32 -5
  199. package/dist/src/components/metric-card/MetricCard.js.map +1 -1
  200. package/dist/src/components/metric-card/MetricCard.mjs +32 -5
  201. package/dist/src/components/metric-card/MetricCard.mjs.map +1 -1
  202. package/dist/src/components/page-header/PageHeader.d.ts +4 -0
  203. package/dist/src/components/page-header/PageHeader.js +4 -3
  204. package/dist/src/components/page-header/PageHeader.js.map +1 -1
  205. package/dist/src/components/page-header/PageHeader.mjs +4 -3
  206. package/dist/src/components/page-header/PageHeader.mjs.map +1 -1
  207. package/dist/src/components/popover/Popover.d.ts +36 -3
  208. package/dist/src/components/popover/Popover.js +118 -22
  209. package/dist/src/components/popover/Popover.js.map +1 -1
  210. package/dist/src/components/popover/Popover.mjs +117 -22
  211. package/dist/src/components/popover/Popover.mjs.map +1 -1
  212. package/dist/src/components/section-heading/SectionHeading.js +1 -1
  213. package/dist/src/components/section-heading/SectionHeading.js.map +1 -1
  214. package/dist/src/components/section-heading/SectionHeading.mjs +1 -1
  215. package/dist/src/components/section-heading/SectionHeading.mjs.map +1 -1
  216. package/dist/src/components/separator/Separator.d.ts +3 -3
  217. package/dist/src/components/site-header/SiteHeader.d.ts +25 -3
  218. package/dist/src/components/site-header/SiteHeader.js +141 -6
  219. package/dist/src/components/site-header/SiteHeader.js.map +1 -1
  220. package/dist/src/components/site-header/SiteHeader.mjs +141 -6
  221. package/dist/src/components/site-header/SiteHeader.mjs.map +1 -1
  222. package/dist/src/components/stepper/Stepper.d.ts +18 -0
  223. package/dist/src/components/stepper/Stepper.js +2 -1
  224. package/dist/src/components/stepper/Stepper.js.map +1 -1
  225. package/dist/src/components/stepper/Stepper.mjs +2 -1
  226. package/dist/src/components/stepper/Stepper.mjs.map +1 -1
  227. package/dist/src/index.d.ts +4 -0
  228. package/dist/src/utils/date.d.ts +32 -0
  229. package/dist/src/utils/date.js +171 -0
  230. package/dist/src/utils/date.js.map +1 -0
  231. package/dist/src/utils/date.mjs +134 -0
  232. package/dist/src/utils/date.mjs.map +1 -0
  233. package/dist/src/utils/position.d.ts +42 -0
  234. package/dist/src/utils/position.js +91 -0
  235. package/dist/src/utils/position.js.map +1 -0
  236. package/dist/src/utils/position.mjs +67 -0
  237. package/dist/src/utils/position.mjs.map +1 -0
  238. package/dist/styles-full.css +1 -1
  239. package/dist/styles.css +1 -1
  240. package/package.json +3 -3
  241. package/src/components/accordion/Accordion.test.tsx +31 -0
  242. package/src/components/accordion/Accordion.tsx +27 -2
  243. package/src/components/alert/Alert.tsx +1 -1
  244. package/src/components/app-shell/AppShell.tsx +1 -1
  245. package/src/components/article-card/ArticleCard.tsx +2 -2
  246. package/src/components/auth-layout/AuthLayout.test.tsx +36 -0
  247. package/src/components/auth-layout/AuthLayout.tsx +20 -3
  248. package/src/components/badge/Badge.test.tsx +7 -0
  249. package/src/components/badge/Badge.tsx +8 -2
  250. package/src/components/bottom-nav/BottomNav.test.tsx +48 -0
  251. package/src/components/bottom-nav/BottomNav.tsx +117 -0
  252. package/src/components/bottom-nav/index.ts +1 -0
  253. package/src/components/calendar/Calendar.test.tsx +277 -0
  254. package/src/components/calendar/Calendar.tsx +273 -0
  255. package/src/components/calendar/index.ts +1 -0
  256. package/src/components/comparison-table/ComparisonTable.tsx +1 -1
  257. package/src/components/cta-section/CTASection.tsx +1 -1
  258. package/src/components/data-table/DataTable.test.tsx +21 -0
  259. package/src/components/data-table/DataTable.tsx +4 -1
  260. package/src/components/date-picker-popover/DatePickerPopover.test.tsx +223 -0
  261. package/src/components/date-picker-popover/DatePickerPopover.tsx +117 -0
  262. package/src/components/date-picker-popover/index.ts +1 -0
  263. package/src/components/drawer/Drawer.test.tsx +86 -1
  264. package/src/components/drawer/Drawer.tsx +135 -7
  265. package/src/components/empty-state/EmptyState.test.tsx +26 -1
  266. package/src/components/empty-state/EmptyState.tsx +40 -3
  267. package/src/components/image/Image.test.tsx +94 -0
  268. package/src/components/image/Image.tsx +71 -0
  269. package/src/components/image/index.ts +1 -0
  270. package/src/components/link/Link.test.tsx +2 -1
  271. package/src/components/link/Link.tsx +4 -4
  272. package/src/components/metric-card/MetricCard.test.tsx +32 -0
  273. package/src/components/metric-card/MetricCard.tsx +45 -7
  274. package/src/components/page-header/PageHeader.test.tsx +13 -0
  275. package/src/components/page-header/PageHeader.tsx +6 -3
  276. package/src/components/popover/Popover.test.tsx +307 -3
  277. package/src/components/popover/Popover.tsx +228 -91
  278. package/src/components/section-heading/SectionHeading.tsx +1 -1
  279. package/src/components/site-header/SiteHeader.test.tsx +103 -1
  280. package/src/components/site-header/SiteHeader.tsx +220 -16
  281. package/src/components/stepper/Stepper.test.tsx +12 -0
  282. package/src/components/stepper/Stepper.tsx +15 -1
  283. package/src/index.ts +4 -0
  284. package/src/manifests/accordion.manifest.json +8 -2
  285. package/src/manifests/alert.manifest.json +1 -1
  286. package/src/manifests/announcement-bar.manifest.json +1 -1
  287. package/src/manifests/app-shell.manifest.json +1 -1
  288. package/src/manifests/applied-filters.manifest.json +1 -1
  289. package/src/manifests/article-card.manifest.json +1 -1
  290. package/src/manifests/auth-layout.manifest.json +19 -1
  291. package/src/manifests/autocomplete.manifest.json +1 -1
  292. package/src/manifests/avatar.manifest.json +1 -1
  293. package/src/manifests/badge.manifest.json +13 -1
  294. package/src/manifests/block.manifest.json +1 -1
  295. package/src/manifests/bottom-nav.manifest.json +130 -0
  296. package/src/manifests/breadcrumb.manifest.json +1 -1
  297. package/src/manifests/button-group.manifest.json +1 -1
  298. package/src/manifests/button.manifest.json +1 -1
  299. package/src/manifests/calendar.manifest.json +175 -0
  300. package/src/manifests/card.manifest.json +1 -1
  301. package/src/manifests/checkbox.manifest.json +1 -1
  302. package/src/manifests/comparison-table.manifest.json +1 -1
  303. package/src/manifests/confirm-dialog.manifest.json +1 -1
  304. package/src/manifests/contact-strip.manifest.json +1 -1
  305. package/src/manifests/container.manifest.json +1 -1
  306. package/src/manifests/cta-section.manifest.json +1 -1
  307. package/src/manifests/data-table.manifest.json +8 -1
  308. package/src/manifests/date-picker-popover.manifest.json +202 -0
  309. package/src/manifests/date-picker.manifest.json +1 -1
  310. package/src/manifests/date-range-picker.manifest.json +1 -1
  311. package/src/manifests/deal-card.manifest.json +1 -1
  312. package/src/manifests/dialog.manifest.json +1 -1
  313. package/src/manifests/document-card.manifest.json +1 -1
  314. package/src/manifests/drawer.manifest.json +48 -2
  315. package/src/manifests/empty-state.manifest.json +1 -1
  316. package/src/manifests/entity-card.manifest.json +1 -1
  317. package/src/manifests/feature-grid.manifest.json +1 -1
  318. package/src/manifests/feature-row.manifest.json +1 -1
  319. package/src/manifests/fieldset.manifest.json +1 -1
  320. package/src/manifests/file-upload.manifest.json +1 -1
  321. package/src/manifests/filter-bar.manifest.json +1 -1
  322. package/src/manifests/filter-chips.manifest.json +1 -1
  323. package/src/manifests/filter-panel.manifest.json +1 -1
  324. package/src/manifests/flex.manifest.json +1 -1
  325. package/src/manifests/form-field.manifest.json +1 -1
  326. package/src/manifests/form-layout.manifest.json +1 -1
  327. package/src/manifests/form.manifest.json +1 -1
  328. package/src/manifests/grid.manifest.json +1 -1
  329. package/src/manifests/heading.manifest.json +1 -1
  330. package/src/manifests/hero.manifest.json +1 -1
  331. package/src/manifests/image.manifest.json +142 -0
  332. package/src/manifests/input-group.manifest.json +1 -1
  333. package/src/manifests/input.manifest.json +1 -1
  334. package/src/manifests/label.manifest.json +1 -1
  335. package/src/manifests/link-tabs.manifest.json +1 -1
  336. package/src/manifests/link.manifest.json +1 -1
  337. package/src/manifests/list.manifest.json +1 -1
  338. package/src/manifests/load-more.manifest.json +1 -1
  339. package/src/manifests/logo-cloud.manifest.json +1 -1
  340. package/src/manifests/menu.manifest.json +1 -1
  341. package/src/manifests/metric-card.manifest.json +36 -4
  342. package/src/manifests/multi-select.manifest.json +1 -1
  343. package/src/manifests/newsletter.manifest.json +1 -1
  344. package/src/manifests/page-header.manifest.json +7 -1
  345. package/src/manifests/pagination.manifest.json +1 -1
  346. package/src/manifests/password-input.manifest.json +1 -1
  347. package/src/manifests/popover.manifest.json +86 -4
  348. package/src/manifests/process-steps.manifest.json +1 -1
  349. package/src/manifests/progress.manifest.json +1 -1
  350. package/src/manifests/prose.manifest.json +1 -1
  351. package/src/manifests/radio.manifest.json +1 -1
  352. package/src/manifests/range-slider.manifest.json +1 -1
  353. package/src/manifests/search.manifest.json +1 -1
  354. package/src/manifests/section-heading.manifest.json +1 -1
  355. package/src/manifests/section.manifest.json +1 -1
  356. package/src/manifests/segmented-control.manifest.json +1 -1
  357. package/src/manifests/select-menu.manifest.json +1 -1
  358. package/src/manifests/select.manifest.json +1 -1
  359. package/src/manifests/separator.manifest.json +1 -1
  360. package/src/manifests/site-footer.manifest.json +1 -1
  361. package/src/manifests/site-header.manifest.json +13 -3
  362. package/src/manifests/skeleton.manifest.json +1 -1
  363. package/src/manifests/spinner.manifest.json +1 -1
  364. package/src/manifests/stat-band.manifest.json +1 -1
  365. package/src/manifests/stepper.manifest.json +7 -1
  366. package/src/manifests/switch.manifest.json +1 -1
  367. package/src/manifests/table-card.manifest.json +1 -1
  368. package/src/manifests/table-of-contents.manifest.json +1 -1
  369. package/src/manifests/table.manifest.json +1 -1
  370. package/src/manifests/tabs.manifest.json +1 -1
  371. package/src/manifests/testimonial.manifest.json +1 -1
  372. package/src/manifests/text.manifest.json +1 -1
  373. package/src/manifests/textarea.manifest.json +1 -1
  374. package/src/manifests/theme-toggle.manifest.json +1 -1
  375. package/src/manifests/time-picker.manifest.json +1 -1
  376. package/src/manifests/timeline.manifest.json +1 -1
  377. package/src/manifests/toast.manifest.json +1 -1
  378. package/src/manifests/tombstone-card.manifest.json +1 -1
  379. package/src/manifests/tooltip.manifest.json +1 -1
  380. package/src/utils/date.test.ts +190 -0
  381. package/src/utils/date.ts +162 -0
  382. package/src/utils/position.test.ts +227 -0
  383. package/src/utils/position.ts +129 -0
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'react';
2
- import { render, screen, waitFor } from '@testing-library/react';
2
+ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { axe } from 'jest-axe';
5
5
  import { describe, expect, it, vi } from 'vitest';
@@ -181,3 +181,88 @@ describe('localized labels', () => {
181
181
  expect(screen.getByRole('button', { name: 'Fermer' })).toBeInTheDocument();
182
182
  });
183
183
  });
184
+
185
+ describe('onClose alias', () => {
186
+ it('closes through onClose when onOpenChange is absent', async () => {
187
+ const user = userEvent.setup();
188
+ const onClose = vi.fn();
189
+ render(<Drawer open title="Filters" onClose={onClose}>Body</Drawer>);
190
+ await user.keyboard('{Escape}');
191
+ expect(onClose).toHaveBeenCalledTimes(1);
192
+ await user.click(screen.getByRole('button', { name: 'Close drawer' }));
193
+ expect(onClose).toHaveBeenCalledTimes(2);
194
+ });
195
+
196
+ it('prefers onOpenChange when both handlers are passed', async () => {
197
+ const user = userEvent.setup();
198
+ const onOpenChange = vi.fn();
199
+ const onClose = vi.fn();
200
+ render(<Drawer open title="Filters" onOpenChange={onOpenChange} onClose={onClose}>Body</Drawer>);
201
+ await user.click(screen.getByRole('button', { name: 'Close drawer' }));
202
+ expect(onOpenChange).toHaveBeenCalledWith(false);
203
+ expect(onClose).not.toHaveBeenCalled();
204
+ });
205
+ });
206
+
207
+ describe('resizable', () => {
208
+ it('renders a separator with the width bounds and seeds the size preset', () => {
209
+ render(<Drawer open onOpenChange={vi.fn()} title="Details" resizable>Body</Drawer>);
210
+ const handle = screen.getByRole('separator', { name: 'Resize drawer' });
211
+ expect(handle).toHaveAttribute('aria-valuenow', '384');
212
+ expect(handle).toHaveAttribute('aria-valuemin', '240');
213
+ expect(handle).toHaveAttribute('aria-valuemax', '960');
214
+ expect(screen.getByRole('dialog')).toHaveStyle({ width: '384px' });
215
+ });
216
+
217
+ it('honours defaultWidth and clamps it to the bounds', () => {
218
+ render(
219
+ <Drawer open onOpenChange={vi.fn()} title="Details" resizable defaultWidth={100}>
220
+ Body
221
+ </Drawer>
222
+ );
223
+ expect(screen.getByRole('separator')).toHaveAttribute('aria-valuenow', '240');
224
+ });
225
+
226
+ it('grows and shrinks from the keyboard, with Home/End jumps', () => {
227
+ const onWidthChange = vi.fn();
228
+ render(
229
+ <Drawer open onOpenChange={vi.fn()} title="Details" resizable onWidthChange={onWidthChange}>
230
+ Body
231
+ </Drawer>
232
+ );
233
+ const handle = screen.getByRole('separator');
234
+ fireEvent.keyDown(handle, { key: 'ArrowLeft' });
235
+ expect(handle).toHaveAttribute('aria-valuenow', '400');
236
+ fireEvent.keyDown(handle, { key: 'ArrowLeft', shiftKey: true });
237
+ expect(handle).toHaveAttribute('aria-valuenow', '464');
238
+ fireEvent.keyDown(handle, { key: 'End' });
239
+ expect(handle).toHaveAttribute('aria-valuenow', '960');
240
+ fireEvent.keyDown(handle, { key: 'Home' });
241
+ expect(handle).toHaveAttribute('aria-valuenow', '240');
242
+ expect(onWidthChange).toHaveBeenLastCalledWith(240);
243
+ });
244
+
245
+ it('resizes while dragging the handle', () => {
246
+ const onWidthChange = vi.fn();
247
+ render(
248
+ <Drawer open onOpenChange={vi.fn()} title="Details" resizable onWidthChange={onWidthChange}>
249
+ Body
250
+ </Drawer>
251
+ );
252
+ const handle = screen.getByRole('separator');
253
+ fireEvent.pointerDown(handle, { button: 0, clientX: 500 });
254
+ fireEvent.pointerMove(window, { clientX: 400 });
255
+ expect(handle).toHaveAttribute('aria-valuenow', '484');
256
+ fireEvent.pointerUp(window);
257
+ expect(onWidthChange).toHaveBeenCalledWith(484);
258
+ });
259
+
260
+ it('does not render a handle for top/bottom drawers or when resizable is false', () => {
261
+ const { rerender } = render(
262
+ <Drawer open onOpenChange={vi.fn()} title="Sheet" side="bottom" resizable>Body</Drawer>
263
+ );
264
+ expect(screen.queryByRole('separator')).not.toBeInTheDocument();
265
+ rerender(<Drawer open onOpenChange={vi.fn()} title="Sheet">Body</Drawer>);
266
+ expect(screen.queryByRole('separator')).not.toBeInTheDocument();
267
+ });
268
+ });
@@ -11,7 +11,14 @@ export type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
11
11
 
12
12
  export type DrawerProps = {
13
13
  open: boolean;
14
- onOpenChange: (open: boolean) => void;
14
+ /** Called with the next open state. Alias: onClose (close requests only). */
15
+ onOpenChange?: (open: boolean) => void;
16
+ /**
17
+ * Called when the drawer asks to close: Escape, backdrop click or the close
18
+ * button. Alias for `onOpenChange(false)`, used when only a close handler is
19
+ * passed.
20
+ */
21
+ onClose?: () => void;
15
22
  title: string;
16
23
  description?: string;
17
24
  children?: React.ReactNode;
@@ -29,6 +36,22 @@ export type DrawerProps = {
29
36
  * ("60vh"). Overrides `size`.
30
37
  */
31
38
  height?: number | string;
39
+ /**
40
+ * Drag the inner edge to resize a left/right drawer. Keyboard: Arrow keys
41
+ * nudge 16px, Shift+Arrow 64px, Home/End jump to the bounds. Ignored for
42
+ * top/bottom drawers.
43
+ */
44
+ resizable?: boolean;
45
+ /** Lower bound in pixels while resizable (default 240). */
46
+ minWidth?: number;
47
+ /** Upper bound in pixels while resizable (default 960). */
48
+ maxWidth?: number;
49
+ /** Initial width in pixels while resizable; defaults to the `size` preset. */
50
+ defaultWidth?: number;
51
+ /** Fired with the next width in pixels when a resize commits. */
52
+ onWidthChange?: (width: number) => void;
53
+ /** Accessible label for the resize handle (default "Resize drawer"). */
54
+ resizeLabel?: string;
32
55
  /** Clicking the backdrop closes (default true). */
33
56
  closeOnBackdrop?: boolean;
34
57
  /** Hide the close (✕) button in the header (default true). */
@@ -80,6 +103,15 @@ const sizeClasses: Record<DrawerSide, Record<DrawerSize, string>> = {
80
103
  bottom: sideHeights,
81
104
  };
82
105
 
106
+ /** Pixel equivalents of the width presets, used as the resize starting point. */
107
+ const sizePx: Record<DrawerSize, number> = {
108
+ sm: 288,
109
+ md: 384,
110
+ lg: 512,
111
+ xl: 640,
112
+ '2xl': 768,
113
+ };
114
+
83
115
  /** Custom extent wins over the preset; numbers are pixels. */
84
116
  function extentStyle(value: number | string | undefined): string | undefined {
85
117
  if (value === undefined) return undefined;
@@ -110,6 +142,7 @@ const slideOut: Record<DrawerSide, string> = {
110
142
  export function Drawer({
111
143
  open,
112
144
  onOpenChange,
145
+ onClose,
113
146
  title,
114
147
  description,
115
148
  children,
@@ -117,6 +150,12 @@ export function Drawer({
117
150
  size = 'md',
118
151
  width,
119
152
  height,
153
+ resizable = false,
154
+ minWidth = 240,
155
+ maxWidth = 960,
156
+ defaultWidth,
157
+ onWidthChange,
158
+ resizeLabel = 'Resize drawer',
120
159
  closeOnBackdrop = true,
121
160
  showClose = true,
122
161
  closeLabel = 'Close drawer',
@@ -131,6 +170,74 @@ export function Drawer({
131
170
  const { present, exiting } = usePresence(open, animate);
132
171
  const isTopLayer = useModalLayer(open);
133
172
 
173
+ // Prefer onOpenChange; fall back to the onClose alias so a migration code
174
+ // path that only passes onClose still dismisses without double-firing.
175
+ const requestClose = React.useCallback(() => {
176
+ if (onOpenChange) onOpenChange(false);
177
+ else onClose?.();
178
+ }, [onOpenChange, onClose]);
179
+
180
+ // Resizable left/right drawers. Width is state-local so dragging stays
181
+ // smooth; `onWidthChange` fires once a drag commits or a key is pressed.
182
+ const isVerticalSide = side === 'top' || side === 'bottom';
183
+ const canResize = resizable && !isVerticalSide;
184
+ const clampWidth = React.useCallback(
185
+ (next: number) => Math.min(maxWidth, Math.max(minWidth, Math.round(next))),
186
+ [minWidth, maxWidth]
187
+ );
188
+ const [resizedWidth, setResizedWidth] = React.useState<number | null>(null);
189
+ const initialWidth = clampWidth(
190
+ defaultWidth ?? (typeof width === 'number' ? width : sizePx[size])
191
+ );
192
+ const resizeWidth = resizedWidth ?? initialWidth;
193
+ const widthRef = React.useRef(resizeWidth);
194
+ widthRef.current = resizeWidth;
195
+ const onWidthChangeRef = React.useRef(onWidthChange);
196
+ onWidthChangeRef.current = onWidthChange;
197
+
198
+ const commitWidth = (next: number) => {
199
+ const clamped = clampWidth(next);
200
+ setResizedWidth(clamped);
201
+ onWidthChangeRef.current?.(clamped);
202
+ };
203
+
204
+ const onResizePointerDown = (event: React.PointerEvent<HTMLDivElement>) => {
205
+ if (event.button !== 0) return;
206
+ event.preventDefault();
207
+ const startX = event.clientX;
208
+ const startWidth = resizeWidth;
209
+ const onMove = (moveEvent: PointerEvent) => {
210
+ const delta = side === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX;
211
+ setResizedWidth(clampWidth(startWidth + delta));
212
+ };
213
+ const onUp = () => {
214
+ window.removeEventListener('pointermove', onMove);
215
+ window.removeEventListener('pointerup', onUp);
216
+ onWidthChangeRef.current?.(widthRef.current);
217
+ };
218
+ window.addEventListener('pointermove', onMove);
219
+ window.addEventListener('pointerup', onUp);
220
+ };
221
+
222
+ const onResizeKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
223
+ const step = event.shiftKey ? 64 : 16;
224
+ const grow = side === 'right' ? 'ArrowLeft' : 'ArrowRight';
225
+ const shrink = side === 'right' ? 'ArrowRight' : 'ArrowLeft';
226
+ if (event.key === grow) {
227
+ event.preventDefault();
228
+ commitWidth(resizeWidth + step);
229
+ } else if (event.key === shrink) {
230
+ event.preventDefault();
231
+ commitWidth(resizeWidth - step);
232
+ } else if (event.key === 'Home') {
233
+ event.preventDefault();
234
+ commitWidth(minWidth);
235
+ } else if (event.key === 'End') {
236
+ event.preventDefault();
237
+ commitWidth(maxWidth);
238
+ }
239
+ };
240
+
134
241
  // Capture the opener before the panel takes focus; restore the moment
135
242
  // open flips false — even while an exit animation keeps the DOM up.
136
243
  React.useEffect(() => {
@@ -158,7 +265,7 @@ export function Drawer({
158
265
  if (event.key === 'Escape') {
159
266
  if (!isTopLayer()) return;
160
267
  event.stopPropagation();
161
- onOpenChange(false);
268
+ requestClose();
162
269
  return;
163
270
  }
164
271
  if (event.key !== 'Tab') return;
@@ -182,12 +289,15 @@ export function Drawer({
182
289
  };
183
290
  document.addEventListener('keydown', onKeyDown);
184
291
  return () => document.removeEventListener('keydown', onKeyDown);
185
- }, [open, onOpenChange, isTopLayer]);
292
+ }, [open, requestClose, isTopLayer]);
186
293
 
187
294
  if (!present || typeof document === 'undefined') return null;
188
295
 
189
- const isVerticalSide = side === 'top' || side === 'bottom';
190
- const customExtent = isVerticalSide ? extentStyle(height) : extentStyle(width);
296
+ const customExtent = canResize
297
+ ? `${resizeWidth}px`
298
+ : isVerticalSide
299
+ ? extentStyle(height)
300
+ : extentStyle(width);
191
301
 
192
302
  const motion = animate
193
303
  ? cn(
@@ -200,7 +310,7 @@ export function Drawer({
200
310
  <div
201
311
  className="fixed inset-0 z-50"
202
312
  onMouseDown={(event) => {
203
- if (closeOnBackdrop && event.target === event.currentTarget) onOpenChange(false);
313
+ if (closeOnBackdrop && event.target === event.currentTarget) requestClose();
204
314
  }}
205
315
  >
206
316
  <div
@@ -219,6 +329,24 @@ export function Drawer({
219
329
  )}
220
330
  style={customExtent ? { [isVerticalSide ? 'height' : 'width']: customExtent } : undefined}
221
331
  >
332
+ {canResize && (
333
+ <div
334
+ role="separator"
335
+ aria-orientation="vertical"
336
+ aria-label={resizeLabel}
337
+ aria-valuenow={resizeWidth}
338
+ aria-valuemin={minWidth}
339
+ aria-valuemax={maxWidth}
340
+ tabIndex={0}
341
+ onPointerDown={onResizePointerDown}
342
+ onKeyDown={onResizeKeyDown}
343
+ className={cn(
344
+ 'absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none rounded-sm bg-transparent',
345
+ 'hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
346
+ side === 'right' ? '-left-1' : '-right-1'
347
+ )}
348
+ />
349
+ )}
222
350
  <div className="flex items-start justify-between gap-4 border-b border-border px-5 py-4">
223
351
  <div>
224
352
  <h2 id={titleId} className="text-base font-semibold leading-tight">
@@ -233,7 +361,7 @@ export function Drawer({
233
361
  {showClose && (
234
362
  <button
235
363
  type="button"
236
- onClick={() => onOpenChange(false)}
364
+ onClick={requestClose}
237
365
  aria-label={closeLabel}
238
366
  className="-me-1 rounded p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
239
367
  >
@@ -1,6 +1,7 @@
1
1
  import { render, screen } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
2
3
  import { axe } from 'jest-axe';
3
- import { describe, expect, it } from 'vitest';
4
+ import { describe, expect, it, vi } from 'vitest';
4
5
  import { EmptyState } from './EmptyState';
5
6
 
6
7
  describe('EmptyState', () => {
@@ -40,3 +41,27 @@ describe('EmptyState', () => {
40
41
  expect(await axe(container)).toHaveNoViolations();
41
42
  });
42
43
  });
44
+
45
+ describe('action object form', () => {
46
+ it('renders a button from { label, onClick }', async () => {
47
+ const user = userEvent.setup();
48
+ const onClick = vi.fn();
49
+ render(<EmptyState title="No results" action={{ label: 'Clear filters', onClick, variant: 'outline' }} />);
50
+ const button = screen.getByRole('button', { name: 'Clear filters' });
51
+ expect(button).toHaveClass('border');
52
+ await user.click(button);
53
+ expect(onClick).toHaveBeenCalledTimes(1);
54
+ });
55
+
56
+ it('renders a link when href is provided', () => {
57
+ render(<EmptyState title="No results" action={{ label: 'Create one', href: '/new' }} />);
58
+ const link = screen.getByRole('link', { name: 'Create one' });
59
+ expect(link).toHaveAttribute('href', '/new');
60
+ expect(screen.queryByRole('button', { name: 'Create one' })).not.toBeInTheDocument();
61
+ });
62
+
63
+ it('still accepts a rendered node', () => {
64
+ render(<EmptyState title="No results" action={<button type="button">Custom</button>} />);
65
+ expect(screen.getByRole('button', { name: 'Custom' })).toBeInTheDocument();
66
+ });
67
+ });
@@ -1,13 +1,23 @@
1
1
  import * as React from 'react';
2
2
  import { cn } from '../../utils/cn';
3
+ import { Button, type ButtonProps } from '../button/Button';
4
+
5
+ /** Object form of `action`: EmptyState renders the button/link for you. */
6
+ export type EmptyStateAction = {
7
+ label: React.ReactNode;
8
+ onClick?: () => void;
9
+ /** Renders an anchor (styled as a button) instead of a button. */
10
+ href?: string;
11
+ variant?: ButtonProps['variant'];
12
+ };
3
13
 
4
14
  export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
5
15
  /** Icon or illustration shown above the title. */
6
16
  icon?: React.ReactNode;
7
17
  title: string;
8
18
  description?: string;
9
- /** Primary action (button/link). */
10
- action?: React.ReactNode;
19
+ /** Primary action: a rendered node, or an action object. */
20
+ action?: React.ReactNode | EmptyStateAction;
11
21
  /** Alias for `action` for codebases that pass a list of actions. */
12
22
  actions?: React.ReactNode;
13
23
  /** Secondary action shown beside the primary one. */
@@ -18,6 +28,33 @@ export type EmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
18
28
  size?: 'sm' | 'md';
19
29
  };
20
30
 
31
+ function isActionObject(value: unknown): value is EmptyStateAction {
32
+ return (
33
+ typeof value === 'object' &&
34
+ value !== null &&
35
+ !React.isValidElement(value) &&
36
+ 'label' in value
37
+ );
38
+ }
39
+
40
+ /** Normalizes the node and object forms into a single element. */
41
+ function renderAction(action: React.ReactNode | EmptyStateAction | undefined): React.ReactNode {
42
+ if (!isActionObject(action)) return action;
43
+ const { label, onClick, href, variant } = action;
44
+ if (href) {
45
+ return (
46
+ <Button variant={variant} asChild>
47
+ <a href={href}>{label}</a>
48
+ </Button>
49
+ );
50
+ }
51
+ return (
52
+ <Button variant={variant} onClick={onClick}>
53
+ {label}
54
+ </Button>
55
+ );
56
+ }
57
+
21
58
  /**
22
59
  * Placeholder for empty collections, zero-result searches and unconfigured
23
60
  * features. Keeps the title/description/action hierarchy consistent across
@@ -39,7 +76,7 @@ export const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(func
39
76
  },
40
77
  ref
41
78
  ) {
42
- const primaryAction = action ?? actions;
79
+ const primaryAction = renderAction(action) ?? actions;
43
80
  return (
44
81
  <div
45
82
  ref={ref}
@@ -0,0 +1,94 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react';
2
+ import { renderToString } from 'react-dom/server';
3
+ import { axe } from 'jest-axe';
4
+ import { describe, expect, it } from 'vitest';
5
+ import { Image } from './Image';
6
+
7
+ describe('Image', () => {
8
+ it('renders the primary source with intrinsic dimensions and lazy loading', () => {
9
+ render(<Image src="/event.jpg" alt="Fall Classic" />);
10
+ const img = screen.getByRole('img', { name: 'Fall Classic' });
11
+ expect(img).toHaveAttribute('src', '/event.jpg');
12
+ expect(img).toHaveAttribute('width', '1200');
13
+ expect(img).toHaveAttribute('height', '630');
14
+ expect(img).toHaveAttribute('loading', 'lazy');
15
+ expect(img).toHaveAttribute('fetchpriority', 'auto');
16
+ expect(img).toHaveAttribute('decoding', 'async');
17
+ });
18
+
19
+ it('loads eagerly only when priority is set', () => {
20
+ render(<Image src="/hero.jpg" alt="Hero" priority width={1600} height={900} />);
21
+ const img = screen.getByRole('img', { name: 'Hero' });
22
+ expect(img).toHaveAttribute('loading', 'eager');
23
+ expect(img).toHaveAttribute('fetchpriority', 'high');
24
+ expect(img).toHaveAttribute('width', '1600');
25
+ expect(img).toHaveAttribute('height', '900');
26
+ });
27
+
28
+ it('falls back to fallbackSrc after the primary fails', () => {
29
+ render(
30
+ <Image src="/broken.jpg" fallbackSrc="/placeholder.svg" alt="Event" />
31
+ );
32
+ const img = screen.getByRole('img', { name: 'Event' });
33
+ fireEvent.error(img);
34
+ expect(screen.getByRole('img', { name: 'Event' })).toHaveAttribute(
35
+ 'src',
36
+ '/placeholder.svg'
37
+ );
38
+ });
39
+
40
+ it('renders the fallback node when both URLs fail', () => {
41
+ render(
42
+ <Image
43
+ src="/broken.jpg"
44
+ fallbackSrc="/also-broken.svg"
45
+ alt="Event"
46
+ fallback={<span data-testid="fallback">No image</span>}
47
+ />
48
+ );
49
+ fireEvent.error(screen.getByRole('img', { name: 'Event' }));
50
+ fireEvent.error(screen.getByRole('img', { name: 'Event' }));
51
+ expect(screen.queryByRole('img')).not.toBeInTheDocument();
52
+ expect(screen.getByTestId('fallback')).toHaveTextContent('No image');
53
+ });
54
+
55
+ it('renders the fallback node on the first error without a fallbackSrc', () => {
56
+ render(
57
+ <Image src="/broken.jpg" alt="Event" fallback={<span data-testid="fallback">No image</span>} />
58
+ );
59
+ fireEvent.error(screen.getByRole('img', { name: 'Event' }));
60
+ expect(screen.getByTestId('fallback')).toBeInTheDocument();
61
+ });
62
+
63
+ it('renders nothing when it fails without a fallback node', () => {
64
+ const { container } = render(<Image src="/broken.jpg" alt="Event" />);
65
+ fireEvent.error(screen.getByRole('img', { name: 'Event' }));
66
+ expect(container).toBeEmptyDOMElement();
67
+ });
68
+
69
+ it('keeps dimensions in server-rendered markup', () => {
70
+ const html = renderToString(<Image src="/event.jpg" alt="Event" width={640} height={360} />);
71
+ expect(html).toContain('width="640"');
72
+ expect(html).toContain('height="360"');
73
+ expect(html).toContain('alt="Event"');
74
+ });
75
+
76
+ it('merges className and imgClassName', () => {
77
+ render(
78
+ <Image
79
+ src="/event.jpg"
80
+ alt="Event"
81
+ className="rounded-md"
82
+ imgClassName="object-cover"
83
+ />
84
+ );
85
+ const img = screen.getByRole('img', { name: 'Event' });
86
+ expect(img).toHaveClass('rounded-md');
87
+ expect(img).toHaveClass('object-cover');
88
+ });
89
+
90
+ it('has no accessibility violations', async () => {
91
+ const { container } = render(<Image src="/event.jpg" alt="Fall Classic" />);
92
+ expect(await axe(container)).toHaveNoViolations();
93
+ });
94
+ });
@@ -0,0 +1,71 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { cn } from '../../utils/cn';
5
+
6
+ export type ImageProps = {
7
+ /** Primary image URL. Hotlinked sources are expected. */
8
+ src: string;
9
+ /** Required: describes the image, not the component. */
10
+ alt: string;
11
+ /** Second chance before the fallback node (e.g. generated placeholder art). */
12
+ fallbackSrc?: string;
13
+ /** Rendered when every URL has failed (icon, initials, empty panel). */
14
+ fallback?: React.ReactNode;
15
+ /** Load eagerly and fetch at high priority for the LCP image. */
16
+ priority?: boolean;
17
+ /** Intrinsic width; always emitted so the browser reserves space. */
18
+ width?: number;
19
+ /** Intrinsic height; always emitted so the browser reserves space. */
20
+ height?: number;
21
+ /** Classes for the image; merged with imgClassName. */
22
+ className?: string;
23
+ /** Classes for the image when a consumer wants to keep them separate. */
24
+ imgClassName?: string;
25
+ style?: React.CSSProperties;
26
+ };
27
+
28
+ /**
29
+ * Resilient image: `src` -> `fallbackSrc` -> `fallback` node.
30
+ *
31
+ * Organizer images are hotlinked and occasionally 403, move, or die. Cards
32
+ * must never show a broken-image box or shift layout when that happens, so
33
+ * intrinsic dimensions are always rendered and only the priority image is
34
+ * eager.
35
+ */
36
+ export function Image({
37
+ src,
38
+ alt,
39
+ fallbackSrc,
40
+ fallback,
41
+ priority = false,
42
+ width = 1200,
43
+ height = 630,
44
+ className,
45
+ imgClassName,
46
+ style,
47
+ }: ImageProps) {
48
+ const [stage, setStage] = React.useState<0 | 1 | 2>(0);
49
+
50
+ const onError = () => setStage((current) => (current === 0 && fallbackSrc ? 1 : 2));
51
+ const current = stage === 0 ? src : stage === 1 ? fallbackSrc : null;
52
+
53
+ if (!current || stage === 2) return <>{fallback ?? null}</>;
54
+
55
+ return (
56
+ <img
57
+ src={current}
58
+ alt={alt}
59
+ width={width}
60
+ height={height}
61
+ loading={priority ? 'eager' : 'lazy'}
62
+ fetchPriority={priority ? 'high' : 'auto'}
63
+ decoding="async"
64
+ className={cn(className, imgClassName)}
65
+ style={style}
66
+ onError={onError}
67
+ />
68
+ );
69
+ }
70
+
71
+ Image.displayName = 'Image';
@@ -0,0 +1 @@
1
+ export { Image, type ImageProps } from './Image';
@@ -8,7 +8,8 @@ describe('Link', () => {
8
8
  render(<Link href="/docs">Docs</Link>);
9
9
  const link = screen.getByRole('link', { name: 'Docs' });
10
10
  expect(link).toHaveAttribute('href', '/docs');
11
- expect(link).toHaveClass('text-primary');
11
+ expect(link).toHaveClass('text-primary-ink');
12
+ expect(link).not.toHaveClass('text-primary');
12
13
  });
13
14
 
14
15
  it('auto-detects external URLs and adds rel/noopener', () => {
@@ -8,11 +8,11 @@ import { cn } from '../../utils/cn';
8
8
  const linkVariants = cva('inline-flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm', {
9
9
  variants: {
10
10
  variant: {
11
- default: 'text-primary hover:underline underline-offset-4',
11
+ default: 'text-primary-ink hover:underline underline-offset-4',
12
12
  muted: 'text-muted-foreground hover:text-foreground',
13
- underline: 'underline underline-offset-4 hover:text-primary',
14
- arrow: 'font-medium text-primary hover:underline underline-offset-4',
15
- external: 'text-primary hover:underline underline-offset-4',
13
+ underline: 'underline underline-offset-4 hover:text-primary-ink',
14
+ arrow: 'font-medium text-primary-ink hover:underline underline-offset-4',
15
+ external: 'text-primary-ink hover:underline underline-offset-4',
16
16
  },
17
17
  },
18
18
  defaultVariants: { variant: 'default' },
@@ -26,3 +26,35 @@ describe('MetricCard', () => {
26
26
  expect(await axe(container)).toHaveNoViolations();
27
27
  });
28
28
  });
29
+
30
+ describe('MetricCard migration aliases', () => {
31
+ it('reads title and description when label and hint are absent', () => {
32
+ render(<MetricCard title="Revenue" value="$1" description="vs last month" />);
33
+ expect(screen.getByText('Revenue')).toBeInTheDocument();
34
+ expect(screen.getByText('vs last month')).toBeInTheDocument();
35
+ });
36
+
37
+ it('prefers label and hint when both forms are passed', () => {
38
+ render(<MetricCard label="Canonical" title="Alias" value="1" hint="Hint line" description="Alt line" />);
39
+ expect(screen.getByText('Canonical')).toBeInTheDocument();
40
+ expect(screen.queryByText('Alias')).not.toBeInTheDocument();
41
+ expect(screen.getByText('Hint line')).toBeInTheDocument();
42
+ expect(screen.queryByText('Alt line')).not.toBeInTheDocument();
43
+ });
44
+ });
45
+
46
+ describe('MetricCard tone and loading', () => {
47
+ it('colors the value by tone', () => {
48
+ const { rerender } = render(<MetricCard label="Revenue" value="$1" tone="success" />);
49
+ expect(screen.getByText('$1')).toHaveClass('text-success');
50
+ rerender(<MetricCard label="Revenue" value="$1" tone="destructive" />);
51
+ expect(screen.getByText('$1')).toHaveClass('text-destructive');
52
+ });
53
+
54
+ it('renders a skeleton with aria-busy while loading', () => {
55
+ const { container } = render(<MetricCard label="Revenue" value="$1" loading />);
56
+ expect(container.firstChild).toHaveAttribute('aria-busy', 'true');
57
+ expect(screen.queryByText('$1')).not.toBeInTheDocument();
58
+ expect(screen.getByText('Loading')).toBeInTheDocument();
59
+ });
60
+ });