@brandlab-digital/site-next 3.13.0 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/analytics.d.ts +1 -1
- package/dist/analytics.d.ts.map +1 -1
- package/dist/analytics.js +2 -0
- package/dist/analytics.js.map +1 -1
- package/dist/contact/delivery.d.ts +81 -0
- package/dist/contact/delivery.d.ts.map +1 -0
- package/dist/contact/delivery.js +138 -0
- package/dist/contact/delivery.js.map +1 -0
- package/dist/contact/resend-webhook.d.ts +72 -0
- package/dist/contact/resend-webhook.d.ts.map +1 -0
- package/dist/contact/resend-webhook.js +300 -0
- package/dist/contact/resend-webhook.js.map +1 -0
- package/dist/contact/route-handler.d.ts +16 -0
- package/dist/contact/route-handler.d.ts.map +1 -1
- package/dist/contact/route-handler.js +8 -0
- package/dist/contact/route-handler.js.map +1 -1
- package/dist/contact/server-entry.d.ts +2 -0
- package/dist/contact/server-entry.d.ts.map +1 -1
- package/dist/contact/server-entry.js +2 -0
- package/dist/contact/server-entry.js.map +1 -1
- package/dist/contact/server.d.ts +26 -0
- package/dist/contact/server.d.ts.map +1 -1
- package/dist/contact/server.js +48 -3
- package/dist/contact/server.js.map +1 -1
- package/dist/navigation/constants.d.ts +11 -2
- package/dist/navigation/constants.d.ts.map +1 -1
- package/dist/navigation/constants.js +11 -2
- package/dist/navigation/constants.js.map +1 -1
- package/dist/navigation/index.d.ts +1 -1
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +1 -1
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/use-back-to-top.d.ts.map +1 -1
- package/dist/navigation/use-back-to-top.js +12 -4
- package/dist/navigation/use-back-to-top.js.map +1 -1
- package/dist/navigation/use-header-metrics.d.ts +1 -1
- package/dist/navigation/use-header-metrics.js +1 -1
- package/dist/navigation/use-header-metrics.js.map +1 -1
- package/dist/navigation/use-sticky-call-bar.d.ts +2 -1
- package/dist/navigation/use-sticky-call-bar.d.ts.map +1 -1
- package/dist/navigation/use-sticky-call-bar.js +11 -2
- package/dist/navigation/use-sticky-call-bar.js.map +1 -1
- package/dist/next-config.d.ts +17 -1
- package/dist/next-config.d.ts.map +1 -1
- package/dist/next-config.js +36 -2
- package/dist/next-config.js.map +1 -1
- package/dist/ui-kit/brandlab-skin.d.ts +50 -1
- package/dist/ui-kit/brandlab-skin.d.ts.map +1 -1
- package/dist/ui-kit/brandlab-skin.js.map +1 -1
- package/dist/ui-kit/form/photo-upload.d.ts +4 -1
- package/dist/ui-kit/form/photo-upload.d.ts.map +1 -1
- package/dist/ui-kit/form/photo-upload.js +4 -4
- package/dist/ui-kit/form/photo-upload.js.map +1 -1
- package/dist/ui-kit/form/quote-form.d.ts +4 -1
- package/dist/ui-kit/form/quote-form.d.ts.map +1 -1
- package/dist/ui-kit/form/quote-form.js.map +1 -1
- package/dist/ui-kit/form/thank-you.d.ts +4 -1
- package/dist/ui-kit/form/thank-you.d.ts.map +1 -1
- package/dist/ui-kit/form/thank-you.js +2 -2
- package/dist/ui-kit/form/thank-you.js.map +1 -1
- package/dist/ui-kit/icon-glyphs.d.ts +41 -0
- package/dist/ui-kit/icon-glyphs.d.ts.map +1 -0
- package/dist/ui-kit/icon-glyphs.js +138 -0
- package/dist/ui-kit/icon-glyphs.js.map +1 -0
- package/dist/ui-kit/icon-sprite.d.ts +19 -0
- package/dist/ui-kit/icon-sprite.d.ts.map +1 -0
- package/dist/ui-kit/icon-sprite.js +44 -0
- package/dist/ui-kit/icon-sprite.js.map +1 -0
- package/dist/ui-kit/icons.d.ts +38 -3
- package/dist/ui-kit/icons.d.ts.map +1 -1
- package/dist/ui-kit/icons.js +47 -64
- package/dist/ui-kit/icons.js.map +1 -1
- package/dist/ui-kit/prefetch.d.ts +19 -10
- package/dist/ui-kit/prefetch.d.ts.map +1 -1
- package/dist/ui-kit/prefetch.js +23 -10
- package/dist/ui-kit/prefetch.js.map +1 -1
- package/dist/ui-kit/primitives/badge.d.ts +25 -0
- package/dist/ui-kit/primitives/badge.d.ts.map +1 -0
- package/dist/ui-kit/primitives/badge.js +21 -0
- package/dist/ui-kit/primitives/badge.js.map +1 -0
- package/dist/ui-kit/primitives/breadcrumbs.d.ts +27 -0
- package/dist/ui-kit/primitives/breadcrumbs.d.ts.map +1 -0
- package/dist/ui-kit/primitives/breadcrumbs.js +40 -0
- package/dist/ui-kit/primitives/breadcrumbs.js.map +1 -0
- package/dist/ui-kit/primitives/button.d.ts +32 -0
- package/dist/ui-kit/primitives/button.d.ts.map +1 -0
- package/dist/ui-kit/primitives/button.js +8 -0
- package/dist/ui-kit/primitives/button.js.map +1 -0
- package/dist/ui-kit/primitives/card.d.ts +40 -0
- package/dist/ui-kit/primitives/card.d.ts.map +1 -0
- package/dist/ui-kit/primitives/card.js +8 -0
- package/dist/ui-kit/primitives/card.js.map +1 -0
- package/dist/ui-kit/primitives/index.d.ts +11 -2
- package/dist/ui-kit/primitives/index.d.ts.map +1 -1
- package/dist/ui-kit/primitives/index.js +11 -2
- package/dist/ui-kit/primitives/index.js.map +1 -1
- package/dist/ui-kit/primitives/layout.d.ts +12 -0
- package/dist/ui-kit/primitives/layout.d.ts.map +1 -1
- package/dist/ui-kit/primitives/layout.js +20 -2
- package/dist/ui-kit/primitives/layout.js.map +1 -1
- package/dist/ui-kit/primitives/links.d.ts +15 -0
- package/dist/ui-kit/primitives/links.d.ts.map +1 -1
- package/dist/ui-kit/primitives/links.js +6 -2
- package/dist/ui-kit/primitives/links.js.map +1 -1
- package/dist/ui-kit/primitives/lists.d.ts +51 -0
- package/dist/ui-kit/primitives/lists.d.ts.map +1 -0
- package/dist/ui-kit/primitives/lists.js +34 -0
- package/dist/ui-kit/primitives/lists.js.map +1 -0
- package/dist/ui-kit/primitives/media-frame.d.ts +28 -0
- package/dist/ui-kit/primitives/media-frame.d.ts.map +1 -0
- package/dist/ui-kit/primitives/media-frame.js +58 -0
- package/dist/ui-kit/primitives/media-frame.js.map +1 -0
- package/dist/ui-kit/primitives/media.d.ts +38 -0
- package/dist/ui-kit/primitives/media.d.ts.map +1 -0
- package/dist/ui-kit/primitives/media.js +9 -0
- package/dist/ui-kit/primitives/media.js.map +1 -0
- package/dist/ui-kit/primitives/quote-button.d.ts +25 -2
- package/dist/ui-kit/primitives/quote-button.d.ts.map +1 -1
- package/dist/ui-kit/primitives/quote-button.js +25 -3
- package/dist/ui-kit/primitives/quote-button.js.map +1 -1
- package/dist/ui-kit/primitives/stat.d.ts +25 -0
- package/dist/ui-kit/primitives/stat.d.ts.map +1 -0
- package/dist/ui-kit/primitives/stat.js +7 -0
- package/dist/ui-kit/primitives/stat.js.map +1 -0
- package/dist/ui-kit/repeated-slots.d.ts +153 -0
- package/dist/ui-kit/repeated-slots.d.ts.map +1 -0
- package/dist/ui-kit/repeated-slots.js +97 -0
- package/dist/ui-kit/repeated-slots.js.map +1 -0
- package/dist/ui-kit/sections/accordion.d.ts +4 -1
- package/dist/ui-kit/sections/accordion.d.ts.map +1 -1
- package/dist/ui-kit/sections/accordion.js +2 -2
- package/dist/ui-kit/sections/accordion.js.map +1 -1
- package/dist/ui-kit/sections/area-map.d.ts +64 -0
- package/dist/ui-kit/sections/area-map.d.ts.map +1 -0
- package/dist/ui-kit/sections/area-map.js +142 -0
- package/dist/ui-kit/sections/area-map.js.map +1 -0
- package/dist/ui-kit/sections/before-after.d.ts +59 -0
- package/dist/ui-kit/sections/before-after.d.ts.map +1 -0
- package/dist/ui-kit/sections/before-after.js +42 -0
- package/dist/ui-kit/sections/before-after.js.map +1 -0
- package/dist/ui-kit/sections/contact-block.d.ts +4 -1
- package/dist/ui-kit/sections/contact-block.d.ts.map +1 -1
- package/dist/ui-kit/sections/contact-block.js +3 -3
- package/dist/ui-kit/sections/contact-block.js.map +1 -1
- package/dist/ui-kit/sections/council-rules.d.ts +64 -0
- package/dist/ui-kit/sections/council-rules.d.ts.map +1 -0
- package/dist/ui-kit/sections/council-rules.js +46 -0
- package/dist/ui-kit/sections/council-rules.js.map +1 -0
- package/dist/ui-kit/sections/coverage.d.ts +53 -0
- package/dist/ui-kit/sections/coverage.d.ts.map +1 -0
- package/dist/ui-kit/sections/coverage.js +57 -0
- package/dist/ui-kit/sections/coverage.js.map +1 -0
- package/dist/ui-kit/sections/emergency-band.d.ts +60 -0
- package/dist/ui-kit/sections/emergency-band.d.ts.map +1 -0
- package/dist/ui-kit/sections/emergency-band.js +43 -0
- package/dist/ui-kit/sections/emergency-band.js.map +1 -0
- package/dist/ui-kit/sections/faqs.d.ts +4 -1
- package/dist/ui-kit/sections/faqs.d.ts.map +1 -1
- package/dist/ui-kit/sections/faqs.js +4 -5
- package/dist/ui-kit/sections/faqs.js.map +1 -1
- package/dist/ui-kit/sections/gallery.d.ts +60 -0
- package/dist/ui-kit/sections/gallery.d.ts.map +1 -0
- package/dist/ui-kit/sections/gallery.js +39 -0
- package/dist/ui-kit/sections/gallery.js.map +1 -0
- package/dist/ui-kit/sections/hero.d.ts +118 -0
- package/dist/ui-kit/sections/hero.d.ts.map +1 -0
- package/dist/ui-kit/sections/hero.js +58 -0
- package/dist/ui-kit/sections/hero.js.map +1 -0
- package/dist/ui-kit/sections/index.d.ts +16 -1
- package/dist/ui-kit/sections/index.d.ts.map +1 -1
- package/dist/ui-kit/sections/index.js +16 -1
- package/dist/ui-kit/sections/index.js.map +1 -1
- package/dist/ui-kit/sections/licences.d.ts +72 -0
- package/dist/ui-kit/sections/licences.d.ts.map +1 -0
- package/dist/ui-kit/sections/licences.js +46 -0
- package/dist/ui-kit/sections/licences.js.map +1 -0
- package/dist/ui-kit/sections/local-facts.d.ts +78 -0
- package/dist/ui-kit/sections/local-facts.d.ts.map +1 -0
- package/dist/ui-kit/sections/local-facts.js +32 -0
- package/dist/ui-kit/sections/local-facts.js.map +1 -0
- package/dist/ui-kit/sections/nearby-areas.d.ts +50 -0
- package/dist/ui-kit/sections/nearby-areas.d.ts.map +1 -0
- package/dist/ui-kit/sections/nearby-areas.js +49 -0
- package/dist/ui-kit/sections/nearby-areas.js.map +1 -0
- package/dist/ui-kit/sections/nearby-jobs.d.ts +66 -0
- package/dist/ui-kit/sections/nearby-jobs.d.ts.map +1 -0
- package/dist/ui-kit/sections/nearby-jobs.js +49 -0
- package/dist/ui-kit/sections/nearby-jobs.js.map +1 -0
- package/dist/ui-kit/sections/price-guide.d.ts +4 -1
- package/dist/ui-kit/sections/price-guide.d.ts.map +1 -1
- package/dist/ui-kit/sections/price-guide.js +3 -3
- package/dist/ui-kit/sections/price-guide.js.map +1 -1
- package/dist/ui-kit/sections/price-table.d.ts +7 -9
- package/dist/ui-kit/sections/price-table.d.ts.map +1 -1
- package/dist/ui-kit/sections/price-table.js +8 -8
- package/dist/ui-kit/sections/price-table.js.map +1 -1
- package/dist/ui-kit/sections/projects.d.ts +79 -0
- package/dist/ui-kit/sections/projects.d.ts.map +1 -0
- package/dist/ui-kit/sections/projects.js +69 -0
- package/dist/ui-kit/sections/projects.js.map +1 -0
- package/dist/ui-kit/sections/proof-strip.d.ts +4 -1
- package/dist/ui-kit/sections/proof-strip.d.ts.map +1 -1
- package/dist/ui-kit/sections/proof-strip.js +2 -2
- package/dist/ui-kit/sections/proof-strip.js.map +1 -1
- package/dist/ui-kit/sections/quote-checklist.d.ts +43 -0
- package/dist/ui-kit/sections/quote-checklist.d.ts.map +1 -0
- package/dist/ui-kit/sections/quote-checklist.js +19 -0
- package/dist/ui-kit/sections/quote-checklist.js.map +1 -0
- package/dist/ui-kit/sections/related-services.d.ts +41 -0
- package/dist/ui-kit/sections/related-services.d.ts.map +1 -0
- package/dist/ui-kit/sections/related-services.js +52 -0
- package/dist/ui-kit/sections/related-services.js.map +1 -0
- package/dist/ui-kit/sections/reviews-band.d.ts +16 -2
- package/dist/ui-kit/sections/reviews-band.d.ts.map +1 -1
- package/dist/ui-kit/sections/reviews-band.js +13 -2
- package/dist/ui-kit/sections/reviews-band.js.map +1 -1
- package/dist/ui-kit/sections/services-grid.d.ts +82 -0
- package/dist/ui-kit/sections/services-grid.d.ts.map +1 -0
- package/dist/ui-kit/sections/services-grid.js +90 -0
- package/dist/ui-kit/sections/services-grid.js.map +1 -0
- package/dist/ui-kit/sections/site-footer.d.ts +4 -1
- package/dist/ui-kit/sections/site-footer.d.ts.map +1 -1
- package/dist/ui-kit/sections/site-footer.js +6 -6
- package/dist/ui-kit/sections/site-footer.js.map +1 -1
- package/dist/ui-kit/sections/work-photos.d.ts +15 -0
- package/dist/ui-kit/sections/work-photos.d.ts.map +1 -0
- package/dist/ui-kit/sections/work-photos.js +24 -0
- package/dist/ui-kit/sections/work-photos.js.map +1 -0
- package/dist/ui-kit/shell/back-to-top.js +1 -1
- package/dist/ui-kit/shell/back-to-top.js.map +1 -1
- package/dist/ui-kit/shell/current-link.d.ts +21 -5
- package/dist/ui-kit/shell/current-link.d.ts.map +1 -1
- package/dist/ui-kit/shell/current-link.js +16 -5
- package/dist/ui-kit/shell/current-link.js.map +1 -1
- package/dist/ui-kit/shell/drawer-client.js +1 -1
- package/dist/ui-kit/shell/drawer-client.js.map +1 -1
- package/dist/ui-kit/shell/intent-prefetch.d.ts.map +1 -1
- package/dist/ui-kit/shell/intent-prefetch.js +3 -2
- package/dist/ui-kit/shell/intent-prefetch.js.map +1 -1
- package/dist/ui-kit/shell/mobile-call-bar.d.ts +6 -1
- package/dist/ui-kit/shell/mobile-call-bar.d.ts.map +1 -1
- package/dist/ui-kit/shell/mobile-call-bar.js +6 -3
- package/dist/ui-kit/shell/mobile-call-bar.js.map +1 -1
- package/dist/ui-kit/shell/mobile-drawer.d.ts +7 -3
- package/dist/ui-kit/shell/mobile-drawer.d.ts.map +1 -1
- package/dist/ui-kit/shell/mobile-drawer.js +21 -5
- package/dist/ui-kit/shell/mobile-drawer.js.map +1 -1
- package/dist/ui-kit/shell/shell-quote.d.ts +10 -0
- package/dist/ui-kit/shell/shell-quote.d.ts.map +1 -0
- package/dist/ui-kit/shell/shell-quote.js +13 -0
- package/dist/ui-kit/shell/shell-quote.js.map +1 -0
- package/dist/ui-kit/shell/site-header.d.ts +5 -2
- package/dist/ui-kit/shell/site-header.d.ts.map +1 -1
- package/dist/ui-kit/shell/site-header.js +9 -9
- package/dist/ui-kit/shell/site-header.js.map +1 -1
- package/dist/ui-kit/shell/social-links.d.ts +1 -2
- package/dist/ui-kit/shell/social-links.d.ts.map +1 -1
- package/dist/ui-kit/shell/social-links.js +6 -3
- package/dist/ui-kit/shell/social-links.js.map +1 -1
- package/dist/ui-kit/shell/utility-bar.d.ts +4 -1
- package/dist/ui-kit/shell/utility-bar.d.ts.map +1 -1
- package/dist/ui-kit/shell/utility-bar.js +2 -2
- package/dist/ui-kit/shell/utility-bar.js.map +1 -1
- package/dist/ui-kit/skin-index.d.ts +2 -1
- package/dist/ui-kit/skin-index.d.ts.map +1 -1
- package/dist/ui-kit/skin-index.js +2 -1
- package/dist/ui-kit/skin-index.js.map +1 -1
- package/dist/ui-kit/skin.d.ts +21 -4
- package/dist/ui-kit/skin.d.ts.map +1 -1
- package/dist/ui-kit/skin.js +14 -1
- package/dist/ui-kit/skin.js.map +1 -1
- package/dist/ui-kit/structure.css +793 -10
- package/package.json +6 -2
package/dist/ui-kit/icons.d.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ui-kit's icons (no icon font). Every icon is decorative (`aria-hidden`): the control around it carries the
|
|
3
|
+
* accessible name. Stroke and fill use `currentColor`, so a skin colours them through its classes or tokens.
|
|
4
|
+
* `data-icon` names the glyph for skins and tests.
|
|
5
|
+
*
|
|
6
|
+
* From 3.14.0 an icon is `<svg aria-hidden="true" viewBox data-icon><use href="/_bl/icons.<hash>.svg#name"/></svg>`:
|
|
7
|
+
* the glyphs live once in a static, immutable sprite that `defineBrandlabNextConfig({ icons })` builds, instead of
|
|
8
|
+
* once per use in the HTML and the RSC payload. Without the sprite (tests, a site that has not opted in) the same
|
|
9
|
+
* `<svg>` carries the glyph inline.
|
|
10
|
+
*/
|
|
1
11
|
import type { UiSocialKind } from './types.js';
|
|
12
|
+
import { type IconGlyph, type SiteIconSet, type UiIconName } from './icon-glyphs.js';
|
|
13
|
+
export { UI_ICON_NAMES, type UiIconName } from './icon-glyphs.js';
|
|
2
14
|
export interface IconProps {
|
|
3
15
|
readonly className?: string | undefined;
|
|
4
16
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The sprite's path when `defineBrandlabNextConfig({ icons })` built one, or undefined. Next inlines the variable into
|
|
19
|
+
* the server and browser bundles, so both render the same markup.
|
|
20
|
+
*/
|
|
21
|
+
export declare function iconSpriteHref(): string | undefined;
|
|
22
|
+
/** One icon from the library set by name. */
|
|
8
23
|
export declare function Icon({ name, className }: IconProps & {
|
|
9
24
|
name: UiIconName;
|
|
10
25
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,4 +27,24 @@ export declare function Icon({ name, className }: IconProps & {
|
|
|
12
27
|
export declare function SocialIcon({ kind, className }: IconProps & {
|
|
13
28
|
kind: UiSocialKind;
|
|
14
29
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* The component for a site's own icons, typed on its names. The same markup as `Icon`: a `<use>` into the shared
|
|
32
|
+
* sprite once the config lists the set in `icons.site`, the glyph inline otherwise.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* export const SiteIcon = createSiteIcon(siteIcons) // src/site/ui.tsx
|
|
36
|
+
* <SiteIcon name="leaf" />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function createSiteIcon<Name extends string>(icons: SiteIconSet<Name>): ({ name, className }: IconProps & {
|
|
40
|
+
name: Name;
|
|
41
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* The one star the rating row repeats: its `<use>` reference into the sprite, or its glyph for the inline fallback.
|
|
44
|
+
* `RatingStars` places five of them in one `<svg>`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function starGlyph(): {
|
|
47
|
+
readonly href?: string;
|
|
48
|
+
readonly glyph: IconGlyph;
|
|
49
|
+
};
|
|
15
50
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/ui-kit/icons.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/ui-kit/icons.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAEjE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACxC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAGnD;AAgBD,6CAA6C;AAC7C,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,2CAEzE;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2CAEjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,yBACnC,SAAS,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,6CAMlE;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAGjF"}
|
package/dist/ui-kit/icons.js
CHANGED
|
@@ -1,72 +1,55 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'
|
|
11
|
-
'camera',
|
|
12
|
-
'mail',
|
|
13
|
-
'facebook',
|
|
14
|
-
'instagram',
|
|
15
|
-
'google',
|
|
16
|
-
'linkedin',
|
|
17
|
-
'youtube',
|
|
18
|
-
'tiktok',
|
|
19
|
-
];
|
|
20
|
-
function Svg({ name, viewBox = '0 0 24 24', className, children }) {
|
|
21
|
-
return (_jsx("svg", { "aria-hidden": "true", focusable: "false", viewBox: viewBox, className: className, "data-icon": name, children: children }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_ICON_VIEW_BOX, UI_ICON_GLYPHS, } from './icon-glyphs.js';
|
|
3
|
+
export { UI_ICON_NAMES } from './icon-glyphs.js';
|
|
4
|
+
/**
|
|
5
|
+
* The sprite's path when `defineBrandlabNextConfig({ icons })` built one, or undefined. Next inlines the variable into
|
|
6
|
+
* the server and browser bundles, so both render the same markup.
|
|
7
|
+
*/
|
|
8
|
+
export function iconSpriteHref() {
|
|
9
|
+
const href = process.env.NEXT_PUBLIC_BL_ICON_SPRITE;
|
|
10
|
+
return typeof href === 'string' && /^\/[\w./-]+\.svg$/.test(href) ? href : undefined;
|
|
22
11
|
}
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
star: {
|
|
34
|
-
viewBox: '0 0 20 20',
|
|
35
|
-
body: _jsx("path", { fill: "currentColor", d: "M10 1.6 12.6 7l5.9.7-4.4 4 1.2 5.8L10 14.6l-5.3 2.9L5.9 11.7l-4.4-4L7.4 7 10 1.6Z" }),
|
|
36
|
-
},
|
|
37
|
-
check: { body: _jsx("path", { ...stroke, strokeWidth: "2", d: "m4.5 12.75 6 6 9-13.5" }) },
|
|
38
|
-
camera: {
|
|
39
|
-
body: (_jsxs(_Fragment, { children: [_jsx("path", { ...stroke, strokeWidth: "1.6", d: "M3 8.25A2.25 2.25 0 0 1 5.25 6h1.372c.516 0 .966-.351 1.091-.852l.38-1.52A1.125 1.125 0 0 1 9.184 2.7h5.632c.516 0 .966.351 1.091.852l.38 1.52c.125.5.575.852 1.091.852h1.372A2.25 2.25 0 0 1 21 8.25v9.75a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18V8.25Z" }), _jsx("circle", { ...stroke, strokeWidth: "1.6", cx: "12", cy: "12.75", r: "3.75" })] })),
|
|
40
|
-
},
|
|
41
|
-
mail: {
|
|
42
|
-
body: (_jsx("path", { ...stroke, strokeWidth: "1.6", d: "M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0-8.69 5.6a2.25 2.25 0 0 1-2.12 0l-8.69-5.6" })),
|
|
43
|
-
},
|
|
44
|
-
facebook: {
|
|
45
|
-
body: (_jsx("path", { fill: "currentColor", d: "M9 8H6v4h3v12h5V12h3.642L18 8h-4V6.333C14 5.378 14.192 5 15.115 5H18V0h-3.808C10.596 0 9 1.583 9 4.615V8Z" })),
|
|
46
|
-
},
|
|
47
|
-
instagram: {
|
|
48
|
-
body: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "5", fill: "none", stroke: "currentColor", strokeWidth: "2" }), _jsx("circle", { cx: "12", cy: "12", r: "4.2", fill: "none", stroke: "currentColor", strokeWidth: "2" }), _jsx("circle", { cx: "17.4", cy: "6.6", r: "1.3", fill: "currentColor" })] })),
|
|
49
|
-
},
|
|
50
|
-
google: {
|
|
51
|
-
body: (_jsx("path", { fill: "currentColor", d: "M21.6 12.23c0-.68-.06-1.33-.17-1.96H12v3.7h5.39a4.6 4.6 0 0 1-2 3.02v2.5h3.24c1.9-1.75 2.97-4.32 2.97-7.26ZM12 22c2.7 0 4.96-.9 6.62-2.43l-3.24-2.5c-.9.6-2.04.95-3.38.95-2.6 0-4.8-1.75-5.59-4.11H3.07v2.59A10 10 0 0 0 12 22Zm-5.59-8.09A6 6 0 0 1 6.1 12c0-.66.11-1.31.31-1.91V7.5H3.07A10 10 0 0 0 2 12c0 1.61.39 3.14 1.07 4.5l3.34-2.59ZM12 5.98c1.47 0 2.79.5 3.83 1.5l2.87-2.87A9.6 9.6 0 0 0 12 2a10 10 0 0 0-8.93 5.5l3.34 2.59C7.2 7.73 9.4 5.98 12 5.98Z" })),
|
|
52
|
-
},
|
|
53
|
-
linkedin: {
|
|
54
|
-
body: (_jsx("path", { fill: "currentColor", d: "M4.98 3.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5ZM3 9.75h4v11.5H3V9.75Zm6.5 0h3.83v1.57h.06c.53-1 1.84-2.07 3.79-2.07 4.05 0 4.8 2.67 4.8 6.13v5.87h-4v-5.2c0-1.24-.02-2.84-1.73-2.84-1.73 0-2 1.35-2 2.75v5.29h-4V9.75Z" })),
|
|
55
|
-
},
|
|
56
|
-
youtube: {
|
|
57
|
-
body: (_jsx("path", { fill: "currentColor", d: "M23 7.2a3 3 0 0 0-2.1-2.1C19 4.6 12 4.6 12 4.6s-7 0-8.9.5A3 3 0 0 0 1 7.2 31 31 0 0 0 .5 12a31 31 0 0 0 .5 4.8 3 3 0 0 0 2.1 2.1c1.9.5 8.9.5 8.9.5s7 0 8.9-.5a3 3 0 0 0 2.1-2.1 31 31 0 0 0 .5-4.8 31 31 0 0 0-.5-4.8ZM9.75 15.02V8.98L15.5 12l-5.75 3.02Z" })),
|
|
58
|
-
},
|
|
59
|
-
tiktok: {
|
|
60
|
-
body: (_jsx("path", { fill: "currentColor", d: "M16.6 2h-3.4v13.4a2.9 2.9 0 1 1-2.9-2.9c.3 0 .6 0 .9.1V9.1a6.3 6.3 0 1 0 5.4 6.3V8.6a8.1 8.1 0 0 0 4.4 1.3V6.5a4.5 4.5 0 0 1-4.4-4.5Z" })),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
/** One icon from the set by name. */
|
|
12
|
+
function SvgIcon({ name, glyph, className }) {
|
|
13
|
+
const viewBox = glyph.viewBox ?? DEFAULT_ICON_VIEW_BOX;
|
|
14
|
+
const sprite = iconSpriteHref();
|
|
15
|
+
if (sprite) {
|
|
16
|
+
return (_jsx("svg", { "aria-hidden": "true", viewBox: viewBox, className: className, "data-icon": name, children: _jsx("use", { href: `${sprite}#${name}` }) }));
|
|
17
|
+
}
|
|
18
|
+
// The fallback: the glyph inline. Library glyphs are constants; site glyphs passed defineSiteIcons' shape checks.
|
|
19
|
+
return _jsx("svg", { "aria-hidden": "true", viewBox: viewBox, className: className, "data-icon": name, dangerouslySetInnerHTML: { __html: glyph.body } });
|
|
20
|
+
}
|
|
21
|
+
/** One icon from the library set by name. */
|
|
64
22
|
export function Icon({ name, className }) {
|
|
65
|
-
|
|
66
|
-
return (_jsx(Svg, { name: name, viewBox: glyph.viewBox, className: className, children: glyph.body }));
|
|
23
|
+
return _jsx(SvgIcon, { name: name, glyph: UI_ICON_GLYPHS[name], className: className });
|
|
67
24
|
}
|
|
68
25
|
/** The icon for a social or Business Profile link. */
|
|
69
26
|
export function SocialIcon({ kind, className }) {
|
|
70
27
|
return _jsx(Icon, { name: kind, className: className });
|
|
71
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The component for a site's own icons, typed on its names. The same markup as `Icon`: a `<use>` into the shared
|
|
31
|
+
* sprite once the config lists the set in `icons.site`, the glyph inline otherwise.
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* export const SiteIcon = createSiteIcon(siteIcons) // src/site/ui.tsx
|
|
35
|
+
* <SiteIcon name="leaf" />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function createSiteIcon(icons) {
|
|
39
|
+
function SiteIcon({ name, className }) {
|
|
40
|
+
const glyph = icons.glyphs[name];
|
|
41
|
+
if (!glyph)
|
|
42
|
+
throw new Error(`Site icon "${name}" is not in the registered set.`);
|
|
43
|
+
return _jsx(SvgIcon, { name: name, glyph: glyph, className: className });
|
|
44
|
+
}
|
|
45
|
+
return SiteIcon;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The one star the rating row repeats: its `<use>` reference into the sprite, or its glyph for the inline fallback.
|
|
49
|
+
* `RatingStars` places five of them in one `<svg>`.
|
|
50
|
+
*/
|
|
51
|
+
export function starGlyph() {
|
|
52
|
+
const sprite = iconSpriteHref();
|
|
53
|
+
return sprite ? { href: `${sprite}#star`, glyph: UI_ICON_GLYPHS.star } : { glyph: UI_ICON_GLYPHS.star };
|
|
54
|
+
}
|
|
72
55
|
//# sourceMappingURL=icons.js.map
|
package/dist/ui-kit/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/ui-kit/icons.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/ui-kit/icons.tsx"],"names":[],"mappings":";AAWA,OAAO,EACL,qBAAqB,EACrB,cAAc,GAIf,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAmB,MAAM,kBAAkB,CAAA;AAMjE;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAA;IACnD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC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I,iCAAiC,CAAC,CAAA;QAChF,OAAO,KAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAI,CAAA;IACpE,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAC/B,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,MAAM,OAAO,EAAE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,CAAA;AACzG,CAAC","sourcesContent":["/**\n * The ui-kit's icons (no icon font). Every icon is decorative (`aria-hidden`): the control around it carries the\n * accessible name. Stroke and fill use `currentColor`, so a skin colours them through its classes or tokens.\n * `data-icon` names the glyph for skins and tests.\n *\n * From 3.14.0 an icon is `<svg aria-hidden=\"true\" viewBox data-icon><use href=\"/_bl/icons.<hash>.svg#name\"/></svg>`:\n * the glyphs live once in a static, immutable sprite that `defineBrandlabNextConfig({ icons })` builds, instead of\n * once per use in the HTML and the RSC payload. Without the sprite (tests, a site that has not opted in) the same\n * `<svg>` carries the glyph inline.\n */\nimport type { UiSocialKind } from './types.js'\nimport {\n DEFAULT_ICON_VIEW_BOX,\n UI_ICON_GLYPHS,\n type IconGlyph,\n type SiteIconSet,\n type UiIconName,\n} from './icon-glyphs.js'\n\nexport { UI_ICON_NAMES, type UiIconName } from './icon-glyphs.js'\n\nexport interface IconProps {\n readonly className?: string | undefined\n}\n\n/**\n * The sprite's path when `defineBrandlabNextConfig({ icons })` built one, or undefined. Next inlines the variable into\n * the server and browser bundles, so both render the same markup.\n */\nexport function iconSpriteHref(): string | undefined {\n const href = process.env.NEXT_PUBLIC_BL_ICON_SPRITE\n return typeof href === 'string' && /^\\/[\\w./-]+\\.svg$/.test(href) ? href : undefined\n}\n\nfunction SvgIcon({ name, glyph, className }: IconProps & { name: string; glyph: IconGlyph }) {\n const viewBox = glyph.viewBox ?? DEFAULT_ICON_VIEW_BOX\n const sprite = iconSpriteHref()\n if (sprite) {\n return (\n <svg aria-hidden=\"true\" viewBox={viewBox} className={className} data-icon={name}>\n <use href={`${sprite}#${name}`} />\n </svg>\n )\n }\n // The fallback: the glyph inline. Library glyphs are constants; site glyphs passed defineSiteIcons' shape checks.\n return <svg aria-hidden=\"true\" viewBox={viewBox} className={className} data-icon={name} dangerouslySetInnerHTML={{ __html: glyph.body }} />\n}\n\n/** One icon from the library set by name. */\nexport function Icon({ name, className }: IconProps & { name: UiIconName }) {\n return <SvgIcon name={name} glyph={UI_ICON_GLYPHS[name]} className={className} />\n}\n\n/** The icon for a social or Business Profile link. */\nexport function SocialIcon({ kind, className }: IconProps & { kind: UiSocialKind }) {\n return <Icon name={kind} className={className} />\n}\n\n/**\n * The component for a site's own icons, typed on its names. The same markup as `Icon`: a `<use>` into the shared\n * sprite once the config lists the set in `icons.site`, the glyph inline otherwise.\n *\n * ```tsx\n * export const SiteIcon = createSiteIcon(siteIcons) // src/site/ui.tsx\n * <SiteIcon name=\"leaf\" />\n * ```\n */\nexport function createSiteIcon<Name extends string>(icons: SiteIconSet<Name>) {\n function SiteIcon({ name, className }: IconProps & { name: Name }) {\n const glyph = icons.glyphs[name]\n if (!glyph) throw new Error(`Site icon \"${name}\" is not in the registered set.`)\n return <SvgIcon name={name} glyph={glyph} className={className} />\n }\n return SiteIcon\n}\n\n/**\n * The one star the rating row repeats: its `<use>` reference into the sprite, or its glyph for the inline fallback.\n * `RatingStars` places five of them in one `<svg>`.\n */\nexport function starGlyph(): { readonly href?: string; readonly glyph: IconGlyph } {\n const sprite = iconSpriteHref()\n return sprite ? { href: `${sprite}#star`, glyph: UI_ICON_GLYPHS.star } : { glyph: UI_ICON_GLYPHS.star }\n}\n"]}
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* about 200 px of the viewport, so a long page of suburb, footer and map links fetched 16 to 45 pages on a full scroll
|
|
4
4
|
* while visitors read 1.0 to 1.3 pages a session. Each link role now has one setting:
|
|
5
5
|
*
|
|
6
|
-
* - `auto` (Next's default): the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - `false`: header panels, the drawer, the footer, area and suburb lists, nearby suburbs, area
|
|
12
|
-
* results, other services in this suburb and any link inside a hidden container.
|
|
6
|
+
* - `auto` (Next's default): the main quote or contact action only, and never on its own page;
|
|
7
|
+
* - `intent`: the top-level header links (7 at most, 3.15.0) and in-content service, project and blog cards (8 at
|
|
8
|
+
* most, matching K11). They render `prefetch={false}` and `data-prefetch="intent"`; `IntentPrefetch` (mounted once
|
|
9
|
+
* in the root layout) prefetches one of them when a visitor points at, focuses or touches it. Until 3.15.0 the
|
|
10
|
+
* header links prefetched in view, which at 1440 px fetched 9 or 10 pages on landing (AA);
|
|
11
|
+
* - `false`: the header logo, header panels, the drawer, the footer, area and suburb lists, nearby suburbs, area
|
|
12
|
+
* maps, suburb finder results, other services in this suburb and any link inside a hidden container.
|
|
13
|
+
*
|
|
14
|
+
* The current page is never prefetched, whatever the role: a header link to it, and a quote button on its own quote
|
|
15
|
+
* page, render `prefetch={false}`, and a link to a place on the same page (`#quote-hero`, `?page=2`) never
|
|
16
|
+
* prefetches, because Next resolves it to the current page and fetches that.
|
|
13
17
|
*
|
|
14
18
|
* The ready gate's W2 journey fails a page that prefetches more than 8 destinations on landing or 12 after a full
|
|
15
19
|
* scroll, or prefetches from an off role, a hidden link or the current page. It finds a site's own off-role
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
/** A link's prefetch setting: Next's default, on intent only, or off. */
|
|
20
24
|
export type LinkPrefetch = 'auto' | 'intent' | false;
|
|
21
25
|
export declare const LINK_PREFETCH_POLICY: Readonly<{
|
|
22
|
-
readonly headerTopLevel: "
|
|
26
|
+
readonly headerTopLevel: "intent";
|
|
23
27
|
readonly primaryAction: "auto";
|
|
24
28
|
readonly contentCard: "intent";
|
|
25
29
|
readonly headerPanel: false;
|
|
@@ -42,8 +46,13 @@ export declare const LINK_PREFETCH_LIMITS: Readonly<{
|
|
|
42
46
|
}>;
|
|
43
47
|
/** The marker `IntentPrefetch` listens for. */
|
|
44
48
|
export declare const INTENT_PREFETCH_SELECTOR = "a[data-prefetch=\"intent\"]";
|
|
45
|
-
/**
|
|
46
|
-
export declare function
|
|
49
|
+
/** True for an href that stays on the current page: a fragment (`#quote-hero`), a query only (`?page=2`) or empty. */
|
|
50
|
+
export declare function isSamePageHref(href: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The `next/link` props for a setting: nothing for `auto`, prefetch off for `false`, and off plus the marker for
|
|
53
|
+
* `intent`. Given the `href`, a link that stays on the current page is always off, without the marker.
|
|
54
|
+
*/
|
|
55
|
+
export declare function linkPrefetchProps(prefetch: LinkPrefetch | undefined, href?: string): {
|
|
47
56
|
prefetch?: false;
|
|
48
57
|
'data-prefetch'?: 'intent';
|
|
49
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetch.d.ts","sourceRoot":"","sources":["../../src/ui-kit/prefetch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prefetch.d.ts","sourceRoot":"","sources":["../../src/ui-kit/prefetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEpD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;EAaiB,CAAA;AAElD,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,oBAAoB,CAAA;AAEhE,iFAAiF;AACjF,eAAO,MAAM,oBAAoB;;;;;EAK/B,CAAA;AAEF,+CAA+C;AAC/C,eAAO,MAAM,wBAAwB,gCAA8B,CAAA;AAEnE,sHAAsH;AACtH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,eAAe,CAAC,EAAE,QAAQ,CAAA;CAAE,CAKrI"}
|
package/dist/ui-kit/prefetch.js
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* about 200 px of the viewport, so a long page of suburb, footer and map links fetched 16 to 45 pages on a full scroll
|
|
4
4
|
* while visitors read 1.0 to 1.3 pages a session. Each link role now has one setting:
|
|
5
5
|
*
|
|
6
|
-
* - `auto` (Next's default): the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - `false`: header panels, the drawer, the footer, area and suburb lists, nearby suburbs, area
|
|
12
|
-
* results, other services in this suburb and any link inside a hidden container.
|
|
6
|
+
* - `auto` (Next's default): the main quote or contact action only, and never on its own page;
|
|
7
|
+
* - `intent`: the top-level header links (7 at most, 3.15.0) and in-content service, project and blog cards (8 at
|
|
8
|
+
* most, matching K11). They render `prefetch={false}` and `data-prefetch="intent"`; `IntentPrefetch` (mounted once
|
|
9
|
+
* in the root layout) prefetches one of them when a visitor points at, focuses or touches it. Until 3.15.0 the
|
|
10
|
+
* header links prefetched in view, which at 1440 px fetched 9 or 10 pages on landing (AA);
|
|
11
|
+
* - `false`: the header logo, header panels, the drawer, the footer, area and suburb lists, nearby suburbs, area
|
|
12
|
+
* maps, suburb finder results, other services in this suburb and any link inside a hidden container.
|
|
13
|
+
*
|
|
14
|
+
* The current page is never prefetched, whatever the role: a header link to it, and a quote button on its own quote
|
|
15
|
+
* page, render `prefetch={false}`, and a link to a place on the same page (`#quote-hero`, `?page=2`) never
|
|
16
|
+
* prefetches, because Next resolves it to the current page and fetches that.
|
|
13
17
|
*
|
|
14
18
|
* The ready gate's W2 journey fails a page that prefetches more than 8 destinations on landing or 12 after a full
|
|
15
19
|
* scroll, or prefetches from an off role, a hidden link or the current page. It finds a site's own off-role
|
|
@@ -17,7 +21,7 @@
|
|
|
17
21
|
* `data-bl-links` with one of `area`, `nearby`, `map`, `finder` or `other-services` on the list's container.
|
|
18
22
|
*/
|
|
19
23
|
export const LINK_PREFETCH_POLICY = Object.freeze({
|
|
20
|
-
headerTopLevel: '
|
|
24
|
+
headerTopLevel: 'intent',
|
|
21
25
|
primaryAction: 'auto',
|
|
22
26
|
contentCard: 'intent',
|
|
23
27
|
headerPanel: false,
|
|
@@ -39,8 +43,17 @@ export const LINK_PREFETCH_LIMITS = Object.freeze({
|
|
|
39
43
|
});
|
|
40
44
|
/** The marker `IntentPrefetch` listens for. */
|
|
41
45
|
export const INTENT_PREFETCH_SELECTOR = 'a[data-prefetch="intent"]';
|
|
42
|
-
/**
|
|
43
|
-
export function
|
|
46
|
+
/** True for an href that stays on the current page: a fragment (`#quote-hero`), a query only (`?page=2`) or empty. */
|
|
47
|
+
export function isSamePageHref(href) {
|
|
48
|
+
return href === '' || href.startsWith('#') || href.startsWith('?');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The `next/link` props for a setting: nothing for `auto`, prefetch off for `false`, and off plus the marker for
|
|
52
|
+
* `intent`. Given the `href`, a link that stays on the current page is always off, without the marker.
|
|
53
|
+
*/
|
|
54
|
+
export function linkPrefetchProps(prefetch, href) {
|
|
55
|
+
if (href !== undefined && isSamePageHref(href))
|
|
56
|
+
return { prefetch: false };
|
|
44
57
|
if (prefetch === 'intent')
|
|
45
58
|
return { prefetch: false, 'data-prefetch': 'intent' };
|
|
46
59
|
if (prefetch === false)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetch.js","sourceRoot":"","sources":["../../src/ui-kit/prefetch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prefetch.js","sourceRoot":"","sources":["../../src/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KAAK,EAAE,CAAA;IAClD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["/**\n * Prefetch by link role (W2, 3.13.0). Next's default `<Link>` prefetches the whole route when the link comes within\n * about 200 px of the viewport, so a long page of suburb, footer and map links fetched 16 to 45 pages on a full scroll\n * while visitors read 1.0 to 1.3 pages a session. Each link role now has one setting:\n *\n * - `auto` (Next's default): the main quote or contact action only, and never on its own page;\n * - `intent`: the top-level header links (7 at most, 3.15.0) and in-content service, project and blog cards (8 at\n * most, matching K11). They render `prefetch={false}` and `data-prefetch=\"intent\"`; `IntentPrefetch` (mounted once\n * in the root layout) prefetches one of them when a visitor points at, focuses or touches it. Until 3.15.0 the\n * header links prefetched in view, which at 1440 px fetched 9 or 10 pages on landing (AA);\n * - `false`: the header logo, header panels, the drawer, the footer, area and suburb lists, nearby suburbs, area\n * maps, suburb finder results, other services in this suburb and any link inside a hidden container.\n *\n * The current page is never prefetched, whatever the role: a header link to it, and a quote button on its own quote\n * page, render `prefetch={false}`, and a link to a place on the same page (`#quote-hero`, `?page=2`) never\n * prefetches, because Next resolves it to the current page and fetches that.\n *\n * The ready gate's W2 journey fails a page that prefetches more than 8 destinations on landing or 12 after a full\n * scroll, or prefetches from an off role, a hidden link or the current page. It finds a site's own off-role\n * containers by the shared section ids (`coverage`, `nearby-areas`, `area-map`), the area map's `data-area-map` or\n * `data-bl-links` with one of `area`, `nearby`, `map`, `finder` or `other-services` on the list's container.\n */\n\n/** A link's prefetch setting: Next's default, on intent only, or off. */\nexport type LinkPrefetch = 'auto' | 'intent' | false\n\nexport const LINK_PREFETCH_POLICY = Object.freeze({\n headerTopLevel: 'intent',\n primaryAction: 'auto',\n contentCard: 'intent',\n headerPanel: false,\n drawer: false,\n footer: false,\n areaList: false,\n nearbySuburbs: false,\n areaMap: false,\n finderResults: false,\n otherServicesInSuburb: false,\n hiddenContainer: false,\n} as const satisfies Record<string, LinkPrefetch>)\n\nexport type LinkPrefetchRole = keyof typeof LINK_PREFETCH_POLICY\n\n/** The most links of each prefetching role on one page, and W2's page limits. */\nexport const LINK_PREFETCH_LIMITS = Object.freeze({\n headerTopLevel: 7,\n contentCard: 8,\n landingDestinations: 8,\n scrolledDestinations: 12,\n})\n\n/** The marker `IntentPrefetch` listens for. */\nexport const INTENT_PREFETCH_SELECTOR = 'a[data-prefetch=\"intent\"]'\n\n/** True for an href that stays on the current page: a fragment (`#quote-hero`), a query only (`?page=2`) or empty. */\nexport function isSamePageHref(href: string): boolean {\n return href === '' || href.startsWith('#') || href.startsWith('?')\n}\n\n/**\n * The `next/link` props for a setting: nothing for `auto`, prefetch off for `false`, and off plus the marker for\n * `intent`. Given the `href`, a link that stays on the current page is always off, without the marker.\n */\nexport function linkPrefetchProps(prefetch: LinkPrefetch | undefined, href?: string): { prefetch?: false; 'data-prefetch'?: 'intent' } {\n if (href !== undefined && isSamePageHref(href)) return { prefetch: false }\n if (prefetch === 'intent') return { prefetch: false, 'data-prefetch': 'intent' }\n if (prefetch === false) return { prefetch: false }\n return {}\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Badge` and `Chip` (3.14.0): a short label as text, never an image of text, with an optional decorative icon.
|
|
3
|
+
* Server components. A badge marks a fact ("Licensed", "Fully insured"); a chip names a filter or a tag, and is the only
|
|
4
|
+
* one a skin may make a pill (Romie, Absolute: "too many round elements").
|
|
5
|
+
*
|
|
6
|
+
* Both are rendered once per entry of a list, so their parts take no class (3.14.0 repeated slots): the site styles
|
|
7
|
+
* `[data-bl="badge"]` and `[data-bl="chip"]` once in `src/site/skin.css`.
|
|
8
|
+
*/
|
|
9
|
+
import { type UiIconName } from '../icons.js';
|
|
10
|
+
import type { RepeatedSlotOf } from '../repeated-slots.js';
|
|
11
|
+
import { type SkinEntry } from '../skin.js';
|
|
12
|
+
export type BadgeSlot = RepeatedSlotOf<'badge'>;
|
|
13
|
+
export type BadgeSkin = SkinEntry<BadgeSlot, never, Record<never, never>, BadgeSlot>;
|
|
14
|
+
export type ChipSlot = RepeatedSlotOf<'chip'>;
|
|
15
|
+
export type ChipSkin = SkinEntry<ChipSlot, never, Record<never, never>, ChipSlot>;
|
|
16
|
+
export interface BadgeProps extends BadgeSkin {
|
|
17
|
+
/** The label, in the site's words. */
|
|
18
|
+
readonly children: string;
|
|
19
|
+
/** A decorative icon before the label. */
|
|
20
|
+
readonly icon?: UiIconName;
|
|
21
|
+
}
|
|
22
|
+
export type ChipProps = BadgeProps & ChipSkin;
|
|
23
|
+
export declare function Badge({ children, icon }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function Chip({ children, icon }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/primitives/badge.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAEzD,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;AAC/C,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAA;AACpF,MAAM,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;AAC7C,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEjF,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAA;CAC3B;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAA;AAe7C,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,UAAU,2CAMnD;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,SAAS,2CAMjD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `Badge` and `Chip` (3.14.0): a short label as text, never an image of text, with an optional decorative icon.
|
|
4
|
+
* Server components. A badge marks a fact ("Licensed", "Fully insured"); a chip names a filter or a tag, and is the only
|
|
5
|
+
* one a skin may make a pill (Romie, Absolute: "too many round elements").
|
|
6
|
+
*
|
|
7
|
+
* Both are rendered once per entry of a list, so their parts take no class (3.14.0 repeated slots): the site styles
|
|
8
|
+
* `[data-bl="badge"]` and `[data-bl="chip"]` once in `src/site/skin.css`.
|
|
9
|
+
*/
|
|
10
|
+
import { Icon } from '../icons.js';
|
|
11
|
+
import { repeatedSlot } from '../skin.js';
|
|
12
|
+
function Label({ hook, children, icon }) {
|
|
13
|
+
return (_jsxs("span", { "data-bl": hook, children: [icon ? (_jsx("span", { ...repeatedSlot('icon'), children: _jsx(Icon, { name: icon }) })) : null, _jsx("span", { ...repeatedSlot('label'), children: children })] }));
|
|
14
|
+
}
|
|
15
|
+
export function Badge({ children, icon }) {
|
|
16
|
+
return (_jsx(Label, { hook: "badge", icon: icon, children: children }));
|
|
17
|
+
}
|
|
18
|
+
export function Chip({ children, icon }) {
|
|
19
|
+
return (_jsx(Label, { hook: "chip", icon: icon, children: children }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/ui-kit/primitives/badge.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAmB,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAA;AAgBzD,SAAS,KAAK,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAA+E;IAClH,OAAO,CACL,2BAAe,IAAI,aAChB,IAAI,CAAC,CAAC,CAAC,CACN,kBAAU,YAAY,CAAC,MAAM,CAAC,YAC5B,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,GACf,CACR,CAAC,CAAC,CAAC,IAAI,EACR,kBAAU,YAAY,CAAC,OAAO,CAAC,YAAG,QAAQ,GAAQ,IAC7C,CACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAc;IAClD,OAAO,CACL,KAAC,KAAK,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,IAAI,YAC3B,QAAQ,GACH,CACT,CAAA;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAa;IAChD,OAAO,CACL,KAAC,KAAK,IAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,YAC1B,QAAQ,GACH,CACT,CAAA;AACH,CAAC","sourcesContent":["/**\n * `Badge` and `Chip` (3.14.0): a short label as text, never an image of text, with an optional decorative icon.\n * Server components. A badge marks a fact (\"Licensed\", \"Fully insured\"); a chip names a filter or a tag, and is the only\n * one a skin may make a pill (Romie, Absolute: \"too many round elements\").\n *\n * Both are rendered once per entry of a list, so their parts take no class (3.14.0 repeated slots): the site styles\n * `[data-bl=\"badge\"]` and `[data-bl=\"chip\"]` once in `src/site/skin.css`.\n */\nimport { Icon, type UiIconName } from '../icons.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, type SkinEntry } from '../skin.js'\n\nexport type BadgeSlot = RepeatedSlotOf<'badge'>\nexport type BadgeSkin = SkinEntry<BadgeSlot, never, Record<never, never>, BadgeSlot>\nexport type ChipSlot = RepeatedSlotOf<'chip'>\nexport type ChipSkin = SkinEntry<ChipSlot, never, Record<never, never>, ChipSlot>\n\nexport interface BadgeProps extends BadgeSkin {\n /** The label, in the site's words. */\n readonly children: string\n /** A decorative icon before the label. */\n readonly icon?: UiIconName\n}\n\nexport type ChipProps = BadgeProps & ChipSkin\n\nfunction Label({ hook, children, icon }: { hook: 'badge' | 'chip'; children: string; icon?: UiIconName | undefined }) {\n return (\n <span data-bl={hook}>\n {icon ? (\n <span {...repeatedSlot('icon')}>\n <Icon name={icon} />\n </span>\n ) : null}\n <span {...repeatedSlot('label')}>{children}</span>\n </span>\n )\n}\n\nexport function Badge({ children, icon }: BadgeProps) {\n return (\n <Label hook=\"badge\" icon={icon}>\n {children}\n </Label>\n )\n}\n\nexport function Chip({ children, icon }: ChipProps) {\n return (\n <Label hook=\"chip\" icon={icon}>\n {children}\n </Label>\n )\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BreadcrumbItem } from '@brandlab-digital/site-core/breadcrumbs';
|
|
2
|
+
import { type Schema } from '@brandlab-digital/site-core/schema';
|
|
3
|
+
import type { BrandlabRouteBreadcrumbOutput } from '../../breadcrumbs.js';
|
|
4
|
+
import type { RepeatedSlotOf } from '../repeated-slots.js';
|
|
5
|
+
import { type SkinEntry } from '../skin.js';
|
|
6
|
+
export type BreadcrumbsSlot = 'root' | 'list' | 'item' | 'link' | 'current';
|
|
7
|
+
/** Rendered once per crumb: styled from the skin stylesheet, never by class. */
|
|
8
|
+
export type BreadcrumbsRepeatedSlot = RepeatedSlotOf<'breadcrumbs'>;
|
|
9
|
+
export type BreadcrumbsSkin = SkinEntry<BreadcrumbsSlot, never, Record<never, never>, BreadcrumbsRepeatedSlot>;
|
|
10
|
+
/** The breadcrumb landmark's accessible name. Locked. */
|
|
11
|
+
export declare const BREADCRUMBS_LABEL = "Breadcrumb";
|
|
12
|
+
/** A trail with the site's URL, for a page without a route catalogue. */
|
|
13
|
+
export interface BreadcrumbTrail {
|
|
14
|
+
readonly items: readonly BreadcrumbItem[];
|
|
15
|
+
/** The site's origin, for example `https://www.aatreeservices.com.au`. */
|
|
16
|
+
readonly siteUrl: string;
|
|
17
|
+
}
|
|
18
|
+
export interface BreadcrumbsProps extends BreadcrumbsSkin {
|
|
19
|
+
/** The route lineage's output (`createRouteBreadcrumbOutput`) or a trail with the site's URL. Home first. */
|
|
20
|
+
readonly trail: BrandlabRouteBreadcrumbOutput | BreadcrumbTrail;
|
|
21
|
+
/** Opt in to writing the `BreadcrumbList` JSON-LD beside the trail. Off by default: the page's schema builder emits it (F14). */
|
|
22
|
+
readonly jsonLd?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** The `BreadcrumbList` for a trail: the route output's own, or one built from the trail and the site's URL. */
|
|
25
|
+
export declare function breadcrumbsSchema(trail: BreadcrumbsProps['trail']): Schema<unknown>;
|
|
26
|
+
export declare function Breadcrumbs({ trail, jsonLd, classes }: BreadcrumbsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
27
|
+
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/ui-kit/primitives/breadcrumbs.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAE7E,OAAO,EAA2C,KAAK,MAAM,EAAE,MAAM,oCAAoC,CAAA;AACzG,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAA;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAE/D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAC3E,gFAAgF;AAChF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAA;AACnE,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,uBAAuB,CAAC,CAAA;AAE9G,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAE7C,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAA;IACzC,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,6GAA6G;IAC7G,QAAQ,CAAC,KAAK,EAAE,6BAA6B,GAAG,eAAe,CAAA;IAC/D,iIAAiI;IACjI,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAC1B;AAMD,gHAAgH;AAChH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAGnF;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAc,EAAE,OAAO,EAAE,EAAE,gBAAgB,kDA4B/E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* `Breadcrumbs` (F11, 3.14.0): the visible trail and its `BreadcrumbList` JSON-LD from one source. Server component.
|
|
4
|
+
* A `nav` named "Breadcrumb" (locked) holding an ordered list; earlier crumbs are links with prefetch off, the current
|
|
5
|
+
* page is plain text with `aria-current="page"`. The list is lean: no separator elements and no icons, so a long trail
|
|
6
|
+
* costs a few bytes per crumb. The separator is drawn by `structure.css` (a `/` with empty alternative text), which a
|
|
7
|
+
* skin may restyle on `[data-bl='breadcrumbs'] [data-slot='item'] + [data-slot='item']::before`.
|
|
8
|
+
*
|
|
9
|
+
* Components never write JSON-LD (F14): the page's schema builder emits the `BreadcrumbList`, so `jsonLd` is off by
|
|
10
|
+
* default. `breadcrumbsSchema(trail)` gives the page the matching schema from the same trail, through the site-core
|
|
11
|
+
* builders (`buildBreadcrumbListSchema`), either from a route lineage (`createRouteBreadcrumbOutput`, which also checks
|
|
12
|
+
* the two agree) or from a trail and the site's URL. A page without its own emitter may opt in with `jsonLd`. The
|
|
13
|
+
* trail is checked either way, so a bad trail fails the build whether or not the JSON-LD is written here.
|
|
14
|
+
*/
|
|
15
|
+
import Link from 'next/link';
|
|
16
|
+
import { getAbsoluteUrl } from '@brandlab-digital/site-core/metadata';
|
|
17
|
+
import { buildBreadcrumbListSchema, createSchema } from '@brandlab-digital/site-core/schema';
|
|
18
|
+
import { SchemaScript } from '../../schema.js';
|
|
19
|
+
import { repeatedSlot, slot } from '../skin.js';
|
|
20
|
+
/** The breadcrumb landmark's accessible name. Locked. */
|
|
21
|
+
export const BREADCRUMBS_LABEL = 'Breadcrumb';
|
|
22
|
+
function isRouteOutput(trail) {
|
|
23
|
+
return 'schema' in trail;
|
|
24
|
+
}
|
|
25
|
+
/** The `BreadcrumbList` for a trail: the route output's own, or one built from the trail and the site's URL. */
|
|
26
|
+
export function breadcrumbsSchema(trail) {
|
|
27
|
+
if (isRouteOutput(trail))
|
|
28
|
+
return trail.schema;
|
|
29
|
+
return createSchema(buildBreadcrumbListSchema([...trail.items], { absoluteUrl: (path) => getAbsoluteUrl(trail.siteUrl, path) }));
|
|
30
|
+
}
|
|
31
|
+
export function Breadcrumbs({ trail, jsonLd = false, classes }) {
|
|
32
|
+
const items = trail.items;
|
|
33
|
+
if (items.length === 0)
|
|
34
|
+
return null;
|
|
35
|
+
// Built even when not written, so a trail Google would reject fails here too.
|
|
36
|
+
const schema = breadcrumbsSchema(trail);
|
|
37
|
+
const last = items.length - 1;
|
|
38
|
+
return (_jsxs(_Fragment, { children: [_jsx("nav", { "aria-label": BREADCRUMBS_LABEL, "data-bl": "breadcrumbs", className: classes?.root, children: _jsx("ol", { ...slot(classes, 'list'), children: items.map((item, index) => (_jsx("li", { ...repeatedSlot('item'), children: index < last && item.href ? (_jsx(Link, { href: item.href, prefetch: false, ...repeatedSlot('link'), children: item.name })) : (_jsx("span", { ...repeatedSlot('current'), "aria-current": index === last ? 'page' : undefined, children: item.name })) }, `${item.href ?? 'current'}:${item.name}`))) }) }), jsonLd ? _jsx(SchemaScript, { id: "breadcrumbs", schema: schema }) : null] }));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../../src/ui-kit/primitives/breadcrumbs.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAe,MAAM,oCAAoC,CAAA;AAEzG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AAO/D,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAA;AAgB7C,SAAS,aAAa,CAAC,KAAgC;IACrD,OAAO,QAAQ,IAAI,KAAK,CAAA;AAC1B,CAAC;AAED,gHAAgH;AAChH,MAAM,UAAU,iBAAiB,CAAC,KAAgC;IAChE,IAAI,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,CAAA;IAC7C,OAAO,YAAY,CAAC,yBAAyB,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,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AAY,IAAC,EAAE,EAAC,aAAa,EAAC,MAAM,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,IACjE,CACJ,CAAA;AACH,CAAC","sourcesContent":["/**\n * `Breadcrumbs` (F11, 3.14.0): the visible trail and its `BreadcrumbList` JSON-LD from one source. Server component.\n * A `nav` named \"Breadcrumb\" (locked) holding an ordered list; earlier crumbs are links with prefetch off, the current\n * page is plain text with `aria-current=\"page\"`. The list is lean: no separator elements and no icons, so a long trail\n * costs a few bytes per crumb. The separator is drawn by `structure.css` (a `/` with empty alternative text), which a\n * skin may restyle on `[data-bl='breadcrumbs'] [data-slot='item'] + [data-slot='item']::before`.\n *\n * Components never write JSON-LD (F14): the page's schema builder emits the `BreadcrumbList`, so `jsonLd` is off by\n * default. `breadcrumbsSchema(trail)` gives the page the matching schema from the same trail, through the site-core\n * builders (`buildBreadcrumbListSchema`), either from a route lineage (`createRouteBreadcrumbOutput`, which also checks\n * the two agree) or from a trail and the site's URL. A page without its own emitter may opt in with `jsonLd`. The\n * trail is checked either way, so a bad trail fails the build whether or not the JSON-LD is written here.\n */\nimport Link from 'next/link'\nimport type { BreadcrumbItem } from '@brandlab-digital/site-core/breadcrumbs'\nimport { getAbsoluteUrl } from '@brandlab-digital/site-core/metadata'\nimport { buildBreadcrumbListSchema, createSchema, type Schema } from '@brandlab-digital/site-core/schema'\nimport type { BrandlabRouteBreadcrumbOutput } from '../../breadcrumbs.js'\nimport { SchemaScript } from '../../schema.js'\nimport type { RepeatedSlotOf } from '../repeated-slots.js'\nimport { repeatedSlot, slot, type SkinEntry } from '../skin.js'\n\nexport type BreadcrumbsSlot = 'root' | 'list' | 'item' | 'link' | 'current'\n/** Rendered once per crumb: styled from the skin stylesheet, never by class. */\nexport type BreadcrumbsRepeatedSlot = RepeatedSlotOf<'breadcrumbs'>\nexport type BreadcrumbsSkin = SkinEntry<BreadcrumbsSlot, never, Record<never, never>, BreadcrumbsRepeatedSlot>\n\n/** The breadcrumb landmark's accessible name. Locked. */\nexport const BREADCRUMBS_LABEL = 'Breadcrumb'\n\n/** A trail with the site's URL, for a page without a route catalogue. */\nexport interface BreadcrumbTrail {\n readonly items: readonly BreadcrumbItem[]\n /** The site's origin, for example `https://www.aatreeservices.com.au`. */\n readonly siteUrl: string\n}\n\nexport interface BreadcrumbsProps extends BreadcrumbsSkin {\n /** The route lineage's output (`createRouteBreadcrumbOutput`) or a trail with the site's URL. Home first. */\n readonly trail: BrandlabRouteBreadcrumbOutput | BreadcrumbTrail\n /** Opt in to writing the `BreadcrumbList` JSON-LD beside the trail. Off by default: the page's schema builder emits it (F14). */\n readonly jsonLd?: boolean\n}\n\nfunction isRouteOutput(trail: BreadcrumbsProps['trail']): trail is BrandlabRouteBreadcrumbOutput {\n return 'schema' in trail\n}\n\n/** The `BreadcrumbList` for a trail: the route output's own, or one built from the trail and the site's URL. */\nexport function breadcrumbsSchema(trail: BreadcrumbsProps['trail']): Schema<unknown> {\n if (isRouteOutput(trail)) return trail.schema\n return createSchema(buildBreadcrumbListSchema([...trail.items], { absoluteUrl: (path) => getAbsoluteUrl(trail.siteUrl, path) }))\n}\n\nexport function Breadcrumbs({ trail, jsonLd = false, classes }: BreadcrumbsProps) {\n const items = trail.items\n if (items.length === 0) return null\n // Built even when not written, so a trail Google would reject fails here too.\n const schema = breadcrumbsSchema(trail)\n const last = items.length - 1\n return (\n <>\n <nav aria-label={BREADCRUMBS_LABEL} data-bl=\"breadcrumbs\" className={classes?.root}>\n <ol {...slot(classes, 'list')}>\n {items.map((item, index) => (\n <li key={`${item.href ?? 'current'}:${item.name}`} {...repeatedSlot('item')}>\n {index < last && item.href ? (\n <Link href={item.href} prefetch={false} {...repeatedSlot('link')}>\n {item.name}\n </Link>\n ) : (\n <span {...repeatedSlot('current')} aria-current={index === last ? 'page' : undefined}>\n {item.name}\n </span>\n )}\n </li>\n ))}\n </ol>\n </nav>\n {jsonLd ? <SchemaScript id=\"breadcrumbs\" schema={schema} /> : null}\n </>\n )\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Button` (3.14.0): an action on the page, as distinct from `ButtonLink`, which goes somewhere. A real `<button>`
|
|
3
|
+
* (default `type="button"`) with the same `data-bl="button"` hook, variants and sizes as `ButtonLink`, so one skin
|
|
4
|
+
* stylesheet rule and the shared 44 px minimum cover both; `button[data-bl='button']` tells them apart. Server
|
|
5
|
+
* component. It takes no event props: a form submits it, or a client island finds it by its `action` hook
|
|
6
|
+
* (`data-bl-action`) and listens there. `disabled` is the native attribute, so it is announced.
|
|
7
|
+
*/
|
|
8
|
+
import type { ReactNode } from 'react';
|
|
9
|
+
import { type UiIconName } from '../icons.js';
|
|
10
|
+
import { type SkinEntry } from '../skin.js';
|
|
11
|
+
import type { ButtonVariant } from './links.js';
|
|
12
|
+
export type ButtonSlot = 'root' | 'label' | 'icon';
|
|
13
|
+
export type ButtonSkin = SkinEntry<ButtonSlot, ButtonVariant, {
|
|
14
|
+
size?: 'regular' | 'large';
|
|
15
|
+
}>;
|
|
16
|
+
export interface ButtonProps extends ButtonSkin {
|
|
17
|
+
readonly children: ReactNode;
|
|
18
|
+
/** `button` by default; `submit` inside a form. */
|
|
19
|
+
readonly type?: 'button' | 'submit' | 'reset';
|
|
20
|
+
/** An icon after the label (`arrow`) or before it (`phone`). */
|
|
21
|
+
readonly icon?: UiIconName;
|
|
22
|
+
readonly iconPosition?: 'start' | 'end';
|
|
23
|
+
readonly disabled?: boolean;
|
|
24
|
+
/** The form field name and value it submits, and the id of a form outside it that it submits. */
|
|
25
|
+
readonly name?: string;
|
|
26
|
+
readonly value?: string;
|
|
27
|
+
readonly form?: string;
|
|
28
|
+
/** A stable name a client island listens for, rendered as `data-bl-action` (for example `show-more`). */
|
|
29
|
+
readonly action?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function Button({ children, type, icon, iconPosition, disabled, name, value, form, action, variant, layout, classes, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
//#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pB,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,OAAmB,EACnB,MAAM,EACN,OAAO,GACR,EAAE,WAAW,2CAoBb"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../icons.js';
|
|
3
|
+
import { slot } from '../skin.js';
|
|
4
|
+
export function Button({ children, type = 'button', icon, iconPosition = 'end', disabled, name, value, form, action, variant = 'primary', layout, classes, }) {
|
|
5
|
+
const iconNode = icon ? _jsx("span", { ...slot(classes, 'icon'), children: _jsx(Icon, { name: icon }) }) : null;
|
|
6
|
+
return (_jsxs("button", { type: type, name: name, value: value, form: form, disabled: disabled, "data-bl": "button", "data-variant": variant, "data-size": layout?.size ?? 'regular', "data-bl-action": action, className: classes?.root, children: [iconPosition === 'start' ? iconNode : null, _jsx("span", { ...slot(classes, 'label'), children: children }), iconPosition === 'end' ? iconNode : null] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=button.js.map
|