@flamingo-stack/openframe-frontend-core 0.0.694 → 0.0.695-2521.7725.1

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 (125) hide show
  1. package/dist/{chunk-N7HFUBOV.js → chunk-3BDYBEYK.js} +3 -3
  2. package/dist/{chunk-NDLFK57D.cjs → chunk-3J72BXGD.cjs} +147 -22
  3. package/dist/chunk-3J72BXGD.cjs.map +1 -0
  4. package/dist/{chunk-LHYOESIQ.js → chunk-3NSXPDPL.js} +3 -3
  5. package/dist/{chunk-SYLLPIGU.cjs → chunk-7GX4V7MN.cjs} +30 -30
  6. package/dist/{chunk-SYLLPIGU.cjs.map → chunk-7GX4V7MN.cjs.map} +1 -1
  7. package/dist/{chunk-FNGX5WZM.cjs → chunk-AHHENQRW.cjs} +415 -391
  8. package/dist/chunk-AHHENQRW.cjs.map +1 -0
  9. package/dist/{chunk-TBR3UTFY.js → chunk-AJ5ZDCIS.js} +4 -4
  10. package/dist/{chunk-TV5SZJ3N.js → chunk-AO7TLP4R.js} +6 -6
  11. package/dist/{chunk-LPFU6U7O.cjs → chunk-CU642HLR.cjs} +3 -3
  12. package/dist/{chunk-LPFU6U7O.cjs.map → chunk-CU642HLR.cjs.map} +1 -1
  13. package/dist/{chunk-O4RDXDVS.js → chunk-DCXRG62W.js} +7 -7
  14. package/dist/{chunk-JB25CCOB.cjs → chunk-ENMV42NB.cjs} +33 -33
  15. package/dist/{chunk-JB25CCOB.cjs.map → chunk-ENMV42NB.cjs.map} +1 -1
  16. package/dist/{chunk-BW6YBATM.js → chunk-IPVN2LW6.js} +18 -9
  17. package/dist/{chunk-BW6YBATM.js.map → chunk-IPVN2LW6.js.map} +1 -1
  18. package/dist/{chunk-XZILGCXJ.js → chunk-JEHDODI6.js} +146 -21
  19. package/dist/{chunk-XZILGCXJ.js.map → chunk-JEHDODI6.js.map} +1 -1
  20. package/dist/{chunk-ZCPMWXIB.cjs → chunk-KQVPZLSD.cjs} +20 -20
  21. package/dist/{chunk-ZCPMWXIB.cjs.map → chunk-KQVPZLSD.cjs.map} +1 -1
  22. package/dist/{chunk-ZUGAHQDB.cjs → chunk-LEG44J2T.cjs} +5 -5
  23. package/dist/{chunk-ZUGAHQDB.cjs.map → chunk-LEG44J2T.cjs.map} +1 -1
  24. package/dist/{chunk-KJHIFF6H.cjs → chunk-LO7D7DUK.cjs} +12 -12
  25. package/dist/{chunk-KJHIFF6H.cjs.map → chunk-LO7D7DUK.cjs.map} +1 -1
  26. package/dist/{chunk-KDUDL4PB.cjs → chunk-M74KK6HX.cjs} +32 -32
  27. package/dist/{chunk-KDUDL4PB.cjs.map → chunk-M74KK6HX.cjs.map} +1 -1
  28. package/dist/{chunk-7VO6NC67.js → chunk-NLZLJJPJ.js} +3 -3
  29. package/dist/{chunk-KBSL4FCL.cjs → chunk-OGKQRKB6.cjs} +6 -6
  30. package/dist/{chunk-KBSL4FCL.cjs.map → chunk-OGKQRKB6.cjs.map} +1 -1
  31. package/dist/{chunk-GWQCUC53.js → chunk-P2OSB37L.js} +3 -3
  32. package/dist/{chunk-2EQED5SZ.cjs → chunk-PSWUL5RH.cjs} +28 -28
  33. package/dist/{chunk-2EQED5SZ.cjs.map → chunk-PSWUL5RH.cjs.map} +1 -1
  34. package/dist/{chunk-SJFB4Z4L.cjs → chunk-QFCPRHLK.cjs} +81 -81
  35. package/dist/{chunk-SJFB4Z4L.cjs.map → chunk-QFCPRHLK.cjs.map} +1 -1
  36. package/dist/{chunk-42LIHMRA.js → chunk-RP2OFHAZ.js} +3 -3
  37. package/dist/{chunk-C27F6GBZ.cjs → chunk-RPF7JVLS.cjs} +188 -179
  38. package/dist/chunk-RPF7JVLS.cjs.map +1 -0
  39. package/dist/{chunk-Q2B2MGFU.cjs → chunk-RVIEJLJP.cjs} +7 -7
  40. package/dist/{chunk-Q2B2MGFU.cjs.map → chunk-RVIEJLJP.cjs.map} +1 -1
  41. package/dist/{chunk-UCXZRJIE.js → chunk-SP5YC4B7.js} +5 -5
  42. package/dist/{chunk-K5K2FRQK.cjs → chunk-SXGJRY2G.cjs} +10 -10
  43. package/dist/{chunk-K5K2FRQK.cjs.map → chunk-SXGJRY2G.cjs.map} +1 -1
  44. package/dist/{chunk-JISKS7RJ.cjs → chunk-TBBVQGOT.cjs} +22 -22
  45. package/dist/{chunk-JISKS7RJ.cjs.map → chunk-TBBVQGOT.cjs.map} +1 -1
  46. package/dist/{chunk-TXSQLORA.js → chunk-TNKSQ3OL.js} +3 -3
  47. package/dist/{chunk-K5GSLGV2.cjs → chunk-U2FFSB6N.cjs} +15 -15
  48. package/dist/{chunk-K5GSLGV2.cjs.map → chunk-U2FFSB6N.cjs.map} +1 -1
  49. package/dist/{chunk-HJZ3UTUE.cjs → chunk-UE5UOHRT.cjs} +59 -59
  50. package/dist/{chunk-HJZ3UTUE.cjs.map → chunk-UE5UOHRT.cjs.map} +1 -1
  51. package/dist/{chunk-TA3JJFEO.js → chunk-UEMECIGD.js} +2 -2
  52. package/dist/{chunk-6ZSDKDOV.js → chunk-UOWWETCM.js} +6 -6
  53. package/dist/{chunk-NOMECDMA.js → chunk-UUDQ6H6U.js} +5 -5
  54. package/dist/{chunk-QP54LMXJ.js → chunk-V4RAE4UE.js} +32 -8
  55. package/dist/chunk-V4RAE4UE.js.map +1 -0
  56. package/dist/{chunk-HBMGSGZY.js → chunk-W52K7U5J.js} +4 -4
  57. package/dist/{chunk-33L2IR62.js → chunk-ZXIAKS6J.js} +2 -2
  58. package/dist/components/case-studies/index.cjs +16 -16
  59. package/dist/components/case-studies/index.js +4 -4
  60. package/dist/components/chat/entity-cards/program-card.d.ts +4 -2
  61. package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
  62. package/dist/components/chat/index.cjs +3 -3
  63. package/dist/components/chat/index.js +2 -2
  64. package/dist/components/contact/index.cjs +5 -5
  65. package/dist/components/contact/index.js +4 -4
  66. package/dist/components/docs/index.cjs +8 -8
  67. package/dist/components/docs/index.js +7 -7
  68. package/dist/components/embeds/index.cjs +5 -5
  69. package/dist/components/embeds/index.js +4 -4
  70. package/dist/components/faq/index.cjs +5 -5
  71. package/dist/components/faq/index.js +4 -4
  72. package/dist/components/features/cards-strip.d.ts +5 -0
  73. package/dist/components/features/cards-strip.d.ts.map +1 -1
  74. package/dist/components/features/index.cjs +4 -4
  75. package/dist/components/features/index.js +3 -3
  76. package/dist/components/help-center-pages/index.cjs +91 -91
  77. package/dist/components/help-center-pages/index.js +15 -15
  78. package/dist/components/index.cjs +55 -55
  79. package/dist/components/index.js +15 -15
  80. package/dist/components/meeting-scheduler/index.cjs +41 -41
  81. package/dist/components/meeting-scheduler/index.js +3 -3
  82. package/dist/components/navigation/index.cjs +7 -7
  83. package/dist/components/navigation/index.js +6 -6
  84. package/dist/components/onboarding-guides/index.cjs +7 -7
  85. package/dist/components/onboarding-guides/index.js +6 -6
  86. package/dist/components/related-content/index.cjs +3 -3
  87. package/dist/components/related-content/index.js +2 -2
  88. package/dist/components/tickets/index.cjs +8 -8
  89. package/dist/components/tickets/index.js +7 -7
  90. package/dist/components/ui/dashboard-info-card.d.ts +6 -1
  91. package/dist/components/ui/dashboard-info-card.d.ts.map +1 -1
  92. package/dist/components/ui/feature-card.d.ts +4 -0
  93. package/dist/components/ui/feature-card.d.ts.map +1 -1
  94. package/dist/components/ui/feature-list.d.ts +10 -3
  95. package/dist/components/ui/feature-list.d.ts.map +1 -1
  96. package/dist/components/ui/index.cjs +4 -4
  97. package/dist/components/ui/index.js +3 -3
  98. package/dist/index.cjs +9 -9
  99. package/dist/index.js +7 -7
  100. package/package.json +1 -1
  101. package/src/components/chat/entity-cards/program-card.tsx +167 -20
  102. package/src/components/features/__tests__/cards-strip-reverse.test.tsx +127 -0
  103. package/src/components/features/cards-strip.tsx +29 -7
  104. package/src/components/ui/dashboard-info-card.tsx +13 -1
  105. package/src/components/ui/feature-card.tsx +17 -3
  106. package/src/components/ui/feature-list.tsx +29 -3
  107. package/dist/chunk-C27F6GBZ.cjs.map +0 -1
  108. package/dist/chunk-FNGX5WZM.cjs.map +0 -1
  109. package/dist/chunk-NDLFK57D.cjs.map +0 -1
  110. package/dist/chunk-QP54LMXJ.js.map +0 -1
  111. /package/dist/{chunk-N7HFUBOV.js.map → chunk-3BDYBEYK.js.map} +0 -0
  112. /package/dist/{chunk-LHYOESIQ.js.map → chunk-3NSXPDPL.js.map} +0 -0
  113. /package/dist/{chunk-TBR3UTFY.js.map → chunk-AJ5ZDCIS.js.map} +0 -0
  114. /package/dist/{chunk-TV5SZJ3N.js.map → chunk-AO7TLP4R.js.map} +0 -0
  115. /package/dist/{chunk-O4RDXDVS.js.map → chunk-DCXRG62W.js.map} +0 -0
  116. /package/dist/{chunk-7VO6NC67.js.map → chunk-NLZLJJPJ.js.map} +0 -0
  117. /package/dist/{chunk-GWQCUC53.js.map → chunk-P2OSB37L.js.map} +0 -0
  118. /package/dist/{chunk-42LIHMRA.js.map → chunk-RP2OFHAZ.js.map} +0 -0
  119. /package/dist/{chunk-UCXZRJIE.js.map → chunk-SP5YC4B7.js.map} +0 -0
  120. /package/dist/{chunk-TXSQLORA.js.map → chunk-TNKSQ3OL.js.map} +0 -0
  121. /package/dist/{chunk-TA3JJFEO.js.map → chunk-UEMECIGD.js.map} +0 -0
  122. /package/dist/{chunk-6ZSDKDOV.js.map → chunk-UOWWETCM.js.map} +0 -0
  123. /package/dist/{chunk-NOMECDMA.js.map → chunk-UUDQ6H6U.js.map} +0 -0
  124. /package/dist/{chunk-HBMGSGZY.js.map → chunk-W52K7U5J.js.map} +0 -0
  125. /package/dist/{chunk-33L2IR62.js.map → chunk-ZXIAKS6J.js.map} +0 -0
@@ -2,9 +2,14 @@
2
2
 
3
3
  /**
4
4
  * ProgramCard (pure presentation). Generic card for podcasts / webinars /
5
- * events. Three densities — `default` (wide horizontal detail, archive
6
- * pages), `sm` (compact horizontal for chat-inline), and `portrait`
7
- * (vertical rail/strip card).
5
+ * events. Five densities — `default` (wide horizontal detail, archive
6
+ * pages), `sm` (compact horizontal for chat-inline), `portrait` (vertical
7
+ * rail/strip card), and the editorial pair a page section uses to lead with
8
+ * one item: `feature` (cover on top, label, title, date, description, person)
9
+ * beside `row`s (square cover, title, date · length · person, two lines).
10
+ *
11
+ * The cover is never tinted: a program's artwork carries its own marks, and a
12
+ * play glyph over a dimmed cover hid them. The whole card is the link.
8
13
  *
9
14
  * `portrait` exists because mixed-content rails MUST share ONE card anatomy
10
15
  * (2026 card-UI practice: a rail mixes content types, never card layouts —
@@ -23,6 +28,7 @@ import { ExternalLink, Clock, Play, Video } from 'lucide-react';
23
28
  import type React from 'react';
24
29
  import { useState } from 'react';
25
30
  import Image from '../../../embed-shims/next-image';
31
+ import { useImageEdgeColor } from '../../../hooks/ui/use-image-edge-color';
26
32
  import { cn } from '../../../utils/cn';
27
33
  import { formatProgramDate } from '../../../utils/format';
28
34
  import { isImageMedia } from '../../../utils/media-type';
@@ -54,7 +60,10 @@ import { EntityPortraitCard } from './entity-portrait-card';
54
60
  import { useEntityCardLink } from './use-entity-card-link';
55
61
  import { useEntityCardPlaceholder } from './use-entity-card-placeholder';
56
62
 
57
- type CardSize = 'default' | 'sm' | 'portrait';
63
+ type CardSize = 'default' | 'sm' | 'portrait' | 'feature' | 'row';
64
+
65
+ /** Sources narrower than this are contained on an edge-colour fill, never cropped. */
66
+ const MIN_WIDE_RATIO = 1.3;
58
67
 
59
68
  export function ProgramCardSkeleton({ size = 'default' }: { size?: CardSize }) {
60
69
  if (size === 'sm') {
@@ -127,6 +136,8 @@ export interface ProgramCardProps<T extends BaseProgramItem> {
127
136
  /** OG placeholder URL used by the compact branch when no cover. */
128
137
  placeholderUrl?: string | null;
129
138
  wholeCardClickable?: boolean;
139
+ /** `feature` density: the label above the title ("Latest episode"). */
140
+ eyebrow?: string;
130
141
  className?: string;
131
142
  }
132
143
 
@@ -211,6 +222,137 @@ function MediaGallery({ images, title }: { images: ProgramMedia[]; title: string
211
222
  );
212
223
  }
213
224
 
225
+ /**
226
+ * The editorial pair. `feature`: the cover across the top (a wide cover fills
227
+ * it, square artwork is contained on its own edge colour), then label, title,
228
+ * date · length, description and the person. `row`: a square cover beside the
229
+ * title, date · length · person and two lines of description.
230
+ */
231
+ function ProgramEditorialCard({
232
+ feature,
233
+ href,
234
+ target,
235
+ rel,
236
+ title,
237
+ description,
238
+ cover,
239
+ eyebrow,
240
+ date,
241
+ typeMeta,
242
+ profile,
243
+ className,
244
+ }: {
245
+ feature: boolean;
246
+ href: string;
247
+ target?: '_blank';
248
+ rel?: string;
249
+ title: string;
250
+ description?: string | null;
251
+ cover: string | null;
252
+ eyebrow?: string;
253
+ date: string | null;
254
+ typeMeta: string | null | undefined;
255
+ profile: ReturnType<typeof programItemToStripProfile>;
256
+ className?: string;
257
+ }) {
258
+ const [measured, setMeasured] = useState<{ src: string | null; isWide: boolean } | null>(null);
259
+ const isWide = measured?.src === cover ? measured.isWide : null;
260
+ const edgeColor = useImageEdgeColor(feature && isWide === false ? cover : null, 'var(--color-bg-surface)');
261
+ const frame =
262
+ 'group overflow-hidden rounded-lg border border-ods-border bg-ods-card no-underline transition-colors duration-200 hover:border-ods-accent';
263
+ const meta = (
264
+ <div className="flex flex-wrap items-center gap-x-[var(--spacing-system-s)] gap-y-[var(--spacing-system-xxs)] text-h6">
265
+ {date && <span className="text-ods-flamingo-pink">{date}</span>}
266
+ {[typeMeta, feature ? null : profile?.name]
267
+ .filter((part): part is string => !!part)
268
+ .map(part => (
269
+ <span key={part} className="flex items-center gap-[var(--spacing-system-s)] text-ods-text-secondary">
270
+ <span aria-hidden="true">•</span>
271
+ {part}
272
+ </span>
273
+ ))}
274
+ </div>
275
+ );
276
+
277
+ if (!feature) {
278
+ return (
279
+ <a
280
+ href={href}
281
+ target={target}
282
+ rel={rel}
283
+ aria-label={`Open ${title}`}
284
+ className={cn(
285
+ frame,
286
+ 'grid grid-cols-[88px_minmax(0,1fr)] items-center gap-[var(--spacing-system-m)] p-[var(--spacing-system-m)] sm:grid-cols-[120px_minmax(0,1fr)] sm:gap-[var(--spacing-system-l)]',
287
+ className,
288
+ )}
289
+ >
290
+ <span className="relative block aspect-square w-full overflow-hidden rounded-md bg-ods-bg">
291
+ {cover && <Image src={cover} alt="" fill sizes="120px" className="object-cover" unoptimized />}
292
+ </span>
293
+ <span className="flex min-w-0 flex-col gap-[var(--spacing-system-xs)]">
294
+ <span className="line-clamp-2 text-ods-text-primary text-h3">{title}</span>
295
+ {meta}
296
+ {description && <span className="line-clamp-2 text-ods-text-secondary text-h6">{description}</span>}
297
+ </span>
298
+ </a>
299
+ );
300
+ }
301
+
302
+ return (
303
+ <a
304
+ href={href}
305
+ target={target}
306
+ rel={rel}
307
+ aria-label={`Open ${title}`}
308
+ className={cn(frame, 'flex flex-col', className)}
309
+ >
310
+ <span
311
+ className="relative block aspect-video w-full overflow-hidden bg-ods-bg transition-colors duration-300"
312
+ style={isWide === false ? { backgroundColor: edgeColor } : undefined}
313
+ >
314
+ {cover && (
315
+ <Image
316
+ src={cover}
317
+ alt=""
318
+ fill
319
+ sizes="(min-width: 1024px) 640px, 100vw"
320
+ className={isWide === false ? 'object-contain' : 'object-cover'}
321
+ unoptimized
322
+ onLoad={e => {
323
+ const img = e.currentTarget;
324
+ if (img.naturalWidth > 0 && img.naturalHeight > 0) {
325
+ setMeasured({ src: cover, isWide: img.naturalWidth / img.naturalHeight >= MIN_WIDE_RATIO });
326
+ }
327
+ }}
328
+ />
329
+ )}
330
+ </span>
331
+ <span className="flex flex-col gap-[var(--spacing-system-s)] p-[var(--spacing-system-l)]">
332
+ {eyebrow && <span className="text-ods-text-secondary text-h5">{eyebrow}</span>}
333
+ <span className="line-clamp-2 text-ods-text-primary text-h3">{title}</span>
334
+ {meta}
335
+ {description && <span className="line-clamp-3 text-ods-text-secondary text-h4">{description}</span>}
336
+ {profile && (
337
+ <span className="flex min-w-0 items-center gap-[var(--spacing-system-s)] pt-[var(--spacing-system-xs)]">
338
+ <SquareAvatar
339
+ variant="round"
340
+ src={profile.avatarUrl || undefined}
341
+ alt={profile.name}
342
+ fallback={profile.name.charAt(0).toUpperCase()}
343
+ size="sm"
344
+ />
345
+ <span className="truncate text-h6">
346
+ <span className="text-ods-text-primary">{profile.name}</span>
347
+ {profile.subtitle && <span className="text-ods-text-secondary"> · {profile.subtitle}</span>}
348
+ </span>
349
+ </span>
350
+ )}
351
+ </span>
352
+ </a>
353
+ );
354
+ }
355
+
214
356
  export function ProgramCard<T extends BaseProgramItem>({
215
357
  config,
216
358
  item,
@@ -224,6 +366,7 @@ export function ProgramCard<T extends BaseProgramItem>({
224
366
  targetPlatform,
225
367
  placeholderUrl: placeholderUrlProp,
226
368
  wholeCardClickable = false,
369
+ eyebrow,
227
370
  className,
228
371
  }: ProgramCardProps<T>) {
229
372
  const { target, rel } = useEntityCardLink({
@@ -235,17 +378,12 @@ export function ProgramCard<T extends BaseProgramItem>({
235
378
  const placeholderUrl = useEntityCardPlaceholder({
236
379
  title: item.title,
237
380
  placeholderUrl: placeholderUrlProp,
238
- aspect: size === 'sm' ? 'square' : 'wide',
381
+ aspect: size === 'sm' || size === 'row' ? 'square' : 'wide',
239
382
  });
240
383
  const coverImage = item.cover_url;
241
384
  const images = media.filter(m => isImageMedia(m));
242
385
  const hosts = getHosts(item.hosts);
243
386
  const accentColor = 'var(--color-accent-primary)';
244
- // `status` / `duration_seconds` / `location_name` / `start_at` … live on the
245
- // concrete program shapes (PodcastItem / EventItem / WebinarItem), not on
246
- // `BaseProgramItem`. The `in` guards narrow them to `unknown`, so each read
247
- // below is followed by a real type check instead of a cast.
248
- const isScheduled = 'status' in item && item.status === 'scheduled';
249
387
 
250
388
  // The compact meta line, built by the ONE shared function — the chat card
251
389
  // renders the same string from the same code rather than mirroring it.
@@ -287,6 +425,25 @@ export function ProgramCard<T extends BaseProgramItem>({
287
425
  );
288
426
  }
289
427
 
428
+ if (size === 'feature' || size === 'row') {
429
+ return (
430
+ <ProgramEditorialCard
431
+ feature={size === 'feature'}
432
+ href={href}
433
+ target={target}
434
+ rel={rel}
435
+ title={item.title}
436
+ description={item.description}
437
+ cover={coverImage || placeholderUrl || null}
438
+ eyebrow={eyebrow}
439
+ date={formatProgramDate(zonedDate, 'weekday')}
440
+ typeMeta={compactTypeMetaValue}
441
+ profile={programItemToStripProfile(item)}
442
+ className={className}
443
+ />
444
+ );
445
+ }
446
+
290
447
  if (size === 'sm') {
291
448
  const itemDate = compactDate;
292
449
  const compactCover = coverImage || placeholderUrl || null;
@@ -310,11 +467,6 @@ export function ProgramCard<T extends BaseProgramItem>({
310
467
  )}
311
468
  </span>
312
469
  )}
313
- {config.type === 'podcast' && !isScheduled && compactCover && (
314
- <span className="absolute inset-0 flex items-center justify-center bg-black/30">
315
- <Play className="h-4 w-4 text-ods-text-on-dark" fill="white" />
316
- </span>
317
- )}
318
470
  </span>
319
471
  <span className={COMPACT_CARD_TEXT_COL}>
320
472
  <span className={COMPACT_CARD_TITLE_ROW}>
@@ -390,11 +542,6 @@ export function ProgramCard<T extends BaseProgramItem>({
390
542
  className="h-auto w-full rounded-lg object-contain"
391
543
  unoptimized
392
544
  />
393
- {config.type === 'podcast' && !isScheduled && (
394
- <div className="absolute inset-0 flex items-center justify-center rounded-lg bg-black/40 opacity-0 transition-opacity group-hover:opacity-100">
395
- <Play className="h-10 w-10 text-ods-text-on-dark" fill="white" />
396
- </div>
397
- )}
398
545
  </div>
399
546
  </div>
400
547
  )}
@@ -0,0 +1,127 @@
1
+ import { act, render } from '@testing-library/react';
2
+ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
3
+ import { CardsStrip } from '../cards-strip';
4
+
5
+ /**
6
+ * `reverse` flips the DIRECTION the marquee travels and nothing else. jsdom has
7
+ * no layout, so the strip is given one: a 500px viewport over a track whose
8
+ * single copy is 2000px wide, which makes it overflow and mount the marquee.
9
+ * Frames are driven by fake timers; the assertion reads the positions the
10
+ * engine WRITES to `scrollLeft` (recorded by the setter below), so the test
11
+ * needs no handle on the scroller element.
12
+ */
13
+ const VIEWPORT = 500;
14
+ const COPY = 2000;
15
+ const GAP = 16;
16
+
17
+ /** Every value written to an element's `scrollLeft`, in order. */
18
+ let writes: number[] = [];
19
+ const stored = new WeakMap<object, number>();
20
+
21
+ beforeAll(() => {
22
+ globalThis.ResizeObserver = class {
23
+ observe() {}
24
+ unobserve() {}
25
+ disconnect() {}
26
+ };
27
+ globalThis.IntersectionObserver = class {
28
+ observe() {}
29
+ unobserve() {}
30
+ disconnect() {}
31
+ takeRecords() {
32
+ return [];
33
+ }
34
+ root = null;
35
+ rootMargin = '';
36
+ thresholds = [];
37
+ };
38
+ window.matchMedia = (query: string) => ({
39
+ matches: false,
40
+ media: query,
41
+ onchange: null,
42
+ addEventListener: () => {},
43
+ removeEventListener: () => {},
44
+ addListener: () => {},
45
+ removeListener: () => {},
46
+ dispatchEvent: () => false,
47
+ });
48
+ Object.defineProperty(HTMLElement.prototype, 'clientWidth', { configurable: true, get: () => VIEWPORT });
49
+ Object.defineProperty(HTMLElement.prototype, 'scrollLeft', {
50
+ configurable: true,
51
+ get(this: HTMLElement) {
52
+ return stored.get(this) ?? 0;
53
+ },
54
+ set(this: HTMLElement, value: number) {
55
+ stored.set(this, value);
56
+ writes.push(value);
57
+ },
58
+ });
59
+ Object.defineProperty(HTMLElement.prototype, 'scrollWidth', {
60
+ configurable: true,
61
+ get(this: HTMLElement) {
62
+ // The track reports one copy, or two copies joined by one gap once cloned.
63
+ return this.dataset.copies === '2' ? COPY * 2 - GAP : COPY;
64
+ },
65
+ });
66
+ });
67
+
68
+ beforeEach(() => {
69
+ writes = [];
70
+ vi.useFakeTimers({
71
+ toFake: ['requestAnimationFrame', 'cancelAnimationFrame', 'performance', 'setTimeout', 'clearTimeout'],
72
+ });
73
+ });
74
+
75
+ afterEach(() => {
76
+ vi.useRealTimers();
77
+ });
78
+
79
+ /** Mount a strip, run its marquee for `ms`, and return the positions it wrote. */
80
+ function travel(reverse: boolean, ms: number): number[] {
81
+ render(
82
+ <CardsStrip showTitle={false} reverse={reverse} pauseOnHover={false}>
83
+ {Array.from({ length: 8 }, (_, i) => (
84
+ <div key={i}>card {i}</div>
85
+ ))}
86
+ </CardsStrip>,
87
+ );
88
+ for (let elapsed = 0; elapsed < ms; elapsed += 16) {
89
+ act(() => {
90
+ vi.advanceTimersByTime(16);
91
+ });
92
+ }
93
+ return writes;
94
+ }
95
+
96
+ /** +1 when the positions only grow, -1 when they only shrink, 0 otherwise (seam wraps ignored). */
97
+ function direction(positions: number[]): number {
98
+ const steps = positions
99
+ .slice(1)
100
+ .map((p, i) => p - positions[i])
101
+ .filter(d => d !== 0 && Math.abs(d) < COPY / 2);
102
+ if (steps.length === 0) return 0;
103
+ if (steps.every(d => d > 0)) return 1;
104
+ if (steps.every(d => d < 0)) return -1;
105
+ return 0;
106
+ }
107
+
108
+ describe('<CardsStrip reverse>', () => {
109
+ it('travels forward by default: scrollLeft grows', () => {
110
+ const positions = travel(false, 1500);
111
+ expect(positions.length).toBeGreaterThan(10);
112
+ expect(direction(positions)).toBe(1);
113
+ });
114
+
115
+ it('travels the other way when reversed: scrollLeft shrinks', () => {
116
+ const positions = travel(true, 1500);
117
+ expect(positions.length).toBeGreaterThan(10);
118
+ expect(direction(positions)).toBe(-1);
119
+ });
120
+
121
+ it('keeps a reversed strip inside the range a forward strip uses', () => {
122
+ for (const p of travel(true, 3000)) {
123
+ expect(p).toBeGreaterThanOrEqual(0);
124
+ expect(p).toBeLessThanOrEqual(COPY * 2);
125
+ }
126
+ });
127
+ });
@@ -94,6 +94,11 @@ interface CardsStripEngineProps {
94
94
  * default around 100px/s; 60 keeps drift lively while cards stay easy to
95
95
  * hover-target. 60px/s ≈ 1px per 60Hz frame, the smoothest integer step. */
96
96
  autoScrollSpeed?: number;
97
+ /** Reverse the marquee: the cards travel RIGHT instead of left. For a strip
98
+ * stacked under another one, so the two rows drift in opposite directions.
99
+ * Only the auto-scroll direction changes: chevrons, wheel, drag, the seam
100
+ * wrap and reduced motion behave exactly as on a forward strip. */
101
+ reverse?: boolean;
97
102
  /** Pause the marquee while a CARD is hovered (resumes as soon as the
98
103
  * pointer leaves the card — strip whitespace/heading never pauses). */
99
104
  pauseOnHover?: boolean;
@@ -221,6 +226,7 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
221
226
  headerSlot,
222
227
  autoScroll = true,
223
228
  autoScrollSpeed = 60,
229
+ reverse = false,
224
230
  pauseOnHover = true,
225
231
  showChevrons = true,
226
232
  prevLabel = 'Previous items',
@@ -484,6 +490,20 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
484
490
  return Math.max(0, Math.min(200, half / 4, half - viewport - TRACK_GAP_PX - 1));
485
491
  }, []);
486
492
 
493
+ // Engine position <-> scrollLeft. Forward they are the same number. Reversed,
494
+ // the engine still counts UP (it only knows one direction) while the scroller
495
+ // counts DOWN: `scrollLeft = 2*min + size - pos`, the mirror of the position
496
+ // inside the wrap range [min, min + size). The mirror is its own inverse, so
497
+ // the same function reads the scroller back into engine space.
498
+ const mirror = useCallback(
499
+ (value: number) => {
500
+ if (!reverse) return value;
501
+ const size = singleCopyWidthRef.current;
502
+ return size > 0 ? 2 * seamBuffer() + size - value : value;
503
+ },
504
+ [reverse, seamBuffer],
505
+ );
506
+
487
507
  const { posRef: marqueePosRef, glideBy } = useMarqueeEngine({
488
508
  // Viewport gates `active` (the rAF fully stops off-screen — a paused
489
509
  // engine would keep scheduling frames forever), same treatment as
@@ -498,9 +518,9 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
498
518
  getWrapMin: seamBuffer,
499
519
  apply: pos => {
500
520
  const scroller = scrollerRef.current;
501
- if (scroller) scroller.scrollLeft = pos;
521
+ if (scroller) scroller.scrollLeft = mirror(pos);
502
522
  },
503
- readBack: () => scrollerRef.current?.scrollLeft ?? 0,
523
+ readBack: () => mirror(scrollerRef.current?.scrollLeft ?? 0),
504
524
  onAfterFrame: syncHoverIfScrolled,
505
525
  });
506
526
 
@@ -596,13 +616,15 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
596
616
  if (marqueeActiveRef.current) {
597
617
  // Wrap-aware glide via the rAF engine (see engine comment) — clicks
598
618
  // accumulate distance instead of racing browser smooth-scroll targets.
599
- glideBy(dir * step);
619
+ // The glide is in ENGINE space: on a reversed strip "next" (scroller
620
+ // moves right) is a step BACK along the engine's axis.
621
+ glideBy((reverse ? -dir : dir) * step);
600
622
  } else {
601
623
  // No clones/seam without the marquee — native smooth scroll is safe.
602
624
  scroller.scrollBy({ left: dir * step, behavior: 'smooth' });
603
625
  }
604
626
  },
605
- [glideBy],
627
+ [glideBy, reverse],
606
628
  );
607
629
 
608
630
  const onUserScrollIntent = useCallback(() => {
@@ -651,13 +673,13 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
651
673
  if (sl >= half + buffer) {
652
674
  sl -= half;
653
675
  scroller.scrollLeft = sl;
654
- marqueePosRef.current = sl;
676
+ marqueePosRef.current = mirror(sl);
655
677
  } else if (sl < buffer) {
656
678
  sl += half;
657
679
  scroller.scrollLeft = sl;
658
- marqueePosRef.current = sl;
680
+ marqueePosRef.current = mirror(sl);
659
681
  }
660
- }, [syncHoverIfScrolled, seamBuffer, marqueePosRef]);
682
+ }, [syncHoverIfScrolled, seamBuffer, marqueePosRef, mirror]);
661
683
 
662
684
  // ---- render ----------------------------------------------------------------
663
685
 
@@ -78,6 +78,11 @@ export interface DashboardInfoCardProps {
78
78
  valueClassName?: string;
79
79
  /** Secondary text rendered beside the value (e.g. an entry/item count). */
80
80
  subValue?: ReactNode;
81
+ /**
82
+ * One line UNDER the value (what the number counts). A card with a caption
83
+ * grows to fit it instead of holding the fixed stat-tile height.
84
+ */
85
+ caption?: ReactNode;
81
86
  }
82
87
 
83
88
  export function DashboardInfoCard({
@@ -97,6 +102,7 @@ export function DashboardInfoCard({
97
102
  tooltip,
98
103
  valueClassName,
99
104
  subValue,
105
+ caption,
100
106
  }: DashboardInfoCardProps) {
101
107
  const formattedValue = typeof value === 'number' ? value.toLocaleString() : value;
102
108
 
@@ -204,6 +210,8 @@ export function DashboardInfoCard({
204
210
  </FloatingTooltip>
205
211
  )}
206
212
  </div>
213
+
214
+ {caption && <p className="text-ods-text-secondary text-h6">{caption}</p>}
207
215
  </div>
208
216
 
209
217
  {/* Progress indicator */}
@@ -218,12 +226,16 @@ export function DashboardInfoCard({
218
226
  const baseClassName =
219
227
  'bg-ods-card border border-ods-border rounded-md p-[var(--spacing-system-xsf)] md:p-[var(--spacing-system-m)] h-16 md:h-[104px] flex gap-[var(--spacing-system-s)] md:gap-[var(--spacing-system-m)] items-center transition-all';
220
228
 
229
+ // A caption is a third line: the fixed stat-tile height would clip it.
230
+ const captionClassName = caption ? 'h-auto md:h-auto' : undefined;
231
+
221
232
  if (href) {
222
233
  return (
223
234
  <Link
224
235
  href={href}
225
236
  className={cn(
226
237
  baseClassName,
238
+ captionClassName,
227
239
  'group cursor-pointer',
228
240
  'hover:border-ods-border-hover hover:bg-ods-card-hover',
229
241
  className,
@@ -234,5 +246,5 @@ export function DashboardInfoCard({
234
246
  );
235
247
  }
236
248
 
237
- return <div className={cn(baseClassName, className)}>{cardContent}</div>;
249
+ return <div className={cn(baseClassName, captionClassName, className)}>{cardContent}</div>;
238
250
  }
@@ -8,6 +8,10 @@ export interface FeatureCardItem {
8
8
  icon?: React.ComponentType<{ size?: number; color?: string; className?: string }>;
9
9
  iconColor?: string;
10
10
  title: string;
11
+ /** Small label above the title (a number such as "01", a category). */
12
+ eyebrow?: string;
13
+ /** One accent line under the title (a tagline). */
14
+ subtitle?: string;
11
15
  badge?: {
12
16
  text: string;
13
17
  variant?: 'card' | 'button';
@@ -153,9 +157,19 @@ export function FeatureCardGrid({
153
157
  </div>
154
158
  )}
155
159
 
156
- <h3 className="whitespace-pre-line tracking-[-0.64px] text-ods-text-primary text-h2">
157
- {item.title}
158
- </h3>
160
+ {item.eyebrow || item.subtitle ? (
161
+ <div className="flex flex-col gap-[var(--spacing-system-xsf)]">
162
+ {item.eyebrow && <span className="text-ods-text-secondary text-h5">{item.eyebrow}</span>}
163
+ <h3 className="whitespace-pre-line tracking-[-0.64px] text-ods-text-primary text-h2">
164
+ {item.title}
165
+ </h3>
166
+ {item.subtitle && <p className="text-ods-flamingo-pink text-h4">{item.subtitle}</p>}
167
+ </div>
168
+ ) : (
169
+ <h3 className="whitespace-pre-line tracking-[-0.64px] text-ods-text-primary text-h2">
170
+ {item.title}
171
+ </h3>
172
+ )}
159
173
 
160
174
  {item.content}
161
175
  </div>
@@ -3,18 +3,44 @@
3
3
  import type React from 'react';
4
4
 
5
5
  export interface FeatureListItemData {
6
- icon: React.ReactNode;
6
+ /** Shown in the boxed slot. Not used by the `numbered` variant. */
7
+ icon?: React.ReactNode;
7
8
  title: string;
8
9
  description: string;
9
10
  }
10
11
 
11
12
  export interface FeatureListProps {
12
- items: FeatureListItemData[];
13
+ items: readonly FeatureListItemData[];
13
14
  className?: string;
14
15
  iconBoxSize?: number;
16
+ /**
17
+ * `boxed` (default): one bordered card, a boxed icon per row.
18
+ * `numbered`: an ordered list of open rows separated by hairlines, each led
19
+ * by its two-digit number (process steps).
20
+ */
21
+ variant?: 'boxed' | 'numbered';
15
22
  }
16
23
 
17
- export function FeatureList({ items, className = '', iconBoxSize = 72 }: FeatureListProps) {
24
+ export function FeatureList({ items, className = '', iconBoxSize = 72, variant = 'boxed' }: FeatureListProps) {
25
+ if (variant === 'numbered') {
26
+ return (
27
+ <ol className={`flex flex-col ${className}`}>
28
+ {items.map((item, index) => (
29
+ <li
30
+ key={index}
31
+ className="grid grid-cols-[48px_minmax(0,1fr)] gap-[var(--spacing-system-m)] border-t border-ods-border py-[var(--spacing-system-l)] last:border-b"
32
+ >
33
+ <span className="text-ods-flamingo-pink text-h5">{String(index + 1).padStart(2, '0')}</span>
34
+ <div className="flex min-w-0 flex-col gap-[var(--spacing-system-xxs)]">
35
+ <h3 className="text-ods-text-primary text-h3">{item.title}</h3>
36
+ <p className="text-ods-text-secondary text-h4">{item.description}</p>
37
+ </div>
38
+ </li>
39
+ ))}
40
+ </ol>
41
+ );
42
+ }
43
+
18
44
  return (
19
45
  <div className={`flex flex-col overflow-hidden rounded-[6px] border border-ods-border bg-ods-bg ${className}`}>
20
46
  {items.map((item, index) => (