@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,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ConsentManager: asks visitors before anything third-party loads (embedded maps and videos,
|
|
4
|
+
* analytics, marketing tags), remembers the answer, and lets them change it later.
|
|
5
|
+
*
|
|
6
|
+
* - **Nothing third-party runs before consent.** ConsentEmbed and ConsentScript wait for their
|
|
7
|
+
* category; without JavaScript they never load at all (embeds show a link instead).
|
|
8
|
+
* - **Rejecting is as easy as accepting.** "Accept all" and "Reject all" sit side by side with
|
|
9
|
+
* the same style; "Choose" opens a dialog with a switch per category, all off until the
|
|
10
|
+
* visitor turns them on (which also honors a browser's Global Privacy Control signal).
|
|
11
|
+
* - **Changing your mind:** add a "Cookie settings" link anywhere with `data-consent-open`
|
|
12
|
+
* (e.g. in the footer). The dialog shows the saved choices. Revoking a category unloads its
|
|
13
|
+
* embeds; if its scripts already ran, the page reloads so they stop.
|
|
14
|
+
* - **The banner** is a labeled region fixed to the bottom of the screen, early in the page's
|
|
15
|
+
* tab order (put this right after SkipLink). It never traps focus and doesn't cover content
|
|
16
|
+
* at the end of the page. It's hidden without JavaScript, since nothing would need consent.
|
|
17
|
+
* - **Storage:** localStorage (`sinn-consent`), with the policy `version` and the date. Bump
|
|
18
|
+
* `version` when you add a category or change what one covers, and everyone is asked again.
|
|
19
|
+
* Choices also expire after `maxAgeDays` (default 365).
|
|
20
|
+
* - Read or react to choices in your own code with `@sinnstack/ui/blocks/consent`.
|
|
21
|
+
*
|
|
22
|
+
* This is the mechanism, not legal advice: check the wording and categories against the privacy
|
|
23
|
+
* laws that apply to the site.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <SkipLink />
|
|
27
|
+
* <ConsentManager policyHref="/privacy" categories={['media', 'analytics']} />
|
|
28
|
+
* …
|
|
29
|
+
* <button type="button" class="sinn-link" data-consent-open>Cookie settings</button>
|
|
30
|
+
*/
|
|
31
|
+
import Button from '../primitives/Button.astro';
|
|
32
|
+
import Dialog from '../primitives/Dialog.astro';
|
|
33
|
+
import Switch from '../primitives/Switch.astro';
|
|
34
|
+
import Link from '../primitives/Link.astro';
|
|
35
|
+
import { consentCategoryPresets, type ConsentCategory } from './internal/consent';
|
|
36
|
+
import ConsentManagerScript from './internal/ConsentManagerScript.astro';
|
|
37
|
+
import ConsentEmbedScript from './internal/ConsentEmbedScript.astro';
|
|
38
|
+
import { safeHref } from './lib/contact';
|
|
39
|
+
import { uid } from '../primitives/utils';
|
|
40
|
+
import './styles/consent.css';
|
|
41
|
+
|
|
42
|
+
type PresetId = keyof typeof consentCategoryPresets;
|
|
43
|
+
type Props = {
|
|
44
|
+
/** Categories the site uses (besides necessary): preset ids or your own definitions. */
|
|
45
|
+
categories?: Array<PresetId | ConsentCategory>;
|
|
46
|
+
/** Your privacy or cookie policy. */
|
|
47
|
+
policyHref?: string;
|
|
48
|
+
/** Policy version: change it to ask everyone again. */
|
|
49
|
+
version?: string;
|
|
50
|
+
/** Ask again after this many days. */
|
|
51
|
+
maxAgeDays?: number;
|
|
52
|
+
/** Text. Translate per site. */
|
|
53
|
+
labels?: {
|
|
54
|
+
title?: string;
|
|
55
|
+
message?: string;
|
|
56
|
+
policy?: string;
|
|
57
|
+
accept?: string;
|
|
58
|
+
reject?: string;
|
|
59
|
+
choose?: string;
|
|
60
|
+
dialogTitle?: string;
|
|
61
|
+
dialogDescription?: string;
|
|
62
|
+
save?: string;
|
|
63
|
+
close?: string;
|
|
64
|
+
};
|
|
65
|
+
id?: string;
|
|
66
|
+
class?: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
categories = ['media', 'analytics'],
|
|
71
|
+
policyHref,
|
|
72
|
+
version = '1',
|
|
73
|
+
maxAgeDays = 365,
|
|
74
|
+
labels = {},
|
|
75
|
+
id = uid('sinn-consent'),
|
|
76
|
+
class: className,
|
|
77
|
+
} = Astro.props;
|
|
78
|
+
|
|
79
|
+
const text = {
|
|
80
|
+
title: labels.title ?? 'Your privacy choices',
|
|
81
|
+
message: labels.message ?? 'We use a few services from other companies, such as embedded maps and anonymous statistics. They only load if you allow them.',
|
|
82
|
+
policy: labels.policy ?? 'Privacy policy',
|
|
83
|
+
accept: labels.accept ?? 'Accept all',
|
|
84
|
+
reject: labels.reject ?? 'Reject all',
|
|
85
|
+
choose: labels.choose ?? 'Choose',
|
|
86
|
+
dialogTitle: labels.dialogTitle ?? 'Privacy choices',
|
|
87
|
+
dialogDescription: labels.dialogDescription ?? 'Choose what may load on this site. You can change this any time from the "Cookie settings" link.',
|
|
88
|
+
save: labels.save ?? 'Save choices',
|
|
89
|
+
close: labels.close ?? 'Close',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const defs: ConsentCategory[] = [
|
|
93
|
+
consentCategoryPresets.necessary,
|
|
94
|
+
...categories
|
|
95
|
+
.map((c) => (typeof c === 'string' ? consentCategoryPresets[c] : c))
|
|
96
|
+
.filter((c): c is ConsentCategory => Boolean(c && c.id && c.id !== 'necessary' && /^[a-z][a-z0-9-]*$/.test(c.id))),
|
|
97
|
+
];
|
|
98
|
+
const ids = defs.filter((c) => c.id !== 'necessary').map((c) => c.id);
|
|
99
|
+
const policy = safeHref(policyHref);
|
|
100
|
+
const dialogId = `${id}-dialog`;
|
|
101
|
+
const formId = `${id}-form`;
|
|
102
|
+
const titleId = `${id}-title`;
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
<div id={id} class:list={['sinn-consent', className]} data-sinn-consent data-version={version} data-max-age={maxAgeDays} data-categories={ids.join(' ')}>
|
|
106
|
+
<section class="sinn-consent__banner" aria-labelledby={titleId} data-consent-banner hidden>
|
|
107
|
+
<div class="sinn-consent__body">
|
|
108
|
+
<p id={titleId} class="sinn-consent__title">{text.title}</p>
|
|
109
|
+
<p class="sinn-consent__message">
|
|
110
|
+
{text.message}
|
|
111
|
+
{policy && <Fragment> <Link href={policy}>{text.policy}</Link></Fragment>}
|
|
112
|
+
</p>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="sinn-consent__actions">
|
|
115
|
+
<Button type="button" size="m" data-consent-accept>{text.accept}</Button>
|
|
116
|
+
<Button type="button" size="m" data-consent-reject>{text.reject}</Button>
|
|
117
|
+
<Button type="button" size="m" variant="outline" tone="neutral" commandfor={dialogId} command="show-modal">{text.choose}</Button>
|
|
118
|
+
</div>
|
|
119
|
+
</section>
|
|
120
|
+
|
|
121
|
+
<Dialog id={dialogId} title={text.dialogTitle} description={text.dialogDescription} size="m" closeLabel={text.close} data-sinn-consent-dialog>
|
|
122
|
+
<form id={formId} class="sinn-consent__form" method="dialog" data-consent-form>
|
|
123
|
+
<ul class="sinn-consent__list" role="list">
|
|
124
|
+
{defs.map((c) => (
|
|
125
|
+
<li class="sinn-consent__item">
|
|
126
|
+
<Switch
|
|
127
|
+
name={`consent-${c.id}`}
|
|
128
|
+
label={c.label}
|
|
129
|
+
description={c.description}
|
|
130
|
+
data-consent-category={c.id}
|
|
131
|
+
checked={c.id === 'necessary' ? true : undefined}
|
|
132
|
+
disabled={c.id === 'necessary' ? true : undefined}
|
|
133
|
+
labelPosition="start"
|
|
134
|
+
/>
|
|
135
|
+
</li>
|
|
136
|
+
))}
|
|
137
|
+
</ul>
|
|
138
|
+
</form>
|
|
139
|
+
<Fragment slot="footer">
|
|
140
|
+
<Button type="button" variant="ghost" tone="neutral" data-consent-reject>{text.reject}</Button>
|
|
141
|
+
<Button type="button" variant="outline" data-consent-accept>{text.accept}</Button>
|
|
142
|
+
<Button type="submit" form={formId}>{text.save}</Button>
|
|
143
|
+
</Fragment>
|
|
144
|
+
</Dialog>
|
|
145
|
+
</div>
|
|
146
|
+
<ConsentManagerScript />
|
|
147
|
+
<ConsentEmbedScript />
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ConsentScript: a third-party script (analytics, a chat widget, an ad tag) that loads only
|
|
4
|
+
* after the visitor allows its category in ConsentManager.
|
|
5
|
+
*
|
|
6
|
+
* - Renders an inert `<template>` holding the URL, so nothing is requested before consent;
|
|
7
|
+
* then a real `<script src>` is added to `<head>`. It runs at most once per page view.
|
|
8
|
+
* - Only `src` scripts: inline snippets would need `unsafe-inline` in your CSP. Put a vendor's
|
|
9
|
+
* setup snippet in a file under `public/` (or your own module) and load that.
|
|
10
|
+
* - Your CSP's `script-src` (and `connect-src`, for analytics) must list the vendor's origin.
|
|
11
|
+
* - Revoking the category reloads the page, so the script stops.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <ConsentScript category="analytics" src="https://plausible.io/js/script.js" async />
|
|
15
|
+
*/
|
|
16
|
+
import ConsentEmbedScript from './internal/ConsentEmbedScript.astro';
|
|
17
|
+
|
|
18
|
+
type Props = {
|
|
19
|
+
src: string;
|
|
20
|
+
/** Consent category it needs. */
|
|
21
|
+
category?: string;
|
|
22
|
+
async?: boolean;
|
|
23
|
+
defer?: boolean;
|
|
24
|
+
module?: boolean;
|
|
25
|
+
id?: string;
|
|
26
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
27
|
+
integrity?: string;
|
|
28
|
+
referrerpolicy?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const { src, category = 'analytics', async = true, defer = false, module = false, id, crossorigin, integrity, referrerpolicy } = Astro.props;
|
|
32
|
+
const url = typeof src === 'string' && /^(https:\/\/|\/)/i.test(src.trim()) ? src.trim() : undefined;
|
|
33
|
+
if (!url) throw new Error(`<ConsentScript> needs an https:// (or site-relative) src; got "${src}".`);
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<template
|
|
37
|
+
data-sinn-consent-script
|
|
38
|
+
data-category={category}
|
|
39
|
+
data-src={url}
|
|
40
|
+
data-async={async ? '' : undefined}
|
|
41
|
+
data-defer={defer ? '' : undefined}
|
|
42
|
+
data-module={module ? '' : undefined}
|
|
43
|
+
data-id={id}
|
|
44
|
+
data-crossorigin={crossorigin}
|
|
45
|
+
data-integrity={integrity}
|
|
46
|
+
data-referrerpolicy={referrerpolicy}></template>
|
|
47
|
+
<ConsentEmbedScript />
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ContactCard — how to reach you: address, click-to-call phone, fax, email, hours and links.
|
|
4
|
+
*
|
|
5
|
+
* - Each item has a `type` that decides its icon and link: phones become `tel:` links (normalized:
|
|
6
|
+
* "(888) 450-2884" → tel:+18884502884, `countryCode` for non-US), emails `mailto:`, `link`
|
|
7
|
+
* items their href. Fax numbers, addresses and hours are never links. Only http(s), mailto,
|
|
8
|
+
* tel, sms and relative URLs are linked, so CMS content can't inject other schemes.
|
|
9
|
+
* - Addresses render in `<address>` and keep their line breaks; so do hours.
|
|
10
|
+
* - `embedded`: just the card, with no section padding or container, for a sidebar or a grid
|
|
11
|
+
* column. Otherwise it's a full section with its own heading.
|
|
12
|
+
* - `variant`: `outline` (bordered surface, default) or `plain`, like Card and Table. `card` is the
|
|
13
|
+
* deprecated name for `outline`. `columns`: 1 (default, a list) or
|
|
14
|
+
* up to 3 when the card is wide (contact pages).
|
|
15
|
+
* - `note`: small print under the items. Say what not to send by email
|
|
16
|
+
* ("Please don't email passwords or API keys.").
|
|
17
|
+
* - Placeholder: no items → dashed placeholder in dev/CMS preview, nothing in builds.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <ContactCard heading="Sinnstack" items={[
|
|
21
|
+
* { type: 'address', value: '560 N Kimball Ave, #140\nSouthlake, TX 76092' },
|
|
22
|
+
* { type: 'phone', value: '(888) 450-2884' },
|
|
23
|
+
* { type: 'fax', value: '(817) 632-3225' },
|
|
24
|
+
* { type: 'email', value: 'info@example.com' },
|
|
25
|
+
* ]} embedded />
|
|
26
|
+
*/
|
|
27
|
+
import Heading from '../primitives/Heading.astro';
|
|
28
|
+
import Text from '../primitives/Text.astro';
|
|
29
|
+
import VisuallyHidden from '../primitives/VisuallyHidden.astro';
|
|
30
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
31
|
+
import type { BlockProps, ContactItem, HeadingLevelNumber } from './types';
|
|
32
|
+
import BlockShell from './internal/BlockShell.astro';
|
|
33
|
+
import Placeholder from './internal/Placeholder.astro';
|
|
34
|
+
import { blockIcons } from './icons';
|
|
35
|
+
import { contactDefaults, contactHref, lines } from './lib/contact';
|
|
36
|
+
import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
|
|
37
|
+
import { sf, joinField } from './internal/fields';
|
|
38
|
+
import './styles/blocks.css';
|
|
39
|
+
import { renameValue } from '../primitives/lib/deprecate';
|
|
40
|
+
|
|
41
|
+
type Props = Omit<HTMLAttributes<'section'>, 'title'> &
|
|
42
|
+
BlockProps & {
|
|
43
|
+
eyebrow?: string;
|
|
44
|
+
heading?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
headingLevel?: HeadingLevelNumber;
|
|
47
|
+
items?: ContactItem[];
|
|
48
|
+
note?: string;
|
|
49
|
+
/** Only the card (no section padding/container), for sidebars and grid columns. */
|
|
50
|
+
embedded?: boolean;
|
|
51
|
+
variant?: 'outline' | 'plain' | 'card';
|
|
52
|
+
columns?: 1 | 2 | 3;
|
|
53
|
+
/** Country calling code for 10-digit numbers without one. Default "1" (US/Canada). */
|
|
54
|
+
countryCode?: string;
|
|
55
|
+
icons?: Record<string, string>;
|
|
56
|
+
newTabLabel?: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const {
|
|
60
|
+
eyebrow,
|
|
61
|
+
heading,
|
|
62
|
+
description,
|
|
63
|
+
headingLevel = 2,
|
|
64
|
+
items = [],
|
|
65
|
+
note,
|
|
66
|
+
embedded = false,
|
|
67
|
+
variant: variantProp = 'outline',
|
|
68
|
+
columns = 1,
|
|
69
|
+
countryCode = '1',
|
|
70
|
+
icons = blockIcons as Record<string, string>,
|
|
71
|
+
newTabLabel = 'opens in a new tab',
|
|
72
|
+
align = 'start',
|
|
73
|
+
anchor,
|
|
74
|
+
spacing = 'l',
|
|
75
|
+
background = 'none',
|
|
76
|
+
tone = 'accent',
|
|
77
|
+
scheme,
|
|
78
|
+
containerSize = 'default',
|
|
79
|
+
placeholder = PLACEHOLDER_DEFAULT,
|
|
80
|
+
fieldPath,
|
|
81
|
+
id,
|
|
82
|
+
class: className,
|
|
83
|
+
...rest
|
|
84
|
+
} = Astro.props;
|
|
85
|
+
const variant = renameValue('ContactCard', 'variant', variantProp, { card: 'outline' });
|
|
86
|
+
|
|
87
|
+
const entries = (items ?? [])
|
|
88
|
+
.filter((item) => item && contactDefaults[item.type] && String(item.value ?? '').trim())
|
|
89
|
+
.map((item) => {
|
|
90
|
+
const defaults = contactDefaults[item.type];
|
|
91
|
+
const href = contactHref(item, countryCode);
|
|
92
|
+
const isExternal = Boolean(href && /^https?:/i.test(href) && item.newTab);
|
|
93
|
+
return {
|
|
94
|
+
item,
|
|
95
|
+
label: item.label ?? defaults.label,
|
|
96
|
+
icon: icons[item.icon ?? defaults.icon],
|
|
97
|
+
href,
|
|
98
|
+
isExternal,
|
|
99
|
+
valueLines: lines(item.value),
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
const { sectionId, headingId } = blockIds('contact', anchor, id);
|
|
103
|
+
const hasHeading = Boolean(heading?.trim());
|
|
104
|
+
// Embedded: a bare <section> (sidebar/grid column). Otherwise the standard block shell.
|
|
105
|
+
// (Typed loosely: TS can't check spread props against a union of a tag and a component.)
|
|
106
|
+
const Wrapper: any = embedded ? 'section' : BlockShell;
|
|
107
|
+
const wrapperProps = embedded
|
|
108
|
+
? { id: sectionId, class: ['sinn-contact', className].filter(Boolean).join(' '), 'data-embedded': '', 'aria-labelledby': hasHeading ? headingId : undefined }
|
|
109
|
+
: { name: 'contact', id: sectionId, class: className, spacing, background, tone, scheme, containerSize, labelledby: hasHeading ? headingId : undefined, align };
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
{
|
|
113
|
+
entries.length === 0 ? (
|
|
114
|
+
placeholder && <Placeholder label="Contact card" hint="Add a phone number, email or address." field={joinField(fieldPath, 'items')} />
|
|
115
|
+
) : (
|
|
116
|
+
<Wrapper {...wrapperProps} {...sf(fieldPath)} {...rest}>
|
|
117
|
+
<div class="sinn-contact__card" data-variant={variant} data-columns={columns === 1 ? undefined : columns}>
|
|
118
|
+
{(eyebrow || hasHeading || description) && (
|
|
119
|
+
<div class="sinn-contact__header">
|
|
120
|
+
{eyebrow && <p class="sinn-block__eyebrow" {...sf(fieldPath, 'eyebrow')}>{eyebrow}</p>}
|
|
121
|
+
{hasHeading && (
|
|
122
|
+
<Heading level={headingLevel} size={embedded ? 'l' : '2xl'} weight="bold" id={headingId} class="sinn-contact__title" {...sf(fieldPath, 'heading')}>
|
|
123
|
+
{heading}
|
|
124
|
+
</Heading>
|
|
125
|
+
)}
|
|
126
|
+
{description && <Text tone="muted" class="sinn-contact__description" {...sf(fieldPath, 'description')}>{description}</Text>}
|
|
127
|
+
</div>
|
|
128
|
+
)}
|
|
129
|
+
<ul class="sinn-contact__list" role="list" {...sf(fieldPath, 'items')}>
|
|
130
|
+
{entries.map(({ item, label, icon, href, isExternal, valueLines }, i) => (
|
|
131
|
+
<li class="sinn-contact__item" data-type={item.type} {...sf(fieldPath, item.field)}>
|
|
132
|
+
{icon && <span class="sinn-contact__icon" set:html={icon} />}
|
|
133
|
+
<div class="sinn-contact__body">
|
|
134
|
+
{label && <span class="sinn-contact__label" {...sf(fieldPath, item.field, 'label')}>{label}</span>}
|
|
135
|
+
{item.type === 'address' ? (
|
|
136
|
+
<address class="sinn-contact__value" {...sf(fieldPath, item.field, 'value')}>
|
|
137
|
+
{valueLines.map((l, k) => (k === 0 ? l : <Fragment><br />{l}</Fragment>))}
|
|
138
|
+
</address>
|
|
139
|
+
) : href ? (
|
|
140
|
+
<a
|
|
141
|
+
class="sinn-contact__value sinn-contact__link"
|
|
142
|
+
href={href}
|
|
143
|
+
target={isExternal ? '_blank' : undefined}
|
|
144
|
+
rel={isExternal ? 'noopener noreferrer' : undefined}
|
|
145
|
+
{...sf(fieldPath, item.field, 'value')}
|
|
146
|
+
>
|
|
147
|
+
{valueLines.join(' ')}
|
|
148
|
+
{isExternal && <VisuallyHidden> ({newTabLabel})</VisuallyHidden>}
|
|
149
|
+
</a>
|
|
150
|
+
) : (
|
|
151
|
+
<span class="sinn-contact__value" {...sf(fieldPath, item.field, 'value')}>
|
|
152
|
+
{valueLines.map((l, k) => (k === 0 ? l : <Fragment><br />{l}</Fragment>))}
|
|
153
|
+
</span>
|
|
154
|
+
)}
|
|
155
|
+
</div>
|
|
156
|
+
</li>
|
|
157
|
+
))}
|
|
158
|
+
</ul>
|
|
159
|
+
{note && <p class="sinn-contact__note" {...sf(fieldPath, 'note')}>{note}</p>}
|
|
160
|
+
<slot />
|
|
161
|
+
</div>
|
|
162
|
+
</Wrapper>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ContactForm: a "send us a message" form that's honest about where messages go.
|
|
4
|
+
*
|
|
5
|
+
* - Default fields: first + last name (or one `name` field), phone, email, message. Put your own
|
|
6
|
+
* fields in the default slot to replace them (a project brief, a booking request…); the
|
|
7
|
+
* endpoint handling, spam trap, notice and submit row stay.
|
|
8
|
+
* - Where it posts: `action`, or `PUBLIC_FORM_ENDPOINT` from the site's environment. With
|
|
9
|
+
* neither, the form still renders (so the page can be reviewed) but shows a warning notice
|
|
10
|
+
* with `fallbackPhone` / `fallbackEmail` instead of pretending to send. Health, legal or
|
|
11
|
+
* financial details need an endpoint whose provider signs the right agreement (e.g. a HIPAA BAA).
|
|
12
|
+
* - Spam: a visually hidden honeypot field (`honeypotName`) that people never see or tab to.
|
|
13
|
+
* `source` adds a hidden `source_page` field so you know which page sent it.
|
|
14
|
+
* - Validation: the Form primitive's inline validation (native validation without JavaScript).
|
|
15
|
+
* - `bare`: just the form (to place inside your own layout, e.g. a page column). Otherwise a
|
|
16
|
+
* section with an optional heading and description, the form in a narrow container.
|
|
17
|
+
* - `variant="outline"` (default): the form sits in a bordered panel. `plain`: no panel. `panel` is the
|
|
18
|
+
* deprecated name for `outline`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <ContactForm bare source="contact" fallbackPhone="(888) 450-2884" fallbackEmail="info@example.com"
|
|
22
|
+
* messageHint="Please don’t include passwords or API keys." note="We reply within one business day." />
|
|
23
|
+
*/
|
|
24
|
+
import Form from '../primitives/Form.astro';
|
|
25
|
+
import Grid from '../primitives/Grid.astro';
|
|
26
|
+
import Input from '../primitives/Input.astro';
|
|
27
|
+
import Textarea from '../primitives/Textarea.astro';
|
|
28
|
+
import Button from '../primitives/Button.astro';
|
|
29
|
+
import Text from '../primitives/Text.astro';
|
|
30
|
+
import Callout from '../primitives/Callout.astro';
|
|
31
|
+
import Link from '../primitives/Link.astro';
|
|
32
|
+
import { uid } from '../primitives/utils';
|
|
33
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
34
|
+
import type { BlockProps, HeadingLevelNumber } from './types';
|
|
35
|
+
import BlockShell from './internal/BlockShell.astro';
|
|
36
|
+
import BlockHeader from './internal/BlockHeader.astro';
|
|
37
|
+
import { telHref, mailHref } from './lib/contact';
|
|
38
|
+
import { blockIds } from './internal/util';
|
|
39
|
+
import { sf } from './internal/fields';
|
|
40
|
+
import './styles/blocks.css';
|
|
41
|
+
import { renameValue } from '../primitives/lib/deprecate';
|
|
42
|
+
|
|
43
|
+
type Props = Omit<HTMLAttributes<'form'>, 'title'> &
|
|
44
|
+
Omit<BlockProps, 'placeholder'> & {
|
|
45
|
+
/** Section heading (ignored with `bare`). */
|
|
46
|
+
heading?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
headingLevel?: HeadingLevelNumber;
|
|
49
|
+
/** Render only the form, no section. */
|
|
50
|
+
bare?: boolean;
|
|
51
|
+
variant?: 'outline' | 'plain' | 'panel';
|
|
52
|
+
/** Where to post. Defaults to PUBLIC_FORM_ENDPOINT. */
|
|
53
|
+
action?: string;
|
|
54
|
+
method?: 'post' | 'get';
|
|
55
|
+
/** Accessible name of the form. */
|
|
56
|
+
label?: string;
|
|
57
|
+
nameFields?: 'split' | 'single';
|
|
58
|
+
phone?: 'optional' | 'required' | 'hidden';
|
|
59
|
+
/** Hint under the message box ("Please don't include passwords"). */
|
|
60
|
+
messageHint?: string;
|
|
61
|
+
/** Small print beside the submit button ("We reply within one business day"). */
|
|
62
|
+
note?: string;
|
|
63
|
+
submitLabel?: string;
|
|
64
|
+
/** Value of the hidden `source_page` field. */
|
|
65
|
+
source?: string;
|
|
66
|
+
honeypotName?: string;
|
|
67
|
+
/** Shown in the not-connected notice. */
|
|
68
|
+
fallbackPhone?: string;
|
|
69
|
+
fallbackEmail?: string;
|
|
70
|
+
/** Prefix for field ids (unique per page). Generated when omitted. */
|
|
71
|
+
idPrefix?: string;
|
|
72
|
+
labels?: Partial<typeof DEFAULT_LABELS>;
|
|
73
|
+
/** @internal Set by the section wrapper when it forwards custom fields. */
|
|
74
|
+
__customFields?: boolean;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const DEFAULT_LABELS = {
|
|
78
|
+
firstName: 'First name',
|
|
79
|
+
lastName: 'Last name',
|
|
80
|
+
name: 'Your name',
|
|
81
|
+
phone: 'Phone number',
|
|
82
|
+
email: 'Email',
|
|
83
|
+
message: 'How can we help?',
|
|
84
|
+
notConnectedTitle: 'Online messages aren’t connected yet',
|
|
85
|
+
notConnectedCall: 'Until they are, please call',
|
|
86
|
+
notConnectedOr: 'or email',
|
|
87
|
+
notConnectedEmailOnly: 'Until they are, please email',
|
|
88
|
+
honeypot: 'Leave this field empty',
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const {
|
|
92
|
+
heading,
|
|
93
|
+
description,
|
|
94
|
+
headingLevel = 2,
|
|
95
|
+
bare = false,
|
|
96
|
+
variant: variantProp = 'outline',
|
|
97
|
+
action,
|
|
98
|
+
method = 'post',
|
|
99
|
+
label = 'Contact form',
|
|
100
|
+
nameFields = 'split',
|
|
101
|
+
phone = 'optional',
|
|
102
|
+
messageHint,
|
|
103
|
+
note,
|
|
104
|
+
submitLabel = 'Send message',
|
|
105
|
+
source,
|
|
106
|
+
honeypotName = 'company_website',
|
|
107
|
+
fallbackPhone,
|
|
108
|
+
fallbackEmail,
|
|
109
|
+
idPrefix,
|
|
110
|
+
labels: labelOverrides = {},
|
|
111
|
+
__customFields,
|
|
112
|
+
align,
|
|
113
|
+
anchor,
|
|
114
|
+
spacing = 'l',
|
|
115
|
+
background,
|
|
116
|
+
tone,
|
|
117
|
+
scheme,
|
|
118
|
+
containerSize = 'narrow',
|
|
119
|
+
fieldPath,
|
|
120
|
+
id,
|
|
121
|
+
class: className,
|
|
122
|
+
...rest
|
|
123
|
+
} = Astro.props;
|
|
124
|
+
const variant = renameValue('ContactForm', 'variant', variantProp, { panel: 'outline' });
|
|
125
|
+
|
|
126
|
+
const L = { ...DEFAULT_LABELS, ...labelOverrides };
|
|
127
|
+
const endpoint = (action ?? import.meta.env?.PUBLIC_FORM_ENDPOINT ?? '').trim();
|
|
128
|
+
const connected = Boolean(endpoint);
|
|
129
|
+
const p = idPrefix ?? uid('sinn-cf');
|
|
130
|
+
const custom = __customFields ?? Astro.slots.has('default');
|
|
131
|
+
const phoneLink = fallbackPhone ? telHref(fallbackPhone) : undefined;
|
|
132
|
+
const emailLink = fallbackEmail ? mailHref(fallbackEmail) : undefined;
|
|
133
|
+
const { sectionId, headingId } = blockIds('contact-form', anchor, id);
|
|
134
|
+
const hasHeader = !bare && Boolean(heading || description);
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
{bare ? (
|
|
138
|
+
<Form
|
|
139
|
+
validate="inline"
|
|
140
|
+
action={connected ? endpoint : undefined}
|
|
141
|
+
method={method}
|
|
142
|
+
class:list={['sinn-contact-form', className]}
|
|
143
|
+
aria-label={label}
|
|
144
|
+
data-variant={variant}
|
|
145
|
+
data-connected={connected ? '' : undefined}
|
|
146
|
+
{...rest}
|
|
147
|
+
>
|
|
148
|
+
{custom ? <slot /> : (
|
|
149
|
+
<Fragment>
|
|
150
|
+
<Grid min="s" gap="m" cols={2}>
|
|
151
|
+
{nameFields === 'split' ? (
|
|
152
|
+
<Fragment>
|
|
153
|
+
<Input id={`${p}-first`} name="first_name" label={L.firstName} required autocomplete="given-name" />
|
|
154
|
+
<Input id={`${p}-last`} name="last_name" label={L.lastName} required autocomplete="family-name" />
|
|
155
|
+
</Fragment>
|
|
156
|
+
) : (
|
|
157
|
+
<Input id={`${p}-name`} name="name" label={L.name} required autocomplete="name" />
|
|
158
|
+
)}
|
|
159
|
+
{phone !== 'hidden' && <Input id={`${p}-phone`} name="phone" type="tel" label={L.phone} required={phone === 'required'} optional={phone === 'optional'} autocomplete="tel" />}
|
|
160
|
+
<Input id={`${p}-email`} name="email" type="email" label={L.email} required autocomplete="email" />
|
|
161
|
+
</Grid>
|
|
162
|
+
<Textarea id={`${p}-message`} name="message" label={L.message} description={messageHint} required rows={5} />
|
|
163
|
+
</Fragment>
|
|
164
|
+
)}
|
|
165
|
+
<div class="sinn-contact-form__hp" aria-hidden="true">
|
|
166
|
+
<label>{L.honeypot} <input type="text" name={honeypotName} tabindex="-1" autocomplete="off" /></label>
|
|
167
|
+
</div>
|
|
168
|
+
{source && <input type="hidden" name="source_page" value={source} />}
|
|
169
|
+
{!connected && (
|
|
170
|
+
<Callout tone="warning" size="s" title={L.notConnectedTitle}>
|
|
171
|
+
{phoneLink ? (
|
|
172
|
+
<Fragment>
|
|
173
|
+
{`${L.notConnectedCall} `}<Link href={phoneLink}>{fallbackPhone}</Link>
|
|
174
|
+
{emailLink && <Fragment>{` ${L.notConnectedOr} `}<Link href={emailLink}>{fallbackEmail}</Link></Fragment>}.
|
|
175
|
+
</Fragment>
|
|
176
|
+
) : emailLink ? (
|
|
177
|
+
<Fragment>{`${L.notConnectedEmailOnly} `}<Link href={emailLink}>{fallbackEmail}</Link>.</Fragment>
|
|
178
|
+
) : null}
|
|
179
|
+
</Callout>
|
|
180
|
+
)}
|
|
181
|
+
<div class="sinn-contact-form__footer">
|
|
182
|
+
{note && <Text size="s" tone="muted">{note}</Text>}
|
|
183
|
+
<Button type="submit">{submitLabel}</Button>
|
|
184
|
+
</div>
|
|
185
|
+
</Form>
|
|
186
|
+
) : (
|
|
187
|
+
<BlockShell
|
|
188
|
+
name="contact-form-section"
|
|
189
|
+
id={sectionId}
|
|
190
|
+
spacing={spacing}
|
|
191
|
+
background={background}
|
|
192
|
+
tone={tone}
|
|
193
|
+
scheme={scheme}
|
|
194
|
+
containerSize={containerSize}
|
|
195
|
+
labelledby={heading ? headingId : undefined}
|
|
196
|
+
align={align}
|
|
197
|
+
{...sf(fieldPath)}
|
|
198
|
+
>
|
|
199
|
+
{hasHeader && <BlockHeader heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />}
|
|
200
|
+
<Astro.self
|
|
201
|
+
bare
|
|
202
|
+
class={className}
|
|
203
|
+
variant={variant}
|
|
204
|
+
action={action}
|
|
205
|
+
method={method}
|
|
206
|
+
label={heading || label}
|
|
207
|
+
nameFields={nameFields}
|
|
208
|
+
phone={phone}
|
|
209
|
+
messageHint={messageHint}
|
|
210
|
+
note={note}
|
|
211
|
+
submitLabel={submitLabel}
|
|
212
|
+
source={source}
|
|
213
|
+
honeypotName={honeypotName}
|
|
214
|
+
fallbackPhone={fallbackPhone}
|
|
215
|
+
fallbackEmail={fallbackEmail}
|
|
216
|
+
idPrefix={p}
|
|
217
|
+
labels={labelOverrides}
|
|
218
|
+
__customFields={custom}
|
|
219
|
+
{...rest}
|
|
220
|
+
>
|
|
221
|
+
<slot />
|
|
222
|
+
</Astro.self>
|
|
223
|
+
</BlockShell>
|
|
224
|
+
)}
|