@brandlab-digital/site-next 3.17.0 → 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.
@@ -5,7 +5,8 @@
5
5
  * takes no other content, and the page is the page header then this block (K12-contact). The form side always has
6
6
  * `id="quote"`, the target of `QuoteButton`'s no-script fallback (`/contact#quote`).
7
7
  *
8
- * 3.17.0: `formHeading` puts an eyebrow, an H2 and a line above the form, as the hero's does. In the details:
8
+ * 3.17.0: `formHeading` puts an eyebrow, a heading and a line above the form, as the hero's does. The form's title is
9
+ * then the section's one H2 (K8, K11) and `title` heads the details as an H3 (3.17.1). In the details:
9
10
  * `notes` is a labelled list apart from `licences` (credentials as ticks with `display: 'ticks'`), `links` are links
10
11
  * such as "Read our Google reviews", and `reply` is a line on its own after the list, such as the reply time.
11
12
  */
@@ -55,7 +56,7 @@ export interface ContactBlockProps extends ContactBlockSkin {
55
56
  readonly text: string;
56
57
  readonly link?: UiLink;
57
58
  };
58
- /** Above the form (3.17.0): an eyebrow, an H2 and a line, for example "Get a free quote". */
59
+ /** Above the form (3.17.0): an eyebrow, the section's H2 and a line, for example "Get a free quote". `title` is then an H3. */
59
60
  readonly formHeading?: {
60
61
  readonly eyebrow?: string;
61
62
  readonly title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"contact-block.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/contact-block.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAGnE,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,MAAM,aAAa,CAAA;AAElD,mGAAmG;AACnG,MA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,EAAE,MAAM,CAAA;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B;AAID,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAU,EACV,KAAK,EACL,SAA6B,EAC7B,IAAI,EACJ,MAAM,EACN,OAAO,GACR,EAAE,iBAAiB,2CAsGnB"}
@@ -9,10 +9,12 @@ export function ContactBlock({ title, form, phone, email, hours, address, licenc
9
9
  throw new Error(`ContactBlock: "${email.address}" is not an email address.`);
10
10
  if (formHeading && formHeading.title.trim() === '')
11
11
  throw new Error('ContactBlock: the form heading is empty.');
12
- const formHeadingId = `${headingId}-form`;
12
+ // One H2 per section (3.17.1): with a form heading, the form's title is the H2 and the details' title an H3.
13
+ const DetailsHeading = formHeading ? 'h3' : 'h2';
14
+ const detailsHeadingId = formHeading ? `${headingId}-details` : headingId;
13
15
  const item = (key, label, value) => (_jsxs("div", { ...slot(classes, 'item'), "data-item": key, children: [_jsx("dt", { ...slot(classes, 'label'), children: label }), _jsx("dd", { ...slot(classes, 'value'), children: value })] }, key));
14
16
  const lines = (detail) => detail.lines.map((line) => (_jsx("span", { ...repeatedSlot('line'), children: line }, line)));
15
- return (_jsxs(Section, { id: "contact", labelledBy: headingId, tone: tone, classes: classes, phonePlacement: "contact", hooks: { 'data-form-side': layout?.formSide ?? 'start' }, children: [_jsxs("div", { id: "quote", ...slot(classes, 'form'), children: [formHeading ? (_jsxs("div", { ...slot(classes, 'formHead'), children: [formHeading.eyebrow ? _jsx("p", { ...slot(classes, 'formEyebrow'), children: formHeading.eyebrow }) : null, _jsx("h2", { id: formHeadingId, ...slot(classes, 'formTitle'), children: formHeading.title }), formHeading.text ? _jsx("p", { ...slot(classes, 'formText'), children: formHeading.text }) : null] })) : null, form] }), _jsxs("div", { ...slot(classes, 'details'), children: [_jsx("h2", { id: headingId, ...slot(classes, 'heading'), children: title }), phone || email || hours || address || licences || notes || areas ? (_jsxs("dl", { ...slot(classes, 'list'), children: [phone ? item('phone', phone.label, _jsx(PhoneLink, { phone: phone.phone, placement: "contact", classes: { root: classes?.phone } })) : null, email ? item('email', email.label, _jsx("a", { href: `mailto:${email.address}`, ...slot(classes, 'link'), children: email.address })) : null, hours ? item('hours', hours.label, lines(hours)) : null, address ? item('address', address.label, lines(address)) : null, licences ? item('licences', licences.label, lines(licences)) : null, notes && notes.items.length > 0
17
+ return (_jsxs(Section, { id: "contact", labelledBy: headingId, tone: tone, classes: classes, phonePlacement: "contact", hooks: { 'data-form-side': layout?.formSide ?? 'start' }, children: [_jsxs("div", { id: "quote", ...slot(classes, 'form'), children: [formHeading ? (_jsxs("div", { ...slot(classes, 'formHead'), children: [formHeading.eyebrow ? _jsx("p", { ...slot(classes, 'formEyebrow'), children: formHeading.eyebrow }) : null, _jsx("h2", { id: headingId, ...slot(classes, 'formTitle'), children: formHeading.title }), formHeading.text ? _jsx("p", { ...slot(classes, 'formText'), children: formHeading.text }) : null] })) : null, form] }), _jsxs("div", { ...slot(classes, 'details'), children: [_jsx(DetailsHeading, { id: detailsHeadingId, ...slot(classes, 'heading'), children: title }), phone || email || hours || address || licences || notes || areas ? (_jsxs("dl", { ...slot(classes, 'list'), children: [phone ? item('phone', phone.label, _jsx(PhoneLink, { phone: phone.phone, placement: "contact", classes: { root: classes?.phone } })) : null, email ? item('email', email.label, _jsx("a", { href: `mailto:${email.address}`, ...slot(classes, 'link'), children: email.address })) : null, hours ? item('hours', hours.label, lines(hours)) : null, address ? item('address', address.label, lines(address)) : null, licences ? item('licences', licences.label, lines(licences)) : null, notes && notes.items.length > 0
16
18
  ? item('notes', notes.label, notes.display === 'ticks' ? (_jsx("span", { ...slot(classes, 'notes'), children: _jsx(TickList, { items: notes.items }) })) : (notes.items.map((note) => (_jsx("span", { ...repeatedSlot('note'), children: note }, note)))))
17
19
  : null, areas
18
20
  ? item('areas', areas.label, _jsxs(_Fragment, { children: [_jsx("span", { ...repeatedSlot('line'), children: areas.text }), areas.link ? (_jsx("span", { ...repeatedSlot('line'), children: _jsx(TextLink, { href: areas.link.href, classes: { root: classes?.link }, children: areas.link.label }) })) : null] }))
@@ -1 +1 @@
1
- {"version":3,"file":"contact-block.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/contact-block.tsx"],"names":[],"mappings":";AAYA,OAAO,EAAE,OAAO,EAAoB,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAqE/D,MAAM,KAAK,GAAG,wCAAwC,CAAA;AAEtD,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,GAAG,EAAE,EACV,KAAK,EACL,SAAS,GAAG,iBAAiB,EAC7B,IAAI,EACJ,MAAM,EACN,OAAO,GACW;IAClB,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;IACrH,IAAI,WAAW,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC/G,MAAM,aAAa,GAAG,GAAG,SAAS,OAAO,CAAA;IACzC,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,KAAgB,EAAE,EAAE,CAAC,CAC7D,kBAAmB,IAAI,CAAC,OAAO,E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I,EAAE,YACzE,IAAI,CAAC,KAAK,GACF,IAHJ,IAAI,CAAC,IAAI,CAIb,CACN,CAAC,GACC,CACN,CAAC,CAAC,CAAC,IAAI,EACP,KAAK,CAAC,CAAC,CAAC,eAAO,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YAAG,KAAK,GAAK,CAAC,CAAC,CAAC,IAAI,IACtD,IACE,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `ContactBlock` (S25, `contact`): the contact page itself. Server component. The site's quote form on one side\n * (the start by default: form left, details right) and the contact details on the other: phone (placement\n * `contact`), email, hours, the public address only where the site passes it, licences and areas. Nothing else: it\n * takes no other content, and the page is the page header then this block (K12-contact). The form side always has\n * `id=\"quote\"`, the target of `QuoteButton`'s no-script fallback (`/contact#quote`).\n *\n * 3.17.0: `formHeading` puts an eyebrow, an H2 and a line above the form, as the hero's does. In the details:\n * `notes` is a labelled list apart from `licences` (credentials as ticks with `display: 'ticks'`), `links` are links\n * such as \"Read our Google reviews\", and `reply` is a line on its own after the list, such as the reply time.\n */\nimport type { ReactNode } from 'react'\nimport { Section, type SectionTone } from '../primitives/layout.js'\nimport { PhoneLink, TextLink } from '../primitives/links.js'\nimport { TickList } from '../primitives/lists.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\nimport type { UiLink, UiPhone } from '../types.js'\n\n/** `phone` and `link` are the classes for the nested `PhoneLink` and the email and areas links. */\nexport type ContactBlockSlot =\n | 'root'\n | 'inner'\n | 'form'\n | 'details'\n | 'heading'\n | 'list'\n | 'item'\n | 'label'\n | 'value'\n | 'line'\n | 'note'\n | 'phone'\n | 'link'\n | 'formHead'\n | 'formEyebrow'\n | 'formTitle'\n | 'formText'\n | 'notes'\n | 'links'\n | 'reply'\n/** Rendered once per line of hours, address, licences or areas: styled from the skin stylesheet, never by class (3.14.0). */\nexport type ContactBlockRepeatedSlot = RepeatedSlotOf<'contactBlock'>\nexport type ContactBlockSkin = SkinEntry<ContactBlockSlot, never, { formSide?: 'start' | 'end' }, ContactBlockRepeatedSlot>\n\n/** A labelled detail of one or more lines, for example hours or a licence. */\nexport interface ContactDetailLines {\n readonly label: string\n readonly lines: readonly string[]\n}\n\n/** A labelled list of short items (3.17.0), for example credentials. `ticks` shows them as a tick list. */\nexport interface ContactDetailNotes {\n readonly label: string\n readonly items: readonly string[]\n readonly display?: 'lines' | 'ticks'\n}\n\nexport interface ContactBlockProps extends ContactBlockSkin {\n /** The details' H2, for example \"Contact details\". */\n readonly title: ReactNode\n /** The site's quote form (`QuoteForm`, plain). */\n readonly form: ReactNode\n /** From the derived business facts; never typed by hand (C10). */\n readonly phone?: { readonly label: string; readonly phone: UiPhone }\n readonly email?: { readonly label: string; readonly address: string }\n readonly hours?: ContactDetailLines\n /** The public address, only where it shows (customers visit, and Romie said so). Never derived here. */\n readonly address?: ContactDetailLines\n readonly licences?: ContactDetailLines\n readonly areas?: { readonly label: string; readonly text: string; readonly link?: UiLink }\n /** Above the form (3.17.0): an eyebrow, an H2 and a line, for example \"Get a free quote\". */\n readonly formHeading?: { readonly eyebrow?: string; readonly title: string; readonly text?: string }\n /** A labelled list apart from licences (3.17.0), for example credentials as ticks. */\n readonly notes?: ContactDetailNotes\n /** Links in the details (3.17.0), for example \"Read our Google reviews\". External links open in a new tab. */\n readonly links?: readonly UiLink[]\n /** A line on its own after the details (3.17.0), for example the reply time. */\n readonly reply?: ReactNode\n /** Defaults to `contact-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\nconst EMAIL = /^[^\\s@<>()]+@[^\\s@<>()]+\\.[^\\s@<>()]+$/\n\nexport function ContactBlock({\n title,\n form,\n phone,\n email,\n hours,\n address,\n licences,\n areas,\n formHeading,\n notes,\n links = [],\n reply,\n headingId = 'contact-heading',\n tone,\n layout,\n classes,\n}: ContactBlockProps) {\n if (email && !EMAIL.test(email.address)) throw new Error(`ContactBlock: \"${email.address}\" is not an email address.`)\n if (formHeading && formHeading.title.trim() === '') throw new Error('ContactBlock: the form heading is empty.')\n const formHeadingId = `${headingId}-form`\n const item = (key: string, label: string, value: ReactNode) => (\n <div key={key} {...slot(classes, 'item')} data-item={key}>\n <dt {...slot(classes, 'label')}>{label}</dt>\n <dd {...slot(classes, 'value')}>{value}</dd>\n </div>\n )\n const lines = (detail: ContactDetailLines) =>\n detail.lines.map((line) => (\n <span key={line} {...repeatedSlot('line')}>\n {line}\n </span>\n ))\n return (\n <Section\n id=\"contact\"\n labelledBy={headingId}\n tone={tone}\n classes={classes}\n phonePlacement=\"contact\"\n hooks={{ 'data-form-side': layout?.formSide ?? 'start' }}\n >\n <div id=\"quote\" {...slot(classes, 'form')}>\n {formHeading ? (\n <div {...slot(classes, 'formHead')}>\n {formHeading.eyebrow ? <p {...slot(classes, 'formEyebrow')}>{formHeading.eyebrow}</p> : null}\n <h2 id={formHeadingId} {...slot(classes, 'formTitle')}>\n {formHeading.title}\n </h2>\n {formHeading.text ? <p {...slot(classes, 'formText')}>{formHeading.text}</p> : null}\n </div>\n ) : null}\n {form}\n </div>\n <div {...slot(classes, 'details')}>\n <h2 id={headingId} {...slot(classes, 'heading')}>\n {title}\n </h2>\n {phone || email || hours || address || licences || notes || areas ? (\n <dl {...slot(classes, 'list')}>\n {phone ? item('phone', phone.label, <PhoneLink phone={phone.phone} placement=\"contact\" classes={{ root: classes?.phone }} />) : null}\n {email ? item('email', email.label, <a href={`mailto:${email.address}`} {...slot(classes, 'link')}>\n {email.address}\n </a>) : null}\n {hours ? item('hours', hours.label, lines(hours)) : null}\n {address ? item('address', address.label, lines(address)) : null}\n {licences ? item('licences', licences.label, lines(licences)) : null}\n {notes && notes.items.length > 0\n ? item(\n 'notes',\n notes.label,\n notes.display === 'ticks' ? (\n <span {...slot(classes, 'notes')}>\n <TickList items={notes.items} />\n </span>\n ) : (\n notes.items.map((note) => (\n <span key={note} {...repeatedSlot('note')}>\n {note}\n </span>\n ))\n ),\n )\n : null}\n {areas\n ? item(\n 'areas',\n areas.label,\n <>\n <span {...repeatedSlot('line')}>{areas.text}</span>\n {areas.link ? (\n <span {...repeatedSlot('line')}>\n <TextLink href={areas.link.href} classes={{ root: classes?.link }}>\n {areas.link.label}\n </TextLink>\n </span>\n ) : null}\n </>,\n )\n : null}\n </dl>\n ) : null}\n {links.length > 0 ? (\n <ul role=\"list\" {...slot(classes, 'links')}>\n {links.map((link) => (\n <li key={link.href}>\n <TextLink href={link.href} prefetch={false} classes={{ root: classes?.link }}>\n {link.label}\n </TextLink>\n </li>\n ))}\n </ul>\n ) : null}\n {reply ? <p {...slot(classes, 'reply')}>{reply}</p> : null}\n </div>\n </Section>\n )\n}\n"]}
1
+ {"version":3,"file":"contact-block.js","sourceRoot":"","sources":["../../../src/ui-kit/sections/contact-block.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,OAAO,EAAoB,MAAM,yBAAyB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAqE/D,MAAM,KAAK,GAAG,wCAAwC,CAAA;AAEtD,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,GAAG,EAAE,EACV,KAAK,EACL,SAAS,GAAG,iBAAiB,EAC7B,IAAI,EACJ,MAAM,EACN,OAAO,GACW;IAClB,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;IACrH,IAAI,WAAW,IAAI,WAAW,CAAC,KAA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C,CAAC,CAAC,IAAI,IACP,CACJ;gCACH,CAAC,CAAC,IAAI,IACL,CACN,CAAC,CAAC,CAAC,IAAI,EACP,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAClB,aAAI,IAAI,EAAC,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YACvC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,uBACE,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,YACzE,IAAI,CAAC,KAAK,GACF,IAHJ,IAAI,CAAC,IAAI,CAIb,CACN,CAAC,GACC,CACN,CAAC,CAAC,CAAC,IAAI,EACP,KAAK,CAAC,CAAC,CAAC,eAAO,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,YAAG,KAAK,GAAK,CAAC,CAAC,CAAC,IAAI,IACtD,IACE,CACX,CAAA;AACH,CAAC","sourcesContent":["/**\n * `ContactBlock` (S25, `contact`): the contact page itself. Server component. The site's quote form on one side\n * (the start by default: form left, details right) and the contact details on the other: phone (placement\n * `contact`), email, hours, the public address only where the site passes it, licences and areas. Nothing else: it\n * takes no other content, and the page is the page header then this block (K12-contact). The form side always has\n * `id=\"quote\"`, the target of `QuoteButton`'s no-script fallback (`/contact#quote`).\n *\n * 3.17.0: `formHeading` puts an eyebrow, a heading and a line above the form, as the hero's does. The form's title is\n * then the section's one H2 (K8, K11) and `title` heads the details as an H3 (3.17.1). In the details:\n * `notes` is a labelled list apart from `licences` (credentials as ticks with `display: 'ticks'`), `links` are links\n * such as \"Read our Google reviews\", and `reply` is a line on its own after the list, such as the reply time.\n */\nimport type { ReactNode } from 'react'\nimport { Section, type SectionTone } from '../primitives/layout.js'\nimport { PhoneLink, TextLink } from '../primitives/links.js'\nimport { TickList } from '../primitives/lists.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\nimport type { UiLink, UiPhone } from '../types.js'\n\n/** `phone` and `link` are the classes for the nested `PhoneLink` and the email and areas links. */\nexport type ContactBlockSlot =\n | 'root'\n | 'inner'\n | 'form'\n | 'details'\n | 'heading'\n | 'list'\n | 'item'\n | 'label'\n | 'value'\n | 'line'\n | 'note'\n | 'phone'\n | 'link'\n | 'formHead'\n | 'formEyebrow'\n | 'formTitle'\n | 'formText'\n | 'notes'\n | 'links'\n | 'reply'\n/** Rendered once per line of hours, address, licences or areas: styled from the skin stylesheet, never by class (3.14.0). */\nexport type ContactBlockRepeatedSlot = RepeatedSlotOf<'contactBlock'>\nexport type ContactBlockSkin = SkinEntry<ContactBlockSlot, never, { formSide?: 'start' | 'end' }, ContactBlockRepeatedSlot>\n\n/** A labelled detail of one or more lines, for example hours or a licence. */\nexport interface ContactDetailLines {\n readonly label: string\n readonly lines: readonly string[]\n}\n\n/** A labelled list of short items (3.17.0), for example credentials. `ticks` shows them as a tick list. */\nexport interface ContactDetailNotes {\n readonly label: string\n readonly items: readonly string[]\n readonly display?: 'lines' | 'ticks'\n}\n\nexport interface ContactBlockProps extends ContactBlockSkin {\n /** The details' H2, for example \"Contact details\". */\n readonly title: ReactNode\n /** The site's quote form (`QuoteForm`, plain). */\n readonly form: ReactNode\n /** From the derived business facts; never typed by hand (C10). */\n readonly phone?: { readonly label: string; readonly phone: UiPhone }\n readonly email?: { readonly label: string; readonly address: string }\n readonly hours?: ContactDetailLines\n /** The public address, only where it shows (customers visit, and Romie said so). Never derived here. */\n readonly address?: ContactDetailLines\n readonly licences?: ContactDetailLines\n readonly areas?: { readonly label: string; readonly text: string; readonly link?: UiLink }\n /** Above the form (3.17.0): an eyebrow, the section's H2 and a line, for example \"Get a free quote\". `title` is then an H3. */\n readonly formHeading?: { readonly eyebrow?: string; readonly title: string; readonly text?: string }\n /** A labelled list apart from licences (3.17.0), for example credentials as ticks. */\n readonly notes?: ContactDetailNotes\n /** Links in the details (3.17.0), for example \"Read our Google reviews\". External links open in a new tab. */\n readonly links?: readonly UiLink[]\n /** A line on its own after the details (3.17.0), for example the reply time. */\n readonly reply?: ReactNode\n /** Defaults to `contact-heading`. */\n readonly headingId?: string\n /** Set by `SectionSequence`. */\n readonly tone?: SectionTone\n}\n\nconst EMAIL = /^[^\\s@<>()]+@[^\\s@<>()]+\\.[^\\s@<>()]+$/\n\nexport function ContactBlock({\n title,\n form,\n phone,\n email,\n hours,\n address,\n licences,\n areas,\n formHeading,\n notes,\n links = [],\n reply,\n headingId = 'contact-heading',\n tone,\n layout,\n classes,\n}: ContactBlockProps) {\n if (email && !EMAIL.test(email.address)) throw new Error(`ContactBlock: \"${email.address}\" is not an email address.`)\n if (formHeading && formHeading.title.trim() === '') throw new Error('ContactBlock: the form heading is empty.')\n // One H2 per section (3.17.1): with a form heading, the form's title is the H2 and the details' title an H3.\n const DetailsHeading = formHeading ? 'h3' : 'h2'\n const detailsHeadingId = formHeading ? `${headingId}-details` : headingId\n const item = (key: string, label: string, value: ReactNode) => (\n <div key={key} {...slot(classes, 'item')} data-item={key}>\n <dt {...slot(classes, 'label')}>{label}</dt>\n <dd {...slot(classes, 'value')}>{value}</dd>\n </div>\n )\n const lines = (detail: ContactDetailLines) =>\n detail.lines.map((line) => (\n <span key={line} {...repeatedSlot('line')}>\n {line}\n </span>\n ))\n return (\n <Section\n id=\"contact\"\n labelledBy={headingId}\n tone={tone}\n classes={classes}\n phonePlacement=\"contact\"\n hooks={{ 'data-form-side': layout?.formSide ?? 'start' }}\n >\n <div id=\"quote\" {...slot(classes, 'form')}>\n {formHeading ? (\n <div {...slot(classes, 'formHead')}>\n {formHeading.eyebrow ? <p {...slot(classes, 'formEyebrow')}>{formHeading.eyebrow}</p> : null}\n <h2 id={headingId} {...slot(classes, 'formTitle')}>\n {formHeading.title}\n </h2>\n {formHeading.text ? <p {...slot(classes, 'formText')}>{formHeading.text}</p> : null}\n </div>\n ) : null}\n {form}\n </div>\n <div {...slot(classes, 'details')}>\n <DetailsHeading id={detailsHeadingId} {...slot(classes, 'heading')}>\n {title}\n </DetailsHeading>\n {phone || email || hours || address || licences || notes || areas ? (\n <dl {...slot(classes, 'list')}>\n {phone ? item('phone', phone.label, <PhoneLink phone={phone.phone} placement=\"contact\" classes={{ root: classes?.phone }} />) : null}\n {email ? item('email', email.label, <a href={`mailto:${email.address}`} {...slot(classes, 'link')}>\n {email.address}\n </a>) : null}\n {hours ? item('hours', hours.label, lines(hours)) : null}\n {address ? item('address', address.label, lines(address)) : null}\n {licences ? item('licences', licences.label, lines(licences)) : null}\n {notes && notes.items.length > 0\n ? item(\n 'notes',\n notes.label,\n notes.display === 'ticks' ? (\n <span {...slot(classes, 'notes')}>\n <TickList items={notes.items} />\n </span>\n ) : (\n notes.items.map((note) => (\n <span key={note} {...repeatedSlot('note')}>\n {note}\n </span>\n ))\n ),\n )\n : null}\n {areas\n ? item(\n 'areas',\n areas.label,\n <>\n <span {...repeatedSlot('line')}>{areas.text}</span>\n {areas.link ? (\n <span {...repeatedSlot('line')}>\n <TextLink href={areas.link.href} classes={{ root: classes?.link }}>\n {areas.link.label}\n </TextLink>\n </span>\n ) : null}\n </>,\n )\n : null}\n </dl>\n ) : null}\n {links.length > 0 ? (\n <ul role=\"list\" {...slot(classes, 'links')}>\n {links.map((link) => (\n <li key={link.href}>\n <TextLink href={link.href} prefetch={false} classes={{ root: classes?.link }}>\n {link.label}\n </TextLink>\n </li>\n ))}\n </ul>\n ) : null}\n {reply ? <p {...slot(classes, 'reply')}>{reply}</p> : null}\n </div>\n </Section>\n )\n}\n"]}
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * 3.17.0: two cards never share a heading. Where a card's label repeats an earlier one ("Tree removal in Eastwood"
16
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. `linkCue` ("View job") shows on a linked card, and the whole card then follows
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
18
  * the heading's link (the cue is `aria-hidden`, so the link's name stays the heading). `layout.arrangement: 'feature'`
19
19
  * sets one tall card beside two stacked from 1024 px. `footer` (a count line) and `link` ("See all our projects")
20
20
  * follow the list.
@@ -1 +1 @@
1
- {"version":3,"file":"nearby-jobs.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/sections/nearby-jobs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,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,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;AACzH,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,GAAG,cAAc,CA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,CAAC,GAAG,wBAAwB,CAEjG;AAaD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,MAAM,EACN,IAAI,EACJ,UAAU,EACV,SAAiC,EACjC,IAAI,EACJ,OAAgB,EAChB,MAAM,EACN,OAAO,GACR,EAAE,eAAe,kDAwEjB"}
@@ -40,7 +40,7 @@ export function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName
40
40
  const ratio = layout?.ratio ?? '4:3';
41
41
  const feature = variant === 'grid' && layout?.arrangement === 'feature' && jobs.length === 3;
42
42
  const sizes = imageSizes ?? `(min-width: 1024px) ${Math.round(100 / columns)}vw, (min-width: 640px) 50vw, 100vw`;
43
- const headings = cardHeadings(jobs, layout?.cardTitle ?? 'label', (job) => 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
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
45
  const label = headings[index];
46
46
  const href = jobHref?.(job);
@@ -49,15 +49,18 @@ export function NearbyJobs({ title, eyebrow, lead, jobs, pageSuburb, serviceName
49
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
50
  }
51
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) {
52
+ function cardHeadings(jobs, cardTitle, labelOf, pageSuburb) {
53
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);
54
56
  return jobs.map(({ job }) => {
55
- let heading = cardTitle === 'job' && job.title ? job.title : labelOf(job);
57
+ const title = titleOf(job);
58
+ let heading = cardTitle === 'job' && title ? title : labelOf(job);
56
59
  if (used.has(heading)) {
57
- if (!job.title || used.has(job.title)) {
60
+ if (!title || used.has(title)) {
58
61
  throw new Error(`NearbyJobs: two cards would both read "${heading}"; give job "${job.id}" its own title in the job log.`);
59
62
  }
60
- heading = job.title;
63
+ heading = title;
61
64
  }
62
65
  used.add(heading);
63
66
  return heading;
@@ -1 +1 @@
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;AA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,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;QAC1B,IAAI,OAAO,GAAG,SAAS,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACzE,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,gBAAgB,GAAG,CAAC,EAAE,iCAAiC,CAAC,CAAA;YAC3H,CAAC;YACD,OAAO,GAAG,GAAG,CAAC,KAAK,CAAA;QACrB,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. `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(jobs, layout?.cardTitle ?? 'label', (job) =>\n jobCardLabel(job, { service: serviceName(job.service), suburbName: suburbName(job.suburb), pageSuburb, ...(labelPrefix === undefined ? {} : { prefix: labelPrefix }) }),\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(jobs: readonly BrandlabNearbyJob[], cardTitle: 'label' | 'job', labelOf: (job: BrandlabJob) => string): string[] {\n const used = new Set<string>()\n return jobs.map(({ job }) => {\n let heading = cardTitle === 'job' && job.title ? job.title : labelOf(job)\n if (used.has(heading)) {\n if (!job.title || used.has(job.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 = job.title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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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandlab-digital/site-next",
3
- "version": "3.17.0",
3
+ "version": "3.17.1",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "typecheck": "tsc --noEmit -p tsconfig.json"
26
26
  },
27
27
  "dependencies": {
28
- "@brandlab-digital/site-core": "3.17.0",
28
+ "@brandlab-digital/site-core": "3.17.1",
29
29
  "browser-image-compression": "2.0.2",
30
30
  "pdf-lib": "1.17.1",
31
31
  "server-only": "0.0.1",