@atelic-action/ui 8.1.0 → 8.2.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 +72 -28
- package/dist/monitoring/server.d.ts +51 -1
- package/dist/monitoring/server.js +102 -1
- package/package.json +1 -1
- package/src/chrome/BrandLockup.tsx +12 -3
- package/src/chrome/ContactDock.tsx +16 -2
- package/src/chrome/Footer.tsx +2 -5
- package/src/chrome/NavMegaPanel.tsx +6 -12
- package/src/chrome/SiteHeader.tsx +39 -17
- package/src/chrome/SiteMenu.tsx +207 -75
- package/src/chrome/SiteShell.tsx +3 -1
- package/src/chrome/StickyCTABar.tsx +12 -0
- package/src/chrome/index.ts +2 -0
- package/src/lib/phoneText.tsx +9 -0
- package/src/monitoring/ErrorCatcherScript.tsx +17 -6
- package/src/monitoring/index.ts +1 -1
- package/src/monitoring/server.ts +125 -1
- package/src/primitives/Button.tsx +2 -2
- package/src/routing/index.ts +10 -32
- package/src/routing/routerErrors.tsx +57 -0
- package/src/routing/staticNotFound.tsx +64 -0
- package/src/scripts/check-sentry.ts +22 -1
- package/src/sections/CalloutPanel.tsx +4 -1
- package/src/sections/ContactInfoCard.tsx +1 -1
- package/src/sections/Hero.tsx +2 -2
- package/src/sections/LogoMarquee.tsx +1 -1
- package/src/sections/PricingBand.tsx +1 -1
- package/src/sections/ProcessSteps.tsx +1 -1
- package/src/sections/siteConfig.ts +32 -0
- package/src/styles/base.css +23 -17
- package/src/styles/chrome.css +250 -32
- package/src/styles/defaults.css +59 -3
- package/src/styles/primitives.css +9 -3
- package/src/styles/sections.css +30 -10
- package/src/types.ts +32 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChevronRight } from "lucide-react";
|
|
2
2
|
import { newTabProps } from "../lib/newTabProps";
|
|
3
|
-
import {
|
|
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
|
-
{
|
|
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
|
-
{
|
|
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 {
|
|
14
|
-
import type {
|
|
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
|
-
/**
|
|
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
|
-
<
|
|
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
|
-
|
|
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
|
-
|
|
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={
|
|
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
|
</>
|
package/src/chrome/SiteMenu.tsx
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
import { ChevronDown } from "lucide-react";
|
|
1
|
+
import { ChevronDown, X } from "lucide-react";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { newTabProps } from "../lib/newTabProps";
|
|
4
|
-
import {
|
|
4
|
+
import { telText } from "../lib/phoneText";
|
|
5
|
+
import { Button } from "../primitives/Button";
|
|
5
6
|
import type {
|
|
7
|
+
Brand,
|
|
6
8
|
CallToAction,
|
|
7
9
|
HeaderPhone,
|
|
8
10
|
MenuContact,
|
|
9
11
|
NavGroupChildLink,
|
|
10
12
|
NavLink,
|
|
11
13
|
NavPanelSection,
|
|
14
|
+
Phone,
|
|
15
|
+
SiteMenuSurface,
|
|
12
16
|
} from "../types";
|
|
17
|
+
import { BrandLockup } from "./BrandLockup";
|
|
13
18
|
import { NavBadge } from "./NavBadge";
|
|
14
19
|
import { isGroup, isLinkColumn, panelSections } from "./navSections";
|
|
15
20
|
|
|
21
|
+
/** A number as the menu lists it: the header's, or the contact block's one phone. */
|
|
22
|
+
type MenuPhone = Phone & { label?: string; menuLabel?: string };
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The words the menu sets with a number: its `menuLabel`, else its `label`,
|
|
26
|
+
* else "Call", which asserts nothing a business may not do (answer texts).
|
|
27
|
+
*/
|
|
28
|
+
export function menuPhoneLabel(phone: MenuPhone): string {
|
|
29
|
+
return phone.menuLabel ?? phone.label ?? "Call";
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
export interface SiteMenuProps {
|
|
17
33
|
/** Whether the menu is showing. The owner holds this state. */
|
|
18
34
|
open: boolean;
|
|
@@ -27,20 +43,42 @@ export interface SiteMenuProps {
|
|
|
27
43
|
* An entry with `columns` is a group, an accordion that opens one at a time.
|
|
28
44
|
*/
|
|
29
45
|
links: NavLink[];
|
|
30
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* The primary action, rendered as a standard button below the entries, in
|
|
48
|
+
* its `menuLabel` when it has one, else its `label`.
|
|
49
|
+
*/
|
|
31
50
|
primaryCTA?: CallToAction;
|
|
32
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The phone, email, and address block at the foot of the dark sheet. The
|
|
53
|
+
* light sheet draws its one phone as a card when `phones` is empty, and
|
|
54
|
+
* leaves the email and the address out, as its design does.
|
|
55
|
+
*/
|
|
33
56
|
contact?: MenuContact;
|
|
34
57
|
/**
|
|
35
58
|
* The numbers the header shows, each a tel link at the foot with its
|
|
36
|
-
* label, in place of the contact
|
|
59
|
+
* `menuLabel`, else its `label`, else "Call", in place of the contact
|
|
60
|
+
* block's one phone.
|
|
37
61
|
*/
|
|
38
62
|
phones?: HeaderPhone[];
|
|
39
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* The path being read, marking the matching link with aria-current and,
|
|
65
|
+
* for the eye, the 2px underline the bar marks its current entry with.
|
|
66
|
+
*/
|
|
40
67
|
currentPath?: string;
|
|
41
68
|
id?: string;
|
|
42
69
|
/** The dialog's accessible name. Defaults to "Menu". */
|
|
43
70
|
label?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The sheet's look. `dark` (the default) is the full screen sheet on the
|
|
73
|
+
* dark surface. `light` sets the page's ground: the brand's lockup and a
|
|
74
|
+
* round close button across the top, the entries as rows under hairlines,
|
|
75
|
+
* and a foot on the alternate ground holding the call to action and a
|
|
76
|
+
* card per number; it shows no email and no address, which the dark
|
|
77
|
+
* sheet's contact block does. The behavior is the same on both.
|
|
78
|
+
*/
|
|
79
|
+
surface?: SiteMenuSurface;
|
|
80
|
+
/** The identity the light sheet's top row draws, linking home. */
|
|
81
|
+
brand?: Brand;
|
|
44
82
|
}
|
|
45
83
|
|
|
46
84
|
/**
|
|
@@ -48,13 +86,18 @@ export interface SiteMenuProps {
|
|
|
48
86
|
* `<dialog>`: the platform supplies Escape, focus containment, and focus
|
|
49
87
|
* return to the burger. The dialog renders closed on the server and opens
|
|
50
88
|
* only in an effect, so the menu stays safe to prerender. Page scroll holds
|
|
51
|
-
* still through chrome.css while the dialog is open
|
|
89
|
+
* still through chrome.css while the dialog is open, and the contact dock's
|
|
90
|
+
* launcher steps aside.
|
|
52
91
|
*
|
|
53
92
|
* A group is an accordion: its label is a control that opens the group's
|
|
54
93
|
* columns under it and closes whichever group was open. Every group starts
|
|
55
94
|
* closed each time the menu opens, the one holding the current page
|
|
56
95
|
* included, so the menu always opens on the short list of entries. A closed
|
|
57
96
|
* group's links stay in the HTML, `inert`.
|
|
97
|
+
*
|
|
98
|
+
* Two sheets share every behavior and differ in look alone (`surface`): the
|
|
99
|
+
* dark one, and the light one with the lockup across the top and the call to
|
|
100
|
+
* action and the numbers in a foot.
|
|
58
101
|
*/
|
|
59
102
|
export function SiteMenu({
|
|
60
103
|
open,
|
|
@@ -66,16 +109,21 @@ export function SiteMenu({
|
|
|
66
109
|
currentPath,
|
|
67
110
|
id,
|
|
68
111
|
label = "Menu",
|
|
112
|
+
surface = "dark",
|
|
113
|
+
brand,
|
|
69
114
|
}: SiteMenuProps) {
|
|
115
|
+
const light = surface === "light";
|
|
70
116
|
const [openGroup, setOpenGroup] = useState<number | null>(null);
|
|
71
117
|
const groupId = useId();
|
|
72
118
|
const dialogRef = useRef<HTMLDialogElement>(null);
|
|
119
|
+
const closeRef = useRef<HTMLButtonElement>(null);
|
|
73
120
|
// Whether the owner already knows the menu is closed. Escape fires cancel
|
|
74
121
|
// and then close, and a followed link closes the dialog and notifies
|
|
75
122
|
// directly, so every path runs through reportClosed and reports once.
|
|
76
123
|
const closedRef = useRef(true);
|
|
77
124
|
// Only a plain entry wears a number, so the numbers count those alone and
|
|
78
|
-
// run 01, 02, 03 down the menu whatever groups sit between them.
|
|
125
|
+
// run 01, 02, 03 down the menu whatever groups sit between them. The light
|
|
126
|
+
// sheet sets none.
|
|
79
127
|
const numbers: number[] = [];
|
|
80
128
|
let counted = 0;
|
|
81
129
|
for (const link of links) numbers.push(isGroup(link) ? 0 : ++counted);
|
|
@@ -86,9 +134,14 @@ export function SiteMenu({
|
|
|
86
134
|
closedRef.current = !open;
|
|
87
135
|
// No group is open when the menu opens, whatever page it opens on.
|
|
88
136
|
if (open) setOpenGroup(null);
|
|
89
|
-
if (open && !dialog.open)
|
|
137
|
+
if (open && !dialog.open) {
|
|
138
|
+
dialog.showModal();
|
|
139
|
+
// The light sheet's first stop is the lockup's home link, so focus
|
|
140
|
+
// starts on its close button, where the dark sheet's already does.
|
|
141
|
+
if (light) closeRef.current?.focus();
|
|
142
|
+
}
|
|
90
143
|
if (!open && dialog.open) dialog.close();
|
|
91
|
-
}, [open]);
|
|
144
|
+
}, [open, light]);
|
|
92
145
|
|
|
93
146
|
const reportClosed = () => {
|
|
94
147
|
if (closedRef.current) return;
|
|
@@ -105,6 +158,135 @@ export function SiteMenu({
|
|
|
105
158
|
reportClosed();
|
|
106
159
|
};
|
|
107
160
|
|
|
161
|
+
// The menu's own words for the action, else the bar's.
|
|
162
|
+
const menuCTA = primaryCTA && { ...primaryCTA, label: primaryCTA.menuLabel ?? primaryCTA.label };
|
|
163
|
+
|
|
164
|
+
const closeButton = (
|
|
165
|
+
<button
|
|
166
|
+
ref={closeRef}
|
|
167
|
+
type="button"
|
|
168
|
+
className="mm-close"
|
|
169
|
+
aria-label="Close menu"
|
|
170
|
+
onClick={close}
|
|
171
|
+
>
|
|
172
|
+
{light ? (
|
|
173
|
+
<X size={20} aria-hidden="true" />
|
|
174
|
+
) : (
|
|
175
|
+
<>
|
|
176
|
+
<span />
|
|
177
|
+
<span />
|
|
178
|
+
</>
|
|
179
|
+
)}
|
|
180
|
+
</button>
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const entries = links.map((link, i) =>
|
|
184
|
+
isGroup(link) ? (
|
|
185
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a one page site points several entries at one page or anchor, so the place keeps the key unique; the menu never reorders
|
|
186
|
+
<div className="mm-group" key={i}>
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
className="mm-link mm-group-btn"
|
|
190
|
+
aria-expanded={openGroup === i}
|
|
191
|
+
aria-controls={`${groupId}${i}`}
|
|
192
|
+
onClick={() => setOpenGroup((current) => (current === i ? null : i))}
|
|
193
|
+
>
|
|
194
|
+
<span>{link.label}</span>
|
|
195
|
+
<ChevronDown className="mm-chevron" size={light ? 20 : 22} aria-hidden="true" />
|
|
196
|
+
</button>
|
|
197
|
+
<div
|
|
198
|
+
id={`${groupId}${i}`}
|
|
199
|
+
className={["mm-group-panel", openGroup === i && "is-open"].filter(Boolean).join(" ")}
|
|
200
|
+
inert={openGroup !== i}
|
|
201
|
+
>
|
|
202
|
+
{link.allLabel && (
|
|
203
|
+
<a
|
|
204
|
+
className="mm-group-all"
|
|
205
|
+
href={link.href}
|
|
206
|
+
onClick={close}
|
|
207
|
+
aria-current={currentPath === link.href ? "page" : undefined}
|
|
208
|
+
>
|
|
209
|
+
{link.allLabel}
|
|
210
|
+
</a>
|
|
211
|
+
)}
|
|
212
|
+
{panelSections(link).map((section, index) => (
|
|
213
|
+
<MenuSection
|
|
214
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a group's sections never reorder while the menu is open
|
|
215
|
+
key={index}
|
|
216
|
+
section={section}
|
|
217
|
+
currentPath={currentPath}
|
|
218
|
+
onNavigate={close}
|
|
219
|
+
/>
|
|
220
|
+
))}
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
) : (
|
|
224
|
+
<a
|
|
225
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: as above, entries may share an href
|
|
226
|
+
key={i}
|
|
227
|
+
className="mm-link"
|
|
228
|
+
href={link.href}
|
|
229
|
+
onClick={close}
|
|
230
|
+
aria-current={currentPath === link.href ? "page" : undefined}
|
|
231
|
+
>
|
|
232
|
+
<span className="mm-label">{link.label}</span>
|
|
233
|
+
{!light && <span className="idx">{String(numbers[i]).padStart(2, "0")}</span>}
|
|
234
|
+
</a>
|
|
235
|
+
),
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
if (light) {
|
|
239
|
+
// A card per number the header shows, else the contact block's one phone.
|
|
240
|
+
const cards: MenuPhone[] = phones ?? (contact?.phone ? [contact.phone] : []);
|
|
241
|
+
return (
|
|
242
|
+
<dialog
|
|
243
|
+
ref={dialogRef}
|
|
244
|
+
id={id}
|
|
245
|
+
className="mobile-menu is-light"
|
|
246
|
+
aria-label={label}
|
|
247
|
+
onCancel={reportClosed}
|
|
248
|
+
onClose={reportClosed}
|
|
249
|
+
>
|
|
250
|
+
<div className="mm-top">
|
|
251
|
+
{brand && <BrandLockup brand={brand} surface="light" onClick={close} />}
|
|
252
|
+
{closeButton}
|
|
253
|
+
</div>
|
|
254
|
+
<div className="mm-list">{entries}</div>
|
|
255
|
+
{(menuCTA || cards.length > 0) && (
|
|
256
|
+
<div className="mm-foot">
|
|
257
|
+
{menuCTA && (
|
|
258
|
+
<Button
|
|
259
|
+
size="lg"
|
|
260
|
+
className="mm-cta"
|
|
261
|
+
href={menuCTA.href}
|
|
262
|
+
newTab={menuCTA.external}
|
|
263
|
+
arrow={menuCTA.arrow}
|
|
264
|
+
onClick={close}
|
|
265
|
+
>
|
|
266
|
+
{menuCTA.label}
|
|
267
|
+
</Button>
|
|
268
|
+
)}
|
|
269
|
+
{cards.map((line) => {
|
|
270
|
+
const words = menuPhoneLabel(line);
|
|
271
|
+
return (
|
|
272
|
+
// The words and the number are one name, spaced as they read.
|
|
273
|
+
<a
|
|
274
|
+
key={line.e164}
|
|
275
|
+
className="mm-phone-card"
|
|
276
|
+
href={`tel:${line.e164}`}
|
|
277
|
+
aria-label={`${words} ${line.display}`}
|
|
278
|
+
>
|
|
279
|
+
<span className="mm-phone-label">{words}</span>
|
|
280
|
+
<span className="mm-phone-number tel-number">{line.display}</span>
|
|
281
|
+
</a>
|
|
282
|
+
);
|
|
283
|
+
})}
|
|
284
|
+
</div>
|
|
285
|
+
)}
|
|
286
|
+
</dialog>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
108
290
|
return (
|
|
109
291
|
<dialog
|
|
110
292
|
ref={dialogRef}
|
|
@@ -114,68 +296,18 @@ export function SiteMenu({
|
|
|
114
296
|
onCancel={reportClosed}
|
|
115
297
|
onClose={reportClosed}
|
|
116
298
|
>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<button
|
|
126
|
-
type="button"
|
|
127
|
-
className="mm-link mm-group-btn"
|
|
128
|
-
aria-expanded={openGroup === i}
|
|
129
|
-
aria-controls={`${groupId}${i}`}
|
|
130
|
-
onClick={() => setOpenGroup((current) => (current === i ? null : i))}
|
|
131
|
-
>
|
|
132
|
-
<span>{link.label}</span>
|
|
133
|
-
<ChevronDown className="mm-chevron" size={22} aria-hidden="true" />
|
|
134
|
-
</button>
|
|
135
|
-
<div
|
|
136
|
-
id={`${groupId}${i}`}
|
|
137
|
-
className={["mm-group-panel", openGroup === i && "is-open"].filter(Boolean).join(" ")}
|
|
138
|
-
inert={openGroup !== i}
|
|
139
|
-
>
|
|
140
|
-
{link.allLabel && (
|
|
141
|
-
<a className="mm-group-all" href={link.href} onClick={close}>
|
|
142
|
-
{link.allLabel}
|
|
143
|
-
</a>
|
|
144
|
-
)}
|
|
145
|
-
{panelSections(link).map((section, index) => (
|
|
146
|
-
<MenuSection
|
|
147
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: a group's sections never reorder while the menu is open
|
|
148
|
-
key={index}
|
|
149
|
-
section={section}
|
|
150
|
-
currentPath={currentPath}
|
|
151
|
-
onNavigate={close}
|
|
152
|
-
/>
|
|
153
|
-
))}
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
) : (
|
|
157
|
-
<a
|
|
158
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: as above, entries may share an href
|
|
159
|
-
key={i}
|
|
160
|
-
className="mm-link"
|
|
161
|
-
href={link.href}
|
|
162
|
-
onClick={close}
|
|
163
|
-
aria-current={currentPath === link.href ? "page" : undefined}
|
|
164
|
-
>
|
|
165
|
-
<span>{link.label}</span>
|
|
166
|
-
<span className="idx">{String(numbers[i]).padStart(2, "0")}</span>
|
|
167
|
-
</a>
|
|
168
|
-
),
|
|
169
|
-
)}
|
|
170
|
-
{primaryCTA && (
|
|
171
|
-
<a
|
|
172
|
-
className="btn btn-primary btn-lg mm-cta"
|
|
173
|
-
href={primaryCTA.href}
|
|
299
|
+
{closeButton}
|
|
300
|
+
{entries}
|
|
301
|
+
{menuCTA && (
|
|
302
|
+
<Button
|
|
303
|
+
size="lg"
|
|
304
|
+
className="mm-cta"
|
|
305
|
+
href={menuCTA.href}
|
|
306
|
+
newTab={menuCTA.external}
|
|
174
307
|
onClick={close}
|
|
175
|
-
{...newTabProps(primaryCTA.href, primaryCTA.external)}
|
|
176
308
|
>
|
|
177
|
-
{
|
|
178
|
-
</
|
|
309
|
+
{menuCTA.label}
|
|
310
|
+
</Button>
|
|
179
311
|
)}
|
|
180
312
|
{(contact || phones) && <ContactBlock contact={contact ?? {}} phones={phones} />}
|
|
181
313
|
</dialog>
|
|
@@ -205,19 +337,19 @@ function MenuSection({
|
|
|
205
337
|
// A child may share its parent's href, and two rows may share one, so a
|
|
206
338
|
// link is keyed by its place, never its href alone.
|
|
207
339
|
const link = (
|
|
208
|
-
item: { label: string; href: string; external?: boolean; badge?: string },
|
|
340
|
+
item: { label: string; href: string; external?: boolean; badge?: string; quiet?: boolean },
|
|
209
341
|
className: string,
|
|
210
342
|
key: string,
|
|
211
343
|
) => (
|
|
212
344
|
<a
|
|
213
345
|
key={key}
|
|
214
|
-
className={className}
|
|
346
|
+
className={item.quiet ? `${className} is-quiet` : className}
|
|
215
347
|
href={item.href}
|
|
216
348
|
onClick={onNavigate}
|
|
217
349
|
aria-current={currentPath === item.href ? "page" : undefined}
|
|
218
350
|
{...newTabProps(item.href, item.external)}
|
|
219
351
|
>
|
|
220
|
-
{
|
|
352
|
+
<span className="mm-label">{telText(item.href, item.label)}</span>
|
|
221
353
|
<Badge text={item.badge} />
|
|
222
354
|
</a>
|
|
223
355
|
);
|
|
@@ -283,7 +415,7 @@ function ContactBlock({
|
|
|
283
415
|
? phones.map((line) => (
|
|
284
416
|
<span key={line.e164}>
|
|
285
417
|
<a className="mm-contact-link" href={`tel:${line.e164}`}>
|
|
286
|
-
{line.
|
|
418
|
+
{menuPhoneLabel(line).toUpperCase()} {line.display}
|
|
287
419
|
</a>
|
|
288
420
|
<br />
|
|
289
421
|
</span>
|
|
@@ -291,7 +423,7 @@ function ContactBlock({
|
|
|
291
423
|
: phone && (
|
|
292
424
|
<>
|
|
293
425
|
<a className="mm-contact-link" href={`tel:${phone.e164}`}>
|
|
294
|
-
|
|
426
|
+
{menuPhoneLabel(phone).toUpperCase()} {phone.display}
|
|
295
427
|
</a>
|
|
296
428
|
<br />
|
|
297
429
|
</>
|
package/src/chrome/SiteShell.tsx
CHANGED
|
@@ -242,6 +242,8 @@ export function SiteShell({
|
|
|
242
242
|
contact={{ phone: site.phone, email: site.email, address: site.address }}
|
|
243
243
|
phones={site.header?.phones}
|
|
244
244
|
menuLabel={site.menuLabel}
|
|
245
|
+
menuSurface={site.menu?.surface}
|
|
246
|
+
burger={site.menu?.burger}
|
|
245
247
|
/>
|
|
246
248
|
<main id="main" className={heroNav ? undefined : "clears-nav"}>
|
|
247
249
|
{children}
|
|
@@ -252,7 +254,7 @@ export function SiteShell({
|
|
|
252
254
|
<StickyCTABar
|
|
253
255
|
primaryCTA={stickyLink}
|
|
254
256
|
phone={site.phone}
|
|
255
|
-
fromTop={!heroNav}
|
|
257
|
+
fromTop={site.cta.stickyFromTop ?? !heroNav}
|
|
256
258
|
onSpaceChange={setBarSpace}
|
|
257
259
|
/>
|
|
258
260
|
)}
|
|
@@ -47,6 +47,8 @@ export function StickyCTABar({
|
|
|
47
47
|
const spaceRef = useRef(onSpaceChange);
|
|
48
48
|
spaceRef.current = onSpaceChange;
|
|
49
49
|
const listening = onSpaceChange !== undefined;
|
|
50
|
+
// The measuring effect's report, so a swap of listeners is told at once.
|
|
51
|
+
const reportRef = useRef<(() => void) | null>(null);
|
|
50
52
|
|
|
51
53
|
useEffect(() => {
|
|
52
54
|
if (fromTop) {
|
|
@@ -82,10 +84,12 @@ export function StickyCTABar({
|
|
|
82
84
|
heard?.(next);
|
|
83
85
|
};
|
|
84
86
|
report();
|
|
87
|
+
reportRef.current = report;
|
|
85
88
|
const sizes = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(report);
|
|
86
89
|
sizes?.observe(bar);
|
|
87
90
|
window.addEventListener("resize", report);
|
|
88
91
|
return () => {
|
|
92
|
+
reportRef.current = null;
|
|
89
93
|
sizes?.disconnect();
|
|
90
94
|
window.removeEventListener("resize", report);
|
|
91
95
|
// A final 0 on unmount, on hiding, and when the listener goes, to the
|
|
@@ -94,6 +98,14 @@ export function StickyCTABar({
|
|
|
94
98
|
};
|
|
95
99
|
}, [show, listening]);
|
|
96
100
|
|
|
101
|
+
// A caller that swaps listeners is heard at once: the old one gives its
|
|
102
|
+
// space back and the new one is told the height, with no resize to wait
|
|
103
|
+
// for. A first render's report has already run, so this one says nothing.
|
|
104
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the listener is the trigger; the report reads it through spaceRef
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
reportRef.current?.();
|
|
107
|
+
}, [onSpaceChange]);
|
|
108
|
+
|
|
97
109
|
return (
|
|
98
110
|
// Inert while offscreen, so its links take no keyboard focus before it slides in.
|
|
99
111
|
// data-dock-lift and data-showing tell the contact dock to ride above it.
|
package/src/chrome/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type {
|
|
|
12
12
|
FooterIcon,
|
|
13
13
|
HeaderPhone,
|
|
14
14
|
HoursRow,
|
|
15
|
+
MenuBurgerStyle,
|
|
15
16
|
MenuContact,
|
|
16
17
|
NavCard,
|
|
17
18
|
NavCardsSection,
|
|
@@ -28,6 +29,7 @@ export type {
|
|
|
28
29
|
Phone,
|
|
29
30
|
PostalAddress,
|
|
30
31
|
SiteLink,
|
|
32
|
+
SiteMenuSurface,
|
|
31
33
|
SocialLink,
|
|
32
34
|
} from "../types";
|
|
33
35
|
export { BrandLockup, type BrandLockupProps } from "./BrandLockup";
|
package/src/lib/phoneText.tsx
CHANGED
|
@@ -38,3 +38,12 @@ export function holdPhoneNumbers(content: ReactNode): ReactNode {
|
|
|
38
38
|
</span>
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The words of a link, with any phone number in them held whole when the
|
|
44
|
+
* link calls (`holdPhoneNumbers` on a `tel:` href), and as given otherwise.
|
|
45
|
+
* The one way a component sets a link's words that may hold a number.
|
|
46
|
+
*/
|
|
47
|
+
export function telText(href: string | undefined, content: ReactNode): ReactNode {
|
|
48
|
+
return isTel(href) ? holdPhoneNumbers(content) : content;
|
|
49
|
+
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { errorCatcherScript } from "./catcher";
|
|
2
2
|
|
|
3
|
+
export interface ErrorCatcherScriptProps {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the catcher renders at all. Defaults to true. A root route
|
|
6
|
+
* passes whether the build has a DSN (`enabled={Boolean(env.VITE_SENTRY_DSN)}`),
|
|
7
|
+
* so a site built without one ships no catcher holding errors nobody reads.
|
|
8
|
+
*/
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
/**
|
|
4
|
-
* The inline early catcher as an element, for
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `startErrorReporting` hands it to Sentry.
|
|
8
|
-
*
|
|
13
|
+
* The inline early catcher as an element, for a root route's `<head>` ahead
|
|
14
|
+
* of `<HeadContent />` and every other script: it is the page's first script
|
|
15
|
+
* and runs before any other, so an error thrown before the app's own
|
|
16
|
+
* JavaScript is held until `startErrorReporting` hands it to Sentry. React 19
|
|
17
|
+
* hoists the title, the meta tags, the preloads, and the stylesheets ahead of
|
|
18
|
+
* it, which changes nothing it does. With `enabled` false it renders nothing.
|
|
9
19
|
*/
|
|
10
|
-
export function ErrorCatcherScript() {
|
|
20
|
+
export function ErrorCatcherScript({ enabled = true }: ErrorCatcherScriptProps = {}) {
|
|
21
|
+
if (!enabled) return null;
|
|
11
22
|
return (
|
|
12
23
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: the package's own constant script, no outside input
|
|
13
24
|
<script dangerouslySetInnerHTML={{ __html: errorCatcherScript }} />
|