@atelic-action/ui 7.1.0 → 8.0.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.
Files changed (105) hide show
  1. package/README.md +313 -127
  2. package/package.json +14 -10
  3. package/src/app/ErrorFallback.tsx +6 -2
  4. package/src/app/context/AppContext.tsx +10 -1
  5. package/src/app/index.ts +0 -1
  6. package/src/app/layout/AppPage.tsx +36 -7
  7. package/src/app/layout/DesktopRail.tsx +9 -2
  8. package/src/app/layout/MobileMenu.tsx +5 -1
  9. package/src/app/layout/PageError.tsx +6 -3
  10. package/src/app/layout/PageSkeleton.tsx +33 -26
  11. package/src/app/layout/UserMenu.tsx +12 -6
  12. package/src/app/ui/alert.tsx +41 -11
  13. package/src/app/ui/badge.tsx +1 -1
  14. package/src/app/ui/button.tsx +2 -1
  15. package/src/app/ui/command.tsx +86 -21
  16. package/src/app/ui/country-dropdown.tsx +26 -47
  17. package/src/app/ui/form.tsx +46 -7
  18. package/src/app/ui/pagination.tsx +1 -1
  19. package/src/app/ui/progress.tsx +26 -12
  20. package/src/app/ui/search-input.tsx +16 -3
  21. package/src/app/ui/select.tsx +8 -3
  22. package/src/app/ui/slider.tsx +62 -15
  23. package/src/artifact/ArtifactShell.tsx +8 -3
  24. package/src/artifact/ErrorFallback.tsx +8 -1
  25. package/src/artifact/artifactConfig.ts +1 -1
  26. package/src/chrome/BrandLockup.tsx +71 -16
  27. package/src/chrome/ClosingBar.tsx +8 -5
  28. package/src/chrome/ContactDock.tsx +329 -0
  29. package/src/chrome/Footer.tsx +32 -9
  30. package/src/chrome/NavBadge.tsx +8 -0
  31. package/src/chrome/NavMegaPanel.tsx +388 -0
  32. package/src/chrome/SiteHeader.tsx +235 -18
  33. package/src/chrome/SiteMenu.tsx +197 -19
  34. package/src/chrome/SiteShell.tsx +130 -13
  35. package/src/chrome/StickyCTABar.tsx +56 -2
  36. package/src/chrome/brandMark.ts +56 -0
  37. package/src/chrome/icons.ts +58 -0
  38. package/src/chrome/index.ts +16 -0
  39. package/src/chrome/navSections.ts +55 -0
  40. package/src/components/ColumnChart.tsx +27 -2
  41. package/src/components/DataTable.tsx +104 -85
  42. package/src/components/Disclosure.tsx +3 -1
  43. package/src/components/Hint.tsx +3 -24
  44. package/src/components/NotFound.tsx +4 -1
  45. package/src/components/StarRating.tsx +45 -19
  46. package/src/components/ThresholdScale.tsx +36 -26
  47. package/src/email/atoms.tsx +13 -57
  48. package/src/email/frame.tsx +4 -6
  49. package/src/email/index.ts +4 -10
  50. package/src/email/scoreboard.tsx +107 -186
  51. package/src/email/text.ts +30 -0
  52. package/src/email/theme.tsx +76 -9
  53. package/src/hooks/useDismiss.ts +39 -0
  54. package/src/lib/useScrollsSideways.ts +26 -0
  55. package/src/primitives/Button.tsx +2 -0
  56. package/src/primitives/ProseBlocks.tsx +6 -1
  57. package/src/primitives/SectionHeading.tsx +3 -1
  58. package/src/primitives/StarRow.tsx +23 -8
  59. package/src/sections/BlogIndex.tsx +17 -3
  60. package/src/sections/BlogPost.tsx +10 -1
  61. package/src/sections/CTASection.tsx +2 -2
  62. package/src/sections/CalloutPanel.tsx +34 -0
  63. package/src/sections/ComparisonTable.tsx +23 -2
  64. package/src/sections/ContactForm.tsx +61 -17
  65. package/src/sections/FAQBrowser.tsx +11 -2
  66. package/src/sections/FeatureGrid.tsx +6 -2
  67. package/src/sections/FullBleedVideo.tsx +158 -0
  68. package/src/sections/Gallery.tsx +6 -4
  69. package/src/sections/Hero.tsx +63 -39
  70. package/src/sections/JumpRail.tsx +7 -0
  71. package/src/sections/LegalPage.tsx +10 -2
  72. package/src/sections/LinkColumns.tsx +64 -0
  73. package/src/sections/LocationSection.tsx +28 -5
  74. package/src/sections/Locations.tsx +17 -4
  75. package/src/sections/LogoMarquee.tsx +43 -11
  76. package/src/sections/MapEmbed.tsx +13 -9
  77. package/src/sections/PageHero.tsx +16 -2
  78. package/src/sections/ProcessSteps.tsx +27 -4
  79. package/src/sections/ProfileCards.tsx +12 -2
  80. package/src/sections/ProofStrip.tsx +44 -0
  81. package/src/sections/RevealSlider.tsx +28 -7
  82. package/src/sections/ReviewCarousel.tsx +17 -4
  83. package/src/sections/ReviewWall.tsx +2 -2
  84. package/src/sections/SplitSection.tsx +2 -1
  85. package/src/sections/index.ts +15 -6
  86. package/src/sections/siteConfig.ts +66 -3
  87. package/src/styles/app.css +24 -2
  88. package/src/styles/artifact.css +20 -8
  89. package/src/styles/base.css +42 -13
  90. package/src/styles/chrome.css +938 -48
  91. package/src/styles/components.css +104 -65
  92. package/src/styles/defaults.css +137 -0
  93. package/src/styles/gate.css +21 -10
  94. package/src/styles/primitives.css +97 -35
  95. package/src/styles/sections.css +477 -437
  96. package/src/styles/star-rating.css +1 -4
  97. package/src/tokens/palettes.ts +24 -4
  98. package/src/types.ts +212 -2
  99. package/src/app/CardErrorBoundary.tsx +0 -39
  100. package/src/sections/CTABanner.tsx +0 -93
  101. package/src/sections/DeviceShowcase.tsx +0 -39
  102. package/src/sections/MediaBand.tsx +0 -20
  103. package/src/sections/MenuList.tsx +0 -44
  104. package/src/sections/PressQuotes.tsx +0 -51
  105. package/src/sections/SocialStrip.tsx +0 -83
@@ -0,0 +1,39 @@
1
+ import { type RefObject, useEffect, useRef } from "react";
2
+
3
+ /** What closed it: the Escape key, or a press somewhere outside. */
4
+ export type DismissReason = "escape" | "outside";
5
+
6
+ /**
7
+ * Closes a popover, a panel, or a menu the two ways a reader expects: the
8
+ * Escape key, and a press anywhere outside the element `ref` holds. It
9
+ * listens only while `active`, on the document, and calls `onDismiss` with
10
+ * the reason, so the caller decides what else to do (hand focus back on
11
+ * Escape, leave it where the press put it). The latest `onDismiss` is always
12
+ * the one called, so a caller can pass an inline function. Used by `Hint`,
13
+ * `SiteHeader`, and `ContactDock`; it touches the document only inside an
14
+ * effect, so a component using it still prerenders.
15
+ */
16
+ export function useDismiss(
17
+ active: boolean,
18
+ ref: RefObject<HTMLElement | null>,
19
+ onDismiss: (reason: DismissReason) => void,
20
+ ): void {
21
+ const latest = useRef(onDismiss);
22
+ latest.current = onDismiss;
23
+
24
+ useEffect(() => {
25
+ if (!active) return;
26
+ const onKey = (event: KeyboardEvent) => {
27
+ if (event.key === "Escape") latest.current("escape");
28
+ };
29
+ const onPointer = (event: PointerEvent) => {
30
+ if (!ref.current?.contains(event.target as Node)) latest.current("outside");
31
+ };
32
+ document.addEventListener("keydown", onKey);
33
+ document.addEventListener("pointerdown", onPointer);
34
+ return () => {
35
+ document.removeEventListener("keydown", onKey);
36
+ document.removeEventListener("pointerdown", onPointer);
37
+ };
38
+ }, [active, ref]);
39
+ }
@@ -0,0 +1,26 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+
3
+ /**
4
+ * Whether a box is narrower than what it holds, kept current as either
5
+ * resizes. False on the server and until the first measure, so the box only
6
+ * takes a tab stop and a name once it actually scrolls: a scrolling region a
7
+ * keyboard cannot reach fails axe's `scrollable-region-focusable`, and one
8
+ * that takes a tab stop while it holds nothing to scroll is a stop for
9
+ * nothing. Used by `DataTable` and `ComparisonTable`.
10
+ */
11
+ export function useScrollsSideways<T extends HTMLElement = HTMLDivElement>() {
12
+ const ref = useRef<T>(null);
13
+ const [active, setActive] = useState(false);
14
+ useEffect(() => {
15
+ const box = ref.current;
16
+ if (!box) return;
17
+ const measure = () => setActive(box.scrollWidth > box.clientWidth + 1);
18
+ measure();
19
+ if (typeof ResizeObserver === "undefined") return;
20
+ const observer = new ResizeObserver(measure);
21
+ observer.observe(box);
22
+ if (box.firstElementChild) observer.observe(box.firstElementChild);
23
+ return () => observer.disconnect();
24
+ }, []);
25
+ return { ref, active };
26
+ }
@@ -19,6 +19,7 @@ export interface ButtonProps {
19
19
  newTab?: boolean;
20
20
  /** Renders a real button element (e.g. form submit) when set. */
21
21
  type?: "submit" | "button";
22
+ /** Called on a click, whether the button is a link or a real button. */
22
23
  onClick?: () => void;
23
24
  ariaLabel?: string;
24
25
  className?: string;
@@ -69,6 +70,7 @@ export function Button({
69
70
  className={classes}
70
71
  style={style}
71
72
  aria-label={ariaLabel}
73
+ onClick={onClick}
72
74
  {...newTabProps(href, newTab)}
73
75
  >
74
76
  {content}
@@ -162,7 +162,12 @@ function Figure({ block, withBase }: { block: ProseBlock; withBase: (path: strin
162
162
  ref={dialogRef}
163
163
  className="pb-lightbox"
164
164
  aria-label={label}
165
- onClose={() => setOpen(false)}
165
+ // The close event lands a task after the dialog shuts, so a tile
166
+ // pressed again inside that task has already reopened it: a close
167
+ // heard while the dialog is open again is that stale one, and ignored.
168
+ onClose={(event) => {
169
+ if (!event.currentTarget.open) setOpen(false);
170
+ }}
166
171
  onClick={(event) => {
167
172
  // A click that lands outside the panel's box is a click on the backdrop; the
168
173
  // panel's own padding and blank areas also target the dialog, so test coordinates.
@@ -27,7 +27,9 @@ export function SectionHeading({
27
27
  as: Heading = "h2",
28
28
  className,
29
29
  }: SectionHeadingProps) {
30
- const classes = ["section-head", center && "center", className].filter(Boolean).join(" ");
30
+ const classes = ["section-head", center && "center", onDark && "on-dark", className]
31
+ .filter(Boolean)
32
+ .join(" ");
31
33
  return (
32
34
  <div className={classes}>
33
35
  {eyebrow && (
@@ -1,28 +1,42 @@
1
- import { Star } from "lucide-react";
1
+ import { Star, StarHalf } from "lucide-react";
2
2
 
3
3
  export interface StarRowProps {
4
- /** Star count, 1 to 5. Rounded and clamped into range. */
4
+ /**
5
+ * The rating, 1 to 5, clamped into range. It is said as given (to one
6
+ * decimal) and drawn to the nearest half star, so a 4.5 reads and shows
7
+ * as four and a half, never as five.
8
+ */
5
9
  rating: number;
6
10
  /** Glyph size in px. */
7
11
  size?: number;
8
12
  className?: string;
9
13
  }
10
14
 
15
+ /** The rating clamped to 1 to 5 and kept to one decimal, as it is said. */
16
+ function spoken(rating: number): number {
17
+ return Math.round(Math.max(1, Math.min(5, rating)) * 10) / 10;
18
+ }
19
+
11
20
  /**
12
21
  * A row of filled stars, rendered as a single labeled image so screen
13
- * readers announce "4 out of 5 stars" instead of four decorative glyphs.
14
- * Shared by the review components; render one only when the source
15
- * actually shows a rating — never invent one.
22
+ * readers announce "4.5 out of 5 stars" instead of the decorative glyphs.
23
+ * Whole stars draw filled and a half star draws as one; a whole rating
24
+ * looks as it always has. Shared by the review components; render one only
25
+ * when the source actually shows a rating, never invent one.
16
26
  */
17
27
  export function StarRow({ rating, size = 15, className }: StarRowProps) {
18
- const count = Math.max(1, Math.min(5, Math.round(rating)));
28
+ const value = spoken(rating);
29
+ // Drawn to the nearest half: 4.3 shows four and a half, 4.2 shows four.
30
+ const halves = Math.round(value * 2);
31
+ const whole = Math.floor(halves / 2);
32
+ const half = halves % 2 === 1;
19
33
  return (
20
34
  <span
21
35
  className={["star-row", className].filter(Boolean).join(" ")}
22
36
  role="img"
23
- aria-label={`${count} out of 5 stars`}
37
+ aria-label={`${value} out of 5 stars`}
24
38
  >
25
- {Array.from({ length: count }, (_, i) => (
39
+ {Array.from({ length: whole }, (_, i) => (
26
40
  <Star
27
41
  // biome-ignore lint/suspicious/noArrayIndexKey: static decorative row
28
42
  key={i}
@@ -32,6 +46,7 @@ export function StarRow({ rating, size = 15, className }: StarRowProps) {
32
46
  aria-hidden="true"
33
47
  />
34
48
  ))}
49
+ {half && <StarHalf size={size} strokeWidth={1.5} fill="currentColor" aria-hidden="true" />}
35
50
  </span>
36
51
  );
37
52
  }
@@ -1,5 +1,6 @@
1
1
  import { displayDate } from "../lib/displayDate";
2
2
  import { useWithBase } from "../routing/BasePathProvider";
3
+ import type { Surface } from "./siteConfig";
3
4
 
4
5
  export interface BlogIndexItem {
5
6
  slug: string;
@@ -16,22 +17,35 @@ export interface BlogIndexProps {
16
17
  basePath?: string;
17
18
  id?: string;
18
19
  className?: string;
20
+ /** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
21
+ surface?: Surface;
19
22
  }
20
23
 
21
24
  /**
22
25
  * The blog listing: every post, newest first, as a plain readable stack
23
26
  * rather than a card grid. These are articles, not products, and a list
24
- * that reads top to bottom suits a small archive better than a gallery
27
+ * that reads top to bottom suits a small archive better than a grid
25
28
  * that pads it out.
26
29
  *
27
30
  * Every entry is a real anchor to a prerendered page, which is what lets
28
31
  * the build's link crawler discover the posts without an explicit page
29
32
  * list in the vite config.
30
33
  */
31
- export function BlogIndex({ items, basePath = "/blog", id, className }: BlogIndexProps) {
34
+ export function BlogIndex({
35
+ items,
36
+ basePath = "/blog",
37
+ id,
38
+ className,
39
+ surface = "default",
40
+ }: BlogIndexProps) {
32
41
  const withBase = useWithBase();
33
42
  return (
34
- <section className={["section", "blog-index", className].filter(Boolean).join(" ")} id={id}>
43
+ <section
44
+ className={["section", "blog-index", surface === "alt" && "surface-alt", className]
45
+ .filter(Boolean)
46
+ .join(" ")}
47
+ id={id}
48
+ >
35
49
  <div className="wrap">
36
50
  <ol className="bi-list">
37
51
  {items.map((item) => (
@@ -2,6 +2,7 @@ import { ArrowLeft } from "lucide-react";
2
2
  import { displayDate } from "../lib/displayDate";
3
3
  import { type ProseBlock, ProseBlocks } from "../primitives/ProseBlocks";
4
4
  import { useWithBase } from "../routing/BasePathProvider";
5
+ import type { Surface } from "./siteConfig";
5
6
 
6
7
  export interface BlogPostDoc {
7
8
  title: string;
@@ -19,6 +20,8 @@ export interface BlogPostProps {
19
20
  backLabel?: string;
20
21
  id?: string;
21
22
  className?: string;
23
+ /** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
24
+ surface?: Surface;
22
25
  }
23
26
 
24
27
  /**
@@ -33,6 +36,7 @@ export interface BlogPostProps {
33
36
  * has touched.
34
37
  */
35
38
  export function BlogPost({
39
+ surface = "default",
36
40
  doc,
37
41
  basePath = "/blog",
38
42
  backLabel = "All posts",
@@ -41,7 +45,12 @@ export function BlogPost({
41
45
  }: BlogPostProps) {
42
46
  const withBase = useWithBase();
43
47
  return (
44
- <article className={["section", "blog-post", className].filter(Boolean).join(" ")} id={id}>
48
+ <article
49
+ className={["section", "blog-post", surface === "alt" && "surface-alt", className]
50
+ .filter(Boolean)
51
+ .join(" ")}
52
+ id={id}
53
+ >
45
54
  <div className="wrap bp-wrap">
46
55
  <a className="bp-back" href={withBase(basePath)}>
47
56
  <ArrowLeft size={15} strokeWidth={2} aria-hidden="true" />
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { Eyebrow, Lead } from "../primitives";
3
3
  import { PrimaryButton, SecondaryButton } from "../primitives/CallToAction";
4
- import type { SiteConfig } from "./siteConfig";
4
+ import type { SiteConfig, Surface } from "./siteConfig";
5
5
 
6
6
  export interface CTASectionProps {
7
7
  /** The site's primary action, `site.cta`; a whole `SiteConfig` passes as it is. */
@@ -17,7 +17,7 @@ export interface CTASectionProps {
17
17
  primary?: { label: string; href: string; newTab?: boolean };
18
18
  /** Page-contextual secondary action; always a ghost button, always second. */
19
19
  secondary?: { label: string; href: string; newTab?: boolean };
20
- surface?: "default" | "alt";
20
+ surface?: Surface;
21
21
  }
22
22
 
23
23
  /** The standard closing CTA: primary action from the site config, ghost secondary. */
@@ -0,0 +1,34 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ /** One callout: a heavy title over a short subtitle. */
4
+ export interface CalloutPanelItem {
5
+ title: ReactNode;
6
+ subtitle?: ReactNode;
7
+ }
8
+
9
+ export interface CalloutPanelProps {
10
+ items: CalloutPanelItem[];
11
+ className?: string;
12
+ }
13
+
14
+ /**
15
+ * A set of short callouts on the primary field, set inside a section after
16
+ * its copy: four across on a desktop and two by two below. The titles share
17
+ * one line across a row and the subtitles another, whatever a title's
18
+ * length, so a two line title never pushes its subtitle out of step with its
19
+ * neighbors' (each item spans two rows of a subgrid). Not `Callout`, which is
20
+ * one finding with a tone; these are the business's headline claims.
21
+ */
22
+ export function CalloutPanel({ items, className }: CalloutPanelProps) {
23
+ return (
24
+ <ul className={["callout-panel", "on-primary", className].filter(Boolean).join(" ")}>
25
+ {items.map((item, i) => (
26
+ // biome-ignore lint/suspicious/noArrayIndexKey: callouts are static content in a fixed order
27
+ <li key={i}>
28
+ <strong className="callout-panel-title">{item.title}</strong>
29
+ <span className="callout-panel-sub">{item.subtitle}</span>
30
+ </li>
31
+ ))}
32
+ </ul>
33
+ );
34
+ }
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import { useScrollsSideways } from "../lib/useScrollsSideways";
2
3
  import { useWithBase } from "../routing/BasePathProvider";
3
4
 
4
5
  /**
@@ -42,6 +43,12 @@ export interface ComparisonTableProps {
42
43
  columns?: { stage?: string; before?: string; after?: string };
43
44
  /** Small print under the table, e.g. what the grades mean. */
44
45
  footnote?: ReactNode;
46
+ /**
47
+ * What a screen reader calls the table's box while the table is wider
48
+ * than the page and scrolls inside it, as on a phone; defaults to
49
+ * "Comparison". Name what the table compares ("The site, before and after").
50
+ */
51
+ ariaLabel?: string;
45
52
  className?: string;
46
53
  }
47
54
 
@@ -72,8 +79,18 @@ function Cell({ state, highlight }: { state: ComparisonState; highlight: boolean
72
79
  );
73
80
  }
74
81
 
75
- export function ComparisonTable({ rows, columns, footnote, className }: ComparisonTableProps) {
82
+ export function ComparisonTable({
83
+ rows,
84
+ columns,
85
+ footnote,
86
+ ariaLabel = "Comparison",
87
+ className,
88
+ }: ComparisonTableProps) {
76
89
  const withBase = useWithBase();
90
+ // The box scrolls sideways on a phone, where the table keeps its shape
91
+ // (Component Rules 6), so while it scrolls it is a named region a
92
+ // keyboard can reach and scroll, as DataTable's is.
93
+ const scrolls = useScrollsSideways();
77
94
  const heads = {
78
95
  stage: columns?.stage ?? "Area",
79
96
  before: columns?.before ?? "Before",
@@ -82,7 +99,11 @@ export function ComparisonTable({ rows, columns, footnote, className }: Comparis
82
99
 
83
100
  return (
84
101
  <div className={["comparison", className].filter(Boolean).join(" ")}>
85
- <div className="cmp-scroll">
102
+ <div
103
+ ref={scrolls.ref}
104
+ className="cmp-scroll"
105
+ {...(scrolls.active ? { tabIndex: 0, role: "region", "aria-label": ariaLabel } : {})}
106
+ >
86
107
  <table className="cmp-table">
87
108
  <colgroup>
88
109
  <col className="cmp-col-stage" />
@@ -1,4 +1,4 @@
1
- import { type FormEvent, type ReactNode, useState } from "react";
1
+ import { type FormEvent, type ReactNode, useId, useState } from "react";
2
2
  import { isHoneypotFilled } from "../lib/honeypot";
3
3
  import { trackEvent } from "../lib/trackEvent";
4
4
  import { Button } from "../primitives/Button";
@@ -62,6 +62,21 @@ export function ContactForm({
62
62
  const withBase = useWithBase();
63
63
  const [errors, setErrors] = useState<FieldErrors>({});
64
64
  const [status, setStatus] = useState<Status>("idle");
65
+ // Ids from useId, so two forms on one page never share a label's target.
66
+ const uid = useId();
67
+ const ids = {
68
+ name: `${uid}-name`,
69
+ email: `${uid}-email`,
70
+ topic: `${uid}-topic`,
71
+ message: `${uid}-message`,
72
+ company: `${uid}-company`,
73
+ };
74
+ // A refused field says so and why: aria-invalid, and its message as its
75
+ // description, only while it is refused.
76
+ const refused = (field: keyof FieldErrors) =>
77
+ errors[field]
78
+ ? { "aria-invalid": true as const, "aria-describedby": `${ids[field]}-error` }
79
+ : {};
65
80
 
66
81
  async function handleSubmit(event: FormEvent<HTMLFormElement>) {
67
82
  event.preventDefault();
@@ -80,8 +95,12 @@ export function ContactForm({
80
95
  message: !message,
81
96
  };
82
97
  setErrors(nextErrors);
83
- if (nextErrors.name || nextErrors.email || nextErrors.message) {
98
+ const firstRefused = (["name", "email", "message"] as const).find((field) => nextErrors[field]);
99
+ if (firstRefused) {
84
100
  setStatus("idle");
101
+ // Focus goes to the first field to fix, where its message is read.
102
+ const field = form.elements.namedItem(firstRefused);
103
+ if (field instanceof HTMLElement) field.focus();
85
104
  return;
86
105
  }
87
106
 
@@ -119,36 +138,61 @@ export function ContactForm({
119
138
 
120
139
  return (
121
140
  <form onSubmit={handleSubmit} noValidate>
122
- {status === "sent" && <div className="form-success">{successMessage}</div>}
123
- {status === "failed" && <div className="form-error">{errorMessage}</div>}
141
+ {/* One shot status: the thanks or the failure is announced once when it
142
+ appears (Component Rules 14). The region is always drawn, so a screen
143
+ reader is already watching it when the words arrive. */}
144
+ <output className="form-status">
145
+ {status === "sent" && <span className="form-success">{successMessage}</span>}
146
+ {status === "failed" && <span className="form-error">{errorMessage}</span>}
147
+ </output>
124
148
  <div className={["field", errors.name && "invalid"].filter(Boolean).join(" ")}>
125
- <label htmlFor="contact-name">Your name</label>
126
- <input id="contact-name" name="name" type="text" autoComplete="name" required />
127
- <span className="err">Please enter your name.</span>
149
+ <label htmlFor={ids.name}>Your name</label>
150
+ <input
151
+ id={ids.name}
152
+ name="name"
153
+ type="text"
154
+ autoComplete="name"
155
+ required
156
+ {...refused("name")}
157
+ />
158
+ <span className="err" id={`${ids.name}-error`}>
159
+ Please enter your name.
160
+ </span>
128
161
  </div>
129
162
  <div className={["field", errors.email && "invalid"].filter(Boolean).join(" ")}>
130
- <label htmlFor="contact-email">Email</label>
131
- <input id="contact-email" name="email" type="email" autoComplete="email" required />
132
- <span className="err">Please enter a valid email.</span>
163
+ <label htmlFor={ids.email}>Email</label>
164
+ <input
165
+ id={ids.email}
166
+ name="email"
167
+ type="email"
168
+ autoComplete="email"
169
+ required
170
+ {...refused("email")}
171
+ />
172
+ <span className="err" id={`${ids.email}-error`}>
173
+ Please enter a valid email.
174
+ </span>
133
175
  </div>
134
176
  <div className="field">
135
- <label htmlFor="contact-topic">What can we help with?</label>
136
- <select id="contact-topic" name="topic">
177
+ <label htmlFor={ids.topic}>What can we help with?</label>
178
+ <select id={ids.topic} name="topic">
137
179
  {topics.map((topic) => (
138
180
  <option key={topic}>{topic}</option>
139
181
  ))}
140
182
  </select>
141
183
  </div>
142
184
  <div className={["field", errors.message && "invalid"].filter(Boolean).join(" ")}>
143
- <label htmlFor="contact-message">Message</label>
144
- <textarea id="contact-message" name="message" required />
145
- <span className="err">Please add a short message.</span>
185
+ <label htmlFor={ids.message}>Message</label>
186
+ <textarea id={ids.message} name="message" required {...refused("message")} />
187
+ <span className="err" id={`${ids.message}-error`}>
188
+ Please add a short message.
189
+ </span>
146
190
  </div>
147
191
  {/* Honeypot: visually hidden and skipped by keyboard/screen readers;
148
192
  bots that fill it are quietly dropped by the backend. */}
149
193
  <div className="hp-field" aria-hidden="true">
150
- <label htmlFor="contact-company">Company</label>
151
- <input id="contact-company" name="company" type="text" tabIndex={-1} autoComplete="off" />
194
+ <label htmlFor={ids.company}>Company</label>
195
+ <input id={ids.company} name="company" type="text" tabIndex={-1} autoComplete="off" />
152
196
  </div>
153
197
  <Button type="submit" size="lg" arrow style={{ width: "100%" }}>
154
198
  {status === "sending" ? "Sending…" : "Send Message"}
@@ -1,5 +1,5 @@
1
1
  import { Check, ChevronDown, Link2, Search, X } from "lucide-react";
2
- import { type ReactNode, useEffect, useMemo, useState } from "react";
2
+ import { type ReactNode, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { newTabProps } from "../lib/newTabProps";
4
4
  import { useOpenHeight } from "../lib/useOpenHeight";
5
5
  import { useWithBase } from "../routing/BasePathProvider";
@@ -157,6 +157,14 @@ export function FAQBrowser({
157
157
  });
158
158
  }, [categories]);
159
159
 
160
+ // Clearing the search removes the clear button, and the focus it held
161
+ // would fall to the page; it goes back to the field it cleared instead.
162
+ const searchRef = useRef<HTMLInputElement>(null);
163
+ function clearSearch() {
164
+ setQuery("");
165
+ searchRef.current?.focus();
166
+ }
167
+
160
168
  function toggle(id: string) {
161
169
  setOpenIds((prev) => {
162
170
  const next = new Set(prev);
@@ -195,6 +203,7 @@ export function FAQBrowser({
195
203
  <div className="faq-search">
196
204
  <Search size={18} strokeWidth={1.6} aria-hidden="true" />
197
205
  <input
206
+ ref={searchRef}
198
207
  type="search"
199
208
  value={query}
200
209
  onChange={(event) => setQuery(event.target.value)}
@@ -206,7 +215,7 @@ export function FAQBrowser({
206
215
  type="button"
207
216
  className="faq-search-clear"
208
217
  aria-label="Clear search"
209
- onClick={() => setQuery("")}
218
+ onClick={clearSearch}
210
219
  >
211
220
  <X size={16} strokeWidth={2} aria-hidden="true" />
212
221
  </button>
@@ -1,6 +1,7 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
2
  import { SectionHeading } from "../primitives";
3
3
  import { useWithBase } from "../routing/BasePathProvider";
4
+ import type { Surface } from "./siteConfig";
4
5
 
5
6
  interface FeatureCardBase {
6
7
  /** Small mono index label, e.g. "01". */
@@ -29,10 +30,12 @@ export interface FeatureGridProps {
29
30
  /** Deprecated no-op: the eyebrow's trailing fade is now its only rendering. */
30
31
  eyebrowRun?: boolean;
31
32
  title: ReactNode;
33
+ /** A line or two under the heading, before the cards. */
34
+ lead?: ReactNode;
32
35
  items: FeatureCard[];
33
36
  /** Cards per row at desktop width (default 4). */
34
37
  columns?: 2 | 3 | 4;
35
- surface?: "default" | "alt";
38
+ surface?: Surface;
36
39
  id?: string;
37
40
  }
38
41
 
@@ -40,6 +43,7 @@ export interface FeatureGridProps {
40
43
  export function FeatureGrid({
41
44
  eyebrow,
42
45
  title,
46
+ lead,
43
47
  items,
44
48
  columns = 4,
45
49
  surface = "alt",
@@ -51,7 +55,7 @@ export function FeatureGrid({
51
55
  return (
52
56
  <section className={sectionClasses} id={id}>
53
57
  <div className="wrap">
54
- <SectionHeading eyebrow={eyebrow} title={title} />
58
+ <SectionHeading eyebrow={eyebrow} title={title} lead={lead} />
55
59
  <div className="feature-grid" style={gridStyle}>
56
60
  {items.map((item) => {
57
61
  const inner = (