@slipstream-ui/core 0.11.8 → 0.11.10

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 (272) hide show
  1. package/dist/index.d.mts +176 -9
  2. package/dist/index.d.ts +176 -9
  3. package/dist/index.js +1297 -905
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1294 -905
  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 +4 -2
  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 +1 -1
  30. package/dist/manifests/cta-section.manifest.json +1 -1
  31. package/dist/manifests/data-table.manifest.json +22 -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 +1 -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 +1 -1
  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 +1 -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-toolbar.manifest.json +120 -0
  62. package/dist/manifests/list.manifest.json +1 -1
  63. package/dist/manifests/load-more.manifest.json +1 -1
  64. package/dist/manifests/logo-cloud.manifest.json +1 -1
  65. package/dist/manifests/media-card.manifest.json +161 -0
  66. package/dist/manifests/menu.manifest.json +1 -1
  67. package/dist/manifests/metric-card.manifest.json +1 -1
  68. package/dist/manifests/month-schedule.manifest.json +217 -0
  69. package/dist/manifests/multi-select.manifest.json +1 -1
  70. package/dist/manifests/newsletter.manifest.json +1 -1
  71. package/dist/manifests/page-header.manifest.json +1 -1
  72. package/dist/manifests/pagination.manifest.json +1 -1
  73. package/dist/manifests/password-input.manifest.json +1 -1
  74. package/dist/manifests/popover.manifest.json +1 -1
  75. package/dist/manifests/process-steps.manifest.json +1 -1
  76. package/dist/manifests/progress.manifest.json +1 -1
  77. package/dist/manifests/prose.manifest.json +1 -1
  78. package/dist/manifests/radio.manifest.json +1 -1
  79. package/dist/manifests/range-slider.manifest.json +1 -1
  80. package/dist/manifests/search.manifest.json +1 -1
  81. package/dist/manifests/section-heading.manifest.json +1 -1
  82. package/dist/manifests/section.manifest.json +1 -1
  83. package/dist/manifests/segmented-control.manifest.json +4 -4
  84. package/dist/manifests/select-menu.manifest.json +1 -1
  85. package/dist/manifests/select.manifest.json +1 -1
  86. package/dist/manifests/separator.manifest.json +1 -1
  87. package/dist/manifests/site-footer.manifest.json +1 -1
  88. package/dist/manifests/site-header.manifest.json +1 -1
  89. package/dist/manifests/skeleton.manifest.json +1 -1
  90. package/dist/manifests/spinner.manifest.json +1 -1
  91. package/dist/manifests/stat-band.manifest.json +1 -1
  92. package/dist/manifests/stepper.manifest.json +1 -1
  93. package/dist/manifests/switch.manifest.json +1 -1
  94. package/dist/manifests/table-card.manifest.json +1 -1
  95. package/dist/manifests/table-of-contents.manifest.json +1 -1
  96. package/dist/manifests/table.manifest.json +1 -1
  97. package/dist/manifests/tabs.manifest.json +1 -1
  98. package/dist/manifests/testimonial.manifest.json +1 -1
  99. package/dist/manifests/text.manifest.json +1 -1
  100. package/dist/manifests/textarea.manifest.json +1 -1
  101. package/dist/manifests/theme-toggle.manifest.json +1 -1
  102. package/dist/manifests/time-picker.manifest.json +1 -1
  103. package/dist/manifests/timeline.manifest.json +1 -1
  104. package/dist/manifests/toast.manifest.json +1 -1
  105. package/dist/manifests/tombstone-card.manifest.json +1 -1
  106. package/dist/manifests/tooltip.manifest.json +1 -1
  107. package/dist/src/components/button/Button.d.ts +2 -2
  108. package/dist/src/components/button/Button.js +1 -0
  109. package/dist/src/components/button/Button.js.map +1 -1
  110. package/dist/src/components/button/Button.mjs +1 -0
  111. package/dist/src/components/button/Button.mjs.map +1 -1
  112. package/dist/src/components/data-table/DataTable.d.ts +12 -1
  113. package/dist/src/components/data-table/DataTable.js +189 -112
  114. package/dist/src/components/data-table/DataTable.js.map +1 -1
  115. package/dist/src/components/data-table/DataTable.mjs +189 -112
  116. package/dist/src/components/data-table/DataTable.mjs.map +1 -1
  117. package/dist/src/components/list-toolbar/ListToolbar.d.ts +25 -0
  118. package/dist/src/components/list-toolbar/ListToolbar.js +68 -0
  119. package/dist/src/components/list-toolbar/ListToolbar.js.map +1 -0
  120. package/dist/src/components/list-toolbar/ListToolbar.mjs +44 -0
  121. package/dist/src/components/list-toolbar/ListToolbar.mjs.map +1 -0
  122. package/dist/src/components/list-toolbar/index.d.ts +1 -0
  123. package/dist/src/components/list-toolbar/index.js +23 -0
  124. package/dist/src/components/list-toolbar/index.js.map +1 -0
  125. package/dist/src/components/list-toolbar/index.mjs +2 -0
  126. package/dist/src/components/list-toolbar/index.mjs.map +1 -0
  127. package/dist/src/components/media-card/MediaCard.d.ts +61 -0
  128. package/dist/src/components/media-card/MediaCard.js +88 -0
  129. package/dist/src/components/media-card/MediaCard.js.map +1 -0
  130. package/dist/src/components/media-card/MediaCard.mjs +54 -0
  131. package/dist/src/components/media-card/MediaCard.mjs.map +1 -0
  132. package/dist/src/components/media-card/index.d.ts +1 -0
  133. package/dist/src/components/media-card/index.js +23 -0
  134. package/dist/src/components/media-card/index.js.map +1 -0
  135. package/dist/src/components/media-card/index.mjs +2 -0
  136. package/dist/src/components/media-card/index.mjs.map +1 -0
  137. package/dist/src/components/month-schedule/MonthSchedule.d.ts +56 -0
  138. package/dist/src/components/month-schedule/MonthSchedule.js +245 -0
  139. package/dist/src/components/month-schedule/MonthSchedule.js.map +1 -0
  140. package/dist/src/components/month-schedule/MonthSchedule.mjs +219 -0
  141. package/dist/src/components/month-schedule/MonthSchedule.mjs.map +1 -0
  142. package/dist/src/components/month-schedule/index.d.ts +1 -0
  143. package/dist/src/components/month-schedule/index.js +23 -0
  144. package/dist/src/components/month-schedule/index.js.map +1 -0
  145. package/dist/src/components/month-schedule/index.mjs +2 -0
  146. package/dist/src/components/month-schedule/index.mjs.map +1 -0
  147. package/dist/src/components/segmented-control/SegmentedControl.d.ts +20 -4
  148. package/dist/src/components/segmented-control/SegmentedControl.js +17 -3
  149. package/dist/src/components/segmented-control/SegmentedControl.js.map +1 -1
  150. package/dist/src/components/segmented-control/SegmentedControl.mjs +17 -3
  151. package/dist/src/components/segmented-control/SegmentedControl.mjs.map +1 -1
  152. package/dist/src/index.d.ts +3 -0
  153. package/dist/styles-full.css +1 -1
  154. package/dist/styles.css +1 -1
  155. package/package.json +3 -3
  156. package/src/components/button/Button.ssr.test.tsx +1 -1
  157. package/src/components/button/Button.test.tsx +6 -0
  158. package/src/components/button/Button.tsx +1 -0
  159. package/src/components/data-table/DataTable.test.tsx +99 -0
  160. package/src/components/data-table/DataTable.tsx +115 -1
  161. package/src/components/list-toolbar/ListToolbar.test.tsx +50 -0
  162. package/src/components/list-toolbar/ListToolbar.tsx +64 -0
  163. package/src/components/list-toolbar/index.ts +1 -0
  164. package/src/components/media-card/MediaCard.test.tsx +97 -0
  165. package/src/components/media-card/MediaCard.tsx +116 -0
  166. package/src/components/media-card/index.ts +1 -0
  167. package/src/components/month-schedule/MonthSchedule.test.tsx +137 -0
  168. package/src/components/month-schedule/MonthSchedule.tsx +332 -0
  169. package/src/components/month-schedule/index.ts +1 -0
  170. package/src/components/segmented-control/SegmentedControl.test.tsx +51 -0
  171. package/src/components/segmented-control/SegmentedControl.tsx +36 -4
  172. package/src/index.ts +3 -0
  173. package/src/manifests/accordion.manifest.json +1 -1
  174. package/src/manifests/alert.manifest.json +1 -1
  175. package/src/manifests/announcement-bar.manifest.json +1 -1
  176. package/src/manifests/app-shell.manifest.json +1 -1
  177. package/src/manifests/applied-filters.manifest.json +1 -1
  178. package/src/manifests/article-card.manifest.json +1 -1
  179. package/src/manifests/auth-layout.manifest.json +1 -1
  180. package/src/manifests/autocomplete.manifest.json +1 -1
  181. package/src/manifests/avatar.manifest.json +1 -1
  182. package/src/manifests/badge.manifest.json +1 -1
  183. package/src/manifests/block.manifest.json +1 -1
  184. package/src/manifests/bottom-nav.manifest.json +1 -1
  185. package/src/manifests/breadcrumb.manifest.json +1 -1
  186. package/src/manifests/button-group.manifest.json +1 -1
  187. package/src/manifests/button.manifest.json +4 -2
  188. package/src/manifests/calendar.manifest.json +1 -1
  189. package/src/manifests/card.manifest.json +1 -1
  190. package/src/manifests/checkbox.manifest.json +1 -1
  191. package/src/manifests/comparison-table.manifest.json +1 -1
  192. package/src/manifests/confirm-dialog.manifest.json +1 -1
  193. package/src/manifests/contact-strip.manifest.json +1 -1
  194. package/src/manifests/container.manifest.json +1 -1
  195. package/src/manifests/cover-image.manifest.json +1 -1
  196. package/src/manifests/cta-section.manifest.json +1 -1
  197. package/src/manifests/data-table.manifest.json +22 -1
  198. package/src/manifests/date-picker-popover.manifest.json +1 -1
  199. package/src/manifests/date-picker.manifest.json +1 -1
  200. package/src/manifests/date-range-picker.manifest.json +1 -1
  201. package/src/manifests/deal-card.manifest.json +1 -1
  202. package/src/manifests/dialog.manifest.json +1 -1
  203. package/src/manifests/document-card.manifest.json +1 -1
  204. package/src/manifests/drawer.manifest.json +1 -1
  205. package/src/manifests/empty-state.manifest.json +1 -1
  206. package/src/manifests/entity-card.manifest.json +1 -1
  207. package/src/manifests/feature-grid.manifest.json +1 -1
  208. package/src/manifests/feature-row.manifest.json +1 -1
  209. package/src/manifests/fieldset.manifest.json +1 -1
  210. package/src/manifests/file-upload.manifest.json +1 -1
  211. package/src/manifests/filter-bar.manifest.json +1 -1
  212. package/src/manifests/filter-chips.manifest.json +1 -1
  213. package/src/manifests/filter-panel.manifest.json +1 -1
  214. package/src/manifests/flex.manifest.json +1 -1
  215. package/src/manifests/form-field.manifest.json +1 -1
  216. package/src/manifests/form-layout.manifest.json +1 -1
  217. package/src/manifests/form.manifest.json +1 -1
  218. package/src/manifests/grid.manifest.json +1 -1
  219. package/src/manifests/heading.manifest.json +1 -1
  220. package/src/manifests/hero.manifest.json +1 -1
  221. package/src/manifests/image.manifest.json +1 -1
  222. package/src/manifests/input-group.manifest.json +1 -1
  223. package/src/manifests/input.manifest.json +1 -1
  224. package/src/manifests/label.manifest.json +1 -1
  225. package/src/manifests/link-tabs.manifest.json +1 -1
  226. package/src/manifests/link.manifest.json +1 -1
  227. package/src/manifests/list-toolbar.manifest.json +120 -0
  228. package/src/manifests/list.manifest.json +1 -1
  229. package/src/manifests/load-more.manifest.json +1 -1
  230. package/src/manifests/logo-cloud.manifest.json +1 -1
  231. package/src/manifests/media-card.manifest.json +161 -0
  232. package/src/manifests/menu.manifest.json +1 -1
  233. package/src/manifests/metric-card.manifest.json +1 -1
  234. package/src/manifests/month-schedule.manifest.json +217 -0
  235. package/src/manifests/multi-select.manifest.json +1 -1
  236. package/src/manifests/newsletter.manifest.json +1 -1
  237. package/src/manifests/page-header.manifest.json +1 -1
  238. package/src/manifests/pagination.manifest.json +1 -1
  239. package/src/manifests/password-input.manifest.json +1 -1
  240. package/src/manifests/popover.manifest.json +1 -1
  241. package/src/manifests/process-steps.manifest.json +1 -1
  242. package/src/manifests/progress.manifest.json +1 -1
  243. package/src/manifests/prose.manifest.json +1 -1
  244. package/src/manifests/radio.manifest.json +1 -1
  245. package/src/manifests/range-slider.manifest.json +1 -1
  246. package/src/manifests/search.manifest.json +1 -1
  247. package/src/manifests/section-heading.manifest.json +1 -1
  248. package/src/manifests/section.manifest.json +1 -1
  249. package/src/manifests/segmented-control.manifest.json +4 -4
  250. package/src/manifests/select-menu.manifest.json +1 -1
  251. package/src/manifests/select.manifest.json +1 -1
  252. package/src/manifests/separator.manifest.json +1 -1
  253. package/src/manifests/site-footer.manifest.json +1 -1
  254. package/src/manifests/site-header.manifest.json +1 -1
  255. package/src/manifests/skeleton.manifest.json +1 -1
  256. package/src/manifests/spinner.manifest.json +1 -1
  257. package/src/manifests/stat-band.manifest.json +1 -1
  258. package/src/manifests/stepper.manifest.json +1 -1
  259. package/src/manifests/switch.manifest.json +1 -1
  260. package/src/manifests/table-card.manifest.json +1 -1
  261. package/src/manifests/table-of-contents.manifest.json +1 -1
  262. package/src/manifests/table.manifest.json +1 -1
  263. package/src/manifests/tabs.manifest.json +1 -1
  264. package/src/manifests/testimonial.manifest.json +1 -1
  265. package/src/manifests/text.manifest.json +1 -1
  266. package/src/manifests/textarea.manifest.json +1 -1
  267. package/src/manifests/theme-toggle.manifest.json +1 -1
  268. package/src/manifests/time-picker.manifest.json +1 -1
  269. package/src/manifests/timeline.manifest.json +1 -1
  270. package/src/manifests/toast.manifest.json +1 -1
  271. package/src/manifests/tombstone-card.manifest.json +1 -1
  272. package/src/manifests/tooltip.manifest.json +1 -1
@@ -0,0 +1,332 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { cn } from '../../utils/cn';
5
+ import {
6
+ addMonths,
7
+ calendarWeeks,
8
+ formatDateLabel,
9
+ monthLabel,
10
+ parseDateKey,
11
+ todayKey,
12
+ weekdayLabels,
13
+ } from '../../utils/date';
14
+ import { Badge } from '../badge/Badge';
15
+ import { Button } from '../button';
16
+
17
+ export type MonthScheduleLegendItem = {
18
+ /** Type key returned by getType. */
19
+ type: string;
20
+ /** Human-readable label shown in the legend. */
21
+ label: string;
22
+ };
23
+
24
+ export type MonthScheduleProps<T> = {
25
+ /** Events to place inside days; each is dated via getDate. */
26
+ events: T[];
27
+ /** ISO date key (YYYY-MM-DD) for an event. */
28
+ getDate: (event: T) => string;
29
+ /** Short label shown on the day chip and in the agenda. */
30
+ getLabel: (event: T) => string;
31
+ /** Optional type key used for chip color and the legend. */
32
+ getType?: (event: T) => string | undefined;
33
+ /** Optional destination per event. */
34
+ getHref?: (event: T) => string | undefined;
35
+ /** Controlled month as YYYY-MM. Falls back to defaultMonth, then today. */
36
+ month?: string;
37
+ /** Uncontrolled initial month (YYYY-MM). */
38
+ defaultMonth?: string;
39
+ /** Called with the new YYYY-MM when paging. */
40
+ onMonthChange?: (month: string) => void;
41
+ /** Override "today" for deterministic server rendering and tests. */
42
+ today?: string;
43
+ /** BCP-47 locale for month, weekday and agenda labels. */
44
+ locale?: string;
45
+ /** 0 starts the week on Sunday, 1 on Monday. */
46
+ weekStartsOn?: 0 | 1;
47
+ /** Maximum event chips per day before collapsing into "+N more". */
48
+ maxPerDay?: number;
49
+ /** Type key → label/color entries rendered as a legend under the grid. */
50
+ legend?: MonthScheduleLegendItem[];
51
+ /**
52
+ * Below this breakpoint an agenda list replaces the day grid:
53
+ * 'sm' swaps under 640px, 'md' under 768px.
54
+ */
55
+ agendaBreakpoint?: 'sm' | 'md';
56
+ /** Custom link element for event hrefs (Next Link, react-router). */
57
+ linkComponent?: React.ElementType;
58
+ /** Prop used to pass the destination to linkComponent ('href' or 'to'). */
59
+ linkHrefProp?: 'href' | 'to';
60
+ 'aria-label'?: string;
61
+ className?: string;
62
+ };
63
+
64
+ // Deterministic tone per type so chips and legend agree without a color map
65
+ // in consumer code. Order chosen for adjacent contrast.
66
+ const TYPE_TONES = [
67
+ 'outline-info',
68
+ 'outline-success',
69
+ 'outline-warning',
70
+ 'outline-danger',
71
+ 'outline',
72
+ ] as const;
73
+
74
+ type Tone = (typeof TYPE_TONES)[number];
75
+
76
+ function typeTone(type: string | undefined, legend: MonthScheduleLegendItem[] | undefined): Tone {
77
+ if (!type) return 'outline';
78
+ const index = legend?.findIndex((item) => item.type === type) ?? -1;
79
+ if (index >= 0) return TYPE_TONES[index % TYPE_TONES.length];
80
+ // Stable hash fallback for types missing from the legend.
81
+ let hash = 0;
82
+ for (let i = 0; i < type.length; i += 1) hash = (hash * 31 + type.charCodeAt(i)) >>> 0;
83
+ return TYPE_TONES[hash % TYPE_TONES.length];
84
+ }
85
+
86
+ function monthOf(key: string): { year: number; month: number } {
87
+ const parts = parseDateKey(`${key}-01`);
88
+ return { year: parts?.year ?? 1970, month: parts?.month ?? 0 };
89
+ }
90
+
91
+ function shiftMonth(monthKey: string, delta: number): string {
92
+ const { year, month } = monthOf(monthKey);
93
+ const shifted = addMonths(`${year}-${String(month + 1).padStart(2, '0')}-01`, delta);
94
+ return shifted.slice(0, 7);
95
+ }
96
+
97
+ /**
98
+ * Month schedule: a month grid with dated events rendered inside each day,
99
+ * plus a legend and a small-screen agenda. Built on the same date utilities
100
+ * as Calendar; `today` stays explicit so server-rendered pages never read the
101
+ * server clock.
102
+ */
103
+ export function MonthSchedule<T>({
104
+ events,
105
+ getDate,
106
+ getLabel,
107
+ getType,
108
+ getHref,
109
+ month,
110
+ defaultMonth,
111
+ onMonthChange,
112
+ today,
113
+ locale = 'en-US',
114
+ weekStartsOn = 0,
115
+ maxPerDay = 3,
116
+ legend,
117
+ agendaBreakpoint = 'md',
118
+ linkComponent,
119
+ linkHrefProp = 'href',
120
+ 'aria-label': ariaLabel,
121
+ className,
122
+ }: MonthScheduleProps<T>) {
123
+ const resolvedToday = today ?? todayKey();
124
+ const Link = linkComponent ?? 'a';
125
+ const [internalMonth, setInternalMonth] = React.useState(
126
+ () => month ?? defaultMonth ?? resolvedToday.slice(0, 7)
127
+ );
128
+ const activeMonth = month ?? internalMonth;
129
+ const { year, month: monthIndex } = monthOf(activeMonth);
130
+
131
+ const byDay = React.useMemo(() => {
132
+ const map = new Map<string, T[]>();
133
+ for (const event of events) {
134
+ const key = getDate(event);
135
+ const list = map.get(key);
136
+ if (list) list.push(event);
137
+ else map.set(key, [event]);
138
+ }
139
+ for (const list of map.values()) {
140
+ list.sort((a, b) => getLabel(a).localeCompare(getLabel(b)));
141
+ }
142
+ return map;
143
+ }, [events, getDate, getLabel]);
144
+
145
+ const weeks = React.useMemo(
146
+ () => calendarWeeks(year, monthIndex, weekStartsOn),
147
+ [year, monthIndex, weekStartsOn]
148
+ );
149
+ const weekdays = React.useMemo(
150
+ () => weekdayLabels(locale, weekStartsOn),
151
+ [locale, weekStartsOn]
152
+ );
153
+ const monthName = monthLabel(year, monthIndex, locale);
154
+ const agendaDays = React.useMemo(
155
+ () =>
156
+ [...byDay.keys()]
157
+ .filter((key) => key.startsWith(activeMonth))
158
+ .sort()
159
+ .map((key) => ({ key, items: byDay.get(key) ?? [] })),
160
+ [byDay, activeMonth]
161
+ );
162
+
163
+ const page = (delta: number) => {
164
+ const next = shiftMonth(activeMonth, delta);
165
+ if (month === undefined) setInternalMonth(next);
166
+ onMonthChange?.(next);
167
+ };
168
+
169
+ const renderEvent = (event: T, key: string) => {
170
+ const label = getLabel(event);
171
+ const type = getType?.(event);
172
+ const tone = typeTone(type, legend);
173
+ const href = getHref?.(event);
174
+ const chip = (
175
+ <Badge variant={tone} size="sm" className="max-w-full truncate">
176
+ {label}
177
+ </Badge>
178
+ );
179
+ if (!href) return <span key={key}>{chip}</span>;
180
+ const destination = linkHrefProp === 'to' ? { to: href } : { href };
181
+ return (
182
+ <Link
183
+ key={key}
184
+ {...destination}
185
+ className="block max-w-full rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
186
+ >
187
+ {chip}
188
+ </Link>
189
+ );
190
+ };
191
+
192
+ const gridHidden = agendaBreakpoint === 'sm' ? 'hidden sm:block' : 'hidden md:block';
193
+ const agendaHidden = agendaBreakpoint === 'sm' ? 'sm:hidden' : 'md:hidden';
194
+
195
+ return (
196
+ <div className={cn('w-full select-none', className)}>
197
+ <div className="mb-2 flex items-center justify-between gap-2">
198
+ <Button
199
+ type="button"
200
+ variant="ghost"
201
+ size="icon"
202
+ aria-label="Previous month"
203
+ onClick={() => page(-1)}
204
+ >
205
+ ‹
206
+ </Button>
207
+ <div aria-live="polite" className="text-sm font-semibold text-foreground">
208
+ {monthName}
209
+ </div>
210
+ <Button
211
+ type="button"
212
+ variant="ghost"
213
+ size="icon"
214
+ aria-label="Next month"
215
+ onClick={() => page(1)}
216
+ >
217
+ ›
218
+ </Button>
219
+ </div>
220
+
221
+ <div
222
+ role="grid"
223
+ aria-label={ariaLabel ?? monthName}
224
+ className={cn('flex flex-col gap-1', gridHidden)}
225
+ >
226
+ <div role="row" className="grid grid-cols-7 gap-1 text-center text-xs text-muted-foreground">
227
+ {weekdays.map((weekday) => (
228
+ <span key={weekday} role="columnheader" aria-label={weekday} className="py-1">
229
+ {weekday}
230
+ </span>
231
+ ))}
232
+ </div>
233
+
234
+ {weeks.map((week) => (
235
+ <div key={week[0]?.key} role="row" className="grid grid-cols-7 gap-1">
236
+ {week.map((day) => {
237
+ const dayEvents = byDay.get(day.key) ?? [];
238
+ const visible = dayEvents.slice(0, maxPerDay);
239
+ const overflow = dayEvents.length - visible.length;
240
+ const isToday = day.key === resolvedToday;
241
+
242
+ return (
243
+ <div
244
+ key={day.key}
245
+ role="gridcell"
246
+ aria-current={isToday ? 'date' : undefined}
247
+ className={cn(
248
+ 'flex min-h-16 flex-col gap-0.5 rounded-md border border-transparent p-1',
249
+ !day.inMonth && 'opacity-50',
250
+ isToday && 'border-primary/40 bg-primary/5'
251
+ )}
252
+ >
253
+ <span
254
+ className={cn(
255
+ 'self-start px-1 text-xs tabular-nums',
256
+ isToday ? 'font-semibold text-primary-ink' : 'text-muted-foreground'
257
+ )}
258
+ >
259
+ {day.day}
260
+ </span>
261
+ {visible.map((event, index) =>
262
+ renderEvent(event, `${day.key}-${index}-${getLabel(event)}`)
263
+ )}
264
+ {overflow > 0 && (
265
+ <span className="px-1 text-[11px] text-muted-foreground">
266
+ +{overflow} more
267
+ </span>
268
+ )}
269
+ </div>
270
+ );
271
+ })}
272
+ </div>
273
+ ))}
274
+ </div>
275
+
276
+ <div className={cn('flex flex-col gap-3', agendaHidden)}>
277
+ {agendaDays.length === 0 ? (
278
+ <p className="py-6 text-center text-sm text-muted-foreground">No events this month.</p>
279
+ ) : (
280
+ agendaDays.map(({ key, items }) => (
281
+ <section key={key} aria-label={formatDateLabel(key, locale)}>
282
+ <h3 className="mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground">
283
+ {formatDateLabel(key, locale)}
284
+ </h3>
285
+ <ul className="flex flex-col gap-1">
286
+ {items.map((event, index) => {
287
+ const label = getLabel(event);
288
+ const type = getType?.(event);
289
+ const tone = typeTone(type, legend);
290
+ const href = getHref?.(event);
291
+ const row = (
292
+ <Badge variant={tone} size="sm" className="max-w-full truncate">
293
+ {label}
294
+ </Badge>
295
+ );
296
+ return (
297
+ <li key={`${key}-${index}-${label}`}>
298
+ {href ? (
299
+ <Link
300
+ {...(linkHrefProp === 'to' ? { to: href } : { href })}
301
+ className="block max-w-full rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
302
+ >
303
+ {row}
304
+ </Link>
305
+ ) : (
306
+ row
307
+ )}
308
+ </li>
309
+ );
310
+ })}
311
+ </ul>
312
+ </section>
313
+ ))
314
+ )}
315
+ </div>
316
+
317
+ {legend && legend.length > 0 && (
318
+ <ul className="mt-3 flex flex-wrap gap-x-4 gap-y-1" aria-label="Event types">
319
+ {legend.map((item) => (
320
+ <li key={item.type} className="flex items-center gap-1.5 text-xs text-muted-foreground">
321
+ <Badge variant={typeTone(item.type, legend)} size="sm">
322
+ {item.label}
323
+ </Badge>
324
+ </li>
325
+ ))}
326
+ </ul>
327
+ )}
328
+ </div>
329
+ );
330
+ }
331
+
332
+ MonthSchedule.displayName = 'MonthSchedule';
@@ -0,0 +1 @@
1
+ export * from './MonthSchedule';
@@ -29,6 +29,57 @@ describe('SegmentedControl', () => {
29
29
  expect(screen.getByRole('radio', { name: 'Investors' })).toHaveAttribute('aria-checked', 'false');
30
30
  });
31
31
 
32
+ it('renders option hints as aria-hidden markers with aria-description', () => {
33
+ render(
34
+ <SegmentedControl
35
+ aria-label="Discipline"
36
+ options={[
37
+ { value: 'amateur', label: 'Amateur' },
38
+ { value: 'proam', label: 'Pro-Am', hint: 'no Pro-Am ladder published' },
39
+ ]}
40
+ />
41
+ );
42
+ const proam = screen.getByRole('radio', { name: 'Pro-Am' });
43
+ expect(proam).toHaveAttribute('aria-description', 'no Pro-Am ladder published');
44
+ expect(proam.querySelector('[aria-hidden="true"]')).toHaveTextContent(
45
+ 'no Pro-Am ladder published'
46
+ );
47
+ });
48
+
49
+ it('applies full width at every viewport when fullWidth is true', () => {
50
+ render(
51
+ <SegmentedControl
52
+ aria-label="Layout"
53
+ fullWidth
54
+ options={[
55
+ { value: 'grid', label: 'Grid' },
56
+ { value: 'list', label: 'List' },
57
+ ]}
58
+ />
59
+ );
60
+ const group = screen.getByRole('radiogroup');
61
+ expect(group).toHaveClass('flex', 'w-full');
62
+ expect(screen.getByRole('radio', { name: 'Grid' })).toHaveClass('flex-1');
63
+ });
64
+
65
+ it('scopes full width below the breakpoint when fullWidth is a breakpoint', () => {
66
+ render(
67
+ <SegmentedControl
68
+ aria-label="Layout"
69
+ fullWidth="md"
70
+ options={[
71
+ { value: 'grid', label: 'Grid' },
72
+ { value: 'list', label: 'List' },
73
+ ]}
74
+ />
75
+ );
76
+ const group = screen.getByRole('radiogroup');
77
+ expect(group).toHaveClass('max-md:flex', 'max-md:w-full');
78
+ expect(group).not.toHaveClass('w-full');
79
+ expect(screen.getByRole('radio', { name: 'Grid' })).toHaveClass('max-md:flex-1');
80
+ expect(screen.getByRole('radio', { name: 'Grid' })).not.toHaveClass('flex-1');
81
+ });
82
+
32
83
  it('moves selection with arrow keys', () => {
33
84
  render(<ControlledExample />);
34
85
  const investors = screen.getByRole('radio', { name: 'Investors' });
@@ -8,6 +8,12 @@ export type SegmentedOption = {
8
8
  label: React.ReactNode;
9
9
  /** Optional leading icon. */
10
10
  icon?: React.ReactNode;
11
+ /**
12
+ * Optional trailing note (e.g. "no Pro-Am ladder"). Rendered as a small
13
+ * muted marker after the label and exposed to assistive tech via
14
+ * `aria-description`, so it does not change the accessible name.
15
+ */
16
+ hint?: string;
11
17
  disabled?: boolean;
12
18
  /**
13
19
  * Destination URL. When set the segment renders as a link instead of a
@@ -31,8 +37,13 @@ export type SegmentedControlProps = Omit<React.HTMLAttributes<HTMLDivElement>, '
31
37
  multiple?: boolean;
32
38
  /** Control density. Default 'md'. */
33
39
  size?: 'sm' | 'md' | 'lg';
34
- /** Stretch segments to fill the container width. */
35
- fullWidth?: boolean;
40
+ /**
41
+ * Stretch segments to fill the container width. `true` fills at every
42
+ * viewport; a breakpoint string ('sm' | 'md' | 'lg' | 'xl' | '2xl') fills
43
+ * only *below* that breakpoint and hugs content at and above it — the
44
+ * responsive pattern for "full-width on mobile, compact on desktop".
45
+ */
46
+ fullWidth?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
36
47
  /** Custom link element for routers (Next Link, react-router Link). */
37
48
  linkComponent?: React.ElementType;
38
49
  /** Prop used to pass the destination to `linkComponent`. */
@@ -45,6 +56,14 @@ const sizeClasses = {
45
56
  lg: 'h-10 px-4 text-sm',
46
57
  } as const;
47
58
 
59
+ const fullWidthBreakpoints = {
60
+ sm: 'max-sm',
61
+ md: 'max-md',
62
+ lg: 'max-lg',
63
+ xl: 'max-xl',
64
+ '2xl': 'max-2xl',
65
+ } as const;
66
+
48
67
  /**
49
68
  * Segmented control for switching a view or filter. Single-select uses radio
50
69
  * semantics and arrow-key navigation; multiple-select uses pressed buttons.
@@ -94,6 +113,9 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
94
113
  ? current
95
114
  : '';
96
115
 
116
+ const fullWidthBelow =
117
+ typeof fullWidth === 'string' ? fullWidthBreakpoints[fullWidth] : null;
118
+
97
119
  const linkMode = options.some((option) => option.href !== undefined);
98
120
  const LinkEl = linkComponent ?? 'a';
99
121
  const destination = (href: string) => (linkHrefProp === 'to' ? { to: href } : { href });
@@ -164,7 +186,8 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
164
186
  aria-label={ariaLabel}
165
187
  className={cn(
166
188
  'inline-flex items-center gap-1 rounded-lg border border-border bg-muted p-1',
167
- fullWidth && 'flex w-full',
189
+ fullWidth === true && 'flex w-full',
190
+ fullWidthBelow && `${fullWidthBelow}:flex ${fullWidthBelow}:w-full`,
168
191
  className
169
192
  )}
170
193
  {...props}
@@ -180,7 +203,8 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
180
203
  'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
181
204
  'disabled:pointer-events-none disabled:opacity-50',
182
205
  sizeClasses[size],
183
- fullWidth && 'flex-1',
206
+ fullWidth === true && 'flex-1',
207
+ fullWidthBelow && `${fullWidthBelow}:flex-1`,
184
208
  active
185
209
  ? 'bg-background text-foreground shadow-sm'
186
210
  : 'text-muted-foreground hover:text-foreground'
@@ -189,6 +213,11 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
189
213
  <>
190
214
  {option.icon && <span className="shrink-0 [&_svg]:size-4">{option.icon}</span>}
191
215
  <span className="truncate">{option.label}</span>
216
+ {option.hint && (
217
+ <span aria-hidden="true" className="shrink-0 text-[10px] font-normal text-muted-foreground/70">
218
+ {option.hint}
219
+ </span>
220
+ )}
192
221
  </>
193
222
  );
194
223
 
@@ -199,6 +228,7 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
199
228
  key={option.value}
200
229
  aria-current={active ? 'page' : undefined}
201
230
  aria-disabled={option.disabled || undefined}
231
+ aria-description={option.hint}
202
232
  className={cn(segmentClass, option.disabled && 'opacity-50')}
203
233
  >
204
234
  {segmentContent}
@@ -209,6 +239,7 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
209
239
  <LinkEl
210
240
  key={option.value}
211
241
  {...destination(option.href)}
242
+ aria-description={option.hint}
212
243
  className={segmentClass}
213
244
  >
214
245
  {segmentContent}
@@ -227,6 +258,7 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
227
258
  aria-checked={multiple || linkMode ? undefined : active}
228
259
  aria-pressed={multiple ? active : undefined}
229
260
  aria-current={linkMode && active ? 'page' : undefined}
261
+ aria-description={option.hint}
230
262
  disabled={option.disabled}
231
263
  tabIndex={focusable ? 0 : -1}
232
264
  onClick={() => select(option)}
package/src/index.ts CHANGED
@@ -36,6 +36,7 @@ export * from './components/link-tabs';
36
36
  export * from './components/theme-toggle';
37
37
  export * from './components/tooltip';
38
38
  export * from './components/calendar';
39
+ export * from './components/month-schedule';
39
40
  export * from './components/card';
40
41
  export * from './components/confirm-dialog';
41
42
  export * from './components/table-of-contents';
@@ -58,6 +59,7 @@ export * from './components/metric-card';
58
59
  export * from './components/password-input';
59
60
  export * from './components/auth-layout';
60
61
  export * from './components/filter-bar';
62
+ export * from './components/list-toolbar';
61
63
  export * from './components/date-picker';
62
64
  export * from './components/date-picker-popover';
63
65
  export * from './components/time-picker';
@@ -79,6 +81,7 @@ export * from './components/feature-row';
79
81
  export * from './components/testimonial';
80
82
  export * from './components/process-steps';
81
83
  export * from './components/article-card';
84
+ export * from './components/media-card';
82
85
  export * from './components/newsletter';
83
86
  export * from './components/contact-strip';
84
87
  export * from './components/announcement-bar';
@@ -138,7 +138,7 @@
138
138
  ],
139
139
  "package": "@slipstream-ui/core",
140
140
  "importPath": "@slipstream-ui/core",
141
- "version": "0.11.8",
141
+ "version": "0.11.10",
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.8",
94
+ "version": "0.11.10",
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.8",
7
+ "version": "0.11.10",
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.8",
217
+ "version": "0.11.10",
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.8",
7
+ "version": "0.11.10",
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.8",
7
+ "version": "0.11.10",
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.8",
127
+ "version": "0.11.10",
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.8",
197
+ "version": "0.11.10",
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.8",
155
+ "version": "0.11.10",
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.8",
220
+ "version": "0.11.10",
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.8",
104
+ "version": "0.11.10",
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.8",
127
+ "version": "0.11.10",
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.8",
132
+ "version": "0.11.10",
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.8",
108
+ "version": "0.11.10",
109
109
  "sourceDir": "button-group",
110
110
  "exportName": "ButtonGroup"
111
111
  }