@atelic-action/ui 8.1.0 → 8.3.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 (45) hide show
  1. package/README.md +117 -34
  2. package/dist/monitoring/server.d.ts +58 -1
  3. package/dist/monitoring/server.js +129 -1
  4. package/package.json +1 -1
  5. package/src/chrome/BrandLockup.tsx +12 -3
  6. package/src/chrome/ContactDock.tsx +16 -2
  7. package/src/chrome/Footer.tsx +50 -12
  8. package/src/chrome/NavMegaPanel.tsx +6 -12
  9. package/src/chrome/SiteHeader.tsx +39 -17
  10. package/src/chrome/SiteMenu.tsx +211 -76
  11. package/src/chrome/SiteShell.tsx +9 -2
  12. package/src/chrome/StickyCTABar.tsx +48 -20
  13. package/src/chrome/index.ts +3 -0
  14. package/src/components/DataTable.tsx +1 -1
  15. package/src/components/ReportCard.tsx +3 -3
  16. package/src/lib/hours.ts +9 -2
  17. package/src/lib/phoneText.tsx +9 -0
  18. package/src/monitoring/ErrorCatcherScript.tsx +17 -6
  19. package/src/monitoring/index.ts +1 -1
  20. package/src/monitoring/server.ts +158 -1
  21. package/src/primitives/Button.tsx +2 -2
  22. package/src/routing/index.ts +10 -32
  23. package/src/routing/miss.ts +14 -3
  24. package/src/routing/routerErrors.tsx +57 -0
  25. package/src/routing/staticNotFound.tsx +77 -0
  26. package/src/scripts/check-sentry.ts +22 -1
  27. package/src/sections/CalloutPanel.tsx +4 -1
  28. package/src/sections/ContactInfoCard.tsx +9 -2
  29. package/src/sections/FeatureGrid.tsx +31 -7
  30. package/src/sections/Hero.tsx +2 -2
  31. package/src/sections/HoursTable.tsx +5 -3
  32. package/src/sections/LocationSection.tsx +2 -2
  33. package/src/sections/LogoMarquee.tsx +1 -1
  34. package/src/sections/PricingBand.tsx +1 -1
  35. package/src/sections/ProcessSteps.tsx +1 -1
  36. package/src/sections/ReviewWall.tsx +2 -2
  37. package/src/sections/index.ts +1 -0
  38. package/src/sections/siteConfig.ts +57 -0
  39. package/src/styles/base.css +34 -17
  40. package/src/styles/chrome.css +358 -42
  41. package/src/styles/components.css +0 -22
  42. package/src/styles/defaults.css +90 -3
  43. package/src/styles/primitives.css +9 -3
  44. package/src/styles/sections.css +46 -26
  45. package/src/types.ts +38 -1
@@ -5,7 +5,7 @@
5
5
  * shipped, so this file imports nothing and touches only what a function and
6
6
  * the middleware runtime both have (fetch, `AbortController`, `crypto`).
7
7
  *
8
- * import { reportServerError, withErrorReporting } from "@atelic-action/ui/monitoring/server";
8
+ * import { reportServerError, reportServerErrorLater, withErrorReporting } from "@atelic-action/ui/monitoring/server";
9
9
  *
10
10
  * Privacy: a report carries the request's method and path, and its user
11
11
  * agent, never its body, its query string, or any other header. A contact
@@ -183,6 +183,134 @@ export async function reportServerError(error, options = {}) {
183
183
  return false;
184
184
  }
185
185
  }
186
+ /**
187
+ * The platform's own `waitUntil`, read the way `@vercel/functions` reads it,
188
+ * from the request context Vercel keeps on a global symbol, so this file
189
+ * needs no dependency for it. Undefined anywhere else.
190
+ */
191
+ function platformWaitUntil() {
192
+ try {
193
+ const store = globalThis[Symbol.for("@vercel/request-context")];
194
+ const context = store?.get?.();
195
+ const waitUntil = context?.waitUntil;
196
+ return typeof waitUntil === "function" ? waitUntil.bind(context) : undefined;
197
+ }
198
+ catch {
199
+ return undefined;
200
+ }
201
+ }
202
+ /**
203
+ * Reports an error without making the caller wait for it. The send starts
204
+ * at once and is handed to the platform's `waitUntil` (the `context` given,
205
+ * else Vercel's request context), which keeps the function alive until it
206
+ * finishes after the answer has gone. With neither, the send still runs,
207
+ * never blocking the answer, and may be cut short if the runtime freezes
208
+ * once the answer is out. Never throws, and returns nothing to wait on.
209
+ *
210
+ * Use `reportServerError`, awaited, where the report must land before the
211
+ * handler goes on (before a throw, in a handler that already waits); use
212
+ * this one where the answer should leave at once (a refusal the person is
213
+ * waiting to read).
214
+ */
215
+ export function reportServerErrorLater(error, options = {}) {
216
+ const { context, ...report } = options;
217
+ const sending = reportServerError(error, report);
218
+ // The context's own waitUntil first, then the platform's; a context with
219
+ // none that can be called, or one that throws, falls through to the
220
+ // next, and with neither the send runs on its own, never blocking.
221
+ const own = context?.waitUntil;
222
+ const fromContext = typeof own === "function"
223
+ ? (promise) => own.call(context, promise)
224
+ : undefined;
225
+ for (const find of [() => fromContext, platformWaitUntil]) {
226
+ try {
227
+ const hold = find();
228
+ if (!hold)
229
+ continue;
230
+ hold(sending);
231
+ return;
232
+ }
233
+ catch {
234
+ // This one could not hold the send; the next is tried.
235
+ }
236
+ }
237
+ }
238
+ /**
239
+ * Anything shaped like an email address, which a refusal may quote (the
240
+ * recipient, the sender). The domain is labels of letters in any script,
241
+ * digits, hyphens, and underscores joined by dots, so an internationalized
242
+ * domain is caught and a sentence's closing period stays outside it.
243
+ */
244
+ const ADDRESS = /[^\s@<>()[\]"',;:]+@[\p{L}\p{N}_-]+(?:\.[\p{L}\p{N}_-]+)+/gu;
245
+ /** A separator inside a phone number: a space, a dot, a slash, or any hyphen or dash. */
246
+ const SEP = "[\\s./\\u2010-\\u2015\\u2212-]";
247
+ /**
248
+ * A run shaped like a phone number: an optional country code, then an area
249
+ * code in parentheses and the number after it, or at least three groups of
250
+ * digits joined by separators, the last of three or four digits, or a plus
251
+ * sign and seven to fifteen digits run together (E.164). A date
252
+ * (2026-11-23), a bare id (12345678), and a count beside a year (120 2026)
253
+ * are none of these, and stay.
254
+ */
255
+ const PHONE = new RegExp(`(?<![\\w+-])\\+\\d{7,15}(?![\\w-])|(?<![\\w+-])(?:\\+\\d{1,3}${SEP}?)?(?:\\(\\d{2,4}\\)${SEP}?\\d{2,4}(?:${SEP}\\d{3,4})?|\\d{2,4}(?:${SEP}\\d{2,4}){1,2}${SEP}\\d{3,4})(?![\\w-])`, "gu");
256
+ /** A refusal's field with every address and phone number in it replaced. */
257
+ function scrub(text) {
258
+ return text.replace(ADDRESS, "[address]").replace(PHONE, "[number]");
259
+ }
260
+ /** The longest a refusal's field is kept, so a report never carries a page of text. */
261
+ const REFUSAL_FIELD_MAX = 300;
262
+ /**
263
+ * A refused upstream answer as an error a report may carry: the service's
264
+ * name, the status, and the error body's `name` and `message` fields alone,
265
+ * each with anything shaped like an email address replaced by `[address]`
266
+ * and anything shaped like a phone number (grouped as one is written) by
267
+ * `[number]`, then cut to 300
268
+ * characters. Nothing else of the body is read, and a body that is not JSON
269
+ * leaves the status alone. Never throws.
270
+ *
271
+ * The scrub takes out the shapes it knows and nothing more: the fields are
272
+ * still the upstream's free text, and a name, a street, or a message quoted
273
+ * in it in words passes through. Report a refusal from a service whose
274
+ * errors are about the request, never one that echoes what a person wrote.
275
+ *
276
+ * await refusalError(response, "Resend") // Error("Resend answered 422: validation_error: ...")
277
+ */
278
+ export async function refusalError(response, service = "The upstream service") {
279
+ let body = {};
280
+ try {
281
+ const parsed = await response.json();
282
+ if (parsed && typeof parsed === "object")
283
+ body = parsed;
284
+ }
285
+ catch {
286
+ // Not JSON, or already read: the status says what there is to say.
287
+ }
288
+ const parts = [body.name, body.message]
289
+ .filter((part) => typeof part === "string" && part.trim() !== "")
290
+ .map((part) => scrub(part).slice(0, REFUSAL_FIELD_MAX));
291
+ return new Error(`${service} answered ${response.status}${parts.length ? `: ${parts.join(": ")}` : ""}`);
292
+ }
293
+ /**
294
+ * Reports a refused upstream answer (a send the mail service would not
295
+ * take) without holding the caller's own answer: the error is built by
296
+ * `refusalError`, so no address in the refusal survives, and sent by
297
+ * `reportServerErrorLater`. Resolves once the refusal's body is read, never
298
+ * waiting on the send, and never throws.
299
+ *
300
+ * if (!response.ok) {
301
+ * await reportRefusedResponse(response, { service: "Resend", request, tags: { route: "contact" } });
302
+ * return json(502, { ok: false, error: "Sending failed. Please try again in a moment." });
303
+ * }
304
+ */
305
+ export async function reportRefusedResponse(response, options = {}) {
306
+ const { service, ...report } = options;
307
+ try {
308
+ reportServerErrorLater(await refusalError(response, service), report);
309
+ }
310
+ catch {
311
+ // A report never becomes a second failure.
312
+ }
313
+ }
186
314
  /**
187
315
  * Wraps a function's handler so a throw is reported, then thrown again: the
188
316
  * platform still answers the request as it would have, and Sentry hears of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atelic-action/ui",
3
- "version": "8.1.0",
3
+ "version": "8.3.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",
@@ -8,6 +8,15 @@ export interface BrandLockupProps {
8
8
  * brand's name when they are its name in another case), then "home".
9
9
  */
10
10
  ariaLabel?: string;
11
+ /**
12
+ * The one ground the lockup sits on, for a place outside the header that
13
+ * only ever wears one (the light phone menu's top row): that surface's
14
+ * mark alone, as the footer draws its own. Left out, the header draws
15
+ * both and its bar shows the one for its state.
16
+ */
17
+ surface?: MarkSurface;
18
+ /** Called when the link is followed, before the browser navigates. */
19
+ onClick?: () => void;
11
20
  }
12
21
 
13
22
  /**
@@ -103,7 +112,7 @@ export function LockupParts({
103
112
  * every child, image alt included, and it always holds the words the link
104
113
  * shows, so what a reader sees is what a voice user can say.
105
114
  */
106
- export function BrandLockup({ brand, ariaLabel }: BrandLockupProps) {
115
+ export function BrandLockup({ brand, ariaLabel, surface, onClick }: BrandLockupProps) {
107
116
  const { name, href = "/", logo, recipient } = brand;
108
117
  const wordmark = lockupWords(name, logo);
109
118
  // The visible words lead the name. A wordmark that is the name in another
@@ -112,8 +121,8 @@ export function BrandLockup({ brand, ariaLabel }: BrandLockupProps) {
112
121
  wordmark === null || name.toLowerCase().includes(wordmark.toLowerCase()) ? name : wordmark;
113
122
  const label = ariaLabel ?? (recipient ? `${words} × ${recipient.alt} home` : `${words} home`);
114
123
  return (
115
- <a className="nav-logo" href={href} aria-label={label}>
116
- <LockupParts name={name} logo={logo} />
124
+ <a className="nav-logo" href={href} aria-label={label} onClick={onClick}>
125
+ <LockupParts name={name} logo={logo} surface={surface} />
117
126
  {recipient && (
118
127
  <>
119
128
  <span className="nav-x" aria-hidden="true">
@@ -2,7 +2,7 @@ import { ChevronRight, MessageCircle, X } from "lucide-react";
2
2
  import { type RefObject, useEffect, useId, useRef, useState } from "react";
3
3
  import { useDismiss } from "../hooks/useDismiss";
4
4
  import { newTabProps } from "../lib/newTabProps";
5
- import { holdPhoneNumbers, isTel } from "../lib/phoneText";
5
+ import { telText } from "../lib/phoneText";
6
6
  import type { ContactDockConfig } from "../types";
7
7
  import { dockIcons } from "./icons";
8
8
 
@@ -186,7 +186,13 @@ export function ContactDock({
186
186
  : typeof avoid === "string"
187
187
  ? document.querySelector(avoid)
188
188
  : avoid.current;
189
+ // A transition ending inside the header (a pill's hover, a panel's
190
+ // chevron) moves nothing; only the header's own counts.
191
+ const onHeadTransition = (event: Event) => {
192
+ if (event.target === head) schedule();
193
+ };
189
194
  const bind = () => {
195
+ head?.removeEventListener("transitionend", onHeadTransition);
190
196
  bar = findBar();
191
197
  footer = findFooter();
192
198
  head = findHeader();
@@ -200,6 +206,13 @@ export function ContactDock({
200
206
  shows?.observe(bar, { attributes: true, attributeFilter: ["data-showing", "class"] });
201
207
  }
202
208
  if (footer) sizes?.observe(footer);
209
+ // The header sets the launcher's ceiling, so a change in its size (a
210
+ // logo that loads late, a bar that grows) measures again, and so does
211
+ // the end of its own transition, which moves it without resizing it.
212
+ if (head) {
213
+ sizes?.observe(head);
214
+ head.addEventListener("transitionend", onHeadTransition);
215
+ }
203
216
  measure();
204
217
  };
205
218
  // A route change swaps the footer, and a bar can mount after the dock:
@@ -230,6 +243,7 @@ export function ContactDock({
230
243
  cancelAnimationFrame(bound);
231
244
  window.removeEventListener("scroll", schedule);
232
245
  window.removeEventListener("resize", schedule);
246
+ head?.removeEventListener("transitionend", onHeadTransition);
233
247
  sizes?.disconnect();
234
248
  shows?.disconnect();
235
249
  added?.disconnect();
@@ -298,7 +312,7 @@ export function ContactDock({
298
312
  {items.map((item, at) => {
299
313
  const Icon = dockIcons[item.icon ?? "chat"];
300
314
  // A call row holds its number whole and wraps its words.
301
- const words = (text: string) => (isTel(item.href) ? holdPhoneNumbers(text) : text);
315
+ const words = (text: string) => telText(item.href, text);
302
316
  const inner = (
303
317
  <>
304
318
  <span className="cd-item-icon">
@@ -6,6 +6,7 @@ import type {
6
6
  Brand,
7
7
  FooterColumn,
8
8
  FooterColumnLink,
9
+ FooterHoursPlacement,
9
10
  HoursRow,
10
11
  Phone,
11
12
  PostalAddress,
@@ -172,6 +173,13 @@ export interface FooterProps {
172
173
  hours?: HoursRow[];
173
174
  /** The hours column's heading. Defaults to "Hours". */
174
175
  hoursHeading?: string;
176
+ /**
177
+ * Where the hours sit: `column` (the default) is a column of their own
178
+ * beside the link columns; `brand` sets them inside the brand column,
179
+ * under the address, the phone, and the email, as a compact list of two
180
+ * columns under a small label, so the link columns keep the row's room.
181
+ */
182
+ hoursPlacement?: FooterHoursPlacement;
175
183
  /**
176
184
  * The link columns beside the brand column. The default footer carries
177
185
  * four: Company, Resources, Social, and Legal. A column with no links is
@@ -218,6 +226,7 @@ export function Footer({
218
226
  email,
219
227
  hours,
220
228
  hoursHeading = "Hours",
229
+ hoursPlacement = "column",
221
230
  columns,
222
231
  attribution,
223
232
  note,
@@ -231,7 +240,23 @@ export function Footer({
231
240
  // The band is a dark surface, resolved by the order the header uses.
232
241
  const mark = resolveMark(logo, "dark");
233
242
  const shown = (columns ?? []).filter((column) => column.links.length > 0);
234
- const hoursShown = hours && hours.length > 0 ? hours : null;
243
+ const hoursGiven = hours && hours.length > 0 ? hours : null;
244
+ // The hours as a column of their own, or inside the brand column.
245
+ // Any value but "brand" (a typo, a value from a later version) is a column.
246
+ const inBrand = hoursPlacement === "brand";
247
+ const hoursShown = inBrand ? null : hoursGiven;
248
+ const hoursInBrand = inBrand ? hoursGiven : null;
249
+ const hoursList = (rows: HoursRow[]) => (
250
+ <dl>
251
+ {rows.map((row, at) => (
252
+ // biome-ignore lint/suspicious/noArrayIndexKey: two rows may share a label (a split day), so the place keeps the key unique; rows never reorder
253
+ <div key={`${at} ${row.label}`}>
254
+ <dt>{row.label}</dt>
255
+ <dd>{row.range}</dd>
256
+ </div>
257
+ ))}
258
+ </dl>
259
+ );
235
260
  const stars = (
236
261
  <span className="footer-stars" aria-hidden="true">
237
262
  {STARS.map((star) => (
@@ -256,8 +281,20 @@ export function Footer({
256
281
  <footer ref={ref} className="footer">
257
282
  <div className="wrap">
258
283
  <div
259
- className={hoursShown ? "footer-grid has-hours" : "footer-grid"}
260
- style={{ "--footer-columns": shown.length + (hoursShown ? 1 : 0) } as CSSProperties}
284
+ className={[
285
+ "footer-grid",
286
+ hoursShown && "has-hours",
287
+ // Two across, the hours span the row only beside an even count of
288
+ // link columns, so no cell is left alone (chrome.css, the footer).
289
+ hoursShown && shown.length % 2 === 0 && "has-even-columns",
290
+ hoursInBrand && "has-brand-hours",
291
+ ]
292
+ .filter(Boolean)
293
+ .join(" ")}
294
+ // The link columns drawn, which the brand placement's floors are
295
+ // measured for (chrome.css), so two or three columns keep the
296
+ // brand column beside them as long as theirs fit.
297
+ style={hoursInBrand ? ({ "--_link-count": shown.length } as CSSProperties) : undefined}
261
298
  >
262
299
  <div className="footer-brand">
263
300
  {logo?.tile ? (
@@ -313,6 +350,15 @@ export function Footer({
313
350
  {email && <a href={`mailto:${email}`}>{breakableEmail(email)}</a>}
314
351
  </address>
315
352
  )}
353
+ {hoursInBrand && (
354
+ <div className="footer-brand-hours">
355
+ {/* biome-ignore lint/a11y/useSemanticElements: a heading by role, as the link columns' are (see below) */}
356
+ <div className="footer-heading" role="heading" aria-level={headingLevel}>
357
+ {hoursHeading}
358
+ </div>
359
+ {hoursList(hoursInBrand)}
360
+ </div>
361
+ )}
316
362
  </div>
317
363
  {hoursShown && (
318
364
  <div className="footer-column footer-hours">
@@ -320,15 +366,7 @@ export function Footer({
320
366
  <div className="footer-heading" role="heading" aria-level={headingLevel}>
321
367
  {hoursHeading}
322
368
  </div>
323
- <dl>
324
- {hoursShown.map((row, at) => (
325
- // biome-ignore lint/suspicious/noArrayIndexKey: two rows may share a label (a split day), so the place keeps the key unique; rows never reorder
326
- <div key={`${at} ${row.label}`}>
327
- <dt>{row.label}</dt>
328
- <dd>{row.range}</dd>
329
- </div>
330
- ))}
331
- </dl>
369
+ {hoursList(hoursShown)}
332
370
  </div>
333
371
  )}
334
372
  {shown.map((column) => (
@@ -1,6 +1,6 @@
1
1
  import { ChevronRight } from "lucide-react";
2
2
  import { newTabProps } from "../lib/newTabProps";
3
- import { holdPhoneNumbers, isTel } from "../lib/phoneText";
3
+ import { telText } from "../lib/phoneText";
4
4
  import { Button } from "../primitives/Button";
5
5
  import { TickList } from "../primitives/TickList";
6
6
  import type {
@@ -112,7 +112,7 @@ function LinkColumn({
112
112
  aria-current={current(linkKey(index, parent, at))}
113
113
  {...newTabProps(link.href, link.external)}
114
114
  >
115
- {isTel(link.href) ? holdPhoneNumbers(link.label) : link.label}
115
+ {telText(link.href, link.label)}
116
116
  <Badge text={link.badge} />
117
117
  </a>
118
118
  </li>
@@ -143,13 +143,11 @@ function LinkColumn({
143
143
  {...newTabProps(link.href, link.external)}
144
144
  >
145
145
  <span className="nav-mega-label">
146
- {isTel(link.href) ? holdPhoneNumbers(link.label) : link.label}
146
+ {telText(link.href, link.label)}
147
147
  <Badge text={link.badge} />
148
148
  </span>
149
149
  {link.description && (
150
- <span className="nav-mega-desc">
151
- {isTel(link.href) ? holdPhoneNumbers(link.description) : link.description}
152
- </span>
150
+ <span className="nav-mega-desc">{telText(link.href, link.description)}</span>
153
151
  )}
154
152
  </a>
155
153
  {link.children && link.children.length > 0 && (
@@ -216,13 +214,9 @@ function RowsSection({
216
214
  <Icon size={21} strokeWidth={1.75} aria-hidden="true" />
217
215
  </span>
218
216
  <span className="nav-mega-row-text">
219
- <span className="nav-mega-row-label">
220
- {isTel(row.href) ? holdPhoneNumbers(row.label) : row.label}
221
- </span>
217
+ <span className="nav-mega-row-label">{telText(row.href, row.label)}</span>
222
218
  {row.description && (
223
- <span className="nav-mega-row-desc">
224
- {isTel(row.href) ? holdPhoneNumbers(row.description) : row.description}
225
- </span>
219
+ <span className="nav-mega-row-desc">{telText(row.href, row.description)}</span>
226
220
  )}
227
221
  </span>
228
222
  <ChevronRight className="nav-mega-row-go" size={16} aria-hidden="true" />
@@ -10,8 +10,16 @@ import {
10
10
  } from "react";
11
11
  import { useDismiss } from "../hooks/useDismiss";
12
12
  import { type PageStop, useScrollSpy } from "../hooks/useScrollSpy";
13
- import { newTabProps } from "../lib/newTabProps";
14
- import type { Brand, CallToAction, HeaderPhone, MenuContact, NavLink } from "../types";
13
+ import { Button } from "../primitives/Button";
14
+ import type {
15
+ Brand,
16
+ CallToAction,
17
+ HeaderPhone,
18
+ MenuBurgerStyle,
19
+ MenuContact,
20
+ NavLink,
21
+ SiteMenuSurface,
22
+ } from "../types";
15
23
  import { BrandLockup } from "./BrandLockup";
16
24
  import { NavMegaPanel } from "./NavMegaPanel";
17
25
  import { groupHrefs, isGroup } from "./navSections";
@@ -32,7 +40,10 @@ export interface SiteHeaderProps {
32
40
  * mega menu panel, and in the phone's menu an accordion.
33
41
  */
34
42
  links?: NavLink[];
35
- /** The primary action, in the bar on desktop and in the menu. */
43
+ /**
44
+ * The primary action, in the bar on desktop and in the menu, where it
45
+ * reads its `menuLabel` when it has one.
46
+ */
36
47
  primaryCTA?: CallToAction;
37
48
  /** Defaults to `solid`. */
38
49
  variant?: SiteHeaderVariant;
@@ -51,6 +62,8 @@ export interface SiteHeaderProps {
51
62
  /**
52
63
  * Up to two numbers the bar shows on a desktop, each a tel link, with the
53
64
  * first as a call button beside the burger on a phone. A third is dropped.
65
+ * A number's `label` sits over it in the bar's pill; the menu lists each
66
+ * with its `menuLabel`, else its `label`, else "Call".
54
67
  */
55
68
  phones?: HeaderPhone[];
56
69
  /**
@@ -58,6 +71,10 @@ export interface SiteHeaderProps {
58
71
  * the burger is its three lines alone, named "Open menu" or "Close menu".
59
72
  */
60
73
  menuLabel?: string;
74
+ /** The phone menu's sheet, `dark` (the default) or `light` (see `SiteMenu`). */
75
+ menuSurface?: SiteMenuSurface;
76
+ /** How the burger is drawn: the lines before its words, an outlined pill. Both off by default. */
77
+ burger?: MenuBurgerStyle;
61
78
  }
62
79
 
63
80
  /** The keys that move focus along the bar and down into an open panel. */
@@ -108,6 +125,8 @@ export function SiteHeader({
108
125
  contact,
109
126
  phones,
110
127
  menuLabel,
128
+ menuSurface = "dark",
129
+ burger,
111
130
  }: SiteHeaderProps) {
112
131
  const [scrolled, setScrolled] = useState(false);
113
132
  const [menuOpen, setMenuOpen] = useState(false);
@@ -315,7 +334,7 @@ export function SiteHeader({
315
334
  <PhoneIcon size={17} aria-hidden="true" />
316
335
  <span className="nav-phone-text">
317
336
  {phone.label && <span className="nav-phone-label">{phone.label}</span>}
318
- <span className="nav-phone-number">{phone.display}</span>
337
+ <span className="nav-phone-number tel-number">{phone.display}</span>
319
338
  </span>
320
339
  </a>
321
340
  ))}
@@ -326,25 +345,19 @@ export function SiteHeader({
326
345
  // display rule lives outside the atelic-ui layer and would beat
327
346
  // any rule here that hid the button itself.
328
347
  <span className="nav-cta">
329
- <a
330
- className="btn btn-primary"
331
- href={barCTA.href}
332
- {...newTabProps(barCTA.href, barCTA.external)}
333
- >
348
+ <Button href={barCTA.href} newTab={barCTA.external} arrow={barCTA.arrow}>
334
349
  {barCTA.label}
335
- {barCTA.arrow && (
336
- <span className="arrow" aria-hidden="true">
337
- →
338
- </span>
339
- )}
340
- </a>
350
+ </Button>
341
351
  </span>
342
352
  )}
343
353
  {barPhones[0] && (
344
354
  <a
345
355
  className="nav-call"
346
356
  href={`tel:${barPhones[0].e164}`}
347
- aria-label={phoneName(barPhones[0])}
357
+ // An icon alone: a number with no label is named "Call" and the number.
358
+ aria-label={
359
+ barPhones[0].label ? phoneName(barPhones[0]) : `Call ${barPhones[0].display}`
360
+ }
348
361
  >
349
362
  <PhoneIcon size={19} aria-hidden="true" />
350
363
  </a>
@@ -352,7 +365,14 @@ export function SiteHeader({
352
365
  {hasMenu && (
353
366
  <button
354
367
  type="button"
355
- className={menuLabel ? "nav-burger has-label" : "nav-burger"}
368
+ className={[
369
+ "nav-burger",
370
+ menuLabel && "has-label",
371
+ menuLabel && burger?.labelAfter && "is-label-after",
372
+ burger?.outlined && "is-outlined",
373
+ ]
374
+ .filter(Boolean)
375
+ .join(" ")}
356
376
  // Words beside the burger name it, so the name holds what a reader
357
377
  // sees; the open state is aria-expanded's to say.
358
378
  aria-label={menuLabel ? undefined : menuOpen ? "Close menu" : "Open menu"}
@@ -390,6 +410,8 @@ export function SiteHeader({
390
410
  contact={stops ? undefined : contact}
391
411
  phones={barPhones.length > 0 ? barPhones : undefined}
392
412
  currentPath={currentPath}
413
+ surface={menuSurface}
414
+ brand={brand}
393
415
  />
394
416
  )}
395
417
  </>