@sarimarcus/content-sites-ui 0.49.2 → 0.49.4

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All packages in the platform release in lockstep; entries are per release version.
4
4
 
5
+ ## 0.49.4 (2026-10-27)
6
+
7
+ - `affiliate`: `AffiliateCard` takes an optional `variant` through `AffiliateCardOptions`: `overlay` (default, unchanged look) or `quiet` (title under the photo, no gradient, outline CTA that fills on hover). On every card the trust lines (`labels.verified`, `labels.booksUp`) now sit above the CTA instead of below it, so the CTA closes the card and CTAs line up across a row however many lines each card shows: an HTML change on every page with affiliate cards (SLA-3515).
8
+
9
+ ## 0.49.3 (2026-10-26)
10
+
11
+ - `composed`: `CardCarousel` takes an optional `staticFrom="sm"` and `trackClass`. With `staticFrom` the strip is a carousel on phones only: from `sm` up the track stops scrolling and lays its cards out as `trackClass` says, its controls stay hidden, and an empty header is hidden. Without the new props the markup is unchanged (`render-diff` against 0.49.2: identical HTML). The controller now also removes the track's `tabindex` when there is nothing to scroll, so a carousel that fits is no longer an empty focus stop, and never shows controls for a track whose overflow is visible (SLA-3515).
12
+
5
13
  ## 0.49.2 (2026-10-26)
6
14
 
7
15
  - Analytics: a same-origin link inside a `[data-track-zone]` element now fires `internal_link_click` with the zone as `link_block`, so a page tracks clicks per section without tagging every card (SLA-3512).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarimarcus/content-sites-ui",
3
- "version": "0.49.2",
3
+ "version": "0.49.4",
4
4
  "description": "Universal Astro UI components, layout shell and design tokens shared by the content sites.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -50,6 +50,6 @@
50
50
  "@lucide/astro": "^1.23.0",
51
51
  "astro": "^7.0.6",
52
52
  "tailwindcss": "^4.1.18",
53
- "@sarimarcus/content-sites-core": "0.49.2"
53
+ "@sarimarcus/content-sites-core": "0.49.4"
54
54
  }
55
55
  }
@@ -10,6 +10,9 @@
10
10
  * Copy: neutral labels have English defaults. Lines that name a provider or make a claim (`labels.verified`,
11
11
  * `labels.booksUp`, `cheapPriceFrame`, `skipQueueFrame`) render only when the site passes them.
12
12
  *
13
+ * `variant="quiet"` puts the title under the photo and makes the CTA an outline button. The trust lines sit above the
14
+ * CTA, which closes the card, so CTAs line up across a row however many lines each card shows.
15
+ *
13
16
  * Kept for byte-identical adoption, each meant to be dropped later: `legacyFractionDigits` (fractional prices then
14
17
  * render with the currency's default maximum, e.g. "€8.5"), `skipQueueFrame` (shown over `cheapPriceFrame` when the
15
18
  * title contains "skip"), and `halfStarIds="index"` (the half-star clip id repeats when two card groups share a page;
@@ -18,7 +21,7 @@
18
21
  import type { ImageMetadata } from 'astro';
19
22
  import { deterministicId } from '@sarimarcus/content-sites-core/dom';
20
23
  import Badge from '../primitives/Badge.astro';
21
- import { CARD_LINK_CLASS, CARD_BODY_CLASS, CARD_CTA_CLASS, CARD_BADGE_CLASS } from './cardClasses';
24
+ import { CARD_LINK_CLASS, CARD_BODY_CLASS, CARD_CTA_CLASS, CARD_CTA_QUIET_CLASS, CARD_BADGE_CLASS } from './cardClasses';
22
25
  import Icon from '../primitives/Icon.astro';
23
26
  import type { AffiliateCardOptions } from './types';
24
27
  import { templateLine } from './templateText';
@@ -77,6 +80,7 @@ const {
77
80
  titleColorClass = 'text-overlay-foreground',
78
81
  booksUpClass = 'text-primary',
79
82
  halfStarIds = 'deterministic',
83
+ variant = 'overlay',
80
84
  class: className,
81
85
  } = Astro.props;
82
86
 
@@ -168,15 +172,22 @@ const priceFrame = skipQueueFrame && title.toLowerCase().includes('skip')
168
172
  class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"
169
173
  />
170
174
  )}
171
- <div class="absolute inset-0 bg-gradient-to-t from-overlay/95 via-overlay/40 to-transparent"></div>
172
- <h3
173
- class:list={["absolute bottom-3 left-4 right-4 text-xl sm:text-2xl font-semibold", titleColorClass, "leading-tight font-display [text-shadow:0_1px_3px_rgba(0,0,0,0.6)]"]}
174
- >
175
- {title}
176
- </h3>
175
+ {variant === 'overlay' && (
176
+ <Fragment>
177
+ <div class="absolute inset-0 bg-gradient-to-t from-overlay/95 via-overlay/40 to-transparent"></div>
178
+ <h3
179
+ class:list={["absolute bottom-3 left-4 right-4 text-xl sm:text-2xl font-semibold", titleColorClass, "leading-tight font-display [text-shadow:0_1px_3px_rgba(0,0,0,0.6)]"]}
180
+ >
181
+ {title}
182
+ </h3>
183
+ </Fragment>
184
+ )}
177
185
  </div>
178
186
 
179
187
  <div class={CARD_BODY_CLASS}>
188
+ {variant === 'quiet' && (
189
+ <h3 class="font-display text-lg font-medium leading-snug text-foreground mb-1.5">{title}</h3>
190
+ )}
180
191
  <p class="text-base text-muted-foreground line-clamp-2 mb-3">
181
192
  {description}
182
193
  </p>{skipTheLineBadge && ' '}{isSkipTheLine && (
@@ -251,16 +262,16 @@ const priceFrame = skipQueueFrame && title.toLowerCase().includes('skip')
251
262
  )}
252
263
 
253
264
  <div class="mt-auto">
254
- <span
255
- class={CARD_CTA_CLASS}
256
- >
257
- <Icon name="ticket" class="w-4 h-4" aria-hidden="true" /><Fragment set:html={templateLine(cta)} /></span>
258
265
  {hasReviews && verified && (
259
- <p class="text-xs text-muted-foreground text-center mt-2"><Fragment set:html={templateLine(verified(formattedReviewCount))} /></p>
266
+ <p class="text-xs text-muted-foreground text-center mb-2"><Fragment set:html={templateLine(verified(formattedReviewCount))} /></p>
260
267
  )}
261
268
  {isBestSeller && booksUp && (
262
- <p class:list={["text-xs", booksUpClass, "text-center mt-2"]}><Fragment set:html={templateLine(booksUp)} /></p>
269
+ <p class:list={["text-xs", booksUpClass, "text-center mb-2"]}><Fragment set:html={templateLine(booksUp)} /></p>
263
270
  )}
271
+ <span
272
+ class={variant === 'quiet' ? CARD_CTA_QUIET_CLASS : CARD_CTA_CLASS}
273
+ >
274
+ <Icon name="ticket" class="w-4 h-4" aria-hidden="true" /><Fragment set:html={templateLine(cta)} /></span>
264
275
  </div>
265
276
  </div>
266
277
  </a>
@@ -1,5 +1,8 @@
1
- // Class strings AffiliateCard and AmazonProductCard share: the whole-card link, its body, the CTA bar and corner badge.
1
+ // Class strings AffiliateCard and AmazonProductCard share: the whole-card link, its body, the CTA bar and corner badge
2
+ // (the quiet CTA is AffiliateCard's only).
2
3
  export const CARD_LINK_CLASS = 'group relative bg-card rounded-xl overflow-hidden card-lift border border-border flex flex-col h-full no-underline text-inherit focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2';
3
4
  export const CARD_BODY_CLASS = 'p-4 sm:p-5 flex flex-col flex-1';
4
- export const CARD_CTA_CLASS = 'flex items-center justify-center gap-2 w-full py-2.5 px-4 bg-primary text-primary-foreground font-medium rounded-lg group-hover:bg-primary/90 group-active:bg-primary/80 transition-colors';
5
+ const CTA_SHAPE = 'flex items-center justify-center gap-2 w-full';
6
+ export const CARD_CTA_CLASS = `${CTA_SHAPE} py-2.5 px-4 bg-primary text-primary-foreground font-medium rounded-lg group-hover:bg-primary/90 group-active:bg-primary/80 transition-colors`;
5
7
  export const CARD_BADGE_CLASS = 'absolute top-3 left-3 z-10 pointer-events-none !px-2.5 !py-1 !font-semibold';
8
+ export const CARD_CTA_QUIET_CLASS = `${CTA_SHAPE} py-2 px-4 border border-foreground/25 text-foreground font-medium rounded-lg group-hover:bg-primary group-hover:border-primary group-hover:text-primary-foreground transition-colors`;
@@ -24,6 +24,8 @@ export interface AffiliateCardOptions {
24
24
  titleColorClass?: string;
25
25
  booksUpClass?: string;
26
26
  halfStarIds?: 'deterministic' | 'index';
27
+ /** `overlay` (default): title over the photo, solid CTA. `quiet`: title under the photo, outline CTA. */
28
+ variant?: 'overlay' | 'quiet';
27
29
  }
28
30
 
29
31
  /** One card in an AffiliateCardSection or AffiliateCarousel: the card's own props, resolved by the site. */
@@ -8,6 +8,10 @@
8
8
  * The header always renders so the arrows exist even under a caller's own heading; the view-all link shows at every
9
9
  * width, so a capped carousel always offers an onward path (SLA-2368). The active dot takes `--carousel-dot` when the
10
10
  * site defines it (default: the primary role).
11
+ *
12
+ * `staticFrom="sm"` keeps the strip a carousel on phones only: from `sm` up the track stops scrolling and lays its
13
+ * cards out as `trackClass` says (e.g. `sm:grid sm:grid-cols-3`; give the cards `sm:w-auto`), and the controls
14
+ * stay hidden. A header with nothing in it is hidden from `sm` up too.
11
15
  */
12
16
  import Icon from '../primitives/Icon.astro';
13
17
  import { deterministicId } from '@sarimarcus/content-sites-core/dom';
@@ -36,6 +40,10 @@ interface Props {
36
40
  /** Accessible names of the arrows, given the carousel's name (undefined when it has none). */
37
41
  previousLabel?: (name: string | undefined) => string;
38
42
  nextLabel?: (name: string | undefined) => string;
43
+ /** From this breakpoint up the track stops scrolling and becomes a static layout (see the header comment). */
44
+ staticFrom?: 'sm';
45
+ /** Extra classes on the track, e.g. the static layout's grid. */
46
+ trackClass?: string;
39
47
  class?: string;
40
48
  }
41
49
 
@@ -51,6 +59,8 @@ const {
51
59
  regionLabel = LABELS.cardCarousel.regionLabel,
52
60
  previousLabel = LABELS.cardCarousel.previousLabel,
53
61
  nextLabel = LABELS.cardCarousel.nextLabel,
62
+ staticFrom,
63
+ trackClass: extraTrackClass,
54
64
  class: className,
55
65
  } = Astro.props;
56
66
 
@@ -66,10 +76,11 @@ const arrowClass =
66
76
  // The track stays swipable with no scrollbar; it is a keyboard focus stop, so it draws its own ring.
67
77
  const trackClass =
68
78
  '-mx-4 flex gap-4 overflow-x-auto scroll-px-4 px-4 py-1.5 snap-x snap-mandatory sm:mx-0 sm:scroll-px-0 sm:px-0 scrollbar-hide focus-visible:rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary';
79
+ const emptyHeader = !heading && !description && !viewAllHref && !Astro.slots.has('header-note');
69
80
  ---
70
81
 
71
82
  <div id={id} data-carousel={containerId} class:list={['scroll-mt-28', className]}>
72
- <div class="mb-5 flex items-end justify-between gap-4">
83
+ <div class:list={['mb-5 flex items-end justify-between gap-4', staticFrom === 'sm' && emptyHeader && 'sm:hidden']}>
73
84
  <div class="min-w-0 flex-1">
74
85
  {heading && (
75
86
  <HeadingTag class={headingClass ?? 'font-display text-2xl font-medium sm:text-3xl'}>{heading}</HeadingTag>
@@ -114,7 +125,7 @@ const trackClass =
114
125
  <div
115
126
  id={trackId}
116
127
  data-carousel-track
117
- class={trackClass}
128
+ class:list={[trackClass, staticFrom === 'sm' && 'sm:overflow-visible sm:snap-none sm:py-0', extraTrackClass]}
118
129
  aria-label={ariaLabel ?? heading ?? regionLabel}
119
130
  role="group"
120
131
  tabindex="0"
@@ -40,7 +40,8 @@ function initCarousel(section: HTMLElement): void {
40
40
  });
41
41
  }
42
42
 
43
- const isScrollable = () => track.scrollWidth - track.clientWidth > EDGE_SLOP;
43
+ // A static layout (staticFrom) can still overflow visibly; it never scrolls, so it never gets controls.
44
+ const isScrollable = () => getComputedStyle(track).overflowX !== 'visible' && track.scrollWidth - track.clientWidth > EDGE_SLOP;
44
45
 
45
46
  function updateUI(idx: number, atLeft?: number): void {
46
47
  const left = typeof atLeft === 'number' ? atLeft : track!.scrollLeft;
@@ -103,6 +104,9 @@ function initCarousel(section: HTMLElement): void {
103
104
  arrowsWrap?.classList.toggle('flex', show);
104
105
  dotsWrap?.classList.toggle('hidden', !show);
105
106
  dotsWrap?.classList.toggle('flex', show);
107
+ // A track with nothing to scroll is not a focus stop.
108
+ if (show) track.setAttribute('tabindex', '0');
109
+ else if (document.activeElement !== track) track.removeAttribute('tabindex');
106
110
  }
107
111
 
108
112
  if ('ResizeObserver' in window) {