@atelic-action/ui 8.2.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.
- package/README.md +50 -11
- package/dist/monitoring/server.d.ts +9 -2
- package/dist/monitoring/server.js +32 -5
- package/package.json +1 -1
- package/src/chrome/Footer.tsx +53 -12
- package/src/chrome/SiteMenu.tsx +5 -2
- package/src/chrome/SiteShell.tsx +6 -1
- package/src/chrome/StickyCTABar.tsx +45 -29
- package/src/chrome/index.ts +1 -0
- package/src/components/DataTable.tsx +1 -1
- package/src/components/ReportCard.tsx +3 -3
- package/src/lib/hours.ts +9 -2
- package/src/monitoring/server.ts +38 -5
- package/src/routing/miss.ts +14 -3
- package/src/routing/staticNotFound.tsx +14 -1
- package/src/sections/ContactInfoCard.tsx +8 -1
- package/src/sections/FeatureGrid.tsx +31 -7
- package/src/sections/HoursTable.tsx +5 -3
- package/src/sections/LocationSection.tsx +2 -2
- package/src/sections/ReviewWall.tsx +2 -2
- package/src/sections/index.ts +1 -0
- package/src/sections/siteConfig.ts +25 -0
- package/src/styles/base.css +12 -1
- package/src/styles/chrome.css +108 -10
- package/src/styles/components.css +0 -22
- package/src/styles/defaults.css +34 -3
- package/src/styles/sections.css +24 -24
- package/src/types.ts +6 -0
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Every export, grouped by the entry it is imported from. The Storybook column lin
|
|
|
18
18
|
| `StickyCTABar` | `@atelic-action/ui/chrome` | The phone's bottom bar: the call to action and a call shortcut, there from the top on an interior page (`fromTop`) and sliding in after a scroll on a hero page | [Chrome/StickyCTABar](https://ui.atelic.me/?path=/docs/chrome-stickyctabar--docs) |
|
|
19
19
|
| `BrandLockup` | `@atelic-action/ui/chrome` | The header's identity as one link, with the recipient's mark on a sent document; the brand's own mark per surface (`onLight`, `onDark`), never recolored, at `--brand-mark-height` (8.0.0); `surface` draws one ground's mark alone, and `onClick` hears the link followed (8.2.0) | [Chrome/BrandLockup](https://ui.atelic.me/?path=/docs/chrome-brandlockup--docs) |
|
|
20
20
|
| `SkipLink` | `@atelic-action/ui/chrome` | The keyboard user's jump past the chrome | [Chrome/SkipLink](https://ui.atelic.me/?path=/docs/chrome-skiplink--docs) |
|
|
21
|
-
| `Brand`, `BrandLogo`, `CallToAction`, `HoursRow`, `MenuContact`, `NavLink`, `NavPanelSection`, `NavGroupColumn`, `NavGroupLink`, `NavGroupChildLink`, `NavPictureSection`, `NavIconRowsSection`, `NavIconRow`, `NavIcon`, `NavCardsSection`, `NavCard`, `NavFeature`, `HeaderPhone`, `SiteMenuSurface`, `MenuBurgerStyle`, `ContactDockConfig`, `ContactDockItem`, `ContactDockIcon`, `Phone`, `PostalAddress`, `SiteLink`, `SocialLink`, `PageStop`, `FooterColumn`, `FooterColumnLink`, `FooterIcon` | `@atelic-action/ui/chrome` | The shapes the chrome renders from (types) | none |
|
|
21
|
+
| `Brand`, `BrandLogo`, `CallToAction`, `HoursRow`, `MenuContact`, `NavLink`, `NavPanelSection`, `NavGroupColumn`, `NavGroupLink`, `NavGroupChildLink`, `NavPictureSection`, `NavIconRowsSection`, `NavIconRow`, `NavIcon`, `NavCardsSection`, `NavCard`, `NavFeature`, `HeaderPhone`, `SiteMenuSurface`, `MenuBurgerStyle`, `FooterHoursPlacement`, `ContactDockConfig`, `ContactDockItem`, `ContactDockIcon`, `Phone`, `PostalAddress`, `SiteLink`, `SocialLink`, `PageStop`, `FooterColumn`, `FooterColumnLink`, `FooterIcon` | `@atelic-action/ui/chrome` | The shapes the chrome renders from (types) | none |
|
|
22
22
|
| `NotFound` | `@atelic-action/ui/components` | The body of the page an unknown path renders | [Components/NotFound](https://ui.atelic.me/?path=/docs/components-notfound--docs) |
|
|
23
23
|
| `Checklist` | `@atelic-action/ui/components` | A short list of checks, each passed or failed | [Components/Checklist](https://ui.atelic.me/?path=/docs/components-checklist--docs) |
|
|
24
24
|
| `IconList` | `@atelic-action/ui/components` | A list whose bullets are icons, one for the list or one per item, each in a tone | [Components/IconList](https://ui.atelic.me/?path=/docs/components-iconlist--docs) |
|
|
@@ -105,7 +105,7 @@ Every export, grouped by the entry it is imported from. The Storybook column lin
|
|
|
105
105
|
| `marketingConfig` | `@atelic-action/ui/vite` | A marketing site's whole Vite configuration as one call; with the three Sentry variables it uploads hidden source maps under the commit (8.1.0) | none |
|
|
106
106
|
| `buildRelease`, `sentryUpload`, `SentryUpload`, `environmentPlugin` | `@atelic-action/ui/vite` | The commit a build is filed under, the source map upload's settings (on only with its three variables), and the plugin that names the build's environment for the browser (8.1.0) | none |
|
|
107
107
|
| `isMiss`, `MissMatch`, `CATCH_ALL_ROUTE_ID` | `@atelic-action/ui/routing` | Whether a router's matches are a miss (the catch all route, or a route whose params name no page), router free, for a site's root route (8.1.0) | none |
|
|
108
|
-
| `routerErrorOptions`, `RouteErrorFallback`, `RouteErrorProps`, `reportRouteError` | `@atelic-action/ui/routing` | The router options that report a route's render crash and draw the package's error page in its place, router free (8.2.0; see [Error Reporting](#error-reporting)) |
|
|
108
|
+
| `routerErrorOptions`, `RouteErrorFallback`, `RouteErrorProps`, `reportRouteError` | `@atelic-action/ui/routing` | The router options that report a route's render crash and draw the package's error page in its place, router free (8.2.0; see [Error Reporting](#error-reporting)) | [Routing/RouteErrorFallback](https://ui.atelic.me/?path=/docs/routing-routeerrorfallback--docs) |
|
|
109
109
|
| `startErrorReporting`, `ErrorCatcherScript` (`enabled`, 8.2.0), `ErrorCatcherScriptProps`, `errorCatcherScript`, `reportError`, `installCatcher`, `readCatcher`, `afterFirstPaint`, `throwLaunchCheck`, `LAUNCH_CHECK_MESSAGE` | `@atelic-action/ui/monitoring` | Error reporting in the browser: the inline early catcher, and the start function that loads the Sentry SDK after first paint, errors only (8.1.0; see [Error Reporting](#error-reporting)) | none |
|
|
110
110
|
| `reportServerError`, `reportServerErrorLater`, `WaitUntilContext`, `refusalError`, `reportRefusedResponse`, `withErrorReporting`, `parseDSN`, `parseStack`, `buildEnvelope` | `@atelic-action/ui/monitoring/server` | Error reporting from a function or the middleware, dependency free and built, for what Vercel runs uncompiled (8.1.0); the later one sends without holding the answer, on the platform's `waitUntil` (8.2.0) | none |
|
|
111
111
|
| `sections.css` | `@atelic-action/ui/styles/sections.css` | Styles for everything under `sections`, imported after `primitives.css` | none |
|
|
@@ -235,7 +235,7 @@ The menu is a native `<dialog>` opened with `showModal()`, so Escape, focus cont
|
|
|
235
235
|
On a statically prerendered TanStack Start site the markup is the easy part. The host serves the `/404` prerender for every miss, and the page survives hydration only with three pieces in the site:
|
|
236
236
|
|
|
237
237
|
1. **A catch all route**, `src/routes/$.tsx`, rendering the site's page (noindexed). Never a dedicated `/404` route: an unknown path then matches only the root, TanStack's hydrate throws, and the page goes blank.
|
|
238
|
-
2. **The router options:** `createRouter({ routeTree, ...staticNotFoundRouting(NotFoundPage, { useMatches }) })`, with `useMatches` imported from `@tanstack/react-router` and handed in, so the package imports no router. A miss hydrates through its pending state first, so pending has to render the same page or React reports a mismatch (a pending view of plain `null` is React error 418 and a blank body on every miss). Given `useMatches` (8.2.0), the pending view draws the page on a miss alone (`isMiss`) and nothing on any other route's pending state, so a slow client navigation never shows a bare 404 body with no header; without it, the pending view is the page itself, as before. `catchAllId` names a catch all route other than `/$`.
|
|
238
|
+
2. **The router options:** `createRouter({ routeTree, ...staticNotFoundRouting(NotFoundPage, { useMatches }) })`, with `useMatches` imported from `@tanstack/react-router` and handed in, so the package imports no router. A miss hydrates through its pending state first, so pending has to render the same page or React reports a mismatch (a pending view of plain `null` is React error 418 and a blank body on every miss). Given `useMatches` (8.2.0), the pending view draws the page on a miss alone (`isMiss`) and nothing on any other route's pending state, so a slow client navigation never shows a bare 404 body with no header; without it, the pending view is the page itself, as before. `catchAllId` names a catch all route other than `/$`. The pending view counts as a miss the catch all route's match, a route whose `staticData.missing(params)` says its params name no page, and a match the router already reports as not found (8.3.0). **A route with params that can claim a path with no page behind it (a blog slug nobody wrote) sets `staticData.missing`**: the host serves that path the 404 prerender, which hydrates through the pending state before the route's loader runs, so a loader's `notFound()` arrives too late for that first render and the page would hydrate blank.
|
|
239
239
|
3. **The build:** a `{ path: "/404", prerender: { enabled: true }, sitemap: { exclude: true } }` entry in the Vite `pages` list, and a copy of `dist/client/404/index.html` to `dist/client/404.html`.
|
|
240
240
|
|
|
241
241
|
```tsx
|
|
@@ -395,7 +395,7 @@ Every site reports its errors to Sentry, errors only and never performance traci
|
|
|
395
395
|
|
|
396
396
|
1. **The early catcher.** `ErrorCatcherScript`, placed first among the root route's `<head>` scripts, is a 443 byte inline script (281 gzipped, ES5, no dependencies) that listens for `error` and `unhandledrejection` from the first moment and holds up to twenty (`CATCHER_CAP`) in a buffer on `window.__atelicErrors` (`CATCHER_GLOBAL`), counting the rest as dropped; the count rides on each replayed error as `earlyDropped`. It is the page's first script and runs before any other script on the page; it is not the first element in `<head>`, since React 19 hoists the title, the meta tags, the preloads, and the stylesheets ahead of it, and nothing it does depends on that. An error thrown before the app's own JavaScript runs is held, not lost.
|
|
397
397
|
2. **The start function.** `startErrorReporting({ dsn, release, environment })` from `@atelic-action/ui/monitoring` (with `environment` defaulting to the build's `import.meta.env.VITE_ENVIRONMENT`) makes sure the catcher is listening (installing it when the page has none), then after first paint (falling back to the load event where the browser cannot report paints, and to ten seconds whatever happens) loads the Sentry browser SDK, replays what the catcher held, each tagged `early`, and takes the catcher's listeners off so nothing is reported twice. With no `dsn` it does nothing and loads nothing. The SDK chunk is the client set up by hand with six integrations (event filters, function to string, the global handlers, linked errors, dedupe, the page's URL and user agent): no tracing, no replay, no breadcrumbs. Measured alone with esbuild, the chunk weighs 69.9 KB raw, 24.6 KB gzipped, and 22.3 KB in brotli, where the old `@sentry/react` chunk with browser tracing, measured the same way, weighed 136.2 KB, 47.0 KB, and 41.5 KB; a site's own build bundles them with what it shares, so its figures differ (a real site's new chunk measured 81 KB raw and 28 KB gzipped, replacing one of 425 KB raw and 141 KB gzipped). `AppErrorBoundary` hands a render crash to the same buffer (`reportError`), since React keeps a caught crash from the window's handlers; on a page where reporting never started and no inline catcher runs, the crash is let go quietly rather than held by a catcher nobody reads. A route's render crash reaches that boundary too on TanStack Router 1.170, where a route has a catch boundary of its own only when an `errorComponent` applies to it, so on a site that sets none the crash rises to `AppErrorBoundary` and is reported once. A route or a site that sets its own `errorComponent` with no `onCatch` puts a boundary in the way that catches the crash and reports it to nobody. `routerErrorOptions()` (8.2.0, below) closes that: spread into `createRouter`, it gives every route the boundary, its `defaultOnCatch` hands what any of them catches to `reportError` once, and its `defaultErrorComponent` draws the same `ErrorFallback` page, so the report no longer depends on which boundary is nearest. The package carries `@sentry/browser`, so a site needs no Sentry dependency of its own.
|
|
398
|
-
3. **The server reporter.** `@atelic-action/ui/monitoring/server`, built like the gate so a Vercel function imports it uncompiled: `reportServerError(error, { dsn?, request?, tags?, release?, environment? })` posts a Sentry envelope to the ingest the DSN names (`SENTRY_DSN`, then `VITE_SENTRY_DSN`), with the stack's frames, the runtime as a tag, and the release from `VERCEL_GIT_COMMIT_SHA`. It waits two seconds at most, never throws, and resolves whether or not the send worked. `withErrorReporting(handler)` reports a handler's throw and throws it again. `reportServerErrorLater(error, { context?, ...options })` (8.2.0) starts the same send and returns at once: it hands the send to the platform's `waitUntil`, the `context` a handler was given (an edge middleware's or a function's second argument) or else the request context Vercel keeps for a function, so the function stays alive until the send finishes after the answer has gone; with neither, the send runs without blocking the answer and may be cut short when the runtime freezes. Await `reportServerError` where the report must land before the handler goes on (before a throw, or in a handler that waits anyway); call `reportServerErrorLater` where the person is waiting on the answer (a refused send the form should say at once). The gate's middleware reports anything it throws, and passes and blocks exactly as before. `refusalError(response, service?)` (8.2.0) turns a refused upstream answer (a send the mail service would not take) into an error a report may carry: the service's name, the status, and the error body's `name` and `message` alone, each with anything shaped like an email address replaced by `[address]` and cut to 300 characters, nothing else of the body read; `reportRefusedResponse(response, { service, request, tags, context })` builds it and sends it with `reportServerErrorLater`, resolving once the body is read and never waiting on the send.
|
|
398
|
+
3. **The server reporter.** `@atelic-action/ui/monitoring/server`, built like the gate so a Vercel function imports it uncompiled: `reportServerError(error, { dsn?, request?, tags?, release?, environment? })` posts a Sentry envelope to the ingest the DSN names (`SENTRY_DSN`, then `VITE_SENTRY_DSN`), with the stack's frames, the runtime as a tag, and the release from `VERCEL_GIT_COMMIT_SHA`. It waits two seconds at most, never throws, and resolves whether or not the send worked. `withErrorReporting(handler)` reports a handler's throw and throws it again. `reportServerErrorLater(error, { context?, ...options })` (8.2.0) starts the same send and returns at once: it hands the send to the platform's `waitUntil`, the `context` a handler was given (an edge middleware's or a function's second argument) or else the request context Vercel keeps for a function, so the function stays alive until the send finishes after the answer has gone; with neither, the send runs without blocking the answer and may be cut short when the runtime freezes. Await `reportServerError` where the report must land before the handler goes on (before a throw, or in a handler that waits anyway); call `reportServerErrorLater` where the person is waiting on the answer (a refused send the form should say at once). The gate's middleware reports anything it throws, and passes and blocks exactly as before. `refusalError(response, service?)` (8.2.0) turns a refused upstream answer (a send the mail service would not take) into an error a report may carry: the service's name, the status, and the error body's `name` and `message` alone, each with anything shaped like an email address replaced by `[address]` (a sentence's closing period kept outside it) and anything shaped like a phone number (grouped as one is written, or a plus sign and its digits run together) by `[number]` (8.3.0), then cut to 300 characters, nothing else of the body read. The fields are still the upstream's free text: a name or a street quoted in words passes through, so report the refusals of a service whose errors are about the request, never one that echoes what a person wrote; `reportRefusedResponse(response, { service, request, tags, context })` builds it and sends it with `reportServerErrorLater`, resolving once the body is read and never waiting on the send.
|
|
399
399
|
|
|
400
400
|
**The launch check.** Once reporting has started, `window.__atelicErrors.test()` in the browser's console throws an error from the package's own code on the next turn, uncaught, named "Atelic error reporting launch check: thrown on purpose from @atelic-action/ui" (`LAUNCH_CHECK_MESSAGE`). Run it on a site's first production deploy: the error should reach Sentry under the deploy's release and environment with a readable, source mapped stack. A stack of minified names means the upload did not run.
|
|
401
401
|
|
|
@@ -612,9 +612,9 @@ export function SiteShell(props: Omit<SiteShellProps, "currentPath" | "basePath"
|
|
|
612
612
|
Every site's footer has one shape, and `Footer` draws it (7.0.0):
|
|
613
613
|
|
|
614
614
|
- **The brand column:** the header's lockup (the mark with the wordmark beside it, or the mark alone when `logo.wordmark` is false), then the Google rating beside five stars, the whole line one link to the business's Google profile when it has one, then the one address, the headquarters, linked to the same profile, then the phone and the email, each a link.
|
|
615
|
-
- **The hours,** when the site gives them: a column of their own headed Hours (`hoursHeading`), each row's days beside or over its range, as the column's width allows (8.1.0).
|
|
615
|
+
- **The hours,** when the site gives them: a column of their own headed Hours (`hoursHeading`), each row's days beside or over its range, as the column's width allows (8.1.0). On a phone, where the footer is two across, the cells under the brand column pair up with none left alone (8.3.0): beside an even count of link columns the hours take the row's whole width with their rows two across and the link columns pair up under them, and beside an odd count the hours stay a column of their own, rows stacked, paired with the first link column, as in 8.1.0. `Footer` counts the link columns it draws (a column with no links is left out first). `footer.hoursPlacement: "brand"` (`Footer`'s `hoursPlacement`, 8.3.0) sets them inside the brand column instead, under the address, the phone, and the email, as a compact list (days, then ranges) under a small Hours label, so the four link columns keep the row's room. In that placement each link column is at least 10em wide and never narrower than its longest label, and the brand column at least 17em, an ordinary email address on one line; while the row holds every floor, the brand column and the link columns share it, and when it cannot, the brand column takes a row of its own with the link columns under it, all across while their floors fit and two by two below that (8.3.0). The floors are measured for the link columns `Footer` draws, so two or three columns keep the brand column beside them as long as theirs fit. One measure, the floors against the row's own width, drives both steps, so no breakpoint disagrees with it, and a font a few percent wider than a site was drawn in still holds a three word label on one line.
|
|
616
616
|
- **Four link columns:** Company, Resources, Social, and Legal, in that order. From 760px the columns share one row at their shares but never narrower than their longest word, wrapping a column to a second row before a label breaks inside itself (8.1.0). A Social link carries its icon in front of its words. A column with no links is left out, and the grid sizes itself to the columns shown.
|
|
617
|
-
- **The closing bar:** `ClosingBar` under it all, `Copyright` with the business's name on the left and `Credit` on the right.
|
|
617
|
+
- **The closing bar:** `ClosingBar` under it all, `Copyright` with the business's name on the left and `Credit` on the right while the two share a line; when they do not (a phone, a long attribution), the credit wraps under the copyright and both start at the same edge, and a copyright longer than the line wraps inside itself (8.3.0).
|
|
618
618
|
|
|
619
619
|
The rating's stars are hidden from assistive technology, so the line, linked or not, is named by its words ("4.8 on Google"); `ratingLabel` gives the link a fuller name when a site wants one ("4.8 on Google, opens the Google profile"). Linked, it opens in a new tab as the address does. With the hours the footer holds six columns, so from 760px to 1100px the brand column keeps a row of its own above the other five, and from 1100px all six share one row with the brand column a little wider; a phone sets the brand column over two across, as without them. The rating's five stars read `--star-fill`, the same token `StarRating`'s filled star reads, and fall back to `--review-gold` (`#f5b301`) when a theme sets none, so one line in `theme.css` recolors every star on a site (8.0.0). The logo is the header's lockup drawn on the dark band (8.1.0): the mark the dark surface resolves to, by the header's own order (see the table under [Rendering From Props](#rendering-from-props)), with the wordmark beside it, composed by the same parts the header's `BrandLockup` draws. Its picture is silent there, since the words name it. `logo.wordmark: false` draws the mark alone, named by `logo.alt`; a glyph tile keeps the name beside it, and a logo with no picture is the words alone. The column headings are level 2 by default (`headingLevel` takes 2 to 6): the footer is a landmark beside the page's main content, so its sections sit one level under the page's `h1` whatever the page's own outline ends on, which satisfies axe's `heading-order` on every page and keeps the columns in a screen reader's heading list. Each is a `div` with `role="heading"` and `aria-level`, wearing `.footer-heading`, rather than an `h2`: a site's own bare `h2` rule is unlayered, so it beats every rule in the package's layer whatever its weight, and it is written for a page's section titles, not these small labels. A heading by role keeps the outline and matches no element rule, with no `!important` and no specificity raised.
|
|
620
620
|
|
|
@@ -627,7 +627,7 @@ The header carries the services and the service areas, so the footer does not re
|
|
|
627
627
|
| The rating | `footer.rating`, as printed (`"4.8 on Google"`) |
|
|
628
628
|
| The rating's link | `footer.ratingHref`, else `mapLinkURL`, the Google profile, whenever a rating is set; `footer.ratingLabel` names it |
|
|
629
629
|
| The address and its link | `address` and `mapLinkURL`; `footer.showAddress: false` drops the address |
|
|
630
|
-
| The hours | `hours`, each row's `labelShort` and its range on `clock
|
|
630
|
+
| The hours | `hours`, each row's `labelShort` and its range on `clock` and `meridiem`, short ("8a to 5p") unless `footer.hoursShort` is false ("8:00a to 5:00p", or "8:00 am to 5:00 pm" with `meridiem: "word"`); `footer.hoursPlacement` sets them as a column (the default) or inside the brand column; `footer.showHours: false` keeps them out of the footer and in the structured data |
|
|
631
631
|
| The phone and the email | `phone`, `email` |
|
|
632
632
|
| Company | `nav` |
|
|
633
633
|
| Resources | `footerLinks` |
|
|
@@ -731,6 +731,37 @@ The space a section leaves above and below itself is one token, `--section-space
|
|
|
731
731
|
|
|
732
732
|
`.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
733
|
|
|
734
|
+
### Moving to 8.3.0
|
|
735
|
+
|
|
736
|
+
No API breaks: every prop, config key, token, class, and export a site uses still works, and every addition is optional (a minor release for that reason). Three things change on screen all the same.
|
|
737
|
+
|
|
738
|
+
**Changes on a site that changes nothing:**
|
|
739
|
+
|
|
740
|
+
1. **The closing bar on a phone stacks.** Where its two sides do not share a line, the credit wraps under the copyright at the same left edge, where it sat at the right of its own line.
|
|
741
|
+
2. **The footer's hours on a phone, beside an even count of link columns** (the default four, or two), span the row with their rows two across and the link columns pair under them; beside an odd count nothing changes from 8.1.0.
|
|
742
|
+
3. **`ContactInfoCard`'s single phone row reads "Call"** where it read "Call / Text", which told a reader the business answers texts. `phoneLabel="Call / Text"` restores it. 8.2.0 made the same change in the phone menu, where `phones[].menuLabel` restores it, so **a site whose business does answer texts sets both.**
|
|
743
|
+
|
|
744
|
+
The rest of what an unchanged site sees, in detail:
|
|
745
|
+
|
|
746
|
+
- **The closing bar on a phone.** Where its two sides do not share a line, the credit (or a site's note) wraps under the copyright and both start at the same edge, where the credit sat at the right of its own line and the two lines zigzagged. On one line they stay as before. No breakpoint decides it, so a long attribution on a tablet stacks the same way, and a copyright longer than the line wraps inside itself.
|
|
747
|
+
- **The footer's hours on a phone, beside an even count of link columns** (the default footer's four, or two). Two across, the hours take the row's whole width under the brand column, their rows two across, and the link columns pair up under them, where the hours sat beside the first link column and left a hole under themselves when that column ran longer. **Beside an odd count** (three, say) nothing changes from 8.1.0: the hours stay a column of their own beside the first link column, so the cells pair and none hangs alone. From 760px nothing moves.
|
|
748
|
+
- **`ContactInfoCard`'s single phone row** reads "Call" where it read "Call / Text", which told a reader the business answers texts; `phoneLabel` gives it other words.
|
|
749
|
+
- **An `h4` under a theme that sets `--subheading-tracking: normal`** is flat, where it took its parent's tracking. At the default nothing moves.
|
|
750
|
+
- **The sticky bar's `onSpaceChange`.** A listener swapped in is told the current height at once and the one it replaced gets 0, without waiting for a resize, and no listener hears one value twice. A listener made anew on every render (an inline function, which looped in 8.2.0) hears the height once a function until the caller's state settles; one that stores an object is cut off after three such arrivals with nothing measured between, so it cannot loop. Store a plain number, or memoize the listener.
|
|
751
|
+
- **`isMiss`** also counts a match the router reports as not found, and the not found pending view (given `useMatches`) asks `isMiss` alone, so the root's 404 head and the pending view agree. A route with params that can claim a path with no page sets `staticData.missing` (see [The Not Found Page](#the-not-found-page)).
|
|
752
|
+
- **`refusalError` and `reportRefusedResponse`** also replace a phone number, grouped as one is written, with `[number]`, catch an address on an internationalized domain or with an underscore in a label, and keep a sentence's closing period outside a scrubbed address; a date, a bare id, and a count beside a year stay.
|
|
753
|
+
- **`SiteMenu`** takes an empty `phones` list as none, so the contact block's one phone stands in on either sheet.
|
|
754
|
+
- **One visually hidden class**, `.visually-hidden`, in `defaults.css`, worn by `ReportCard`'s spoken words, `DataTable`'s empty label, `ReviewWall`'s control labels, and `FeatureGrid`'s new tab note, in place of four copies of the rule. The old class names stay on their elements beside it as aliases (`.rc-sr`, `.data-table-empty-label`, `.rw-select-label`), so a site rule written against one still reaches it; they go in the next major, and a site moves its rules to `.visually-hidden` before then.
|
|
755
|
+
- **The rule above the closing bar** is drawn in its top border's place rather than as the border; at the default it looks and measures as before.
|
|
756
|
+
|
|
757
|
+
New, each at today's look unless set (the table under [Tokens](#tokens)):
|
|
758
|
+
|
|
759
|
+
- **The hero:** `--hero-gap-kicker`, `--hero-gap-lead`, and `--hero-gap-actions`, each one gap of the stack, falling back to `--hero-stack-gap` and then to the gap's own value; `--hero-lead-leading` (`1.55`); `--hero-split-pad-block` (`--section-space`); `--hero-kicker-display` and `--hero-kicker-leading` (`inline-block`, inherited), which as `block` and a leading lay the kicker out at its drawn height; `--hero-actions-gap` (`14px`).
|
|
760
|
+
- **The footer:** `footer.hoursPlacement` (`"column"`, or `"brand"` for the hours inside the brand column, the brand column taking its own row when the link columns' floors outrun the row; an unknown value is a column); `--footer-link-size` (`1em`); `--footer-brand-width` (unset, the brand column's 1.4 share, or 2 beside the hours); `--closing-rule-inset` (`0px`).
|
|
761
|
+
- **Hours:** `meridiem` (`"letter"`, or `"word"` for "8 am") and `footer.hoursShort` (`true`), so "8:00 am to 5:00 pm" in the footer is `meridiem: "word"` with `hoursShort: false`, no site code; `HoursTable` takes `meridiem`.
|
|
762
|
+
- **Sections:** `FeatureGrid`'s `external` on a linked card, opening it in a new tab and saying so (`newTabLabel`, "opens in a new tab"); `ContactInfoCard`'s `phoneLabel` (`"Call"`).
|
|
763
|
+
- `RouteErrorFallback` has its stories, and the story widths gain `smallPhone` 320, `smallTablet` 768, `laptop` 1024, and `wideTablet` 1099.
|
|
764
|
+
|
|
734
765
|
### Moving to 8.2.0
|
|
735
766
|
|
|
736
767
|
Nothing breaks: every addition is an optional prop, config key, token, or export. On a site that changes nothing, these change, all in or beside the phone menu: a header number with no label, or the contact block's one phone, reads "CALL" in the menu where it read "CALL / TEXT", which told a reader the business answers texts; the phone's round call button for a number with no label is named "Call" and the number where it was named by the number alone; the link to the page being read is underlined in the menu, as the bar marks its current entry; the contact dock's launcher is hidden while the menu is open, where the sheet already covered it; and a labeled burger, while the menu is open, folds only its lines to an X, where its words and its column of lines were caught by the X's rules too, a fault the open sheet covered. The group's own link in an open group now carries `aria-current` when it is the page being read, as the desktop panel's does. The light sheet, which no site has yet, shows no email and no address.
|
|
@@ -811,7 +842,7 @@ Nothing breaks: every addition is an optional prop, config key, token, or entry.
|
|
|
811
842
|
| `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 |
|
|
812
843
|
| `PricingBand` | A brand colored band with the price in a card beside it, informational by design |
|
|
813
844
|
| `CTASection` | The standard closer: the site's own primary action and an optional ghost second |
|
|
814
|
-
| `FeatureGrid` | Numbered cards with a hover lift; a card is a link or holds one, never both |
|
|
845
|
+
| `FeatureGrid` | Numbered cards with a hover lift; a card is a link or holds one, never both; a linked card with `external` opens in a new tab and says so to a screen reader (`newTabLabel`, 8.3.0) |
|
|
815
846
|
| `FeatureDetail` | Alternating copy and media rows with tags and a tick list |
|
|
816
847
|
| `ProcessSteps` | A dark band of numbered steps beside a frame |
|
|
817
848
|
| `PricingCard` | A standalone price card with a tick list and its booking action |
|
|
@@ -828,7 +859,7 @@ Nothing breaks: every addition is an optional prop, config key, token, or entry.
|
|
|
828
859
|
| `MapEmbed` | The map: a screenshot linking to directions, or a click to load facade over the live embed |
|
|
829
860
|
| `HoursTable` | Day rows with dashed rules and mono times |
|
|
830
861
|
| `ContactForm` | Validated form with a honeypot that posts to `endpoint` (or hands off to mail); `onLead` replaces the default GA4 `generate_lead` event |
|
|
831
|
-
| `ContactInfoCard` | A dark card of direct contact rows: call, email, visit, portal |
|
|
862
|
+
| `ContactInfoCard` | A dark card of direct contact rows: call, email, visit, portal; the single phone row reads `phoneLabel`, default "Call" (8.3.0) |
|
|
832
863
|
| `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 |
|
|
833
864
|
| `JumpRail` | Sticky in page pill tabs with scroll spy, used by `FAQBrowser` and on its own |
|
|
834
865
|
| `BlogIndex` | The post listing as a readable stack |
|
|
@@ -839,7 +870,7 @@ The primitives that came with them, in `@atelic-action/ui/primitives`: `ImageFra
|
|
|
839
870
|
|
|
840
871
|
The entry also exports the helpers the sections use, for a site's own code: `formatClock`, `formatHoursRange`, and `isClosed` for hours, `isHoneypotFilled`, and `trackEvent`.
|
|
841
872
|
|
|
842
|
-
Hours print on the 12 hour clock unless the site's config sets `clock: "24h"`, which turns "9a to 5p" into "09:00 to 17:00" everywhere hours appear: `LocationSection` and `HoursTable` (which takes `clock` as a prop when used on its own). `formatClock` and `formatHoursRange` take the same `clock`
|
|
873
|
+
Hours print on the 12 hour clock unless the site's config sets `clock: "24h"`, which turns "9a to 5p" into "09:00 to 17:00" everywhere hours appear: `LocationSection` and `HoursTable` (which takes `clock` as a prop when used on its own). `meridiem: "word"` (8.3.0) marks the 12 hour clock with a word, "9 am to 5 pm", wherever hours print (`HoursTable`'s `meridiem` when used on its own). The footer prints the short form, a whole hour's minutes dropped ("8a to 5p"), unless `footer.hoursShort` is false, so "8:00 am to 5:00 pm" in the footer is `meridiem: "word"` with `footer: { hoursShort: false }`, no site code. `formatClock` and `formatHoursRange` take the same `clock`, `meridiem`, and `short` options for a site's own code.
|
|
843
874
|
|
|
844
875
|
### The Marketing Vite Config and Commands
|
|
845
876
|
|
|
@@ -1049,10 +1080,15 @@ The sheets read a set of tokens beyond the theme's palette, type, radii, and lay
|
|
|
1049
1080
|
| `--nav-open-bg`, `--nav-open-ink` | `--hover-tint` read in place, `currentColor` (the bar's words) | The open group's pill (8.1.0) |
|
|
1050
1081
|
| `--nav-phone-pad`, `--nav-phone-size` | `6px 16px 6px 12px`, `0.95rem` | The header phone pill's padding and its number's size (8.1.0) |
|
|
1051
1082
|
| `--heading-transform`, `--heading-weight`, `--heading-tracking`, `--heading-color` | `none`, `--weight-heavy`, `-0.02em`, `currentColor` (inherited) | Every `h1` and `h2` the package sets (section headings, the heroes', the page hero's). The color never reaches a heading on a ground that says it is dark or the primary fill, by `data-ground` (8.2.0: every such section the package draws wears it, the hero, the process band, the callout panel, the price band, the credentials band, the contact card, and a site's own dark band may) or by `.on-primary` or `.on-dark`, nor one a component colors itself (8.1.0) |
|
|
1052
|
-
| `--subheading-tracking` | `-0.015em` | Every `h3`'s tracking, and two thirds of it every `h4`'s (`-0.01em` at the default), as `--heading-tracking` reaches `h1` and `h2`; a brand setting headings flat sets it to `0` (8.2.0) |
|
|
1083
|
+
| `--subheading-tracking` | `-0.015em` | Every `h3`'s tracking, and two thirds of it every `h4`'s (`-0.01em` at the default), as `--heading-tracking` reaches `h1` and `h2`; a brand setting headings flat sets it to `0` (8.2.0). Set a length; a theme that sets `normal` gets `normal` on `h3` and a flat `h4` (8.3.0: the `h4` took its parent's tracking) |
|
|
1053
1084
|
| `--hero-kicker-weight`, `--hero-kicker-tracking`, `--hero-kicker-size` | the eyebrow primitive's own (`--weight-medium`, `0.18em`, `0.74rem`), read in place from its private properties | The hero's eyebrow line, both layouts (8.2.0) |
|
|
1054
1085
|
| `--hero-lead-measure` | `52ch` | The hero's lead paragraph's measure, both layouts (8.2.0) |
|
|
1055
1086
|
| `--hero-stack-gap` | none; unset, each gap keeps its own (18, 22, and 32px on the full hero, 12, 22, and 26px on the split hero), read in place | One gap between the hero's kicker and headline, headline and lead, and lead and actions, both layouts (8.2.0) |
|
|
1087
|
+
| `--hero-gap-kicker`, `--hero-gap-lead`, `--hero-gap-actions` | `--hero-stack-gap` when set, else the gap's own (kicker to headline 18px, 12px on the split hero; headline to lead 22px; lead to actions 32px, 26px on the split hero), read in place | Each of the hero's three gaps on its own, both layouts (8.3.0) |
|
|
1088
|
+
| `--hero-lead-leading` | `1.55` | The hero's lead paragraph's line height, both layouts (8.3.0) |
|
|
1089
|
+
| `--hero-kicker-display`, `--hero-kicker-leading` | `inline-block`, inherited, read in place | The hero's kicker as the inline block it has been, in a line box of the copy's leading that stands it taller than its type; `block` with a leading of its own lays it out as a block whose height is that leading, so a design's kicker takes its drawn height (8.3.0) |
|
|
1090
|
+
| `--hero-actions-gap` | `14px` | The gap between the hero's actions, side by side or stacked (8.3.0) |
|
|
1091
|
+
| `--hero-split-pad-block` | `--section-space`, read in place | The split hero's copy column's top and bottom padding; over a transparent bar from 900px the bar's height is added above it, as before (8.3.0) |
|
|
1056
1092
|
| `--hero-lead-size` | `clamp(1.05rem, 2.2vw, 1.35rem)` | The hero's lead paragraph (`subtitle`), both layouts; a split hero whose lead wraps too long sets it smaller (8.2.0) |
|
|
1057
1093
|
| `--card-title-color` | `currentColor` (inherited) | A `FeatureGrid` card's title (8.1.0) |
|
|
1058
1094
|
| `--callout-transform`, `--callout-sub-font` | `none`, inherited (read in place, since no custom property can hold `inherit`) | A `CalloutPanel` title's case and its line's face (8.1.0) |
|
|
@@ -1062,6 +1098,9 @@ The sheets read a set of tokens beyond the theme's palette, type, radii, and lay
|
|
|
1062
1098
|
| `--footer-mark-height`, `--footer-nap-weight` | `38px`, `--weight-semibold` (the plain address: the column's own, read in place, since no custom property can hold `inherit`) | The footer lockup's mark and the address, phone, and email lines (8.1.0) |
|
|
1063
1099
|
| `--footer-link`, `--footer-link-hover` | `--neutral-200`, `--on-dark`, read in place | The footer's column links and every footer link's hover, apart from the neutrals that also draw outlines (8.2.0) |
|
|
1064
1100
|
| `--footer-link-hover-decoration` | `none` | The line a footer column link and a contact line take on hover (`underline`), for a theme whose links are already the hover's color, where a hover by color alone shows nothing (8.2.0) |
|
|
1101
|
+
| `--footer-link-size` | `1em` (the footer's own size, as the links always inherited) | The footer's column links' size, to a design's proportion (8.3.0) |
|
|
1102
|
+
| `--footer-brand-width` | none; unset, the brand column's share is 1.4, or 2 beside the hours from 1100px, read in place | The brand column's share of the footer's row from 760px, a link column's being 1 (8.3.0) |
|
|
1103
|
+
| `--closing-rule-inset` | `0px` | How far in from each side the rule above the closing bar starts; `max(var(--gutter), calc((100% - var(--max-width)) / 2 + var(--gutter)))` sets it inside the content's width (8.3.0) |
|
|
1065
1104
|
| `--closing-link`, `--closing-link-hover` | `--neutral-300`, `--surface` mixed 96% with `--on-dark`, read in place | The closing bar's links, the credit's among them, and their hover. Their own pair, since the closing bar's links have always read a step quieter than the footer's (8.2.0) |
|
|
1066
1105
|
| `--menu-card-bg`, `--menu-card-ink` | `--primary-deep`, `--on-primary`, read in place | The mega panel's feature card: its ground, and its eyebrow, headline, line, and ticked points. The card is the primary field (`.on-primary`), so its button stays light; a theme that sets a light ground here checks the button against it (8.2.0) |
|
|
1067
1106
|
| `--menu-rule` | `--hairline`, read in place | The light phone menu's row dividers (8.2.0) |
|
|
@@ -92,8 +92,15 @@ export declare function reportServerErrorLater(error: unknown, options?: ServerR
|
|
|
92
92
|
* A refused upstream answer as an error a report may carry: the service's
|
|
93
93
|
* name, the status, and the error body's `name` and `message` fields alone,
|
|
94
94
|
* each with anything shaped like an email address replaced by `[address]`
|
|
95
|
-
* and
|
|
96
|
-
*
|
|
95
|
+
* and anything shaped like a phone number (grouped as one is written) by
|
|
96
|
+
* `[number]`, then cut to 300
|
|
97
|
+
* characters. Nothing else of the body is read, and a body that is not JSON
|
|
98
|
+
* leaves the status alone. Never throws.
|
|
99
|
+
*
|
|
100
|
+
* The scrub takes out the shapes it knows and nothing more: the fields are
|
|
101
|
+
* still the upstream's free text, and a name, a street, or a message quoted
|
|
102
|
+
* in it in words passes through. Report a refusal from a service whose
|
|
103
|
+
* errors are about the request, never one that echoes what a person wrote.
|
|
97
104
|
*
|
|
98
105
|
* await refusalError(response, "Resend") // Error("Resend answered 422: validation_error: ...")
|
|
99
106
|
*/
|
|
@@ -235,16 +235,43 @@ export function reportServerErrorLater(error, options = {}) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
/**
|
|
239
|
-
|
|
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
|
+
}
|
|
240
260
|
/** The longest a refusal's field is kept, so a report never carries a page of text. */
|
|
241
261
|
const REFUSAL_FIELD_MAX = 300;
|
|
242
262
|
/**
|
|
243
263
|
* A refused upstream answer as an error a report may carry: the service's
|
|
244
264
|
* name, the status, and the error body's `name` and `message` fields alone,
|
|
245
265
|
* each with anything shaped like an email address replaced by `[address]`
|
|
246
|
-
* and
|
|
247
|
-
*
|
|
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.
|
|
248
275
|
*
|
|
249
276
|
* await refusalError(response, "Resend") // Error("Resend answered 422: validation_error: ...")
|
|
250
277
|
*/
|
|
@@ -260,7 +287,7 @@ export async function refusalError(response, service = "The upstream service") {
|
|
|
260
287
|
}
|
|
261
288
|
const parts = [body.name, body.message]
|
|
262
289
|
.filter((part) => typeof part === "string" && part.trim() !== "")
|
|
263
|
-
.map((part) => part
|
|
290
|
+
.map((part) => scrub(part).slice(0, REFUSAL_FIELD_MAX));
|
|
264
291
|
return new Error(`${service} answered ${response.status}${parts.length ? `: ${parts.join(": ")}` : ""}`);
|
|
265
292
|
}
|
|
266
293
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "8.
|
|
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",
|
package/src/chrome/Footer.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Mail, Star, UserRound } from "lucide-react";
|
|
2
|
-
import type { ComponentProps, Ref } from "react";
|
|
2
|
+
import type { ComponentProps, CSSProperties, Ref } from "react";
|
|
3
3
|
import { breakableEmail } from "../lib/emailText";
|
|
4
4
|
import { newTabProps } from "../lib/newTabProps";
|
|
5
5
|
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
|
|
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) => (
|
|
@@ -255,7 +280,22 @@ export function Footer({
|
|
|
255
280
|
<>
|
|
256
281
|
<footer ref={ref} className="footer">
|
|
257
282
|
<div className="wrap">
|
|
258
|
-
<div
|
|
283
|
+
<div
|
|
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}
|
|
298
|
+
>
|
|
259
299
|
<div className="footer-brand">
|
|
260
300
|
{logo?.tile ? (
|
|
261
301
|
<p className="footer-wordmark">
|
|
@@ -310,6 +350,15 @@ export function Footer({
|
|
|
310
350
|
{email && <a href={`mailto:${email}`}>{breakableEmail(email)}</a>}
|
|
311
351
|
</address>
|
|
312
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
|
+
)}
|
|
313
362
|
</div>
|
|
314
363
|
{hoursShown && (
|
|
315
364
|
<div className="footer-column footer-hours">
|
|
@@ -317,15 +366,7 @@ export function Footer({
|
|
|
317
366
|
<div className="footer-heading" role="heading" aria-level={headingLevel}>
|
|
318
367
|
{hoursHeading}
|
|
319
368
|
</div>
|
|
320
|
-
|
|
321
|
-
{hoursShown.map((row, at) => (
|
|
322
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: two rows may share a label (a split day), so the place keeps the key unique; rows never reorder
|
|
323
|
-
<div key={`${at} ${row.label}`}>
|
|
324
|
-
<dt>{row.label}</dt>
|
|
325
|
-
<dd>{row.range}</dd>
|
|
326
|
-
</div>
|
|
327
|
-
))}
|
|
328
|
-
</dl>
|
|
369
|
+
{hoursList(hoursShown)}
|
|
329
370
|
</div>
|
|
330
371
|
)}
|
|
331
372
|
{shown.map((column) => (
|
package/src/chrome/SiteMenu.tsx
CHANGED
|
@@ -113,6 +113,9 @@ export function SiteMenu({
|
|
|
113
113
|
brand,
|
|
114
114
|
}: SiteMenuProps) {
|
|
115
115
|
const light = surface === "light";
|
|
116
|
+
// The header's numbers, when there are any; an empty list is none, so the
|
|
117
|
+
// contact block's one phone stands in on either sheet.
|
|
118
|
+
const headerPhones = phones && phones.length > 0 ? phones : undefined;
|
|
116
119
|
const [openGroup, setOpenGroup] = useState<number | null>(null);
|
|
117
120
|
const groupId = useId();
|
|
118
121
|
const dialogRef = useRef<HTMLDialogElement>(null);
|
|
@@ -237,7 +240,7 @@ export function SiteMenu({
|
|
|
237
240
|
|
|
238
241
|
if (light) {
|
|
239
242
|
// A card per number the header shows, else the contact block's one phone.
|
|
240
|
-
const cards: MenuPhone[] =
|
|
243
|
+
const cards: MenuPhone[] = headerPhones ?? (contact?.phone ? [contact.phone] : []);
|
|
241
244
|
return (
|
|
242
245
|
<dialog
|
|
243
246
|
ref={dialogRef}
|
|
@@ -309,7 +312,7 @@ export function SiteMenu({
|
|
|
309
312
|
{menuCTA.label}
|
|
310
313
|
</Button>
|
|
311
314
|
)}
|
|
312
|
-
{(contact ||
|
|
315
|
+
{(contact || headerPhones) && <ContactBlock contact={contact ?? {}} phones={headerPhones} />}
|
|
313
316
|
</dialog>
|
|
314
317
|
);
|
|
315
318
|
}
|
package/src/chrome/SiteShell.tsx
CHANGED
|
@@ -212,7 +212,11 @@ export function SiteShell({
|
|
|
212
212
|
? undefined
|
|
213
213
|
: site.hours?.map((row) => ({
|
|
214
214
|
label: row.labelShort,
|
|
215
|
-
range: formatHoursRange(row, {
|
|
215
|
+
range: formatHoursRange(row, {
|
|
216
|
+
short: site.footer?.hoursShort ?? true,
|
|
217
|
+
clock: site.clock,
|
|
218
|
+
meridiem: site.meridiem,
|
|
219
|
+
}),
|
|
216
220
|
}));
|
|
217
221
|
// The rating links to the Google profile: the site's own link for it, else
|
|
218
222
|
// the profile the address already links to.
|
|
@@ -269,6 +273,7 @@ export function SiteShell({
|
|
|
269
273
|
phone={site.phone}
|
|
270
274
|
email={site.email}
|
|
271
275
|
hours={footerHours}
|
|
276
|
+
hoursPlacement={site.footer?.hoursPlacement}
|
|
272
277
|
columns={footerColumns}
|
|
273
278
|
attribution={site.attribution}
|
|
274
279
|
note={site.footer?.note}
|
|
@@ -25,7 +25,11 @@ export interface StickyCTABarProps {
|
|
|
25
25
|
* measured height while it shows, and 0 while it is hidden (scrolled
|
|
26
26
|
* above its threshold, or on a desktop, where the stylesheet hides it).
|
|
27
27
|
* `SiteShell` pads the page's closing bar by it, so the copyright and the
|
|
28
|
-
* credit are never under the bar.
|
|
28
|
+
* credit are never under the bar. A listener swapped in is told the
|
|
29
|
+
* current height at once and the one it replaced gets 0; no listener
|
|
30
|
+
* hears one value twice. A listener made anew each render that sets state
|
|
31
|
+
* should store a plain number (or be memoized): each new function hears
|
|
32
|
+
* the height once, and a state equal to it stops the renders.
|
|
29
33
|
*/
|
|
30
34
|
onSpaceChange?: (pixels: number) => void;
|
|
31
35
|
}
|
|
@@ -42,13 +46,20 @@ export function StickyCTABar({
|
|
|
42
46
|
const [show, setShow] = useState(fromTop);
|
|
43
47
|
const barRef = useRef<HTMLDivElement>(null);
|
|
44
48
|
// The latest listener, so a caller passing a new function each render
|
|
45
|
-
// never restarts the measuring below. Whether there is one at all does:
|
|
46
|
-
//
|
|
49
|
+
// never restarts the measuring below. Whether there is one at all does: a
|
|
50
|
+
// listener supplied after mount starts the measuring then.
|
|
47
51
|
const spaceRef = useRef(onSpaceChange);
|
|
48
52
|
spaceRef.current = onSpaceChange;
|
|
49
53
|
const listening = onSpaceChange !== undefined;
|
|
50
|
-
// The
|
|
51
|
-
|
|
54
|
+
// The height last measured (-1 before any, and after the bar goes), and
|
|
55
|
+
// what each listener was last told: no listener hears one value twice.
|
|
56
|
+
const heightRef = useRef(-1);
|
|
57
|
+
const toldRef = useRef(new WeakMap<(pixels: number) => void, number>());
|
|
58
|
+
const tell = (listener: ((pixels: number) => void) | undefined, pixels: number) => {
|
|
59
|
+
if (!listener || toldRef.current.get(listener) === pixels) return;
|
|
60
|
+
toldRef.current.set(listener, pixels);
|
|
61
|
+
listener(pixels);
|
|
62
|
+
};
|
|
52
63
|
|
|
53
64
|
useEffect(() => {
|
|
54
65
|
if (fromTop) {
|
|
@@ -64,46 +75,51 @@ export function StickyCTABar({
|
|
|
64
75
|
// The bar's real height while it shows, measured again whenever it changes
|
|
65
76
|
// size (a phone turned, a font loading, a label wrapping), never assumed.
|
|
66
77
|
// Hidden by the stylesheet its height reads 0, so a desktop reserves nothing.
|
|
78
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: tell reads only refs
|
|
67
79
|
useEffect(() => {
|
|
68
80
|
const bar = barRef.current;
|
|
69
81
|
if (!bar || !listening) return;
|
|
70
|
-
let last = -1;
|
|
71
|
-
// The listener last told a height: the one holding the space, which
|
|
72
|
-
// the cleanup hands back. Never the caller's latest, which after a
|
|
73
|
-
// swap is a listener that was never told anything.
|
|
74
|
-
let heard: ((pixels: number) => void) | undefined;
|
|
75
82
|
const report = () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// A caller swapped listeners since the last report: the old one
|
|
80
|
-
// gives its space back before the new one is told the height.
|
|
81
|
-
if (heard && heard !== listener) heard(0);
|
|
82
|
-
last = next;
|
|
83
|
-
heard = listener;
|
|
84
|
-
heard?.(next);
|
|
83
|
+
heightRef.current = show ? bar.offsetHeight : 0;
|
|
84
|
+
arrivalsRef.current = 0;
|
|
85
|
+
tell(spaceRef.current, heightRef.current);
|
|
85
86
|
};
|
|
86
87
|
report();
|
|
87
|
-
reportRef.current = report;
|
|
88
88
|
const sizes = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(report);
|
|
89
89
|
sizes?.observe(bar);
|
|
90
90
|
window.addEventListener("resize", report);
|
|
91
91
|
return () => {
|
|
92
|
-
reportRef.current = null;
|
|
93
92
|
sizes?.disconnect();
|
|
94
93
|
window.removeEventListener("resize", report);
|
|
95
|
-
// A final 0 on unmount, on hiding, and when the listener goes,
|
|
96
|
-
//
|
|
97
|
-
|
|
94
|
+
// A final 0 on unmount, on hiding, and when the listener goes, so no
|
|
95
|
+
// foot padding outlives the bar.
|
|
96
|
+
heightRef.current = -1;
|
|
97
|
+
tell(spaceRef.current, 0);
|
|
98
98
|
};
|
|
99
99
|
}, [show, listening]);
|
|
100
100
|
|
|
101
|
-
// A
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
101
|
+
// A listener swapped in is told the current height, and the one it
|
|
102
|
+
// replaced gets 0, unless either already heard that value. A function made
|
|
103
|
+
// anew each render (an inline listener) hears the height once a function
|
|
104
|
+
// until the caller's state settles; a stable listener hears nothing here.
|
|
105
|
+
const previousRef = useRef(onSpaceChange);
|
|
106
|
+
// Arrivals told since the bar last measured. A listener that sets object
|
|
107
|
+
// state is a new function on every render its own call causes, which no
|
|
108
|
+
// test of identity tells from a real swap; past three arrivals in a row
|
|
109
|
+
// with nothing measured between, the rest wait for the next measure, so
|
|
110
|
+
// such a listener cannot loop. Three real swaps in a row are all told.
|
|
111
|
+
const arrivalsRef = useRef(0);
|
|
112
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the listener is the trigger; tell reads only refs
|
|
105
113
|
useEffect(() => {
|
|
106
|
-
|
|
114
|
+
const previous = previousRef.current;
|
|
115
|
+
previousRef.current = onSpaceChange;
|
|
116
|
+
if (previous === onSpaceChange) return;
|
|
117
|
+
if (onSpaceChange && arrivalsRef.current >= 3) return;
|
|
118
|
+
arrivalsRef.current += 1;
|
|
119
|
+
// The outgoing one gives its space back, the bar measured or not (a
|
|
120
|
+
// listener taken away leaves the measuring off by now).
|
|
121
|
+
tell(previous, 0);
|
|
122
|
+
if (heightRef.current >= 0) tell(onSpaceChange, heightRef.current);
|
|
107
123
|
}, [onSpaceChange]);
|
|
108
124
|
|
|
109
125
|
return (
|
package/src/chrome/index.ts
CHANGED
|
@@ -234,7 +234,7 @@ export function DataTable({
|
|
|
234
234
|
const body = isEmpty(cell, c) ? (
|
|
235
235
|
<>
|
|
236
236
|
<span className="data-table-empty" aria-hidden="true" />
|
|
237
|
-
<span className="data-table-empty-label">
|
|
237
|
+
<span className="data-table-empty-label visually-hidden">
|
|
238
238
|
{columns[c]?.emptyLabel ?? "None"}
|
|
239
239
|
</span>
|
|
240
240
|
</>
|
|
@@ -119,7 +119,7 @@ export function ReportCard({
|
|
|
119
119
|
<span className="rc-grade">
|
|
120
120
|
{row.before && (
|
|
121
121
|
<span className="rc-before">
|
|
122
|
-
<span className="rc-sr">{`${labels.before}: ${gradeLabel[row.before]}. `}</span>
|
|
122
|
+
<span className="rc-sr visually-hidden">{`${labels.before}: ${gradeLabel[row.before]}. `}</span>
|
|
123
123
|
<span aria-hidden="true">
|
|
124
124
|
<GradeChip grade={row.before} />
|
|
125
125
|
</span>
|
|
@@ -127,14 +127,14 @@ export function ReportCard({
|
|
|
127
127
|
)}
|
|
128
128
|
{row.grade ? (
|
|
129
129
|
<>
|
|
130
|
-
<span className="rc-sr">{`${labels.grade} ${gradeLabel[row.grade]}: `}</span>
|
|
130
|
+
<span className="rc-sr visually-hidden">{`${labels.grade} ${gradeLabel[row.grade]}: `}</span>
|
|
131
131
|
<span aria-hidden="true">
|
|
132
132
|
<GradeChip grade={row.grade} />
|
|
133
133
|
</span>
|
|
134
134
|
</>
|
|
135
135
|
) : (
|
|
136
136
|
<>
|
|
137
|
-
<span className="rc-sr">{`${labels.notGraded}: `}</span>
|
|
137
|
+
<span className="rc-sr visually-hidden">{`${labels.notGraded}: `}</span>
|
|
138
138
|
<span className="rc-dash" aria-hidden="true" />
|
|
139
139
|
</>
|
|
140
140
|
)}
|