@brandlab-digital/site-next 3.20.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/instrumentation-client.d.ts +1 -1
- package/dist/instrumentation-client.js +1 -1
- package/dist/instrumentation-client.js.map +1 -1
- package/dist/navigation/index.d.ts +2 -3
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +2 -3
- package/dist/navigation/index.js.map +1 -1
- package/dist/next-config.d.ts +1 -17
- package/dist/next-config.d.ts.map +1 -1
- package/dist/next-config.js +2 -33
- package/dist/next-config.js.map +1 -1
- package/package.json +4 -33
- package/dist/ui-kit/brandlab-skin.d.ts +0 -112
- package/dist/ui-kit/brandlab-skin.d.ts.map +0 -1
- package/dist/ui-kit/brandlab-skin.js +0 -2
- package/dist/ui-kit/brandlab-skin.js.map +0 -1
- package/dist/ui-kit/form/copy.d.ts +0 -3
- package/dist/ui-kit/form/copy.d.ts.map +0 -1
- package/dist/ui-kit/form/copy.js +0 -5
- package/dist/ui-kit/form/copy.js.map +0 -1
- package/dist/ui-kit/form/dialog.d.ts +0 -24
- package/dist/ui-kit/form/dialog.d.ts.map +0 -1
- package/dist/ui-kit/form/dialog.js +0 -17
- package/dist/ui-kit/form/dialog.js.map +0 -1
- package/dist/ui-kit/form/field.d.ts +0 -30
- package/dist/ui-kit/form/field.d.ts.map +0 -1
- package/dist/ui-kit/form/field.js +0 -11
- package/dist/ui-kit/form/field.js.map +0 -1
- package/dist/ui-kit/form/index.d.ts +0 -7
- package/dist/ui-kit/form/index.d.ts.map +0 -1
- package/dist/ui-kit/form/index.js +0 -7
- package/dist/ui-kit/form/index.js.map +0 -1
- package/dist/ui-kit/form/photo-upload.d.ts +0 -40
- package/dist/ui-kit/form/photo-upload.d.ts.map +0 -1
- package/dist/ui-kit/form/photo-upload.js +0 -19
- package/dist/ui-kit/form/photo-upload.js.map +0 -1
- package/dist/ui-kit/form/quote-dialog.d.ts +0 -15
- package/dist/ui-kit/form/quote-dialog.d.ts.map +0 -1
- package/dist/ui-kit/form/quote-dialog.js +0 -68
- package/dist/ui-kit/form/quote-dialog.js.map +0 -1
- package/dist/ui-kit/form/quote-form.d.ts +0 -172
- package/dist/ui-kit/form/quote-form.d.ts.map +0 -1
- package/dist/ui-kit/form/quote-form.js +0 -238
- package/dist/ui-kit/form/quote-form.js.map +0 -1
- package/dist/ui-kit/form/thank-you.d.ts +0 -40
- package/dist/ui-kit/form/thank-you.d.ts.map +0 -1
- package/dist/ui-kit/form/thank-you.js +0 -36
- package/dist/ui-kit/form/thank-you.js.map +0 -1
- package/dist/ui-kit/icon-glyphs.d.ts +0 -41
- package/dist/ui-kit/icon-glyphs.d.ts.map +0 -1
- package/dist/ui-kit/icon-glyphs.js +0 -138
- package/dist/ui-kit/icon-glyphs.js.map +0 -1
- package/dist/ui-kit/icon-sprite.d.ts +0 -19
- package/dist/ui-kit/icon-sprite.d.ts.map +0 -1
- package/dist/ui-kit/icon-sprite.js +0 -44
- package/dist/ui-kit/icon-sprite.js.map +0 -1
- package/dist/ui-kit/icons.d.ts +0 -50
- package/dist/ui-kit/icons.d.ts.map +0 -1
- package/dist/ui-kit/icons.js +0 -55
- package/dist/ui-kit/icons.js.map +0 -1
- package/dist/ui-kit/prefetch.d.ts +0 -59
- package/dist/ui-kit/prefetch.d.ts.map +0 -1
- package/dist/ui-kit/prefetch.js +0 -63
- package/dist/ui-kit/prefetch.js.map +0 -1
- package/dist/ui-kit/primitives/badge.d.ts +0 -25
- package/dist/ui-kit/primitives/badge.d.ts.map +0 -1
- package/dist/ui-kit/primitives/badge.js +0 -21
- package/dist/ui-kit/primitives/badge.js.map +0 -1
- package/dist/ui-kit/primitives/breadcrumbs.d.ts +0 -27
- package/dist/ui-kit/primitives/breadcrumbs.d.ts.map +0 -1
- package/dist/ui-kit/primitives/breadcrumbs.js +0 -40
- package/dist/ui-kit/primitives/breadcrumbs.js.map +0 -1
- package/dist/ui-kit/primitives/button.d.ts +0 -32
- package/dist/ui-kit/primitives/button.d.ts.map +0 -1
- package/dist/ui-kit/primitives/button.js +0 -8
- package/dist/ui-kit/primitives/button.js.map +0 -1
- package/dist/ui-kit/primitives/card.d.ts +0 -40
- package/dist/ui-kit/primitives/card.d.ts.map +0 -1
- package/dist/ui-kit/primitives/card.js +0 -8
- package/dist/ui-kit/primitives/card.js.map +0 -1
- package/dist/ui-kit/primitives/index.d.ts +0 -16
- package/dist/ui-kit/primitives/index.d.ts.map +0 -1
- package/dist/ui-kit/primitives/index.js +0 -16
- package/dist/ui-kit/primitives/index.js.map +0 -1
- package/dist/ui-kit/primitives/layout.d.ts +0 -85
- package/dist/ui-kit/primitives/layout.d.ts.map +0 -1
- package/dist/ui-kit/primitives/layout.js +0 -52
- package/dist/ui-kit/primitives/layout.js.map +0 -1
- package/dist/ui-kit/primitives/links.d.ts +0 -74
- package/dist/ui-kit/primitives/links.d.ts.map +0 -1
- package/dist/ui-kit/primitives/links.js +0 -41
- package/dist/ui-kit/primitives/links.js.map +0 -1
- package/dist/ui-kit/primitives/lists.d.ts +0 -51
- package/dist/ui-kit/primitives/lists.d.ts.map +0 -1
- package/dist/ui-kit/primitives/lists.js +0 -34
- package/dist/ui-kit/primitives/lists.js.map +0 -1
- package/dist/ui-kit/primitives/media-frame.d.ts +0 -33
- package/dist/ui-kit/primitives/media-frame.d.ts.map +0 -1
- package/dist/ui-kit/primitives/media-frame.js +0 -61
- package/dist/ui-kit/primitives/media-frame.js.map +0 -1
- package/dist/ui-kit/primitives/media.d.ts +0 -40
- package/dist/ui-kit/primitives/media.d.ts.map +0 -1
- package/dist/ui-kit/primitives/media.js +0 -9
- package/dist/ui-kit/primitives/media.js.map +0 -1
- package/dist/ui-kit/primitives/quote-button.d.ts +0 -46
- package/dist/ui-kit/primitives/quote-button.d.ts.map +0 -1
- package/dist/ui-kit/primitives/quote-button.js +0 -38
- package/dist/ui-kit/primitives/quote-button.js.map +0 -1
- package/dist/ui-kit/primitives/stat.d.ts +0 -25
- package/dist/ui-kit/primitives/stat.d.ts.map +0 -1
- package/dist/ui-kit/primitives/stat.js +0 -7
- package/dist/ui-kit/primitives/stat.js.map +0 -1
- package/dist/ui-kit/repeated-slots.d.ts +0 -153
- package/dist/ui-kit/repeated-slots.d.ts.map +0 -1
- package/dist/ui-kit/repeated-slots.js +0 -100
- package/dist/ui-kit/repeated-slots.js.map +0 -1
- package/dist/ui-kit/sections/accordion.d.ts +0 -28
- package/dist/ui-kit/sections/accordion.d.ts.map +0 -1
- package/dist/ui-kit/sections/accordion.js +0 -14
- package/dist/ui-kit/sections/accordion.js.map +0 -1
- package/dist/ui-kit/sections/area-map.d.ts +0 -64
- package/dist/ui-kit/sections/area-map.d.ts.map +0 -1
- package/dist/ui-kit/sections/area-map.js +0 -146
- package/dist/ui-kit/sections/area-map.js.map +0 -1
- package/dist/ui-kit/sections/before-after.d.ts +0 -59
- package/dist/ui-kit/sections/before-after.d.ts.map +0 -1
- package/dist/ui-kit/sections/before-after.js +0 -42
- package/dist/ui-kit/sections/before-after.js.map +0 -1
- package/dist/ui-kit/sections/contact-block.d.ts +0 -77
- package/dist/ui-kit/sections/contact-block.d.ts.map +0 -1
- package/dist/ui-kit/sections/contact-block.js +0 -23
- package/dist/ui-kit/sections/contact-block.js.map +0 -1
- package/dist/ui-kit/sections/council-rules.d.ts +0 -64
- package/dist/ui-kit/sections/council-rules.d.ts.map +0 -1
- package/dist/ui-kit/sections/council-rules.js +0 -46
- package/dist/ui-kit/sections/council-rules.js.map +0 -1
- package/dist/ui-kit/sections/coverage.d.ts +0 -53
- package/dist/ui-kit/sections/coverage.d.ts.map +0 -1
- package/dist/ui-kit/sections/coverage.js +0 -57
- package/dist/ui-kit/sections/coverage.js.map +0 -1
- package/dist/ui-kit/sections/cta-band.d.ts +0 -67
- package/dist/ui-kit/sections/cta-band.d.ts.map +0 -1
- package/dist/ui-kit/sections/cta-band.js +0 -11
- package/dist/ui-kit/sections/cta-band.js.map +0 -1
- package/dist/ui-kit/sections/emergency-band.d.ts +0 -60
- package/dist/ui-kit/sections/emergency-band.d.ts.map +0 -1
- package/dist/ui-kit/sections/emergency-band.js +0 -43
- package/dist/ui-kit/sections/emergency-band.js.map +0 -1
- package/dist/ui-kit/sections/faqs.d.ts +0 -46
- package/dist/ui-kit/sections/faqs.d.ts.map +0 -1
- package/dist/ui-kit/sections/faqs.js +0 -39
- package/dist/ui-kit/sections/faqs.js.map +0 -1
- package/dist/ui-kit/sections/gallery.d.ts +0 -60
- package/dist/ui-kit/sections/gallery.d.ts.map +0 -1
- package/dist/ui-kit/sections/gallery.js +0 -39
- package/dist/ui-kit/sections/gallery.js.map +0 -1
- package/dist/ui-kit/sections/hero.d.ts +0 -168
- package/dist/ui-kit/sections/hero.d.ts.map +0 -1
- package/dist/ui-kit/sections/hero.js +0 -147
- package/dist/ui-kit/sections/hero.js.map +0 -1
- package/dist/ui-kit/sections/index.d.ts +0 -29
- package/dist/ui-kit/sections/index.d.ts.map +0 -1
- package/dist/ui-kit/sections/index.js +0 -29
- package/dist/ui-kit/sections/index.js.map +0 -1
- package/dist/ui-kit/sections/licences.d.ts +0 -95
- package/dist/ui-kit/sections/licences.d.ts.map +0 -1
- package/dist/ui-kit/sections/licences.js +0 -72
- package/dist/ui-kit/sections/licences.js.map +0 -1
- package/dist/ui-kit/sections/local-facts.d.ts +0 -107
- package/dist/ui-kit/sections/local-facts.d.ts.map +0 -1
- package/dist/ui-kit/sections/local-facts.js +0 -44
- package/dist/ui-kit/sections/local-facts.js.map +0 -1
- package/dist/ui-kit/sections/nearby-areas.d.ts +0 -50
- package/dist/ui-kit/sections/nearby-areas.d.ts.map +0 -1
- package/dist/ui-kit/sections/nearby-areas.js +0 -49
- package/dist/ui-kit/sections/nearby-areas.js.map +0 -1
- package/dist/ui-kit/sections/nearby-jobs.d.ts +0 -84
- package/dist/ui-kit/sections/nearby-jobs.d.ts.map +0 -1
- package/dist/ui-kit/sections/nearby-jobs.js +0 -72
- package/dist/ui-kit/sections/nearby-jobs.js.map +0 -1
- package/dist/ui-kit/sections/page-header.d.ts +0 -29
- package/dist/ui-kit/sections/page-header.d.ts.map +0 -1
- package/dist/ui-kit/sections/page-header.js +0 -9
- package/dist/ui-kit/sections/page-header.js.map +0 -1
- package/dist/ui-kit/sections/price-guide.d.ts +0 -59
- package/dist/ui-kit/sections/price-guide.d.ts.map +0 -1
- package/dist/ui-kit/sections/price-guide.js +0 -28
- package/dist/ui-kit/sections/price-guide.js.map +0 -1
- package/dist/ui-kit/sections/price-table.d.ts +0 -42
- package/dist/ui-kit/sections/price-table.d.ts.map +0 -1
- package/dist/ui-kit/sections/price-table.js +0 -29
- package/dist/ui-kit/sections/price-table.js.map +0 -1
- package/dist/ui-kit/sections/projects.d.ts +0 -79
- package/dist/ui-kit/sections/projects.d.ts.map +0 -1
- package/dist/ui-kit/sections/projects.js +0 -69
- package/dist/ui-kit/sections/projects.js.map +0 -1
- package/dist/ui-kit/sections/proof-strip.d.ts +0 -68
- package/dist/ui-kit/sections/proof-strip.d.ts.map +0 -1
- package/dist/ui-kit/sections/proof-strip.js +0 -27
- package/dist/ui-kit/sections/proof-strip.js.map +0 -1
- package/dist/ui-kit/sections/quote-checklist.d.ts +0 -43
- package/dist/ui-kit/sections/quote-checklist.d.ts.map +0 -1
- package/dist/ui-kit/sections/quote-checklist.js +0 -19
- package/dist/ui-kit/sections/quote-checklist.js.map +0 -1
- package/dist/ui-kit/sections/rating-chip.d.ts +0 -35
- package/dist/ui-kit/sections/rating-chip.d.ts.map +0 -1
- package/dist/ui-kit/sections/rating-chip.js +0 -21
- package/dist/ui-kit/sections/rating-chip.js.map +0 -1
- package/dist/ui-kit/sections/related-services.d.ts +0 -41
- package/dist/ui-kit/sections/related-services.d.ts.map +0 -1
- package/dist/ui-kit/sections/related-services.js +0 -52
- package/dist/ui-kit/sections/related-services.js.map +0 -1
- package/dist/ui-kit/sections/reviews-band.d.ts +0 -124
- package/dist/ui-kit/sections/reviews-band.d.ts.map +0 -1
- package/dist/ui-kit/sections/reviews-band.js +0 -115
- package/dist/ui-kit/sections/reviews-band.js.map +0 -1
- package/dist/ui-kit/sections/section-sequence.d.ts +0 -41
- package/dist/ui-kit/sections/section-sequence.d.ts.map +0 -1
- package/dist/ui-kit/sections/section-sequence.js +0 -36
- package/dist/ui-kit/sections/section-sequence.js.map +0 -1
- package/dist/ui-kit/sections/services-grid.d.ts +0 -82
- package/dist/ui-kit/sections/services-grid.d.ts.map +0 -1
- package/dist/ui-kit/sections/services-grid.js +0 -90
- package/dist/ui-kit/sections/services-grid.js.map +0 -1
- package/dist/ui-kit/sections/signature-section.d.ts +0 -42
- package/dist/ui-kit/sections/signature-section.d.ts.map +0 -1
- package/dist/ui-kit/sections/signature-section.js +0 -14
- package/dist/ui-kit/sections/signature-section.js.map +0 -1
- package/dist/ui-kit/sections/site-footer-columns.d.ts +0 -12
- package/dist/ui-kit/sections/site-footer-columns.d.ts.map +0 -1
- package/dist/ui-kit/sections/site-footer-columns.js +0 -63
- package/dist/ui-kit/sections/site-footer-columns.js.map +0 -1
- package/dist/ui-kit/sections/site-footer.d.ts +0 -66
- package/dist/ui-kit/sections/site-footer.d.ts.map +0 -1
- package/dist/ui-kit/sections/site-footer.js +0 -49
- package/dist/ui-kit/sections/site-footer.js.map +0 -1
- package/dist/ui-kit/sections/work-photos.d.ts +0 -15
- package/dist/ui-kit/sections/work-photos.d.ts.map +0 -1
- package/dist/ui-kit/sections/work-photos.js +0 -24
- package/dist/ui-kit/sections/work-photos.js.map +0 -1
- package/dist/ui-kit/shell/back-to-top-client.d.ts +0 -9
- package/dist/ui-kit/shell/back-to-top-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/back-to-top-client.js +0 -8
- package/dist/ui-kit/shell/back-to-top-client.js.map +0 -1
- package/dist/ui-kit/shell/back-to-top.d.ts +0 -13
- package/dist/ui-kit/shell/back-to-top.d.ts.map +0 -1
- package/dist/ui-kit/shell/back-to-top.js +0 -14
- package/dist/ui-kit/shell/back-to-top.js.map +0 -1
- package/dist/ui-kit/shell/call-bar-client.d.ts +0 -8
- package/dist/ui-kit/shell/call-bar-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/call-bar-client.js +0 -13
- package/dist/ui-kit/shell/call-bar-client.js.map +0 -1
- package/dist/ui-kit/shell/current-link.d.ts +0 -45
- package/dist/ui-kit/shell/current-link.d.ts.map +0 -1
- package/dist/ui-kit/shell/current-link.js +0 -54
- package/dist/ui-kit/shell/current-link.js.map +0 -1
- package/dist/ui-kit/shell/drawer-client.d.ts +0 -22
- package/dist/ui-kit/shell/drawer-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/drawer-client.js +0 -70
- package/dist/ui-kit/shell/drawer-client.js.map +0 -1
- package/dist/ui-kit/shell/header-client.d.ts +0 -44
- package/dist/ui-kit/shell/header-client.d.ts.map +0 -1
- package/dist/ui-kit/shell/header-client.js +0 -59
- package/dist/ui-kit/shell/header-client.js.map +0 -1
- package/dist/ui-kit/shell/index.d.ts +0 -7
- package/dist/ui-kit/shell/index.d.ts.map +0 -1
- package/dist/ui-kit/shell/index.js +0 -7
- package/dist/ui-kit/shell/index.js.map +0 -1
- package/dist/ui-kit/shell/intent-prefetch.d.ts +0 -4
- package/dist/ui-kit/shell/intent-prefetch.d.ts.map +0 -1
- package/dist/ui-kit/shell/intent-prefetch.js +0 -62
- package/dist/ui-kit/shell/intent-prefetch.js.map +0 -1
- package/dist/ui-kit/shell/mobile-call-bar.d.ts +0 -25
- package/dist/ui-kit/shell/mobile-call-bar.d.ts.map +0 -1
- package/dist/ui-kit/shell/mobile-call-bar.js +0 -21
- package/dist/ui-kit/shell/mobile-call-bar.js.map +0 -1
- package/dist/ui-kit/shell/mobile-drawer.d.ts +0 -41
- package/dist/ui-kit/shell/mobile-drawer.d.ts.map +0 -1
- package/dist/ui-kit/shell/mobile-drawer.js +0 -41
- package/dist/ui-kit/shell/mobile-drawer.js.map +0 -1
- package/dist/ui-kit/shell/shell-context.d.ts +0 -3
- package/dist/ui-kit/shell/shell-context.d.ts.map +0 -1
- package/dist/ui-kit/shell/shell-context.js +0 -5
- package/dist/ui-kit/shell/shell-context.js.map +0 -1
- package/dist/ui-kit/shell/shell-quote.d.ts +0 -10
- package/dist/ui-kit/shell/shell-quote.d.ts.map +0 -1
- package/dist/ui-kit/shell/shell-quote.js +0 -13
- package/dist/ui-kit/shell/shell-quote.js.map +0 -1
- package/dist/ui-kit/shell/site-header.d.ts +0 -55
- package/dist/ui-kit/shell/site-header.d.ts.map +0 -1
- package/dist/ui-kit/shell/site-header.js +0 -35
- package/dist/ui-kit/shell/site-header.js.map +0 -1
- package/dist/ui-kit/shell/social-links.d.ts +0 -7
- package/dist/ui-kit/shell/social-links.d.ts.map +0 -1
- package/dist/ui-kit/shell/social-links.js +0 -12
- package/dist/ui-kit/shell/social-links.js.map +0 -1
- package/dist/ui-kit/shell/utility-bar.d.ts +0 -33
- package/dist/ui-kit/shell/utility-bar.d.ts.map +0 -1
- package/dist/ui-kit/shell/utility-bar.js +0 -15
- package/dist/ui-kit/shell/utility-bar.js.map +0 -1
- package/dist/ui-kit/skin-index.d.ts +0 -4
- package/dist/ui-kit/skin-index.d.ts.map +0 -1
- package/dist/ui-kit/skin-index.js +0 -3
- package/dist/ui-kit/skin-index.js.map +0 -1
- package/dist/ui-kit/skin.d.ts +0 -65
- package/dist/ui-kit/skin.d.ts.map +0 -1
- package/dist/ui-kit/skin.js +0 -60
- package/dist/ui-kit/skin.js.map +0 -1
- package/dist/ui-kit/structure.css +0 -2546
- package/dist/ui-kit/types.d.ts +0 -27
- package/dist/ui-kit/types.d.ts.map +0 -1
- package/dist/ui-kit/types.js +0 -6
- package/dist/ui-kit/types.js.map +0 -1
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* `Coverage` (S15, `coverage`, 3.15.0): the areas served. Server component.
|
|
4
|
-
*
|
|
5
|
-
* On a region page it lists every suburb in the region; on the areas hub every region's suburbs, grouped (D4: every
|
|
6
|
-
* suburb page is indexed and linked). While D4 return waves run, a suburb whose page is still noindex is an entry with
|
|
7
|
-
* no `href`: its name as plain text in the same list (`<li>Putney</li>`), because indexable pages never link a noindex
|
|
8
|
-
* location page. site-core's `coverageEntries()` decides link or text from the estate plan and the day. The lists are lean (cost item 1f): each group is a `LinkList` of plain
|
|
9
|
-
* `<li><a>` entries with no class, hook or icon, so a 120-suburb region stays near 120 bytes a link, and nothing in the
|
|
10
|
-
* section prefetches (`data-bl-links="area"`, W2). Groups come from the site's data in money order (regions or
|
|
11
|
-
* councils); a group's heading links to its own page when it has one. The groups and their lists are repeated parts:
|
|
12
|
-
* style them from `skin.css` (`[data-bl-section="coverage"] [data-slot="group"]`, `… [data-bl="link-list"]`). The hub link reads "All {n} areas" unless the
|
|
13
|
-
* site gives its own label. Locked: no invented region names, no "based in" or distance text.
|
|
14
|
-
*/
|
|
15
|
-
import Link from 'next/link';
|
|
16
|
-
import { SECTION_READY } from '@brandlab-digital/site-core/section-order';
|
|
17
|
-
import { LinkList } from '../primitives/lists.js';
|
|
18
|
-
import { Section, SectionHeading } from '../primitives/layout.js';
|
|
19
|
-
import { repeatedSlot, slot } from '../skin.js';
|
|
20
|
-
export const COVERAGE_VARIANTS = ['list'];
|
|
21
|
-
/** The hub link's text: the site's label, or "All {n} areas" ("All 1 area" never reads well, so one is "All areas"). */
|
|
22
|
-
export function coverageHubLabel(hub) {
|
|
23
|
-
if (hub.label?.trim())
|
|
24
|
-
return hub.label;
|
|
25
|
-
if (!Number.isInteger(hub.count) || hub.count < 1)
|
|
26
|
-
throw new Error('Coverage: the hub count must be a whole number of areas, 1 or more.');
|
|
27
|
-
return hub.count === 1 ? 'All areas' : `All ${hub.count} areas`;
|
|
28
|
-
}
|
|
29
|
-
/** The guard for `SectionSequence`. */
|
|
30
|
-
export function coverageReady({ groups }) {
|
|
31
|
-
return groups.some((group) => group.links.length > 0) ? SECTION_READY : { render: false, reason: 'no-areas' };
|
|
32
|
-
}
|
|
33
|
-
function assertGroups(groups) {
|
|
34
|
-
const ids = new Set();
|
|
35
|
-
for (const group of groups) {
|
|
36
|
-
if (!group.id || ids.has(group.id))
|
|
37
|
-
throw new Error(`Coverage: every group needs its own id ("${group.id}" is empty or repeated).`);
|
|
38
|
-
ids.add(group.id);
|
|
39
|
-
const seen = new Set();
|
|
40
|
-
for (const link of group.links) {
|
|
41
|
-
const key = link.href ?? `text:${link.label}`;
|
|
42
|
-
if (seen.has(key))
|
|
43
|
-
throw new Error(`Coverage: ${link.href ?? link.label} is listed twice in "${group.id}".`);
|
|
44
|
-
seen.add(key);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (groups.length > 1 && groups.some((group) => !group.title?.trim()))
|
|
48
|
-
throw new Error('Coverage: with more than one group, every group needs its title.');
|
|
49
|
-
}
|
|
50
|
-
export function Coverage({ title, eyebrow, lead, groups, hub, headingId = 'coverage-heading', tone, variant = 'list', layout, classes }) {
|
|
51
|
-
const shown = groups.filter((group) => group.links.length > 0);
|
|
52
|
-
if (shown.length === 0)
|
|
53
|
-
return null;
|
|
54
|
-
assertGroups(shown);
|
|
55
|
-
return (_jsxs(Section, { id: "coverage", labelledBy: headingId, tone: tone, variant: variant, classes: classes, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsx("div", { ...slot(classes, 'groups'), children: shown.map((group) => (_jsxs("div", { ...repeatedSlot('group'), "data-item": group.id, children: [group.title ? (_jsx("h3", { ...repeatedSlot('groupHeading'), children: group.href ? (_jsx(Link, { href: group.href, prefetch: false, children: group.title })) : (group.title) })) : null, _jsx(LinkList, { links: group.links, kind: "area", layout: layout })] }, group.id))) }), hub ? (_jsx("p", { ...slot(classes, 'hub'), children: _jsx(Link, { href: hub.href, prefetch: false, children: coverageHubLabel(hub) }) })) : null] }));
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=coverage.js.map
|
|
@@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Q,EAAE,KAAK,YAClC,gBAAgB,CAAC,GAAG,CAAC,GACjB,GACL,CACL,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `Coverage` (S15, `coverage`, 3.15.0): the areas served. Server component.\n *\n * On a region page it lists every suburb in the region; on the areas hub every region's suburbs, grouped (D4: every\n * suburb page is indexed and linked). While D4 return waves run, a suburb whose page is still noindex is an entry with\n * no `href`: its name as plain text in the same list (`<li>Putney</li>`), because indexable pages never link a noindex\n * location page. site-core's `coverageEntries()` decides link or text from the estate plan and the day. The lists are lean (cost item 1f): each group is a `LinkList` of plain\n * `<li><a>` entries with no class, hook or icon, so a 120-suburb region stays near 120 bytes a link, and nothing in the\n * section prefetches (`data-bl-links=\"area\"`, W2). Groups come from the site's data in money order (regions or\n * councils); a group's heading links to its own page when it has one. The groups and their lists are repeated parts:\n * style them from `skin.css` (`[data-bl-section=\"coverage\"] [data-slot=\"group\"]`, `… [data-bl=\"link-list\"]`). The hub link reads \"All {n} areas\" unless the\n * site gives its own label. Locked: no invented region names, no \"based in\" or distance text.\n */\nimport Link from 'next/link'\nimport type { ReactNode } from 'react'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { LinkList, type LinkListEntry, type LinkListLayout } from '../primitives/lists.js'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\n\nexport const COVERAGE_VARIANTS = ['list'] as const\nexport type CoverageVariant = (typeof COVERAGE_VARIANTS)[number]\nexport type CoverageSlot = SectionSlot | SectionHeadingSlot | 'groups' | 'hub' | RepeatedSlotOf<'coverage'>\n/** Rendered once per group: styled from the skin stylesheet, never by class. */\nexport type CoverageRepeatedSlot = RepeatedSlotOf<'coverage'>\nexport type CoverageLayout = LinkListLayout\nexport type CoverageSkin = SkinEntry<CoverageSlot, CoverageVariant, CoverageLayout, CoverageRepeatedSlot>\n\n/** One group of areas, for example a region or a council. */\nexport interface CoverageGroup {\n /** A stable slug, rendered as `data-item`. */\n readonly id: string\n /** The group's H3, for example \"Hills District\". Left out on a region page that lists one group. */\n readonly title?: string\n /** The group's own page, for example its region page; its heading links there. */\n readonly href?: string\n /**\n * Every area in the group: `{ label, href }` links its page; `{ label }` with no `href` names an area whose page is\n * still noindex (it waits for its return wave) as plain text. Both count towards the hub's \"All {n} areas\".\n */\n readonly links: readonly LinkListEntry[]\n}\n\n/** The hub link: every area the site serves. */\nexport interface CoverageHub {\n readonly href: string\n /** How many areas the hub lists, for the locked label \"All {n} areas\". */\n readonly count: number\n /** The site's own label instead. */\n readonly label?: string\n}\n\nexport interface CoverageProps extends CoverageSkin {\n /** The H2, for example \"Tree services across the Hills District\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n readonly groups: readonly CoverageGroup[]\n readonly hub?: CoverageHub\n /** Defaults to `coverage-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The hub link's text: the site's label, or \"All {n} areas\" (\"All 1 area\" never reads well, so one is \"All areas\"). */\nexport function coverageHubLabel(hub: CoverageHub): string {\n if (hub.label?.trim()) return hub.label\n if (!Number.isInteger(hub.count) || hub.count < 1) throw new Error('Coverage: the hub count must be a whole number of areas, 1 or more.')\n return hub.count === 1 ? 'All areas' : `All ${hub.count} areas`\n}\n\n/** The guard for `SectionSequence`. */\nexport function coverageReady({ groups }: Pick<CoverageProps, 'groups'>): BrandlabSectionReadiness {\n return groups.some((group) => group.links.length > 0) ? SECTION_READY : { render: false, reason: 'no-areas' }\n}\n\nfunction assertGroups(groups: readonly CoverageGroup[]) {\n const ids = new Set<string>()\n for (const group of groups) {\n if (!group.id || ids.has(group.id)) throw new Error(`Coverage: every group needs its own id (\"${group.id}\" is empty or repeated).`)\n ids.add(group.id)\n const seen = new Set<string>()\n for (const link of group.links) {\n const key = link.href ?? `text:${link.label}`\n if (seen.has(key)) throw new Error(`Coverage: ${link.href ?? link.label} is listed twice in \"${group.id}\".`)\n seen.add(key)\n }\n }\n if (groups.length > 1 && groups.some((group) => !group.title?.trim())) throw new Error('Coverage: with more than one group, every group needs its title.')\n}\n\nexport function Coverage({ title, eyebrow, lead, groups, hub, headingId = 'coverage-heading', tone, variant = 'list', layout, classes }: CoverageProps) {\n const shown = groups.filter((group) => group.links.length > 0)\n if (shown.length === 0) return null\n assertGroups(shown)\n return (\n <Section id=\"coverage\" labelledBy={headingId} tone={tone} variant={variant} classes={classes}>\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <div {...slot(classes, 'groups')}>\n {shown.map((group) => (\n <div key={group.id} {...repeatedSlot('group')} data-item={group.id}>\n {group.title ? (\n <h3 {...repeatedSlot('groupHeading')}>\n {group.href ? (\n <Link href={group.href} prefetch={false}>\n {group.title}\n </Link>\n ) : (\n group.title\n )}\n </h3>\n ) : null}\n <LinkList links={group.links} kind=\"area\" layout={layout} />\n </div>\n ))}\n </div>\n {hub ? (\n <p {...slot(classes, 'hub')}>\n <Link href={hub.href} prefetch={false}>\n {coverageHubLabel(hub)}\n </Link>\n </p>\n ) : null}\n </Section>\n )\n}\n"]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* S8 `CTABand` (`cta`): the one closing action design a site uses on every page. Server component, no client JS of
|
|
3
|
-
* its own. A heading, an optional one-line summary, the quote button (`lead_cta_click` placement `section`, id
|
|
4
|
-
* `quote-cta`) and one phone link (`phone_link_click` placement `cta`), phone first like the header, hero and call bar. No "what happens next" filler.
|
|
5
|
-
*
|
|
6
|
-
* Variants: `plain`; `photo`, with the site's backdrop image in `media` (decorative, so it renders `aria-hidden`);
|
|
7
|
-
* `form`, with the site's own quote form in `form` beside the heading and the phone link (the form is the quote
|
|
8
|
-
* action there, so the quote button is left out). A `photo` band without `media` or a `form` band without `form`
|
|
9
|
-
* renders as `plain`.
|
|
10
|
-
*
|
|
11
|
-
* Placement (S8): on every page except contact, thank-you and 404, which already end in the form or a confirmation.
|
|
12
|
-
* One variant per site, recorded in the skin.
|
|
13
|
-
*
|
|
14
|
-
* 3.16.0: an optional `eyebrow` above the heading; `layout.arrangement: 'split'` puts the heading and summary on one
|
|
15
|
-
* side and the actions on the other from 768 px; and the band's colour comes from the skin's `--bl-color-cta` (falling
|
|
16
|
-
* back to `--bl-color-band`), so a site sets its closing band apart from the footer.
|
|
17
|
-
*/
|
|
18
|
-
import type { ReactNode } from 'react';
|
|
19
|
-
import type { ButtonVariant } from '../primitives/links.js';
|
|
20
|
-
import type { SectionTone } from '../primitives/layout.js';
|
|
21
|
-
import { type SkinEntry } from '../skin.js';
|
|
22
|
-
import type { UiPhone } from '../types.js';
|
|
23
|
-
export declare const CTA_BAND_VARIANTS: readonly ["plain", "photo", "form"];
|
|
24
|
-
export type CTABandVariant = (typeof CTA_BAND_VARIANTS)[number];
|
|
25
|
-
export type CTABandSlot = 'root' | 'media' | 'inner' | 'content' | 'eyebrow' | 'heading' | 'summary' | 'actions' | 'quote' | 'phone' | 'form';
|
|
26
|
-
export interface CTABandLayout {
|
|
27
|
-
readonly align?: 'start' | 'center';
|
|
28
|
-
/** The quote button's variant (default `primary`). */
|
|
29
|
-
readonly quoteVariant?: ButtonVariant;
|
|
30
|
-
/** The phone link's variant (default `button`). */
|
|
31
|
-
readonly phoneVariant?: 'text' | 'button';
|
|
32
|
-
/** `stacked` (the default) or `split`: the words on one side, the actions on the other (3.16.0). */
|
|
33
|
-
readonly arrangement?: 'stacked' | 'split';
|
|
34
|
-
}
|
|
35
|
-
export type CTABandSkin = SkinEntry<CTABandSlot, CTABandVariant, CTABandLayout>;
|
|
36
|
-
export declare const CTA_BAND_HEADING_ID = "bl-cta-heading";
|
|
37
|
-
export interface CTABandProps extends CTABandSkin {
|
|
38
|
-
/** The H2 text the site owns. */
|
|
39
|
-
readonly heading: string;
|
|
40
|
-
/** A short label above the heading (3.16.0). */
|
|
41
|
-
readonly eyebrow?: string;
|
|
42
|
-
/** One line under the heading. */
|
|
43
|
-
readonly summary?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The site's recorded quote label (C5) and the quote form it falls back to, for example `/contact#quote`. Required
|
|
46
|
-
* for the `plain` and `photo` variants; the `form` variant leaves the quote button out, so it may omit this.
|
|
47
|
-
*/
|
|
48
|
-
readonly quote?: {
|
|
49
|
-
readonly label: string;
|
|
50
|
-
readonly href: string;
|
|
51
|
-
};
|
|
52
|
-
readonly phone: UiPhone;
|
|
53
|
-
/** Optional words before the number, for example "Call". */
|
|
54
|
-
readonly phoneLabel?: string;
|
|
55
|
-
/** The `photo` variant's backdrop: the site's image node (decorative). */
|
|
56
|
-
readonly media?: ReactNode;
|
|
57
|
-
/** The `form` variant's form: the site's own quote form. */
|
|
58
|
-
readonly form?: ReactNode;
|
|
59
|
-
/** The id of the band's H2 (default `bl-cta-heading`). */
|
|
60
|
-
readonly headingId?: string;
|
|
61
|
-
/** Set by `SectionSequence`; a `photo` band defaults to `photo`. */
|
|
62
|
-
readonly tone?: SectionTone;
|
|
63
|
-
/** Signature art, rendered `aria-hidden`. */
|
|
64
|
-
readonly decoration?: ReactNode;
|
|
65
|
-
}
|
|
66
|
-
export declare function CTABand({ heading, eyebrow, summary, quote, phone, phoneLabel, media, form, headingId, tone, decoration, variant, layout, classes, }: CTABandProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
-
//# sourceMappingURL=cta-band.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cta-band.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/cta-band.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D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AAE,MAAM,CAAA;KAAE,CAAA;IAClE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAChC;AAED,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,IAAI,EACJ,SAA+B,EAC/B,IAAI,EACJ,UAAU,EACV,OAAiB,EACjB,MAAM,EACN,OAAO,GACR,EAAE,YAAY,2CA+Cd"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PhoneLink } from '../primitives/links.js';
|
|
3
|
-
import { QuoteButton } from '../primitives/quote-button.js';
|
|
4
|
-
import { slot } from '../skin.js';
|
|
5
|
-
export const CTA_BAND_VARIANTS = ['plain', 'photo', 'form'];
|
|
6
|
-
export const CTA_BAND_HEADING_ID = 'bl-cta-heading';
|
|
7
|
-
export function CTABand({ heading, eyebrow, summary, quote, phone, phoneLabel, media, form, headingId = CTA_BAND_HEADING_ID, tone, decoration, variant = 'plain', layout, classes, }) {
|
|
8
|
-
const shown = (variant === 'photo' && !media) || (variant === 'form' && !form) ? 'plain' : variant;
|
|
9
|
-
return (_jsxs("section", { "data-bl-section": "cta", "data-variant": shown, "data-tone": tone ?? (shown === 'photo' ? 'photo' : undefined), "data-align": layout?.align ?? 'start', "data-arrangement": layout?.arrangement === 'split' && shown !== 'form' ? 'split' : undefined, "aria-labelledby": headingId, className: classes?.root, children: [decoration ? (_jsx("div", { "data-slot": "decoration", "aria-hidden": "true", children: decoration })) : null, shown === 'photo' ? (_jsx("div", { ...slot(classes, 'media'), "aria-hidden": "true", children: media })) : null, _jsxs("div", { ...slot(classes, 'inner'), children: [_jsxs("div", { ...slot(classes, 'content'), children: [eyebrow ? _jsx("p", { ...slot(classes, 'eyebrow'), children: eyebrow }) : null, _jsx("h2", { id: headingId, ...slot(classes, 'heading'), children: heading }), summary ? _jsx("p", { ...slot(classes, 'summary'), children: summary }) : null, _jsxs("div", { ...slot(classes, 'actions'), children: [_jsx(PhoneLink, { phone: phone, placement: "cta", label: phoneLabel, showIcon: true, variant: layout?.phoneVariant ?? 'button', classes: { root: classes?.phone } }), shown === 'form' || !quote ? null : (_jsx(QuoteButton, { label: quote.label, href: quote.href, placement: "section", ctaId: "quote-cta", variant: layout?.quoteVariant ?? 'primary', classes: { root: classes?.quote } }))] })] }), shown === 'form' ? _jsx("div", { ...slot(classes, 'form'), children: form }) : null] })] }));
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=cta-band.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cta-band.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/cta-band.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAGjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAU,CAAA;AAiBpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAA;AA6BnD,MAAM,UAAU,OAAO,CAAC,EACtB,OAAO,EACP,OAA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YAC5C,OAAO,GACL,EACJ,OAAO,CAAC,CAAC,CAAC,eAAO,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,YAAG,OAAO,GAAK,CAAC,CAAC,CAAC,IAAI,EAChE,kBAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,aAC/B,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,KAAK,EAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,QAAC,OAAO,EAAE,MAAM,EAAE,YAAY,IAAI,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAI,EACpJ,KAAK,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACnC,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,SAAS,EAAC,SAAS,EACnB,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,MAAM,EAAE,YAAY,IAAI,SAAS,EAC1C,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GACjC,CACH,IACG,IACF,EACL,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,iBAAS,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,YAAG,IAAI,GAAO,CAAC,CAAC,CAAC,IAAI,IACnE,IACE,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * S8 `CTABand` (`cta`): the one closing action design a site uses on every page. Server component, no client JS of\n * its own. A heading, an optional one-line summary, the quote button (`lead_cta_click` placement `section`, id\n * `quote-cta`) and one phone link (`phone_link_click` placement `cta`), phone first like the header, hero and call bar. No \"what happens next\" filler.\n *\n * Variants: `plain`; `photo`, with the site's backdrop image in `media` (decorative, so it renders `aria-hidden`);\n * `form`, with the site's own quote form in `form` beside the heading and the phone link (the form is the quote\n * action there, so the quote button is left out). A `photo` band without `media` or a `form` band without `form`\n * renders as `plain`.\n *\n * Placement (S8): on every page except contact, thank-you and 404, which already end in the form or a confirmation.\n * One variant per site, recorded in the skin.\n *\n * 3.16.0: an optional `eyebrow` above the heading; `layout.arrangement: 'split'` puts the heading and summary on one\n * side and the actions on the other from 768 px; and the band's colour comes from the skin's `--bl-color-cta` (falling\n * back to `--bl-color-band`), so a site sets its closing band apart from the footer.\n */\nimport type { ReactNode } from 'react'\nimport { PhoneLink } from '../primitives/links.js'\nimport type { ButtonVariant } from '../primitives/links.js'\nimport type { SectionTone } from '../primitives/layout.js'\nimport { QuoteButton } from '../primitives/quote-button.js'\nimport { slot, type SkinEntry } from '../skin.js'\nimport type { UiPhone } from '../types.js'\n\nexport const CTA_BAND_VARIANTS = ['plain', 'photo', 'form'] as const\nexport type CTABandVariant = (typeof CTA_BAND_VARIANTS)[number]\n\nexport type CTABandSlot = 'root' | 'media' | 'inner' | 'content' | 'eyebrow' | 'heading' | 'summary' | 'actions' | 'quote' | 'phone' | 'form'\n\nexport interface CTABandLayout {\n readonly align?: 'start' | 'center'\n /** The quote button's variant (default `primary`). */\n readonly quoteVariant?: ButtonVariant\n /** The phone link's variant (default `button`). */\n readonly phoneVariant?: 'text' | 'button'\n /** `stacked` (the default) or `split`: the words on one side, the actions on the other (3.16.0). */\n readonly arrangement?: 'stacked' | 'split'\n}\n\nexport type CTABandSkin = SkinEntry<CTABandSlot, CTABandVariant, CTABandLayout>\n\nexport const CTA_BAND_HEADING_ID = 'bl-cta-heading'\n\nexport interface CTABandProps extends CTABandSkin {\n /** The H2 text the site owns. */\n readonly heading: string\n /** A short label above the heading (3.16.0). */\n readonly eyebrow?: string\n /** One line under the heading. */\n readonly summary?: string\n /**\n * The site's recorded quote label (C5) and the quote form it falls back to, for example `/contact#quote`. Required\n * for the `plain` and `photo` variants; the `form` variant leaves the quote button out, so it may omit this.\n */\n readonly quote?: { readonly label: string; readonly href: string }\n readonly phone: UiPhone\n /** Optional words before the number, for example \"Call\". */\n readonly phoneLabel?: string\n /** The `photo` variant's backdrop: the site's image node (decorative). */\n readonly media?: ReactNode\n /** The `form` variant's form: the site's own quote form. */\n readonly form?: ReactNode\n /** The id of the band's H2 (default `bl-cta-heading`). */\n readonly headingId?: string\n /** Set by `SectionSequence`; a `photo` band defaults to `photo`. */\n readonly tone?: SectionTone\n /** Signature art, rendered `aria-hidden`. */\n readonly decoration?: ReactNode\n}\n\nexport function CTABand({\n heading,\n eyebrow,\n summary,\n quote,\n phone,\n phoneLabel,\n media,\n form,\n headingId = CTA_BAND_HEADING_ID,\n tone,\n decoration,\n variant = 'plain',\n layout,\n classes,\n}: CTABandProps) {\n const shown: CTABandVariant = (variant === 'photo' && !media) || (variant === 'form' && !form) ? 'plain' : variant\n return (\n <section\n data-bl-section=\"cta\"\n data-variant={shown}\n data-tone={tone ?? (shown === 'photo' ? 'photo' : undefined)}\n data-align={layout?.align ?? 'start'}\n data-arrangement={layout?.arrangement === 'split' && shown !== 'form' ? 'split' : undefined}\n aria-labelledby={headingId}\n className={classes?.root}\n >\n {decoration ? (\n <div data-slot=\"decoration\" aria-hidden=\"true\">\n {decoration}\n </div>\n ) : null}\n {shown === 'photo' ? (\n <div {...slot(classes, 'media')} aria-hidden=\"true\">\n {media}\n </div>\n ) : null}\n <div {...slot(classes, 'inner')}>\n <div {...slot(classes, 'content')}>\n {eyebrow ? <p {...slot(classes, 'eyebrow')}>{eyebrow}</p> : null}\n <h2 id={headingId} {...slot(classes, 'heading')}>\n {heading}\n </h2>\n {summary ? <p {...slot(classes, 'summary')}>{summary}</p> : null}\n <div {...slot(classes, 'actions')}>\n <PhoneLink phone={phone} placement=\"cta\" label={phoneLabel} showIcon variant={layout?.phoneVariant ?? 'button'} classes={{ root: classes?.phone }} />\n {shown === 'form' || !quote ? null : (\n <QuoteButton\n label={quote.label}\n href={quote.href}\n placement=\"section\"\n ctaId=\"quote-cta\"\n variant={layout?.quoteVariant ?? 'primary'}\n classes={{ root: classes?.quote }}\n />\n )}\n </div>\n </div>\n {shown === 'form' ? <div {...slot(classes, 'form')}>{form}</div> : null}\n </div>\n </section>\n )\n}\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `EmergencyBand` (`emergency`, 3.15.0): the after-hours call band, straight after the proof strip. Server component,
|
|
3
|
-
* no client JS.
|
|
4
|
-
*
|
|
5
|
-
* Locked:
|
|
6
|
-
* - it renders **only** while the business facts record real after-hours work: `credentials.afterHours`, read through
|
|
7
|
-
* `renderableCredentials(credentials, 'website-copy')`, so the claim needs its claims-register id, evidence that
|
|
8
|
-
* allows website copy and has not expired, and (for a storm season) a day before its `endsOn`. Otherwise it renders
|
|
9
|
-
* nothing (matrix: "C, real after-hours only");
|
|
10
|
-
* - phone first: the phone link (`phone_link_click` placement `emergency`) comes before the optional quote button, as
|
|
11
|
-
* in the header, hero, call bar and CTA band (K6);
|
|
12
|
-
* - no response time: no record carries one, so a heading or summary that promises one ("within 60 minutes", "in 2
|
|
13
|
-
* hours", "within the hour") fails the build;
|
|
14
|
-
* - no default visible copy: the heading, summary and labels are the site's.
|
|
15
|
-
*/
|
|
16
|
-
import { type BrandlabAfterHours, type BrandlabBusiness } from '@brandlab-digital/site-core/business';
|
|
17
|
-
import { type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order';
|
|
18
|
-
import type { SectionTone } from '../primitives/layout.js';
|
|
19
|
-
import { type ButtonVariant } from '../primitives/links.js';
|
|
20
|
-
import { type SkinEntry } from '../skin.js';
|
|
21
|
-
import type { UiPhone } from '../types.js';
|
|
22
|
-
export type EmergencyBandSlot = 'root' | 'inner' | 'content' | 'heading' | 'summary' | 'actions' | 'phone' | 'quote';
|
|
23
|
-
export interface EmergencyBandLayout {
|
|
24
|
-
/** The phone link's variant. Defaults to `button`. */
|
|
25
|
-
readonly phoneVariant?: 'text' | 'button';
|
|
26
|
-
/** The quote button's variant. Defaults to `secondary`: the call is the band's main action. */
|
|
27
|
-
readonly quoteVariant?: ButtonVariant;
|
|
28
|
-
}
|
|
29
|
-
export type EmergencyBandSkin = SkinEntry<EmergencyBandSlot, never, EmergencyBandLayout>;
|
|
30
|
-
/** The business facts the band reads: `business.credentials`. */
|
|
31
|
-
export type EmergencyBandBusiness = Pick<BrandlabBusiness, 'credentials'>;
|
|
32
|
-
export interface EmergencyBandProps extends EmergencyBandSkin {
|
|
33
|
-
readonly business: EmergencyBandBusiness;
|
|
34
|
-
/** The H2, for example "Tree down after a storm?". No response time. */
|
|
35
|
-
readonly heading: string;
|
|
36
|
-
/** One line under the heading. No response time. */
|
|
37
|
-
readonly summary?: string;
|
|
38
|
-
readonly phone: UiPhone;
|
|
39
|
-
/** Words before the number, for example "Call". */
|
|
40
|
-
readonly phoneLabel?: string;
|
|
41
|
-
/** An optional quote action after the phone link, for work that can wait for a quote. */
|
|
42
|
-
readonly quote?: {
|
|
43
|
-
readonly label: string;
|
|
44
|
-
readonly href: string;
|
|
45
|
-
};
|
|
46
|
-
/** The day the page is built (tests pin it). */
|
|
47
|
-
readonly asOf?: Date;
|
|
48
|
-
/** Defaults to `emergency-heading`. */
|
|
49
|
-
readonly headingId?: string;
|
|
50
|
-
/** Set by `SectionSequence`. */
|
|
51
|
-
readonly tone?: SectionTone;
|
|
52
|
-
}
|
|
53
|
-
/** The after-hours work the band may stand on today, or nothing. */
|
|
54
|
-
export declare function renderableAfterHours(business: EmergencyBandBusiness, asOf?: Date): (BrandlabAfterHours & {
|
|
55
|
-
claimId: string;
|
|
56
|
-
}) | undefined;
|
|
57
|
-
/** The section's guard for `SectionSequence`: skipped unless real after-hours work is recorded and current. */
|
|
58
|
-
export declare function emergencyBandReady({ business, asOf }: Pick<EmergencyBandProps, 'business' | 'asOf'>): BrandlabSectionReadiness;
|
|
59
|
-
export declare function EmergencyBand({ business, heading, summary, phone, phoneLabel, quote, asOf, headingId, tone, layout, classes, }: EmergencyBandProps): import("react/jsx-runtime").JSX.Element | null;
|
|
60
|
-
//# sourceMappingURL=emergency-band.d.ts.map
|
|
@@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AE,OAAO,CAAA;IACvB,mDAAmD;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAClE,gDAAgD;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;IACpB,uCAAuC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B;AAED,oEAAoE;AACpE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,IAAI,GAAE,IAAiB,GAAG,CAAC,kBAAkB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CAErJ;AAED,+GAA+G;AAC/G,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG,wBAAwB,CAE9H;AAKD,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,OAAO,EACP,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,EACL,IAAI,EACJ,SAA+B,EAC/B,IAAI,EACJ,MAAM,EACN,OAAO,GACR,EAAE,kBAAkB,kDA6CpB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* `EmergencyBand` (`emergency`, 3.15.0): the after-hours call band, straight after the proof strip. Server component,
|
|
4
|
-
* no client JS.
|
|
5
|
-
*
|
|
6
|
-
* Locked:
|
|
7
|
-
* - it renders **only** while the business facts record real after-hours work: `credentials.afterHours`, read through
|
|
8
|
-
* `renderableCredentials(credentials, 'website-copy')`, so the claim needs its claims-register id, evidence that
|
|
9
|
-
* allows website copy and has not expired, and (for a storm season) a day before its `endsOn`. Otherwise it renders
|
|
10
|
-
* nothing (matrix: "C, real after-hours only");
|
|
11
|
-
* - phone first: the phone link (`phone_link_click` placement `emergency`) comes before the optional quote button, as
|
|
12
|
-
* in the header, hero, call bar and CTA band (K6);
|
|
13
|
-
* - no response time: no record carries one, so a heading or summary that promises one ("within 60 minutes", "in 2
|
|
14
|
-
* hours", "within the hour") fails the build;
|
|
15
|
-
* - no default visible copy: the heading, summary and labels are the site's.
|
|
16
|
-
*/
|
|
17
|
-
import { renderableCredentials, } from '@brandlab-digital/site-core/business';
|
|
18
|
-
import { SECTION_READY } from '@brandlab-digital/site-core/section-order';
|
|
19
|
-
import { PhoneLink } from '../primitives/links.js';
|
|
20
|
-
import { QuoteButton } from '../primitives/quote-button.js';
|
|
21
|
-
import { slot } from '../skin.js';
|
|
22
|
-
/** The after-hours work the band may stand on today, or nothing. */
|
|
23
|
-
export function renderableAfterHours(business, asOf = new Date()) {
|
|
24
|
-
return renderableCredentials(business.credentials, 'website-copy', asOf).afterHours;
|
|
25
|
-
}
|
|
26
|
-
/** The section's guard for `SectionSequence`: skipped unless real after-hours work is recorded and current. */
|
|
27
|
-
export function emergencyBandReady({ business, asOf }) {
|
|
28
|
-
return renderableAfterHours(business, asOf) ? SECTION_READY : { render: false, reason: 'no-after-hours-record' };
|
|
29
|
-
}
|
|
30
|
-
/** A promised response time: "60 minutes", "in 2 hours", "1-2 hrs", "within the hour", "within an hour". */
|
|
31
|
-
const RESPONSE_TIME = /\b\d+(?:\s*(?:-|–|to)\s*\d+)?\s*-?\s*(?:min(?:ute)?s?|h(?:ou)?rs?)\b|\bwithin\s+(?:an?|one|the)\s+hour\b|\bunder\s+an?\s+hour\b/i;
|
|
32
|
-
export function EmergencyBand({ business, heading, summary, phone, phoneLabel, quote, asOf, headingId = 'emergency-heading', tone, layout, classes, }) {
|
|
33
|
-
const afterHours = renderableAfterHours(business, asOf);
|
|
34
|
-
if (!afterHours)
|
|
35
|
-
return null;
|
|
36
|
-
for (const text of [heading, summary]) {
|
|
37
|
-
if (text && RESPONSE_TIME.test(text)) {
|
|
38
|
-
throw new Error(`EmergencyBand: "${text}" promises a response time, which no record supports. Say what is done after hours instead.`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return (_jsx("section", { "data-bl-section": "emergency", "data-tone": tone, "aria-labelledby": headingId, className: classes?.root, children: _jsxs("div", { ...slot(classes, 'inner'), children: [_jsxs("div", { ...slot(classes, 'content'), children: [_jsx("h2", { id: headingId, ...slot(classes, 'heading'), children: heading }), summary ? _jsx("p", { ...slot(classes, 'summary'), children: summary }) : null] }), _jsxs("div", { ...slot(classes, 'actions'), children: [_jsx(PhoneLink, { phone: phone, placement: "emergency", label: phoneLabel, showIcon: true, variant: layout?.phoneVariant ?? 'button', classes: { root: classes?.phone } }), quote ? (_jsx(QuoteButton, { label: quote.label, href: quote.href, placement: "section", ctaId: "quote-emergency", variant: layout?.quoteVariant ?? 'secondary', classes: { root: classes?.quote } })) : null] })] }) }));
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=emergency-band.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emergency-band.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/emergency-band.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,qBAAqB,GAGtB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AAExG,OAAO,EAAE,SAAS,EAAsB,MAAM,wBAAwB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAkCjD,oEAAoE;AACpE,MAAM,UAAU,oBAAoB,CAAC,QAA+B,EAAE,OAAa,IAA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,EACJ,OAAO,CAAC,CAAC,CAAC,eAAO,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,YAAG,OAAO,GAAK,CAAC,CAAC,CAAC,IAAI,IAC5D,EACN,kBAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,aAC/B,KAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,WAAW,EACrB,KAAK,EAAE,UAAU,EACjB,QAAQ,QACR,OAAO,EAAE,MAAM,EAAE,YAAY,IAAI,QAAQ,EACzC,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GACjC,EACD,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,SAAS,EAAC,SAAS,EACnB,KAAK,EAAC,iBAAiB,EACvB,OAAO,EAAE,MAAM,EAAE,YAAY,IAAI,WAAW,EAC5C,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GACjC,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,IACF,GACE,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `EmergencyBand` (`emergency`, 3.15.0): the after-hours call band, straight after the proof strip. Server component,\n * no client JS.\n *\n * Locked:\n * - it renders **only** while the business facts record real after-hours work: `credentials.afterHours`, read through\n * `renderableCredentials(credentials, 'website-copy')`, so the claim needs its claims-register id, evidence that\n * allows website copy and has not expired, and (for a storm season) a day before its `endsOn`. Otherwise it renders\n * nothing (matrix: \"C, real after-hours only\");\n * - phone first: the phone link (`phone_link_click` placement `emergency`) comes before the optional quote button, as\n * in the header, hero, call bar and CTA band (K6);\n * - no response time: no record carries one, so a heading or summary that promises one (\"within 60 minutes\", \"in 2\n * hours\", \"within the hour\") fails the build;\n * - no default visible copy: the heading, summary and labels are the site's.\n */\nimport {\n renderableCredentials,\n type BrandlabAfterHours,\n type BrandlabBusiness,\n} from '@brandlab-digital/site-core/business'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport type { SectionTone } from '../primitives/layout.js'\nimport { PhoneLink, type ButtonVariant } from '../primitives/links.js'\nimport { QuoteButton } from '../primitives/quote-button.js'\nimport { slot, type SkinEntry } from '../skin.js'\nimport type { UiPhone } from '../types.js'\n\nexport type EmergencyBandSlot = 'root' | 'inner' | 'content' | 'heading' | 'summary' | 'actions' | 'phone' | 'quote'\nexport interface EmergencyBandLayout {\n /** The phone link's variant. Defaults to `button`. */\n readonly phoneVariant?: 'text' | 'button'\n /** The quote button's variant. Defaults to `secondary`: the call is the band's main action. */\n readonly quoteVariant?: ButtonVariant\n}\nexport type EmergencyBandSkin = SkinEntry<EmergencyBandSlot, never, EmergencyBandLayout>\n\n/** The business facts the band reads: `business.credentials`. */\nexport type EmergencyBandBusiness = Pick<BrandlabBusiness, 'credentials'>\n\nexport interface EmergencyBandProps extends EmergencyBandSkin {\n readonly business: EmergencyBandBusiness\n /** The H2, for example \"Tree down after a storm?\". No response time. */\n readonly heading: string\n /** One line under the heading. No response time. */\n readonly summary?: string\n readonly phone: UiPhone\n /** Words before the number, for example \"Call\". */\n readonly phoneLabel?: string\n /** An optional quote action after the phone link, for work that can wait for a quote. */\n readonly quote?: { readonly label: string; readonly href: string }\n /** The day the page is built (tests pin it). */\n readonly asOf?: Date\n /** Defaults to `emergency-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The after-hours work the band may stand on today, or nothing. */\nexport function renderableAfterHours(business: EmergencyBandBusiness, asOf: Date = new Date()): (BrandlabAfterHours & { claimId: string }) | undefined {\n return renderableCredentials(business.credentials, 'website-copy', asOf).afterHours\n}\n\n/** The section's guard for `SectionSequence`: skipped unless real after-hours work is recorded and current. */\nexport function emergencyBandReady({ business, asOf }: Pick<EmergencyBandProps, 'business' | 'asOf'>): BrandlabSectionReadiness {\n return renderableAfterHours(business, asOf) ? SECTION_READY : { render: false, reason: 'no-after-hours-record' }\n}\n\n/** A promised response time: \"60 minutes\", \"in 2 hours\", \"1-2 hrs\", \"within the hour\", \"within an hour\". */\nconst RESPONSE_TIME = /\\b\\d+(?:\\s*(?:-|–|to)\\s*\\d+)?\\s*-?\\s*(?:min(?:ute)?s?|h(?:ou)?rs?)\\b|\\bwithin\\s+(?:an?|one|the)\\s+hour\\b|\\bunder\\s+an?\\s+hour\\b/i\n\nexport function EmergencyBand({\n business,\n heading,\n summary,\n phone,\n phoneLabel,\n quote,\n asOf,\n headingId = 'emergency-heading',\n tone,\n layout,\n classes,\n}: EmergencyBandProps) {\n const afterHours = renderableAfterHours(business, asOf)\n if (!afterHours) return null\n for (const text of [heading, summary]) {\n if (text && RESPONSE_TIME.test(text)) {\n throw new Error(`EmergencyBand: \"${text}\" promises a response time, which no record supports. Say what is done after hours instead.`)\n }\n }\n return (\n <section\n data-bl-section=\"emergency\"\n data-tone={tone}\n aria-labelledby={headingId}\n className={classes?.root}\n >\n <div {...slot(classes, 'inner')}>\n <div {...slot(classes, 'content')}>\n <h2 id={headingId} {...slot(classes, 'heading')}>\n {heading}\n </h2>\n {summary ? <p {...slot(classes, 'summary')}>{summary}</p> : null}\n </div>\n <div {...slot(classes, 'actions')}>\n <PhoneLink\n phone={phone}\n placement=\"emergency\"\n label={phoneLabel}\n showIcon\n variant={layout?.phoneVariant ?? 'button'}\n classes={{ root: classes?.phone }}\n />\n {quote ? (\n <QuoteButton\n label={quote.label}\n href={quote.href}\n placement=\"section\"\n ctaId=\"quote-emergency\"\n variant={layout?.quoteVariant ?? 'secondary'}\n classes={{ root: classes?.quote }}\n />\n ) : null}\n </div>\n </div>\n </section>\n )\n}\n"]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `FAQs` (S9, `faqs`): real questions and answers from the page's data, on `Accordion` (closed, one open at a time,
|
|
3
|
-
* answers in the server HTML). Never emits `FAQPage` or any other schema (F14). Variants: `list`, or `grouped` for
|
|
4
|
-
* the FAQs page (an H3 per group); one or two columns.
|
|
5
|
-
*/
|
|
6
|
-
import type { ReactNode } from 'react';
|
|
7
|
-
import { type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order';
|
|
8
|
-
import { type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js';
|
|
9
|
-
import type { RepeatedSlotOf } from '../repeated-slots.js';
|
|
10
|
-
import { type SkinEntry } from '../skin.js';
|
|
11
|
-
import { type AccordionSlot } from './accordion.js';
|
|
12
|
-
export declare const FAQS_VARIANTS: readonly ["list", "grouped"];
|
|
13
|
-
export type FAQsVariant = (typeof FAQS_VARIANTS)[number];
|
|
14
|
-
export type FAQsSlot = SectionSlot | SectionHeadingSlot | 'columns' | 'column' | 'group' | 'subheading' | 'accordion' | Exclude<AccordionSlot, 'root'>;
|
|
15
|
-
/** Rendered once per column, group or question: styled from the skin stylesheet, never by class (3.14.0). */
|
|
16
|
-
export type FAQsRepeatedSlot = RepeatedSlotOf<'faqs'>;
|
|
17
|
-
export type FAQsSkin = SkinEntry<FAQsSlot, FAQsVariant, {
|
|
18
|
-
columns?: 1 | 2;
|
|
19
|
-
}, FAQsRepeatedSlot>;
|
|
20
|
-
export interface FAQItem {
|
|
21
|
-
/** A stable slug, unique on the page. */
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly question: string;
|
|
24
|
-
readonly answer: ReactNode;
|
|
25
|
-
/** The group on the FAQs page (`grouped`), for example "Prices and quotes". */
|
|
26
|
-
readonly group?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface FAQsProps extends FAQsSkin {
|
|
29
|
-
/** The H2. */
|
|
30
|
-
readonly title: ReactNode;
|
|
31
|
-
readonly eyebrow?: ReactNode;
|
|
32
|
-
readonly lead?: ReactNode;
|
|
33
|
-
readonly items: readonly FAQItem[];
|
|
34
|
-
/** The question open on load, only where the site recorded one. */
|
|
35
|
-
readonly defaultOpen?: string;
|
|
36
|
-
/** The accordion group name and id prefix. Defaults to `faq`. */
|
|
37
|
-
readonly name?: string;
|
|
38
|
-
/** Defaults to `faqs-heading`. */
|
|
39
|
-
readonly headingId?: string;
|
|
40
|
-
/** Set by `SectionSequence`. */
|
|
41
|
-
readonly tone?: SectionTone;
|
|
42
|
-
}
|
|
43
|
-
/** Whether the section renders: nothing without questions (`no-faqs`). */
|
|
44
|
-
export declare function faqsReady({ items }: Pick<FAQsProps, 'items'>): BrandlabSectionReadiness;
|
|
45
|
-
export declare function FAQs({ title, eyebrow, lead, items, defaultOpen, name, headingId, tone, variant, layout, classes, }: FAQsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
46
|
-
//# sourceMappingURL=faqs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"faqs.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/faqs.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAA2B,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC9H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9D,eAAO,MAAM,aAAa,8BAA+B,CAAA;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AACxD,MAAM,MAAM,QAAQ,GAChB,WAAW,GACX,kBAAkB,GAClB,SAAS,GACT,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,WAAW,GACX,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;AAClC,6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AChB,MAAM,EACN,OAAO,GACR,EAAE,SAAS,kDAsCX"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SECTION_READY } from '@brandlab-digital/site-core/section-order';
|
|
3
|
-
import { Section, SectionHeading } from '../primitives/layout.js';
|
|
4
|
-
import { repeatedSlot, slot } from '../skin.js';
|
|
5
|
-
import { Accordion } from './accordion.js';
|
|
6
|
-
export const FAQS_VARIANTS = ['list', 'grouped'];
|
|
7
|
-
/** Whether the section renders: nothing without questions (`no-faqs`). */
|
|
8
|
-
export function faqsReady({ items }) {
|
|
9
|
-
return items.length > 0 ? SECTION_READY : { render: false, reason: 'no-faqs' };
|
|
10
|
-
}
|
|
11
|
-
/** Questions by group, in first-seen order; questions without a group come under no subheading. */
|
|
12
|
-
function groupItems(items) {
|
|
13
|
-
const groups = new Map();
|
|
14
|
-
for (const item of items)
|
|
15
|
-
groups.set(item.group ?? '', [...(groups.get(item.group ?? '') ?? []), item]);
|
|
16
|
-
return [...groups];
|
|
17
|
-
}
|
|
18
|
-
function halves(list, columns) {
|
|
19
|
-
if (columns === 1 || list.length < 2)
|
|
20
|
-
return [list];
|
|
21
|
-
const split = Math.ceil(list.length / 2);
|
|
22
|
-
return [list.slice(0, split), list.slice(split)];
|
|
23
|
-
}
|
|
24
|
-
export function FAQs({ title, eyebrow, lead, items, defaultOpen, name = 'faq', headingId = 'faqs-heading', tone, variant = 'list', layout, classes, }) {
|
|
25
|
-
if (!faqsReady({ items }).render)
|
|
26
|
-
return null;
|
|
27
|
-
if (new Set(items.map((item) => item.id)).size !== items.length)
|
|
28
|
-
throw new Error('FAQs: question ids must be unique on the page.');
|
|
29
|
-
if (defaultOpen !== undefined && !items.some((item) => item.id === defaultOpen)) {
|
|
30
|
-
throw new Error(`FAQs: defaultOpen "${defaultOpen}" is not a question on this page.`);
|
|
31
|
-
}
|
|
32
|
-
const columns = layout?.columns ?? 1;
|
|
33
|
-
const accordion = (list) => (_jsx(Accordion, { name: name, defaultOpen: list.some((item) => item.id === defaultOpen) ? defaultOpen : undefined, items: list.map((item) => ({ id: item.id, summary: item.question, content: item.answer })) }));
|
|
34
|
-
const groups = variant === 'grouped' ? groupItems(items) : null;
|
|
35
|
-
return (_jsxs(Section, { id: "faqs", labelledBy: headingId, tone: tone, variant: variant, classes: classes, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsx("div", { ...slot(classes, 'columns'), "data-columns": String(columns), children: groups
|
|
36
|
-
? halves(groups, columns).map((column, index) => (_jsx("div", { ...repeatedSlot('column'), children: column.map(([group, list]) => (_jsxs("div", { ...repeatedSlot('group'), children: [group ? _jsx("h3", { ...repeatedSlot('subheading'), children: group }) : null, accordion(list)] }, group))) }, index)))
|
|
37
|
-
: halves(items, columns).map((column, index) => (_jsx("div", { ...repeatedSlot('column'), children: accordion(column) }, index))) })] }));
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=faqs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"faqs.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/faqs.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAAE,OAAO,EAAE,cAAc,EAA+D,MAAM,yBAAyB,CAAA;AAE9H,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAA;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,CAAU,CAAA;AAwCzD,0EAA0E;AAC1E,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAA4B;IAC3D,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EA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iBAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,kBAAgB,MAAM,CAAC,OAAO,CAAC,YAC7D,MAAM;oBACL,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7C,iBAAqB,YAAY,CAAC,QAAQ,CAAC,YACxC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAC7B,kBAAqB,YAAY,CAAC,OAAO,CAAC,aACvC,KAAK,CAAC,CAAC,CAAC,gBAAQ,YAAY,CAAC,YAAY,CAAC,YAAG,KAAK,GAAM,CAAC,CAAC,CAAC,IAAI,EAC/D,SAAS,CAAC,IAAI,CAAC,KAFR,KAAK,CAGT,CACP,CAAC,IANM,KAAK,CAOT,CACP,CAAC;oBACJ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5C,iBAAqB,YAAY,CAAC,QAAQ,CAAC,YACxC,SAAS,CAAC,MAAM,CAAC,IADV,KAAK,CAET,CACP,CAAC,GACF,IACE,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `FAQs` (S9, `faqs`): real questions and answers from the page's data, on `Accordion` (closed, one open at a time,\n * answers in the server HTML). Never emits `FAQPage` or any other schema (F14). Variants: `list`, or `grouped` for\n * the FAQs page (an H3 per group); one or two columns.\n */\nimport type { ReactNode } from 'react'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\nimport { Accordion, type AccordionSlot } from './accordion.js'\n\nexport const FAQS_VARIANTS = ['list', 'grouped'] as const\nexport type FAQsVariant = (typeof FAQS_VARIANTS)[number]\nexport type FAQsSlot =\n | SectionSlot\n | SectionHeadingSlot\n | 'columns'\n | 'column'\n | 'group'\n | 'subheading'\n | 'accordion'\n | Exclude<AccordionSlot, 'root'>\n/** Rendered once per column, group or question: styled from the skin stylesheet, never by class (3.14.0). */\nexport type FAQsRepeatedSlot = RepeatedSlotOf<'faqs'>\nexport type FAQsSkin = SkinEntry<FAQsSlot, FAQsVariant, { columns?: 1 | 2 }, FAQsRepeatedSlot>\n\nexport interface FAQItem {\n /** A stable slug, unique on the page. */\n readonly id: string\n readonly question: string\n readonly answer: ReactNode\n /** The group on the FAQs page (`grouped`), for example \"Prices and quotes\". */\n readonly group?: string\n}\n\nexport interface FAQsProps extends FAQsSkin {\n /** The H2. */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n readonly items: readonly FAQItem[]\n /** The question open on load, only where the site recorded one. */\n readonly defaultOpen?: string\n /** The accordion group name and id prefix. Defaults to `faq`. */\n readonly name?: string\n /** Defaults to `faqs-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** Whether the section renders: nothing without questions (`no-faqs`). */\nexport function faqsReady({ items }: Pick<FAQsProps, 'items'>): BrandlabSectionReadiness {\n return items.length > 0 ? SECTION_READY : { render: false, reason: 'no-faqs' }\n}\n\n/** Questions by group, in first-seen order; questions without a group come under no subheading. */\nfunction groupItems(items: readonly FAQItem[]): (readonly [string, readonly FAQItem[]])[] {\n const groups = new Map<string, FAQItem[]>()\n for (const item of items) groups.set(item.group ?? '', [...(groups.get(item.group ?? '') ?? []), item])\n return [...groups]\n}\n\nfunction halves<T>(list: readonly T[], columns: 1 | 2): (readonly T[])[] {\n if (columns === 1 || list.length < 2) return [list]\n const split = Math.ceil(list.length / 2)\n return [list.slice(0, split), list.slice(split)]\n}\n\nexport function FAQs({\n title,\n eyebrow,\n lead,\n items,\n defaultOpen,\n name = 'faq',\n headingId = 'faqs-heading',\n tone,\n variant = 'list',\n layout,\n classes,\n}: FAQsProps) {\n if (!faqsReady({ items }).render) return null\n if (new Set(items.map((item) => item.id)).size !== items.length) throw new Error('FAQs: question ids must be unique on the page.')\n if (defaultOpen !== undefined && !items.some((item) => item.id === defaultOpen)) {\n throw new Error(`FAQs: defaultOpen \"${defaultOpen}\" is not a question on this page.`)\n }\n const columns = layout?.columns ?? 1\n const accordion = (list: readonly FAQItem[]) => (\n <Accordion\n name={name}\n defaultOpen={list.some((item) => item.id === defaultOpen) ? defaultOpen : undefined}\n items={list.map((item) => ({ id: item.id, summary: item.question, content: item.answer }))}\n />\n )\n const groups = variant === 'grouped' ? groupItems(items) : null\n return (\n <Section id=\"faqs\" labelledBy={headingId} tone={tone} variant={variant} classes={classes}>\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <div {...slot(classes, 'columns')} data-columns={String(columns)}>\n {groups\n ? halves(groups, columns).map((column, index) => (\n <div key={index} {...repeatedSlot('column')}>\n {column.map(([group, list]) => (\n <div key={group} {...repeatedSlot('group')}>\n {group ? <h3 {...repeatedSlot('subheading')}>{group}</h3> : null}\n {accordion(list)}\n </div>\n ))}\n </div>\n ))\n : halves(items, columns).map((column, index) => (\n <div key={index} {...repeatedSlot('column')}>\n {accordion(column)}\n </div>\n ))}\n </div>\n </Section>\n )\n}\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `Gallery` (`gallery`, 3.15.0): a grid of genuine job photos, on the gallery page (eight or more) or as a short
|
|
3
|
-
* section on a money page. Server component, no client JS: every photo renders through `MediaFrame`, so the sizing
|
|
4
|
-
* rule (a fluid `vw` size or a fixed `displayWidth`, never `sizes="148px"`) and the provenance hook are the library's.
|
|
5
|
-
*
|
|
6
|
-
* Locked:
|
|
7
|
-
* - genuine photos only: a stock or AI image fails the build. An AI illustration is supporting media with its
|
|
8
|
-
* "Illustration" label elsewhere, never in an "our work" gallery (F13);
|
|
9
|
-
* - every photo loads lazily (no preload): a gallery is never the page's main image;
|
|
10
|
-
* - a photo may link its project page; those links never prefetch (a gallery can hold dozens);
|
|
11
|
-
* - no photo twice, and no default visible copy: captions ("{what}, {suburb}, {month year}") come from the site.
|
|
12
|
-
*/
|
|
13
|
-
import type { ReactNode } from 'react';
|
|
14
|
-
import type { BrandlabMediaRatio } from '@brandlab-digital/site-core/media';
|
|
15
|
-
import { type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order';
|
|
16
|
-
import { type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js';
|
|
17
|
-
import { type UiMedia } from '../primitives/media-frame.js';
|
|
18
|
-
import type { RepeatedSlotOf } from '../repeated-slots.js';
|
|
19
|
-
import { type SkinEntry } from '../skin.js';
|
|
20
|
-
import type { UiLink } from '../types.js';
|
|
21
|
-
/** Rendered once per photo: styled from the skin stylesheet, never by class. The frames are `[data-bl="media"]`. */
|
|
22
|
-
export type GalleryRepeatedSlot = RepeatedSlotOf<'gallery'>;
|
|
23
|
-
export type GallerySlot = SectionSlot | SectionHeadingSlot | 'list' | 'more' | GalleryRepeatedSlot;
|
|
24
|
-
export interface GalleryLayout {
|
|
25
|
-
/** Columns on wide screens. Defaults to 3. */
|
|
26
|
-
readonly columns?: 2 | 3 | 4;
|
|
27
|
-
/** Crop every photo to one ratio, so the grid lines up. Left out, each photo keeps its own shape. */
|
|
28
|
-
readonly ratio?: BrandlabMediaRatio;
|
|
29
|
-
}
|
|
30
|
-
export type GallerySkin = SkinEntry<GallerySlot, never, GalleryLayout, GalleryRepeatedSlot>;
|
|
31
|
-
/** One photo of the work. */
|
|
32
|
-
export interface GalleryPhoto {
|
|
33
|
-
/** A stable slug (the media id), rendered as `data-item`. */
|
|
34
|
-
readonly id: string;
|
|
35
|
-
/** A genuine photo from the media manifest. */
|
|
36
|
-
readonly media: UiMedia;
|
|
37
|
-
/** "{what}, {suburb}, {month year}", only when the photo really shows that job. */
|
|
38
|
-
readonly caption?: ReactNode;
|
|
39
|
-
/** The job's project page, when it has one. Never prefetched. */
|
|
40
|
-
readonly href?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface GalleryProps extends GallerySkin {
|
|
43
|
-
/** The H2, for example "Our recent tree work". */
|
|
44
|
-
readonly title: ReactNode;
|
|
45
|
-
readonly eyebrow?: ReactNode;
|
|
46
|
-
readonly lead?: ReactNode;
|
|
47
|
-
readonly photos: readonly GalleryPhoto[];
|
|
48
|
-
/** A link after the grid, for example the full gallery. Never prefetched. */
|
|
49
|
-
readonly more?: UiLink;
|
|
50
|
-
/** The photos' `sizes`: a fluid `vw` string, or a number for a fixed CSS width (thumbnails). Defaults to one column. */
|
|
51
|
-
readonly imageSizes?: string | number;
|
|
52
|
-
/** Defaults to `gallery-heading`. */
|
|
53
|
-
readonly headingId?: string;
|
|
54
|
-
/** Set by `SectionSequence`. */
|
|
55
|
-
readonly tone?: SectionTone;
|
|
56
|
-
}
|
|
57
|
-
/** The section's guard for `SectionSequence`: skipped when there is no genuine photo to show. */
|
|
58
|
-
export declare function galleryReady({ photos }: Pick<GalleryProps, 'photos'>): BrandlabSectionReadiness;
|
|
59
|
-
export declare function Gallery({ title, eyebrow, lead, photos, more, imageSizes, headingId, tone, layout, classes }: GalleryProps): import("react/jsx-runtime").JSX.Element | null;
|
|
60
|
-
//# sourceMappingURL=gallery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/gallery.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAA2B,KAAK,kBAAkB,EAAE,KA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zB,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,wHAAwH;IACxH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrC,qCAAqC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,wBAAwB,CAE/F;AAgBD,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,SAA6B,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,kDAiC7I"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SECTION_READY } from '@brandlab-digital/site-core/section-order';
|
|
3
|
-
import { Section, SectionHeading } from '../primitives/layout.js';
|
|
4
|
-
import { Anchor } from '../primitives/links.js';
|
|
5
|
-
import { MediaFrame } from '../primitives/media-frame.js';
|
|
6
|
-
import { repeatedSlot, slot } from '../skin.js';
|
|
7
|
-
import { assertGenuineWork, frameSizing, gridImageSizes, isInternalPath } from './work-photos.js';
|
|
8
|
-
/** The section's guard for `SectionSequence`: skipped when there is no genuine photo to show. */
|
|
9
|
-
export function galleryReady({ photos }) {
|
|
10
|
-
return photos.length > 0 ? SECTION_READY : { render: false, reason: 'no-genuine-photos' };
|
|
11
|
-
}
|
|
12
|
-
function assertPhotos(photos) {
|
|
13
|
-
const ids = new Set();
|
|
14
|
-
const sources = new Map();
|
|
15
|
-
for (const photo of photos) {
|
|
16
|
-
if (!photo.id || ids.has(photo.id))
|
|
17
|
-
throw new Error(`Gallery: every photo needs its own id ("${photo.id}" is empty or repeated).`);
|
|
18
|
-
ids.add(photo.id);
|
|
19
|
-
assertGenuineWork('Gallery', photo.media, `"${photo.id}"`);
|
|
20
|
-
const other = sources.get(photo.media.src);
|
|
21
|
-
if (other)
|
|
22
|
-
throw new Error(`Gallery: "${photo.id}" and "${other}" are the same photo (${photo.media.src}).`);
|
|
23
|
-
sources.set(photo.media.src, photo.id);
|
|
24
|
-
if (photo.href !== undefined && !isInternalPath(photo.href))
|
|
25
|
-
throw new Error(`Gallery: "${photo.id}" links ${photo.href}; a photo links its project page on this site.`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export function Gallery({ title, eyebrow, lead, photos, more, imageSizes, headingId = 'gallery-heading', tone, layout, classes }) {
|
|
29
|
-
if (!galleryReady({ photos }).render)
|
|
30
|
-
return null;
|
|
31
|
-
assertPhotos(photos);
|
|
32
|
-
const columns = layout?.columns ?? 3;
|
|
33
|
-
const sizing = frameSizing(imageSizes ?? gridImageSizes(columns));
|
|
34
|
-
return (_jsxs(Section, { id: "gallery", labelledBy: headingId, tone: tone, classes: classes, hooks: { 'data-columns': String(columns), 'data-ratio': layout?.ratio }, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsx("ul", { role: "list", ...slot(classes, 'list'), children: photos.map((photo) => {
|
|
35
|
-
const frame = _jsx(MediaFrame, { media: photo.media, ratio: layout?.ratio, caption: photo.caption, ...sizing });
|
|
36
|
-
return (_jsx("li", { ...repeatedSlot('item'), "data-item": photo.id, children: photo.href ? (_jsx(Anchor, { href: photo.href, prefetch: false, hooks: { 'data-slot': 'link' }, children: frame })) : (frame) }, photo.id));
|
|
37
|
-
}) }), more ? (_jsx("p", { ...slot(classes, 'more'), children: _jsx(Anchor, { href: more.href, prefetch: false, hooks: {}, children: more.label }) })) : null] }));
|
|
38
|
-
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E,aAChJ,KAAC,cAAc,IAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAI,EAC/F,aAAI,IAAI,EAAC,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,YACtC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;oBACpB,MAAM,KAAK,GAAG,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,KAAM,MAAM,GAAI,CAAA;oBAC1G,OAAO,CACL,gBAAuB,YAAY,CAAC,MAAM,CAAC,eAAa,KAAK,CAAC,EAAE,YAC7D,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACZ,KAAC,MAAM,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,YACtE,KAAK,GACC,CACV,CAAC,CAAC,CAAC,CACF,KAAK,CACN,IAPM,KAAK,CAAC,EAAE,CAQZ,CACN,CAAA;gBACH,CAAC,CAAC,GACC,EACJ,IAAI,CAAC,CAAC,CAAC,CACN,eAAO,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,YAC1B,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,YAChD,IAAI,CAAC,KAAK,GACJ,GACP,CACL,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `Gallery` (`gallery`, 3.15.0): a grid of genuine job photos, on the gallery page (eight or more) or as a short\n * section on a money page. Server component, no client JS: every photo renders through `MediaFrame`, so the sizing\n * rule (a fluid `vw` size or a fixed `displayWidth`, never `sizes=\"148px\"`) and the provenance hook are the library's.\n *\n * Locked:\n * - genuine photos only: a stock or AI image fails the build. An AI illustration is supporting media with its\n * \"Illustration\" label elsewhere, never in an \"our work\" gallery (F13);\n * - every photo loads lazily (no preload): a gallery is never the page's main image;\n * - a photo may link its project page; those links never prefetch (a gallery can hold dozens);\n * - no photo twice, and no default visible copy: captions (\"{what}, {suburb}, {month year}\") come from the site.\n */\nimport type { ReactNode } from 'react'\nimport type { BrandlabMediaRatio } from '@brandlab-digital/site-core/media'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { Section, SectionHeading, type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js'\nimport { Anchor } from '../primitives/links.js'\nimport { MediaFrame, type UiMedia } from '../primitives/media-frame.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\nimport type { UiLink } from '../types.js'\nimport { assertGenuineWork, frameSizing, gridImageSizes, isInternalPath } from './work-photos.js'\n\n/** Rendered once per photo: styled from the skin stylesheet, never by class. The frames are `[data-bl=\"media\"]`. */\nexport type GalleryRepeatedSlot = RepeatedSlotOf<'gallery'>\nexport type GallerySlot = SectionSlot | SectionHeadingSlot | 'list' | 'more' | GalleryRepeatedSlot\nexport interface GalleryLayout {\n /** Columns on wide screens. Defaults to 3. */\n readonly columns?: 2 | 3 | 4\n /** Crop every photo to one ratio, so the grid lines up. Left out, each photo keeps its own shape. */\n readonly ratio?: BrandlabMediaRatio\n}\nexport type GallerySkin = SkinEntry<GallerySlot, never, GalleryLayout, GalleryRepeatedSlot>\n\n/** One photo of the work. */\nexport interface GalleryPhoto {\n /** A stable slug (the media id), rendered as `data-item`. */\n readonly id: string\n /** A genuine photo from the media manifest. */\n readonly media: UiMedia\n /** \"{what}, {suburb}, {month year}\", only when the photo really shows that job. */\n readonly caption?: ReactNode\n /** The job's project page, when it has one. Never prefetched. */\n readonly href?: string\n}\n\nexport interface GalleryProps extends GallerySkin {\n /** The H2, for example \"Our recent tree work\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n readonly photos: readonly GalleryPhoto[]\n /** A link after the grid, for example the full gallery. Never prefetched. */\n readonly more?: UiLink\n /** The photos' `sizes`: a fluid `vw` string, or a number for a fixed CSS width (thumbnails). Defaults to one column. */\n readonly imageSizes?: string | number\n /** Defaults to `gallery-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The section's guard for `SectionSequence`: skipped when there is no genuine photo to show. */\nexport function galleryReady({ photos }: Pick<GalleryProps, 'photos'>): BrandlabSectionReadiness {\n return photos.length > 0 ? SECTION_READY : { render: false, reason: 'no-genuine-photos' }\n}\n\nfunction assertPhotos(photos: readonly GalleryPhoto[]): void {\n const ids = new Set<string>()\n const sources = new Map<string, string>()\n for (const photo of photos) {\n if (!photo.id || ids.has(photo.id)) throw new Error(`Gallery: every photo needs its own id (\"${photo.id}\" is empty or repeated).`)\n ids.add(photo.id)\n assertGenuineWork('Gallery', photo.media, `\"${photo.id}\"`)\n const other = sources.get(photo.media.src)\n if (other) throw new Error(`Gallery: \"${photo.id}\" and \"${other}\" are the same photo (${photo.media.src}).`)\n sources.set(photo.media.src, photo.id)\n if (photo.href !== undefined && !isInternalPath(photo.href)) throw new Error(`Gallery: \"${photo.id}\" links ${photo.href}; a photo links its project page on this site.`)\n }\n}\n\nexport function Gallery({ title, eyebrow, lead, photos, more, imageSizes, headingId = 'gallery-heading', tone, layout, classes }: GalleryProps) {\n if (!galleryReady({ photos }).render) return null\n assertPhotos(photos)\n const columns = layout?.columns ?? 3\n const sizing = frameSizing(imageSizes ?? gridImageSizes(columns))\n return (\n <Section id=\"gallery\" labelledBy={headingId} tone={tone} classes={classes} hooks={{ 'data-columns': String(columns), 'data-ratio': layout?.ratio }}>\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <ul role=\"list\" {...slot(classes, 'list')}>\n {photos.map((photo) => {\n const frame = <MediaFrame media={photo.media} ratio={layout?.ratio} caption={photo.caption} {...sizing} />\n return (\n <li key={photo.id} {...repeatedSlot('item')} data-item={photo.id}>\n {photo.href ? (\n <Anchor href={photo.href} prefetch={false} hooks={{ 'data-slot': 'link' }}>\n {frame}\n </Anchor>\n ) : (\n frame\n )}\n </li>\n )\n })}\n </ul>\n {more ? (\n <p {...slot(classes, 'more')}>\n <Anchor href={more.href} prefetch={false} hooks={{}}>\n {more.label}\n </Anchor>\n </p>\n ) : null}\n </Section>\n )\n}\n"]}
|