@atelic-action/ui 8.4.0 → 8.5.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 (37) hide show
  1. package/README.md +50 -5
  2. package/dist/lib/contactLinks.d.ts +31 -0
  3. package/dist/lib/contactLinks.js +55 -0
  4. package/dist/scripts/check-contacts.d.ts +17 -0
  5. package/dist/scripts/check-contacts.js +162 -0
  6. package/package.json +10 -13
  7. package/src/chrome/Footer.tsx +4 -3
  8. package/src/chrome/SiteHeader.tsx +7 -6
  9. package/src/chrome/SiteMenu.tsx +11 -9
  10. package/src/chrome/StickyCTABar.tsx +3 -2
  11. package/src/components/GateLogin.tsx +2 -1
  12. package/src/components/MultiSelect.tsx +225 -0
  13. package/src/components/index.ts +1 -0
  14. package/src/lib/contactForm.ts +184 -0
  15. package/src/lib/contactLinks.ts +57 -0
  16. package/src/lib/googlePlaces.ts +392 -0
  17. package/src/lib/latestOnly.ts +47 -0
  18. package/src/primitives/AddressSearch.tsx +341 -0
  19. package/src/primitives/EmailLink.tsx +55 -0
  20. package/src/primitives/ExpandableText.tsx +137 -0
  21. package/src/primitives/GoogleMapsAttribution.tsx +14 -0
  22. package/src/primitives/PhoneLink.tsx +61 -0
  23. package/src/primitives/index.ts +18 -0
  24. package/src/scripts/check-base-path.ts +15 -0
  25. package/src/scripts/check-contacts.ts +177 -0
  26. package/src/sections/ContactForm.tsx +683 -87
  27. package/src/sections/ContactInfoCard.tsx +20 -5
  28. package/src/sections/InfoRows.tsx +103 -0
  29. package/src/sections/LocationSection.tsx +2 -1
  30. package/src/sections/Locations.tsx +3 -2
  31. package/src/sections/PageHero.tsx +22 -5
  32. package/src/sections/index.ts +23 -1
  33. package/src/styles/components.css +123 -0
  34. package/src/styles/defaults.css +31 -1
  35. package/src/styles/fields.css +33 -0
  36. package/src/styles/primitives.css +165 -0
  37. package/src/styles/sections.css +306 -19
package/README.md CHANGED
@@ -30,6 +30,7 @@ Every export, grouped by the entry it is imported from. The Storybook column lin
30
30
  | `StatRow` | `@atelic-action/ui/components` | A row of large figures with periods, deltas, and trends; a share's denominator set small after the figure (`outOf`) and a change set small beside it with a triangle (`change`), 3.14.0 | [Components/StatRow](https://ui.atelic.me/?path=/docs/components-statrow--docs) |
31
31
  | `Callout` | `@atelic-action/ui/components` | One finding: an icon in its tone, the title, the explainer (not `CalloutPanel`, the business's headline claims) | [Components/Callout](https://ui.atelic.me/?path=/docs/components-callout--docs) |
32
32
  | `Disclosure` | `@atelic-action/ui/components` | A section that folds: controlled, an app's card; uncontrolled, a native details fold that prints open | [Components/Disclosure](https://ui.atelic.me/?path=/docs/components-disclosure--docs) |
33
+ | `MultiSelect`, `MultiSelectOption`, `MultiSelectProps` | `@atelic-action/ui/components` | A button naming what is chosen over a Radix popover of Radix checkboxes, any number ticked, each chosen value submitted under `name`; styled in `components.css`, so an app draws it too (8.5.0) | [Components/MultiSelect](https://ui.atelic.me/?path=/docs/components-multiselect--docs) |
33
34
  | `Tabs`, `TabsItem` | `@atelic-action/ui/components` | Panels behind a row of tabs, every panel kept in the page: a hash opens the tab or the panel holding what it names, and it prints every panel under its label | [Components/Tabs](https://ui.atelic.me/?path=/docs/components-tabs--docs) |
34
35
  | `StackedBar` | `@atelic-action/ui/components` | One bar split into the parts of a whole, with a key | [Components/StackedBar](https://ui.atelic.me/?path=/docs/components-stackedbar--docs) |
35
36
  | `ColumnChart` | `@atelic-action/ui/components` | A bar a period, the periods in labeled groups | [Components/ColumnChart](https://ui.atelic.me/?path=/docs/components-columnchart--docs) |
@@ -39,6 +40,12 @@ Every export, grouped by the entry it is imported from. The Storybook column lin
39
40
  | `Watermark` | `@atelic-action/ui/components` | The signed in reader's confidential stamp, pill or tiled | [Components/Watermark](https://ui.atelic.me/?path=/docs/components-watermark--docs) |
40
41
  | `readCookie`, `Tone` | `@atelic-action/ui/components` | The cookie reader the watermark uses, and the tone type | none |
41
42
  | `Button`, `PrimaryButton`, `SecondaryButton`, `Chip`, `Eyebrow`, `Lead`, `SectionHeading` | `@atelic-action/ui/primitives` | The small pieces a page is set in; the two named buttons are the only call to action shapes a page uses | [Primitives/Button](https://ui.atelic.me/?path=/docs/primitives-button--docs) |
43
+ | `AddressSearch`, `AddressProvider`, `AddressSuggestion`, `AddressParts`, `AddressSearchProps` | `@atelic-action/ui/primitives` | A field that offers addresses as they are typed from the provider a site passes, and hands back the street, city, state, and ZIP on a pick; renders nothing without a provider (8.5.0) | [Primitives/AddressSearch](https://ui.atelic.me/?path=/docs/primitives-addresssearch--docs) |
44
+ | `googlePlacesProvider`, `GooglePlacesOptions`, `GoogleMapsAttribution`, `addressFromComponents`, `AddressComponent` | `@atelic-action/ui/primitives` | Google's address suggestions as an `AddressSearch` provider from a key alone (the Maps JavaScript API's Places library, loaded on the field's first focus, one session token per search and pick), the "Google Maps" credit its terms ask for, and the mapping from Google's address components to street, city, state, and ZIP (8.5.0) | [Primitives/AddressSearch](https://ui.atelic.me/?path=/docs/primitives-addresssearch--docs) |
45
+ | `PhoneLink`, `EmailLink`, `phoneHref`, `emailHref`, `PhoneLinkProps`, `EmailLinkProps` | `@atelic-action/ui/primitives` | The one way the package draws a phone number and an email address as links (Component Rules 17): `PhoneLink` takes the site's phone (`e164`, `display`) or a typed number, `EmailLink` an address, breakable after the @ and before each dot; neither opens a new tab; a configured number or address links exactly as given, as before, and only one with nothing to dial or write shows as words (8.5.0) | [Primitives/PhoneLink](https://ui.atelic.me/?path=/docs/primitives-phonelink--docs) |
46
+ | `toE164`, `isE164`, `isEmail`, `EMAIL_PATTERN` | `@atelic-action/ui/primitives` | The light checks the links and the contact form share: a typed number read into E.164 (ten digits take +1), and the address pattern (8.5.0) | none |
47
+ | `contactProblems` | `@atelic-action/ui/scripts/contacts` | The build time check on phone numbers and addresses, against Google's numbering plan (`libphonenumber-js`), for a site's own test of numbers it passes as props (8.5.0) | none |
48
+ | `ExpandableText`, `ExpandableTextProps` | `@atelic-action/ui/primitives` | Long text clamped to a few lines behind Show more, every word kept in the page, a checkbox's whole label when `labelFor` is set (8.5.0) | [Primitives/ExpandableText](https://ui.atelic.me/?path=/docs/primitives-expandabletext--docs) |
42
49
  | `GradeChip`, `gradeLabel`, `WriteupGrade` | `@atelic-action/ui/artifact` | A section's grade, A to D, as a chip in its color, the letter alone, and the grade type | [Artifact/GradeChip](https://ui.atelic.me/?path=/docs/artifact-gradechip--docs) |
43
50
  | `SignOff`, `WriteupPerson` | `@atelic-action/ui/artifact` | The close a document ends on, and the person it names | [Artifact/SignOff](https://ui.atelic.me/?path=/docs/artifact-signoff--docs) |
44
51
  | `Shot`, `WriteupShot` | `@atelic-action/ui/artifact` | The owner's own screen, opening the full picture, over its caption; a portrait crop is marked `data-portrait` and held to 200px (1.8in in print) | [Artifact/Shot](https://ui.atelic.me/?path=/docs/artifact-shot--docs) |
@@ -69,8 +76,10 @@ Every export, grouped by the entry it is imported from. The Storybook column lin
69
76
  | `CalloutPanel` | `@atelic-action/ui/sections` | Short callouts on the primary field, a heavy title over a subtitle each, four across and two by two below, titles and subtitles each on a shared line (8.0.0) | [Sections/CalloutPanel](https://ui.atelic.me/?path=/docs/sections-calloutpanel--docs) |
70
77
  | `CTASection` | `@atelic-action/ui/sections` | The standard closer: the site's own primary action and an optional ghost second | [Sections/CTASection](https://ui.atelic.me/?path=/docs/sections-ctasection--docs) |
71
78
  | `ComparisonTable` | `@atelic-action/ui/sections` | A graded before and after that scrolls sideways on a phone rather than reflowing; a row's label can link to what explains it (`stageHref`, 3.14.0) | [Sections/ComparisonTable](https://ui.atelic.me/?path=/docs/sections-comparisontable--docs) |
72
- | `ContactForm` | `@atelic-action/ui/sections` | Validated form with a honeypot that posts to `endpoint` (or hands off to mail); `onLead` replaces the default GA4 `generate_lead` event | [Sections/ContactForm](https://ui.atelic.me/?path=/docs/sections-contactform--docs) |
73
- | `ContactInfoCard` | `@atelic-action/ui/sections` | A dark card of direct contact rows: call, email, visit, portal | [Sections/ContactInfoCard](https://ui.atelic.me/?path=/docs/sections-contactinfocard--docs) |
79
+ | `ContactForm` | `@atelic-action/ui/sections` | Validated form with a honeypot that posts to `endpoint` (or hands off to mail); `onLead` replaces the default GA4 `generate_lead` event; opt in props add a split name, a phone, the address with its search, a services picker, a consent line, a count of fields to fix, and a thanks that replaces the form (8.5.0) | [Sections/ContactForm](https://ui.atelic.me/?path=/docs/sections-contactform--docs) |
80
+ | `ContactFormAddress`, `ContactFormConsent`, `ContactFormLabels`, `ContactFormPlaceholders`, `ContactFormThanks`, `ContactFormValues`, `ContactFormField`, `isPhoneNumber`, `isZIP` | `@atelic-action/ui/sections` | The shapes the form's opt in props take, what a visitor wrote, and the form's default phone and ZIP checks (8.5.0) | none |
81
+ | `ContactInfoCard` | `@atelic-action/ui/sections` | A dark card of direct contact rows: call, email, visit, portal; `layout="stacked"` sets each label over its number (8.5.0) | [Sections/ContactInfoCard](https://ui.atelic.me/?path=/docs/sections-contactinfocard--docs) |
82
+ | `InfoRows`, `InfoRow`, `InfoRowAction`, `InfoRowIcon`, `InfoRowsProps` | `@atelic-action/ui/sections` | Rows of a title over a few lines with one icon action on the right, the way a map pack lists a place with its directions (8.5.0) | [Sections/InfoRows](https://ui.atelic.me/?path=/docs/sections-inforows--docs) |
74
83
  | `CredentialList` | `@atelic-action/ui/sections` | Credential cards with a mono code before each | [Sections/CredentialList](https://ui.atelic.me/?path=/docs/sections-credentiallist--docs) |
75
84
  | `ExpandList` | `@atelic-action/ui/sections` | A light accordion of numbered rows whose bodies stay in the HTML while closed | [Sections/ExpandList](https://ui.atelic.me/?path=/docs/sections-expandlist--docs) |
76
85
  | `FAQBrowser` | `@atelic-action/ui/sections` | The help page: live search, a sticky `JumpRail` of categories with scroll spy, expand all, deep links; `contactHref` sets where the no match line points | [Sections/FAQBrowser](https://ui.atelic.me/?path=/docs/sections-faqbrowser--docs) |
@@ -288,6 +297,14 @@ import { Button, SectionHeading } from "@atelic-action/ui/primitives";
288
297
 
289
298
  `Button` is an anchor when it has an `href` and a real button otherwise. It puts the base path from `BasePathProvider` on a root path `href` (0.19.0), so a site served under a prefix needs no wrapper; with no provider above it the `href` renders as given. Its arrow is hidden from the name a screen reader hears.
290
299
 
300
+ `AddressSearch` and `ExpandableText` (8.5.0) are the two form primitives. `AddressSearch` is the ARIA combobox: it asks the `provider` a site passes (`suggest` from the typed text to suggestions, `resolve` from a pick to `{ street, city, state, zip }`, each handed an `AbortSignal`) after a pause in the typing, drops an answer that comes back after a newer question, and hands the parts to `onPick`; it knows no service, so a site wraps Google's address autocomplete, or any other, in those two functions and passes the credit its terms ask for as `attribution`. Without a provider it renders nothing. A provider may also have `prepare()`, which the search calls on each focus of the field.
301
+
302
+ `googlePlacesProvider({ apiKey, regionCodes, near, types, language, region })` is the one provider the package ships. It runs on the Maps JavaScript API's Places library (the Autocomplete Data API, the New one), not the Places web service: Google documents a website restricted key for the JavaScript API and does not document one for calling `places.googleapis.com` from a browser, where its security guidance files the web service under servers. The script loads on the field's first focus (`prepare`), never at page load, and once per key; it uses the API when the page already has it, waits for a Maps script already on the page rather than adding a second, and takes the older `google.maps.places` namespace where `importLibrary` is missing. A failed load takes its tag back out; searches then hand back the same failure for 30 seconds rather than adding a tag per keystroke, and the field's next focus tries again at once. One `AutocompleteSessionToken` covers every search up to a pick; the pick's `fetchFields` ends the session, and the next search makes a new token, so a search and its pick bill as one session. The pick asks for `addressComponents` alone, an Essentials field. Suggestions default to addresses, buildings, and units (`street_address`, `premise`, `subpremise`; up to five types); `regionCodes` limits the countries, and `near` (`lat`, `lng`, `radius` in meters) prefers a point without limiting to it. The form's ZIP check is US only, on purpose: every consumer is a US business, and a pluggable check waits for the first one that is not. A failed load or search offers nothing, so the plain fields still take the address; an aborted search rejects. The key is a browser key: restrict it to the site's domains and to the Maps JavaScript API and Places API (New).
303
+
304
+ **Google's attribution.** Google's Places policies ask for attribution wherever its content shows without a Google map: the Google Maps logo where there is room, or else the text "Google Maps", unmodified, never translated (`translate="no"`), never wrapped, 12 to 16 pixels in a regular weight, at 4.5 to 1 contrast, inside the same container as the content, near its top or bottom. "Google" alone is accepted for now as the older form; "Powered by Google" does not appear in the current policy. `GoogleMapsAttribution` draws the text form, and `AddressSearch` sets it under the suggestions; a site that wants the logo passes its own node as `attribution`.
305
+
306
+ `ExpandableText` clamps prose to `lines` with a Show more under it (`aria-expanded`, its words by prop); the cut is a line clamp, so every word stays in the page and a checkbox it labels (`labelFor`) is named by the whole text, and anything a reader acts on goes in `more`, hidden and `inert` while closed. With `inline` the control sits at the end of the last line instead: closed, over the line's end on a fade of `--expandable-ground` after an ellipsis drawn with empty alternative text; open, after the last word. It stays a sibling of the text, so a checkbox the text labels is never named with the control's words. The multi select beside them is a component, `MultiSelect` in `@atelic-action/ui/components`, since an app draws it too.
307
+
291
308
  `Bubble` (3.11.0) is the round tile set beside a heading or a numbered step, holding either a lucide icon the caller sizes (`icon`) or a short mono index (`num`, such as "01"); given both, the icon sits inside and the number rides a small badge on the lower right rim, the way an unread count sits on an app icon. It comes in three sizes (`sm`, `md`, `lg`: 36, 48, and 60 pixels across, `md` by default) and lifts its fill for a dark band with `onDark`, the way `Chip` does. It is decoration and wears `aria-hidden`, so the heading beside it carries the meaning, the step's number included.
292
309
 
293
310
  ## The Access Gate
@@ -731,6 +748,22 @@ The space a section leaves above and below itself is one token, `--section-space
731
748
 
732
749
  `.section` pads with it, and the steps derived from it keep their old proportion to it: `.section-md` 0.7, `.section-sm` 0.6, `tight-top` and `tight-bottom` a third, the `PricingBand` 0.84, `PageHero` and the not found opener 0.72 on top and 0.5 below, and the `FeatureDetail` rows 0.6, whose first and last rows now sit flush with the section around them. `--block-gap` is the space between a section's heading and the grid under it (`FeatureGrid`, `ProfileCards`, `LinkColumns`, `CalloutPanel`, and `Gallery` at 0.77 of it), and `--card-min` the least a `FeatureGrid` card stands. A site that wants its own value sets the property on `.atelic-ui` in its own sheet, outside the layer. `ArtifactShell` pins `comfortable`, so a document reads as it did; the app shell reads none of these.
733
750
 
751
+ ### Moving to 8.5.0
752
+
753
+ No API breaks, and nothing moves on a site that changes nothing: every addition is an optional prop, an export, or a token whose default is the look it had. `@radix-ui/react-popover` and `@radix-ui/react-checkbox` move from optional peers to dependencies, as `@radix-ui/react-tabs` is, so a marketing site installs nothing for `MultiSelect`; an app that already had them keeps one copy where the ranges meet.
754
+
755
+ **The contact form's opt in fields.** `ContactForm` takes `splitName`, `phone` (`"optional"` or `"required"`), `address` (`required`, a `provider` and its `attribution` for the search, `states` for a state select, `defaultState`), `services` (a `MultiSelect` in place of the topic select), `consent` (its wording, its `links`, its `lines`), `labels`, `placeholders`, `errorText`, `errorSummary` (a count of the fields to fix over the form), `thanks` (a heading, a lead, the read back, the next steps, and Send another message, replacing the form once sent), and `validatePhone`. `topics` is optional now; with none and no `services`, no select is drawn. The body keeps `name`, `email`, `topic`, `message`, and `company` whatever is drawn, so a relay that reads only those works unchanged: with the split name `name` is the two joined, with services `topic` is the chosen ones joined by commas. Each opt in field adds its own keys (`firstName`, `lastName`, `phone`, `address`, `services`, `consent`), which a relay has to read to pass them on.
756
+
757
+ **Phone and email links.** Every phone number and email address the package draws is a `PhoneLink` or an `EmailLink`, with the same markup and the same `href` as before, loose values included, so nothing moves on a site: the browser is never stricter than it was. Only a number with no digit, or an empty address, shows as words, with a warning in development. Strictness lives in the build: `atelic-check-base-path` checks the site config's contacts (`contactProblems`) against Google's numbering plan (`libphonenumber-js`, a new dependency that runs in the command only and never ships in a page), and a failure stops the build and names the field. It judges only what it is sure is a contact: a phone is an object holding `e164` and `display`, or a `Locations` entry's `phoneE164` and `phoneDisplay`, anywhere in the config, and its number must be valid in E.164 for its country with a display that reads as it; an address is a string at a known address path (`email`, `gate.contactEmail`, `analytics.identify.email`), never a string judged by its key's name, so a label reading "Email" is left alone; a `tel:` href must reduce to a valid number once RFC 3966's visual separators and parameters are set aside, and a `mailto:` href must write to an address. A site that passes numbers as props outside its config (a contact card's `phones`) checks them in its own test with `contactProblems` from `@atelic-action/ui/scripts/contacts`. The contact form's phone check is now the links' (`toE164`): a number typed with a + and its country code is accepted too.
758
+
759
+ **Google's address suggestions.** `googlePlacesProvider` is new in the primitives, and `ContactForm`'s `address` takes `googlePlacesKey` (and `googlePlacesOptions`): with a key, the address search offers Google's addresses under the "Google Maps" credit, a site's own `provider` and `attribution` still winning; with neither, the four fields stand alone. Nothing of Google's loads until the field is focused. It has not yet been run against Google's live API.
760
+
761
+ **The field label's tokens.** `.field label` reads `--field-label-font`, `--field-label-size`, `--field-label-weight`, `--field-label-case`, `--field-label-tracking`, and `--field-label-color`, as do the pickers' labels, and every field's border reads `--field-border`; a theme restyles every label in one place. A quiet note beside a label (`(optional)`) is `.field-hint`, in the body face. The errors read `--field-error`, `--field-error-border`, and `--field-error-bg`, each unset reading what it always did, so a theme sets its errors in the tone palette's bad (`--tone-bad`, `--tone-bad-bg`) without a rule of its own.
762
+
763
+ **Also new:** `InfoRows` in the sections, `ContactInfoCard`'s `layout="stacked"`, `PageHero`'s `surface="primary"` and `eyebrowRule`, a thanks with `lead: false` drawing no lead, `ExpandableText`'s `inline` (and the consent's `inline`), the error type, footnote, and hours tokens in the table below, and `.field.invalid` reaches a `select`. The pickers name their label's words and its hint apart (`aria-labelledby`), so their names keep the space between them where a page's HTML has lost it.
764
+
765
+ **One change on a site that changes nothing:** the contact form's footnote moved from an inline style to `.form-footnote` in the sheet, at the same size and spacing, so a site can restyle it; a site's own unlayered rule on bare `p` elements now reaches it, where the inline style used to win.
766
+
734
767
  ### Moving to 8.4.0
735
768
 
736
769
  No API breaks. One optional config key is new, `phone.menuLabel`, which makes this a minor; everything else is a fix.
@@ -857,7 +890,7 @@ Nothing breaks: every addition is an optional prop, config key, token, or entry.
857
890
  | `FullBleedVideo` | A silent looping clip edge to edge, the poster first and the clip only while on screen |
858
891
  | `CalloutPanel` | Short callouts on the primary field, titles and subtitles each on a shared line |
859
892
  | `LinkColumns` | Columns of links under a heading, a link's figure right aligned in tabular numerals |
860
- | `PageHero` | The interior page opener on the alternate band; children sit under the lead |
893
+ | `PageHero` | The interior page opener on the alternate band; children sit under the lead; `surface="primary"` sets it on the primary fill, every word in `--on-primary`, and `eyebrowRule={false}` sets the kicker without its rule, as `Hero`'s (8.5.0) |
861
894
  | `LogoMarquee` | A dark band of chips scrolling without end: credentials, clients, or press |
862
895
  | `SplitSection` | The two column band: copy beside copy, or media beside copy. `ratio` is `even`, `narrow-first`, or `media`, a fixed 420px shot column and the gap a card row uses, so a photo beside copy lines up with a case study entry above it; `even` and `narrow-first` stack below 920px, `media` below 761px |
863
896
  | `PricingBand` | A brand colored band with the price in a card beside it, informational by design |
@@ -878,8 +911,9 @@ Nothing breaks: every addition is an optional prop, config key, token, or entry.
878
911
  | `Locations` | More than one address: the flagship's map beside a card for each location |
879
912
  | `MapEmbed` | The map: a screenshot linking to directions, or a click to load facade over the live embed |
880
913
  | `HoursTable` | Day rows with dashed rules and mono times |
881
- | `ContactForm` | Validated form with a honeypot that posts to `endpoint` (or hands off to mail); `onLead` replaces the default GA4 `generate_lead` event |
882
- | `ContactInfoCard` | A dark card of direct contact rows: call, email, visit, portal; the single phone row reads `phoneLabel`, default "Call" (8.3.0) |
914
+ | `ContactForm` | Validated form with a honeypot that posts to `endpoint` (or hands off to mail); `onLead` replaces the default GA4 `generate_lead` event; the service business's opt in fields (8.5.0), below |
915
+ | `ContactInfoCard` | A dark card of direct contact rows: call, email, visit, portal; the single phone row reads `phoneLabel`, default "Call" (8.3.0); `layout="stacked"` puts each label over its number, the numbers large (8.5.0) |
916
+ | `InfoRows` | Rows of a title over lines (an address) and an optional `detail` (an office's hours), with one action on the right as an icon over its words; the action is described by its row's title, and a directions link opens a new tab with `newTab` (8.5.0) |
883
917
  | `FAQBrowser` | The help page: live search, a sticky `JumpRail` of categories with scroll spy, expand all, deep links; `contactHref` sets where the no match line points |
884
918
  | `JumpRail` | Sticky in page pill tabs with scroll spy, used by `FAQBrowser` and on its own |
885
919
  | `BlogIndex` | The post listing as a readable stack |
@@ -1126,6 +1160,17 @@ The sheets read a set of tokens beyond the theme's palette, type, radii, and lay
1126
1160
  | `--menu-rule` | `--hairline`, read in place | The light phone menu's row dividers (8.2.0) |
1127
1161
  | `--menu-badge-bg`, `--menu-badge-ink`, `--menu-cta-bg`, `--menu-cta-ink` | `--primary-fill`, `--on-primary` (as 8.0.0 drew them), read in place | The phone menu's badge and call to action. A theme whose sheet's ground equals its primary sets them to `--on-primary` and `--primary-ink`, or they vanish into the sheet (8.1.0) |
1128
1162
  | `--link-columns-min` | `170px` | The least a `LinkColumns` column narrows to (8.1.0) |
1163
+ | `--field-label-font`, `--field-label-size`, `--field-label-weight`, `--field-label-case`, `--field-label-tracking`, `--field-label-color` | `--font-mono` read in place, `0.74rem`, the inherited weight read in place, `uppercase`, `0.1em`, `--neutral-600` read in place | Every form field's label: `.field label`, and the labels of `AddressSearch` and `MultiSelect`; a design with labels in the body face sets `--field-label-font: var(--font-sans)`, `--field-label-case: none`, `--field-label-tracking: 0`, and its own size and weight (8.5.0) |
1164
+ | `--field-border` | `--neutral-200`, read in place | Every form field's border, the pickers' and their lists' included (8.5.0) |
1165
+ | `--field-error-size`, `--field-error-weight`, `--field-error-border-width` | `0.82rem`, the inherited weight read in place, `1.5px` | A refused field's message size and weight, and its border's width (8.5.0) |
1166
+ | `--form-footnote-size` | `0.82rem` | The contact form's footnote size (8.5.0) |
1167
+ | `--field-padding-block`, `--field-padding-inline` | `14px`, `16px` | Every form field's padding, the services button and the address search with them, so a form stays even (the search keeps its 44px for the pin) (8.5.0) |
1168
+ | `--page-hero-kicker-font`, `--page-hero-kicker-size`, `--page-hero-kicker-weight`, `--page-hero-kicker-tracking` | `--font-mono`, and the eyebrow's own size, weight, and tracking, read in place | `PageHero`'s kicker, as `--hero-kicker-*` set the hero's (8.5.0) |
1169
+ | `--page-hero-title-size`, `--page-hero-pad-block` | `clamp(2.4rem, 7vw, 4.2rem)`; none, each side keeping its own padding, read in place | `PageHero`'s headline size, and its band's top and bottom padding alike (8.5.0) |
1170
+ | `--form-footnote-align`, `--form-footnote-link-weight`, `--form-footnote-link-color` | each the inherited value, read in place | The contact form's line under its button (`footnote`, now `.form-footnote` in the sheet rather than an inline style): its alignment, and its links' weight and color (8.5.0) |
1171
+ | `--hours-rule`, `--hours-time-font`, `--hours-time-size` | `1px dashed --neutral-200` and `--font-mono`, read in place; `0.85rem` | `HoursTable`'s line under each row (a whole border value: `1px solid var(--hairline)` for a solid hairline), and its times' face and size (8.5.0) |
1172
+ | `--expandable-ground` | `--surface`, read in place | The ground an inline `ExpandableText` control fades over at the end of its clamped line; a form in a card sets `var(--card)` (8.5.0) |
1173
+ | `--field-error`, `--field-error-border`, `--field-error-bg` | `--primary-ink` (then `--primary`), `--primary-deep`, `--primary-tint`, read in place | A refused field's message, a refused field's border, and the count of fields to fix over the form: its words, border, and ground. A design that sets errors in the tone palette sets `--field-error: var(--tone-bad)`, `--field-error-border: var(--tone-bad)`, and `--field-error-bg: var(--tone-bad-bg)` (8.5.0) |
1129
1174
  | `--section-space`, `--block-gap`, `--card-min` | `clamp(56px, 9vw, 120px)`, `44px`, `240px` | The section rhythm where no `base.css` sets it (an app importing `components.css` alone); with `base.css` the settings under [Density](#density) win |
1130
1175
 
1131
1176
  The review carousel's dots and a ghost button's outline already read neutral tokens a theme sets, so they take none of their own: the dots `--neutral-200` (hover `--neutral-500`, current `--ink`), the outline `--neutral-300` (hover `--ink`). Three more read a fallback in place: `--star-fill` colors every filled star (`StarRating`'s, which falls back to the text color, and the footer's rating, which falls back to `--review-gold`), `--font-condensed` sets a `CalloutPanel` title's face, and `--neutral-700` colors prose bodies (`ProseBlocks`, the blog's index and post), falling back to `--ink`. The tone palette (`--tone-good` and its kin) is declared with the defaults and described under [Page Components](#page-components).
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Whether a phone number or an email address is well formed enough to link.
3
+ * One check each, shared by the contact form (what it accepts) and the link
4
+ * primitives (what they link), so the two never disagree. Light by design:
5
+ * the build guard checks a site's configured numbers against Google's full
6
+ * numbering plan (`checkSiteContacts`, in the scripts); a page carries none
7
+ * of that.
8
+ */
9
+ /** An email address: something, an @, something, a dot, something; no spaces. */
10
+ export declare const EMAIL_PATTERN: RegExp;
11
+ /** Whether an address is one to send to, ignoring the space around it. */
12
+ export declare function isEmail(value: string): boolean;
13
+ /** A number in E.164: a + and 8 to 15 digits, never opening on 0. */
14
+ export declare function isE164(value: string): boolean;
15
+ /** An extension after the number ("x12", "ext. 12", "extension 12"), which no dialer takes in E.164. */
16
+ export declare const EXTENSION: RegExp;
17
+ /**
18
+ * A typed number in E.164, or null when it is not one to dial. A number
19
+ * typed with a + keeps its country code; ten digits, typed any common way,
20
+ * take the North American +1 (an area code never opens on 0 or 1); eleven
21
+ * that open on 1 take the +. An extension is dropped, so the link dials the
22
+ * main line while the words still show it. Anything else, letters included,
23
+ * is null.
24
+ */
25
+ export declare function toE164(value: string): string | null;
26
+ /**
27
+ * What a dialer can still take from a typed number `toE164` cannot read:
28
+ * its digits, its extension dropped and a typed leading + kept. Null when
29
+ * there is no digit to dial.
30
+ */
31
+ export declare function dialable(value: string): string | null;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Whether a phone number or an email address is well formed enough to link.
3
+ * One check each, shared by the contact form (what it accepts) and the link
4
+ * primitives (what they link), so the two never disagree. Light by design:
5
+ * the build guard checks a site's configured numbers against Google's full
6
+ * numbering plan (`checkSiteContacts`, in the scripts); a page carries none
7
+ * of that.
8
+ */
9
+ /** An email address: something, an @, something, a dot, something; no spaces. */
10
+ export const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
11
+ /** Whether an address is one to send to, ignoring the space around it. */
12
+ export function isEmail(value) {
13
+ return EMAIL_PATTERN.test(value.trim());
14
+ }
15
+ /** A number in E.164: a + and 8 to 15 digits, never opening on 0. */
16
+ export function isE164(value) {
17
+ return /^\+[1-9]\d{7,14}$/.test(value);
18
+ }
19
+ /** An extension after the number ("x12", "ext. 12", "extension 12"), which no dialer takes in E.164. */
20
+ export const EXTENSION = /\s*(?:,|;|#|x|ext\.?|extension)\s*\d+\s*$/i;
21
+ /**
22
+ * A typed number in E.164, or null when it is not one to dial. A number
23
+ * typed with a + keeps its country code; ten digits, typed any common way,
24
+ * take the North American +1 (an area code never opens on 0 or 1); eleven
25
+ * that open on 1 take the +. An extension is dropped, so the link dials the
26
+ * main line while the words still show it. Anything else, letters included,
27
+ * is null.
28
+ */
29
+ export function toE164(value) {
30
+ const number = value.trim().replace(EXTENSION, "");
31
+ if (!number || /[^\d\s().+-]/.test(number) || number.lastIndexOf("+") > 0)
32
+ return null;
33
+ const digits = number.replace(/\D/g, "");
34
+ if (number.startsWith("+")) {
35
+ const e164 = `+${digits}`;
36
+ return isE164(e164) ? e164 : null;
37
+ }
38
+ if (/^[2-9]\d{9}$/.test(digits))
39
+ return `+1${digits}`;
40
+ if (/^1[2-9]\d{9}$/.test(digits))
41
+ return `+${digits}`;
42
+ return null;
43
+ }
44
+ /**
45
+ * What a dialer can still take from a typed number `toE164` cannot read:
46
+ * its digits, its extension dropped and a typed leading + kept. Null when
47
+ * there is no digit to dial.
48
+ */
49
+ export function dialable(value) {
50
+ const number = value.trim().replace(EXTENSION, "");
51
+ const digits = number.replace(/\D/g, "");
52
+ if (!digits)
53
+ return null;
54
+ return number.startsWith("+") ? `+${digits}` : digits;
55
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Every problem with the numbers and addresses in `value`, each naming its
3
+ * field (`site.header.phones[1].display`), empty when all is sound. Judges
4
+ * only what it is sure is a contact:
5
+ *
6
+ * - a phone is any object holding a string `e164` and `display` (the
7
+ * package's `Phone`, `HeaderPhone`, `ContactPhone`) or `phoneE164` and
8
+ * `phoneDisplay` (a `Locations` entry), wherever it sits: the number must
9
+ * be valid in E.164 for its country and the display must read as it;
10
+ * - an address is a string at one of the config's known address paths
11
+ * (`email`, `gate.contactEmail`, `analytics.identify.email`);
12
+ * - a `tel:` href must reduce, separators aside, to a valid number, and a
13
+ * `mailto:` href must write to an address.
14
+ *
15
+ * A value seen twice (a config that refers to itself) is walked once.
16
+ */
17
+ export declare function contactProblems(value: unknown, path?: string): string[];
@@ -0,0 +1,162 @@
1
+ /**
2
+ * The build time check on a site's phone numbers and email addresses: every
3
+ * number the package draws as a link has an `e164` that is a real number
4
+ * for its country, and a `display` that reads as the same number; every
5
+ * address matches the form's pattern. A number that fails ships as a dead or
6
+ * wrong call link on every page, so the build stops and names the field.
7
+ *
8
+ * Google's numbering plan (`libphonenumber-js`, its complete `max` metadata)
9
+ * runs here and in tests only, never in a page: nothing a page bundles
10
+ * imports this file (tst/phone-library-stays-out.test.ts holds that). The
11
+ * browser keeps its light check (`toE164`, `src/lib/contactLinks.ts`).
12
+ *
13
+ * It is sure of what it judges: phones by their shape (an `e164` beside a
14
+ * `display`), addresses only at the config's known paths, and `tel:` and
15
+ * `mailto:` hrefs anywhere, so a site's words are never mistaken for a
16
+ * contact and a valid site never fails.
17
+ *
18
+ * `atelic-check-base-path`, a marketing site's last build step and the one
19
+ * that already reads its config, runs `contactProblems` over the `site`
20
+ * export. A site passing numbers as props outside its config (a contact
21
+ * card's `phones`) calls the same function from its own test:
22
+ *
23
+ * import { contactProblems } from "@atelic-action/ui/scripts/contacts";
24
+ * expect(contactProblems({ phones })).toEqual([]);
25
+ */
26
+ import parsePhoneNumber, { isSupportedCountry, } from "libphonenumber-js/max";
27
+ import { isEmail } from "../lib/contactLinks.js";
28
+ /** A number read against a country, or undefined when it is not one; never throws. */
29
+ function parse(text, country) {
30
+ try {
31
+ return parsePhoneNumber(text, country);
32
+ }
33
+ catch {
34
+ return undefined;
35
+ }
36
+ }
37
+ /**
38
+ * The country a number written without its + is read against: the
39
+ * config's own (`address.country`, a two letter code), else the US, where
40
+ * every site so far does business.
41
+ */
42
+ function countryOf(value) {
43
+ const country = isRecord(value) && isRecord(value.address) ? value.address.country : undefined;
44
+ const code = typeof country === "string" ? country.trim().toUpperCase() : "";
45
+ return isSupportedCountry(code) ? code : "US";
46
+ }
47
+ /** The problem with one number, or null when it is sound. */
48
+ function phoneProblem(e164, display, country) {
49
+ const number = e164.startsWith("+") ? parse(e164, country) : undefined;
50
+ if (!number?.isValid() || number.number !== e164) {
51
+ return `e164 "${e164}" is not a valid number in E.164 (a + and the country code, digits only)`;
52
+ }
53
+ const shown = parse(display, number.country ?? country);
54
+ if (shown?.number !== e164) {
55
+ return `display "${display}" does not read as ${e164}`;
56
+ }
57
+ return null;
58
+ }
59
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
60
+ /**
61
+ * The config's known email addresses, by path from the walk's root (a
62
+ * `SiteConfig` or an `ArtifactConfig`). A string is judged as an address
63
+ * only here or as a `mailto:` href, never by its key's name alone, so words
64
+ * such as a label reading "Email" are left alone.
65
+ */
66
+ const EMAIL_PATHS = new Set([
67
+ "email",
68
+ "gate.contactEmail",
69
+ "contactEmail",
70
+ "analytics.identify.email",
71
+ ]);
72
+ /**
73
+ * A `tel:` href's number, decoded, with RFC 3966's visual separators (- .
74
+ * ( ) and spaces) and any parameters (";ext=12") taken out.
75
+ */
76
+ const telNumber = (href) => decoded(href.slice("tel:".length))
77
+ .split(";")[0]
78
+ ?.replace(/[-.()\s]/g, "") ?? "";
79
+ /** A percent encoded address, decoded; one too malformed to decode, as given. */
80
+ function decoded(address) {
81
+ try {
82
+ return decodeURIComponent(address);
83
+ }
84
+ catch {
85
+ return address;
86
+ }
87
+ }
88
+ /**
89
+ * Every problem with the numbers and addresses in `value`, each naming its
90
+ * field (`site.header.phones[1].display`), empty when all is sound. Judges
91
+ * only what it is sure is a contact:
92
+ *
93
+ * - a phone is any object holding a string `e164` and `display` (the
94
+ * package's `Phone`, `HeaderPhone`, `ContactPhone`) or `phoneE164` and
95
+ * `phoneDisplay` (a `Locations` entry), wherever it sits: the number must
96
+ * be valid in E.164 for its country and the display must read as it;
97
+ * - an address is a string at one of the config's known address paths
98
+ * (`email`, `gate.contactEmail`, `analytics.identify.email`);
99
+ * - a `tel:` href must reduce, separators aside, to a valid number, and a
100
+ * `mailto:` href must write to an address.
101
+ *
102
+ * A value seen twice (a config that refers to itself) is walked once.
103
+ */
104
+ export function contactProblems(value, path = "site") {
105
+ return walk(value, path, "", new WeakSet(), countryOf(value));
106
+ }
107
+ function walk(value, path, at, seen, country) {
108
+ if (typeof value === "object" && value !== null) {
109
+ if (seen.has(value))
110
+ return [];
111
+ seen.add(value);
112
+ }
113
+ if (Array.isArray(value)) {
114
+ return value.flatMap((item, index) => walk(item, `${path}[${index}]`, at, seen, country));
115
+ }
116
+ // A React element (words a config may hold as JSX) is copy, never a contact.
117
+ if (!isRecord(value) || "$$typeof" in value)
118
+ return [];
119
+ const problems = [];
120
+ for (const [e164Key, displayKey] of [
121
+ ["e164", "display"],
122
+ ["phoneE164", "phoneDisplay"],
123
+ ]) {
124
+ const e164 = value[e164Key];
125
+ const display = value[displayKey];
126
+ if (typeof e164 === "string" && typeof display === "string") {
127
+ const problem = phoneProblem(e164, display, country);
128
+ if (problem)
129
+ problems.push(`${path}: ${problem}`);
130
+ }
131
+ }
132
+ for (const [key, item] of Object.entries(value)) {
133
+ const field = `${path}.${key}`;
134
+ const where = at ? `${at}.${key}` : key;
135
+ if (typeof item !== "string") {
136
+ // An array keeps its parent's place: header.phones[0] is under header.phones.
137
+ problems.push(...walk(item, field, where, seen, country));
138
+ continue;
139
+ }
140
+ // An empty address is none (a site without a public one), not a bad one.
141
+ if (EMAIL_PATHS.has(where) && item.trim() && !isEmail(item)) {
142
+ problems.push(`${field}: "${item}" is not an email address`);
143
+ }
144
+ if (item.startsWith("tel:")) {
145
+ // A national number (no +) is read against the config's country, as a
146
+ // dialer reads it; only one that is not a plausible number fails.
147
+ const number = parse(telNumber(item), country);
148
+ if (!number?.isPossible())
149
+ problems.push(`${field}: "${item}" does not dial a number`);
150
+ }
151
+ if (item.startsWith("mailto:")) {
152
+ // RFC 6068: one address or several, comma separated, before the query,
153
+ // or in its to= when nothing comes before it.
154
+ const [head = "", query = ""] = item.slice("mailto:".length).split("?");
155
+ const to = decoded(head) || (new URLSearchParams(query).get("to") ?? "");
156
+ if (!to.split(",").every((address) => isEmail(address))) {
157
+ problems.push(`${field}: "${item}" does not write to an address`);
158
+ }
159
+ }
160
+ }
161
+ return problems;
162
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atelic-action/ui",
3
- "version": "8.4.0",
3
+ "version": "8.5.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",
@@ -58,6 +58,10 @@
58
58
  "types": "./dist/routing/basePath.d.ts",
59
59
  "default": "./dist/routing/basePath.js"
60
60
  },
61
+ "./scripts/contacts": {
62
+ "types": "./dist/scripts/check-contacts.d.ts",
63
+ "default": "./dist/scripts/check-contacts.js"
64
+ },
61
65
  "./sections": "./src/sections/index.ts",
62
66
  "./tokens": "./src/tokens/index.ts",
63
67
  "./styles/app.css": "./src/styles/app.css",
@@ -97,7 +101,7 @@
97
101
  },
98
102
  "scripts": {
99
103
  "build": "rm -rf dist && tsc -p tsconfig.server.json",
100
- "build:smoke": "node --input-type=module -e \"for (const entry of ['gate', 'gate/middleware', 'gate/request-link', 'gate/verify', 'vite', 'vite/private-chunks', 'artifact/readers', 'routing/base-path', 'monitoring/server']) await import('@atelic-action/ui/' + entry)\"",
104
+ "build:smoke": "node --input-type=module -e \"for (const entry of ['gate', 'gate/middleware', 'gate/request-link', 'gate/verify', 'vite', 'vite/private-chunks', 'artifact/readers', 'routing/base-path', 'monitoring/server', 'scripts/contacts']) await import('@atelic-action/ui/' + entry)\"",
101
105
  "prepack": "bun run build",
102
106
  "lint": "biome check .",
103
107
  "lint:fix": "biome check . --write",
@@ -108,20 +112,21 @@
108
112
  "storybook:build": "storybook build --output-dir storybook-static"
109
113
  },
110
114
  "dependencies": {
115
+ "@radix-ui/react-checkbox": "^1.1.2",
116
+ "@radix-ui/react-popover": "^1.1.15",
111
117
  "@radix-ui/react-tabs": "^1.2.1",
112
118
  "@sentry/browser": "^11.16.0",
113
119
  "@sentry/vite-plugin": "^11.16.0",
114
- "jose": "^6.2.12"
120
+ "jose": "^6.2.12",
121
+ "libphonenumber-js": "^1.13.17"
115
122
  },
116
123
  "peerDependencies": {
117
124
  "@radix-ui/react-accordion": "^1.2.12",
118
125
  "@radix-ui/react-alert-dialog": "^1.1.15",
119
126
  "@radix-ui/react-avatar": "^1.1.11",
120
- "@radix-ui/react-checkbox": "^1.1.2",
121
127
  "@radix-ui/react-dialog": "^1.1.15",
122
128
  "@radix-ui/react-dropdown-menu": "^2.1.16",
123
129
  "@radix-ui/react-label": "^2.1.8",
124
- "@radix-ui/react-popover": "^1.1.15",
125
130
  "@radix-ui/react-progress": "^1.1.8",
126
131
  "@radix-ui/react-select": "^2.2.6",
127
132
  "@radix-ui/react-separator": "^1.1.0",
@@ -158,9 +163,6 @@
158
163
  "@radix-ui/react-avatar": {
159
164
  "optional": true
160
165
  },
161
- "@radix-ui/react-checkbox": {
162
- "optional": true
163
- },
164
166
  "@radix-ui/react-dialog": {
165
167
  "optional": true
166
168
  },
@@ -170,9 +172,6 @@
170
172
  "@radix-ui/react-label": {
171
173
  "optional": true
172
174
  },
173
- "@radix-ui/react-popover": {
174
- "optional": true
175
- },
176
175
  "@radix-ui/react-progress": {
177
176
  "optional": true
178
177
  },
@@ -245,11 +244,9 @@
245
244
  "@radix-ui/react-accordion": "^1.2.12",
246
245
  "@radix-ui/react-alert-dialog": "^1.1.15",
247
246
  "@radix-ui/react-avatar": "^1.1.11",
248
- "@radix-ui/react-checkbox": "^1.1.2",
249
247
  "@radix-ui/react-dialog": "^1.1.15",
250
248
  "@radix-ui/react-dropdown-menu": "^2.1.16",
251
249
  "@radix-ui/react-label": "^2.1.8",
252
- "@radix-ui/react-popover": "^1.1.15",
253
250
  "@radix-ui/react-progress": "^1.1.8",
254
251
  "@radix-ui/react-select": "^2.2.6",
255
252
  "@radix-ui/react-separator": "^1.1.0",
@@ -1,7 +1,8 @@
1
1
  import { Mail, Star, UserRound } from "lucide-react";
2
2
  import type { ComponentProps, CSSProperties, ReactNode, Ref } from "react";
3
- import { breakableEmail } from "../lib/emailText";
4
3
  import { newTabProps } from "../lib/newTabProps";
4
+ import { EmailLink } from "../primitives/EmailLink";
5
+ import { PhoneLink } from "../primitives/PhoneLink";
5
6
  import type {
6
7
  Brand,
7
8
  FooterColumn,
@@ -353,8 +354,8 @@ export function Footer({
353
354
  ) : (
354
355
  <span className="nap-address">{addressLines}</span>
355
356
  ))}
356
- {phone && <a href={`tel:${phone.e164}`}>{phone.display}</a>}
357
- {email && <a href={`mailto:${email}`}>{breakableEmail(email)}</a>}
357
+ {phone && <PhoneLink phone={phone} />}
358
+ {email && <EmailLink email={email} />}
358
359
  </address>
359
360
  )}
360
361
  {hoursInBrand && (
@@ -11,6 +11,7 @@ import {
11
11
  import { useDismiss } from "../hooks/useDismiss";
12
12
  import { type PageStop, useScrollSpy } from "../hooks/useScrollSpy";
13
13
  import { Button } from "../primitives/Button";
14
+ import { PhoneLink } from "../primitives/PhoneLink";
14
15
  import type {
15
16
  Brand,
16
17
  CallToAction,
@@ -325,10 +326,10 @@ export function SiteHeader({
325
326
  {barPhones.length > 0 && (
326
327
  <div className="nav-phones">
327
328
  {barPhones.map((phone) => (
328
- <a
329
+ <PhoneLink
329
330
  key={phone.e164}
330
331
  className="nav-phone"
331
- href={`tel:${phone.e164}`}
332
+ phone={phone}
332
333
  aria-label={phoneName(phone)}
333
334
  >
334
335
  <PhoneIcon size={17} aria-hidden="true" />
@@ -336,7 +337,7 @@ export function SiteHeader({
336
337
  {phone.label && <span className="nav-phone-label">{phone.label}</span>}
337
338
  <span className="nav-phone-number tel-number">{phone.display}</span>
338
339
  </span>
339
- </a>
340
+ </PhoneLink>
340
341
  ))}
341
342
  </div>
342
343
  )}
@@ -351,16 +352,16 @@ export function SiteHeader({
351
352
  </span>
352
353
  )}
353
354
  {barPhones[0] && (
354
- <a
355
+ <PhoneLink
355
356
  className="nav-call"
356
- href={`tel:${barPhones[0].e164}`}
357
+ phone={barPhones[0]}
357
358
  // An icon alone: a number with no label is named "Call" and the number.
358
359
  aria-label={
359
360
  barPhones[0].label ? phoneName(barPhones[0]) : `Call ${barPhones[0].display}`
360
361
  }
361
362
  >
362
363
  <PhoneIcon size={19} aria-hidden="true" />
363
- </a>
364
+ </PhoneLink>
364
365
  )}
365
366
  {hasMenu && (
366
367
  <button
@@ -3,6 +3,8 @@ import { useEffect, useId, useRef, useState } from "react";
3
3
  import { newTabProps } from "../lib/newTabProps";
4
4
  import { telText } from "../lib/phoneText";
5
5
  import { Button } from "../primitives/Button";
6
+ import { EmailLink } from "../primitives/EmailLink";
7
+ import { PhoneLink } from "../primitives/PhoneLink";
6
8
  import type {
7
9
  Brand,
8
10
  CallToAction,
@@ -274,15 +276,15 @@ export function SiteMenu({
274
276
  const words = menuPhoneLabel(line);
275
277
  return (
276
278
  // The words and the number are one name, spaced as they read.
277
- <a
279
+ <PhoneLink
278
280
  key={line.e164}
279
281
  className="mm-phone-card"
280
- href={`tel:${line.e164}`}
282
+ phone={line}
281
283
  aria-label={`${words} ${line.display}`}
282
284
  >
283
285
  <span className="mm-phone-label">{words}</span>
284
286
  <span className="mm-phone-number tel-number">{line.display}</span>
285
- </a>
287
+ </PhoneLink>
286
288
  );
287
289
  })}
288
290
  </div>
@@ -418,25 +420,25 @@ function ContactBlock({
418
420
  {phones
419
421
  ? phones.map((line) => (
420
422
  <span key={line.e164}>
421
- <a className="mm-contact-link" href={`tel:${line.e164}`}>
423
+ <PhoneLink className="mm-contact-link" phone={line}>
422
424
  {menuPhoneLabel(line).toUpperCase()}&nbsp;&nbsp;{line.display}
423
- </a>
425
+ </PhoneLink>
424
426
  <br />
425
427
  </span>
426
428
  ))
427
429
  : phone && (
428
430
  <>
429
- <a className="mm-contact-link" href={`tel:${phone.e164}`}>
431
+ <PhoneLink className="mm-contact-link" phone={phone}>
430
432
  {menuPhoneLabel(phone).toUpperCase()}&nbsp;&nbsp;{phone.display}
431
- </a>
433
+ </PhoneLink>
432
434
  <br />
433
435
  </>
434
436
  )}
435
437
  {email && (
436
438
  <>
437
- <a className="mm-contact-link" href={`mailto:${email}`}>
439
+ <EmailLink className="mm-contact-link" email={email}>
438
440
  {email}
439
- </a>
441
+ </EmailLink>
440
442
  <br />
441
443
  </>
442
444
  )}