@atomic-ui/blocks 0.0.0-stage → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -2
- package/custom-elements.json +8688 -0
- package/dist/chunk-4JW2CHWS.js +708 -0
- package/dist/chunk-4JW2CHWS.js.map +1 -0
- package/dist/chunk-AFN7IAG2.js +379 -0
- package/dist/chunk-AFN7IAG2.js.map +1 -0
- package/dist/chunk-F4BTXUYP.js +65 -0
- package/dist/chunk-F4BTXUYP.js.map +1 -0
- package/dist/chunk-MYTYMOH6.js +193 -0
- package/dist/chunk-MYTYMOH6.js.map +1 -0
- package/dist/chunk-OTOFULMT.js +465 -0
- package/dist/chunk-OTOFULMT.js.map +1 -0
- package/dist/chunk-PORKVHAX.js +255 -0
- package/dist/chunk-PORKVHAX.js.map +1 -0
- package/dist/chunk-T7U4OPTW.js +413 -0
- package/dist/chunk-T7U4OPTW.js.map +1 -0
- package/dist/chunk-WHENVU5E.js +318 -0
- package/dist/chunk-WHENVU5E.js.map +1 -0
- package/dist/chunk-XHFUTZGU.js +228 -0
- package/dist/chunk-XHFUTZGU.js.map +1 -0
- package/dist/chunk-XJMKAK2I.js +442 -0
- package/dist/chunk-XJMKAK2I.js.map +1 -0
- package/dist/components/card-grid.d.ts +72 -0
- package/dist/components/card-grid.js +7 -0
- package/dist/components/card-grid.js.map +1 -0
- package/dist/components/changelog.d.ts +373 -0
- package/dist/components/changelog.js +16 -0
- package/dist/components/changelog.js.map +1 -0
- package/dist/components/estimator.d.ts +246 -0
- package/dist/components/estimator.js +11 -0
- package/dist/components/estimator.js.map +1 -0
- package/dist/components/marketing.d.ts +342 -0
- package/dist/components/marketing.js +17 -0
- package/dist/components/marketing.js.map +1 -0
- package/dist/components/organisms.d.ts +559 -0
- package/dist/components/organisms.js +23 -0
- package/dist/components/organisms.js.map +1 -0
- package/dist/components/property.d.ts +389 -0
- package/dist/components/property.js +17 -0
- package/dist/components/property.js.map +1 -0
- package/dist/components/scene.d.ts +138 -0
- package/dist/components/scene.js +7 -0
- package/dist/components/scene.js.map +1 -0
- package/dist/components/scrubber.d.ts +86 -0
- package/dist/components/scrubber.js +7 -0
- package/dist/components/scrubber.js.map +1 -0
- package/dist/components/selling.d.ts +409 -0
- package/dist/components/selling.js +23 -0
- package/dist/components/selling.js.map +1 -0
- package/dist/components/site.d.ts +235 -0
- package/dist/components/site.js +11 -0
- package/dist/components/site.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/dist/standalone/atomic-ui-blocks.js +1229 -0
- package/dist/standalone/atomic-ui-blocks.js.map +7 -0
- package/dist/standalone/index.html +78 -0
- package/package.json +64 -3
- package/scripts/copy-to-product.mjs +59 -0
- package/specimen/index.html +78 -0
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
// packages/blocks/src/components/organisms.ts
|
|
2
|
+
import { css, html, nothing } from "lit";
|
|
3
|
+
import { say, ImpaktElement, focusRing, targetSize, visuallyHidden, fontWeight, lineHeight, space, spaceAround, t, token, type, iconSvg } from "@atomic-ui/ui";
|
|
4
|
+
var token_accent = token("color.accent.default", "#c8a15a");
|
|
5
|
+
var reducedMotion = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6
|
+
var roundButton = css`
|
|
7
|
+
.round { ${targetSize} display: inline-flex; align-items: center; justify-content: center; inline-size: 44px; block-size: 44px; padding: 0; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.rule}; border-radius: 50%; box-shadow: ${t.shadowSm}; cursor: pointer; transition: box-shadow 120ms ease-in-out, background-color 120ms ease-in-out; }
|
|
8
|
+
.round:hover:not(:disabled) { box-shadow: ${t.shadowMd}; }
|
|
9
|
+
.round:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
|
|
10
|
+
`;
|
|
11
|
+
var headingStyles = css`
|
|
12
|
+
.eyebrow { margin: 0; color: var(--impakt-eyebrow, var(--impakt-color-text-eyebrow, ${t.brand})); ${type("sm")} font-size: var(--impakt-font-size-eyebrow, var(--impakt-font-size-sm, 0.875rem)); font-family: ${t.fontEyebrow}; font-weight: var(--impakt-font-weight-eyebrow, ${fontWeight("semibold")}); letter-spacing: ${t.trackingWide}; text-transform: uppercase; }
|
|
13
|
+
.h { margin: 0; color: ${t.textHeading}; font-family: ${t.fontHeading}; font-weight: ${fontWeight("bold")}; letter-spacing: ${t.trackingTight}; text-wrap: balance; }
|
|
14
|
+
.lead { margin: 0; color: ${t.textMuted}; text-wrap: pretty; }
|
|
15
|
+
`;
|
|
16
|
+
var ImpaktCarousel = class extends ImpaktElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.index = 0;
|
|
20
|
+
this.count = 0;
|
|
21
|
+
/** How many slides fit right now, which the width decides. */
|
|
22
|
+
this.visible = null;
|
|
23
|
+
/** Where a button or dot is taking the row. Until it arrives, the scroll position is not the truth. */
|
|
24
|
+
this.heading = null;
|
|
25
|
+
this.paused = false;
|
|
26
|
+
this.held = false;
|
|
27
|
+
this.label = "Slides";
|
|
28
|
+
this.perView = "1";
|
|
29
|
+
this.arrows = "below";
|
|
30
|
+
this.autoplay = false;
|
|
31
|
+
this.seconds = 6;
|
|
32
|
+
this.spaceAbove = "none";
|
|
33
|
+
this.spaceBelow = "none";
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
this.properties = {
|
|
37
|
+
label: { type: String },
|
|
38
|
+
perView: { type: String, reflect: true, attribute: "per-view" },
|
|
39
|
+
arrows: { type: String, reflect: true },
|
|
40
|
+
autoplay: { type: Boolean, reflect: true },
|
|
41
|
+
seconds: { type: Number },
|
|
42
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
43
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
static {
|
|
47
|
+
this.styles = [...ImpaktElement.styles, focusRing, spaceAround, roundButton, css`
|
|
48
|
+
:host { display: block; container-type: inline-size; --most: 1; --gap: ${space(6)}; }
|
|
49
|
+
:host([per-view='2']) { --most: 2; }
|
|
50
|
+
:host([per-view='3']) { --most: 3; }
|
|
51
|
+
.track { --per: var(--most); display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-block: ${space(1)} ${space(2)}; border-radius: ${t.radiusLg}; }
|
|
52
|
+
.track::-webkit-scrollbar { display: none; }
|
|
53
|
+
::slotted(*) { flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); min-inline-size: 0; scroll-snap-align: start; box-sizing: border-box; }
|
|
54
|
+
/* Whole slides only: a slice of the next one reads as content spilling out of the page. */
|
|
55
|
+
@container (max-width: 60rem) { .track { --per: min(var(--most), 2); } }
|
|
56
|
+
@container (max-width: 40rem) { .track { --per: 1; --gap: ${space(4)}; } }
|
|
57
|
+
.controls { display: flex; align-items: center; justify-content: space-between; gap: ${space(4)}; margin-block-start: ${space(4)}; }
|
|
58
|
+
.dots { display: flex; flex-wrap: wrap; gap: ${space(1)}; }
|
|
59
|
+
.dot { ${targetSize} display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 0; cursor: pointer; border-radius: ${t.radiusSm}; }
|
|
60
|
+
.dot span { display: block; inline-size: 8px; block-size: 8px; border-radius: 999px; background: ${t.rule}; transition: inline-size 150ms ease-in-out, background-color 150ms ease-in-out; }
|
|
61
|
+
.dot[aria-current='true'] span { inline-size: 24px; background: ${t.brand}; }
|
|
62
|
+
.buttons { display: flex; gap: ${space(2)}; }
|
|
63
|
+
section { position: relative; }
|
|
64
|
+
@container (min-width: 40.01rem) { :host([arrows='top']) .buttons { position: absolute; inset-block-end: calc(100% + ${space(4)}); inset-inline-end: 0; } }
|
|
65
|
+
.sr-only { ${visuallyHidden} }
|
|
66
|
+
@media (forced-colors: active) { .dot span { background: CanvasText; } .dot[aria-current='true'] span { background: Highlight; } }
|
|
67
|
+
`];
|
|
68
|
+
}
|
|
69
|
+
get track() {
|
|
70
|
+
return this.renderRoot.querySelector(".track");
|
|
71
|
+
}
|
|
72
|
+
get slides() {
|
|
73
|
+
return Array.from(this.children);
|
|
74
|
+
}
|
|
75
|
+
/** The last slide that can sit at the start of the row. */
|
|
76
|
+
get last() {
|
|
77
|
+
return Math.max(0, this.count - (this.visible ?? Number(this.perView || 1)));
|
|
78
|
+
}
|
|
79
|
+
/** Count what actually fits, and keep the row on a real stop when that changes. */
|
|
80
|
+
measure() {
|
|
81
|
+
const track = this.track;
|
|
82
|
+
const first = this.slides[0];
|
|
83
|
+
if (!track || !first) return;
|
|
84
|
+
const width = first.getBoundingClientRect().width;
|
|
85
|
+
if (width <= 0) return;
|
|
86
|
+
const gap = Number.parseFloat(getComputedStyle(track).columnGap) || 0;
|
|
87
|
+
const fits = Math.max(1, Math.round((track.clientWidth + gap) / (width + gap)));
|
|
88
|
+
if (fits === this.visible) return;
|
|
89
|
+
this.visible = fits;
|
|
90
|
+
this.index = Math.min(this.index, this.last);
|
|
91
|
+
const slide = this.slides[this.index];
|
|
92
|
+
if (slide && typeof track.scrollTo === "function") track.scrollTo({ left: slide.offsetLeft - track.offsetLeft, behavior: "auto" });
|
|
93
|
+
this.requestUpdate();
|
|
94
|
+
}
|
|
95
|
+
onSlots() {
|
|
96
|
+
const slides = this.slides;
|
|
97
|
+
this.count = slides.length;
|
|
98
|
+
slides.forEach((slide, i) => {
|
|
99
|
+
slide.setAttribute("role", "group");
|
|
100
|
+
slide.setAttribute("aria-roledescription", say("slide"));
|
|
101
|
+
slide.setAttribute("aria-label", say("{slide} of {slides}", { slide: i + 1, slides: slides.length }));
|
|
102
|
+
});
|
|
103
|
+
this.measure();
|
|
104
|
+
this.requestUpdate();
|
|
105
|
+
}
|
|
106
|
+
go(to) {
|
|
107
|
+
const target = Math.min(this.last, Math.max(0, to));
|
|
108
|
+
this.index = target;
|
|
109
|
+
this.heading = target;
|
|
110
|
+
clearTimeout(this.settle);
|
|
111
|
+
this.settle = setTimeout(() => {
|
|
112
|
+
const arrived = this.heading === null;
|
|
113
|
+
this.heading = null;
|
|
114
|
+
const track2 = this.track;
|
|
115
|
+
const slide2 = this.slides[this.index];
|
|
116
|
+
if (!arrived && track2 && slide2 && typeof track2.scrollTo === "function") track2.scrollTo({ left: slide2.offsetLeft - track2.offsetLeft, behavior: "auto" });
|
|
117
|
+
}, 900);
|
|
118
|
+
this.requestUpdate();
|
|
119
|
+
const track = this.track;
|
|
120
|
+
const slide = this.slides[target];
|
|
121
|
+
if (track && slide && typeof track.scrollTo === "function") {
|
|
122
|
+
track.scrollTo({ left: slide.offsetLeft - track.offsetLeft, behavior: reducedMotion() ? "auto" : "smooth" });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
onScroll() {
|
|
126
|
+
const track = this.track;
|
|
127
|
+
const slides = this.slides;
|
|
128
|
+
if (!track || !slides.length) return;
|
|
129
|
+
let nearest = 0;
|
|
130
|
+
let distance = Infinity;
|
|
131
|
+
slides.forEach((slide, i) => {
|
|
132
|
+
const d = Math.abs(slide.offsetLeft - track.offsetLeft - track.scrollLeft);
|
|
133
|
+
if (d < distance) {
|
|
134
|
+
distance = d;
|
|
135
|
+
nearest = i;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
if (this.heading !== null) {
|
|
139
|
+
if (nearest === this.heading && distance < 2) {
|
|
140
|
+
this.heading = null;
|
|
141
|
+
clearTimeout(this.settle);
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (nearest !== this.index) {
|
|
146
|
+
this.index = Math.min(nearest, this.last);
|
|
147
|
+
this.requestUpdate();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
onKey(event) {
|
|
151
|
+
if (event.key === "ArrowRight") {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
this.go(this.index + 1);
|
|
154
|
+
}
|
|
155
|
+
if (event.key === "ArrowLeft") {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
this.go(this.index - 1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
get canPlay() {
|
|
161
|
+
return this.autoplay && !reducedMotion();
|
|
162
|
+
}
|
|
163
|
+
restart() {
|
|
164
|
+
clearInterval(this.timer);
|
|
165
|
+
this.timer = void 0;
|
|
166
|
+
if (!this.canPlay || this.paused || this.held) return;
|
|
167
|
+
this.timer = setInterval(() => this.go(this.index >= this.last ? 0 : this.index + 1), Math.max(2, this.seconds) * 1e3);
|
|
168
|
+
}
|
|
169
|
+
hold(held) {
|
|
170
|
+
this.held = held;
|
|
171
|
+
this.restart();
|
|
172
|
+
}
|
|
173
|
+
togglePause() {
|
|
174
|
+
this.paused = !this.paused;
|
|
175
|
+
this.restart();
|
|
176
|
+
this.requestUpdate();
|
|
177
|
+
}
|
|
178
|
+
firstUpdated() {
|
|
179
|
+
if (typeof ResizeObserver === "function" && this.track) {
|
|
180
|
+
this.observer = new ResizeObserver(() => this.measure());
|
|
181
|
+
this.observer.observe(this.track);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
updated(changed) {
|
|
185
|
+
if (changed.has("autoplay") || changed.has("seconds")) this.restart();
|
|
186
|
+
if (changed.has("perView")) this.measure();
|
|
187
|
+
}
|
|
188
|
+
connectedCallback() {
|
|
189
|
+
super.connectedCallback();
|
|
190
|
+
if (this.track) this.observer?.observe(this.track);
|
|
191
|
+
this.restart();
|
|
192
|
+
}
|
|
193
|
+
disconnectedCallback() {
|
|
194
|
+
super.disconnectedCallback();
|
|
195
|
+
this.observer?.disconnect();
|
|
196
|
+
clearInterval(this.timer);
|
|
197
|
+
clearTimeout(this.settle);
|
|
198
|
+
}
|
|
199
|
+
render() {
|
|
200
|
+
const stops = Array.from({ length: this.last + 1 }, (_, i) => i);
|
|
201
|
+
return html`<section aria-roledescription=${say("carousel")} aria-label=${this.label} part="carousel" @keydown=${this.onKey}
|
|
202
|
+
@mouseenter=${() => this.hold(true)} @mouseleave=${() => this.hold(false)} @focusin=${() => this.hold(true)} @focusout=${() => this.hold(false)}>
|
|
203
|
+
<div class="track" part="track" tabindex="0" @scroll=${this.onScroll}><slot @slotchange=${this.onSlots}></slot></div>
|
|
204
|
+
<div class="controls" part="controls">
|
|
205
|
+
<div class="dots">${stops.length > 1 ? stops.map((i) => html`<button class="dot" type="button" aria-label=${say("Go to slide {slide}", { slide: i + 1 })} aria-current=${i === this.index ? "true" : "false"} @click=${() => this.go(i)}><span></span></button>`) : nothing}</div>
|
|
206
|
+
<div class="buttons">
|
|
207
|
+
${this.canPlay ? html`<button class="round" type="button" aria-label=${say(this.paused ? "Play the slides" : "Pause the slides")} @click=${this.togglePause}>${this.paused ? iconSvg("arrow-right", "18px") : html`<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="6" y="5" width="4" height="14" rx="1"/><rect x="14" y="5" width="4" height="14" rx="1"/></svg>`}</button>` : nothing}
|
|
208
|
+
<button class="round" type="button" aria-label=${say("Previous slide")} ?disabled=${this.index === 0} @click=${() => this.go(this.index - 1)}>${iconSvg("arrow-left", "18px")}</button>
|
|
209
|
+
<button class="round" type="button" aria-label=${say("Next slide")} ?disabled=${this.index >= this.last} @click=${() => this.go(this.index + 1)}>${iconSvg("arrow-right", "18px")}</button>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
<p class="sr-only" aria-live="polite">${say("Slide {slide} of {slides}", { slide: this.index + 1, slides: this.count })}</p>
|
|
213
|
+
</section>`;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
function gallerySpan(index, count, layout) {
|
|
217
|
+
const last = index === count - 1;
|
|
218
|
+
const span = { wide: 1, narrow: 1, rows: 1 };
|
|
219
|
+
if (layout === "grid") {
|
|
220
|
+
if (last) {
|
|
221
|
+
span.wide = count % 3 ? 4 - count % 3 : 1;
|
|
222
|
+
span.narrow = count % 2 ? 2 : 1;
|
|
223
|
+
}
|
|
224
|
+
return span;
|
|
225
|
+
}
|
|
226
|
+
if (index === 0) return span;
|
|
227
|
+
if (count === 2) return { wide: 2, narrow: 2, rows: 2 };
|
|
228
|
+
if (count === 3) return { ...span, wide: 2 };
|
|
229
|
+
if (last) {
|
|
230
|
+
const extra = (count - 5) % 4;
|
|
231
|
+
span.wide = count === 4 ? 2 : count > 5 && extra ? 5 - extra : 1;
|
|
232
|
+
span.narrow = count % 2 ? 1 : 2;
|
|
233
|
+
}
|
|
234
|
+
return span;
|
|
235
|
+
}
|
|
236
|
+
var ImpaktGallery = class extends ImpaktElement {
|
|
237
|
+
constructor() {
|
|
238
|
+
super();
|
|
239
|
+
this.shown = -1;
|
|
240
|
+
this.opener = null;
|
|
241
|
+
this.items = [];
|
|
242
|
+
this.layout = "feature";
|
|
243
|
+
this.label = "Gallery";
|
|
244
|
+
this.spaceAbove = "none";
|
|
245
|
+
this.spaceBelow = "none";
|
|
246
|
+
}
|
|
247
|
+
static {
|
|
248
|
+
this.properties = {
|
|
249
|
+
items: { type: Array },
|
|
250
|
+
layout: { type: String, reflect: true },
|
|
251
|
+
label: { type: String },
|
|
252
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
253
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
static {
|
|
257
|
+
this.styles = [...ImpaktElement.styles, focusRing, spaceAround, roundButton, css`
|
|
258
|
+
:host { display: block; container-type: inline-size; }
|
|
259
|
+
ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(3)}; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 180px; }
|
|
260
|
+
:host([layout='grid']) ul { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 220px; }
|
|
261
|
+
li { grid-column: span var(--span-wide, 1); grid-row: span var(--span-rows, 1); }
|
|
262
|
+
:host([layout='feature']) li:first-child { grid-column: span 2; grid-row: span 2; }
|
|
263
|
+
.open { position: relative; display: block; inline-size: 100%; block-size: 100%; padding: 0; border: 0; background: ${t.surfaceInset}; border-radius: ${t.radiusXl}; overflow: hidden; cursor: zoom-in; }
|
|
264
|
+
.open img { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; transition: transform 300ms ease-out; }
|
|
265
|
+
.open:hover img { transform: scale(1.03); }
|
|
266
|
+
@container (max-width: 40rem) { ul, :host([layout='grid']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 130px; } li { grid-column: span var(--span-narrow, 1); } }
|
|
267
|
+
dialog { padding: 0; border: 0; background: transparent; max-inline-size: none; max-block-size: none; inline-size: 100vw; block-size: 100dvh; }
|
|
268
|
+
dialog::backdrop { background: rgb(10 14 12 / 0.9); }
|
|
269
|
+
.stage { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; block-size: 100%; box-sizing: border-box; padding: ${space(4)}; gap: ${space(3)}; color: #fff; }
|
|
270
|
+
.bar { display: flex; align-items: center; justify-content: space-between; ${type("sm")} }
|
|
271
|
+
.middle { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: ${space(3)}; min-block-size: 0; }
|
|
272
|
+
.middle img { display: block; margin: auto; max-inline-size: 100%; max-block-size: 100%; object-fit: contain; border-radius: ${t.radiusLg}; }
|
|
273
|
+
figure { margin: 0; display: flex; min-block-size: 0; block-size: 100%; }
|
|
274
|
+
.caption { margin: 0; text-align: center; ${type("sm")} }
|
|
275
|
+
`];
|
|
276
|
+
}
|
|
277
|
+
get dialog() {
|
|
278
|
+
return this.renderRoot.querySelector("dialog");
|
|
279
|
+
}
|
|
280
|
+
open(index, event) {
|
|
281
|
+
this.opener = event.currentTarget;
|
|
282
|
+
this.shown = index;
|
|
283
|
+
this.requestUpdate();
|
|
284
|
+
void this.updateComplete.then(() => {
|
|
285
|
+
const d = this.dialog;
|
|
286
|
+
if (d && !d.open) {
|
|
287
|
+
if (typeof d.showModal === "function") d.showModal();
|
|
288
|
+
else d.setAttribute("open", "");
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
close() {
|
|
293
|
+
const d = this.dialog;
|
|
294
|
+
if (d?.open) {
|
|
295
|
+
if (typeof d.close === "function") d.close();
|
|
296
|
+
else d.removeAttribute("open");
|
|
297
|
+
}
|
|
298
|
+
this.onClosed();
|
|
299
|
+
}
|
|
300
|
+
onClosed() {
|
|
301
|
+
if (this.shown === -1) return;
|
|
302
|
+
this.shown = -1;
|
|
303
|
+
this.requestUpdate();
|
|
304
|
+
this.opener?.focus();
|
|
305
|
+
}
|
|
306
|
+
step(by) {
|
|
307
|
+
const n = (this.items ?? []).length;
|
|
308
|
+
if (!n || this.shown < 0) return;
|
|
309
|
+
this.shown = (this.shown + by + n) % n;
|
|
310
|
+
this.requestUpdate();
|
|
311
|
+
}
|
|
312
|
+
onKey(event) {
|
|
313
|
+
if (event.key === "ArrowRight") {
|
|
314
|
+
event.preventDefault();
|
|
315
|
+
this.step(1);
|
|
316
|
+
}
|
|
317
|
+
if (event.key === "ArrowLeft") {
|
|
318
|
+
event.preventDefault();
|
|
319
|
+
this.step(-1);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
render() {
|
|
323
|
+
const items = this.items ?? [];
|
|
324
|
+
const current = this.shown >= 0 ? items[this.shown] : void 0;
|
|
325
|
+
return html`<ul aria-label=${this.label} part="list">${items.map((item, i) => {
|
|
326
|
+
const span = gallerySpan(i, items.length, this.layout);
|
|
327
|
+
return html`<li style=${`--span-wide:${span.wide};--span-narrow:${span.narrow};--span-rows:${span.rows}`}>
|
|
328
|
+
<button class="open" type="button" aria-label=${say("View larger: {picture}", { picture: item.alt })} @click=${(e) => this.open(i, e)}><img src=${item.src} alt=${item.alt} loading="lazy" /></button>
|
|
329
|
+
</li>`;
|
|
330
|
+
})}</ul>
|
|
331
|
+
<dialog aria-label=${this.label} @keydown=${this.onKey} @close=${this.onClosed}>
|
|
332
|
+
${current ? html`<div class="stage">
|
|
333
|
+
<div class="bar"><span>${this.shown + 1} of ${items.length}</span><button class="round" type="button" aria-label=${say("Close")} @click=${this.close}>${iconSvg("close", "18px")}</button></div>
|
|
334
|
+
<div class="middle">
|
|
335
|
+
<button class="round" type="button" aria-label=${say("Previous picture")} @click=${() => this.step(-1)}>${iconSvg("arrow-left", "18px")}</button>
|
|
336
|
+
<figure><img src=${current.src} alt=${current.alt} /></figure>
|
|
337
|
+
<button class="round" type="button" aria-label=${say("Next picture")} @click=${() => this.step(1)}>${iconSvg("arrow-right", "18px")}</button>
|
|
338
|
+
</div>
|
|
339
|
+
<p class="caption">${current.caption ?? current.alt}</p>
|
|
340
|
+
</div>` : nothing}
|
|
341
|
+
</dialog>`;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
var ImpaktLogoCloud = class extends ImpaktElement {
|
|
345
|
+
static {
|
|
346
|
+
this.properties = {
|
|
347
|
+
heading: { type: String },
|
|
348
|
+
items: { type: Array },
|
|
349
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
350
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
constructor() {
|
|
354
|
+
super();
|
|
355
|
+
this.heading = "";
|
|
356
|
+
this.items = [];
|
|
357
|
+
this.spaceAbove = "none";
|
|
358
|
+
this.spaceBelow = "none";
|
|
359
|
+
}
|
|
360
|
+
static {
|
|
361
|
+
this.styles = [...ImpaktElement.styles, focusRing, spaceAround, css`
|
|
362
|
+
:host { display: block; }
|
|
363
|
+
p { margin: 0 0 ${space(6)}; text-align: center; color: ${t.textMuted}; ${type("sm")} font-weight: ${fontWeight("medium")}; }
|
|
364
|
+
ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: ${space(8)} ${space(12)}; }
|
|
365
|
+
img { display: block; block-size: 40px; inline-size: auto; max-inline-size: 160px; object-fit: contain; filter: grayscale(1); opacity: 0.7; transition: filter 200ms ease-in-out, opacity 200ms ease-in-out; }
|
|
366
|
+
li:hover img { filter: none; opacity: 1; }
|
|
367
|
+
a { display: block; border-radius: ${t.radiusSm}; }
|
|
368
|
+
`];
|
|
369
|
+
}
|
|
370
|
+
render() {
|
|
371
|
+
return html`${this.heading ? html`<p part="heading">${this.heading}</p>` : nothing}
|
|
372
|
+
<ul part="list">${(this.items ?? []).map((logo) => html`<li>${logo.href ? html`<a href=${logo.href}><img src=${logo.src} alt=${logo.alt} /></a>` : html`<img src=${logo.src} alt=${logo.alt} />`}</li>`)}</ul>`;
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
var ImpaktSteps = class extends ImpaktElement {
|
|
376
|
+
static {
|
|
377
|
+
this.properties = {
|
|
378
|
+
items: { type: Array },
|
|
379
|
+
orientation: { type: String, reflect: true },
|
|
380
|
+
look: { type: String, reflect: true },
|
|
381
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
382
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
383
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
constructor() {
|
|
387
|
+
super();
|
|
388
|
+
this.items = [];
|
|
389
|
+
this.orientation = "horizontal";
|
|
390
|
+
this.look = "numbered";
|
|
391
|
+
this.headingLevel = 3;
|
|
392
|
+
this.spaceAbove = "none";
|
|
393
|
+
this.spaceBelow = "none";
|
|
394
|
+
}
|
|
395
|
+
static {
|
|
396
|
+
this.styles = [...ImpaktElement.styles, spaceAround, headingStyles, css`
|
|
397
|
+
:host { display: block; container-type: inline-size; }
|
|
398
|
+
ol { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: ${space(6)}; }
|
|
399
|
+
li { position: relative; counter-increment: step; display: flex; flex-direction: column; gap: ${space(2)}; }
|
|
400
|
+
li::before { content: counter(step); display: flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; border-radius: 50%; background: ${t.brand}; color: ${t.onBrand}; ${type("sm")} font-weight: ${fontWeight("bold")}; position: relative; z-index: 1; margin-block-end: ${space(2)}; }
|
|
401
|
+
li:not(:last-child)::after { content: ''; position: absolute; inset-block-start: 20px; inset-inline-start: 48px; inset-inline-end: calc(-1 * ${space(6)} + 8px); block-size: 2px; background: ${t.rule}; }
|
|
402
|
+
.h { ${type("lg")} letter-spacing: 0; }
|
|
403
|
+
.meta { margin: 0; ${type("sm")} color: ${t.textMuted}; font-family: ${t.fontMono}; letter-spacing: 0.02em; }
|
|
404
|
+
.body { margin: 0; color: ${t.textMuted}; line-height: ${lineHeight("normal")}; text-wrap: pretty; }
|
|
405
|
+
:host([orientation='vertical']) ol { grid-auto-flow: row; }
|
|
406
|
+
:host([orientation='vertical']) li { padding-inline-start: 56px; min-block-size: 56px; }
|
|
407
|
+
:host([orientation='vertical']) li::before { position: absolute; inset-inline-start: 0; inset-block-start: 0; margin: 0; }
|
|
408
|
+
:host([orientation='vertical']) li:not(:last-child)::after { inset-block-start: 48px; inset-block-end: calc(-1 * ${space(6)} + 8px); inset-inline-start: 19px; inset-inline-end: auto; inline-size: 2px; block-size: auto; }
|
|
409
|
+
@container (max-width: 40rem) {
|
|
410
|
+
ol { grid-auto-flow: row; }
|
|
411
|
+
li { padding-inline-start: 56px; min-block-size: 56px; }
|
|
412
|
+
li::before { position: absolute; inset-inline-start: 0; inset-block-start: 0; margin: 0; }
|
|
413
|
+
li:not(:last-child)::after { inset-block-start: 48px; inset-block-end: calc(-1 * ${space(6)} + 8px); inset-inline-start: 19px; inset-inline-end: auto; inline-size: 2px; block-size: auto; }
|
|
414
|
+
}
|
|
415
|
+
:host([look='ruled']) li { padding-block-start: ${space(5)}; border-block-start: 3px solid var(--rule); }
|
|
416
|
+
:host([look='ruled']) li::before, :host([look='ruled']) li::after { display: none; }
|
|
417
|
+
:host([look='ruled']) ol { gap: ${space(5)}; }
|
|
418
|
+
/* On a phone the ruled steps become a branch graph: one trunk down the left, and each step a coloured branch off it with a dot. */
|
|
419
|
+
@container (max-width: 40rem) {
|
|
420
|
+
:host([look='ruled']) ol { gap: 0; }
|
|
421
|
+
:host([look='ruled']) li { padding-inline-start: 40px; padding-block: ${space(6)}; min-block-size: 0; border-block-start: 0; }
|
|
422
|
+
:host([look='ruled']) li::before { display: block; content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 2px; block-size: auto; border-radius: 0; margin: 0; background: ${t.text}; }
|
|
423
|
+
:host([look='ruled']) li::after { display: block; content: ''; position: absolute; inset-block: ${space(3)}; inset-inline-start: 2px; inset-inline-end: auto; inline-size: 12px; block-size: auto; background: radial-gradient(circle at 100% 34px, var(--rule) 4px, transparent 4.5px); border: 2px solid var(--rule); border-inline-start: 0; border-radius: 0 14px 14px 0; }
|
|
424
|
+
}
|
|
425
|
+
@media (forced-colors: active) { li::before { border: 1px solid CanvasText; } li:not(:last-child)::after { background: CanvasText; } :host([look='ruled']) li { border-block-start-color: CanvasText; } }
|
|
426
|
+
`];
|
|
427
|
+
}
|
|
428
|
+
render() {
|
|
429
|
+
return html`<ol part="list">${(this.items ?? []).map((step, i) => html`<li part="step" style=${this.look === "ruled" ? `--rule:var(--impakt-color-chart-${i % 5 + 1}, ${"var(--impakt-color-brand-default, #1f4ed8)"})` : nothing}>
|
|
430
|
+
${step.meta ? html`<p class="meta">${step.meta}</p>` : nothing}
|
|
431
|
+
<div class="h" role="heading" aria-level=${this.headingLevel}>${step.heading}</div>
|
|
432
|
+
${step.text ? html`<p class="body">${step.text}</p>` : nothing}
|
|
433
|
+
</li>`)}</ol>`;
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
var ImpaktMediaSplit = class extends ImpaktElement {
|
|
437
|
+
static {
|
|
438
|
+
this.properties = {
|
|
439
|
+
eyebrow: { type: String },
|
|
440
|
+
heading: { type: String },
|
|
441
|
+
lead: { type: String },
|
|
442
|
+
points: { type: Array },
|
|
443
|
+
level: { type: Number, reflect: true },
|
|
444
|
+
imageSrc: { type: String, attribute: "image-src" },
|
|
445
|
+
imageAlt: { type: String, attribute: "image-alt" },
|
|
446
|
+
imageSide: { type: String, reflect: true, attribute: "image-side" },
|
|
447
|
+
insetSrc: { type: String, attribute: "inset-src" },
|
|
448
|
+
insetAlt: { type: String, attribute: "inset-alt" },
|
|
449
|
+
ratio: { type: String, reflect: true },
|
|
450
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
451
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
constructor() {
|
|
455
|
+
super();
|
|
456
|
+
this.eyebrow = "";
|
|
457
|
+
this.heading = "";
|
|
458
|
+
this.lead = "";
|
|
459
|
+
this.points = [];
|
|
460
|
+
this.level = 2;
|
|
461
|
+
this.imageSrc = "";
|
|
462
|
+
this.imageAlt = "";
|
|
463
|
+
this.imageSide = "end";
|
|
464
|
+
this.insetSrc = "";
|
|
465
|
+
this.insetAlt = "";
|
|
466
|
+
this.ratio = "4:3";
|
|
467
|
+
this.spaceAbove = "none";
|
|
468
|
+
this.spaceBelow = "none";
|
|
469
|
+
}
|
|
470
|
+
static {
|
|
471
|
+
this.styles = [...ImpaktElement.styles, spaceAround, headingStyles, css`
|
|
472
|
+
:host { display: block; container-type: inline-size; --ratio: 4 / 3; }
|
|
473
|
+
:host([ratio='1:1']) { --ratio: 1 / 1; }
|
|
474
|
+
:host([ratio='3:2']) { --ratio: 3 / 2; }
|
|
475
|
+
:host([ratio='16:9']) { --ratio: 16 / 9; }
|
|
476
|
+
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${space(16)}; align-items: center; }
|
|
477
|
+
:host([image-side='start']) .picture { order: -1; }
|
|
478
|
+
.words { display: flex; flex-direction: column; gap: ${space(4)}; }
|
|
479
|
+
.h { ${type("4xl")} }
|
|
480
|
+
.lead { ${type("lg")} }
|
|
481
|
+
ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: ${space(3)}; }
|
|
482
|
+
li { display: flex; gap: ${space(3)}; align-items: flex-start; line-height: ${lineHeight("normal")}; }
|
|
483
|
+
.tick { flex: none; display: inline-flex; align-items: center; justify-content: center; inline-size: 24px; block-size: 24px; border-radius: 50%; background: ${t.brandSubtle}; color: ${t.brand}; }
|
|
484
|
+
.actions { display: flex; flex-wrap: wrap; gap: ${space(3)} ${space(4)}; align-items: center; margin-block-start: ${space(2)}; }
|
|
485
|
+
img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowXl}; }
|
|
486
|
+
.picture { position: relative; }
|
|
487
|
+
.picture.has-inset { padding-block-end: 8%; padding-inline-end: 4%; }
|
|
488
|
+
.inset { position: absolute; inset-block-end: 0; inset-inline-end: 0; inline-size: 42%; aspect-ratio: 10 / 7; border: 6px solid ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-sizing: border-box; }
|
|
489
|
+
@container (max-width: 48rem) {
|
|
490
|
+
.split { grid-template-columns: minmax(0, 1fr); gap: ${space(8)}; }
|
|
491
|
+
:host([image-side='start']) .picture { order: 0; }
|
|
492
|
+
.h { ${type("3xl")} }
|
|
493
|
+
}
|
|
494
|
+
`];
|
|
495
|
+
}
|
|
496
|
+
render() {
|
|
497
|
+
return html`<div class="split" part="split">
|
|
498
|
+
<div class="words">
|
|
499
|
+
${this.eyebrow ? html`<p class="eyebrow" part="eyebrow">${this.eyebrow}</p>` : nothing}
|
|
500
|
+
<div class="h" role="heading" aria-level=${this.level}>${this.heading}</div>
|
|
501
|
+
${this.lead ? html`<p class="lead">${this.lead}</p>` : nothing}
|
|
502
|
+
${this.points?.length ? html`<ul>${this.points.map((p) => html`<li><span class="tick">${iconSvg("check", "14px")}</span><span>${p}</span></li>`)}</ul>` : nothing}
|
|
503
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
504
|
+
</div>
|
|
505
|
+
${this.imageSrc ? html`<div class="picture ${this.insetSrc ? "has-inset" : ""}"><img src=${this.imageSrc} alt=${this.imageAlt} loading="lazy" part="image" />${this.insetSrc ? html`<img class="inset" src=${this.insetSrc} alt=${this.insetAlt} loading="lazy" />` : nothing}</div>` : nothing}
|
|
506
|
+
</div>`;
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
var ImpaktCtaBanner = class extends ImpaktElement {
|
|
510
|
+
static {
|
|
511
|
+
this.properties = {
|
|
512
|
+
heading: { type: String },
|
|
513
|
+
lead: { type: String },
|
|
514
|
+
tone: { type: String, reflect: true },
|
|
515
|
+
align: { type: String, reflect: true },
|
|
516
|
+
imageSrc: { type: String, attribute: "image-src" },
|
|
517
|
+
imageAlt: { type: String, attribute: "image-alt" },
|
|
518
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
519
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
520
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
constructor() {
|
|
524
|
+
super();
|
|
525
|
+
this.heading = "";
|
|
526
|
+
this.lead = "";
|
|
527
|
+
this.tone = "brand";
|
|
528
|
+
this.align = "split";
|
|
529
|
+
this.imageSrc = "";
|
|
530
|
+
this.imageAlt = "";
|
|
531
|
+
this.headingLevel = 2;
|
|
532
|
+
this.spaceAbove = "none";
|
|
533
|
+
this.spaceBelow = "none";
|
|
534
|
+
}
|
|
535
|
+
static {
|
|
536
|
+
this.styles = [...ImpaktElement.styles, spaceAround, headingStyles, css`
|
|
537
|
+
:host { display: block; container-type: inline-size; }
|
|
538
|
+
.panel { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: ${space(8)}; padding: ${space(16)}; border-radius: ${t.radius2xl}; background: ${t.surfaceCard}; box-shadow: ${t.shadowSm}, inset 0 0 0 1px ${t.hairline}; }
|
|
539
|
+
:host([tone='subtle']) .panel { background: ${t.surfaceSubtle}; box-shadow: none; }
|
|
540
|
+
:host([tone='brand']) .panel { background: ${t.brand}; color: ${t.onBrand}; box-shadow: ${t.shadowLg}; }
|
|
541
|
+
/* Only the words take the light colours: a button in the actions keeps its own. */
|
|
542
|
+
:host([tone='brand']) .words { --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; }
|
|
543
|
+
/* A soft glow in the corner, so a flat colour has some depth. Decoration only. */
|
|
544
|
+
:host([tone='brand']) .panel::before { content: ''; position: absolute; inset-block-start: -40%; inset-inline-end: -10%; inline-size: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, ${t.onBrand} 18%, transparent), transparent); pointer-events: none; }
|
|
545
|
+
.photo { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: cover; }
|
|
546
|
+
.panel.pictured { min-block-size: 26rem; color: #fff; background: #12211a; --impakt-color-text-heading: #fff; }
|
|
547
|
+
.panel.pictured::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(18 31 26 / 0.8) 0%, rgb(18 31 26 / 0.1) 75%); }
|
|
548
|
+
.panel.pictured .words, .panel.pictured .actions { z-index: 1; }
|
|
549
|
+
@container (max-width: 48rem) { .panel.pictured { justify-content: flex-end; } .panel.pictured::after { background: linear-gradient(180deg, rgb(18 31 26 / 0.15) 0%, rgb(18 31 26 / 0.85) 100%); } }
|
|
550
|
+
.words { position: relative; display: flex; flex-direction: column; gap: ${space(3)}; max-inline-size: 40rem; }
|
|
551
|
+
.h { ${type("4xl")} }
|
|
552
|
+
.lead { ${type("lg")} }
|
|
553
|
+
.actions { position: relative; flex: none; display: flex; flex-wrap: wrap; gap: ${space(3)}; }
|
|
554
|
+
:host([align='stacked']) .panel { flex-direction: column; align-items: flex-start; justify-content: center; }
|
|
555
|
+
:host([align='center']) .panel { flex-direction: column; text-align: center; }
|
|
556
|
+
:host([align='center']) .words { align-items: center; }
|
|
557
|
+
@container (max-width: 48rem) { .panel { flex-direction: column; align-items: flex-start; padding: ${space(8)} ${space(6)}; } .h { ${type("3xl")} } :host([align='center']) .panel { align-items: center; } }
|
|
558
|
+
@media (forced-colors: active) { .panel { border: 1px solid CanvasText; } }
|
|
559
|
+
`];
|
|
560
|
+
}
|
|
561
|
+
render() {
|
|
562
|
+
return html`<div class="panel ${this.imageSrc ? "pictured" : ""}" part="panel">
|
|
563
|
+
${this.imageSrc ? html`<img class="photo" src=${this.imageSrc} alt=${this.imageAlt} />` : nothing}
|
|
564
|
+
<div class="words">
|
|
565
|
+
<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>
|
|
566
|
+
${this.lead ? html`<p class="lead">${this.lead}</p>` : nothing}
|
|
567
|
+
</div>
|
|
568
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
569
|
+
</div>`;
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
var stars = (rating) => html`<span class="stars" role="img" aria-label=${say("Rated {rating} out of 5", { rating })}>${[1, 2, 3, 4, 5].map((n) => html`<svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true" fill=${n <= rating ? "currentColor" : "none"} stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"><path d="M12 3.5l2.6 5.4 5.9.7-4.4 4 1.2 5.8L12 16.5l-5.3 2.9 1.2-5.8-4.4-4 5.9-.7z"/></svg>`)}</span>`;
|
|
573
|
+
var initials = (name) => name.split(/\s+/).filter((w) => /^[A-Za-z]/.test(w) && w.toLowerCase() !== "and").slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
574
|
+
var ImpaktReviews = class extends ImpaktElement {
|
|
575
|
+
static {
|
|
576
|
+
this.properties = {
|
|
577
|
+
summary: { type: String },
|
|
578
|
+
rating: { type: Number },
|
|
579
|
+
items: { type: Array },
|
|
580
|
+
columns: { type: String, reflect: true },
|
|
581
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
582
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
constructor() {
|
|
586
|
+
super();
|
|
587
|
+
this.summary = "";
|
|
588
|
+
this.rating = void 0;
|
|
589
|
+
this.items = [];
|
|
590
|
+
this.columns = "three";
|
|
591
|
+
this.spaceAbove = "none";
|
|
592
|
+
this.spaceBelow = "none";
|
|
593
|
+
}
|
|
594
|
+
static {
|
|
595
|
+
this.styles = [...ImpaktElement.styles, spaceAround, css`
|
|
596
|
+
:host { display: block; container-type: inline-size; }
|
|
597
|
+
.top { display: flex; align-items: center; gap: ${space(3)}; margin-block-end: ${space(6)}; ${type("sm")} font-weight: ${fontWeight("medium")}; }
|
|
598
|
+
.stars { display: inline-flex; gap: 2px; color: ${token_accent}; }
|
|
599
|
+
ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(6)}; grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
600
|
+
:host([columns='two']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
601
|
+
li { display: flex; flex-direction: column; gap: ${space(4)}; padding: ${space(6)}; background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowSm}, inset 0 0 0 1px ${t.hairline}; }
|
|
602
|
+
blockquote { margin: 0; flex: 1; ${type("md")} text-wrap: pretty; }
|
|
603
|
+
.who { display: flex; align-items: center; gap: ${space(3)}; }
|
|
604
|
+
.face { flex: none; display: inline-flex; align-items: center; justify-content: center; inline-size: 44px; block-size: 44px; border-radius: 50%; overflow: hidden; background: ${t.brandSubtle}; color: ${t.brand}; ${type("sm")} font-weight: ${fontWeight("bold")}; }
|
|
605
|
+
.face img { inline-size: 100%; block-size: 100%; object-fit: cover; }
|
|
606
|
+
.name { font-weight: ${fontWeight("semibold")}; ${type("sm")} }
|
|
607
|
+
.about { color: ${t.textMuted}; ${type("sm")} }
|
|
608
|
+
@container (max-width: 56rem) { ul, :host([columns='two']) ul { grid-template-columns: minmax(0, 1fr); } }
|
|
609
|
+
`];
|
|
610
|
+
}
|
|
611
|
+
render() {
|
|
612
|
+
return html`${this.summary || this.rating ? html`<p class="top" part="summary" style="margin-block-start:0">${this.rating ? stars(Math.round(this.rating)) : nothing}<span>${this.summary}</span></p>` : nothing}
|
|
613
|
+
<ul part="list">${(this.items ?? []).map((r) => html`<li part="review">
|
|
614
|
+
${r.rating ? stars(r.rating) : nothing}
|
|
615
|
+
<blockquote>${r.quote}</blockquote>
|
|
616
|
+
<div class="who"><span class="face" aria-hidden="true">${r.avatarSrc ? html`<img src=${r.avatarSrc} alt="" />` : initials(r.person)}</span><span><span class="name">${r.person}</span>${r.about ? html`<br /><span class="about">${r.about}</span>` : nothing}</span></div>
|
|
617
|
+
</li>`)}</ul>`;
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
var ImpaktNewsletter = class extends ImpaktElement {
|
|
621
|
+
constructor() {
|
|
622
|
+
super();
|
|
623
|
+
this.done = false;
|
|
624
|
+
this.heading = "";
|
|
625
|
+
this.lead = "";
|
|
626
|
+
this.label = "Email address";
|
|
627
|
+
this.buttonText = "Sign up";
|
|
628
|
+
this.smallPrint = "";
|
|
629
|
+
this.doneText = "Thank you. You\u2019re on the list.";
|
|
630
|
+
this.headingLevel = 2;
|
|
631
|
+
this.spaceAbove = "none";
|
|
632
|
+
this.spaceBelow = "none";
|
|
633
|
+
}
|
|
634
|
+
static {
|
|
635
|
+
this.properties = {
|
|
636
|
+
heading: { type: String },
|
|
637
|
+
lead: { type: String },
|
|
638
|
+
label: { type: String },
|
|
639
|
+
buttonText: { type: String, attribute: "button-text" },
|
|
640
|
+
smallPrint: { type: String, attribute: "small-print" },
|
|
641
|
+
doneText: { type: String, attribute: "done-text" },
|
|
642
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
643
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
644
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
static {
|
|
648
|
+
this.styles = [...ImpaktElement.styles, focusRing, spaceAround, headingStyles, css`
|
|
649
|
+
:host { display: block; container-type: inline-size; }
|
|
650
|
+
.wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${space(8)}; align-items: center; }
|
|
651
|
+
.words { display: flex; flex-direction: column; gap: ${space(2)}; }
|
|
652
|
+
.h { ${type("2xl")} }
|
|
653
|
+
form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: ${space(1)} ${space(3)}; }
|
|
654
|
+
label { grid-column: 1 / -1; ${type("sm")} font-weight: ${fontWeight("semibold")}; }
|
|
655
|
+
input { min-block-size: 44px; box-sizing: border-box; inline-size: 100%; padding: ${space(2.5)} ${space(3)}; font: inherit; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: ${t.shadowXs}; }
|
|
656
|
+
button { ${targetSize} min-block-size: 44px; padding: ${space(2)} ${space(5)}; font: inherit; ${type("sm")} font-weight: ${fontWeight("semibold")}; color: ${t.onBrand}; background: ${t.brand}; border: 0; border-radius: ${t.radiusLg}; box-shadow: ${t.shadowXs}; cursor: pointer; }
|
|
657
|
+
button:hover { background: ${t.brandHover}; }
|
|
658
|
+
.note { grid-column: 1 / -1; margin: ${space(1)} 0 0; color: ${t.textMuted}; ${type("sm")} }
|
|
659
|
+
.done { margin: 0; ${type("md")} font-weight: ${fontWeight("semibold")}; }
|
|
660
|
+
@container (max-width: 40rem) { .wrap { grid-template-columns: minmax(0, 1fr); } }
|
|
661
|
+
`];
|
|
662
|
+
}
|
|
663
|
+
submit(event) {
|
|
664
|
+
event.preventDefault();
|
|
665
|
+
const form = event.currentTarget;
|
|
666
|
+
if (typeof form.reportValidity === "function" && !form.reportValidity()) return;
|
|
667
|
+
const email = form.querySelector("input").value.trim();
|
|
668
|
+
this.dispatchEvent(new CustomEvent("impakt-submit", { detail: { email }, bubbles: true, composed: true }));
|
|
669
|
+
this.done = true;
|
|
670
|
+
this.requestUpdate();
|
|
671
|
+
}
|
|
672
|
+
render() {
|
|
673
|
+
const field = this.id_("email");
|
|
674
|
+
return html`<div class="wrap" part="wrap">
|
|
675
|
+
<div class="words">
|
|
676
|
+
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
677
|
+
${this.lead ? html`<p class="lead">${this.lead}</p>` : nothing}
|
|
678
|
+
</div>
|
|
679
|
+
<div aria-live="polite">${this.done ? html`<p class="done">${this.doneText}</p>` : html`<form @submit=${this.submit}>
|
|
680
|
+
<label for=${field}>${this.label}</label>
|
|
681
|
+
<input id=${field} type="email" name="email" autocomplete="email" required />
|
|
682
|
+
<button type="submit">${this.buttonText}</button>
|
|
683
|
+
${this.smallPrint ? html`<p class="note">${this.smallPrint}</p>` : nothing}
|
|
684
|
+
</form>`}</div>
|
|
685
|
+
</div>`;
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
customElements.define("impakt-carousel", ImpaktCarousel);
|
|
689
|
+
customElements.define("impakt-gallery", ImpaktGallery);
|
|
690
|
+
customElements.define("impakt-logo-cloud", ImpaktLogoCloud);
|
|
691
|
+
customElements.define("impakt-steps", ImpaktSteps);
|
|
692
|
+
customElements.define("impakt-media-split", ImpaktMediaSplit);
|
|
693
|
+
customElements.define("impakt-cta-banner", ImpaktCtaBanner);
|
|
694
|
+
customElements.define("impakt-reviews", ImpaktReviews);
|
|
695
|
+
customElements.define("impakt-newsletter", ImpaktNewsletter);
|
|
696
|
+
|
|
697
|
+
export {
|
|
698
|
+
ImpaktCarousel,
|
|
699
|
+
gallerySpan,
|
|
700
|
+
ImpaktGallery,
|
|
701
|
+
ImpaktLogoCloud,
|
|
702
|
+
ImpaktSteps,
|
|
703
|
+
ImpaktMediaSplit,
|
|
704
|
+
ImpaktCtaBanner,
|
|
705
|
+
ImpaktReviews,
|
|
706
|
+
ImpaktNewsletter
|
|
707
|
+
};
|
|
708
|
+
//# sourceMappingURL=chunk-4JW2CHWS.js.map
|