@brandlab-digital/site-next 3.16.1 → 3.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/ui-kit/repeated-slots.d.ts +3 -3
  2. package/dist/ui-kit/repeated-slots.d.ts.map +1 -1
  3. package/dist/ui-kit/repeated-slots.js +6 -3
  4. package/dist/ui-kit/repeated-slots.js.map +1 -1
  5. package/dist/ui-kit/sections/area-map.d.ts.map +1 -1
  6. package/dist/ui-kit/sections/area-map.js +8 -4
  7. package/dist/ui-kit/sections/area-map.js.map +1 -1
  8. package/dist/ui-kit/sections/contact-block.d.ts +25 -2
  9. package/dist/ui-kit/sections/contact-block.d.ts.map +1 -1
  10. package/dist/ui-kit/sections/contact-block.js +11 -3
  11. package/dist/ui-kit/sections/contact-block.js.map +1 -1
  12. package/dist/ui-kit/sections/local-facts.d.ts +33 -4
  13. package/dist/ui-kit/sections/local-facts.d.ts.map +1 -1
  14. package/dist/ui-kit/sections/local-facts.js +18 -6
  15. package/dist/ui-kit/sections/local-facts.js.map +1 -1
  16. package/dist/ui-kit/sections/nearby-jobs.d.ts +20 -2
  17. package/dist/ui-kit/sections/nearby-jobs.d.ts.map +1 -1
  18. package/dist/ui-kit/sections/nearby-jobs.js +26 -6
  19. package/dist/ui-kit/sections/nearby-jobs.js.map +1 -1
  20. package/dist/ui-kit/sections/proof-strip.d.ts +3 -1
  21. package/dist/ui-kit/sections/proof-strip.d.ts.map +1 -1
  22. package/dist/ui-kit/sections/proof-strip.js +5 -2
  23. package/dist/ui-kit/sections/proof-strip.js.map +1 -1
  24. package/dist/ui-kit/sections/site-footer.d.ts +6 -2
  25. package/dist/ui-kit/sections/site-footer.d.ts.map +1 -1
  26. package/dist/ui-kit/sections/site-footer.js +7 -2
  27. package/dist/ui-kit/sections/site-footer.js.map +1 -1
  28. package/dist/ui-kit/structure.css +139 -0
  29. package/package.json +2 -2
@@ -1,15 +1,17 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { COUNCIL_PERMIT_SKIP_REASON, visibleCouncilRecord } from '@brandlab-digital/site-core/council-register';
3
3
  import { SECTION_READY, SECTION_SLOT_ATTRIBUTE, SECTION_SLOT_SKIP_ATTRIBUTE, formatSectionSlotSkips, } from '@brandlab-digital/site-core/section-order';
4
- import { Anchor } from '../primitives/links.js';
4
+ import { Anchor, ButtonLink } from '../primitives/links.js';
5
+ import { TickList } from '../primitives/lists.js';
6
+ import { Media } from '../primitives/media.js';
5
7
  import { Section, SectionHeading } from '../primitives/layout.js';
6
8
  import { repeatedSlot, slot } from '../skin.js';
7
9
  import { CouncilRecordLines } from './council-rules.js';
8
10
  export const LOCAL_FACTS_VARIANTS = ['intro', 'detailed'];
9
11
  /** The guard for `SectionSequence`: renders when it has at least one true item to show. */
10
- export function localFactsReady({ intro, body, facts, job, permit }) {
12
+ export function localFactsReady({ intro, body, facts, checklist, job, permit, }) {
11
13
  const permitShown = permit ? visibleCouncilRecord(permit.record, permit.asOf) !== undefined : false;
12
- if (intro || body || (facts && facts.length > 0) || job || permitShown)
14
+ if (intro || body || (facts && facts.length > 0) || (checklist && checklist.length > 0) || job || permitShown)
13
15
  return SECTION_READY;
14
16
  return { render: false, reason: 'no-local-facts' };
15
17
  }
@@ -21,12 +23,22 @@ function assertFacts(facts) {
21
23
  ids.add(fact.id);
22
24
  }
23
25
  }
24
- export function LocalFacts({ title, eyebrow, lead, intro, body, facts = [], job, permit, headingId = 'local-facts-heading', tone, variant = 'intro', classes, }) {
25
- if (!localFactsReady({ intro, body, facts, job, permit }).render)
26
+ function pickPhoto(photos, pagePhotos) {
27
+ const shown = new Set(pagePhotos);
28
+ const photo = photos.find((entry) => !shown.has(entry.id) && !shown.has(entry.src));
29
+ if (photo && photo.provenance !== 'genuine') {
30
+ throw new Error(`LocalFacts: "${photo.id}" is ${photo.provenance}; only a genuine photo of the client's work shows here.`);
31
+ }
32
+ return photo;
33
+ }
34
+ export function LocalFacts({ title, eyebrow, lead, intro, body, facts = [], photos = [], pagePhotos, imageSizes = '(min-width: 768px) 45vw, 100vw', checklist = [], action, job, permit, headingId = 'local-facts-heading', tone, variant = 'intro', layout, classes, }) {
35
+ if (!localFactsReady({ intro, body, facts, checklist, job, permit }).render)
26
36
  return null;
27
37
  assertFacts(facts);
38
+ const photo = pickPhoto(photos, pagePhotos);
28
39
  const record = permit ? visibleCouncilRecord(permit.record, permit.asOf) : undefined;
29
40
  const skip = permit && !record ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips([{ slot: 'permit', reason: COUNCIL_PERMIT_SKIP_REASON }]) } : undefined;
30
- return (_jsxs(Section, { id: "local-facts", labelledBy: headingId, tone: tone, variant: variant, classes: classes, phonePlacement: "location", hooks: skip, children: [intro ? _jsx("div", { ...slot(classes, 'intro'), children: intro }) : null, _jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), body ? _jsx("div", { ...slot(classes, 'body'), children: body }) : null, facts.length > 0 ? (_jsx("ul", { role: "list", ...slot(classes, 'facts'), children: facts.map((fact) => (_jsxs("li", { ...repeatedSlot('fact'), "data-item": fact.id, children: [fact.text, fact.source ? (_jsxs(_Fragment, { children: [' ', _jsx(Anchor, { href: fact.source.href, prefetch: false, hooks: repeatedSlot('factSource'), children: fact.source.label })] })) : null] }, fact.id))) })) : null, job ? _jsx("p", { ...slot(classes, 'job'), children: job }) : null, permit && record ? (_jsx("div", { ...slot(classes, 'permit'), [SECTION_SLOT_ATTRIBUTE]: 'permit', "data-council": record.council, children: _jsx(CouncilRecordLines, { record: record, rule: permit.rule, sourceLabel: permit.sourceLabel, councilPage: permit.councilPage, classes: classes }) })) : null] }));
41
+ const hooks = photo ? { ...skip, 'data-media-side': layout?.mediaSide ?? 'end' } : skip;
42
+ return (_jsxs(Section, { id: "local-facts", labelledBy: headingId, tone: tone, variant: variant, classes: classes, phonePlacement: "location", hooks: hooks, children: [photo ? (_jsx("div", { ...slot(classes, 'media'), children: _jsx(Media, { media: photo, sizes: imageSizes, layout: { ratio: layout?.ratio ?? '4:3' } }) })) : null, intro ? _jsx("div", { ...slot(classes, 'intro'), children: intro }) : null, _jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), body ? _jsx("div", { ...slot(classes, 'body'), children: body }) : null, facts.length > 0 ? (_jsx("ul", { role: "list", ...slot(classes, 'facts'), children: facts.map((fact) => (_jsxs("li", { ...repeatedSlot('fact'), "data-item": fact.id, children: [fact.text, fact.source ? (_jsxs(_Fragment, { children: [' ', _jsx(Anchor, { href: fact.source.href, prefetch: false, hooks: repeatedSlot('factSource'), children: fact.source.label })] })) : null] }, fact.id))) })) : null, checklist.length > 0 ? (_jsx("div", { ...slot(classes, 'checklist'), children: _jsx(TickList, { items: checklist }) })) : null, job ? _jsx("p", { ...slot(classes, 'job'), children: job }) : null, permit && record ? (_jsx("div", { ...slot(classes, 'permit'), [SECTION_SLOT_ATTRIBUTE]: 'permit', "data-council": record.council, children: _jsx(CouncilRecordLines, { record: record, rule: permit.rule, sourceLabel: permit.sourceLabel, councilPage: permit.councilPage, classes: classes }) })) : null, action ? (_jsx("div", { ...slot(classes, 'action'), children: _jsx(ButtonLink, { href: action.href, prefetch: false, variant: "secondary", children: action.label }) })) : null] }));
31
43
  }
32
44
  //# sourceMappingURL=local-facts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"local-facts.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/local-facts.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAoC,MAAM,8CAA8C,CAAA;AACjJ,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GAEvB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,cAAc,EA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C,CAAC,CAClB,aAAI,IAAI,EAAC,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YACvC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,iBAAsB,YAAY,CAAC,MAAM,CAAC,eAAa,IAAI,CAAC,EAAE,aAC3D,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CACb,8BACG,GAAG,EACJ,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,YAC/E,IAAI,CAAC,MAAM,CAAC,KAAK,GACX,IACR,CACJ,CAAC,CAAC,CAAC,IAAI,KATD,IAAI,CAAC,EAAE,CAUX,CACN,CAAC,GACC,CACN,CAAC,CAAC,CAAC,IAAI,EACP,GAAG,CAAC,CAAC,CAAC,eAAO,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,YAAG,GAAG,GAAK,CAAC,CAAC,CAAC,IAAI,EACnD,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAClB,iBAAS,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAQ,CAAC,sBAAsB,CAAC,EAAE,QAAQ,kBAAkB,MAAM,CAAC,OAAO,YACxG,KAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,GAAI,GACzI,CACP,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `LocalFacts` (S16, `local-facts`, 3.15.0): what makes a suburb or service-in-suburb page true for this place, the\n * block that keeps location pages from being doorways. Server component.\n *\n * Only true items render, all from the site's data: an optional `intro` first (the page's own local overview, before\n * the heading, 3.15.0), the site's own sentences about real work here (`body`; 2 to 4\n * sentences on standard pages, the head page's owner-confirmed copy on `detailed`), sourced facts, one line about the\n * job here or nearby, and, in permit trades, the permit note from the council register. Locked (Romie, v1 §4.4): no\n * suburb trivia, no council facts beyond the permit note, no kilometre figures or \"based in\" (L10), no copy rotated from\n * a pool (L4). A phone link inside reports the `location` placement.\n *\n * The permit note is the `permit` slot (K12-slots): its line carries `data-bl-slot=\"permit\"`. When the page passes a\n * `permit` but the register has no current record for the council (none, more than six months since it was checked,\n * or past its fees' financial year), the line renders nothing and the section lists\n * `data-bl-slot-skip=\"permit:no-current-council-record\"`, which K12-slots reports as a warning until the record is\n * checked again. A page in a trade without a permit note passes no `permit`.\n */\nimport type { ReactNode } from 'react'\nimport { COUNCIL_PERMIT_SKIP_REASON, visibleCouncilRecord, type BrandlabCouncilPermitRecord } from '@brandlab-digital/site-core/council-register'\nimport {\n SECTION_READY,\n SECTION_SLOT_ATTRIBUTE,\n SECTION_SLOT_SKIP_ATTRIBUTE,\n formatSectionSlotSkips,\n type BrandlabSectionReadiness,\n} from '@brandlab-digital/site-core/section-order'\nimport { Anchor } from '../primitives/links.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'\nimport type { UiLink } from '../types.js'\nimport { CouncilRecordLines, type CouncilRecordSlot, type CouncilRuleWording } from './council-rules.js'\n\nexport const LOCAL_FACTS_VARIANTS = ['intro', 'detailed'] as const\nexport type LocalFactsVariant = (typeof LOCAL_FACTS_VARIANTS)[number]\nexport type LocalFactsSlot = SectionSlot | SectionHeadingSlot | 'intro' | 'body' | 'facts' | 'fact' | 'factSource' | 'job' | 'permit' | CouncilRecordSlot | 'fee'\n/** Rendered once per fact or fee: styled from the skin stylesheet, never by class. */\nexport type LocalFactsRepeatedSlot = RepeatedSlotOf<'localFacts'>\nexport type LocalFactsSkin = SkinEntry<LocalFactsSlot, LocalFactsVariant, Record<never, never>, LocalFactsRepeatedSlot>\n\n/** One sourced fact that changes the job here (a job or owner source; never a templated terrain line). */\nexport interface LocalFact {\n /** A stable id, rendered as `data-item`. */\n readonly id: string\n readonly text: ReactNode\n /** Where the fact can be checked. */\n readonly source?: UiLink\n}\n\n/** The permit note's data: the council's register record and how this site words it. */\nexport interface LocalFactsPermit {\n /** The register record for the suburb's council; `undefined` when the register has none. */\n readonly record: BrandlabCouncilPermitRecord | undefined\n /** The site's own wording of the rule in one or two lines. Defaults to the record's rule. */\n readonly rule?: CouncilRuleWording\n /** The source link's text. Defaults to the council's name. */\n readonly sourceLabel?: string\n /** The site's own council page, for example its \"Tree removal and Hornsby Council\" guide. */\n readonly councilPage?: UiLink\n /** The day the page is built or refreshed (Sydney). Defaults to now. */\n readonly asOf?: Date\n}\n\nexport interface LocalFactsProps extends LocalFactsSkin {\n /** The H2, for example \"Tree work in Castle Hill\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n /**\n * The page's own introduction to the place (3.15.0), for example a suburb page's local overview paragraph. Site copy,\n * rendered first inside the section, before its heading, so the suburb page's intro lives in the `local-facts` place.\n */\n readonly intro?: ReactNode\n /** The site's own copy about real work here: sentences on `intro`, the head page's copy (with H3s) on `detailed`. */\n readonly body?: ReactNode\n readonly facts?: readonly LocalFact[]\n /** One line about the job here, or the nearest one labelled as nearby. */\n readonly job?: ReactNode\n /** Permit trades only. */\n readonly permit?: LocalFactsPermit\n /** Defaults to `local-facts-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The guard for `SectionSequence`: renders when it has at least one true item to show. */\nexport function localFactsReady({ intro, body, facts, job, permit }: Pick<LocalFactsProps, 'intro' | 'body' | 'facts' | 'job' | 'permit'>): BrandlabSectionReadiness {\n const permitShown = permit ? visibleCouncilRecord(permit.record, permit.asOf) !== undefined : false\n if (intro || body || (facts && facts.length > 0) || job || permitShown) return SECTION_READY\n return { render: false, reason: 'no-local-facts' }\n}\n\nfunction assertFacts(facts: readonly LocalFact[]) {\n const ids = new Set<string>()\n for (const fact of facts) {\n if (!fact.id || ids.has(fact.id)) throw new Error(`LocalFacts: every fact needs its own id (\"${fact.id}\" is empty or repeated).`)\n ids.add(fact.id)\n }\n}\n\nexport function LocalFacts({\n title,\n eyebrow,\n lead,\n intro,\n body,\n facts = [],\n job,\n permit,\n headingId = 'local-facts-heading',\n tone,\n variant = 'intro',\n classes,\n}: LocalFactsProps) {\n if (!localFactsReady({ intro, body, facts, job, permit }).render) return null\n assertFacts(facts)\n const record = permit ? visibleCouncilRecord(permit.record, permit.asOf) : undefined\n const skip = permit && !record ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips([{ slot: 'permit', reason: COUNCIL_PERMIT_SKIP_REASON }]) } : undefined\n return (\n <Section id=\"local-facts\" labelledBy={headingId} tone={tone} variant={variant} classes={classes} phonePlacement=\"location\" hooks={skip}>\n {intro ? <div {...slot(classes, 'intro')}>{intro}</div> : null}\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n {body ? <div {...slot(classes, 'body')}>{body}</div> : null}\n {facts.length > 0 ? (\n <ul role=\"list\" {...slot(classes, 'facts')}>\n {facts.map((fact) => (\n <li key={fact.id} {...repeatedSlot('fact')} data-item={fact.id}>\n {fact.text}\n {fact.source ? (\n <>\n {' '}\n <Anchor href={fact.source.href} prefetch={false} hooks={repeatedSlot('factSource')}>\n {fact.source.label}\n </Anchor>\n </>\n ) : null}\n </li>\n ))}\n </ul>\n ) : null}\n {job ? <p {...slot(classes, 'job')}>{job}</p> : null}\n {permit && record ? (\n <div {...slot(classes, 'permit')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'permit' }} data-council={record.council}>\n <CouncilRecordLines record={record} rule={permit.rule} sourceLabel={permit.sourceLabel} councilPage={permit.councilPage} classes={classes} />\n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AAO,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,YAAG,GAAG,GAAK,CAAC,CAAC,CAAC,IAAI,EACnD,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAClB,iBAAS,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAQ,CAAC,sBAAsB,CAAC,EAAE,QAAQ,kBAAkB,MAAM,CAAC,OAAO,YACxG,KAAC,kBAAkB,IAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,GAAI,GACzI,CACP,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,CAAC,CAAC,CAAC,CACR,iBAAS,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,YAC9B,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAC,WAAW,YAChE,MAAM,CAAC,KAAK,GACF,GACT,CACP,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `LocalFacts` (S16, `local-facts`, 3.15.0): what makes a suburb or service-in-suburb page true for this place, the\n * block that keeps location pages from being doorways. Server component.\n *\n * Only true items render, all from the site's data: an optional `intro` first (the page's own local overview, before\n * the heading, 3.15.0), the site's own sentences about real work here (`body`; 2 to 4\n * sentences on standard pages, the head page's owner-confirmed copy on `detailed`), sourced facts, one line about the\n * job here or nearby, and, in permit trades, the permit note from the council register. Locked (Romie, v1 §4.4): no\n * suburb trivia, no council facts beyond the permit note, no kilometre figures or \"based in\" (L10), no copy rotated from\n * a pool (L4). A phone link inside reports the `location` placement.\n *\n * The permit note is the `permit` slot (K12-slots): its line carries `data-bl-slot=\"permit\"`. When the page passes a\n * `permit` but the register has no current record for the council (none, more than six months since it was checked,\n * or past its fees' financial year), the line renders nothing and the section lists\n * `data-bl-slot-skip=\"permit:no-current-council-record\"`, which K12-slots reports as a warning until the record is\n * checked again. A page in a trade without a permit note passes no `permit`.\n *\n * 3.17.0: an optional photo, checklist and action. `photos` are the candidate photos in order (for example\n * `jobPhotos(job, media)` for the suburb's best job); the first one the page doesn't already show (`pagePhotos`, the\n * same no-repeat rule as `NearbyJobs`) renders, and only a genuine photo of the client's work. It comes first on phones\n * and sits beside the copy from 768 px. `checklist` is a `TickList` of the site's own points; `action` one button link,\n * for example the council guidance page.\n */\nimport type { ReactNode } from 'react'\nimport type { BrandlabMediaEntry } from '@brandlab-digital/site-core/media'\nimport { COUNCIL_PERMIT_SKIP_REASON, visibleCouncilRecord, type BrandlabCouncilPermitRecord } from '@brandlab-digital/site-core/council-register'\nimport {\n SECTION_READY,\n SECTION_SLOT_ATTRIBUTE,\n SECTION_SLOT_SKIP_ATTRIBUTE,\n formatSectionSlotSkips,\n type BrandlabSectionReadiness,\n} from '@brandlab-digital/site-core/section-order'\nimport { Anchor, ButtonLink } from '../primitives/links.js'\nimport { TickList, type TickItem } from '../primitives/lists.js'\nimport { Media, type MediaLayout } from '../primitives/media.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'\nimport type { UiLink } from '../types.js'\nimport { CouncilRecordLines, type CouncilRecordSlot, type CouncilRuleWording } from './council-rules.js'\n\nexport const LOCAL_FACTS_VARIANTS = ['intro', 'detailed'] as const\nexport type LocalFactsVariant = (typeof LOCAL_FACTS_VARIANTS)[number]\nexport type LocalFactsSlot =\n | SectionSlot\n | SectionHeadingSlot\n | 'media'\n | 'intro'\n | 'body'\n | 'facts'\n | 'fact'\n | 'factSource'\n | 'checklist'\n | 'action'\n | 'job'\n | 'permit'\n | CouncilRecordSlot\n | 'fee'\n/** Rendered once per fact or fee: styled from the skin stylesheet, never by class. */\nexport type LocalFactsRepeatedSlot = RepeatedSlotOf<'localFacts'>\nexport interface LocalFactsLayout {\n /** The photo's crop. Defaults to 4:3. */\n readonly ratio?: NonNullable<MediaLayout['ratio']>\n /** The photo's side from 768 px. Defaults to `end`; it always comes first on phones. */\n readonly mediaSide?: 'start' | 'end'\n}\nexport type LocalFactsSkin = SkinEntry<LocalFactsSlot, LocalFactsVariant, LocalFactsLayout, LocalFactsRepeatedSlot>\n\n/** A candidate photo: a media-manifest entry with its id, as `jobPhotos()` returns them. */\nexport type LocalFactsPhoto = BrandlabMediaEntry & { readonly id: string }\n\n/** One sourced fact that changes the job here (a job or owner source; never a templated terrain line). */\nexport interface LocalFact {\n /** A stable id, rendered as `data-item`. */\n readonly id: string\n readonly text: ReactNode\n /** Where the fact can be checked. */\n readonly source?: UiLink\n}\n\n/** The permit note's data: the council's register record and how this site words it. */\nexport interface LocalFactsPermit {\n /** The register record for the suburb's council; `undefined` when the register has none. */\n readonly record: BrandlabCouncilPermitRecord | undefined\n /** The site's own wording of the rule in one or two lines. Defaults to the record's rule. */\n readonly rule?: CouncilRuleWording\n /** The source link's text. Defaults to the council's name. */\n readonly sourceLabel?: string\n /** The site's own council page, for example its \"Tree removal and Hornsby Council\" guide. */\n readonly councilPage?: UiLink\n /** The day the page is built or refreshed (Sydney). Defaults to now. */\n readonly asOf?: Date\n}\n\nexport interface LocalFactsProps extends LocalFactsSkin {\n /** The H2, for example \"Tree work in Castle Hill\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n /**\n * The page's own introduction to the place (3.15.0), for example a suburb page's local overview paragraph. Site copy,\n * rendered first inside the section, before its heading, so the suburb page's intro lives in the `local-facts` place.\n */\n readonly intro?: ReactNode\n /** The site's own copy about real work here: sentences on `intro`, the head page's copy (with H3s) on `detailed`. */\n readonly body?: ReactNode\n readonly facts?: readonly LocalFact[]\n /** Candidate photos in order (3.17.0); the first the page doesn't already show renders. Genuine photos only. */\n readonly photos?: readonly LocalFactsPhoto[]\n /** Photos the page already shows, such as the hero's: media ids or `src` paths. The section never repeats one. */\n readonly pagePhotos?: readonly string[]\n /** The photo `sizes`. Defaults to half the width from 768 px. */\n readonly imageSizes?: string\n /** The site's own points, as a tick list (3.17.0). */\n readonly checklist?: readonly TickItem[]\n /** One button link after the copy (3.17.0), for example the site's council guidance page. */\n readonly action?: UiLink\n /** One line about the job here, or the nearest one labelled as nearby. */\n readonly job?: ReactNode\n /** Permit trades only. */\n readonly permit?: LocalFactsPermit\n /** Defaults to `local-facts-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The guard for `SectionSequence`: renders when it has at least one true item to show. */\nexport function localFactsReady({\n intro,\n body,\n facts,\n checklist,\n job,\n permit,\n}: Pick<LocalFactsProps, 'intro' | 'body' | 'facts' | 'checklist' | 'job' | 'permit'>): BrandlabSectionReadiness {\n const permitShown = permit ? visibleCouncilRecord(permit.record, permit.asOf) !== undefined : false\n if (intro || body || (facts && facts.length > 0) || (checklist && checklist.length > 0) || job || permitShown) return SECTION_READY\n return { render: false, reason: 'no-local-facts' }\n}\n\nfunction assertFacts(facts: readonly LocalFact[]) {\n const ids = new Set<string>()\n for (const fact of facts) {\n if (!fact.id || ids.has(fact.id)) throw new Error(`LocalFacts: every fact needs its own id (\"${fact.id}\" is empty or repeated).`)\n ids.add(fact.id)\n }\n}\n\nfunction pickPhoto(photos: readonly LocalFactsPhoto[], pagePhotos: readonly string[] | undefined) {\n const shown = new Set(pagePhotos)\n const photo = photos.find((entry) => !shown.has(entry.id) && !shown.has(entry.src))\n if (photo && photo.provenance !== 'genuine') {\n throw new Error(`LocalFacts: \"${photo.id}\" is ${photo.provenance}; only a genuine photo of the client's work shows here.`)\n }\n return photo\n}\n\nexport function LocalFacts({\n title,\n eyebrow,\n lead,\n intro,\n body,\n facts = [],\n photos = [],\n pagePhotos,\n imageSizes = '(min-width: 768px) 45vw, 100vw',\n checklist = [],\n action,\n job,\n permit,\n headingId = 'local-facts-heading',\n tone,\n variant = 'intro',\n layout,\n classes,\n}: LocalFactsProps) {\n if (!localFactsReady({ intro, body, facts, checklist, job, permit }).render) return null\n assertFacts(facts)\n const photo = pickPhoto(photos, pagePhotos)\n const record = permit ? visibleCouncilRecord(permit.record, permit.asOf) : undefined\n const skip = permit && !record ? { [SECTION_SLOT_SKIP_ATTRIBUTE]: formatSectionSlotSkips([{ slot: 'permit', reason: COUNCIL_PERMIT_SKIP_REASON }]) } : undefined\n const hooks = photo ? { ...skip, 'data-media-side': layout?.mediaSide ?? 'end' } : skip\n return (\n <Section id=\"local-facts\" labelledBy={headingId} tone={tone} variant={variant} classes={classes} phonePlacement=\"location\" hooks={hooks}>\n {photo ? (\n <div {...slot(classes, 'media')}>\n <Media media={photo} sizes={imageSizes} layout={{ ratio: layout?.ratio ?? '4:3' }} />\n </div>\n ) : null}\n {intro ? <div {...slot(classes, 'intro')}>{intro}</div> : null}\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n {body ? <div {...slot(classes, 'body')}>{body}</div> : null}\n {facts.length > 0 ? (\n <ul role=\"list\" {...slot(classes, 'facts')}>\n {facts.map((fact) => (\n <li key={fact.id} {...repeatedSlot('fact')} data-item={fact.id}>\n {fact.text}\n {fact.source ? (\n <>\n {' '}\n <Anchor href={fact.source.href} prefetch={false} hooks={repeatedSlot('factSource')}>\n {fact.source.label}\n </Anchor>\n </>\n ) : null}\n </li>\n ))}\n </ul>\n ) : null}\n {checklist.length > 0 ? (\n <div {...slot(classes, 'checklist')}>\n <TickList items={checklist} />\n </div>\n ) : null}\n {job ? <p {...slot(classes, 'job')}>{job}</p> : null}\n {permit && record ? (\n <div {...slot(classes, 'permit')} {...{ [SECTION_SLOT_ATTRIBUTE]: 'permit' }} data-council={record.council}>\n <CouncilRecordLines record={record} rule={permit.rule} sourceLabel={permit.sourceLabel} councilPage={permit.councilPage} classes={classes} />\n </div>\n ) : null}\n {action ? (\n <div {...slot(classes, 'action')}>\n <ButtonLink href={action.href} prefetch={false} variant=\"secondary\">\n {action.label}\n </ButtonLink>\n </div>\n ) : null}\n </Section>\n )\n}\n"]}
@@ -11,6 +11,13 @@
11
11
  * Card photos are always lazy. `pagePhotos` names the photos the page already shows (the hero's): a card then takes the
12
12
  * job's next genuine photo, or none, so the hero's priority photo is never repeated below as a lazy copy (3.15.0; on
13
13
  * AA's suburb pages the repeat made Next report the hero, the LCP image, as lazy and downloaded it twice).
14
+ *
15
+ * 3.17.0: two cards never share a heading. Where a card's label repeats an earlier one ("Tree removal in Eastwood"
16
+ * twice) it takes the job's own `title`, and a job without one fails the build; `layout.cardTitle: 'job'` uses the
17
+ * title on every card that has one. A title from another suburb reads "Nearby: {title}" (L4, 3.17.1). `linkCue` ("View job") shows on a linked card, and the whole card then follows
18
+ * the heading's link (the cue is `aria-hidden`, so the link's name stays the heading). `layout.arrangement: 'feature'`
19
+ * sets one tall card beside two stacked from 1024 px. `footer` (a count line) and `link` ("See all our projects")
20
+ * follow the list.
14
21
  */
15
22
  import type { ReactNode } from 'react';
16
23
  import { type BrandlabJob, type BrandlabNearbyJob } from '@brandlab-digital/site-core/jobs';
@@ -20,9 +27,10 @@ import { type MediaLayout } from '../primitives/media.js';
20
27
  import { type SectionHeadingSlot, type SectionSlot, type SectionTone } from '../primitives/layout.js';
21
28
  import type { RepeatedSlotOf } from '../repeated-slots.js';
22
29
  import { type SkinEntry } from '../skin.js';
30
+ import type { UiLink } from '../types.js';
23
31
  export declare const NEARBY_JOBS_VARIANTS: readonly ["grid", "rail"];
24
32
  export type NearbyJobsVariant = (typeof NEARBY_JOBS_VARIANTS)[number];
25
- export type NearbyJobsSlot = SectionSlot | SectionHeadingSlot | 'list' | RepeatedSlotOf<'nearbyJobs'>;
33
+ export type NearbyJobsSlot = SectionSlot | SectionHeadingSlot | 'list' | 'footer' | 'more' | RepeatedSlotOf<'nearbyJobs'>;
26
34
  /** Rendered once per job: styled from the skin stylesheet, never by class. */
27
35
  export type NearbyJobsRepeatedSlot = RepeatedSlotOf<'nearbyJobs'>;
28
36
  export interface NearbyJobsLayout {
@@ -30,6 +38,10 @@ export interface NearbyJobsLayout {
30
38
  readonly columns?: 2 | 3;
31
39
  /** The photo's crop. Defaults to 4:3. */
32
40
  readonly ratio?: NonNullable<MediaLayout['ratio']>;
41
+ /** `grid`: `even` (the default) or `feature`, one tall card beside two stacked from 1024 px (3.17.0). */
42
+ readonly arrangement?: 'even' | 'feature';
43
+ /** `label` (the default): the `jobCardLabel` heading; `job`: the job's own `title` where it has one (3.17.0). */
44
+ readonly cardTitle?: 'label' | 'job';
33
45
  }
34
46
  export type NearbyJobsSkin = SkinEntry<NearbyJobsSlot, NearbyJobsVariant, NearbyJobsLayout, NearbyJobsRepeatedSlot>;
35
47
  export interface NearbyJobsProps extends NearbyJobsSkin {
@@ -53,6 +65,12 @@ export interface NearbyJobsProps extends NearbyJobsSkin {
53
65
  readonly pagePhotos?: readonly string[];
54
66
  /** The job's project page, when the site has one. */
55
67
  readonly jobHref?: (job: BrandlabJob) => string | undefined;
68
+ /** A visible cue on a linked card (3.17.0), for example "View job". Decorative: the link's name is the heading. */
69
+ readonly linkCue?: ReactNode;
70
+ /** A line after the list (3.17.0), for example "42 jobs logged across the Hills District". */
71
+ readonly footer?: ReactNode;
72
+ /** A link after the list (3.17.0), for example `{ label: 'See all our projects', href: '/projects' }`. */
73
+ readonly link?: UiLink;
56
74
  /** The photo `sizes`. Defaults to one column of the grid. */
57
75
  readonly imageSizes?: string;
58
76
  /** Defaults to `nearby-jobs-heading`. */
@@ -62,5 +80,5 @@ export interface NearbyJobsProps extends NearbyJobsSkin {
62
80
  }
63
81
  /** The guard for `SectionSequence`: no card means no section (D2). */
64
82
  export declare function nearbyJobsReady({ jobs }: Pick<NearbyJobsProps, 'jobs'>): BrandlabSectionReadiness;
65
- export declare function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName, suburbName, labelPrefix, media, pagePhotos, jobHref, imageSizes, headingId, tone, variant, layout, classes, }: NearbyJobsProps): import("react/jsx-runtime").JSX.Element | null;
83
+ export declare function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName, suburbName, labelPrefix, media, pagePhotos, jobHref, linkCue, footer, link, imageSizes, headingId, tone, variant, layout, classes, }: NearbyJobsProps): import("react/jsx-runtime").JSX.Element | null;
66
84
  //# sourceMappingURL=nearby-jobs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-jobs.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAA2C,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpI,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAA;AAGxG,OAAO,EAAS,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAChE,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;AAE/D,eAAO,MAAM,oBAAoB,2BAA4B,CAAA;AAC7D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AACrE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,kBAAkB,GAAG,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;AACrG,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;AACjE,MAAM,WA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'@brandlab-digital/site-core/jobs';
3
3
  import { SECTION_READY } from '@brandlab-digital/site-core/section-order';
4
4
  import { LINK_PREFETCH_POLICY } from '../prefetch.js';
5
- import { Anchor } from '../primitives/links.js';
5
+ import { Anchor, TextLink } from '../primitives/links.js';
6
6
  import { Media } from '../primitives/media.js';
7
7
  import { Section, SectionHeading } from '../primitives/layout.js';
8
8
  import { repeatedSlot, slot } from '../skin.js';
@@ -24,7 +24,7 @@ function photoOf(job, media, shown) {
24
24
  throw new Error(`NearbyJobs: "${photo.id}" is a photo of ${photo.job}, not ${job.id}.`);
25
25
  return photo;
26
26
  }
27
- export function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName, suburbName, labelPrefix, media, pagePhotos, jobHref, imageSizes, headingId = 'nearby-jobs-heading', tone, variant = 'grid', layout, classes, }) {
27
+ export function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName, suburbName, labelPrefix, media, pagePhotos, jobHref, linkCue, footer, link, imageSizes, headingId = 'nearby-jobs-heading', tone, variant = 'grid', layout, classes, }) {
28
28
  if (jobs.length === 0)
29
29
  return null;
30
30
  if (jobs.length > JOB_CARD_LIMIT)
@@ -38,12 +38,32 @@ export function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName
38
38
  const shown = new Set(pagePhotos);
39
39
  const columns = layout?.columns ?? 3;
40
40
  const ratio = layout?.ratio ?? '4:3';
41
+ const feature = variant === 'grid' && layout?.arrangement === 'feature' && jobs.length === 3;
41
42
  const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`;
42
- return (_jsxs(Section, { id: "nearby-jobs", labelledBy: headingId, tone: tone, variant: variant, classes: classes, hooks: { 'data-columns': String(columns), 'data-ratio': ratio }, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsx("ul", { role: "list", ...slot(classes, 'list'), children: jobs.map(({ job }) => {
43
- const label = jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) });
43
+ const headings = cardHeadings(jobs, layout?.cardTitle ?? 'label', (job) => jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }), pageSuburb);
44
+ return (_jsxs(Section, { id: "nearby-jobs", labelledBy: headingId, tone: tone, variant: variant, classes: classes, hooks: { 'data-columns': String(columns), 'data-ratio': ratio, 'data-arrangement': feature ? 'feature' : undefined }, children: [_jsx(SectionHeading, { id: headingId, title: title, eyebrow: eyebrow, lead: lead, classes: classes }), _jsx("ul", { role: "list", ...slot(classes, 'list'), children: jobs.map(({ job }, index) => {
45
+ const label = headings[index];
44
46
  const href = jobHref?.(job);
45
47
  const photo = photoOf(job, media, shown);
46
- return (_jsxs("li", { ...repeatedSlot('item'), "data-item": job.id, "data-suburb": job.suburb, children: [_jsxs("div", { ...repeatedSlot('body'), children: [_jsx("h3", { ...repeatedSlot('title'), children: href ? (_jsx(Anchor, { href: href, prefetch: LINK_PREFETCH_POLICY.contentCard, hooks: repeatedSlot('link'), children: label })) : (label) }), _jsx("p", { ...repeatedSlot('outcome'), children: job.outcome })] }), photo ? (_jsx("div", { ...repeatedSlot('media'), children: _jsx(Media, { media: photo, sizes: sizes, layout: { ratio } }) })) : null] }, job.id));
47
- }) })] }));
48
+ return (_jsxs("li", { ...repeatedSlot('item'), "data-item": job.id, "data-suburb": job.suburb, "data-linked": href ? '' : undefined, children: [_jsxs("div", { ...repeatedSlot('body'), children: [_jsx("h3", { ...repeatedSlot('title'), children: href ? (_jsx(Anchor, { href: href, prefetch: LINK_PREFETCH_POLICY.contentCard, hooks: repeatedSlot('link'), children: label })) : (label) }), _jsx("p", { ...repeatedSlot('outcome'), children: job.outcome }), href && linkCue ? (_jsx("span", { ...repeatedSlot('cue'), "aria-hidden": "true", children: linkCue })) : null] }), photo ? (_jsx("div", { ...repeatedSlot('media'), children: _jsx(Media, { media: photo, sizes: sizes, layout: { ratio } }) })) : null] }, job.id));
49
+ }) }), footer ? _jsx("p", { ...slot(classes, 'footer'), children: footer }) : null, link ? (_jsx("p", { ...slot(classes, 'more'), children: _jsx(TextLink, { href: link.href, prefetch: LINK_PREFETCH_POLICY.contentCard, children: link.label }) })) : null] }));
50
+ }
51
+ /** Each card's heading: its label, or the job's title where the label repeats an earlier card's or `cardTitle` is `job`. */
52
+ function cardHeadings(jobs, cardTitle, labelOf, pageSuburb) {
53
+ const used = new Set();
54
+ // A job from another suburb keeps the "nearby" label when its own title stands in (L4, 3.17.1).
55
+ const titleOf = (job) => (job.title && job.suburb !== pageSuburb ? `Nearby: ${job.title}` : job.title);
56
+ return jobs.map(({ job }) => {
57
+ const title = titleOf(job);
58
+ let heading = cardTitle === 'job' && title ? title : labelOf(job);
59
+ if (used.has(heading)) {
60
+ if (!title || used.has(title)) {
61
+ throw new Error(`NearbyJobs: two cards would both read "${heading}"; give job "${job.id}" its own title in the job log.`);
62
+ }
63
+ heading = title;
64
+ }
65
+ used.add(heading);
66
+ return heading;
67
+ });
48
68
  }
49
69
  //# sourceMappingURL=nearby-jobs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-jobs.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAA4C,MAAM,kCAAkC,CAAA;AAEpI,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAoB,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,cAAc,EAA+D,MAAM,yBAAyB,CAAA;AAE9H,OAAO,EAAE,YAAY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,YAC5B,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAI,GACpD,CACP,CAAC,CAAC,CAAC,IAAI,KAjBD,GAAG,CAAC,EAAE,CAkBV,CACN,CAAA;gBACH,CAAC,CAAC,GACC,IACG,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `NearbyJobs` (S17, `nearby-jobs`, 3.15.0): proof of real work near this place. Server component.\n *\n * The cards come from the job log (site-core `./jobs`): `nearbyJobs(origin, jobs, { centreOf, service })` ranks the\n * page suburb's own jobs first, then others by real distance within 10 km, at most three. Each card's heading is\n * `jobCardLabel`: \"Tree removal in Castle Hill\" for the page's own suburb, \"Tree removal nearby: Ryde\" for any other\n * (L4); only a job whose month is known says \"Recent\" (or `labelPrefix`) and ends \", {Month Year}\". Distances rank the cards and are never\n * printed (L10). A card shows the job's first photo through `Media`, and only a genuine photo of that job: a stock or AI\n * image never stands for the client's work. With no job close enough the section renders nothing and its guard says\n * so (`no-jobs-nearby`, D2). A card links to the job's project page when the site has one (prefetch on intent).\n * Card photos are always lazy. `pagePhotos` names the photos the page already shows (the hero's): a card then takes the\n * job's next genuine photo, or none, so the hero's priority photo is never repeated below as a lazy copy (3.15.0; on\n * AA's suburb pages the repeat made Next report the hero, the LCP image, as lazy and downloaded it twice).\n */\nimport type { ReactNode } from 'react'\nimport { JOB_CARD_LIMIT, jobCardLabel, jobPhotos, type BrandlabJob, type BrandlabNearbyJob } from '@brandlab-digital/site-core/jobs'\nimport type { BrandlabMediaManifest } from '@brandlab-digital/site-core/media'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { LINK_PREFETCH_POLICY } from '../prefetch.js'\nimport { Anchor } from '../primitives/links.js'\nimport { Media, type MediaLayout } from '../primitives/media.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 NEARBY_JOBS_VARIANTS = ['grid', 'rail'] as const\nexport type NearbyJobsVariant = (typeof NEARBY_JOBS_VARIANTS)[number]\nexport type NearbyJobsSlot = SectionSlot | SectionHeadingSlot | 'list' | RepeatedSlotOf<'nearbyJobs'>\n/** Rendered once per job: styled from the skin stylesheet, never by class. */\nexport type NearbyJobsRepeatedSlot = RepeatedSlotOf<'nearbyJobs'>\nexport interface NearbyJobsLayout {\n /** `grid`: columns on wide screens. Defaults to 3. */\n readonly columns?: 2 | 3\n /** The photo's crop. Defaults to 4:3. */\n readonly ratio?: NonNullable<MediaLayout['ratio']>\n}\nexport type NearbyJobsSkin = SkinEntry<NearbyJobsSlot, NearbyJobsVariant, NearbyJobsLayout, NearbyJobsRepeatedSlot>\n\nexport interface NearbyJobsProps extends NearbyJobsSkin {\n /** The H2, for example \"Recent tree work near Castle Hill\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n /** The ranked cards from `nearbyJobs()`, nearest first; at most three. */\n readonly jobs: readonly BrandlabNearbyJob[]\n /** The page's suburb slug: its own jobs read \"in {Suburb}\", every other \"nearby: {Suburb}\". */\n readonly pageSuburb: string\n /** The service's name from the site's catalogue, for example `(slug) => services[slug].name`. */\n readonly serviceName: (service: string) => string\n /** The suburb's name from the registry. */\n readonly suburbName: (suburb: string) => string\n /** Replaces \"Recent\" on a dated card (\"Completed tree removal …\"); `''` for none. An undated card never has one. */\n readonly labelPrefix?: string\n /** The media manifest, for the jobs' photos. Left out, the cards show no photo. */\n readonly media?: BrandlabMediaManifest\n /** Photos the page already shows, such as the hero's: media ids or `src` paths. A card never repeats one. */\n readonly pagePhotos?: readonly string[]\n /** The job's project page, when the site has one. */\n readonly jobHref?: (job: BrandlabJob) => string | undefined\n /** The photo `sizes`. Defaults to one column of the grid. */\n readonly imageSizes?: string\n /** Defaults to `nearby-jobs-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The guard for `SectionSequence`: no card means no section (D2). */\nexport function nearbyJobsReady({ jobs }: Pick<NearbyJobsProps, 'jobs'>): BrandlabSectionReadiness {\n return jobs.length > 0 ? SECTION_READY : { render: false, reason: 'no-jobs-nearby' }\n}\n\nfunction photoOf(job: BrandlabJob, media: BrandlabMediaManifest | undefined, shown: ReadonlySet<string>) {\n if (!media) return undefined\n const photo = jobPhotos(job, media).find((entry) => !shown.has(entry.id) && !shown.has(entry.src))\n if (!photo) return undefined\n if (photo.provenance !== 'genuine') {\n throw new Error(`NearbyJobs: \"${photo.id}\" is ${photo.provenance}; only a genuine photo of the job shows on its card.`)\n }\n if (photo.job !== undefined && photo.job !== job.id) throw new Error(`NearbyJobs: \"${photo.id}\" is a photo of ${photo.job}, not ${job.id}.`)\n return photo\n}\n\nexport function NearbyJobs({\n title,\n eyebrow,\n lead,\n jobs,\n pageSuburb,\n serviceName,\n suburbName,\n labelPrefix,\n media,\n pagePhotos,\n jobHref,\n imageSizes,\n headingId = 'nearby-jobs-heading',\n tone,\n variant = 'grid',\n layout,\n classes,\n}: NearbyJobsProps) {\n if (jobs.length === 0) return null\n if (jobs.length > JOB_CARD_LIMIT) throw new Error(`NearbyJobs: ${jobs.length} jobs; a page shows at most ${JOB_CARD_LIMIT} job cards.`)\n const ids = new Set<string>()\n for (const { job } of jobs) {\n if (ids.has(job.id)) throw new Error(`NearbyJobs: \"${job.id}\" is listed twice.`)\n ids.add(job.id)\n }\n const shown = new Set(pagePhotos)\n const columns = layout?.columns ?? 3\n const ratio = layout?.ratio ?? '4:3'\n const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`\n return (\n <Section id=\"nearby-jobs\" labelledBy={headingId} tone={tone} variant={variant} classes={classes} hooks={{ 'data-columns': String(columns), 'data-ratio': ratio }}>\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <ul role=\"list\" {...slot(classes, 'list')}>\n {jobs.map(({ job }) => {\n const label = jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) })\n const href = jobHref?.(job)\n const photo = photoOf(job, media, shown)\n return (\n <li key={job.id} {...repeatedSlot('item')} data-item={job.id} data-suburb={job.suburb}>\n <div {...repeatedSlot('body')}>\n <h3 {...repeatedSlot('title')}>\n {href ? (\n <Anchor href={href} prefetch={LINK_PREFETCH_POLICY.contentCard} hooks={repeatedSlot('link')}>\n {label}\n </Anchor>\n ) : (\n label\n )}\n </h3>\n <p {...repeatedSlot('outcome')}>{job.outcome}</p>\n </div>\n {photo ? (\n <div {...repeatedSlot('media')}>\n <Media media={photo} sizes={sizes} layout={{ ratio }} />\n </div>\n ) : null}\n </li>\n )\n })}\n </ul>\n </Section>\n )\n}\n"]}
1
+ {"version":3,"file":"nearby-jobs.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAA4C,MAAM,kCAAkC,CAAA;AAEpI,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAoB,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,cAAc,EAA+D,MAAM,yBAAyB,CAAA;AAE9H,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAG/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAA;AAoD7D,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAAC,E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E,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACnH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC1B,IAAI,OAAO,GAAG,SAAS,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjE,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,gBAAgB,GAAG,CAAC,EAAE,iCAAiC,CAAC,CAAA;YAC3H,CAAC;YACD,OAAO,GAAG,KAAK,CAAA;QACjB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACjB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * `NearbyJobs` (S17, `nearby-jobs`, 3.15.0): proof of real work near this place. Server component.\n *\n * The cards come from the job log (site-core `./jobs`): `nearbyJobs(origin, jobs, { centreOf, service })` ranks the\n * page suburb's own jobs first, then others by real distance within 10 km, at most three. Each card's heading is\n * `jobCardLabel`: \"Tree removal in Castle Hill\" for the page's own suburb, \"Tree removal nearby: Ryde\" for any other\n * (L4); only a job whose month is known says \"Recent\" (or `labelPrefix`) and ends \", {Month Year}\". Distances rank the cards and are never\n * printed (L10). A card shows the job's first photo through `Media`, and only a genuine photo of that job: a stock or AI\n * image never stands for the client's work. With no job close enough the section renders nothing and its guard says\n * so (`no-jobs-nearby`, D2). A card links to the job's project page when the site has one (prefetch on intent).\n * Card photos are always lazy. `pagePhotos` names the photos the page already shows (the hero's): a card then takes the\n * job's next genuine photo, or none, so the hero's priority photo is never repeated below as a lazy copy (3.15.0; on\n * AA's suburb pages the repeat made Next report the hero, the LCP image, as lazy and downloaded it twice).\n *\n * 3.17.0: two cards never share a heading. Where a card's label repeats an earlier one (\"Tree removal in Eastwood\"\n * twice) it takes the job's own `title`, and a job without one fails the build; `layout.cardTitle: 'job'` uses the\n * title on every card that has one. A title from another suburb reads \"Nearby: {title}\" (L4, 3.17.1). `linkCue` (\"View job\") shows on a linked card, and the whole card then follows\n * the heading's link (the cue is `aria-hidden`, so the link's name stays the heading). `layout.arrangement: 'feature'`\n * sets one tall card beside two stacked from 1024 px. `footer` (a count line) and `link` (\"See all our projects\")\n * follow the list.\n */\nimport type { ReactNode } from 'react'\nimport { JOB_CARD_LIMIT, jobCardLabel, jobPhotos, type BrandlabJob, type BrandlabNearbyJob } from '@brandlab-digital/site-core/jobs'\nimport type { BrandlabMediaManifest } from '@brandlab-digital/site-core/media'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { LINK_PREFETCH_POLICY } from '../prefetch.js'\nimport { Anchor, TextLink } from '../primitives/links.js'\nimport { Media, type MediaLayout } from '../primitives/media.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'\nimport type { UiLink } from '../types.js'\n\nexport const NEARBY_JOBS_VARIANTS = ['grid', 'rail'] as const\nexport type NearbyJobsVariant = (typeof NEARBY_JOBS_VARIANTS)[number]\nexport type NearbyJobsSlot = SectionSlot | SectionHeadingSlot | 'list' | 'footer' | 'more' | RepeatedSlotOf<'nearbyJobs'>\n/** Rendered once per job: styled from the skin stylesheet, never by class. */\nexport type NearbyJobsRepeatedSlot = RepeatedSlotOf<'nearbyJobs'>\nexport interface NearbyJobsLayout {\n /** `grid`: columns on wide screens. Defaults to 3. */\n readonly columns?: 2 | 3\n /** The photo's crop. Defaults to 4:3. */\n readonly ratio?: NonNullable<MediaLayout['ratio']>\n /** `grid`: `even` (the default) or `feature`, one tall card beside two stacked from 1024 px (3.17.0). */\n readonly arrangement?: 'even' | 'feature'\n /** `label` (the default): the `jobCardLabel` heading; `job`: the job's own `title` where it has one (3.17.0). */\n readonly cardTitle?: 'label' | 'job'\n}\nexport type NearbyJobsSkin = SkinEntry<NearbyJobsSlot, NearbyJobsVariant, NearbyJobsLayout, NearbyJobsRepeatedSlot>\n\nexport interface NearbyJobsProps extends NearbyJobsSkin {\n /** The H2, for example \"Recent tree work near Castle Hill\". */\n readonly title: ReactNode\n readonly eyebrow?: ReactNode\n readonly lead?: ReactNode\n /** The ranked cards from `nearbyJobs()`, nearest first; at most three. */\n readonly jobs: readonly BrandlabNearbyJob[]\n /** The page's suburb slug: its own jobs read \"in {Suburb}\", every other \"nearby: {Suburb}\". */\n readonly pageSuburb: string\n /** The service's name from the site's catalogue, for example `(slug) => services[slug].name`. */\n readonly serviceName: (service: string) => string\n /** The suburb's name from the registry. */\n readonly suburbName: (suburb: string) => string\n /** Replaces \"Recent\" on a dated card (\"Completed tree removal …\"); `''` for none. An undated card never has one. */\n readonly labelPrefix?: string\n /** The media manifest, for the jobs' photos. Left out, the cards show no photo. */\n readonly media?: BrandlabMediaManifest\n /** Photos the page already shows, such as the hero's: media ids or `src` paths. A card never repeats one. */\n readonly pagePhotos?: readonly string[]\n /** The job's project page, when the site has one. */\n readonly jobHref?: (job: BrandlabJob) => string | undefined\n /** A visible cue on a linked card (3.17.0), for example \"View job\". Decorative: the link's name is the heading. */\n readonly linkCue?: ReactNode\n /** A line after the list (3.17.0), for example \"42 jobs logged across the Hills District\". */\n readonly footer?: ReactNode\n /** A link after the list (3.17.0), for example `{ label: 'See all our projects', href: '/projects' }`. */\n readonly link?: UiLink\n /** The photo `sizes`. Defaults to one column of the grid. */\n readonly imageSizes?: string\n /** Defaults to `nearby-jobs-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** The guard for `SectionSequence`: no card means no section (D2). */\nexport function nearbyJobsReady({ jobs }: Pick<NearbyJobsProps, 'jobs'>): BrandlabSectionReadiness {\n return jobs.length > 0 ? SECTION_READY : { render: false, reason: 'no-jobs-nearby' }\n}\n\nfunction photoOf(job: BrandlabJob, media: BrandlabMediaManifest | undefined, shown: ReadonlySet<string>) {\n if (!media) return undefined\n const photo = jobPhotos(job, media).find((entry) => !shown.has(entry.id) && !shown.has(entry.src))\n if (!photo) return undefined\n if (photo.provenance !== 'genuine') {\n throw new Error(`NearbyJobs: \"${photo.id}\" is ${photo.provenance}; only a genuine photo of the job shows on its card.`)\n }\n if (photo.job !== undefined && photo.job !== job.id) throw new Error(`NearbyJobs: \"${photo.id}\" is a photo of ${photo.job}, not ${job.id}.`)\n return photo\n}\n\nexport function NearbyJobs({\n title,\n eyebrow,\n lead,\n jobs,\n pageSuburb,\n serviceName,\n suburbName,\n labelPrefix,\n media,\n pagePhotos,\n jobHref,\n linkCue,\n footer,\n link,\n imageSizes,\n headingId = 'nearby-jobs-heading',\n tone,\n variant = 'grid',\n layout,\n classes,\n}: NearbyJobsProps) {\n if (jobs.length === 0) return null\n if (jobs.length > JOB_CARD_LIMIT) throw new Error(`NearbyJobs: ${jobs.length} jobs; a page shows at most ${JOB_CARD_LIMIT} job cards.`)\n const ids = new Set<string>()\n for (const { job } of jobs) {\n if (ids.has(job.id)) throw new Error(`NearbyJobs: \"${job.id}\" is listed twice.`)\n ids.add(job.id)\n }\n const shown = new Set(pagePhotos)\n const columns = layout?.columns ?? 3\n const ratio = layout?.ratio ?? '4:3'\n const feature = variant === 'grid' && layout?.arrangement === 'feature' && jobs.length === 3\n const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`\n const headings = cardHeadings(\n jobs,\n layout?.cardTitle ?? 'label',\n (job) => jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }),\n pageSuburb,\n )\n return (\n <Section\n id=\"nearby-jobs\"\n labelledBy={headingId}\n tone={tone}\n variant={variant}\n classes={classes}\n hooks={{ 'data-columns': String(columns), 'data-ratio': ratio, 'data-arrangement': feature ? 'feature' : undefined }}\n >\n <SectionHeading id={headingId} title={title} eyebrow={eyebrow} lead={lead} classes={classes} />\n <ul role=\"list\" {...slot(classes, 'list')}>\n {jobs.map(({ job }, index) => {\n const label = headings[index]\n const href = jobHref?.(job)\n const photo = photoOf(job, media, shown)\n return (\n <li key={job.id} {...repeatedSlot('item')} data-item={job.id} data-suburb={job.suburb} data-linked={href ? '' : undefined}>\n <div {...repeatedSlot('body')}>\n <h3 {...repeatedSlot('title')}>\n {href ? (\n <Anchor href={href} prefetch={LINK_PREFETCH_POLICY.contentCard} hooks={repeatedSlot('link')}>\n {label}\n </Anchor>\n ) : (\n label\n )}\n </h3>\n <p {...repeatedSlot('outcome')}>{job.outcome}</p>\n {href && linkCue ? (\n <span {...repeatedSlot('cue')} aria-hidden=\"true\">\n {linkCue}\n </span>\n ) : null}\n </div>\n {photo ? (\n <div {...repeatedSlot('media')}>\n <Media media={photo} sizes={sizes} layout={{ ratio }} />\n </div>\n ) : null}\n </li>\n )\n })}\n </ul>\n {footer ? <p {...slot(classes, 'footer')}>{footer}</p> : null}\n {link ? (\n <p {...slot(classes, 'more')}>\n <TextLink href={link.href} prefetch={LINK_PREFETCH_POLICY.contentCard}>\n {link.label}\n </TextLink>\n </p>\n ) : null}\n </Section>\n )\n}\n\n/** Each card's heading: its label, or the job's title where the label repeats an earlier card's or `cardTitle` is `job`. */\nfunction cardHeadings(\n jobs: readonly BrandlabNearbyJob[],\n cardTitle: 'label' | 'job',\n labelOf: (job: BrandlabJob) => string,\n pageSuburb: string,\n): string[] {\n const used = new Set<string>()\n // A job from another suburb keeps the \"nearby\" label when its own title stands in (L4, 3.17.1).\n const titleOf = (job: BrandlabJob) => (job.title && job.suburb !== pageSuburb ? `Nearby: ${job.title}` : job.title)\n return jobs.map(({ job }) => {\n const title = titleOf(job)\n let heading = cardTitle === 'job' && title ? title : labelOf(job)\n if (used.has(heading)) {\n if (!title || used.has(title)) {\n throw new Error(`NearbyJobs: two cards would both read \"${heading}\"; give job \"${job.id}\" its own title in the job log.`)\n }\n heading = title\n }\n used.add(heading)\n return heading\n })\n}\n"]}
@@ -17,7 +17,7 @@ import type { RepeatedSlotOf } from '../repeated-slots.js';
17
17
  import { type SkinEntry } from '../skin.js';
18
18
  export declare const PROOF_STRIP_VARIANTS: readonly ["inline", "tiles"];
19
19
  export type ProofStripVariant = (typeof PROOF_STRIP_VARIANTS)[number];
20
- export type ProofStripSlot = SectionSlot | 'heading' | 'list' | 'item' | 'link' | 'icon' | 'stars' | 'value' | 'label' | 'logos';
20
+ export type ProofStripSlot = SectionSlot | 'heading' | 'list' | 'item' | 'link' | 'icon' | 'stars' | 'value' | 'label' | 'linkLabel' | 'logos';
21
21
  /** `heading`: the section's H2 is visually hidden by default; a skin may show it. */
22
22
  /** Rendered once per proof item: styled from the skin stylesheet, never by class (3.14.0). */
23
23
  export type ProofStripRepeatedSlot = RepeatedSlotOf<'proofStrip'>;
@@ -33,6 +33,8 @@ interface ProofItemBase {
33
33
  readonly icon?: UiIconName;
34
34
  /** Where the fact can be checked (3.16.0), for example `/reviews` or the licence register. */
35
35
  readonly href?: string;
36
+ /** A visible cue under the label when `href` is set (3.17.0), for example "Read reviews". An arrow follows it. */
37
+ readonly linkLabel?: string;
36
38
  }
37
39
  /** One verified fact, for example `{ id: 'licence', value: '276621C', label: 'NSW contractor licence' }`. */
38
40
  export interface ProofFactItem extends ProofItemBase {
@@ -1 +1 @@
1
- {"version":3,"file":"proof-strip.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/s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M,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CACvB;AAED,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,eAAe,CAAA;AAEvD,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,mGAAmG;IACnG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;IACpC,mFAAmF;IACnF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,wBAAwB,CAGpH;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAA2B,EAAE,IAAI,EAAE,OAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,eAAe,kDAyD1I"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { SECTION_READY } from '@brandlab-digital/site-core/section-order';
3
3
  import { Icon } from '../icons.js';
4
4
  import { Anchor } from '../primitives/links.js';
@@ -15,9 +15,12 @@ export function proofStripReady({ items, logos }) {
15
15
  export function ProofStrip({ title, items, logos, headingId = 'proof-heading', tone, variant = 'inline', layout, classes }) {
16
16
  if (!proofStripReady({ items, logos }).render)
17
17
  return null;
18
+ const unlinked = items.find((item) => item.linkLabel && !item.href);
19
+ if (unlinked)
20
+ throw new Error(`ProofStrip: "${unlinked.id}" has a link label but no href.`);
18
21
  const hidden = (layout?.heading ?? 'hidden') === 'hidden';
19
22
  return (_jsxs(Section, { id: "proof-strip", labelledBy: headingId, tone: tone, variant: variant, classes: classes, children: [_jsx("h2", { id: headingId, ...slot(classes, 'heading'), "data-bl-visually-hidden": hidden ? '' : undefined, children: title }), items.length > 0 ? (_jsx("ul", { role: "list", ...slot(classes, 'list'), children: items.map((item) => {
20
- const content = (_jsxs(_Fragment, { children: [item.icon ? (_jsx("span", { ...repeatedSlot('icon'), children: _jsx(Icon, { name: item.icon }) })) : null, item.rating !== undefined ? (_jsx("span", { ...repeatedSlot('stars'), "aria-hidden": "true", children: _jsx(RatingStars, { rating: item.rating }) })) : null, item.rating !== undefined ? (_jsx("span", { ...repeatedSlot('value'), children: item.rating.toFixed(1) })) : item.value ? (_jsx("span", { ...repeatedSlot('value'), children: item.value })) : null, ' ', _jsx("span", { ...repeatedSlot('label'), children: item.label })] }));
23
+ const content = (_jsxs(_Fragment, { children: [item.icon ? (_jsx("span", { ...repeatedSlot('icon'), children: _jsx(Icon, { name: item.icon }) })) : null, item.rating !== undefined ? (_jsx("span", { ...repeatedSlot('stars'), "aria-hidden": "true", children: _jsx(RatingStars, { rating: item.rating }) })) : null, item.rating !== undefined ? (_jsx("span", { ...repeatedSlot('value'), children: item.rating.toFixed(1) })) : item.value ? (_jsx("span", { ...repeatedSlot('value'), children: item.value })) : null, ' ', _jsx("span", { ...repeatedSlot('label'), children: item.label }), item.href && item.linkLabel ? (_jsxs("span", { ...repeatedSlot('linkLabel'), children: [' ', item.linkLabel, _jsx(Icon, { name: "arrow" })] })) : null] }));
21
24
  return (_jsx("li", { ...repeatedSlot('item'), "data-item": item.id, "data-bl-source": item.rating !== undefined ? 'feed' : undefined, children: item.href ? (_jsx(Anchor, { href: item.href, prefetch: false, hooks: repeatedSlot('link'), children: content })) : (content) }, item.id));
22
25
  }) })) : null, logos ? _jsx("div", { ...slot(classes, 'logos'), children: logos }) : null] }));
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"proof-strip.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/proof-strip.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,aAAa,EAAiC,MAAM,2CAA2C,CAAA;AACxG,OAAO,EAAE,IAAI,EAAmB,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAsC,MAAM,yBAAyB,CAAA;AAElG,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAE/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAA;AAQhE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAwCpC,4GAA4G;AAC5G,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAA4C;IACxF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5C,OAAO,KAAK,IAAI,mBAAmB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAA;AAC9G,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,GAAG,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAmB;IACzI,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,E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AAC,CACf,kBAAU,YAAY,CAAC,OAAO,CAAC,YAAG,IAAI,CAAC,KAAK,GAAQ,CACrD,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,EACb,kBAAU,YAAY,CAAC,OAAO,CAAC,YAAG,IAAI,CAAC,KAAK,GAAQ,IACnD,CACJ,CAAA;oBACD,OAAO,CACL,gBAAsB,YAAY,CAAC,MAAM,CAAC,eAAa,IAAI,CAAC,EAAE,oBAAkB,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,YAC3H,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,YAClE,OAAO,GACD,CACV,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IAPM,IAAI,CAAC,EAAE,CAQX,CACN,CAAA;gBACH,CAAC,CAAC,GACC,CACN,CAAC,CAAC,CAAC,IAAI,EACP,KAAK,CAAC,CAAC,CAAC,iBAAS,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YAAG,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,IACtD,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `ProofStrip` (S3, `proof-strip`): the business's verified strengths straight after the hero: the live rating from\n * the feed, licence lines, insurance, years trading and partner logos. Server component. It takes items that are\n * already verified (`verified` or `legacy-carried` facts, T4); it never counts up or hides text before scripts run.\n * With fewer than three items it renders nothing and reports `merge-into-hero-checklist`: the facts belong in the\n * hero's checklist instead (v1 §7.2).\n *\n * 3.16.0: an item with `href` links its value and label to where the fact can be checked (the reviews, the licence\n * register, the about page), never prefetched; external links open in a new tab. The `tiles` variant sets each value\n * as a large figure (`--bl-proof-figure-size`) over its label, as AA's home strip does.\n */\nimport type { ReactNode } from 'react'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { Icon, type UiIconName } from '../icons.js'\nimport { Anchor } from '../primitives/links.js'\nimport { RatingStars, Section, 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 PROOF_STRIP_VARIANTS = ['inline', 'tiles'] as const\nexport type ProofStripVariant = (typeof PROOF_STRIP_VARIANTS)[number]\nexport type ProofStripSlot = SectionSlot | 'heading' | 'list' | 'item' | 'link' | 'icon' | 'stars' | 'value' | 'label' | 'logos'\n/** `heading`: the section's H2 is visually hidden by default; a skin may show it. */\n/** Rendered once per proof item: styled from the skin stylesheet, never by class (3.14.0). */\nexport type ProofStripRepeatedSlot = RepeatedSlotOf<'proofStrip'>\nexport type ProofStripSkin = SkinEntry<ProofStripSlot, ProofStripVariant, { heading?: 'hidden' | 'visible' }, ProofStripRepeatedSlot>\n\n/** The fewest items a strip shows; below this the facts merge into the hero checklist. */\nexport const PROOF_STRIP_MINIMUM = 3\n\ninterface ProofItemBase {\n /** A stable slug, rendered as `data-item`. */\n readonly id: string\n readonly label: string\n readonly icon?: UiIconName\n /** Where the fact can be checked (3.16.0), for example `/reviews` or the licence register. */\n readonly href?: string\n}\n\n/** One verified fact, for example `{ id: 'licence', value: '276621C', label: 'NSW contractor licence' }`. */\nexport interface ProofFactItem extends ProofItemBase {\n readonly value?: string\n readonly rating?: never\n}\n\n/**\n * The live rating from the reviews feed (F9), never typed by hand (T4). Its value is the rating itself (\"4.9\"), with\n * the stars beside it, and the item is marked `data-bl-source=\"feed\"`, as the reviews band marks its root.\n */\nexport interface ProofRatingItem extends ProofItemBase {\n readonly rating: number\n readonly value?: never\n}\n\nexport type ProofItem = ProofFactItem | ProofRatingItem\n\nexport interface ProofStripProps extends ProofStripSkin {\n /** The H2, for example \"Why homeowners choose Omega\". Visually hidden unless the skin shows it. */\n readonly title: string\n readonly items: readonly ProofItem[]\n /** Partner logos (a `LogoStrip` of verified relationships). Counts as one item. */\n readonly logos?: ReactNode\n /** Defaults to `proof-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** Whether the strip renders: at least three items, logos counting as one (`merge-into-hero-checklist`). */\nexport function proofStripReady({ items, logos }: Pick<ProofStripProps, 'items' | 'logos'>): BrandlabSectionReadiness {\n const count = items.length + (logos ? 1 : 0)\n return count >= PROOF_STRIP_MINIMUM ? SECTION_READY : { render: false, reason: 'merge-into-hero-checklist' }\n}\n\nexport function ProofStrip({ title, items, logos, headingId = 'proof-heading', tone, variant = 'inline', layout, classes }: ProofStripProps) {\n if (!proofStripReady({ items, logos }).render) return null\n const hidden = (layout?.heading ?? 'hidden') === 'hidden'\n return (\n <Section id=\"proof-strip\" labelledBy={headingId} tone={tone} variant={variant} classes={classes}>\n <h2 id={headingId} {...slot(classes, 'heading')} data-bl-visually-hidden={hidden ? '' : undefined}>\n {title}\n </h2>\n {items.length > 0 ? (\n <ul role=\"list\" {...slot(classes, 'list')}>\n {items.map((item) => {\n const content = (\n <>\n {item.icon ? (\n <span {...repeatedSlot('icon')}>\n <Icon name={item.icon} />\n </span>\n ) : null}\n {item.rating !== undefined ? (\n <span {...repeatedSlot('stars')} aria-hidden=\"true\">\n <RatingStars rating={item.rating} />\n </span>\n ) : null}\n {item.rating !== undefined ? (\n <span {...repeatedSlot('value')}>{item.rating.toFixed(1)}</span>\n ) : item.value ? (\n <span {...repeatedSlot('value')}>{item.value}</span>\n ) : null}{' '}\n <span {...repeatedSlot('label')}>{item.label}</span>\n </>\n )\n return (\n <li key={item.id} {...repeatedSlot('item')} data-item={item.id} data-bl-source={item.rating !== undefined ? 'feed' : undefined}>\n {item.href ? (\n <Anchor href={item.href} prefetch={false} hooks={repeatedSlot('link')}>\n {content}\n </Anchor>\n ) : (\n content\n )}\n </li>\n )\n })}\n </ul>\n ) : null}\n {logos ? <div {...slot(classes, 'logos')}>{logos}</div> : null}\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MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAQ,CACjE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACf,kBAAU,YAAY,CAAC,OAAO,CAAC,YAAG,IAAI,CAAC,KAAK,GAAQ,CACrD,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,EACb,kBAAU,YAAY,CAAC,OAAO,CAAC,YAAG,IAAI,CAAC,KAAK,GAAQ,EACnD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAC7B,mBAAU,YAAY,CAAC,WAAW,CAAC,aAChC,GAAG,EACH,IAAI,CAAC,SAAS,EACf,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,IAChB,CACR,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAA;oBACD,OAAO,CACL,gBAAsB,YAAY,CAAC,MAAM,CAAC,eAAa,IAAI,CAAC,EAAE,oBAAkB,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,YAC3H,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,YAClE,OAAO,GACD,CACV,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IAPM,IAAI,CAAC,EAAE,CAQX,CACN,CAAA;gBACH,CAAC,CAAC,GACC,CACN,CAAC,CAAC,CAAC,IAAI,EACP,KAAK,CAAC,CAAC,CAAC,iBAAS,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YAAG,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,IACtD,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `ProofStrip` (S3, `proof-strip`): the business's verified strengths straight after the hero: the live rating from\n * the feed, licence lines, insurance, years trading and partner logos. Server component. It takes items that are\n * already verified (`verified` or `legacy-carried` facts, T4); it never counts up or hides text before scripts run.\n * With fewer than three items it renders nothing and reports `merge-into-hero-checklist`: the facts belong in the\n * hero's checklist instead (v1 §7.2).\n *\n * 3.16.0: an item with `href` links its value and label to where the fact can be checked (the reviews, the licence\n * register, the about page), never prefetched; external links open in a new tab. The `tiles` variant sets each value\n * as a large figure (`--bl-proof-figure-size`) over its label, as AA's home strip does.\n */\nimport type { ReactNode } from 'react'\nimport { SECTION_READY, type BrandlabSectionReadiness } from '@brandlab-digital/site-core/section-order'\nimport { Icon, type UiIconName } from '../icons.js'\nimport { Anchor } from '../primitives/links.js'\nimport { RatingStars, Section, 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 PROOF_STRIP_VARIANTS = ['inline', 'tiles'] as const\nexport type ProofStripVariant = (typeof PROOF_STRIP_VARIANTS)[number]\nexport type ProofStripSlot = SectionSlot | 'heading' | 'list' | 'item' | 'link' | 'icon' | 'stars' | 'value' | 'label' | 'linkLabel' | 'logos'\n/** `heading`: the section's H2 is visually hidden by default; a skin may show it. */\n/** Rendered once per proof item: styled from the skin stylesheet, never by class (3.14.0). */\nexport type ProofStripRepeatedSlot = RepeatedSlotOf<'proofStrip'>\nexport type ProofStripSkin = SkinEntry<ProofStripSlot, ProofStripVariant, { heading?: 'hidden' | 'visible' }, ProofStripRepeatedSlot>\n\n/** The fewest items a strip shows; below this the facts merge into the hero checklist. */\nexport const PROOF_STRIP_MINIMUM = 3\n\ninterface ProofItemBase {\n /** A stable slug, rendered as `data-item`. */\n readonly id: string\n readonly label: string\n readonly icon?: UiIconName\n /** Where the fact can be checked (3.16.0), for example `/reviews` or the licence register. */\n readonly href?: string\n /** A visible cue under the label when `href` is set (3.17.0), for example \"Read reviews\". An arrow follows it. */\n readonly linkLabel?: string\n}\n\n/** One verified fact, for example `{ id: 'licence', value: '276621C', label: 'NSW contractor licence' }`. */\nexport interface ProofFactItem extends ProofItemBase {\n readonly value?: string\n readonly rating?: never\n}\n\n/**\n * The live rating from the reviews feed (F9), never typed by hand (T4). Its value is the rating itself (\"4.9\"), with\n * the stars beside it, and the item is marked `data-bl-source=\"feed\"`, as the reviews band marks its root.\n */\nexport interface ProofRatingItem extends ProofItemBase {\n readonly rating: number\n readonly value?: never\n}\n\nexport type ProofItem = ProofFactItem | ProofRatingItem\n\nexport interface ProofStripProps extends ProofStripSkin {\n /** The H2, for example \"Why homeowners choose Omega\". Visually hidden unless the skin shows it. */\n readonly title: string\n readonly items: readonly ProofItem[]\n /** Partner logos (a `LogoStrip` of verified relationships). Counts as one item. */\n readonly logos?: ReactNode\n /** Defaults to `proof-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\n/** Whether the strip renders: at least three items, logos counting as one (`merge-into-hero-checklist`). */\nexport function proofStripReady({ items, logos }: Pick<ProofStripProps, 'items' | 'logos'>): BrandlabSectionReadiness {\n const count = items.length + (logos ? 1 : 0)\n return count >= PROOF_STRIP_MINIMUM ? SECTION_READY : { render: false, reason: 'merge-into-hero-checklist' }\n}\n\nexport function ProofStrip({ title, items, logos, headingId = 'proof-heading', tone, variant = 'inline', layout, classes }: ProofStripProps) {\n if (!proofStripReady({ items, logos }).render) return null\n const unlinked = items.find((item) => item.linkLabel && !item.href)\n if (unlinked) throw new Error(`ProofStrip: \"${unlinked.id}\" has a link label but no href.`)\n const hidden = (layout?.heading ?? 'hidden') === 'hidden'\n return (\n <Section id=\"proof-strip\" labelledBy={headingId} tone={tone} variant={variant} classes={classes}>\n <h2 id={headingId} {...slot(classes, 'heading')} data-bl-visually-hidden={hidden ? '' : undefined}>\n {title}\n </h2>\n {items.length > 0 ? (\n <ul role=\"list\" {...slot(classes, 'list')}>\n {items.map((item) => {\n const content = (\n <>\n {item.icon ? (\n <span {...repeatedSlot('icon')}>\n <Icon name={item.icon} />\n </span>\n ) : null}\n {item.rating !== undefined ? (\n <span {...repeatedSlot('stars')} aria-hidden=\"true\">\n <RatingStars rating={item.rating} />\n </span>\n ) : null}\n {item.rating !== undefined ? (\n <span {...repeatedSlot('value')}>{item.rating.toFixed(1)}</span>\n ) : item.value ? (\n <span {...repeatedSlot('value')}>{item.value}</span>\n ) : null}{' '}\n <span {...repeatedSlot('label')}>{item.label}</span>\n {item.href && item.linkLabel ? (\n <span {...repeatedSlot('linkLabel')}>\n {' '}\n {item.linkLabel}\n <Icon name=\"arrow\" />\n </span>\n ) : null}\n </>\n )\n return (\n <li key={item.id} {...repeatedSlot('item')} data-item={item.id} data-bl-source={item.rating !== undefined ? 'feed' : undefined}>\n {item.href ? (\n <Anchor href={item.href} prefetch={false} hooks={repeatedSlot('link')}>\n {content}\n </Anchor>\n ) : (\n content\n )}\n </li>\n )\n })}\n </ul>\n ) : null}\n {logos ? <div {...slot(classes, 'logos')}>{logos}</div> : null}\n </Section>\n )\n}\n"]}
@@ -7,7 +7,11 @@ export type SiteFooterVariant = (typeof SITE_FOOTER_VARIANTS)[number];
7
7
  export type SiteFooterSlot = 'root' | 'panel' | 'media' | 'inner' | 'brand' | 'logo' | 'description' | 'licences' | 'licenceLink' | 'social' | 'socialLink' | 'contact' | 'phone' | 'phoneLabel' | 'phoneNumber' | 'email' | 'address' | 'columns' | 'column' | 'heading' | 'toggle' | 'list' | 'link' | 'bottom' | 'bottomInner' | 'legal' | 'policies' | 'policyLink';
8
8
  /** Rendered once per licence, profile, column, link or policy: styled from the skin stylesheet, never by class (3.14.0). */
9
9
  export type SiteFooterRepeatedSlot = RepeatedSlotOf<'siteFooter'>;
10
- export type SiteFooterSkin = SkinEntry<SiteFooterSlot, SiteFooterVariant, Record<never, never>, SiteFooterRepeatedSlot>;
10
+ export interface SiteFooterLayout {
11
+ /** `brand` (the default): the contact lines in column 1; `tier`: a full-width row at the top (3.17.0). */
12
+ readonly contact?: 'brand' | 'tier';
13
+ }
14
+ export type SiteFooterSkin = SkinEntry<SiteFooterSlot, SiteFooterVariant, SiteFooterLayout, SiteFooterRepeatedSlot>;
11
15
  /** One licence line: the text as the register shows it, and the register link when there is one. */
12
16
  export interface SiteFooterLicence {
13
17
  readonly text: string;
@@ -58,5 +62,5 @@ export interface SiteFooterProps extends SiteFooterSkin {
58
62
  /** Prefix for the column list ids (default `bl-footer`). */
59
63
  readonly idPrefix?: string;
60
64
  }
61
- export declare function SiteFooter({ brandName, homeHref, logo, description, licences, socials, phone, phoneLabel, email, address, columns, legal, media, decoration, idPrefix, variant, classes, }: SiteFooterProps): import("react/jsx-runtime").JSX.Element;
65
+ export declare function SiteFooter({ brandName, homeHref, logo, description, licences, socials, phone, phoneLabel, email, address, columns, legal, media, decoration, idPrefix, variant, layout, classes, }: SiteFooterProps): import("react/jsx-runtime").JSX.Element;
62
66
  //# sourceMappingURL=site-footer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"site-footer.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/site-footer.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG5D,eAAO,MAAM,oBAAoB,+BAAgC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAErE,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,MAAM,GACN,aAAa,GACb,UAAU,GACV,aAAa,GACb,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,OAAO,GACP,YAAY,GACZ,aAAa,GACb,OAAO,GACP,SAAS,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AS,CAAA;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AAwBD,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,QAAc,EACd,IAAI,EACJ,WAAW,EACX,QAAa,EACb,OAAY,EACZ,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAsB,EACtB,OAAmB,EACnB,MAAM,EACN,OAAO,GACR,EAAE,eAAe,2CAiHjB"}
@@ -9,6 +9,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
9
9
  * ABN · the privacy and terms links. Never a quote button, "based in", opening hours, a guides column or a "back to
10
10
  * top" text link: the props have no place for them.
11
11
  *
12
+ * `layout.contact: 'tier'` (3.17.0) lifts the phone, email and address out of column 1 into a full-width row at the top
13
+ * of the footer, the phone large (`--bl-footer-tier-phone-size`). Still no quote button.
14
+ *
12
15
  * Variants: `columns`; `photo`, with the site's backdrop image for the panel in `media` (decorative, `aria-hidden`),
13
16
  * for example Superior's sunlit water. Signature art goes in `decoration`.
14
17
  *
@@ -31,9 +34,11 @@ function FooterLink({ link, slotName }) {
31
34
  function currentYear() {
32
35
  return Number(new Intl.DateTimeFormat('en-AU', { year: 'numeric', timeZone: 'Australia/Sydney' }).format(new Date()));
33
36
  }
34
- export function SiteFooter({ brandName, homeHref = '/', logo, description, licences = [], socials = [], phone, phoneLabel, email, address, columns, legal, media, decoration, idPrefix = 'bl-footer', variant = 'columns', classes, }) {
37
+ export function SiteFooter({ brandName, homeHref = '/', logo, description, licences = [], socials = [], phone, phoneLabel, email, address, columns, legal, media, decoration, idPrefix = 'bl-footer', variant = 'columns', layout, classes, }) {
35
38
  const policies = [legal.privacy, legal.terms].filter((link) => !!link);
36
- return (_jsxs("footer", { "data-bl": "footer", "data-variant": variant, className: classes?.root, children: [decoration ? (_jsx("div", { "data-slot": "decoration", "aria-hidden": "true", children: decoration })) : null, _jsxs("div", { ...slot(classes, 'panel'), children: [variant === 'photo' && media ? (_jsx("div", { ...slot(classes, 'media'), "aria-hidden": "true", children: media })) : null, _jsxs("div", { ...slot(classes, 'inner'), children: [_jsxs("div", { ...slot(classes, 'brand'), children: [_jsx(Link, { href: homeHref, prefetch: false, ...slot(classes, 'logo'), "aria-label": brandName, children: logo }), _jsx("p", { ...slot(classes, 'description'), children: description }), licences.length > 0 ? (_jsx("ul", { ...slot(classes, 'licences'), children: licences.map((licence) => (_jsx("li", { children: licence.href ? (_jsx("a", { ...repeatedSlot('licenceLink'), href: licence.href, target: "_blank", rel: "noopener noreferrer", children: licence.text })) : (licence.text) }, licence.text))) })) : null, socials.length > 0 ? (_jsx("ul", { ...slot(classes, 'social'), children: socials.map((social) => (_jsx("li", { children: _jsx("a", { ...repeatedSlot('socialLink'), href: social.href, "aria-label": social.label, target: "_blank", rel: "noopener noreferrer", children: _jsx(SocialIcon, { kind: social.kind }) }) }, social.href))) })) : null, _jsxs("div", { ...slot(classes, 'contact'), children: [_jsx(PhoneLink, { phone: phone, placement: "footer", label: phoneLabel, classes: { root: classes?.phone, label: classes?.phoneLabel, number: classes?.phoneNumber } }), email ? (_jsx("a", { ...slot(classes, 'email'), href: `mailto:${email}`, children: email })) : null, address ? _jsx("p", { ...slot(classes, 'address'), children: address }) : null] })] }), _jsx(SiteFooterColumns, { className: classes?.columns, children: COLUMN_KEYS.map((key) => {
39
+ const tier = layout?.contact === 'tier';
40
+ const contact = (_jsxs("div", { ...slot(classes, 'contact'), children: [_jsx(PhoneLink, { phone: phone, placement: "footer", label: phoneLabel, classes: { root: classes?.phone, label: classes?.phoneLabel, number: classes?.phoneNumber } }), email ? (_jsx("a", { ...slot(classes, 'email'), href: `mailto:${email}`, children: email })) : null, address ? _jsx("p", { ...slot(classes, 'address'), children: address }) : null] }));
41
+ return (_jsxs("footer", { "data-bl": "footer", "data-variant": variant, "data-contact": tier ? 'tier' : undefined, className: classes?.root, children: [decoration ? (_jsx("div", { "data-slot": "decoration", "aria-hidden": "true", children: decoration })) : null, _jsxs("div", { ...slot(classes, 'panel'), children: [variant === 'photo' && media ? (_jsx("div", { ...slot(classes, 'media'), "aria-hidden": "true", children: media })) : null, _jsxs("div", { ...slot(classes, 'inner'), children: [tier ? contact : null, _jsxs("div", { ...slot(classes, 'brand'), children: [_jsx(Link, { href: homeHref, prefetch: false, ...slot(classes, 'logo'), "aria-label": brandName, children: logo }), _jsx("p", { ...slot(classes, 'description'), children: description }), licences.length > 0 ? (_jsx("ul", { ...slot(classes, 'licences'), children: licences.map((licence) => (_jsx("li", { children: licence.href ? (_jsx("a", { ...repeatedSlot('licenceLink'), href: licence.href, target: "_blank", rel: "noopener noreferrer", children: licence.text })) : (licence.text) }, licence.text))) })) : null, socials.length > 0 ? (_jsx("ul", { ...slot(classes, 'social'), children: socials.map((social) => (_jsx("li", { children: _jsx("a", { ...repeatedSlot('socialLink'), href: social.href, "aria-label": social.label, target: "_blank", rel: "noopener noreferrer", children: _jsx(SocialIcon, { kind: social.kind }) }) }, social.href))) })) : null, tier ? null : contact] }), _jsx(SiteFooterColumns, { className: classes?.columns, children: COLUMN_KEYS.map((key) => {
37
42
  const column = columns[key];
38
43
  if (!column || column.links.length === 0)
39
44
  return null;