@slipstream-ui/core 0.11.3 → 0.11.6

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 (253) hide show
  1. package/dist/index.d.mts +126 -7
  2. package/dist/index.d.ts +126 -7
  3. package/dist/index.js +605 -444
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +500 -340
  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/contact-strip.manifest.json +1 -1
  28. package/dist/manifests/container.manifest.json +1 -1
  29. package/dist/manifests/cover-image.manifest.json +151 -0
  30. package/dist/manifests/cta-section.manifest.json +1 -1
  31. package/dist/manifests/data-table.manifest.json +1 -1
  32. package/dist/manifests/date-picker-popover.manifest.json +1 -1
  33. package/dist/manifests/date-picker.manifest.json +1 -1
  34. package/dist/manifests/date-range-picker.manifest.json +1 -1
  35. package/dist/manifests/deal-card.manifest.json +1 -1
  36. package/dist/manifests/dialog.manifest.json +1 -1
  37. package/dist/manifests/document-card.manifest.json +1 -1
  38. package/dist/manifests/drawer.manifest.json +1 -1
  39. package/dist/manifests/empty-state.manifest.json +45 -1
  40. package/dist/manifests/entity-card.manifest.json +1 -1
  41. package/dist/manifests/feature-grid.manifest.json +1 -1
  42. package/dist/manifests/feature-row.manifest.json +1 -1
  43. package/dist/manifests/fieldset.manifest.json +1 -1
  44. package/dist/manifests/file-upload.manifest.json +1 -1
  45. package/dist/manifests/filter-bar.manifest.json +1 -1
  46. package/dist/manifests/filter-chips.manifest.json +1 -1
  47. package/dist/manifests/filter-panel.manifest.json +1 -1
  48. package/dist/manifests/flex.manifest.json +1 -1
  49. package/dist/manifests/form-field.manifest.json +1 -1
  50. package/dist/manifests/form-layout.manifest.json +16 -4
  51. package/dist/manifests/form.manifest.json +1 -1
  52. package/dist/manifests/grid.manifest.json +1 -1
  53. package/dist/manifests/heading.manifest.json +1 -1
  54. package/dist/manifests/hero.manifest.json +1 -1
  55. package/dist/manifests/image.manifest.json +7 -1
  56. package/dist/manifests/input-group.manifest.json +1 -1
  57. package/dist/manifests/input.manifest.json +1 -1
  58. package/dist/manifests/label.manifest.json +1 -1
  59. package/dist/manifests/link-tabs.manifest.json +1 -1
  60. package/dist/manifests/link.manifest.json +1 -1
  61. package/dist/manifests/list.manifest.json +1 -1
  62. package/dist/manifests/load-more.manifest.json +1 -1
  63. package/dist/manifests/logo-cloud.manifest.json +1 -1
  64. package/dist/manifests/menu.manifest.json +1 -1
  65. package/dist/manifests/metric-card.manifest.json +1 -1
  66. package/dist/manifests/multi-select.manifest.json +1 -1
  67. package/dist/manifests/newsletter.manifest.json +1 -1
  68. package/dist/manifests/page-header.manifest.json +1 -1
  69. package/dist/manifests/pagination.manifest.json +1 -1
  70. package/dist/manifests/password-input.manifest.json +1 -1
  71. package/dist/manifests/popover.manifest.json +1 -1
  72. package/dist/manifests/process-steps.manifest.json +1 -1
  73. package/dist/manifests/progress.manifest.json +1 -1
  74. package/dist/manifests/prose.manifest.json +1 -1
  75. package/dist/manifests/radio.manifest.json +1 -1
  76. package/dist/manifests/range-slider.manifest.json +1 -1
  77. package/dist/manifests/search.manifest.json +1 -1
  78. package/dist/manifests/section-heading.manifest.json +1 -1
  79. package/dist/manifests/section.manifest.json +1 -1
  80. package/dist/manifests/segmented-control.manifest.json +29 -2
  81. package/dist/manifests/select-menu.manifest.json +1 -1
  82. package/dist/manifests/select.manifest.json +1 -1
  83. package/dist/manifests/separator.manifest.json +1 -1
  84. package/dist/manifests/site-footer.manifest.json +1 -1
  85. package/dist/manifests/site-header.manifest.json +1 -1
  86. package/dist/manifests/skeleton.manifest.json +1 -1
  87. package/dist/manifests/spinner.manifest.json +1 -1
  88. package/dist/manifests/stat-band.manifest.json +23 -1
  89. package/dist/manifests/stepper.manifest.json +1 -1
  90. package/dist/manifests/switch.manifest.json +1 -1
  91. package/dist/manifests/table-card.manifest.json +1 -1
  92. package/dist/manifests/table-of-contents.manifest.json +1 -1
  93. package/dist/manifests/table.manifest.json +1 -1
  94. package/dist/manifests/tabs.manifest.json +1 -1
  95. package/dist/manifests/testimonial.manifest.json +1 -1
  96. package/dist/manifests/text.manifest.json +1 -1
  97. package/dist/manifests/textarea.manifest.json +1 -1
  98. package/dist/manifests/theme-toggle.manifest.json +1 -1
  99. package/dist/manifests/time-picker.manifest.json +1 -1
  100. package/dist/manifests/timeline.manifest.json +1 -1
  101. package/dist/manifests/toast.manifest.json +1 -1
  102. package/dist/manifests/tombstone-card.manifest.json +1 -1
  103. package/dist/manifests/tooltip.manifest.json +1 -1
  104. package/dist/src/components/cover-image/CoverImage.d.ts +34 -0
  105. package/dist/src/components/cover-image/CoverImage.js +94 -0
  106. package/dist/src/components/cover-image/CoverImage.js.map +1 -0
  107. package/dist/src/components/cover-image/CoverImage.mjs +70 -0
  108. package/dist/src/components/cover-image/CoverImage.mjs.map +1 -0
  109. package/dist/src/components/cover-image/index.d.ts +1 -0
  110. package/dist/src/components/cover-image/index.js +29 -0
  111. package/dist/src/components/cover-image/index.js.map +1 -0
  112. package/dist/src/components/cover-image/index.mjs +5 -0
  113. package/dist/src/components/cover-image/index.mjs.map +1 -0
  114. package/dist/src/components/empty-state/EmptyState.d.ts +24 -0
  115. package/dist/src/components/empty-state/EmptyState.js +16 -6
  116. package/dist/src/components/empty-state/EmptyState.js.map +1 -1
  117. package/dist/src/components/empty-state/EmptyState.mjs +16 -6
  118. package/dist/src/components/empty-state/EmptyState.mjs.map +1 -1
  119. package/dist/src/components/form-layout/FormLayout.d.ts +26 -4
  120. package/dist/src/components/form-layout/FormLayout.js +16 -3
  121. package/dist/src/components/form-layout/FormLayout.js.map +1 -1
  122. package/dist/src/components/form-layout/FormLayout.mjs +16 -3
  123. package/dist/src/components/form-layout/FormLayout.mjs.map +1 -1
  124. package/dist/src/components/image/Image.d.ts +3 -1
  125. package/dist/src/components/image/Image.js +2 -0
  126. package/dist/src/components/image/Image.js.map +1 -1
  127. package/dist/src/components/image/Image.mjs +2 -0
  128. package/dist/src/components/image/Image.mjs.map +1 -1
  129. package/dist/src/components/segmented-control/SegmentedControl.d.ts +21 -0
  130. package/dist/src/components/segmented-control/SegmentedControl.js +47 -16
  131. package/dist/src/components/segmented-control/SegmentedControl.js.map +1 -1
  132. package/dist/src/components/segmented-control/SegmentedControl.mjs +48 -17
  133. package/dist/src/components/segmented-control/SegmentedControl.mjs.map +1 -1
  134. package/dist/src/components/stat-band/StatBand.d.ts +16 -0
  135. package/dist/src/components/stat-band/StatBand.js +46 -9
  136. package/dist/src/components/stat-band/StatBand.js.map +1 -1
  137. package/dist/src/components/stat-band/StatBand.mjs +46 -9
  138. package/dist/src/components/stat-band/StatBand.mjs.map +1 -1
  139. package/dist/src/index.d.ts +1 -0
  140. package/dist/styles-full.css +1 -1
  141. package/dist/styles.css +1 -1
  142. package/package.json +1 -1
  143. package/src/components/cover-image/CoverImage.test.tsx +88 -0
  144. package/src/components/cover-image/CoverImage.tsx +109 -0
  145. package/src/components/cover-image/index.ts +1 -0
  146. package/src/components/empty-state/EmptyState.test.tsx +33 -0
  147. package/src/components/empty-state/EmptyState.tsx +34 -6
  148. package/src/components/form-layout/FormLayout.test.tsx +26 -0
  149. package/src/components/form-layout/FormLayout.tsx +37 -5
  150. package/src/components/image/Image.tsx +4 -0
  151. package/src/components/segmented-control/SegmentedControl.test.tsx +64 -0
  152. package/src/components/segmented-control/SegmentedControl.tsx +69 -15
  153. package/src/components/stat-band/StatBand.test.tsx +26 -0
  154. package/src/components/stat-band/StatBand.tsx +52 -7
  155. package/src/index.ts +1 -0
  156. package/src/manifests/accordion.manifest.json +1 -1
  157. package/src/manifests/alert.manifest.json +1 -1
  158. package/src/manifests/announcement-bar.manifest.json +1 -1
  159. package/src/manifests/app-shell.manifest.json +1 -1
  160. package/src/manifests/applied-filters.manifest.json +1 -1
  161. package/src/manifests/article-card.manifest.json +1 -1
  162. package/src/manifests/auth-layout.manifest.json +1 -1
  163. package/src/manifests/autocomplete.manifest.json +1 -1
  164. package/src/manifests/avatar.manifest.json +1 -1
  165. package/src/manifests/badge.manifest.json +1 -1
  166. package/src/manifests/block.manifest.json +1 -1
  167. package/src/manifests/bottom-nav.manifest.json +1 -1
  168. package/src/manifests/breadcrumb.manifest.json +1 -1
  169. package/src/manifests/button-group.manifest.json +1 -1
  170. package/src/manifests/button.manifest.json +1 -1
  171. package/src/manifests/calendar.manifest.json +1 -1
  172. package/src/manifests/card.manifest.json +1 -1
  173. package/src/manifests/checkbox.manifest.json +1 -1
  174. package/src/manifests/comparison-table.manifest.json +1 -1
  175. package/src/manifests/confirm-dialog.manifest.json +1 -1
  176. package/src/manifests/contact-strip.manifest.json +1 -1
  177. package/src/manifests/container.manifest.json +1 -1
  178. package/src/manifests/cover-image.manifest.json +151 -0
  179. package/src/manifests/cta-section.manifest.json +1 -1
  180. package/src/manifests/data-table.manifest.json +1 -1
  181. package/src/manifests/date-picker-popover.manifest.json +1 -1
  182. package/src/manifests/date-picker.manifest.json +1 -1
  183. package/src/manifests/date-range-picker.manifest.json +1 -1
  184. package/src/manifests/deal-card.manifest.json +1 -1
  185. package/src/manifests/dialog.manifest.json +1 -1
  186. package/src/manifests/document-card.manifest.json +1 -1
  187. package/src/manifests/drawer.manifest.json +1 -1
  188. package/src/manifests/empty-state.manifest.json +45 -1
  189. package/src/manifests/entity-card.manifest.json +1 -1
  190. package/src/manifests/feature-grid.manifest.json +1 -1
  191. package/src/manifests/feature-row.manifest.json +1 -1
  192. package/src/manifests/fieldset.manifest.json +1 -1
  193. package/src/manifests/file-upload.manifest.json +1 -1
  194. package/src/manifests/filter-bar.manifest.json +1 -1
  195. package/src/manifests/filter-chips.manifest.json +1 -1
  196. package/src/manifests/filter-panel.manifest.json +1 -1
  197. package/src/manifests/flex.manifest.json +1 -1
  198. package/src/manifests/form-field.manifest.json +1 -1
  199. package/src/manifests/form-layout.manifest.json +16 -4
  200. package/src/manifests/form.manifest.json +1 -1
  201. package/src/manifests/grid.manifest.json +1 -1
  202. package/src/manifests/heading.manifest.json +1 -1
  203. package/src/manifests/hero.manifest.json +1 -1
  204. package/src/manifests/image.manifest.json +7 -1
  205. package/src/manifests/input-group.manifest.json +1 -1
  206. package/src/manifests/input.manifest.json +1 -1
  207. package/src/manifests/label.manifest.json +1 -1
  208. package/src/manifests/link-tabs.manifest.json +1 -1
  209. package/src/manifests/link.manifest.json +1 -1
  210. package/src/manifests/list.manifest.json +1 -1
  211. package/src/manifests/load-more.manifest.json +1 -1
  212. package/src/manifests/logo-cloud.manifest.json +1 -1
  213. package/src/manifests/menu.manifest.json +1 -1
  214. package/src/manifests/metric-card.manifest.json +1 -1
  215. package/src/manifests/multi-select.manifest.json +1 -1
  216. package/src/manifests/newsletter.manifest.json +1 -1
  217. package/src/manifests/page-header.manifest.json +1 -1
  218. package/src/manifests/pagination.manifest.json +1 -1
  219. package/src/manifests/password-input.manifest.json +1 -1
  220. package/src/manifests/popover.manifest.json +1 -1
  221. package/src/manifests/process-steps.manifest.json +1 -1
  222. package/src/manifests/progress.manifest.json +1 -1
  223. package/src/manifests/prose.manifest.json +1 -1
  224. package/src/manifests/radio.manifest.json +1 -1
  225. package/src/manifests/range-slider.manifest.json +1 -1
  226. package/src/manifests/search.manifest.json +1 -1
  227. package/src/manifests/section-heading.manifest.json +1 -1
  228. package/src/manifests/section.manifest.json +1 -1
  229. package/src/manifests/segmented-control.manifest.json +29 -2
  230. package/src/manifests/select-menu.manifest.json +1 -1
  231. package/src/manifests/select.manifest.json +1 -1
  232. package/src/manifests/separator.manifest.json +1 -1
  233. package/src/manifests/site-footer.manifest.json +1 -1
  234. package/src/manifests/site-header.manifest.json +1 -1
  235. package/src/manifests/skeleton.manifest.json +1 -1
  236. package/src/manifests/spinner.manifest.json +1 -1
  237. package/src/manifests/stat-band.manifest.json +23 -1
  238. package/src/manifests/stepper.manifest.json +1 -1
  239. package/src/manifests/switch.manifest.json +1 -1
  240. package/src/manifests/table-card.manifest.json +1 -1
  241. package/src/manifests/table-of-contents.manifest.json +1 -1
  242. package/src/manifests/table.manifest.json +1 -1
  243. package/src/manifests/tabs.manifest.json +1 -1
  244. package/src/manifests/testimonial.manifest.json +1 -1
  245. package/src/manifests/text.manifest.json +1 -1
  246. package/src/manifests/textarea.manifest.json +1 -1
  247. package/src/manifests/theme-toggle.manifest.json +1 -1
  248. package/src/manifests/time-picker.manifest.json +1 -1
  249. package/src/manifests/timeline.manifest.json +1 -1
  250. package/src/manifests/toast.manifest.json +1 -1
  251. package/src/manifests/tombstone-card.manifest.json +1 -1
  252. package/src/manifests/tooltip.manifest.json +1 -1
  253. package/src/styles.css +5 -0
@@ -11,17 +11,47 @@ const GRID_COLUMNS: Record<number, string> = {
11
11
  4: 'grid-cols-4',
12
12
  };
13
13
 
14
+ const GRID_BREAKPOINTS = ['sm', 'md', 'lg', 'xl'] as const;
15
+
16
+ /** Column count per breakpoint; `base` applies at every width. */
17
+ export type FormLayoutColumns =
18
+ | 1
19
+ | 2
20
+ | 3
21
+ | 4
22
+ | { base?: 1 | 2 | 3 | 4; sm?: 1 | 2 | 3 | 4; md?: 1 | 2 | 3 | 4; lg?: 1 | 2 | 3 | 4; xl?: 1 | 2 | 3 | 4 };
23
+
24
+ function gridColumnClasses(columns: FormLayoutColumns): string {
25
+ if (typeof columns === 'number') return GRID_COLUMNS[columns];
26
+ return [
27
+ columns.base !== undefined ? GRID_COLUMNS[columns.base] : '',
28
+ ...GRID_BREAKPOINTS.map((bp) => {
29
+ const count = columns[bp];
30
+ return count !== undefined ? `${bp}:${GRID_COLUMNS[count]}` : '';
31
+ }),
32
+ ]
33
+ .filter(Boolean)
34
+ .join(' ');
35
+ }
36
+
14
37
  export type FormLayoutProps = React.HTMLAttributes<HTMLElement> & {
15
38
  /** Grouping layout: even vertical stack (default), horizontal row, or responsive grid. */
16
39
  layout?: 'stack' | 'row' | 'grid';
17
- /** Grid column count (1-4); grid wraps naturally via responsive variants passed as className. */
18
- columns?: 1 | 2 | 3 | 4;
40
+ /**
41
+ * Grid column count (1-4) at every width, or per breakpoint
42
+ * (`{ base: 1, md: 2 }`) for responsive grids without className overrides.
43
+ */
44
+ columns?: FormLayoutColumns;
19
45
  /** Even spacing between children — token ('md') or exact pixels (16). */
20
46
  gap?: GapValue;
21
47
  /** Group label; renders a semantic <legend> when as="fieldset". */
22
48
  legend?: string;
49
+ /** Extra classes for the legend (fieldset mode). */
50
+ legendClassName?: string;
23
51
  /** Supporting line under the legend (fieldset mode). */
24
52
  description?: string;
53
+ /** Extra classes for the description (fieldset mode). */
54
+ descriptionClassName?: string;
25
55
  /** Render as a semantic fieldset (default 'div'). */
26
56
  as?: 'div' | 'fieldset';
27
57
  };
@@ -39,7 +69,9 @@ const FormLayout = React.forwardRef<HTMLElement, FormLayoutProps>(
39
69
  columns = 2,
40
70
  gap,
41
71
  legend,
72
+ legendClassName,
42
73
  description,
74
+ descriptionClassName,
43
75
  as = 'div',
44
76
  className,
45
77
  style,
@@ -57,7 +89,7 @@ const FormLayout = React.forwardRef<HTMLElement, FormLayoutProps>(
57
89
  'flex min-w-0',
58
90
  layout === 'stack' && 'flex-col',
59
91
  layout === 'row' && 'flex-row flex-wrap items-end',
60
- layout === 'grid' && `grid ${GRID_COLUMNS[columns]}`,
92
+ layout === 'grid' && `grid ${gridColumnClasses(columns)}`,
61
93
  gapResolved.className,
62
94
  className
63
95
  )}
@@ -65,10 +97,10 @@ const FormLayout = React.forwardRef<HTMLElement, FormLayoutProps>(
65
97
  {...props}
66
98
  >
67
99
  {legend && as === 'fieldset' && (
68
- <legend className="col-span-full p-0 text-sm font-medium leading-none">{legend}</legend>
100
+ <legend className={cn('col-span-full p-0 text-sm font-medium leading-none', legendClassName)}>{legend}</legend>
69
101
  )}
70
102
  {description && as === 'fieldset' && (
71
- <p className="col-span-full text-xs text-muted-foreground">{description}</p>
103
+ <p className={cn('col-span-full text-xs text-muted-foreground', descriptionClassName)}>{description}</p>
72
104
  )}
73
105
  {children}
74
106
  </Tag>
@@ -22,6 +22,8 @@ export type ImageProps = {
22
22
  className?: string;
23
23
  /** Classes for the image when a consumer wants to keep them separate. */
24
24
  imgClassName?: string;
25
+ /** Responsive `sizes` hint for the browser's source selection. */
26
+ sizes?: string;
25
27
  style?: React.CSSProperties;
26
28
  };
27
29
 
@@ -43,6 +45,7 @@ export function Image({
43
45
  height = 630,
44
46
  className,
45
47
  imgClassName,
48
+ sizes,
46
49
  style,
47
50
  }: ImageProps) {
48
51
  const [stage, setStage] = React.useState<0 | 1 | 2>(0);
@@ -68,6 +71,7 @@ export function Image({
68
71
  loading={priority ? 'eager' : 'lazy'}
69
72
  fetchPriority={priority ? 'high' : 'auto'}
70
73
  decoding="async"
74
+ sizes={sizes}
71
75
  className={cn(className, imgClassName)}
72
76
  style={style}
73
77
  onError={onError}
@@ -59,4 +59,68 @@ describe('SegmentedControl', () => {
59
59
  const { container } = render(<ControlledExample />);
60
60
  expect(await axe(container)).toHaveNoViolations();
61
61
  });
62
+
63
+ it('renders options with href as links and marks the active segment', () => {
64
+ render(
65
+ <SegmentedControl
66
+ aria-label="View"
67
+ value="grid"
68
+ options={[
69
+ { value: 'list', label: 'List', href: '/items?view=list' },
70
+ { value: 'grid', label: 'Grid', href: '/items?view=grid' },
71
+ ]}
72
+ />
73
+ );
74
+ expect(screen.getByRole('link', { name: 'List' })).toHaveAttribute('href', '/items?view=list');
75
+ expect(screen.queryByRole('link', { name: 'Grid' })).not.toBeInTheDocument();
76
+ expect(screen.getByText('Grid').closest('[aria-current]')).toHaveAttribute('aria-current', 'page');
77
+ });
78
+
79
+ it('honors linkComponent and linkHrefProp', () => {
80
+ const RouterLink = ({ to, children, ...rest }: { to: string; children: React.ReactNode }) => (
81
+ <a href={to} data-to={to} {...rest}>{children}</a>
82
+ );
83
+ render(
84
+ <SegmentedControl
85
+ aria-label="View"
86
+ value="list"
87
+ linkComponent={RouterLink}
88
+ linkHrefProp="to"
89
+ options={[
90
+ { value: 'list', label: 'List', href: '/items?view=list' },
91
+ { value: 'grid', label: 'Grid', href: '/items?view=grid' },
92
+ ]}
93
+ />
94
+ );
95
+ expect(screen.getByRole('link', { name: 'Grid' })).toHaveAttribute('data-to', '/items?view=grid');
96
+ });
97
+
98
+ it('renders a disabled link option as a non-interactive marker', () => {
99
+ render(
100
+ <SegmentedControl
101
+ aria-label="View"
102
+ value="list"
103
+ options={[
104
+ { value: 'list', label: 'List', href: '/items?view=list' },
105
+ { value: 'grid', label: 'Grid', href: '/items?view=grid', disabled: true },
106
+ ]}
107
+ />
108
+ );
109
+ expect(screen.queryByRole('link', { name: 'Grid' })).not.toBeInTheDocument();
110
+ expect(screen.getByText('Grid').closest('[aria-disabled]')).toHaveAttribute('aria-disabled', 'true');
111
+ });
112
+
113
+ it('has no accessibility violations in link mode', async () => {
114
+ const { container } = render(
115
+ <SegmentedControl
116
+ aria-label="View"
117
+ value="grid"
118
+ options={[
119
+ { value: 'list', label: 'List', href: '/items?view=list' },
120
+ { value: 'grid', label: 'Grid', href: '/items?view=grid' },
121
+ ]}
122
+ />
123
+ );
124
+ expect(await axe(container)).toHaveNoViolations();
125
+ });
62
126
  });
@@ -9,6 +9,13 @@ export type SegmentedOption = {
9
9
  /** Optional leading icon. */
10
10
  icon?: React.ReactNode;
11
11
  disabled?: boolean;
12
+ /**
13
+ * Destination URL. When set the segment renders as a link instead of a
14
+ * button - use this for view switches that must survive refresh and work
15
+ * without JavaScript. The active segment renders as a non-link
16
+ * `aria-current="page"` marker.
17
+ */
18
+ href?: string;
12
19
  };
13
20
 
14
21
  export type SegmentedControlProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> & {
@@ -26,6 +33,10 @@ export type SegmentedControlProps = Omit<React.HTMLAttributes<HTMLDivElement>, '
26
33
  size?: 'sm' | 'md' | 'lg';
27
34
  /** Stretch segments to fill the container width. */
28
35
  fullWidth?: boolean;
36
+ /** Custom link element for routers (Next Link, react-router Link). */
37
+ linkComponent?: React.ElementType;
38
+ /** Prop used to pass the destination to `linkComponent`. */
39
+ linkHrefProp?: 'href' | 'to';
29
40
  };
30
41
 
31
42
  const sizeClasses = {
@@ -39,6 +50,12 @@ const sizeClasses = {
39
50
  * semantics and arrow-key navigation; multiple-select uses pressed buttons.
40
51
  * Use it for filters such as All / Investors / Advisors, not for tab panels
41
52
  * (use Tabs when each segment owns a tabpanel).
53
+ *
54
+ * Give an option an `href` to render it as a real link - the pattern for
55
+ * view switches that must survive refresh, work without JavaScript, and stay
56
+ * cacheable. The active segment then renders as a non-link
57
+ * `aria-current="page"` marker and link segments use normal tab navigation
58
+ * instead of roving tabindex. Link mode is intended for single-select.
42
59
  */
43
60
  export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(
44
61
  function SegmentedControl(
@@ -50,6 +67,8 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
50
67
  multiple = false,
51
68
  size = 'md',
52
69
  fullWidth = false,
70
+ linkComponent,
71
+ linkHrefProp = 'href',
53
72
  className,
54
73
  'aria-label': ariaLabel = 'Segmented control',
55
74
  ...props
@@ -75,6 +94,10 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
75
94
  ? current
76
95
  : '';
77
96
 
97
+ const linkMode = options.some((option) => option.href !== undefined);
98
+ const LinkEl = linkComponent ?? 'a';
99
+ const destination = (href: string) => (linkHrefProp === 'to' ? { to: href } : { href });
100
+
78
101
  const refs = React.useRef<Array<HTMLButtonElement | null>>([]);
79
102
 
80
103
  const commit = (next: string | string[]) => {
@@ -137,7 +160,7 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
137
160
  return (
138
161
  <div
139
162
  ref={ref}
140
- role={multiple ? 'group' : 'radiogroup'}
163
+ role={multiple || linkMode ? 'group' : 'radiogroup'}
141
164
  aria-label={ariaLabel}
142
165
  className={cn(
143
166
  'inline-flex items-center gap-1 rounded-lg border border-border bg-muted p-1',
@@ -152,6 +175,46 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
152
175
  : selected === option.value;
153
176
  const firstEnabled = options.findIndex((entry) => !entry.disabled);
154
177
  const focusable = multiple || active || (!selected && index === firstEnabled);
178
+ const segmentClass = cn(
179
+ 'inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors',
180
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
181
+ 'disabled:pointer-events-none disabled:opacity-50',
182
+ sizeClasses[size],
183
+ fullWidth && 'flex-1',
184
+ active
185
+ ? 'bg-background text-foreground shadow-sm'
186
+ : 'text-muted-foreground hover:text-foreground'
187
+ );
188
+ const segmentContent = (
189
+ <>
190
+ {option.icon && <span className="shrink-0 [&_svg]:size-4">{option.icon}</span>}
191
+ <span className="truncate">{option.label}</span>
192
+ </>
193
+ );
194
+
195
+ if (option.href !== undefined) {
196
+ if (option.disabled || active) {
197
+ return (
198
+ <span
199
+ key={option.value}
200
+ aria-current={active ? 'page' : undefined}
201
+ aria-disabled={option.disabled || undefined}
202
+ className={cn(segmentClass, option.disabled && 'opacity-50')}
203
+ >
204
+ {segmentContent}
205
+ </span>
206
+ );
207
+ }
208
+ return (
209
+ <LinkEl
210
+ key={option.value}
211
+ {...destination(option.href)}
212
+ className={segmentClass}
213
+ >
214
+ {segmentContent}
215
+ </LinkEl>
216
+ );
217
+ }
155
218
 
156
219
  return (
157
220
  <button
@@ -160,26 +223,17 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
160
223
  refs.current[index] = node;
161
224
  }}
162
225
  type="button"
163
- role={multiple ? undefined : 'radio'}
164
- aria-checked={multiple ? undefined : active}
226
+ role={multiple || linkMode ? undefined : 'radio'}
227
+ aria-checked={multiple || linkMode ? undefined : active}
165
228
  aria-pressed={multiple ? active : undefined}
229
+ aria-current={linkMode && active ? 'page' : undefined}
166
230
  disabled={option.disabled}
167
231
  tabIndex={focusable ? 0 : -1}
168
232
  onClick={() => select(option)}
169
233
  onKeyDown={onKeyDown}
170
- className={cn(
171
- 'inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors',
172
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
173
- 'disabled:pointer-events-none disabled:opacity-50',
174
- sizeClasses[size],
175
- fullWidth && 'flex-1',
176
- active
177
- ? 'bg-background text-foreground shadow-sm'
178
- : 'text-muted-foreground hover:text-foreground'
179
- )}
234
+ className={segmentClass}
180
235
  >
181
- {option.icon && <span className="shrink-0 [&_svg]:size-4">{option.icon}</span>}
182
- <span className="truncate">{option.label}</span>
236
+ {segmentContent}
183
237
  </button>
184
238
  );
185
239
  })}
@@ -35,8 +35,34 @@ describe('StatBand', () => {
35
35
  expect(screen.getByText('One').parentElement).toHaveClass('items-start', 'text-left');
36
36
  });
37
37
 
38
+ it('renders a bordered panel variant with dense cells', () => {
39
+ const { container } = render(
40
+ <StatBand
41
+ variant="panel"
42
+ align="left"
43
+ valueClassName="font-mono"
44
+ items={[
45
+ { value: '3', label: 'Deadlines', hint: 'closing soon' },
46
+ { value: '12', label: 'Events' },
47
+ ]}
48
+ />
49
+ );
50
+ const dl = container.firstElementChild as HTMLElement;
51
+ expect(dl).toHaveClass('border', 'border-border', 'rounded-lg', 'divide-y', 'sm:divide-x');
52
+ expect(screen.getByText('3')).toHaveClass('font-mono', 'text-xl');
53
+ const label = screen.getByText('Deadlines');
54
+ expect(label).toHaveClass('uppercase');
55
+ });
56
+
38
57
  it('has no accessibility violations', async () => {
39
58
  const { container } = render(<StatBand items={[{ value: '10+', label: 'Years' }]} />);
40
59
  expect(await axe(container)).toHaveNoViolations();
41
60
  });
61
+
62
+ it('has no accessibility violations in panel variant', async () => {
63
+ const { container } = render(
64
+ <StatBand variant="panel" items={[{ value: '10+', label: 'Years', hint: 'and counting' }]} />
65
+ );
66
+ expect(await axe(container)).toHaveNoViolations();
67
+ });
42
68
  });
@@ -21,6 +21,14 @@ export type StatBandProps = React.HTMLAttributes<HTMLDListElement> & {
21
21
  size?: 'sm' | 'md' | 'lg';
22
22
  /** Draw dividers between stats at sm and up. Default true. */
23
23
  divided?: boolean;
24
+ /**
25
+ * Surface treatment. 'panel' renders a bordered strip of hairline-separated
26
+ * cells with denser type for data pages; 'plain' is the marketing band.
27
+ * Default 'plain'.
28
+ */
29
+ variant?: 'plain' | 'panel';
30
+ /** Extra classes for the value element (e.g. font-mono for tabular numerals). */
31
+ valueClassName?: string;
24
32
  };
25
33
 
26
34
  const columnClasses: Record<NonNullable<StatBandProps['columns']>, string> = {
@@ -35,22 +43,43 @@ const valueClasses: Record<NonNullable<StatBandProps['size']>, string> = {
35
43
  lg: 'text-4xl sm:text-5xl',
36
44
  };
37
45
 
46
+ const panelValueClasses: Record<NonNullable<StatBandProps['size']>, string> = {
47
+ sm: 'text-lg',
48
+ md: 'text-xl sm:text-2xl',
49
+ lg: 'text-2xl sm:text-3xl',
50
+ };
51
+
38
52
  /**
39
53
  * Marketing stat band: a semantic description list of headline numbers with
40
54
  * labels and optional hints. Use it inside a Section; the Section owns the
41
55
  * surface tone, so the same band works on white and inverse backgrounds.
42
56
  */
43
57
  export const StatBand = React.forwardRef<HTMLDListElement, StatBandProps>(function StatBand(
44
- { items, columns = 3, align = 'center', size = 'md', divided = true, className, ...props },
58
+ {
59
+ items,
60
+ columns = 3,
61
+ align = 'center',
62
+ size = 'md',
63
+ divided = true,
64
+ variant = 'plain',
65
+ valueClassName,
66
+ className,
67
+ ...props
68
+ },
45
69
  ref
46
70
  ) {
71
+ const panel = variant === 'panel';
47
72
  return (
48
73
  <dl
49
74
  ref={ref}
50
75
  className={cn(
51
- 'grid w-full gap-8',
76
+ 'grid w-full',
77
+ panel ? 'gap-0 rounded-lg border border-border bg-card' : 'gap-8',
52
78
  columnClasses[columns],
53
- divided && 'sm:divide-x sm:divide-border',
79
+ divided &&
80
+ (panel
81
+ ? 'divide-y divide-border sm:divide-x sm:divide-y-0'
82
+ : 'sm:divide-x sm:divide-border'),
54
83
  className
55
84
  )}
56
85
  {...props}
@@ -59,15 +88,31 @@ export const StatBand = React.forwardRef<HTMLDListElement, StatBandProps>(functi
59
88
  <div
60
89
  key={item.label}
61
90
  className={cn(
62
- 'flex min-w-0 flex-col gap-1 sm:px-6 sm:first:pl-0 sm:last:pr-0',
91
+ 'flex min-w-0 flex-col gap-1',
92
+ panel ? 'px-4 py-3 sm:px-5 sm:py-4' : 'sm:px-6 sm:first:pl-0 sm:last:pr-0',
63
93
  align === 'center' ? 'items-center text-center' : 'items-start text-left'
64
94
  )}
65
95
  >
66
- <dt className="order-2 text-sm font-medium text-muted-foreground">
96
+ <dt
97
+ className={cn(
98
+ 'order-2 text-muted-foreground',
99
+ panel ? 'text-xs font-medium uppercase tracking-wide' : 'text-sm font-medium'
100
+ )}
101
+ >
67
102
  {item.label}
68
- {item.hint && <span className="mt-1 block text-xs font-normal">{item.hint}</span>}
103
+ {item.hint && (
104
+ <span className={cn('mt-1 block font-normal', panel ? 'text-xs normal-case tracking-normal' : 'text-xs')}>
105
+ {item.hint}
106
+ </span>
107
+ )}
69
108
  </dt>
70
- <dd className={cn('order-1 m-0 font-semibold tracking-tight tabular-nums', valueClasses[size])}>
109
+ <dd
110
+ className={cn(
111
+ 'order-1 m-0 font-semibold tracking-tight tabular-nums',
112
+ panel ? panelValueClasses[size] : valueClasses[size],
113
+ valueClassName
114
+ )}
115
+ >
71
116
  {item.value}
72
117
  </dd>
73
118
  </div>
package/src/index.ts CHANGED
@@ -48,6 +48,7 @@ export * from './components/data-table';
48
48
  export * from './components/list';
49
49
  export * from './components/link';
50
50
  export * from './components/image';
51
+ export * from './components/cover-image';
51
52
  export * from './components/text';
52
53
  export * from './components/heading';
53
54
  export * from './components/empty-state';
@@ -138,7 +138,7 @@
138
138
  ],
139
139
  "package": "@slipstream-ui/core",
140
140
  "importPath": "@slipstream-ui/core",
141
- "version": "0.11.3",
141
+ "version": "0.11.6",
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.11.3",
94
+ "version": "0.11.6",
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.11.3",
7
+ "version": "0.11.6",
8
8
  "sourceDir": "announcement-bar",
9
9
  "exportName": "AnnouncementBar",
10
10
  "description": "Dismissible announcement bar with optional action, tone and sticky positioning.",
@@ -214,7 +214,7 @@
214
214
  ],
215
215
  "package": "@slipstream-ui/core",
216
216
  "importPath": "@slipstream-ui/core",
217
- "version": "0.11.3",
217
+ "version": "0.11.6",
218
218
  "sourceDir": "app-shell",
219
219
  "exportName": "AppShell"
220
220
  }
@@ -4,7 +4,7 @@
4
4
  "tier": "molecule",
5
5
  "package": "@slipstream-ui/core",
6
6
  "importPath": "@slipstream-ui/core",
7
- "version": "0.11.3",
7
+ "version": "0.11.6",
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.11.3",
7
+ "version": "0.11.6",
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.11.3",
127
+ "version": "0.11.6",
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.11.3",
197
+ "version": "0.11.6",
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.11.3",
155
+ "version": "0.11.6",
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.11.3",
220
+ "version": "0.11.6",
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.11.3",
104
+ "version": "0.11.6",
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.11.3",
127
+ "version": "0.11.6",
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.11.3",
132
+ "version": "0.11.6",
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.11.3",
108
+ "version": "0.11.6",
109
109
  "sourceDir": "button-group",
110
110
  "exportName": "ButtonGroup"
111
111
  }
@@ -253,7 +253,7 @@
253
253
  ],
254
254
  "package": "@slipstream-ui/core",
255
255
  "importPath": "@slipstream-ui/core",
256
- "version": "0.11.3",
256
+ "version": "0.11.6",
257
257
  "sourceDir": "button",
258
258
  "exportName": "Button"
259
259
  }
@@ -169,7 +169,7 @@
169
169
  ],
170
170
  "package": "@slipstream-ui/core",
171
171
  "importPath": "@slipstream-ui/core",
172
- "version": "0.11.3",
172
+ "version": "0.11.6",
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.11.3",
89
+ "version": "0.11.6",
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.11.3",
163
+ "version": "0.11.6",
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.11.3",
7
+ "version": "0.11.6",
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.",