@atelic-action/ui 3.14.1 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,7 +94,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
94
94
  | `ProcessSteps` | `@atelic-action/ui/sections` | A dark band of numbered steps beside a frame | [#process-steps](https://ui.atelic.me/#process-steps) |
95
95
  | `ProfileCards` | `@atelic-action/ui/sections` | Equal weight cards of media beside a short bio | [#profile-cards](https://ui.atelic.me/#profile-cards) |
96
96
  | `RevealSlider` | `@atelic-action/ui/sections` | Drag or arrow keys to compare two frames, each with its own toned shot brief before photography | [#reveal-slider](https://ui.atelic.me/#reveal-slider) |
97
- | `ReviewCarousel` | `@atelic-action/ui/sections` | The aggregate beside one large review at a time, stepped by dots and arrows | [#review-carousel](https://ui.atelic.me/#review-carousel) |
97
+ | `ReviewCarousel` | `@atelic-action/ui/sections` | The aggregate beside one large review at a time, stepped by dots and arrows, each review linking to its source | [#review-carousel](https://ui.atelic.me/#review-carousel) |
98
98
  | `ReviewWall` | `@atelic-action/ui/sections` | The reviews page: tag filter and sort when the data carries them, clamped quotes behind Read more | [#review-wall](https://ui.atelic.me/#review-wall) |
99
99
  | `SocialStrip` | `@atelic-action/ui/sections` | A static grid of the business's social photos linking to the profile, never a live embed | [#social-strip](https://ui.atelic.me/#social-strip) |
100
100
  | `SplitSection` | `@atelic-action/ui/sections` | The two column band: copy beside copy, or media beside copy | [#split-section](https://ui.atelic.me/#split-section) |
@@ -497,7 +497,7 @@ export function SiteShell(props: Omit<SiteShellProps, "currentPath" | "basePath"
497
497
  | `ComparisonTable` | A graded before and after that scrolls sideways on a phone rather than reflowing |
498
498
  | `RevealSlider` | Drag or arrow keys to compare two frames, each with its own toned shot brief before photography |
499
499
  | `DeviceShowcase` | A desktop browser frame with a phone overlapping it |
500
- | `ReviewCarousel` | The aggregate beside one large review at a time, stepped by dots and arrows |
500
+ | `ReviewCarousel` | The aggregate beside one large review at a time, stepped by dots and arrows, each review linking to its source |
501
501
  | `ReviewWall` | The reviews page: tag filter and sort when the data carries them, clamped quotes behind Read more |
502
502
  | `PressQuotes` | Rows of press quotes and awards with source and year, newest first (`sortPress` beside it) |
503
503
  | `ProfileCards` | Equal weight cards of media beside a short bio |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atelic-action/ui",
3
- "version": "3.14.1",
3
+ "version": "3.15.0",
4
4
  "description": "Shared UI for the Atelic templates: site chrome, base styles, the component library, the access gate, and the app shell they install",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -1,5 +1,6 @@
1
1
  import { ArrowUpRight, ChevronLeft, ChevronRight } from "lucide-react";
2
2
  import { type KeyboardEvent, type ReactNode, useState } from "react";
3
+ import { newTabProps } from "../lib/newTabProps";
3
4
  import { Eyebrow } from "../primitives";
4
5
  import { StarRow } from "../primitives/StarRow";
5
6
  import type { ReviewItem } from "./ReviewWall";
@@ -35,6 +36,12 @@ export interface ReviewCarouselProps {
35
36
  stats?: ReviewStat[];
36
37
  /** The reviews, shown one at a time. */
37
38
  items: ReviewItem[];
39
+ /**
40
+ * The label of the link under a review to where it was written, for a
41
+ * review that carries a `sourceURL`, e.g. "View on Google". A review with
42
+ * no `sourceURL` gets no link. Defaults to "View review".
43
+ */
44
+ sourceLabel?: string;
38
45
  /** Accessible name for the carousel region. */
39
46
  ariaLabel?: string;
40
47
  id?: string;
@@ -82,6 +89,7 @@ export function ReviewCarousel({
82
89
  lead,
83
90
  stats,
84
91
  items,
92
+ sourceLabel = "View review",
85
93
  ariaLabel = "Customer reviews",
86
94
  id,
87
95
  className,
@@ -97,7 +105,10 @@ export function ReviewCarousel({
97
105
 
98
106
  // Left/right step the carousel whenever focus sits on one of its
99
107
  // controls, the keyboard convention for a paged region.
108
+ // A link inside a slide keeps its own arrow keys: stepping from it would
109
+ // hide the slide that holds focus.
100
110
  function onKeyDown(event: KeyboardEvent<HTMLDivElement>) {
111
+ if ((event.target as HTMLElement).closest?.("a")) return;
101
112
  if (event.key === "ArrowLeft") {
102
113
  event.preventDefault();
103
114
  go(index - 1);
@@ -178,6 +189,16 @@ export function ReviewCarousel({
178
189
  <figcaption className="rvc-who">
179
190
  <span className="rvc-name">{item.by}</span>
180
191
  {item.detail && <span className="rvc-detail">{item.detail}</span>}
192
+ {item.sourceURL && (
193
+ <a
194
+ className="rvc-source"
195
+ href={item.sourceURL}
196
+ {...newTabProps(item.sourceURL, true)}
197
+ >
198
+ {sourceLabel}
199
+ <ArrowUpRight size={14} strokeWidth={2} aria-hidden="true" />
200
+ </a>
201
+ )}
181
202
  </figcaption>
182
203
  </figure>
183
204
  ))}
@@ -198,10 +219,14 @@ export function ReviewCarousel({
198
219
  ))}
199
220
  </div>
200
221
  <div className="rvc-arrows">
222
+ {/* With one review there is nowhere to step, so the arrows stay
223
+ in place, greyed and inert, rather than vanishing and shifting
224
+ the dots. */}
201
225
  <button
202
226
  type="button"
203
227
  className="rvc-arrow"
204
228
  aria-label="Previous review"
229
+ disabled={count <= 1}
205
230
  onClick={() => go(index - 1)}
206
231
  >
207
232
  <ChevronLeft size={18} strokeWidth={2} aria-hidden="true" />
@@ -210,6 +235,7 @@ export function ReviewCarousel({
210
235
  type="button"
211
236
  className="rvc-arrow"
212
237
  aria-label="Next review"
238
+ disabled={count <= 1}
213
239
  onClick={() => go(index + 1)}
214
240
  >
215
241
  <ChevronRight size={18} strokeWidth={2} aria-hidden="true" />
@@ -2558,7 +2558,37 @@
2558
2558
  background: var(--surface-alt);
2559
2559
  border-color: var(--neutral-300);
2560
2560
  }
2561
+ /* One review: the arrows stay, greyed, with nothing to do. */
2562
+ .atelic-ui .rvc-arrow:disabled,
2563
+ .atelic-ui .rvc-arrow:disabled:hover {
2564
+ opacity: 0.4;
2565
+ cursor: default;
2566
+ background: var(--card);
2567
+ border-color: var(--neutral-200);
2568
+ }
2569
+ /* The link under a review to where it was written: the caption link's
2570
+ quiet idiom, set small on its own line of the attribution. */
2571
+ .atelic-ui .rvc-source {
2572
+ display: inline-flex;
2573
+ align-self: flex-start;
2574
+ align-items: center;
2575
+ gap: 3px;
2576
+ margin-top: 6px;
2577
+ font-size: 0.85rem;
2578
+ color: var(--ink-soft);
2579
+ text-decoration: underline;
2580
+ text-decoration-color: var(--neutral-300);
2581
+ text-underline-offset: 3px;
2582
+ transition:
2583
+ color 0.2s ease,
2584
+ text-decoration-color 0.2s ease;
2585
+ }
2586
+ .atelic-ui .rvc-source:hover {
2587
+ color: var(--primary);
2588
+ text-decoration-color: currentColor;
2589
+ }
2561
2590
  .atelic-ui .rvc-arrow:focus-visible,
2591
+ .atelic-ui .rvc-source:focus-visible,
2562
2592
  .atelic-ui .rvc-dot:focus-visible {
2563
2593
  outline: 2px solid var(--primary);
2564
2594
  outline-offset: 3px;