@sinnstack/ui 0.0.0-stage → 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 +89 -0
- package/LICENSE +373 -0
- package/README.md +188 -2
- package/docs/blocks.md +373 -0
- package/docs/data.md +128 -0
- package/docs/finishes.md +165 -0
- package/docs/motion.md +166 -0
- package/docs/primitives.md +510 -0
- package/docs/seo.md +191 -0
- package/docs/tokens.md +122 -0
- package/package.json +132 -3
- package/scripts/check-contrast.mjs +180 -0
- package/src/blocks/BlockRenderer.astro +60 -0
- package/src/blocks/CTABanner.astro +121 -0
- package/src/blocks/CTAPair.astro +110 -0
- package/src/blocks/CardGrid.astro +167 -0
- package/src/blocks/ConsentEmbed.astro +125 -0
- package/src/blocks/ConsentManager.astro +147 -0
- package/src/blocks/ConsentScript.astro +47 -0
- package/src/blocks/ContactCard.astro +164 -0
- package/src/blocks/ContactForm.astro +224 -0
- package/src/blocks/ErrorPage.astro +242 -0
- package/src/blocks/FAQ.astro +135 -0
- package/src/blocks/FeatureGrid.astro +148 -0
- package/src/blocks/Hero.astro +171 -0
- package/src/blocks/HeroCarousel.astro +220 -0
- package/src/blocks/HighlightCards.astro +107 -0
- package/src/blocks/LocationHours.astro +311 -0
- package/src/blocks/LogoCloud.astro +135 -0
- package/src/blocks/MaintenancePage.astro +173 -0
- package/src/blocks/MediaText.astro +177 -0
- package/src/blocks/PageHeader.astro +126 -0
- package/src/blocks/ProseSection.astro +98 -0
- package/src/blocks/Reviews.astro +194 -0
- package/src/blocks/RichText.astro +58 -0
- package/src/blocks/StatsBand.astro +117 -0
- package/src/blocks/Steps.astro +141 -0
- package/src/blocks/Testimonials.astro +144 -0
- package/src/blocks/Topbar.astro +158 -0
- package/src/blocks/cms/card-grid.ts +48 -0
- package/src/blocks/cms/consent.ts +16 -0
- package/src/blocks/cms/contact-card.ts +46 -0
- package/src/blocks/cms/contact-form.ts +37 -0
- package/src/blocks/cms/cta-banner.ts +27 -0
- package/src/blocks/cms/cta-pair.ts +30 -0
- package/src/blocks/cms/data-base.ts +5 -0
- package/src/blocks/cms/data.ts +257 -0
- package/src/blocks/cms/faq.ts +38 -0
- package/src/blocks/cms/feature-grid.ts +47 -0
- package/src/blocks/cms/fixtures.ts +591 -0
- package/src/blocks/cms/hero-carousel.ts +36 -0
- package/src/blocks/cms/hero.ts +33 -0
- package/src/blocks/cms/highlight-cards.ts +41 -0
- package/src/blocks/cms/images.ts +37 -0
- package/src/blocks/cms/index.ts +59 -0
- package/src/blocks/cms/location-hours.ts +67 -0
- package/src/blocks/cms/logo-cloud.ts +36 -0
- package/src/blocks/cms/media-text.ts +26 -0
- package/src/blocks/cms/page-header.ts +27 -0
- package/src/blocks/cms/pages.ts +35 -0
- package/src/blocks/cms/prose-section.ts +25 -0
- package/src/blocks/cms/reviews.ts +50 -0
- package/src/blocks/cms/schema-dsl.ts +134 -0
- package/src/blocks/cms/schema.ts +794 -0
- package/src/blocks/cms/shared.ts +63 -0
- package/src/blocks/cms/stats-band.ts +35 -0
- package/src/blocks/cms/steps.ts +40 -0
- package/src/blocks/cms/testimonials.ts +46 -0
- package/src/blocks/cms/topbar.ts +27 -0
- package/src/blocks/cms/types.ts +27 -0
- package/src/blocks/consent.ts +14 -0
- package/src/blocks/icons.ts +47 -0
- package/src/blocks/index.ts +42 -0
- package/src/blocks/internal/Actions.astro +35 -0
- package/src/blocks/internal/BlockHeader.astro +45 -0
- package/src/blocks/internal/BlockShell.astro +58 -0
- package/src/blocks/internal/CarouselScript.astro +7 -0
- package/src/blocks/internal/ConsentEmbedScript.astro +7 -0
- package/src/blocks/internal/ConsentManagerScript.astro +7 -0
- package/src/blocks/internal/HoursScript.astro +7 -0
- package/src/blocks/internal/Placeholder.astro +13 -0
- package/src/blocks/internal/RichTextNode.astro +133 -0
- package/src/blocks/internal/StandaloneDocument.astro +53 -0
- package/src/blocks/internal/consent.ts +96 -0
- package/src/blocks/internal/fields.ts +18 -0
- package/src/blocks/internal/registry-contract.ts +67 -0
- package/src/blocks/internal/reviews.ts +22 -0
- package/src/blocks/internal/slug.ts +12 -0
- package/src/blocks/internal/util.ts +23 -0
- package/src/blocks/lib/contact.ts +92 -0
- package/src/blocks/lib/error-pages.ts +119 -0
- package/src/blocks/lib/faq.ts +37 -0
- package/src/blocks/lib/hours.ts +201 -0
- package/src/blocks/lib/maintenance.ts +129 -0
- package/src/blocks/lib/markdown.ts +350 -0
- package/src/blocks/lib/rich-text.ts +132 -0
- package/src/blocks/registry.ts +79 -0
- package/src/blocks/scripts/carousel.ts +218 -0
- package/src/blocks/scripts/consent-embed.ts +105 -0
- package/src/blocks/scripts/consent-manager.ts +112 -0
- package/src/blocks/scripts/consent-store.ts +86 -0
- package/src/blocks/scripts/error-page.ts +71 -0
- package/src/blocks/scripts/hours.ts +107 -0
- package/src/blocks/scripts/maintenance.ts +109 -0
- package/src/blocks/styles/blocks.css +1320 -0
- package/src/blocks/styles/consent.css +102 -0
- package/src/blocks/styles/faq.css +28 -0
- package/src/blocks/styles/location.css +92 -0
- package/src/blocks/styles/prose-section.css +13 -0
- package/src/blocks/styles/quotes.css +123 -0
- package/src/blocks/styles/rich-text.css +14 -0
- package/src/blocks/types.ts +293 -0
- package/src/data/ChartAxis.astro +19 -0
- package/src/data/ChartContainer.astro +152 -0
- package/src/data/ChartLegend.astro +25 -0
- package/src/data/ChartSeries.astro +14 -0
- package/src/data/ChartTable.astro +17 -0
- package/src/data/ChartTooltip.astro +20 -0
- package/src/data/Sparkline.astro +55 -0
- package/src/data/cms.ts +130 -0
- package/src/data/index.ts +10 -0
- package/src/data/internal/scale.ts +107 -0
- package/src/data/lib/chart.ts +459 -0
- package/src/data/lib/render.ts +219 -0
- package/src/data/lib/sparkline.ts +117 -0
- package/src/data/schema.ts +65 -0
- package/src/data/scripts/chart.ts +324 -0
- package/src/data/styles/chart.css +392 -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/motion/Marquee.astro +90 -0
- package/src/motion/MotionProvider.astro +50 -0
- package/src/motion/PageTransitions.astro +61 -0
- package/src/motion/Parallax.astro +44 -0
- package/src/motion/ParallaxLayer.astro +31 -0
- package/src/motion/RevealOnScroll.astro +59 -0
- package/src/motion/SceneRegistry.astro +38 -0
- package/src/motion/ScrollScene.astro +81 -0
- package/src/motion/index.ts +12 -0
- package/src/motion/integration.ts +48 -0
- package/src/motion/runtime/page-transitions.ts +68 -0
- package/src/motion/runtime/runtime.ts +180 -0
- package/src/motion/runtime/scenes.ts +248 -0
- package/src/motion/runtime/types.ts +103 -0
- package/src/motion/styles/motion.css +332 -0
- package/src/motion/transitions.ts +74 -0
- package/src/motion/virtual.d.ts +4 -0
- package/src/primitives/Accordion.astro +129 -0
- package/src/primitives/Breadcrumbs.astro +50 -0
- package/src/primitives/BulletList.astro +69 -0
- package/src/primitives/Button.astro +73 -0
- package/src/primitives/ButtonGroup.astro +54 -0
- package/src/primitives/Callout.astro +137 -0
- package/src/primitives/Caption.astro +35 -0
- package/src/primitives/Card.astro +72 -0
- package/src/primitives/CardContent.astro +24 -0
- package/src/primitives/CardFooter.astro +36 -0
- package/src/primitives/CardHeader.astro +86 -0
- package/src/primitives/Checkbox.astro +38 -0
- package/src/primitives/ChoiceGroup.astro +23 -0
- package/src/primitives/Cluster.astro +49 -0
- package/src/primitives/Container.astro +44 -0
- package/src/primitives/DescriptionList.astro +83 -0
- package/src/primitives/Dialog.astro +38 -0
- package/src/primitives/Disclosure.astro +67 -0
- package/src/primitives/Divider.astro +93 -0
- package/src/primitives/Drawer.astro +33 -0
- package/src/primitives/Fieldset.astro +80 -0
- package/src/primitives/Flex.astro +64 -0
- package/src/primitives/FocusRing.astro +63 -0
- package/src/primitives/FocusTrap.astro +64 -0
- package/src/primitives/Footer.astro +155 -0
- package/src/primitives/Form.astro +68 -0
- package/src/primitives/FormDescription.astro +26 -0
- package/src/primitives/FormError.astro +106 -0
- package/src/primitives/FormField.astro +72 -0
- package/src/primitives/Grid.astro +64 -0
- package/src/primitives/Heading.astro +45 -0
- package/src/primitives/IconButton.astro +48 -0
- package/src/primitives/Image.astro +125 -0
- package/src/primitives/Input.astro +86 -0
- package/src/primitives/Label.astro +50 -0
- package/src/primitives/Link.astro +81 -0
- package/src/primitives/LinkButton.astro +66 -0
- package/src/primitives/List.astro +39 -0
- package/src/primitives/ListItem.astro +178 -0
- package/src/primitives/MediaObject.astro +66 -0
- package/src/primitives/MetricCard.astro +278 -0
- package/src/primitives/NavLink.astro +81 -0
- package/src/primitives/NavMenu.astro +109 -0
- package/src/primitives/Navbar.astro +197 -0
- package/src/primitives/Panel.astro +153 -0
- package/src/primitives/Picture.astro +167 -0
- package/src/primitives/Popover.astro +95 -0
- package/src/primitives/Prose.astro +45 -0
- package/src/primitives/Radio.astro +21 -0
- package/src/primitives/Rating.astro +135 -0
- package/src/primitives/ReducedMotion.astro +90 -0
- package/src/primitives/SegmentedControl.astro +132 -0
- package/src/primitives/Select.astro +109 -0
- package/src/primitives/Sheet.astro +45 -0
- package/src/primitives/SkipLink.astro +31 -0
- package/src/primitives/Slider.astro +186 -0
- package/src/primitives/Spacer.astro +35 -0
- package/src/primitives/Stack.astro +51 -0
- package/src/primitives/Surface.astro +70 -0
- package/src/primitives/Switch.astro +22 -0
- package/src/primitives/Table.astro +382 -0
- package/src/primitives/Tabs.astro +126 -0
- package/src/primitives/Text.astro +56 -0
- package/src/primitives/Textarea.astro +75 -0
- package/src/primitives/Thumbnail.astro +154 -0
- package/src/primitives/Toggle.astro +99 -0
- package/src/primitives/Tooltip.astro +50 -0
- package/src/primitives/VisuallyHidden.astro +29 -0
- package/src/primitives/index.ts +103 -0
- package/src/primitives/internal/AccordionScript.astro +7 -0
- package/src/primitives/internal/ChoiceField.astro +91 -0
- package/src/primitives/internal/FocusTrapScript.astro +8 -0
- package/src/primitives/internal/FormValidationScript.astro +10 -0
- package/src/primitives/internal/IndeterminateScript.astro +13 -0
- package/src/primitives/internal/ModalPanel.astro +114 -0
- package/src/primitives/internal/OverlayScript.astro +7 -0
- package/src/primitives/internal/ReducedMotionScript.astro +7 -0
- package/src/primitives/internal/SliderScript.astro +7 -0
- package/src/primitives/internal/SparklineScript.astro +7 -0
- package/src/primitives/internal/TableSortScript.astro +7 -0
- package/src/primitives/internal/TabsScript.astro +7 -0
- package/src/primitives/internal/TooltipScript.astro +7 -0
- package/src/primitives/internal/image-plan.ts +82 -0
- package/src/primitives/internal/image.ts +129 -0
- package/src/primitives/internal/slider.ts +170 -0
- package/src/primitives/lib/deprecate.ts +47 -0
- package/src/primitives/lib/focus-trap.ts +197 -0
- package/src/primitives/lib/focus.ts +60 -0
- package/src/primitives/lib/motion.ts +68 -0
- package/src/primitives/scripts/accordion.ts +123 -0
- package/src/primitives/scripts/form-validation.ts +225 -0
- package/src/primitives/scripts/overlay.ts +71 -0
- package/src/primitives/scripts/reduced-motion.ts +59 -0
- package/src/primitives/scripts/slider.ts +150 -0
- package/src/primitives/scripts/sparkline.ts +131 -0
- package/src/primitives/scripts/table-sort.ts +68 -0
- package/src/primitives/scripts/tabs.ts +151 -0
- package/src/primitives/scripts/tooltip.ts +28 -0
- package/src/primitives/styles/a11y.css +104 -0
- package/src/primitives/styles/accordion.css +53 -0
- package/src/primitives/styles/breadcrumbs.css +59 -0
- package/src/primitives/styles/bullet-list.css +89 -0
- package/src/primitives/styles/button.css +237 -0
- package/src/primitives/styles/choice.css +164 -0
- package/src/primitives/styles/cluster.css +24 -0
- package/src/primitives/styles/container.css +19 -0
- package/src/primitives/styles/data.css +849 -0
- package/src/primitives/styles/disclosure.css +140 -0
- package/src/primitives/styles/divider.css +50 -0
- package/src/primitives/styles/flex.css +42 -0
- package/src/primitives/styles/form.css +241 -0
- package/src/primitives/styles/grid.css +36 -0
- package/src/primitives/styles/media.css +247 -0
- package/src/primitives/styles/nav.css +792 -0
- package/src/primitives/styles/overlay.css +362 -0
- package/src/primitives/styles/prose.css +146 -0
- package/src/primitives/styles/scale.css +175 -0
- package/src/primitives/styles/segmented.css +165 -0
- package/src/primitives/styles/slider.css +170 -0
- package/src/primitives/styles/spacer.css +17 -0
- package/src/primitives/styles/stack.css +25 -0
- package/src/primitives/styles/surface.css +403 -0
- package/src/primitives/styles/tabs.css +223 -0
- package/src/primitives/styles/typography.css +144 -0
- package/src/primitives/styles/utilities.css +24 -0
- package/src/primitives/types.ts +385 -0
- package/src/primitives/utils.ts +254 -0
- package/src/seo/JSONLD.astro +35 -0
- package/src/seo/SEOHead.astro +47 -0
- package/src/seo/cms.ts +59 -0
- package/src/seo/index.ts +10 -0
- package/src/seo/integration.ts +268 -0
- package/src/seo/internal/url.ts +68 -0
- package/src/seo/lib/jsonld.ts +342 -0
- package/src/seo/lib/meta.ts +205 -0
- package/src/seo/lib/redirects.ts +293 -0
- package/src/seo/lib/robots.ts +33 -0
- package/src/seo/lib/rss.ts +98 -0
- package/src/seo/lib/sitemap.ts +105 -0
- package/src/seo/schema.ts +43 -0
- package/src/tokens/base.css +71 -0
- package/src/tokens/tokens.css +210 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Mapping helpers shared by every block's CMS module. */
|
|
2
|
+
import type { ActionItem, BlockProps, ImageSource } from '../types';
|
|
3
|
+
import type { CmsAction, CmsSettings, MapContext } from './types';
|
|
4
|
+
import { safeHref } from '../lib/contact';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tags each list item with its stored path (`items.3`) before the mapper filters the list, so the
|
|
8
|
+
* `data-sinn-field` annotations point at the right item even when empty ones are skipped.
|
|
9
|
+
* Null entries are dropped.
|
|
10
|
+
*/
|
|
11
|
+
export function withFields<T extends object>(list: ReadonlyArray<T | null | undefined> | null | undefined, key: string): Array<T & { _field: string }> {
|
|
12
|
+
return (list ?? []).flatMap((item, n) => (item ? [{ ...item, _field: `${key}.${n}` }] : []));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Plain text only: CMS strings are rendered as text (escaped), never as HTML. */
|
|
16
|
+
export function clean(value: unknown): string | undefined {
|
|
17
|
+
if (typeof value !== 'string') return undefined;
|
|
18
|
+
const v = value.trim();
|
|
19
|
+
return v.length ? v : undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function mapSettings(settings: CmsSettings | null | undefined): Partial<BlockProps> {
|
|
23
|
+
const s = settings ?? {};
|
|
24
|
+
return {
|
|
25
|
+
anchor: clean(s.anchor),
|
|
26
|
+
background: s.background,
|
|
27
|
+
tone: s.tone,
|
|
28
|
+
spacing: s.spacing,
|
|
29
|
+
align: s.align,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function mapActions(actions: CmsAction[] | undefined): ActionItem[] {
|
|
34
|
+
return withFields(actions, 'actions')
|
|
35
|
+
.map((a) => ({ ...a, href: safeHref(a.href) }))
|
|
36
|
+
.filter((a) => clean(a.label) && a.href)
|
|
37
|
+
.map((a, i) => ({ label: clean(a.label)!, href: a.href!, variant: a.style ?? (i === 0 ? 'solid' : 'outline'), ...(a.arrow ? { arrow: true } : {}), field: a._field }));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function mapImage(src: unknown, alt: unknown, ctx: MapContext): ImageSource | undefined {
|
|
41
|
+
const path = clean(src);
|
|
42
|
+
if (!path) return undefined;
|
|
43
|
+
const resolved = ctx.resolveImage(path);
|
|
44
|
+
if (!resolved) {
|
|
45
|
+
if (import.meta.env?.DEV) console.warn(`[blocks] Image "${path}" couldn't be resolved; skipped. Pass resolveImage to BlockRenderer.`);
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return 'format' in resolved ? { src: resolved, alt: clean(alt) ?? '' } : { src: resolved.src, width: resolved.width, height: resolved.height, alt: clean(alt) ?? '' };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Map a value stored by an older schema to the current vocabulary. Content keeps working
|
|
53
|
+
* without a migration; the schema offers only current values, so the next save stores those.
|
|
54
|
+
*/
|
|
55
|
+
export function upgrade<T extends string>(value: T | undefined | null, renames: Readonly<Record<string, string>>): T | undefined {
|
|
56
|
+
if (value == null) return undefined;
|
|
57
|
+
return (Object.prototype.hasOwnProperty.call(renames, value) ? renames[value] : value) as T;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Drops undefined values so component defaults apply. */
|
|
61
|
+
export function compact<T extends Record<string, unknown>>(obj: T): Partial<T> {
|
|
62
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { StatItem } from '../types';
|
|
2
|
+
import type { StatsBandData } from './data';
|
|
3
|
+
import type { MapContext } from './types';
|
|
4
|
+
import { blockIconNames } from '../icons';
|
|
5
|
+
import { clean, compact, mapImage, mapSettings, withFields } from './shared';
|
|
6
|
+
|
|
7
|
+
export const statsBandDefaults: StatsBandData = {
|
|
8
|
+
_template: 'statsBand',
|
|
9
|
+
label: 'At a glance',
|
|
10
|
+
items: [
|
|
11
|
+
{ value: '24', label: 'Hours a day' },
|
|
12
|
+
{ value: '7', label: 'Days a week' },
|
|
13
|
+
{ value: '15', label: 'Counties served' },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function statsBandToProps(d: StatsBandData, ctx: MapContext) {
|
|
18
|
+
const items = withFields(d.items, 'items')
|
|
19
|
+
.filter((i) => clean(i?.value) && clean(i?.label))
|
|
20
|
+
.slice(0, 6)
|
|
21
|
+
.map((i) => compact({ value: clean(i.value)!, label: clean(i.label)!, icon: i.icon && (blockIconNames as string[]).includes(i.icon) ? i.icon : undefined, field: i._field }) as StatItem);
|
|
22
|
+
const { anchor, align, spacing } = mapSettings(d.settings);
|
|
23
|
+
return compact({
|
|
24
|
+
anchor,
|
|
25
|
+
align,
|
|
26
|
+
spacing,
|
|
27
|
+
heading: clean(d.heading),
|
|
28
|
+
label: clean(d.label),
|
|
29
|
+
items,
|
|
30
|
+
image: mapImage(d.image, '', ctx),
|
|
31
|
+
tone: d.tone,
|
|
32
|
+
headingLevel: ctx.headingLevel === 1 ? (2 as const) : ctx.headingLevel,
|
|
33
|
+
placeholder: ctx.placeholder,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { blockIconNames } from '../icons';
|
|
2
|
+
import type { StepItem } from '../types';
|
|
3
|
+
import type { StepsData } from './data';
|
|
4
|
+
import type { MapContext } from './types';
|
|
5
|
+
import { clean, compact, mapSettings, upgrade, withFields } from './shared';
|
|
6
|
+
|
|
7
|
+
export const stepsDefaults: StepsData = {
|
|
8
|
+
_template: 'steps',
|
|
9
|
+
heading: 'How it works',
|
|
10
|
+
items: [
|
|
11
|
+
{ title: 'First step', description: 'What happens, and who does it.' },
|
|
12
|
+
{ title: 'Second step', description: 'What happens next.' },
|
|
13
|
+
{ title: 'Third step', description: 'How it ends.' },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function stepsToProps(d: StepsData, ctx: MapContext) {
|
|
18
|
+
const items = withFields(d.items, 'items')
|
|
19
|
+
.filter((i) => clean(i?.title))
|
|
20
|
+
.map((i) =>
|
|
21
|
+
compact({
|
|
22
|
+
title: clean(i.title)!,
|
|
23
|
+
description: clean(i.description),
|
|
24
|
+
icon: i.icon && (blockIconNames as string[]).includes(i.icon) ? i.icon : undefined,
|
|
25
|
+
field: i._field,
|
|
26
|
+
}) as StepItem,
|
|
27
|
+
);
|
|
28
|
+
return compact({
|
|
29
|
+
...mapSettings(d.settings),
|
|
30
|
+
eyebrow: clean(d.eyebrow),
|
|
31
|
+
heading: clean(d.heading),
|
|
32
|
+
description: clean(d.description),
|
|
33
|
+
items,
|
|
34
|
+
marker: d.marker,
|
|
35
|
+
layout: d.layout,
|
|
36
|
+
variant: upgrade(d.variant, { cards: 'card' }),
|
|
37
|
+
headingLevel: 2 as const,
|
|
38
|
+
placeholder: ctx.placeholder,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TestimonialItem } from '../types';
|
|
2
|
+
import type { TestimonialsData } from './data';
|
|
3
|
+
import type { MapContext } from './types';
|
|
4
|
+
import { clean, compact, mapActions, mapImage, mapSettings, withFields } from './shared';
|
|
5
|
+
import { safeHref } from '../lib/contact';
|
|
6
|
+
|
|
7
|
+
export const testimonialsDefaults: TestimonialsData = {
|
|
8
|
+
_template: 'testimonials',
|
|
9
|
+
heading: 'What clients say',
|
|
10
|
+
items: [
|
|
11
|
+
{ quote: 'Our bookings doubled the month the new site went live.', name: 'Client name', role: 'Owner', organization: 'Company' },
|
|
12
|
+
{ quote: 'We update the menu ourselves now. It takes a minute.', name: 'Client name', role: 'Manager', organization: 'Company' },
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function testimonialsToProps(d: TestimonialsData, ctx: MapContext) {
|
|
17
|
+
const items = withFields(d.items, 'items')
|
|
18
|
+
.filter((i) => clean(i?.quote) && clean(i?.name))
|
|
19
|
+
.map((i) => {
|
|
20
|
+
const rating = typeof i.rating === 'number' && i.rating >= 1 && i.rating <= 5 ? i.rating : undefined;
|
|
21
|
+
const label = clean(i.sourceLabel);
|
|
22
|
+
return compact({
|
|
23
|
+
quote: clean(i.quote)!,
|
|
24
|
+
name: clean(i.name)!,
|
|
25
|
+
role: clean(i.role),
|
|
26
|
+
organization: clean(i.organization),
|
|
27
|
+
image: mapImage(i.image, '', ctx),
|
|
28
|
+
rating,
|
|
29
|
+
source: label ? compact({ label, href: safeHref(clean(i.sourceHref)) }) : undefined,
|
|
30
|
+
field: i._field,
|
|
31
|
+
}) as TestimonialItem;
|
|
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
|
+
variant: d.variant,
|
|
41
|
+
columns: d.columns ? (Number(d.columns) as 1 | 2 | 3) : undefined,
|
|
42
|
+
actions: mapActions(d.actions),
|
|
43
|
+
headingLevel: 2 as const,
|
|
44
|
+
placeholder: ctx.placeholder,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Topbar is site chrome, not a page block: its content lives in site settings, like the error and
|
|
3
|
+
* maintenance pages. Pass `topbarProps(settings.topbar)` to <Topbar> in the layout.
|
|
4
|
+
*/
|
|
5
|
+
import type { ContactItem } from '../types';
|
|
6
|
+
import type { TopbarData } from './data';
|
|
7
|
+
import { clean, compact } from './shared';
|
|
8
|
+
import { mapContactItems } from './contact-card';
|
|
9
|
+
import { safeHref } from '../lib/contact';
|
|
10
|
+
|
|
11
|
+
export function topbarProps(d: TopbarData | null | undefined) {
|
|
12
|
+
const data = d ?? {};
|
|
13
|
+
const items: ContactItem[] = mapContactItems(data.items as never).map(({ field: _f, ...rest }) => rest);
|
|
14
|
+
const links = (data.links ?? [])
|
|
15
|
+
.map((l) => ({ label: clean(l?.label), href: safeHref(clean(l?.href)), newTab: l?.newTab ?? undefined }))
|
|
16
|
+
.filter((l): l is { label: string; href: string; newTab: boolean | undefined } => Boolean(l.label && l.href))
|
|
17
|
+
.map((l) => compact(l) as { label: string; href: string; newTab?: boolean });
|
|
18
|
+
// Older content stored tone: 'subtle'; that is background: 'subtle' now.
|
|
19
|
+
const legacySubtle = data.tone === 'subtle';
|
|
20
|
+
return compact({
|
|
21
|
+
message: clean(data.message),
|
|
22
|
+
items,
|
|
23
|
+
links,
|
|
24
|
+
background: legacySubtle ? 'subtle' : data.background,
|
|
25
|
+
tone: legacySubtle ? undefined : data.tone,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Types shared by the CMS data → props mappers. */
|
|
2
|
+
/** What a CMS image string resolves to: an imported asset, or a URL with its size. */
|
|
3
|
+
export type ResolvedImage = import('astro').ImageMetadata | { src: string; width: number; height: number };
|
|
4
|
+
export type ImageResolver = (src: string) => ResolvedImage | undefined;
|
|
5
|
+
|
|
6
|
+
export interface MapContext {
|
|
7
|
+
resolveImage: ImageResolver;
|
|
8
|
+
/** Heading level the renderer chose for this block (1 for the first hero, else 2). */
|
|
9
|
+
headingLevel: 1 | 2;
|
|
10
|
+
/** Show placeholders for empty content (CMS preview / dev). */
|
|
11
|
+
placeholder: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Shared section settings, nested under `settings` in every block. */
|
|
15
|
+
export interface CmsSettings {
|
|
16
|
+
anchor?: string;
|
|
17
|
+
background?: 'none' | 'subtle' | 'sunken' | 'tinted' | 'strong';
|
|
18
|
+
tone?: 'accent' | 'neutral';
|
|
19
|
+
spacing?: 's' | 'm' | 'l' | 'xl';
|
|
20
|
+
align?: 'start' | 'center';
|
|
21
|
+
}
|
|
22
|
+
export interface CmsAction {
|
|
23
|
+
label?: string;
|
|
24
|
+
href?: string;
|
|
25
|
+
style?: 'solid' | 'outline' | 'ghost';
|
|
26
|
+
arrow?: boolean | null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent API for your own code (browser only; SSR-safe to import).
|
|
3
|
+
*
|
|
4
|
+
* import { hasConsent, onConsentChange, openConsentSettings } from '@sinnstack/ui/blocks/consent';
|
|
5
|
+
* if (hasConsent('analytics')) startAnalytics();
|
|
6
|
+
* onConsentChange(({ choices }) => choices.analytics && startAnalytics());
|
|
7
|
+
*
|
|
8
|
+
* Prefer ConsentScript for third-party script tags and ConsentEmbed for iframes: they already
|
|
9
|
+
* wait for consent. Use this for anything else that must not run before it.
|
|
10
|
+
*/
|
|
11
|
+
export { hasConsent, setConsent, onConsentChange, openConsentSettings, getConsentRecord } from './scripts/consent-store';
|
|
12
|
+
export type { ConsentChangeDetail } from './scripts/consent-store';
|
|
13
|
+
export { consentCategoryPresets, CONSENT_EVENT, CONSENT_KEY } from './internal/consent';
|
|
14
|
+
export type { ConsentCategory, ConsentChoices, ConsentRecord } from './internal/consent';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in icon set for FeatureGrid (24×24, stroked with currentColor, lucide-style geometry
|
|
3
|
+
* drawn for this library). Referenced by name, so CMS content never carries raw SVG.
|
|
4
|
+
* Extend or replace it per site: <FeatureGrid icons={{ ...blockIcons, tooth: '<svg…>' }} />.
|
|
5
|
+
*/
|
|
6
|
+
const svg = (body: string) =>
|
|
7
|
+
`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${body}</svg>`;
|
|
8
|
+
|
|
9
|
+
export const blockIcons = {
|
|
10
|
+
check: svg('<path d="M20 6 9 17l-5-5"/>'),
|
|
11
|
+
// Social profiles (simplified, stroked to match the set). Use with a visible or visually hidden network name.
|
|
12
|
+
facebook: svg('<path d="M15 3.5h-2.2A3.8 3.8 0 0 0 9 7.3V10H6.5v3.5H9v7h3.5v-7H15l.5-3.5h-3V7.8c0-.6.4-1 1-1H15Z"/>'),
|
|
13
|
+
x: svg('<path d="M4 4h4.5L20 20h-4.5Z"/><path d="m20 4-6.8 7.6M10.8 12.4 4 20"/>'),
|
|
14
|
+
instagram: svg('<rect x="3.5" y="3.5" width="17" height="17" rx="5"/><circle cx="12" cy="12" r="4"/><path d="M17.2 6.8h.01"/>'),
|
|
15
|
+
linkedin: svg('<rect x="3.5" y="3.5" width="17" height="17" rx="2.5"/><path d="M8 10.5V16M8 7.5v.01M11.5 16v-5.5M11.5 13a2.5 2.5 0 0 1 5 0v3"/>'),
|
|
16
|
+
youtube: svg('<rect x="2.5" y="5.5" width="19" height="13" rx="4"/><path d="m10 9 5 3-5 3Z"/>'),
|
|
17
|
+
heart: svg('<path d="M12 20s-7.5-4.6-9.2-9.3A4.9 4.9 0 0 1 12 6.6a4.9 4.9 0 0 1 9.2 4.1C19.5 15.4 12 20 12 20Z"/>'),
|
|
18
|
+
shield: svg('<path d="M12 3 4.5 6v5.5c0 4.6 3.2 8.4 7.5 9.5 4.3-1.1 7.5-4.9 7.5-9.5V6L12 3Z"/><path d="m9 12 2 2 4-4"/>'),
|
|
19
|
+
clock: svg('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>'),
|
|
20
|
+
calendar: svg('<rect x="3.5" y="5" width="17" height="15.5" rx="2"/><path d="M3.5 10h17M8 3v4M16 3v4"/>'),
|
|
21
|
+
phone: svg('<path d="M6.6 3.5h2.9l1.5 4.2-2.1 1.4a11.5 11.5 0 0 0 6 6l1.4-2.1 4.2 1.5v2.9a2 2 0 0 1-2.2 2A16.8 16.8 0 0 1 4.6 5.7a2 2 0 0 1 2-2.2Z"/>'),
|
|
22
|
+
chat: svg('<path d="M20.5 12a8 8 0 0 1-11.8 7L4 20l1-4.4A8 8 0 1 1 20.5 12Z"/>'),
|
|
23
|
+
video: svg('<rect x="2.5" y="6" width="13" height="12" rx="2"/><path d="m15.5 10.5 6-3.5v10l-6-3.5"/>'),
|
|
24
|
+
home: svg('<path d="m3 10.5 9-7 9 7"/><path d="M5.5 9v11h13V9"/><path d="M10 20v-5.5h4V20"/>'),
|
|
25
|
+
mapPin: svg('<path d="M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21Z"/><circle cx="12" cy="9.5" r="2.5"/>'),
|
|
26
|
+
users: svg('<circle cx="9" cy="8" r="3.5"/><path d="M2.5 20a6.5 6.5 0 0 1 13 0"/><path d="M16 4.6a3.5 3.5 0 0 1 0 6.8M18.5 14a6.5 6.5 0 0 1 3 6"/>'),
|
|
27
|
+
star: svg('<path d="m12 3 2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.3l-5.6 2.9 1.1-6.2L3 9.6l6.2-.9L12 3Z"/>'),
|
|
28
|
+
sparkle: svg('<path d="M12 3v4M12 17v4M3 12h4M17 12h4M6.3 6.3l2.4 2.4M15.3 15.3l2.4 2.4M6.3 17.7l2.4-2.4M15.3 8.7l2.4-2.4"/>'),
|
|
29
|
+
stethoscope: svg('<path d="M5 3v5a5 5 0 0 0 10 0V3"/><path d="M10 13v2.5a5 5 0 0 0 10 0V13"/><circle cx="20" cy="11" r="2"/>'),
|
|
30
|
+
activity: svg('<path d="M3 12h4l3-8 4 16 3-8h4"/>'),
|
|
31
|
+
lock: svg('<rect x="4.5" y="10.5" width="15" height="10" rx="2"/><path d="M8 10.5V7a4 4 0 0 1 8 0v3.5"/>'),
|
|
32
|
+
box: svg('<path d="m3.5 7.5 8.5-4 8.5 4-8.5 4-8.5-4Z"/><path d="M3.5 7.5v9l8.5 4 8.5-4v-9M12 11.5v9"/>'),
|
|
33
|
+
truck: svg('<path d="M2.5 6h11v10h-11zM13.5 9.5h4l3 3.5V16h-7"/><circle cx="6.5" cy="17.5" r="1.8"/><circle cx="17" cy="17.5" r="1.8"/>'),
|
|
34
|
+
card: svg('<rect x="2.5" y="5" width="19" height="14" rx="2"/><path d="M2.5 10h19M6.5 15h4"/>'),
|
|
35
|
+
globe: svg('<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/>'),
|
|
36
|
+
bolt: svg('<path d="M13 2.5 4.5 13.5H12l-1 8 8.5-11H12l1-8Z"/>'),
|
|
37
|
+
chart: svg('<path d="M3.5 20.5h17"/><path d="M6.5 16v-4M11 16V8M15.5 16v-6M20 16V5"/>'),
|
|
38
|
+
code: svg('<path d="m8 7-5 5 5 5M16 7l5 5-5 5M13.5 4.5l-3 15"/>'),
|
|
39
|
+
mail: svg('<rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3.5 6.5 8.5 6.5 8.5-6.5"/>'),
|
|
40
|
+
fax: svg('<path d="M7 8V3.5h10V8"/><rect x="3" y="8" width="18" height="9" rx="2"/><path d="M7 14h10v6.5H7z"/><path d="M17.5 11h.01"/>'),
|
|
41
|
+
link: svg('<path d="M10 14a4 4 0 0 0 5.7 0l3.5-3.5a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3.5 3.5a4 4 0 0 0 5.7 5.7l1-1"/>'),
|
|
42
|
+
file: svg('<path d="M14 3H6.5A1.5 1.5 0 0 0 5 4.5v15A1.5 1.5 0 0 0 6.5 21h11a1.5 1.5 0 0 0 1.5-1.5V8l-5-5Z"/><path d="M14 3v5h5M8.5 13h7M8.5 17h5"/>'),
|
|
43
|
+
leaf: svg('<path d="M5 19c0-8 5.5-14 15-14 0 9.5-6 15-14 15"/><path d="M5 19 13 11"/>'),
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
export type BlockIconName = keyof typeof blockIcons;
|
|
47
|
+
export const blockIconNames = Object.keys(blockIcons) as BlockIconName[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @sinnstack/ui/blocks — page sections composed from primitives.
|
|
2
|
+
export { default as Hero } from './Hero.astro';
|
|
3
|
+
export { default as CTABanner } from './CTABanner.astro';
|
|
4
|
+
export { default as FeatureGrid } from './FeatureGrid.astro';
|
|
5
|
+
export { default as CardGrid } from './CardGrid.astro';
|
|
6
|
+
export { default as LogoCloud } from './LogoCloud.astro';
|
|
7
|
+
export { default as HeroCarousel } from './HeroCarousel.astro';
|
|
8
|
+
export { default as PageHeader } from './PageHeader.astro';
|
|
9
|
+
export { default as ContactCard } from './ContactCard.astro';
|
|
10
|
+
export { default as Steps } from './Steps.astro';
|
|
11
|
+
export { default as MediaText } from './MediaText.astro';
|
|
12
|
+
export { default as CTAPair } from './CTAPair.astro';
|
|
13
|
+
export { default as StatsBand } from './StatsBand.astro';
|
|
14
|
+
export { default as HighlightCards } from './HighlightCards.astro';
|
|
15
|
+
export { default as ContactForm } from './ContactForm.astro';
|
|
16
|
+
export { default as ProseSection } from './ProseSection.astro';
|
|
17
|
+
export { default as RichText } from './RichText.astro';
|
|
18
|
+
export { default as FAQ } from './FAQ.astro';
|
|
19
|
+
export { default as Testimonials } from './Testimonials.astro';
|
|
20
|
+
export { default as Reviews } from './Reviews.astro';
|
|
21
|
+
export { default as LocationHours } from './LocationHours.astro';
|
|
22
|
+
export { default as ConsentManager } from './ConsentManager.astro';
|
|
23
|
+
export { default as ConsentEmbed } from './ConsentEmbed.astro';
|
|
24
|
+
export { default as ConsentScript } from './ConsentScript.astro';
|
|
25
|
+
export { default as Topbar } from './Topbar.astro';
|
|
26
|
+
export { default as BlockRenderer } from './BlockRenderer.astro';
|
|
27
|
+
export { default as ErrorPage } from './ErrorPage.astro';
|
|
28
|
+
export { default as MaintenancePage } from './MaintenancePage.astro';
|
|
29
|
+
export { errorCopy, copyFor, suggestPage } from './lib/error-pages';
|
|
30
|
+
export type { ErrorStatus, ErrorCopy, SuggestCandidate } from './lib/error-pages';
|
|
31
|
+
|
|
32
|
+
export { telHref, mailHref, contactHref } from './lib/contact';
|
|
33
|
+
export { faqStructuredData } from './lib/faq';
|
|
34
|
+
export { locationStructuredData, directionsHref, mapEmbedSrc, mapSearchHref } from './lib/hours';
|
|
35
|
+
export { richTextPlain, isRichTextEmpty } from './lib/rich-text';
|
|
36
|
+
export type { RichTextValue, RichTextNode, RichTextRoot } from './lib/rich-text';
|
|
37
|
+
export { consentCategoryPresets } from './internal/consent';
|
|
38
|
+
export type { ConsentCategory } from './internal/consent';
|
|
39
|
+
export type { SinnSlideChangeDetail } from './scripts/carousel';
|
|
40
|
+
export { blockIcons, blockIconNames } from './icons';
|
|
41
|
+
export type { BlockIconName } from './icons';
|
|
42
|
+
export type * from './types';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** @internal Renders `actions` data as LinkButtons, then any `actions` slot content. */
|
|
3
|
+
import LinkButton from '../../primitives/LinkButton.astro';
|
|
4
|
+
import VisuallyHidden from '../../primitives/VisuallyHidden.astro';
|
|
5
|
+
import type { ActionItem } from '../types';
|
|
6
|
+
import { actionVariant } from './util';
|
|
7
|
+
import { sf } from './fields';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
actions?: ActionItem[];
|
|
11
|
+
size?: 's' | 'm' | 'l';
|
|
12
|
+
class: string;
|
|
13
|
+
/** Path of the block (or item) that holds `actions`, for `data-sinn-field`. */
|
|
14
|
+
fieldPath?: string;
|
|
15
|
+
};
|
|
16
|
+
const { actions = [], size = 'l', class: className, fieldPath } = Astro.props;
|
|
17
|
+
const hasSlot = Astro.slots.has('default');
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
(actions.length > 0 || hasSlot) && (
|
|
22
|
+
<div class={className}>
|
|
23
|
+
{actions.map((action, i) => (
|
|
24
|
+
<LinkButton href={action.href} size={size} variant={actionVariant(action, i)} newTab={action.newTab} {...sf(fieldPath, action.field)}>
|
|
25
|
+
{action.label}
|
|
26
|
+
{action.srLabel && <VisuallyHidden> {action.srLabel}</VisuallyHidden>}
|
|
27
|
+
{action.arrow && (
|
|
28
|
+
<svg slot="icon-end" class="sinn-action-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14M13 6l6 6-6 6" /></svg>
|
|
29
|
+
)}
|
|
30
|
+
</LinkButton>
|
|
31
|
+
))}
|
|
32
|
+
<slot />
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
/** @internal Eyebrow, heading and description above a block's content. Renders nothing if empty. */
|
|
3
|
+
import Heading from '../../primitives/Heading.astro';
|
|
4
|
+
import Text from '../../primitives/Text.astro';
|
|
5
|
+
import type { TextSize } from '../../primitives/types';
|
|
6
|
+
import type { HeadingLevelNumber } from '../types';
|
|
7
|
+
import { sf } from './fields';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
eyebrow?: string;
|
|
11
|
+
heading?: string;
|
|
12
|
+
headingId?: string;
|
|
13
|
+
headingLevel?: HeadingLevelNumber;
|
|
14
|
+
headingSize?: TextSize;
|
|
15
|
+
/** Small muted heading ("Trusted by…"). Still a real heading. */
|
|
16
|
+
compact?: boolean;
|
|
17
|
+
description?: string;
|
|
18
|
+
fieldPath?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const { eyebrow, heading, headingId, headingLevel = 2, headingSize = '2xl', compact = false, description, fieldPath } = Astro.props;
|
|
22
|
+
const hasContent = Boolean(eyebrow || heading || description);
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
hasContent && (
|
|
27
|
+
<header class="sinn-block__header" data-compact={compact ? '' : undefined}>
|
|
28
|
+
{eyebrow && <p class="sinn-block__eyebrow" {...sf(fieldPath, 'eyebrow')}>{eyebrow}</p>}
|
|
29
|
+
{heading && (
|
|
30
|
+
<Heading
|
|
31
|
+
level={headingLevel}
|
|
32
|
+
size={compact ? 's' : headingSize}
|
|
33
|
+
tone={compact ? 'muted' : 'default'}
|
|
34
|
+
weight={compact ? 'semibold' : 'bold'}
|
|
35
|
+
id={headingId}
|
|
36
|
+
class="sinn-block__title"
|
|
37
|
+
{...sf(fieldPath, 'heading')}
|
|
38
|
+
>
|
|
39
|
+
{heading}
|
|
40
|
+
</Heading>
|
|
41
|
+
)}
|
|
42
|
+
{description && <Text size="l" tone="muted" class="sinn-block__description" {...sf(fieldPath, 'description')}>{description}</Text>}
|
|
43
|
+
</header>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @internal The outer element every section block shares: a <section> (a named landmark when it
|
|
4
|
+
* has a heading), vertical rhythm, background/tone/scheme, and the inner container.
|
|
5
|
+
* The `bleed` slot renders behind the container (full-bleed media, scrims).
|
|
6
|
+
*/
|
|
7
|
+
import type { HTMLAttributes, HTMLTag } from 'astro/types';
|
|
8
|
+
import Container from '../../primitives/Container.astro';
|
|
9
|
+
import type { BlockBackground, BlockSize, BlockSpacing, BlockTone } from '../types';
|
|
10
|
+
import '../styles/blocks.css';
|
|
11
|
+
|
|
12
|
+
type Props = HTMLAttributes<'section'> & {
|
|
13
|
+
as?: HTMLTag;
|
|
14
|
+
name: string;
|
|
15
|
+
spacing?: BlockSpacing;
|
|
16
|
+
background?: BlockBackground;
|
|
17
|
+
tone?: BlockTone;
|
|
18
|
+
scheme?: 'light' | 'dark';
|
|
19
|
+
size?: BlockSize;
|
|
20
|
+
containerSize?: 'narrow' | 'default' | 'wide' | 'full';
|
|
21
|
+
labelledby?: string;
|
|
22
|
+
align?: 'start' | 'center';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
as: Tag = 'section',
|
|
27
|
+
name,
|
|
28
|
+
spacing = 'l',
|
|
29
|
+
background = 'none',
|
|
30
|
+
tone = 'accent',
|
|
31
|
+
scheme,
|
|
32
|
+
size,
|
|
33
|
+
containerSize = 'default',
|
|
34
|
+
labelledby,
|
|
35
|
+
align,
|
|
36
|
+
class: className,
|
|
37
|
+
...rest
|
|
38
|
+
} = Astro.props;
|
|
39
|
+
const surface = background === 'tinted' || background === 'strong' ? background : undefined;
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
<Tag
|
|
43
|
+
class:list={['sinn-block', `sinn-${name}`, className]}
|
|
44
|
+
data-spacing={spacing === 'l' ? undefined : spacing}
|
|
45
|
+
data-background={background === 'subtle' || background === 'sunken' ? background : undefined}
|
|
46
|
+
data-surface={surface}
|
|
47
|
+
data-tone={surface ? tone : undefined}
|
|
48
|
+
data-scheme={scheme}
|
|
49
|
+
data-size={size && size !== 'm' ? size : undefined}
|
|
50
|
+
data-align={align === 'center' ? 'center' : undefined}
|
|
51
|
+
aria-labelledby={labelledby}
|
|
52
|
+
{...rest}
|
|
53
|
+
>
|
|
54
|
+
<slot name="bleed" />
|
|
55
|
+
<Container size={containerSize} class="sinn-block__container" query={false}>
|
|
56
|
+
<slot />
|
|
57
|
+
</Container>
|
|
58
|
+
</Tag>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* @internal Shown in place of a block whose required content is missing, when placeholders
|
|
4
|
+
* are on (dev and CMS preview). Never rendered in production builds by default.
|
|
5
|
+
*/
|
|
6
|
+
type Props = { label: string; hint: string; field?: string };
|
|
7
|
+
const { label, hint, field } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<div class="sinn-block-placeholder" role="note" data-sinn-field={field}>
|
|
11
|
+
<strong>{label}</strong>
|
|
12
|
+
<span>{hint}</span>
|
|
13
|
+
</div>
|