@sinnstack/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/README.md +6 -4
- package/docs/blocks.md +373 -364
- package/docs/data.md +128 -128
- package/docs/finishes.md +165 -0
- package/docs/primitives.md +4 -4
- package/docs/seo.md +191 -187
- package/package.json +15 -24
- package/src/blocks/BlockRenderer.astro +13 -7
- package/src/blocks/CTABanner.astro +8 -8
- package/src/blocks/CTAPair.astro +9 -9
- package/src/blocks/CardGrid.astro +7 -7
- package/src/blocks/ConsentEmbed.astro +1 -1
- package/src/blocks/ConsentManager.astro +1 -1
- package/src/blocks/ContactCard.astro +14 -14
- package/src/blocks/ContactForm.astro +4 -4
- package/src/blocks/ErrorPage.astro +1 -1
- package/src/blocks/FAQ.astro +9 -9
- package/src/blocks/FeatureGrid.astro +7 -7
- package/src/blocks/Hero.astro +11 -11
- package/src/blocks/HeroCarousel.astro +11 -11
- package/src/blocks/HighlightCards.astro +10 -10
- package/src/blocks/LocationHours.astro +14 -14
- package/src/blocks/LogoCloud.astro +7 -7
- package/src/blocks/MaintenancePage.astro +8 -3
- package/src/blocks/MediaText.astro +12 -12
- package/src/blocks/PageHeader.astro +9 -9
- package/src/blocks/ProseSection.astro +8 -8
- package/src/blocks/Reviews.astro +11 -11
- package/src/blocks/RichText.astro +58 -57
- package/src/blocks/StatsBand.astro +117 -117
- package/src/blocks/Steps.astro +9 -9
- package/src/blocks/Testimonials.astro +13 -13
- package/src/blocks/cms/card-grid.ts +48 -80
- package/src/blocks/cms/consent.ts +1 -30
- package/src/blocks/cms/contact-card.ts +4 -46
- package/src/blocks/cms/contact-form.ts +2 -20
- package/src/blocks/cms/cta-banner.ts +2 -23
- package/src/blocks/cms/cta-pair.ts +4 -37
- package/src/blocks/cms/data-base.ts +2 -4
- package/src/blocks/cms/data.ts +19 -19
- package/src/blocks/cms/faq.ts +4 -36
- package/src/blocks/cms/feature-grid.ts +47 -80
- package/src/blocks/cms/fixtures.ts +591 -599
- package/src/blocks/cms/hero-carousel.ts +4 -48
- package/src/blocks/cms/hero.ts +2 -46
- package/src/blocks/cms/highlight-cards.ts +4 -39
- package/src/blocks/cms/images.ts +1 -2
- package/src/blocks/cms/index.ts +59 -87
- package/src/blocks/cms/location-hours.ts +3 -85
- package/src/blocks/cms/logo-cloud.ts +36 -62
- package/src/blocks/cms/media-text.ts +2 -20
- package/src/blocks/cms/page-header.ts +27 -49
- package/src/blocks/cms/pages.ts +35 -81
- package/src/blocks/cms/prose-section.ts +2 -22
- package/src/blocks/cms/reviews.ts +5 -56
- package/src/blocks/cms/schema-dsl.ts +134 -0
- package/src/blocks/cms/schema.ts +794 -0
- package/src/blocks/cms/shared.ts +63 -115
- package/src/blocks/cms/stats-band.ts +35 -61
- package/src/blocks/cms/steps.ts +4 -31
- package/src/blocks/cms/testimonials.ts +4 -38
- package/src/blocks/cms/topbar.ts +4 -41
- package/src/blocks/cms/types.ts +1 -37
- package/src/blocks/consent.ts +2 -2
- package/src/blocks/index.ts +2 -2
- package/src/blocks/internal/Actions.astro +11 -5
- package/src/blocks/internal/BlockHeader.astro +7 -7
- package/src/blocks/internal/Placeholder.astro +3 -3
- package/src/blocks/internal/fields.ts +18 -0
- package/src/blocks/internal/registry-contract.ts +67 -0
- package/src/blocks/internal/util.ts +4 -4
- package/src/blocks/lib/contact.ts +10 -4
- package/src/blocks/lib/faq.ts +1 -1
- package/src/blocks/lib/markdown.ts +350 -0
- package/src/blocks/lib/rich-text.ts +132 -143
- package/src/blocks/scripts/consent-manager.ts +1 -1
- package/src/blocks/scripts/consent-store.ts +1 -1
- package/src/blocks/scripts/hours.ts +3 -2
- package/src/blocks/types.ts +33 -23
- package/src/data/ChartContainer.astro +2 -1
- package/src/data/cms.ts +130 -190
- package/src/data/lib/chart.ts +13 -4
- package/src/data/schema.ts +65 -0
- package/src/finishes/aurora.css +75 -0
- package/src/finishes/autumn.css +87 -0
- package/src/finishes/blueprint.css +69 -0
- package/src/finishes/brutalist.css +55 -0
- package/src/finishes/clay.css +48 -0
- package/src/finishes/day-cycle.css +46 -0
- package/src/finishes/fog.css +71 -0
- package/src/finishes/glass.css +149 -0
- package/src/finishes/holographic.css +91 -0
- package/src/finishes/night.css +77 -0
- package/src/finishes/paper.css +58 -0
- package/src/finishes/polished-glass.css +159 -0
- package/src/finishes/rain.css +84 -0
- package/src/finishes/scripts/day-cycle.ts +30 -0
- package/src/finishes/scripts/holographic.ts +37 -0
- package/src/finishes/scripts/spotlight.ts +30 -0
- package/src/finishes/spotlight.css +41 -0
- package/src/finishes/spring.css +80 -0
- package/src/finishes/terminal.css +49 -0
- package/src/primitives/Divider.astro +1 -1
- package/src/primitives/FocusRing.astro +1 -1
- package/src/primitives/FormField.astro +2 -2
- package/src/primitives/Image.astro +3 -3
- package/src/primitives/Input.astro +4 -2
- package/src/primitives/MetricCard.astro +3 -1
- package/src/primitives/Picture.astro +3 -3
- package/src/primitives/Prose.astro +1 -1
- package/src/primitives/Select.astro +4 -2
- package/src/primitives/Slider.astro +1 -1
- package/src/primitives/Table.astro +1 -1
- package/src/primitives/Textarea.astro +4 -2
- package/src/primitives/Thumbnail.astro +2 -2
- package/src/primitives/index.ts +4 -4
- package/src/primitives/internal/ChoiceField.astro +4 -2
- package/src/primitives/scripts/slider.ts +1 -1
- package/src/primitives/scripts/table-sort.ts +2 -2
- package/src/seo/cms.ts +59 -80
- package/src/seo/index.ts +1 -1
- package/src/seo/integration.ts +40 -3
- package/src/seo/lib/jsonld.ts +10 -2
- package/src/seo/lib/meta.ts +2 -2
- package/src/seo/lib/redirects.ts +14 -4
- package/src/seo/lib/rss.ts +1 -1
- package/src/seo/lib/sitemap.ts +1 -1
- package/src/seo/schema.ts +43 -0
- package/src/blocks/internal/tina.ts +0 -19
- /package/src/blocks/{lib → internal}/consent.ts +0 -0
- /package/src/blocks/{lib → internal}/reviews.ts +0 -0
- /package/src/blocks/{lib → internal}/slug.ts +0 -0
- /package/src/data/{lib → internal}/scale.ts +0 -0
- /package/src/primitives/{lib → internal}/image-plan.ts +0 -0
- /package/src/primitives/{lib → internal}/image.ts +0 -0
- /package/src/primitives/{lib → internal}/slider.ts +0 -0
- /package/src/seo/{lib → internal}/url.ts +0 -0
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* StatsBand: a few headline figures in a band ("100 Lighthouse score · 24-hour support ·
|
|
4
|
-
* 60 years of experience · 15 counties served"), optionally over a photo under a color wash.
|
|
5
|
-
*
|
|
6
|
-
* - The figures are real text in a `<dl>` (label = term, value = description; the value is shown
|
|
7
|
-
* above its label). Never count up from 0 with JavaScript: crawlers, screenshots, no-JS and
|
|
8
|
-
* reduced-motion visitors would read zeros.
|
|
9
|
-
* - A strong surface in `tone` (default `accent`): text, icons and focus rings recolor themselves.
|
|
10
|
-
* With `image`, the photo sits under that color at 88% (`--sinn-stats-wash` changes it); keep it
|
|
11
|
-
* high, since text contrast over a photo can't be measured.
|
|
12
|
-
* - No visible heading by default: pass `label` to name the section for screen readers, or
|
|
13
|
-
* `heading` to show one (then `headingLevel`).
|
|
14
|
-
* - 2 to 6 items; they wrap to as many columns as fit (each at least 11rem).
|
|
15
|
-
* - Placeholder: no item with a value and label → dashed placeholder in dev/CMS preview.
|
|
16
|
-
*
|
|
17
|
-
* Use it for marketing figures. For dashboard metrics with deltas and formats, use MetricCard.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* <StatsBand label="At a glance" image={{ src: band, alt: '' }} items={[
|
|
21
|
-
* { value: '24', label: 'Hours a day' }, { value: '15', label: 'Counties served' },
|
|
22
|
-
* ]} />
|
|
23
|
-
*/
|
|
24
|
-
import Container from '../primitives/Container.astro';
|
|
25
|
-
import Heading from '../primitives/Heading.astro';
|
|
26
|
-
import Image from '../primitives/Image.astro';
|
|
27
|
-
import type { HTMLAttributes } from 'astro/types';
|
|
28
|
-
import type { BlockProps, HeadingLevelNumber, ImageSource, StatItem } from './types';
|
|
29
|
-
import Placeholder from './internal/Placeholder.astro';
|
|
30
|
-
import { blockIcons } from './icons';
|
|
31
|
-
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
32
|
-
import {
|
|
33
|
-
import './styles/blocks.css';
|
|
34
|
-
|
|
35
|
-
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
36
|
-
Omit<BlockProps, 'background'> & {
|
|
37
|
-
items?: StatItem[];
|
|
38
|
-
/** Optional visible heading. */
|
|
39
|
-
heading?: string;
|
|
40
|
-
headingLevel?: HeadingLevelNumber;
|
|
41
|
-
/** Accessible name when there's no visible heading ("At a glance"). */
|
|
42
|
-
label?: string;
|
|
43
|
-
/** Background photo (decorative; alt is ignored). */
|
|
44
|
-
image?: ImageSource;
|
|
45
|
-
/** Icon set for `items[].icon`. */
|
|
46
|
-
icons?: Record<string, string>;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const {
|
|
50
|
-
items = [],
|
|
51
|
-
heading,
|
|
52
|
-
headingLevel = 2,
|
|
53
|
-
label,
|
|
54
|
-
image,
|
|
55
|
-
icons = blockIcons as Record<string, string>,
|
|
56
|
-
tone = 'accent',
|
|
57
|
-
align = 'center',
|
|
58
|
-
anchor,
|
|
59
|
-
spacing = 'xl',
|
|
60
|
-
scheme,
|
|
61
|
-
containerSize = 'default',
|
|
62
|
-
placeholder = PLACEHOLDER_DEFAULT,
|
|
63
|
-
|
|
64
|
-
id,
|
|
65
|
-
class: className,
|
|
66
|
-
...rest
|
|
67
|
-
} = Astro.props;
|
|
68
|
-
|
|
69
|
-
const stats = (items ?? []).filter((s) => s && String(s.value ?? '').trim() && String(s.label ?? '').trim()).slice(0, 6);
|
|
70
|
-
const { sectionId, headingId } = blockIds('stats', anchor, id);
|
|
71
|
-
const hasHeading = Boolean(heading?.trim());
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
{
|
|
75
|
-
stats.length === 0 ? (
|
|
76
|
-
placeholder && <Placeholder label="Stats band" hint="Add at least one figure with a value and a label."
|
|
77
|
-
) : (
|
|
78
|
-
<section
|
|
79
|
-
id={sectionId}
|
|
80
|
-
class:list={['sinn-block', 'sinn-stats', className]}
|
|
81
|
-
aria-labelledby={hasHeading ? headingId : undefined}
|
|
82
|
-
aria-label={!hasHeading && label ? label : undefined}
|
|
83
|
-
data-surface="strong"
|
|
84
|
-
data-tone={tone}
|
|
85
|
-
data-spacing={spacing === 'l' ? undefined : spacing}
|
|
86
|
-
data-scheme={scheme}
|
|
87
|
-
data-align={align === 'center' ? 'center' : undefined}
|
|
88
|
-
data-has-image={image ? '' : undefined}
|
|
89
|
-
{...
|
|
90
|
-
{...rest}
|
|
91
|
-
>
|
|
92
|
-
{image && (
|
|
93
|
-
<div class="sinn-stats__bg" aria-hidden="true" {...
|
|
94
|
-
<Image src={image.src} alt="" width={image.width} height={image.height} layout="full" sizes="100vw" placeholder={false} />
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
97
|
-
<Container size={containerSize} class="sinn-block__container" query={false}>
|
|
98
|
-
{hasHeading && (
|
|
99
|
-
<Heading level={headingLevel} size="2xl" weight="bold" id={headingId} class="sinn-stats__title" {...
|
|
100
|
-
{heading}
|
|
101
|
-
</Heading>
|
|
102
|
-
)}
|
|
103
|
-
<dl class="sinn-stats__list" data-count={stats.length} {...
|
|
104
|
-
{stats.map((s, i) => (
|
|
105
|
-
<div class="sinn-stats__item" {...
|
|
106
|
-
<dt class="sinn-stats__label" {...
|
|
107
|
-
<dd class="sinn-stats__value">
|
|
108
|
-
{s.icon && icons
|
|
109
|
-
<span {...
|
|
110
|
-
</dd>
|
|
111
|
-
</div>
|
|
112
|
-
))}
|
|
113
|
-
</dl>
|
|
114
|
-
</Container>
|
|
115
|
-
</section>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* StatsBand: a few headline figures in a band ("100 Lighthouse score · 24-hour support ·
|
|
4
|
+
* 60 years of experience · 15 counties served"), optionally over a photo under a color wash.
|
|
5
|
+
*
|
|
6
|
+
* - The figures are real text in a `<dl>` (label = term, value = description; the value is shown
|
|
7
|
+
* above its label). Never count up from 0 with JavaScript: crawlers, screenshots, no-JS and
|
|
8
|
+
* reduced-motion visitors would read zeros.
|
|
9
|
+
* - A strong surface in `tone` (default `accent`): text, icons and focus rings recolor themselves.
|
|
10
|
+
* With `image`, the photo sits under that color at 88% (`--sinn-stats-wash` changes it); keep it
|
|
11
|
+
* high, since text contrast over a photo can't be measured.
|
|
12
|
+
* - No visible heading by default: pass `label` to name the section for screen readers, or
|
|
13
|
+
* `heading` to show one (then `headingLevel`).
|
|
14
|
+
* - 2 to 6 items; they wrap to as many columns as fit (each at least 11rem).
|
|
15
|
+
* - Placeholder: no item with a value and label → dashed placeholder in dev/CMS preview.
|
|
16
|
+
*
|
|
17
|
+
* Use it for marketing figures. For dashboard metrics with deltas and formats, use MetricCard.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <StatsBand label="At a glance" image={{ src: band, alt: '' }} items={[
|
|
21
|
+
* { value: '24', label: 'Hours a day' }, { value: '15', label: 'Counties served' },
|
|
22
|
+
* ]} />
|
|
23
|
+
*/
|
|
24
|
+
import Container from '../primitives/Container.astro';
|
|
25
|
+
import Heading from '../primitives/Heading.astro';
|
|
26
|
+
import Image from '../primitives/Image.astro';
|
|
27
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
28
|
+
import type { BlockProps, HeadingLevelNumber, ImageSource, StatItem } from './types';
|
|
29
|
+
import Placeholder from './internal/Placeholder.astro';
|
|
30
|
+
import { blockIcons } from './icons';
|
|
31
|
+
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
32
|
+
import { sf, joinField } from './internal/fields';
|
|
33
|
+
import './styles/blocks.css';
|
|
34
|
+
|
|
35
|
+
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
36
|
+
Omit<BlockProps, 'background'> & {
|
|
37
|
+
items?: StatItem[];
|
|
38
|
+
/** Optional visible heading. */
|
|
39
|
+
heading?: string;
|
|
40
|
+
headingLevel?: HeadingLevelNumber;
|
|
41
|
+
/** Accessible name when there's no visible heading ("At a glance"). */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Background photo (decorative; alt is ignored). */
|
|
44
|
+
image?: ImageSource;
|
|
45
|
+
/** Icon set for `items[].icon`. */
|
|
46
|
+
icons?: Record<string, string>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
items = [],
|
|
51
|
+
heading,
|
|
52
|
+
headingLevel = 2,
|
|
53
|
+
label,
|
|
54
|
+
image,
|
|
55
|
+
icons = blockIcons as Record<string, string>,
|
|
56
|
+
tone = 'accent',
|
|
57
|
+
align = 'center',
|
|
58
|
+
anchor,
|
|
59
|
+
spacing = 'xl',
|
|
60
|
+
scheme,
|
|
61
|
+
containerSize = 'default',
|
|
62
|
+
placeholder = PLACEHOLDER_DEFAULT,
|
|
63
|
+
fieldPath,
|
|
64
|
+
id,
|
|
65
|
+
class: className,
|
|
66
|
+
...rest
|
|
67
|
+
} = Astro.props;
|
|
68
|
+
|
|
69
|
+
const stats = (items ?? []).filter((s) => s && String(s.value ?? '').trim() && String(s.label ?? '').trim()).slice(0, 6);
|
|
70
|
+
const { sectionId, headingId } = blockIds('stats', anchor, id);
|
|
71
|
+
const hasHeading = Boolean(heading?.trim());
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
stats.length === 0 ? (
|
|
76
|
+
placeholder && <Placeholder label="Stats band" hint="Add at least one figure with a value and a label." field={joinField(fieldPath, 'items')} />
|
|
77
|
+
) : (
|
|
78
|
+
<section
|
|
79
|
+
id={sectionId}
|
|
80
|
+
class:list={['sinn-block', 'sinn-stats', className]}
|
|
81
|
+
aria-labelledby={hasHeading ? headingId : undefined}
|
|
82
|
+
aria-label={!hasHeading && label ? label : undefined}
|
|
83
|
+
data-surface="strong"
|
|
84
|
+
data-tone={tone}
|
|
85
|
+
data-spacing={spacing === 'l' ? undefined : spacing}
|
|
86
|
+
data-scheme={scheme}
|
|
87
|
+
data-align={align === 'center' ? 'center' : undefined}
|
|
88
|
+
data-has-image={image ? '' : undefined}
|
|
89
|
+
{...sf(fieldPath)}
|
|
90
|
+
{...rest}
|
|
91
|
+
>
|
|
92
|
+
{image && (
|
|
93
|
+
<div class="sinn-stats__bg" aria-hidden="true" {...sf(fieldPath, 'image')}>
|
|
94
|
+
<Image src={image.src} alt="" width={image.width} height={image.height} layout="full" sizes="100vw" placeholder={false} />
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
<Container size={containerSize} class="sinn-block__container" query={false}>
|
|
98
|
+
{hasHeading && (
|
|
99
|
+
<Heading level={headingLevel} size="2xl" weight="bold" id={headingId} class="sinn-stats__title" {...sf(fieldPath, 'heading')}>
|
|
100
|
+
{heading}
|
|
101
|
+
</Heading>
|
|
102
|
+
)}
|
|
103
|
+
<dl class="sinn-stats__list" data-count={stats.length} {...sf(fieldPath, 'items')}>
|
|
104
|
+
{stats.map((s, i) => (
|
|
105
|
+
<div class="sinn-stats__item" {...sf(fieldPath, s.field)}>
|
|
106
|
+
<dt class="sinn-stats__label" {...sf(fieldPath, s.field, 'label')}>{s.label}</dt>
|
|
107
|
+
<dd class="sinn-stats__value">
|
|
108
|
+
{s.icon && Object.hasOwn(icons, s.icon) && <span class="sinn-stats__icon" aria-hidden="true" set:html={icons[s.icon]} />}
|
|
109
|
+
<span {...sf(fieldPath, s.field, 'value')}>{s.value}</span>
|
|
110
|
+
</dd>
|
|
111
|
+
</div>
|
|
112
|
+
))}
|
|
113
|
+
</dl>
|
|
114
|
+
</Container>
|
|
115
|
+
</section>
|
|
116
|
+
)
|
|
117
|
+
}
|
package/src/blocks/Steps.astro
CHANGED
|
@@ -28,7 +28,7 @@ import BlockHeader from './internal/BlockHeader.astro';
|
|
|
28
28
|
import Placeholder from './internal/Placeholder.astro';
|
|
29
29
|
import { blockIcons } from './icons';
|
|
30
30
|
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
31
|
-
import {
|
|
31
|
+
import { sf, joinField } from './internal/fields';
|
|
32
32
|
import { renameProp, renameValue } from '../primitives/lib/deprecate';
|
|
33
33
|
|
|
34
34
|
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
@@ -73,7 +73,7 @@ const {
|
|
|
73
73
|
scheme,
|
|
74
74
|
containerSize = 'default',
|
|
75
75
|
placeholder = PLACEHOLDER_DEFAULT,
|
|
76
|
-
|
|
76
|
+
fieldPath,
|
|
77
77
|
id,
|
|
78
78
|
class: className,
|
|
79
79
|
...rest
|
|
@@ -94,7 +94,7 @@ const iconFor = (name?: string) => {
|
|
|
94
94
|
|
|
95
95
|
{
|
|
96
96
|
steps.length === 0 ? (
|
|
97
|
-
placeholder && <Placeholder label="Steps" hint="Add at least one step."
|
|
97
|
+
placeholder && <Placeholder label="Steps" hint="Add at least one step." field={joinField(fieldPath, 'items')} />
|
|
98
98
|
) : (
|
|
99
99
|
<BlockShell
|
|
100
100
|
name="steps"
|
|
@@ -111,25 +111,25 @@ const iconFor = (name?: string) => {
|
|
|
111
111
|
data-marker={marker}
|
|
112
112
|
data-variant={variant === 'card' ? 'card' : undefined}
|
|
113
113
|
data-count={steps.length}
|
|
114
|
-
{...
|
|
114
|
+
{...sf(fieldPath)}
|
|
115
115
|
{...rest}
|
|
116
116
|
>
|
|
117
|
-
<BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description}
|
|
118
|
-
<ol class="sinn-steps__list" role="list" start={start !== 1 ? start : undefined} {...
|
|
117
|
+
<BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />
|
|
118
|
+
<ol class="sinn-steps__list" role="list" start={start !== 1 ? start : undefined} {...sf(fieldPath, 'items')}>
|
|
119
119
|
{steps.map((step, i) => {
|
|
120
120
|
const svg = marker === 'icon' ? iconFor(step.icon) : undefined;
|
|
121
121
|
return (
|
|
122
|
-
<li class="sinn-step" {...
|
|
122
|
+
<li class="sinn-step" {...sf(fieldPath, step.field)}>
|
|
123
123
|
{marker !== 'none' && (
|
|
124
124
|
<span class="sinn-step__marker" aria-hidden="true" data-icon={svg ? '' : undefined}>
|
|
125
125
|
{svg ? <Fragment set:html={svg} /> : start + i}
|
|
126
126
|
</span>
|
|
127
127
|
)}
|
|
128
128
|
<div class="sinn-step__body">
|
|
129
|
-
<Heading level={itemLevel} size="l" weight="semibold" class="sinn-step__title" {...
|
|
129
|
+
<Heading level={itemLevel} size="l" weight="semibold" class="sinn-step__title" {...sf(fieldPath, step.field, 'title')}>
|
|
130
130
|
{step.title}
|
|
131
131
|
</Heading>
|
|
132
|
-
{step.description && <Text tone="muted" class="sinn-step__description" {...
|
|
132
|
+
{step.description && <Text tone="muted" class="sinn-step__description" {...sf(fieldPath, step.field, 'description')}>{step.description}</Text>}
|
|
133
133
|
</div>
|
|
134
134
|
</li>
|
|
135
135
|
);
|
|
@@ -33,7 +33,7 @@ import Actions from './internal/Actions.astro';
|
|
|
33
33
|
import Placeholder from './internal/Placeholder.astro';
|
|
34
34
|
import { safeHref } from './lib/contact';
|
|
35
35
|
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
36
|
-
import {
|
|
36
|
+
import { sf, joinField } from './internal/fields';
|
|
37
37
|
import './styles/blocks.css';
|
|
38
38
|
import './styles/quotes.css';
|
|
39
39
|
|
|
@@ -74,7 +74,7 @@ const {
|
|
|
74
74
|
scheme,
|
|
75
75
|
containerSize = 'default',
|
|
76
76
|
placeholder = PLACEHOLDER_DEFAULT,
|
|
77
|
-
|
|
77
|
+
fieldPath,
|
|
78
78
|
id,
|
|
79
79
|
class: className,
|
|
80
80
|
...rest
|
|
@@ -84,13 +84,13 @@ const quotes = (items ?? []).filter((q) => q && String(q.quote ?? '').trim() &&
|
|
|
84
84
|
const shown = layout === 'single' ? quotes.slice(0, 1) : quotes;
|
|
85
85
|
const { sectionId, headingId } = blockIds('testimonials', anchor, id);
|
|
86
86
|
const hasHeading = Boolean(heading?.trim());
|
|
87
|
-
const readOn = (source: string) => (labels.readOn ?? 'Read on {source}').replace('{source}', source);
|
|
87
|
+
const readOn = (source: string) => (labels.readOn ?? 'Read on {source}').replace('{source}', () => source);
|
|
88
88
|
const roleLine = (q: TestimonialItem) => [q.role?.trim(), q.organization?.trim()].filter(Boolean).join(', ');
|
|
89
89
|
---
|
|
90
90
|
|
|
91
91
|
{
|
|
92
92
|
shown.length === 0 ? (
|
|
93
|
-
placeholder && <Placeholder label="Testimonials" hint="Add at least one quote with the person's name."
|
|
93
|
+
placeholder && <Placeholder label="Testimonials" hint="Add at least one quote with the person's name." field={joinField(fieldPath, 'items')} />
|
|
94
94
|
) : (
|
|
95
95
|
<BlockShell
|
|
96
96
|
name="testimonials"
|
|
@@ -105,26 +105,26 @@ const roleLine = (q: TestimonialItem) => [q.role?.trim(), q.organization?.trim()
|
|
|
105
105
|
align={layout === 'single' ? 'center' : align}
|
|
106
106
|
data-layout={layout}
|
|
107
107
|
data-variant={variant}
|
|
108
|
-
{...
|
|
108
|
+
{...sf(fieldPath)}
|
|
109
109
|
{...rest}
|
|
110
110
|
>
|
|
111
|
-
<BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description}
|
|
112
|
-
<ul class="sinn-quotes" role="list" data-columns={layout === 'single' ? 1 : columns} {...
|
|
113
|
-
{shown.map((q
|
|
111
|
+
<BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />
|
|
112
|
+
<ul class="sinn-quotes" role="list" data-columns={layout === 'single' ? 1 : columns} {...sf(fieldPath, 'items')}>
|
|
113
|
+
{shown.map((q) => {
|
|
114
114
|
const href = q.source?.href ? safeHref(q.source.href) : undefined;
|
|
115
115
|
const role = roleLine(q);
|
|
116
116
|
return (
|
|
117
|
-
<li class="sinn-quotes__item" {...
|
|
117
|
+
<li class="sinn-quotes__item" {...sf(fieldPath, q.field)}>
|
|
118
118
|
<figure class="sinn-quote">
|
|
119
119
|
<svg class="sinn-quote__mark" viewBox="0 0 32 24" aria-hidden="true" focusable="false"><path fill="currentColor" d="M0 24V14.4C0 6.6 4.3 1.6 12.2 0l1.2 3.3C9 4.6 6.7 7.6 6.5 11.2H12V24H0Zm19 0V14.4C19 6.6 23.3 1.6 31.2 0l1.2 3.3C28 4.6 25.7 7.6 25.5 11.2H31V24H19Z" /></svg>
|
|
120
120
|
{typeof q.rating === 'number' && q.rating > 0 && <Rating value={q.rating} size="s" showValue={false} class="sinn-quote__rating" />}
|
|
121
|
-
<blockquote class="sinn-quote__text" {...
|
|
121
|
+
<blockquote class="sinn-quote__text" {...sf(fieldPath, q.field, 'quote')}>
|
|
122
122
|
{q.quote.trim().split(/\n\s*\n/).map((p) => <p>{p.trim()}</p>)}
|
|
123
123
|
</blockquote>
|
|
124
124
|
<figcaption class="sinn-quote__person">
|
|
125
|
-
{q.image && <Thumbnail src={q.image.src} width={q.image.width} height={q.image.height} alt="" size={layout === 'single' ? 'm' : 's'} shape="circle" class="sinn-quote__avatar" {...
|
|
125
|
+
{q.image && <Thumbnail src={q.image.src} width={q.image.width} height={q.image.height} alt="" size={layout === 'single' ? 'm' : 's'} shape="circle" class="sinn-quote__avatar" {...sf(fieldPath, q.field, 'image')} />}
|
|
126
126
|
<span class="sinn-quote__who">
|
|
127
|
-
<span class="sinn-quote__name" {...
|
|
127
|
+
<span class="sinn-quote__name" {...sf(fieldPath, q.field, 'name')}>{q.name}</span>
|
|
128
128
|
{role && <span class="sinn-quote__role">{role}</span>}
|
|
129
129
|
{q.source?.label && (href ? (
|
|
130
130
|
<a class="sinn-quote__source sinn-link" href={href} rel={/^https?:/i.test(href) ? 'noopener' : undefined}>{readOn(q.source.label)}<VisuallyHidden>{` (${q.name})`}</VisuallyHidden></a>
|
|
@@ -138,7 +138,7 @@ const roleLine = (q: TestimonialItem) => [q.role?.trim(), q.organization?.trim()
|
|
|
138
138
|
);
|
|
139
139
|
})}
|
|
140
140
|
</ul>
|
|
141
|
-
<Actions actions={actions} size="m" class="sinn-block__footer"
|
|
141
|
+
<Actions actions={actions} size="m" class="sinn-block__footer" fieldPath={fieldPath} />
|
|
142
142
|
</BlockShell>
|
|
143
143
|
)
|
|
144
144
|
}
|
|
@@ -1,80 +1,48 @@
|
|
|
1
|
-
import type { CardGridData } from './data';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{ title: '
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export function cardGridToProps(d: CardGridData, ctx: MapContext) {
|
|
52
|
-
const items = (d.items ?? [])
|
|
53
|
-
.filter((i) => clean(i?.title))
|
|
54
|
-
.map((i) =>
|
|
55
|
-
compact({
|
|
56
|
-
title: clean(i.title)!,
|
|
57
|
-
description: clean(i.description),
|
|
58
|
-
href: clean(i.href),
|
|
59
|
-
image: mapImage(i.image, i.imageAlt, ctx),
|
|
60
|
-
eyebrow: clean(i.eyebrow),
|
|
61
|
-
meta: clean(i.meta),
|
|
62
|
-
tina: i as never,
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
65
|
-
return compact({
|
|
66
|
-
...mapSettings(d.settings),
|
|
67
|
-
eyebrow: clean(d.eyebrow),
|
|
68
|
-
heading: clean(d.heading),
|
|
69
|
-
description: clean(d.description),
|
|
70
|
-
items,
|
|
71
|
-
layout: d.layout,
|
|
72
|
-
featured: d.featured ?? undefined,
|
|
73
|
-
variant: d.variant,
|
|
74
|
-
columns: d.columns ? (Number(d.columns) as 2 | 3 | 4) : undefined,
|
|
75
|
-
mediaAspect: upgrade(d.mediaAspect, { '16-9': '16/9', '3-2': '3/2', '4-3': '4/3', '1-1': '1/1' }),
|
|
76
|
-
emptyMessage: typeof d.emptyMessage === 'string' ? d.emptyMessage : undefined,
|
|
77
|
-
headingLevel: 2 as const,
|
|
78
|
-
placeholder: ctx.placeholder,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
1
|
+
import type { CardGridData } from './data';
|
|
2
|
+
import type { CardItem } from '../types';
|
|
3
|
+
import type { MapContext } from './types';
|
|
4
|
+
import { safeHref } from '../lib/contact';
|
|
5
|
+
import { clean, compact, mapImage, mapSettings, upgrade, withFields } from './shared';
|
|
6
|
+
|
|
7
|
+
export const cardGridDefaults: CardGridData = {
|
|
8
|
+
_template: 'cardGrid',
|
|
9
|
+
heading: 'Latest',
|
|
10
|
+
variant: 'outline',
|
|
11
|
+
layout: 'grid',
|
|
12
|
+
items: [
|
|
13
|
+
{ title: 'First card', description: 'A short summary.', href: '/' },
|
|
14
|
+
{ title: 'Second card', description: 'A short summary.', href: '/' },
|
|
15
|
+
{ title: 'Third card', description: 'A short summary.', href: '/' },
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function cardGridToProps(d: CardGridData, ctx: MapContext) {
|
|
20
|
+
const items = withFields(d.items, 'items')
|
|
21
|
+
.filter((i) => clean(i?.title))
|
|
22
|
+
.map((i) =>
|
|
23
|
+
compact({
|
|
24
|
+
title: clean(i.title)!,
|
|
25
|
+
description: clean(i.description),
|
|
26
|
+
href: safeHref(i.href),
|
|
27
|
+
image: mapImage(i.image, i.imageAlt, ctx),
|
|
28
|
+
eyebrow: clean(i.eyebrow),
|
|
29
|
+
meta: clean(i.meta),
|
|
30
|
+
field: i._field,
|
|
31
|
+
}) as CardItem,
|
|
32
|
+
);
|
|
33
|
+
return compact({
|
|
34
|
+
...mapSettings(d.settings),
|
|
35
|
+
eyebrow: clean(d.eyebrow),
|
|
36
|
+
heading: clean(d.heading),
|
|
37
|
+
description: clean(d.description),
|
|
38
|
+
items,
|
|
39
|
+
layout: d.layout,
|
|
40
|
+
featured: d.featured ?? undefined,
|
|
41
|
+
variant: d.variant,
|
|
42
|
+
columns: d.columns ? (Number(d.columns) as 2 | 3 | 4) : undefined,
|
|
43
|
+
mediaAspect: upgrade(d.mediaAspect, { '16-9': '16/9', '3-2': '3/2', '4-3': '4/3', '1-1': '1/1' }),
|
|
44
|
+
emptyMessage: typeof d.emptyMessage === 'string' ? d.emptyMessage : undefined,
|
|
45
|
+
headingLevel: 2 as const,
|
|
46
|
+
placeholder: ctx.placeholder,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
import type { ConsentData } from './data';
|
|
2
|
-
import
|
|
3
|
-
import { clean, compact, longTextField, textField } from './shared';
|
|
2
|
+
import { clean, compact } from './shared';
|
|
4
3
|
import { safeHref } from '../lib/contact';
|
|
5
4
|
|
|
6
|
-
const CATEGORY_OPTIONS = [
|
|
7
|
-
{ value: 'media', label: 'Embedded content (maps, videos, booking tools)' },
|
|
8
|
-
{ value: 'analytics', label: 'Analytics' },
|
|
9
|
-
{ value: 'marketing', label: 'Marketing' },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
/** Site-settings field for ConsentManager. Add it to your Tina settings collection. */
|
|
13
|
-
export function consentField(): TinaField {
|
|
14
|
-
return {
|
|
15
|
-
type: 'object',
|
|
16
|
-
name: 'consent',
|
|
17
|
-
label: 'Privacy banner',
|
|
18
|
-
fields: [
|
|
19
|
-
longTextField('message', 'Banner text (optional)', { description: 'Say which outside services the site uses.' }),
|
|
20
|
-
textField('policyHref', 'Privacy policy link', { description: 'e.g. /privacy' }),
|
|
21
|
-
{
|
|
22
|
-
type: 'string',
|
|
23
|
-
name: 'categories',
|
|
24
|
-
label: 'What the site uses',
|
|
25
|
-
list: true,
|
|
26
|
-
options: CATEGORY_OPTIONS,
|
|
27
|
-
ui: { component: 'checkbox-group' },
|
|
28
|
-
},
|
|
29
|
-
textField('version', 'Policy version', { description: 'Change it (e.g. to 2) when you add a service, and every visitor is asked again.' }),
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
5
|
/** Site settings → ConsentManager props. */
|
|
35
6
|
export function consentProps(d: ConsentData | null | undefined) {
|
|
36
7
|
const data = d ?? {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContactItem } from '../types';
|
|
2
2
|
import type { ContactCardData } from './data';
|
|
3
|
-
import type { MapContext
|
|
4
|
-
import { clean, compact,
|
|
3
|
+
import type { MapContext } from './types';
|
|
4
|
+
import { clean, compact, mapSettings, upgrade, withFields } from './shared';
|
|
5
5
|
|
|
6
6
|
const TYPES = ['address', 'phone', 'fax', 'email', 'hours', 'link'] as const;
|
|
7
7
|
|
|
@@ -14,50 +14,8 @@ export const contactCardDefaults: ContactCardData = {
|
|
|
14
14
|
],
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const contactCardTemplate: TinaTemplate = {
|
|
18
|
-
name: 'contactCard',
|
|
19
|
-
label: 'Contact card',
|
|
20
|
-
ui: { defaultItem: contactCardDefaults, itemProps: (item: ContactCardData) => ({ label: `Contact: ${item?.heading ?? ''}` }) },
|
|
21
|
-
fields: [
|
|
22
|
-
textField('eyebrow', 'Eyebrow'),
|
|
23
|
-
textField('heading', 'Heading'),
|
|
24
|
-
longTextField('description', 'Intro text'),
|
|
25
|
-
{
|
|
26
|
-
type: 'object',
|
|
27
|
-
name: 'items',
|
|
28
|
-
label: 'Contact details',
|
|
29
|
-
list: true,
|
|
30
|
-
description: 'Phone numbers become click-to-call links; fax numbers stay plain text.',
|
|
31
|
-
ui: { itemProps: (item: { type?: string; value?: string }) => ({ label: [item?.type, item?.value].filter(Boolean).join(': ') || 'Detail' }), defaultItem: { type: 'phone', value: '' } },
|
|
32
|
-
fields: [
|
|
33
|
-
{
|
|
34
|
-
type: 'string',
|
|
35
|
-
name: 'type',
|
|
36
|
-
label: 'Type',
|
|
37
|
-
required: true,
|
|
38
|
-
options: [
|
|
39
|
-
{ value: 'phone', label: 'Phone (click to call)' },
|
|
40
|
-
{ value: 'email', label: 'Email' },
|
|
41
|
-
{ value: 'address', label: 'Address' },
|
|
42
|
-
{ value: 'fax', label: 'Fax' },
|
|
43
|
-
{ value: 'hours', label: 'Hours' },
|
|
44
|
-
{ value: 'link', label: 'Link' },
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
longTextField('value', 'Value', { required: true, description: 'Addresses and hours can use several lines.' }),
|
|
48
|
-
textField('label', 'Label (optional)', { description: 'Shown above the value. Defaults to the type (“Phone”).' }),
|
|
49
|
-
textField('href', 'Link (links only)', { description: 'For “Link” items: the URL.' }),
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
longTextField('note', 'Small print', { description: 'E.g. “Please don’t email passwords or API keys.”' }),
|
|
53
|
-
{ type: 'string', name: 'variant', label: 'Style', options: [{ value: 'outline', label: 'Card' }, { value: 'plain', label: 'Plain' }] },
|
|
54
|
-
{ type: 'string', name: 'columns', label: 'Columns (when wide)', options: ['1', '2', '3'] },
|
|
55
|
-
settingsField(),
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
|
|
59
17
|
export function mapContactItems(items: ContactCardData['items']): ContactItem[] {
|
|
60
|
-
return (items
|
|
18
|
+
return withFields(items, 'items')
|
|
61
19
|
.filter((i) => i && (TYPES as readonly string[]).includes(i.type ?? '') && clean(i.value))
|
|
62
20
|
.map((i) =>
|
|
63
21
|
compact({
|
|
@@ -66,7 +24,7 @@ export function mapContactItems(items: ContactCardData['items']): ContactItem[]
|
|
|
66
24
|
// An empty label in the CMS means "use the default"; only code can hide labels with "".
|
|
67
25
|
label: clean(i.label),
|
|
68
26
|
href: i.type === 'link' ? clean(i.href) : undefined,
|
|
69
|
-
|
|
27
|
+
field: i._field,
|
|
70
28
|
}) as ContactItem,
|
|
71
29
|
);
|
|
72
30
|
}
|