@slipstream-ui/core 0.12.0 → 0.13.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 (309) hide show
  1. package/dist/index.d.mts +177 -2
  2. package/dist/index.d.ts +177 -2
  3. package/dist/index.js +262 -9
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +254 -9
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/manifests/accordion.manifest.json +1 -1
  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 +1 -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 +1 -1
  17. package/dist/manifests/block.manifest.json +1 -1
  18. package/dist/manifests/bottom-nav.manifest.json +1 -1
  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 +1 -1
  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/consent-banner.manifest.json +1 -1
  28. package/dist/manifests/contact-strip.manifest.json +1 -1
  29. package/dist/manifests/container.manifest.json +1 -1
  30. package/dist/manifests/cover-image.manifest.json +1 -1
  31. package/dist/manifests/cta-section.manifest.json +1 -1
  32. package/dist/manifests/data-table.manifest.json +1 -1
  33. package/dist/manifests/date-picker-popover.manifest.json +1 -1
  34. package/dist/manifests/date-picker.manifest.json +1 -1
  35. package/dist/manifests/date-range-picker.manifest.json +1 -1
  36. package/dist/manifests/deal-card.manifest.json +1 -1
  37. package/dist/manifests/dialog.manifest.json +1 -1
  38. package/dist/manifests/document-card.manifest.json +1 -1
  39. package/dist/manifests/drawer.manifest.json +1 -1
  40. package/dist/manifests/empty-state.manifest.json +1 -1
  41. package/dist/manifests/entity-card.manifest.json +1 -1
  42. package/dist/manifests/feature-grid.manifest.json +1 -1
  43. package/dist/manifests/feature-row.manifest.json +1 -1
  44. package/dist/manifests/fieldset.manifest.json +1 -1
  45. package/dist/manifests/figure.manifest.json +105 -0
  46. package/dist/manifests/file-upload.manifest.json +1 -1
  47. package/dist/manifests/filter-bar.manifest.json +1 -1
  48. package/dist/manifests/filter-chips.manifest.json +1 -1
  49. package/dist/manifests/filter-panel.manifest.json +1 -1
  50. package/dist/manifests/flex.manifest.json +1 -1
  51. package/dist/manifests/form-field.manifest.json +1 -1
  52. package/dist/manifests/form-layout.manifest.json +1 -1
  53. package/dist/manifests/form.manifest.json +1 -1
  54. package/dist/manifests/grid.manifest.json +1 -1
  55. package/dist/manifests/heading.manifest.json +1 -1
  56. package/dist/manifests/hero.manifest.json +1 -1
  57. package/dist/manifests/icon-button.manifest.json +101 -0
  58. package/dist/manifests/icon-tile.manifest.json +107 -0
  59. package/dist/manifests/icon.manifest.json +119 -0
  60. package/dist/manifests/image.manifest.json +1 -1
  61. package/dist/manifests/input-group.manifest.json +1 -1
  62. package/dist/manifests/input.manifest.json +1 -1
  63. package/dist/manifests/label.manifest.json +1 -1
  64. package/dist/manifests/link-tabs.manifest.json +1 -1
  65. package/dist/manifests/link.manifest.json +1 -1
  66. package/dist/manifests/list-toolbar.manifest.json +1 -1
  67. package/dist/manifests/list.manifest.json +1 -1
  68. package/dist/manifests/load-more.manifest.json +1 -1
  69. package/dist/manifests/logo-cloud.manifest.json +1 -1
  70. package/dist/manifests/media-card.manifest.json +1 -1
  71. package/dist/manifests/media.manifest.json +142 -0
  72. package/dist/manifests/menu.manifest.json +1 -1
  73. package/dist/manifests/metric-card.manifest.json +1 -1
  74. package/dist/manifests/month-schedule.manifest.json +1 -1
  75. package/dist/manifests/multi-select.manifest.json +1 -1
  76. package/dist/manifests/newsletter.manifest.json +1 -1
  77. package/dist/manifests/page-header.manifest.json +1 -1
  78. package/dist/manifests/pagination.manifest.json +1 -1
  79. package/dist/manifests/password-input.manifest.json +1 -1
  80. package/dist/manifests/popover.manifest.json +1 -1
  81. package/dist/manifests/process-steps.manifest.json +1 -1
  82. package/dist/manifests/progress.manifest.json +1 -1
  83. package/dist/manifests/prose.manifest.json +1 -1
  84. package/dist/manifests/radio.manifest.json +1 -1
  85. package/dist/manifests/range-slider.manifest.json +1 -1
  86. package/dist/manifests/search.manifest.json +1 -1
  87. package/dist/manifests/section-heading.manifest.json +1 -1
  88. package/dist/manifests/section.manifest.json +1 -1
  89. package/dist/manifests/segmented-control.manifest.json +1 -1
  90. package/dist/manifests/select-menu.manifest.json +1 -1
  91. package/dist/manifests/select.manifest.json +1 -1
  92. package/dist/manifests/separator.manifest.json +1 -1
  93. package/dist/manifests/site-footer.manifest.json +1 -1
  94. package/dist/manifests/site-header.manifest.json +1 -1
  95. package/dist/manifests/skeleton.manifest.json +1 -1
  96. package/dist/manifests/social-links.manifest.json +120 -0
  97. package/dist/manifests/spinner.manifest.json +1 -1
  98. package/dist/manifests/stat-band.manifest.json +1 -1
  99. package/dist/manifests/stepper.manifest.json +1 -1
  100. package/dist/manifests/switch.manifest.json +1 -1
  101. package/dist/manifests/table-card.manifest.json +1 -1
  102. package/dist/manifests/table-of-contents.manifest.json +1 -1
  103. package/dist/manifests/table.manifest.json +1 -1
  104. package/dist/manifests/tabs.manifest.json +1 -1
  105. package/dist/manifests/testimonial.manifest.json +1 -1
  106. package/dist/manifests/text.manifest.json +1 -1
  107. package/dist/manifests/textarea.manifest.json +1 -1
  108. package/dist/manifests/theme-toggle.manifest.json +1 -1
  109. package/dist/manifests/time-picker.manifest.json +1 -1
  110. package/dist/manifests/timeline.manifest.json +1 -1
  111. package/dist/manifests/toast.manifest.json +1 -1
  112. package/dist/manifests/tombstone-card.manifest.json +1 -1
  113. package/dist/manifests/tooltip.manifest.json +1 -1
  114. package/dist/src/components/figure/Figure.d.ts +23 -0
  115. package/dist/src/components/figure/Figure.js +60 -0
  116. package/dist/src/components/figure/Figure.js.map +1 -0
  117. package/dist/src/components/figure/Figure.mjs +26 -0
  118. package/dist/src/components/figure/Figure.mjs.map +1 -0
  119. package/dist/src/components/figure/index.d.ts +2 -0
  120. package/dist/src/components/figure/index.js +29 -0
  121. package/dist/src/components/figure/index.js.map +1 -0
  122. package/dist/src/components/figure/index.mjs +5 -0
  123. package/dist/src/components/figure/index.mjs.map +1 -0
  124. package/dist/src/components/icon/Icon.d.ts +33 -0
  125. package/dist/src/components/icon/Icon.js +82 -0
  126. package/dist/src/components/icon/Icon.js.map +1 -0
  127. package/dist/src/components/icon/Icon.mjs +47 -0
  128. package/dist/src/components/icon/Icon.mjs.map +1 -0
  129. package/dist/src/components/icon/index.d.ts +2 -0
  130. package/dist/src/components/icon/index.js +31 -0
  131. package/dist/src/components/icon/index.js.map +1 -0
  132. package/dist/src/components/icon/index.mjs +6 -0
  133. package/dist/src/components/icon/index.mjs.map +1 -0
  134. package/dist/src/components/icon-button/IconButton.d.ts +25 -0
  135. package/dist/src/components/icon-button/IconButton.js +60 -0
  136. package/dist/src/components/icon-button/IconButton.js.map +1 -0
  137. package/dist/src/components/icon-button/IconButton.mjs +26 -0
  138. package/dist/src/components/icon-button/IconButton.mjs.map +1 -0
  139. package/dist/src/components/icon-button/index.d.ts +2 -0
  140. package/dist/src/components/icon-button/index.js +29 -0
  141. package/dist/src/components/icon-button/index.js.map +1 -0
  142. package/dist/src/components/icon-button/index.mjs +5 -0
  143. package/dist/src/components/icon-button/index.mjs.map +1 -0
  144. package/dist/src/components/icon-tile/IconTile.d.ts +23 -0
  145. package/dist/src/components/icon-tile/IconTile.js +75 -0
  146. package/dist/src/components/icon-tile/IconTile.js.map +1 -0
  147. package/dist/src/components/icon-tile/IconTile.mjs +40 -0
  148. package/dist/src/components/icon-tile/IconTile.mjs.map +1 -0
  149. package/dist/src/components/icon-tile/index.d.ts +2 -0
  150. package/dist/src/components/icon-tile/index.js +31 -0
  151. package/dist/src/components/icon-tile/index.js.map +1 -0
  152. package/dist/src/components/icon-tile/index.mjs +6 -0
  153. package/dist/src/components/icon-tile/index.mjs.map +1 -0
  154. package/dist/src/components/media/Media.d.ts +48 -0
  155. package/dist/src/components/media/Media.js +97 -0
  156. package/dist/src/components/media/Media.js.map +1 -0
  157. package/dist/src/components/media/Media.mjs +63 -0
  158. package/dist/src/components/media/Media.mjs.map +1 -0
  159. package/dist/src/components/media/index.d.ts +2 -0
  160. package/dist/src/components/media/index.js +29 -0
  161. package/dist/src/components/media/index.js.map +1 -0
  162. package/dist/src/components/media/index.mjs +5 -0
  163. package/dist/src/components/media/index.mjs.map +1 -0
  164. package/dist/src/components/site-header/SiteHeader.js +33 -9
  165. package/dist/src/components/site-header/SiteHeader.js.map +1 -1
  166. package/dist/src/components/site-header/SiteHeader.mjs +33 -9
  167. package/dist/src/components/site-header/SiteHeader.mjs.map +1 -1
  168. package/dist/src/components/social-links/SocialLinks.d.ts +34 -0
  169. package/dist/src/components/social-links/SocialLinks.js +69 -0
  170. package/dist/src/components/social-links/SocialLinks.js.map +1 -0
  171. package/dist/src/components/social-links/SocialLinks.mjs +35 -0
  172. package/dist/src/components/social-links/SocialLinks.mjs.map +1 -0
  173. package/dist/src/components/social-links/index.d.ts +2 -0
  174. package/dist/src/components/social-links/index.js +29 -0
  175. package/dist/src/components/social-links/index.js.map +1 -0
  176. package/dist/src/components/social-links/index.mjs +5 -0
  177. package/dist/src/components/social-links/index.mjs.map +1 -0
  178. package/dist/src/index.d.ts +6 -0
  179. package/dist/styles-full.css +1 -1
  180. package/dist/styles.css +1 -1
  181. package/package.json +2 -2
  182. package/src/components/figure/Figure.test.tsx +54 -0
  183. package/src/components/figure/Figure.tsx +38 -0
  184. package/src/components/figure/index.ts +2 -0
  185. package/src/components/icon/Icon.test.tsx +70 -0
  186. package/src/components/icon/Icon.tsx +61 -0
  187. package/src/components/icon/index.ts +2 -0
  188. package/src/components/icon-button/IconButton.test.tsx +76 -0
  189. package/src/components/icon-button/IconButton.tsx +38 -0
  190. package/src/components/icon-button/index.ts +2 -0
  191. package/src/components/icon-tile/IconTile.test.tsx +63 -0
  192. package/src/components/icon-tile/IconTile.tsx +55 -0
  193. package/src/components/icon-tile/index.ts +2 -0
  194. package/src/components/media/Media.test.tsx +53 -0
  195. package/src/components/media/Media.tsx +92 -0
  196. package/src/components/media/index.ts +2 -0
  197. package/src/components/site-header/SiteHeader.test.tsx +27 -0
  198. package/src/components/site-header/SiteHeader.tsx +60 -21
  199. package/src/components/social-links/SocialLinks.test.tsx +59 -0
  200. package/src/components/social-links/SocialLinks.tsx +73 -0
  201. package/src/components/social-links/index.ts +2 -0
  202. package/src/index.ts +6 -0
  203. package/src/manifests/accordion.manifest.json +1 -1
  204. package/src/manifests/alert.manifest.json +1 -1
  205. package/src/manifests/announcement-bar.manifest.json +1 -1
  206. package/src/manifests/app-shell.manifest.json +1 -1
  207. package/src/manifests/applied-filters.manifest.json +1 -1
  208. package/src/manifests/article-card.manifest.json +1 -1
  209. package/src/manifests/auth-layout.manifest.json +1 -1
  210. package/src/manifests/autocomplete.manifest.json +1 -1
  211. package/src/manifests/avatar.manifest.json +1 -1
  212. package/src/manifests/badge.manifest.json +1 -1
  213. package/src/manifests/block.manifest.json +1 -1
  214. package/src/manifests/bottom-nav.manifest.json +1 -1
  215. package/src/manifests/breadcrumb.manifest.json +1 -1
  216. package/src/manifests/button-group.manifest.json +1 -1
  217. package/src/manifests/button.manifest.json +1 -1
  218. package/src/manifests/calendar.manifest.json +1 -1
  219. package/src/manifests/card.manifest.json +1 -1
  220. package/src/manifests/checkbox.manifest.json +1 -1
  221. package/src/manifests/comparison-table.manifest.json +1 -1
  222. package/src/manifests/confirm-dialog.manifest.json +1 -1
  223. package/src/manifests/consent-banner.manifest.json +1 -1
  224. package/src/manifests/contact-strip.manifest.json +1 -1
  225. package/src/manifests/container.manifest.json +1 -1
  226. package/src/manifests/cover-image.manifest.json +1 -1
  227. package/src/manifests/cta-section.manifest.json +1 -1
  228. package/src/manifests/data-table.manifest.json +1 -1
  229. package/src/manifests/date-picker-popover.manifest.json +1 -1
  230. package/src/manifests/date-picker.manifest.json +1 -1
  231. package/src/manifests/date-range-picker.manifest.json +1 -1
  232. package/src/manifests/deal-card.manifest.json +1 -1
  233. package/src/manifests/dialog.manifest.json +1 -1
  234. package/src/manifests/document-card.manifest.json +1 -1
  235. package/src/manifests/drawer.manifest.json +1 -1
  236. package/src/manifests/empty-state.manifest.json +1 -1
  237. package/src/manifests/entity-card.manifest.json +1 -1
  238. package/src/manifests/feature-grid.manifest.json +1 -1
  239. package/src/manifests/feature-row.manifest.json +1 -1
  240. package/src/manifests/fieldset.manifest.json +1 -1
  241. package/src/manifests/figure.manifest.json +105 -0
  242. package/src/manifests/file-upload.manifest.json +1 -1
  243. package/src/manifests/filter-bar.manifest.json +1 -1
  244. package/src/manifests/filter-chips.manifest.json +1 -1
  245. package/src/manifests/filter-panel.manifest.json +1 -1
  246. package/src/manifests/flex.manifest.json +1 -1
  247. package/src/manifests/form-field.manifest.json +1 -1
  248. package/src/manifests/form-layout.manifest.json +1 -1
  249. package/src/manifests/form.manifest.json +1 -1
  250. package/src/manifests/grid.manifest.json +1 -1
  251. package/src/manifests/heading.manifest.json +1 -1
  252. package/src/manifests/hero.manifest.json +1 -1
  253. package/src/manifests/icon-button.manifest.json +101 -0
  254. package/src/manifests/icon-tile.manifest.json +107 -0
  255. package/src/manifests/icon.manifest.json +119 -0
  256. package/src/manifests/image.manifest.json +1 -1
  257. package/src/manifests/input-group.manifest.json +1 -1
  258. package/src/manifests/input.manifest.json +1 -1
  259. package/src/manifests/label.manifest.json +1 -1
  260. package/src/manifests/link-tabs.manifest.json +1 -1
  261. package/src/manifests/link.manifest.json +1 -1
  262. package/src/manifests/list-toolbar.manifest.json +1 -1
  263. package/src/manifests/list.manifest.json +1 -1
  264. package/src/manifests/load-more.manifest.json +1 -1
  265. package/src/manifests/logo-cloud.manifest.json +1 -1
  266. package/src/manifests/media-card.manifest.json +1 -1
  267. package/src/manifests/media.manifest.json +142 -0
  268. package/src/manifests/menu.manifest.json +1 -1
  269. package/src/manifests/metric-card.manifest.json +1 -1
  270. package/src/manifests/month-schedule.manifest.json +1 -1
  271. package/src/manifests/multi-select.manifest.json +1 -1
  272. package/src/manifests/newsletter.manifest.json +1 -1
  273. package/src/manifests/page-header.manifest.json +1 -1
  274. package/src/manifests/pagination.manifest.json +1 -1
  275. package/src/manifests/password-input.manifest.json +1 -1
  276. package/src/manifests/popover.manifest.json +1 -1
  277. package/src/manifests/process-steps.manifest.json +1 -1
  278. package/src/manifests/progress.manifest.json +1 -1
  279. package/src/manifests/prose.manifest.json +1 -1
  280. package/src/manifests/radio.manifest.json +1 -1
  281. package/src/manifests/range-slider.manifest.json +1 -1
  282. package/src/manifests/search.manifest.json +1 -1
  283. package/src/manifests/section-heading.manifest.json +1 -1
  284. package/src/manifests/section.manifest.json +1 -1
  285. package/src/manifests/segmented-control.manifest.json +1 -1
  286. package/src/manifests/select-menu.manifest.json +1 -1
  287. package/src/manifests/select.manifest.json +1 -1
  288. package/src/manifests/separator.manifest.json +1 -1
  289. package/src/manifests/site-footer.manifest.json +1 -1
  290. package/src/manifests/site-header.manifest.json +1 -1
  291. package/src/manifests/skeleton.manifest.json +1 -1
  292. package/src/manifests/social-links.manifest.json +120 -0
  293. package/src/manifests/spinner.manifest.json +1 -1
  294. package/src/manifests/stat-band.manifest.json +1 -1
  295. package/src/manifests/stepper.manifest.json +1 -1
  296. package/src/manifests/switch.manifest.json +1 -1
  297. package/src/manifests/table-card.manifest.json +1 -1
  298. package/src/manifests/table-of-contents.manifest.json +1 -1
  299. package/src/manifests/table.manifest.json +1 -1
  300. package/src/manifests/tabs.manifest.json +1 -1
  301. package/src/manifests/testimonial.manifest.json +1 -1
  302. package/src/manifests/text.manifest.json +1 -1
  303. package/src/manifests/textarea.manifest.json +1 -1
  304. package/src/manifests/theme-toggle.manifest.json +1 -1
  305. package/src/manifests/time-picker.manifest.json +1 -1
  306. package/src/manifests/timeline.manifest.json +1 -1
  307. package/src/manifests/toast.manifest.json +1 -1
  308. package/src/manifests/tombstone-card.manifest.json +1 -1
  309. package/src/manifests/tooltip.manifest.json +1 -1
@@ -218,6 +218,34 @@ export function SiteHeader({
218
218
  const hasColumns = (item: SiteNavItem): item is SiteNavItem & { columns: SiteNavColumn[] } =>
219
219
  Array.isArray(item.columns) && item.columns.length > 0;
220
220
 
221
+ /*
222
+ * Panels are wider than their triggers, so a fixed left-0 anchor pushes
223
+ * edge menus off-screen. On open we measure the panel and clamp its left
224
+ * edge into the viewport; the inline style wins over the left-0 class.
225
+ * Layout effect keeps the correction ahead of paint.
226
+ */
227
+ const alignPanel = React.useCallback((panel: HTMLElement) => {
228
+ const item = panel.parentElement;
229
+ if (!item) return;
230
+ const itemRect = item.getBoundingClientRect();
231
+ const width = panel.offsetWidth;
232
+ const gutter = 8;
233
+ const centered = itemRect.left + itemRect.width / 2 - width / 2;
234
+ const left = Math.max(gutter, Math.min(centered, window.innerWidth - gutter - width));
235
+ panel.style.left = `${left - itemRect.left}px`;
236
+ panel.style.right = 'auto';
237
+ }, []);
238
+
239
+ const useIsoLayoutEffect =
240
+ typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
241
+
242
+ useIsoLayoutEffect(() => {
243
+ if (!openMenu) return;
244
+ const panelId = `${generatedId}-panel-${openMenu.replace(/\s+/g, '-').toLowerCase()}`;
245
+ const panel = document.getElementById(panelId);
246
+ if (panel) alignPanel(panel);
247
+ }, [openMenu, generatedId, alignPanel]);
248
+
221
249
  return (
222
250
  <>
223
251
  <header
@@ -302,31 +330,42 @@ export function SiteHeader({
302
330
  {item.label}
303
331
  <Caret />
304
332
  </button>
333
+ {/*
334
+ * The pt-2 bridge keeps the pointer inside the <li> while
335
+ * it travels from the trigger into the panel - a margin
336
+ * gap would fire onMouseLeave and slam the menu shut.
337
+ */}
305
338
  <div
306
339
  id={panelId}
307
340
  hidden={!open}
308
- className={cn(
309
- 'absolute left-0 top-full z-50 mt-2 grid gap-6 rounded-lg border border-border bg-popover p-5 shadow-lg',
310
- item.columns.length > 1 ? 'grid-cols-2' : 'grid-cols-1',
311
- 'min-w-[22rem]'
312
- )}
341
+ className="absolute left-0 top-full z-50 pt-2"
313
342
  >
314
- {item.columns.map((column, index) => (
315
- <div key={column.heading ?? index} className="min-w-40">
316
- {column.heading && (
317
- <p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
318
- {column.heading}
319
- </p>
320
- )}
321
- <ul className="flex flex-col gap-0.5">
322
- {column.items.map((link) => (
323
- <li key={`${column.heading ?? index}-${link.href}-${link.label}`}>
324
- {navLink(link, 'panel')}
325
- </li>
326
- ))}
327
- </ul>
328
- </div>
329
- ))}
343
+ <div
344
+ className={cn(
345
+ 'grid gap-6 rounded-lg border border-border bg-popover p-5 shadow-lg',
346
+ item.columns.length > 1 ? 'grid-cols-2' : 'grid-cols-1',
347
+ item.columns.length > 1
348
+ ? 'w-[38rem] max-w-[calc(100vw-2rem)]'
349
+ : 'w-[22rem] max-w-[calc(100vw-2rem)]'
350
+ )}
351
+ >
352
+ {item.columns.map((column, index) => (
353
+ <div key={column.heading ?? index} className="min-w-40">
354
+ {column.heading && (
355
+ <p className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
356
+ {column.heading}
357
+ </p>
358
+ )}
359
+ <ul className="flex flex-col gap-0.5">
360
+ {column.items.map((link) => (
361
+ <li key={`${column.heading ?? index}-${link.href}-${link.label}`}>
362
+ {navLink(link, 'panel')}
363
+ </li>
364
+ ))}
365
+ </ul>
366
+ </div>
367
+ ))}
368
+ </div>
330
369
  </div>
331
370
  </li>
332
371
  );
@@ -0,0 +1,59 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { axe } from 'jest-axe';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { SocialLinks } from './SocialLinks';
5
+
6
+ const GithubIcon = (props: React.SVGProps<SVGSVGElement>) => (
7
+ <svg data-testid="github-icon" viewBox="0 0 24 24" {...props} />
8
+ );
9
+
10
+ describe('SocialLinks', () => {
11
+ it('renders a labelled navigation landmark', () => {
12
+ render(<SocialLinks links={[{ href: 'https://github.com/acme', label: 'GitHub' }]} />);
13
+ expect(screen.getByRole('navigation', { name: 'Social links' })).toBeInTheDocument();
14
+ });
15
+
16
+ it('names each destination and applies safe external attributes', () => {
17
+ render(
18
+ <SocialLinks
19
+ links={[
20
+ { href: 'https://github.com/acme', label: 'GitHub', icon: GithubIcon },
21
+ { href: 'https://x.com/acme', label: 'X profile' },
22
+ ]}
23
+ />
24
+ );
25
+ const github = screen.getByRole('link', { name: 'GitHub' });
26
+ expect(github).toHaveAttribute('href', 'https://github.com/acme');
27
+ expect(github).toHaveAttribute('target', '_blank');
28
+ expect(github).toHaveAttribute('rel', expect.stringContaining('noopener'));
29
+ expect(screen.getByRole('link', { name: 'X profile' })).toHaveTextContent('X profile');
30
+ });
31
+
32
+ it('renders icon components through Icon sizing', () => {
33
+ render(
34
+ <SocialLinks iconSize="lg" iconTone="primary" links={[{ href: 'https://a.dev', label: 'A', icon: GithubIcon }]} />
35
+ );
36
+ expect(screen.getByTestId('github-icon')).toBeInTheDocument();
37
+ expect(screen.getByRole('link', { name: 'A' }).querySelector('span')).toHaveClass('text-primary-ink');
38
+ });
39
+
40
+ it('accepts a custom landmark label', () => {
41
+ render(
42
+ <SocialLinks label="Follow the studio" links={[{ href: 'https://a.dev', label: 'Site' }]} />
43
+ );
44
+ expect(screen.getByRole('navigation', { name: 'Follow the studio' })).toBeInTheDocument();
45
+ });
46
+
47
+ it('has no accessibility violations', async () => {
48
+ const { container } = render(
49
+ <SocialLinks
50
+ label="Studio socials"
51
+ links={[
52
+ { href: 'https://github.com/acme', label: 'GitHub', icon: GithubIcon },
53
+ { href: 'https://x.com/acme', label: 'X' },
54
+ ]}
55
+ />
56
+ );
57
+ expect(await axe(container)).toHaveNoViolations();
58
+ });
59
+ });
@@ -0,0 +1,73 @@
1
+ import * as React from 'react';
2
+ import { cn } from '../../utils/cn';
3
+ import { Icon, type IconProps } from '../icon/Icon';
4
+
5
+ export type SocialLink = {
6
+ /** Destination URL. Rendered with safe external-link attributes. */
7
+ href: string;
8
+ /** Accessible name for the destination (e.g. "GitHub"). */
9
+ label: string;
10
+ /** Optional icon element or component rendered inside the link. */
11
+ icon?: React.ReactElement | React.ComponentType<React.SVGProps<SVGSVGElement>>;
12
+ };
13
+
14
+ export type SocialLinksProps = React.HTMLAttributes<HTMLElement> & {
15
+ links: SocialLink[];
16
+ /** Accessible name for the navigation landmark (default "Social links"). */
17
+ label?: string;
18
+ /** Icon size passed through to Icon (default 'md'). */
19
+ iconSize?: IconProps['size'];
20
+ /** Icon tone (default 'muted'). */
21
+ iconTone?: IconProps['tone'];
22
+ };
23
+
24
+ function isElement(icon: SocialLink['icon']): icon is React.ReactElement {
25
+ return React.isValidElement(icon);
26
+ }
27
+
28
+ /**
29
+ * Row of outbound social/profile links. Every destination is named via
30
+ * `aria-label`, external links get `target="_blank" rel="noopener noreferrer"`,
31
+ * and icon-only links stay accessible because the label is always applied.
32
+ */
33
+ const SocialLinks = React.forwardRef<HTMLElement, SocialLinksProps>(
34
+ ({ className, links, label = 'Social links', iconSize = 'md', iconTone = 'muted', ...props }, ref) => (
35
+ <nav ref={ref} aria-label={label} className={cn('flex items-center gap-1', className)} {...props}>
36
+ <ul className="flex items-center gap-1">
37
+ {links.map((link) => (
38
+ <li key={link.href}>
39
+ <a
40
+ href={link.href}
41
+ target="_blank"
42
+ rel="noopener noreferrer"
43
+ aria-label={link.icon ? link.label : undefined}
44
+ className={cn(
45
+ 'inline-flex items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
46
+ link.icon ? 'h-9 w-9' : 'px-3 py-1.5 text-sm'
47
+ )}
48
+ >
49
+ {link.icon ? (
50
+ isElement(link.icon) ? (
51
+ <Icon size={iconSize} tone={iconTone}>
52
+ {link.icon}
53
+ </Icon>
54
+ ) : (
55
+ <Icon
56
+ size={iconSize}
57
+ tone={iconTone}
58
+ icon={link.icon as React.ComponentType<React.SVGProps<SVGSVGElement>>}
59
+ />
60
+ )
61
+ ) : (
62
+ link.label
63
+ )}
64
+ </a>
65
+ </li>
66
+ ))}
67
+ </ul>
68
+ </nav>
69
+ )
70
+ );
71
+ SocialLinks.displayName = 'SocialLinks';
72
+
73
+ export { SocialLinks };
@@ -0,0 +1,2 @@
1
+ export { SocialLinks } from './SocialLinks';
2
+ export type { SocialLinksProps, SocialLink } from './SocialLinks';
package/src/index.ts CHANGED
@@ -105,3 +105,9 @@ export * from './components/alert';
105
105
  export * from './components/popover';
106
106
  export * from './components/breadcrumb';
107
107
  export * from './components/pagination';
108
+ export * from './components/icon';
109
+ export * from './components/icon-button';
110
+ export * from './components/icon-tile';
111
+ export * from './components/social-links';
112
+ export * from './components/figure';
113
+ export * from './components/media';
@@ -138,7 +138,7 @@
138
138
  ],
139
139
  "package": "@slipstream-ui/core",
140
140
  "importPath": "@slipstream-ui/core",
141
- "version": "0.12.0",
141
+ "version": "0.13.0",
142
142
  "sourceDir": "accordion",
143
143
  "exportName": "Accordion"
144
144
  }
@@ -91,7 +91,7 @@
91
91
  ],
92
92
  "package": "@slipstream-ui/core",
93
93
  "importPath": "@slipstream-ui/core",
94
- "version": "0.12.0",
94
+ "version": "0.13.0",
95
95
  "sourceDir": "alert",
96
96
  "exportName": "Alert"
97
97
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "announcement-bar",
9
9
  "exportName": "AnnouncementBar",
10
10
  "description": "Dismissible announcement bar with optional action, tone and sticky positioning.",
@@ -225,7 +225,7 @@
225
225
  ],
226
226
  "package": "@slipstream-ui/core",
227
227
  "importPath": "@slipstream-ui/core",
228
- "version": "0.12.0",
228
+ "version": "0.13.0",
229
229
  "sourceDir": "app-shell",
230
230
  "exportName": "AppShell"
231
231
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "applied-filters",
9
9
  "exportName": "AppliedFilters",
10
10
  "description": "Applied-filter summary with a live count, removable chips and an edit action.",
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "article-card",
9
9
  "exportName": "ArticleCard",
10
10
  "description": "Linked article or resource card with media, eyebrow, title, summary and metadata.",
@@ -124,7 +124,7 @@
124
124
  ],
125
125
  "package": "@slipstream-ui/core",
126
126
  "importPath": "@slipstream-ui/core",
127
- "version": "0.12.0",
127
+ "version": "0.13.0",
128
128
  "sourceDir": "auth-layout",
129
129
  "exportName": "AuthLayout"
130
130
  }
@@ -194,7 +194,7 @@
194
194
  ],
195
195
  "package": "@slipstream-ui/core",
196
196
  "importPath": "@slipstream-ui/core",
197
- "version": "0.12.0",
197
+ "version": "0.13.0",
198
198
  "sourceDir": "autocomplete",
199
199
  "exportName": "Autocomplete"
200
200
  }
@@ -152,7 +152,7 @@
152
152
  ],
153
153
  "package": "@slipstream-ui/core",
154
154
  "importPath": "@slipstream-ui/core",
155
- "version": "0.12.0",
155
+ "version": "0.13.0",
156
156
  "sourceDir": "avatar",
157
157
  "exportName": "Avatar"
158
158
  }
@@ -217,7 +217,7 @@
217
217
  ],
218
218
  "package": "@slipstream-ui/core",
219
219
  "importPath": "@slipstream-ui/core",
220
- "version": "0.12.0",
220
+ "version": "0.13.0",
221
221
  "sourceDir": "badge",
222
222
  "exportName": "Badge"
223
223
  }
@@ -101,7 +101,7 @@
101
101
  ],
102
102
  "package": "@slipstream-ui/core",
103
103
  "importPath": "@slipstream-ui/core",
104
- "version": "0.12.0",
104
+ "version": "0.13.0",
105
105
  "sourceDir": "block",
106
106
  "exportName": "Block"
107
107
  }
@@ -124,7 +124,7 @@
124
124
  ],
125
125
  "package": "@slipstream-ui/core",
126
126
  "importPath": "@slipstream-ui/core",
127
- "version": "0.12.0",
127
+ "version": "0.13.0",
128
128
  "sourceDir": "bottom-nav",
129
129
  "exportName": "BottomNav"
130
130
  }
@@ -129,7 +129,7 @@
129
129
  ],
130
130
  "package": "@slipstream-ui/core",
131
131
  "importPath": "@slipstream-ui/core",
132
- "version": "0.12.0",
132
+ "version": "0.13.0",
133
133
  "sourceDir": "breadcrumb",
134
134
  "exportName": "Breadcrumb"
135
135
  }
@@ -105,7 +105,7 @@
105
105
  ],
106
106
  "package": "@slipstream-ui/core",
107
107
  "importPath": "@slipstream-ui/core",
108
- "version": "0.12.0",
108
+ "version": "0.13.0",
109
109
  "sourceDir": "button-group",
110
110
  "exportName": "ButtonGroup"
111
111
  }
@@ -255,7 +255,7 @@
255
255
  ],
256
256
  "package": "@slipstream-ui/core",
257
257
  "importPath": "@slipstream-ui/core",
258
- "version": "0.12.0",
258
+ "version": "0.13.0",
259
259
  "sourceDir": "button",
260
260
  "exportName": "Button"
261
261
  }
@@ -169,7 +169,7 @@
169
169
  ],
170
170
  "package": "@slipstream-ui/core",
171
171
  "importPath": "@slipstream-ui/core",
172
- "version": "0.12.0",
172
+ "version": "0.13.0",
173
173
  "sourceDir": "calendar",
174
174
  "exportName": "Calendar"
175
175
  }
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "package": "@slipstream-ui/core",
88
88
  "importPath": "@slipstream-ui/core",
89
- "version": "0.12.0",
89
+ "version": "0.13.0",
90
90
  "sourceDir": "card",
91
91
  "exportName": "Card"
92
92
  }
@@ -160,7 +160,7 @@
160
160
  ],
161
161
  "package": "@slipstream-ui/core",
162
162
  "importPath": "@slipstream-ui/core",
163
- "version": "0.12.0",
163
+ "version": "0.13.0",
164
164
  "sourceDir": "checkbox",
165
165
  "exportName": "Checkbox"
166
166
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "comparison-table",
9
9
  "exportName": "ComparisonTable",
10
10
  "description": "Marketing comparison table with check/dash boolean cells, a highlighted column and responsive overflow.",
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "confirm-dialog",
9
9
  "exportName": "ConfirmDialog",
10
10
  "description": "Accessible confirmation dialog with async pending state, destructive variant and cancellable actions, built on Dialog.",
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "consent-banner",
9
9
  "exportName": "ConsentBanner",
10
10
  "description": "Styled cookie/consent banner: fixed bottom bar with accept, decline and an optional manage-preferences action. Pair it with the headless useConsent hook so the decision persists per-purpose in localStorage.",
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "contact-strip",
9
9
  "exportName": "ContactStrip",
10
10
  "description": "Compact labelled contact rows with optional icons and links.",
@@ -4,7 +4,7 @@
4
4
  "tier": "atom",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "container",
9
9
  "exportName": "Container",
10
10
  "description": "Centered, width-constrained page container with shared gutters and four width presets.",
@@ -145,7 +145,7 @@
145
145
  ],
146
146
  "package": "@slipstream-ui/core",
147
147
  "importPath": "@slipstream-ui/core",
148
- "version": "0.12.0",
148
+ "version": "0.13.0",
149
149
  "sourceDir": "cover-image",
150
150
  "exportName": "CoverImage"
151
151
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "organism",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "cta-section",
9
9
  "exportName": "CTASection",
10
10
  "description": "Full-width conversion band with eyebrow, headline, supporting copy and actions.",
@@ -343,7 +343,7 @@
343
343
  ],
344
344
  "package": "@slipstream-ui/core",
345
345
  "importPath": "@slipstream-ui/core",
346
- "version": "0.12.0",
346
+ "version": "0.13.0",
347
347
  "sourceDir": "data-table",
348
348
  "exportName": "DataTable"
349
349
  }
@@ -196,7 +196,7 @@
196
196
  ],
197
197
  "package": "@slipstream-ui/core",
198
198
  "importPath": "@slipstream-ui/core",
199
- "version": "0.12.0",
199
+ "version": "0.13.0",
200
200
  "sourceDir": "date-picker-popover",
201
201
  "exportName": "DatePickerPopover"
202
202
  }
@@ -88,7 +88,7 @@
88
88
  ],
89
89
  "package": "@slipstream-ui/core",
90
90
  "importPath": "@slipstream-ui/core",
91
- "version": "0.12.0",
91
+ "version": "0.13.0",
92
92
  "sourceDir": "date-picker",
93
93
  "exportName": "DatePicker"
94
94
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "date-range-picker",
9
9
  "exportName": "DateRangePicker",
10
10
  "description": "Start/end date range with ISO strings and quick presets.",
@@ -4,7 +4,7 @@
4
4
  "tier": "organism",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "deal-card",
9
9
  "exportName": "DealCard",
10
10
  "description": "Deal opportunity card with sector, status, metrics, NDA/CIM badges and access actions.",
@@ -163,7 +163,7 @@
163
163
  ],
164
164
  "package": "@slipstream-ui/core",
165
165
  "importPath": "@slipstream-ui/core",
166
- "version": "0.12.0",
166
+ "version": "0.13.0",
167
167
  "sourceDir": "dialog",
168
168
  "exportName": "Dialog"
169
169
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "document-card",
9
9
  "exportName": "DocumentCard",
10
10
  "description": "Document row with file metadata, access status and an optional download action.",
@@ -259,7 +259,7 @@
259
259
  ],
260
260
  "package": "@slipstream-ui/core",
261
261
  "importPath": "@slipstream-ui/core",
262
- "version": "0.12.0",
262
+ "version": "0.13.0",
263
263
  "sourceDir": "drawer",
264
264
  "exportName": "Drawer"
265
265
  }
@@ -159,7 +159,7 @@
159
159
  ],
160
160
  "package": "@slipstream-ui/core",
161
161
  "importPath": "@slipstream-ui/core",
162
- "version": "0.12.0",
162
+ "version": "0.13.0",
163
163
  "sourceDir": "empty-state",
164
164
  "exportName": "EmptyState"
165
165
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "organism",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "entity-card",
9
9
  "exportName": "EntityCard",
10
10
  "description": "Firm or member profile card with logo, type, location, stats, tags and actions.",
@@ -4,7 +4,7 @@
4
4
  "tier": "organism",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "feature-grid",
9
9
  "exportName": "FeatureGrid",
10
10
  "description": "Grid of feature or benefit cards with an icon, title, copy and optional link.",
@@ -4,7 +4,7 @@
4
4
  "tier": "organism",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.12.0",
7
+ "version": "0.13.0",
8
8
  "sourceDir": "feature-row",
9
9
  "exportName": "FeatureRow",
10
10
  "description": "Alternating media and copy row for mid-page feature sections.",
@@ -107,7 +107,7 @@
107
107
  ],
108
108
  "package": "@slipstream-ui/core",
109
109
  "importPath": "@slipstream-ui/core",
110
- "version": "0.12.0",
110
+ "version": "0.13.0",
111
111
  "sourceDir": "fieldset",
112
112
  "exportName": "Fieldset"
113
113
  }