@atomic-ui/blocks 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/custom-elements.json +2978 -9654
- package/dist/chunk-GQ2I44OU.js +226 -0
- package/dist/chunk-GQ2I44OU.js.map +1 -0
- package/dist/chunk-HISF6RYK.js +199 -0
- package/dist/chunk-HISF6RYK.js.map +1 -0
- package/dist/{chunk-Q366ZM2X.js → chunk-LJGOTYDJ.js} +17 -41
- package/dist/chunk-LJGOTYDJ.js.map +1 -0
- package/dist/{chunk-BW5ZMKES.js → chunk-OBBPBN4S.js} +17 -144
- package/dist/chunk-OBBPBN4S.js.map +1 -0
- package/dist/chunk-OHXEZPBB.js +109 -0
- package/dist/chunk-OHXEZPBB.js.map +1 -0
- package/dist/{chunk-NZQZRBKV.js → chunk-VOONXP5H.js} +15 -57
- package/dist/chunk-VOONXP5H.js.map +1 -0
- package/dist/chunk-XSKGWT2D.js +84 -0
- package/dist/chunk-XSKGWT2D.js.map +1 -0
- package/dist/components/changelog.d.ts +0 -288
- package/dist/components/changelog.js +3 -12
- package/dist/components/g2-site.d.ts +27 -40
- package/dist/components/g2-site.js +1 -3
- package/dist/components/marketing.d.ts +0 -283
- package/dist/components/marketing.js +3 -13
- package/dist/components/organisms.d.ts +0 -489
- package/dist/components/organisms.js +3 -19
- package/dist/components/selling.d.ts +0 -255
- package/dist/components/selling.js +3 -15
- package/dist/components/site.d.ts +6 -52
- package/dist/components/site.js +3 -5
- package/dist/components/studio.d.ts +10 -95
- package/dist/components/studio.js +1 -3
- package/dist/index.d.ts +9 -13
- package/dist/index.js +23 -101
- package/dist/index.js.map +1 -1
- package/dist/standalone/atomic-ui-blocks.js +751 -1642
- package/dist/standalone/atomic-ui-blocks.js.map +4 -4
- package/dist/standalone/index.html +18 -26
- package/package.json +3 -3
- package/specimen/index.html +18 -26
- package/dist/chunk-BW5ZMKES.js.map +0 -1
- package/dist/chunk-GZTBAT6P.js +0 -574
- package/dist/chunk-GZTBAT6P.js.map +0 -1
- package/dist/chunk-NHWD2LUR.js +0 -255
- package/dist/chunk-NHWD2LUR.js.map +0 -1
- package/dist/chunk-NZQZRBKV.js.map +0 -1
- package/dist/chunk-Q366ZM2X.js.map +0 -1
- package/dist/chunk-R7SSIE2E.js +0 -362
- package/dist/chunk-R7SSIE2E.js.map +0 -1
- package/dist/chunk-XB6FD4SF.js +0 -438
- package/dist/chunk-XB6FD4SF.js.map +0 -1
- package/dist/chunk-YXMXLVK7.js +0 -230
- package/dist/chunk-YXMXLVK7.js.map +0 -1
- package/dist/chunk-ZD75GU6J.js +0 -75
- package/dist/chunk-ZD75GU6J.js.map +0 -1
- package/dist/chunk-ZM2HLQOG.js +0 -783
- package/dist/chunk-ZM2HLQOG.js.map +0 -1
- package/dist/chunk-ZODL5HD4.js +0 -535
- package/dist/chunk-ZODL5HD4.js.map +0 -1
- package/dist/components/card-grid.d.ts +0 -72
- package/dist/components/card-grid.js +0 -7
- package/dist/components/card-grid.js.map +0 -1
- package/dist/components/property.d.ts +0 -389
- package/dist/components/property.js +0 -17
- package/dist/components/property.js.map +0 -1
- package/dist/components/scene.d.ts +0 -138
- package/dist/components/scene.js +0 -7
- package/dist/components/scene.js.map +0 -1
- package/dist/components/scrubber.d.ts +0 -86
- package/dist/components/scrubber.js +0 -7
- package/dist/components/scrubber.js.map +0 -1
package/dist/chunk-ZODL5HD4.js
DELETED
|
@@ -1,535 +0,0 @@
|
|
|
1
|
-
// packages/blocks/src/components/selling.ts
|
|
2
|
-
import { css, html, nothing } from "lit";
|
|
3
|
-
import { say, pageLocale, ImpaktElement, focusRing, targetSize, visuallyHidden, fontWeight, space, spaceAround, t, token, type } from "@atomic-ui/ui";
|
|
4
|
-
var card = css`
|
|
5
|
-
.card { background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowSm}, 0 0 0 1px ${t.hairline}; }
|
|
6
|
-
.h { margin: 0; font-family: ${t.fontHeading}; ${type("2xl")} font-weight: ${fontWeight("bold")}; color: ${t.textHeading}; }
|
|
7
|
-
.btn { display: inline-flex; justify-content: center; align-items: center; min-block-size: 44px; padding: ${space(2.5)} ${space(5)}; font: inherit; font-weight: ${fontWeight("semibold")}; color: ${t.onBrand}; text-decoration: none; background: ${t.brand}; border: 0; border-radius: ${t.radiusLg}; cursor: pointer; }
|
|
8
|
-
.btn:hover { background: ${t.brandHover}; }
|
|
9
|
-
.btn.quiet { color: ${t.link}; background: transparent; box-shadow: inset 0 0 0 ${t.borderThin} ${t.border}; }
|
|
10
|
-
.small { margin: 0; ${type("xs")} color: ${t.textMuted}; }
|
|
11
|
-
.visually-hidden { ${visuallyHidden} }
|
|
12
|
-
`;
|
|
13
|
-
var money = (amount, currency = "GBP", digits = 0) => {
|
|
14
|
-
try {
|
|
15
|
-
return new Intl.NumberFormat(pageLocale(), { style: "currency", currency, maximumFractionDigits: digits, minimumFractionDigits: digits }).format(amount);
|
|
16
|
-
} catch {
|
|
17
|
-
return String(Math.round(amount));
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var arrow = html`<svg viewBox="0 0 20 12" width="20" height="12" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true" focusable="false"><path d="M0 6h18M13 1l5 5-5 5" /></svg>`;
|
|
21
|
-
var ImpaktPlanComparison = class extends ImpaktElement {
|
|
22
|
-
static {
|
|
23
|
-
this.properties = {
|
|
24
|
-
heading: { type: String },
|
|
25
|
-
plans: { type: Array },
|
|
26
|
-
rows: { type: Array },
|
|
27
|
-
buttonText: { type: String, attribute: "button-text" },
|
|
28
|
-
headingLevel: { type: Number, attribute: "heading-level" },
|
|
29
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
30
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
constructor() {
|
|
34
|
-
super();
|
|
35
|
-
this.heading = "Compare cover";
|
|
36
|
-
this.plans = [];
|
|
37
|
-
this.rows = [];
|
|
38
|
-
this.buttonText = "Choose";
|
|
39
|
-
this.headingLevel = 2;
|
|
40
|
-
this.spaceAbove = "none";
|
|
41
|
-
this.spaceBelow = "none";
|
|
42
|
-
}
|
|
43
|
-
static {
|
|
44
|
-
this.styles = [
|
|
45
|
-
...ImpaktElement.styles,
|
|
46
|
-
focusRing,
|
|
47
|
-
targetSize,
|
|
48
|
-
spaceAround,
|
|
49
|
-
card,
|
|
50
|
-
css`
|
|
51
|
-
:host { display: block; container-type: inline-size; }
|
|
52
|
-
.h { margin-block-end: ${space(5)}; }
|
|
53
|
-
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: ${space(4)}; }
|
|
54
|
-
.plan { --plan-accent: ${token("color.accent.default", "#ffd43b")}; --plan-on-accent: ${token("color.accent.on", "#111111")}; position: relative; display: flex; flex-direction: column; gap: ${space(3)}; padding: ${space(6)}; color: ${t.text}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radiusSm}; box-shadow: none; }
|
|
55
|
-
/* The featured plan is filled with ink: the card colour on it, and the accent for its badge, price, ticks and button. */
|
|
56
|
-
.plan.top { background: ${t.text}; color: ${t.surfaceCard}; --plan-muted: color-mix(in srgb, ${t.surfaceCard} 72%, ${t.text}); }
|
|
57
|
-
.badge { align-self: flex-start; padding: 2px ${space(2)}; font-family: ${t.fontMono}; font-size: 0.6875rem; font-weight: ${fontWeight("medium")}; line-height: 1.4; letter-spacing: ${t.trackingWide}; text-transform: uppercase; color: var(--plan-on-accent); background: var(--plan-accent); white-space: nowrap; }
|
|
58
|
-
.name { margin: 0; ${type("lg")} font-weight: ${fontWeight("medium")}; color: inherit; }
|
|
59
|
-
.price { margin: 0; font-family: ${t.fontHeading}; ${type("4xl")} font-weight: ${fontWeight("bold")}; letter-spacing: -0.03em; color: inherit; }
|
|
60
|
-
/* Accent words on ink only where the theme says the pair reads: in light. In dark the ink turns to paper and the price keeps the card's words. */
|
|
61
|
-
.top .price { color: var(--impakt-color-accent-on-ink, var(--impakt-site-menu-current, currentColor)); }
|
|
62
|
-
.period { margin-inline-start: ${space(1)}; font-family: ${t.fontMono}; font-size: 0.8125rem; font-weight: ${fontWeight("regular")}; letter-spacing: 0; color: var(--plan-muted, ${t.textMuted}); }
|
|
63
|
-
.note { margin: 0; ${type("sm")} color: var(--plan-muted, ${t.textMuted}); }
|
|
64
|
-
ul { flex: 1; margin: 0; padding: ${space(3)} 0 0; list-style: none; display: grid; gap: ${space(2)}; align-content: start; }
|
|
65
|
-
li { display: flex; gap: ${space(2)}; ${type("sm")} }
|
|
66
|
-
li[data-has='false'] { color: var(--plan-muted, ${t.textMuted}); }
|
|
67
|
-
.mark { flex-shrink: 0; inline-size: 1em; text-align: start; }
|
|
68
|
-
.top li[data-has='true'] .mark { color: var(--plan-accent); }
|
|
69
|
-
.plan .btn { justify-content: space-between; gap: ${space(4)}; color: ${t.surfaceCard}; background: ${t.text}; border-radius: ${t.radiusSm}; box-shadow: none; }
|
|
70
|
-
.plan .btn:hover { background: ${t.brandHover}; }
|
|
71
|
-
.plan.top .btn { color: var(--plan-on-accent); background: var(--plan-accent); }
|
|
72
|
-
.plan.top .btn:hover { background: color-mix(in srgb, var(--plan-accent) 88%, ${t.surfaceCard}); }
|
|
73
|
-
@media (forced-colors: active) { .plan { border-color: CanvasText; } .badge { border: 1px solid CanvasText; } }
|
|
74
|
-
@container (max-width: 40rem) { .grid { grid-template-columns: minmax(0, 1fr); gap: ${space(6)}; } }
|
|
75
|
-
`
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
has(plan, row) {
|
|
79
|
-
return plan.includes.split(",").map((s) => s.trim().toLowerCase()).includes(row.label.trim().toLowerCase());
|
|
80
|
-
}
|
|
81
|
-
choose(plan, event) {
|
|
82
|
-
const go = this.dispatchEvent(new CustomEvent("impakt-select", { detail: { plan }, bubbles: true, composed: true, cancelable: true }));
|
|
83
|
-
if (!go) event.preventDefault();
|
|
84
|
-
}
|
|
85
|
-
render() {
|
|
86
|
-
return html`
|
|
87
|
-
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
88
|
-
<div class="grid" style=${`--cols: ${Math.max(1, this.plans.length)}`}>
|
|
89
|
-
${this.plans.map(
|
|
90
|
-
(p) => html`<section class="card plan ${p.badge ? "top" : ""}" aria-labelledby=${this.id_(`n-${p.id}`)}>
|
|
91
|
-
${p.badge ? html`<span class="badge">${p.badge}</span>` : nothing}
|
|
92
|
-
<h3 class="name" id=${this.id_(`n-${p.id}`)}>${p.name}</h3>
|
|
93
|
-
<p class="price">${p.price}${p.period ? html` <span class="period">${p.period}</span>` : nothing}</p>
|
|
94
|
-
${p.note ? html`<p class="note">${p.note}</p>` : nothing}
|
|
95
|
-
<ul>${this.rows.map((r) => {
|
|
96
|
-
const has = this.has(p, r);
|
|
97
|
-
return html`<li data-has=${String(has)}><span class="mark" aria-hidden="true">${has ? "\u221A" : "\u2013"}</span><span>${r.label}${has ? html`<span class="visually-hidden">: ${say("included")}</span>` : html`<span class="not"> · ${say("not included")}</span>`}</span></li>`;
|
|
98
|
-
})}</ul>
|
|
99
|
-
${p.href ? html`<a class="btn" href=${p.href} @click=${(e) => this.choose(p, e)}><span>${this.buttonText}<span class="visually-hidden"> ${p.name}</span></span>${arrow}</a>` : html`<button class="btn" type="button" @click=${(e) => this.choose(p, e)}><span>${this.buttonText}<span class="visually-hidden"> ${p.name}</span></span>${arrow}</button>`}
|
|
100
|
-
</section>`
|
|
101
|
-
)}
|
|
102
|
-
</div>`;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
function embedOf(src, locale) {
|
|
106
|
-
const yt = /(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{6,})/.exec(src);
|
|
107
|
-
const hl = locale && !/^en\b/i.test(locale) ? `&hl=${encodeURIComponent(locale.split("-")[0])}&cc_lang_pref=${encodeURIComponent(locale.split("-")[0])}` : "";
|
|
108
|
-
if (yt) return `https://www.youtube-nocookie.com/embed/${yt[1]}?autoplay=1&rel=0${hl}`;
|
|
109
|
-
const vimeo = /vimeo\.com\/(?:video\/)?(\d+)/.exec(src);
|
|
110
|
-
if (vimeo) return `https://player.vimeo.com/video/${vimeo[1]}?autoplay=1&dnt=1`;
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
var ImpaktVideo = class extends ImpaktElement {
|
|
114
|
-
static {
|
|
115
|
-
this.properties = {
|
|
116
|
-
videoSrc: { type: String, attribute: "video-src" },
|
|
117
|
-
label: { type: String },
|
|
118
|
-
posterSrc: { type: String, attribute: "poster-src" },
|
|
119
|
-
captionsSrc: { type: String, attribute: "captions-src" },
|
|
120
|
-
transcriptHref: { type: String, attribute: "transcript-href" },
|
|
121
|
-
playText: { type: String, attribute: "play-text" },
|
|
122
|
-
ratio: { type: String, reflect: true },
|
|
123
|
-
look: { type: String, reflect: true },
|
|
124
|
-
caption: { type: String },
|
|
125
|
-
duration: { type: String },
|
|
126
|
-
transcript: { type: String },
|
|
127
|
-
transcriptText: { type: String, attribute: "transcript-text" },
|
|
128
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
129
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
constructor() {
|
|
133
|
-
super();
|
|
134
|
-
this.videoSrc = "";
|
|
135
|
-
this.label = "Video";
|
|
136
|
-
this.posterSrc = "";
|
|
137
|
-
this.captionsSrc = "";
|
|
138
|
-
this.transcriptHref = "";
|
|
139
|
-
this.playText = "Play video";
|
|
140
|
-
this.ratio = "16:9";
|
|
141
|
-
this.look = "plain";
|
|
142
|
-
this.caption = "";
|
|
143
|
-
this.duration = "";
|
|
144
|
-
this.transcript = "";
|
|
145
|
-
this.transcriptText = "";
|
|
146
|
-
this.playing = false;
|
|
147
|
-
this.spaceAbove = "none";
|
|
148
|
-
this.spaceBelow = "none";
|
|
149
|
-
}
|
|
150
|
-
static {
|
|
151
|
-
this.styles = [
|
|
152
|
-
...ImpaktElement.styles,
|
|
153
|
-
focusRing,
|
|
154
|
-
spaceAround,
|
|
155
|
-
card,
|
|
156
|
-
css`
|
|
157
|
-
:host { display: block; }
|
|
158
|
-
.frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: ${t.radiusXl}; background: #111; }
|
|
159
|
-
:host([ratio='4:3']) .frame { aspect-ratio: 4 / 3; }
|
|
160
|
-
:host([ratio='1:1']) .frame { aspect-ratio: 1; }
|
|
161
|
-
:host([ratio='9:16']) .frame { aspect-ratio: 9 / 16; max-inline-size: 420px; }
|
|
162
|
-
iframe, video, img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; border: 0; object-fit: cover; }
|
|
163
|
-
.play { position: absolute; inset: 0; display: grid; place-items: center; inline-size: 100%; padding: 0; color: #fff; background: linear-gradient(transparent 40%, rgb(0 0 0 / 0.55)); border: 0; cursor: pointer; }
|
|
164
|
-
.disc { display: grid; place-items: center; inline-size: 72px; block-size: 72px; border-radius: 50%; background: ${t.brand}; box-shadow: ${t.shadowLg}; }
|
|
165
|
-
/* Held inside the frame at both edges, so loosened or long words wrap rather than run out of it (1.4.12). */
|
|
166
|
-
.label { position: absolute; inset-inline: ${space(5)}; inset-block-end: ${space(4)}; ${type("lg")} font-weight: ${fontWeight("semibold")}; text-align: start; }
|
|
167
|
-
.foot { margin: ${space(2)} 0 0; ${type("sm")} }
|
|
168
|
-
.foot a { color: ${t.link}; }
|
|
169
|
-
.empty { display: grid; place-items: center; block-size: 100%; color: #ccc; }
|
|
170
|
-
/* The window: a bar with three dots and a caption over an ink stage. It stays ink in both themes. */
|
|
171
|
-
.window { --stage: var(--impakt-video-stage, #111111); --stage-on: var(--impakt-video-stage-on, #efefed); --stage-rule: color-mix(in srgb, var(--stage-on) 14%, var(--stage)); background: var(--stage); color: var(--stage-on); border: ${t.borderThin} solid var(--stage-rule); }
|
|
172
|
-
.bar { display: flex; align-items: center; gap: ${space(1.5)}; padding: ${space(3)} ${space(4)}; border-block-end: ${t.borderThin} solid var(--stage-rule); background: color-mix(in srgb, var(--stage-on) 6%, var(--stage)); }
|
|
173
|
-
.bar .dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--stage-rule); }
|
|
174
|
-
.bar .dot:first-child { background: ${token("color.accent.default", "#ffd43b")}; }
|
|
175
|
-
.bar .caption { margin-inline-start: ${space(1.5)}; font-family: ${t.fontMono}; font-size: 0.6875rem; letter-spacing: ${t.trackingWide}; text-transform: uppercase; color: color-mix(in srgb, var(--stage-on) 78%, var(--stage)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
176
|
-
:host([look='window']) .frame { border-radius: 0; background: var(--stage); }
|
|
177
|
-
:host([look='window']) .play { background: none; color: inherit; }
|
|
178
|
-
:host([look='window']) .disc { display: none; }
|
|
179
|
-
:host([look='window']) .label { position: static; display: inline-flex; align-items: baseline; gap: ${space(3)}; max-inline-size: calc(100% - 2 * ${space(5)}); box-sizing: border-box; padding: ${space(3)} ${space(5)}; ${type("md")} font-weight: ${fontWeight("medium")}; color: ${token("color.accent.on", "#111111")}; background: ${token("color.accent.default", "#ffd43b")}; }
|
|
180
|
-
:host([look='window']) .play:hover .label { background: color-mix(in srgb, ${token("color.accent.default", "#ffd43b")} 88%, #ffffff); }
|
|
181
|
-
:host([look='window']) .play:focus-visible { outline: none; }
|
|
182
|
-
:host([look='window']) .play:focus-visible .label { box-shadow: ${t.focusShadow}; }
|
|
183
|
-
.length { font-family: ${t.fontMono}; font-size: 0.6875rem; letter-spacing: ${t.trackingWide}; text-transform: uppercase; }
|
|
184
|
-
.transcript { margin-block-start: ${space(3)}; border-block: ${t.borderThin} solid ${t.text}; }
|
|
185
|
-
.transcript summary { ${targetSize} display: flex; align-items: center; gap: ${space(2)}; padding-block: ${space(3)}; cursor: pointer; font-weight: ${fontWeight("medium")}; list-style: none; }
|
|
186
|
-
.transcript summary::-webkit-details-marker { display: none; }
|
|
187
|
-
.transcript summary::before { content: '+'; inline-size: 1ch; font-family: ${t.fontMono}; }
|
|
188
|
-
.transcript[open] summary::before { content: '−'; }
|
|
189
|
-
.transcript .words { padding-block-end: ${space(4)}; color: ${t.textMuted}; display: grid; gap: ${space(3)}; max-inline-size: 65ch; }
|
|
190
|
-
.transcript p { margin: 0; }
|
|
191
|
-
@media (forced-colors: active) { .window, .bar { border-color: CanvasText; } :host([look='window']) .label { border: 1px solid ButtonText; } }
|
|
192
|
-
`
|
|
193
|
-
];
|
|
194
|
-
}
|
|
195
|
-
render() {
|
|
196
|
-
const embed = embedOf(this.videoSrc, pageLocale(this));
|
|
197
|
-
let player;
|
|
198
|
-
if (!this.videoSrc) player = html`<div class="empty">${say("Add a video address")}</div>`;
|
|
199
|
-
else if (embed && this.playing)
|
|
200
|
-
player = html`<iframe src=${embed} title=${this.label} allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen></iframe>`;
|
|
201
|
-
else if (embed)
|
|
202
|
-
player = html`${this.posterSrc ? html`<img src=${this.posterSrc} alt="" />` : nothing}
|
|
203
|
-
<button class="play" type="button" @click=${() => {
|
|
204
|
-
this.playing = true;
|
|
205
|
-
}}>
|
|
206
|
-
<span class="disc" aria-hidden="true"><svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></span>
|
|
207
|
-
<span class="label">${this.playText}${this.duration ? html` <span class="length">${this.duration}</span>` : nothing}<span class="visually-hidden">: ${this.label}</span></span>
|
|
208
|
-
</button>`;
|
|
209
|
-
else
|
|
210
|
-
player = html`<video controls preload="metadata" poster=${this.posterSrc || nothing} aria-label=${this.label}>
|
|
211
|
-
<source src=${this.videoSrc} />
|
|
212
|
-
${this.captionsSrc ? html`<track kind="captions" src=${this.captionsSrc} srclang="en" label="English" default />` : nothing}
|
|
213
|
-
</video>`;
|
|
214
|
-
const frame = html`<div class="frame" part="frame">${player}</div>`;
|
|
215
|
-
const paragraphs = (this.transcript ?? "").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean);
|
|
216
|
-
return html`${this.look === "window" ? html`<div class="window" part="window">
|
|
217
|
-
<div class="bar" aria-hidden="true"><span class="dot"></span><span class="dot"></span><span class="dot"></span>${this.caption ? html`<span class="caption">${this.caption}</span>` : nothing}</div>
|
|
218
|
-
${frame}
|
|
219
|
-
</div>` : frame}
|
|
220
|
-
${paragraphs.length ? html`<details class="transcript" part="transcript"><summary>${this.transcriptText || say("Read the transcript")}</summary><div class="words">${paragraphs.map((p) => html`<p>${p}</p>`)}</div></details>` : nothing}
|
|
221
|
-
${this.transcriptHref ? html`<p class="foot"><a href=${this.transcriptHref}>${say("Read the transcript")}<span class="visually-hidden">${say(" of {video}", { video: this.label })}</span></a></p>` : nothing}`;
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
var NOTICE_WORDS = {
|
|
225
|
-
mortgage: { heading: "Your home may be repossessed", text: "Your home may be repossessed if you do not keep up repayments on your mortgage." },
|
|
226
|
-
"secured-loan": {
|
|
227
|
-
heading: "Think carefully before securing other debts against your home",
|
|
228
|
-
text: "Your home may be repossessed if you do not keep up repayments on a mortgage or any other debt secured on it."
|
|
229
|
-
},
|
|
230
|
-
investment: { heading: "Capital at risk", text: "The value of investments can go down as well as up, and you may get back less than you put in." },
|
|
231
|
-
insurance: { heading: "Important information", text: "Read the policy documents to check the cover suits your needs. Limits and exclusions apply." },
|
|
232
|
-
custom: { heading: "", text: "" }
|
|
233
|
-
};
|
|
234
|
-
var ImpaktRegulatoryNotice = class extends ImpaktElement {
|
|
235
|
-
static {
|
|
236
|
-
this.properties = {
|
|
237
|
-
kind: { type: String, reflect: true },
|
|
238
|
-
heading: { type: String },
|
|
239
|
-
text: { type: String },
|
|
240
|
-
firm: { type: String },
|
|
241
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
242
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
constructor() {
|
|
246
|
-
super();
|
|
247
|
-
this.kind = "mortgage";
|
|
248
|
-
this.heading = "";
|
|
249
|
-
this.text = "";
|
|
250
|
-
this.firm = "";
|
|
251
|
-
this.spaceAbove = "none";
|
|
252
|
-
this.spaceBelow = "none";
|
|
253
|
-
}
|
|
254
|
-
static {
|
|
255
|
-
this.styles = [
|
|
256
|
-
...ImpaktElement.styles,
|
|
257
|
-
spaceAround,
|
|
258
|
-
css`
|
|
259
|
-
:host { display: block; }
|
|
260
|
-
.box { padding: ${space(5)}; border-inline-start: 6px solid ${t.warning}; border-radius: ${t.radiusLg}; background: ${t.warningSubtle}; }
|
|
261
|
-
:host([kind='insurance']) .box { border-color: ${t.info}; background: ${t.infoSubtle}; }
|
|
262
|
-
strong { display: block; margin-block-end: ${space(1)}; ${type("md")} color: ${t.text}; }
|
|
263
|
-
p { margin: 0; color: ${t.text}; }
|
|
264
|
-
/* Muted text is proved against the card colour, not the notice's, so the firm's line is in the text colour (1.4.3). */
|
|
265
|
-
.firm { margin-block-start: ${space(3)}; ${type("sm")} color: ${t.text}; }
|
|
266
|
-
`
|
|
267
|
-
];
|
|
268
|
-
}
|
|
269
|
-
render() {
|
|
270
|
-
const preset = NOTICE_WORDS[this.kind] ?? NOTICE_WORDS.custom;
|
|
271
|
-
const heading = this.heading || (preset.heading ? say(preset.heading) : "");
|
|
272
|
-
const text = this.text || (preset.text ? say(preset.text) : "");
|
|
273
|
-
return html`<aside class="box" part="box" aria-label=${heading || say("Important information")}>
|
|
274
|
-
${heading ? html`<strong>${heading}</strong>` : nothing}
|
|
275
|
-
${text ? html`<p>${text}</p>` : nothing}
|
|
276
|
-
${this.firm ? html`<p class="firm">${this.firm}</p>` : nothing}
|
|
277
|
-
</aside>`;
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
var SDLT = {
|
|
281
|
-
standard: [
|
|
282
|
-
{ from: 0, rate: 0 },
|
|
283
|
-
{ from: 125e3, rate: 2 },
|
|
284
|
-
{ from: 25e4, rate: 5 },
|
|
285
|
-
{ from: 925e3, rate: 10 },
|
|
286
|
-
{ from: 15e5, rate: 12 }
|
|
287
|
-
],
|
|
288
|
-
firstTime: [
|
|
289
|
-
{ from: 0, rate: 0 },
|
|
290
|
-
{ from: 3e5, rate: 5 }
|
|
291
|
-
],
|
|
292
|
-
firstTimeLimit: 5e5,
|
|
293
|
-
additionalSurcharge: 5
|
|
294
|
-
};
|
|
295
|
-
function taxOn(price, bands, extra = 0) {
|
|
296
|
-
let tax = 0;
|
|
297
|
-
bands.forEach((band, i) => {
|
|
298
|
-
const top = bands[i + 1]?.from ?? Infinity;
|
|
299
|
-
if (price > band.from) tax += (Math.min(price, top) - band.from) * (band.rate + extra) / 100;
|
|
300
|
-
});
|
|
301
|
-
return Math.round(tax);
|
|
302
|
-
}
|
|
303
|
-
function stampDuty(price, buyer) {
|
|
304
|
-
if (price <= 0) return 0;
|
|
305
|
-
if (buyer === "first-time" && price <= SDLT.firstTimeLimit) return taxOn(price, SDLT.firstTime);
|
|
306
|
-
if (buyer === "additional") return price < 4e4 ? 0 : taxOn(price, SDLT.standard, SDLT.additionalSurcharge);
|
|
307
|
-
return taxOn(price, SDLT.standard);
|
|
308
|
-
}
|
|
309
|
-
var calcStyles = css`
|
|
310
|
-
:host { display: block; container-type: inline-size; }
|
|
311
|
-
.wrap { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); overflow: hidden; }
|
|
312
|
-
.inputs { display: flex; flex-direction: column; gap: ${space(5)}; padding: ${space(8)}; }
|
|
313
|
-
label, legend { display: block; ${type("sm")} font-weight: ${fontWeight("semibold")}; margin-block-end: ${space(1.5)}; padding: 0; }
|
|
314
|
-
fieldset { margin: 0; padding: 0; border: 0; }
|
|
315
|
-
.choices { display: flex; flex-wrap: wrap; gap: ${space(2)}; }
|
|
316
|
-
.choices label { display: inline-flex; align-items: center; gap: ${space(2)}; margin: 0; padding: ${space(2)} ${space(3)}; font-weight: ${fontWeight("regular")}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; cursor: pointer; }
|
|
317
|
-
.choices input { accent-color: ${t.brand}; }
|
|
318
|
-
input[type='number'] { box-sizing: border-box; inline-size: 100%; min-block-size: 44px; padding: ${space(2)} ${space(3)}; font: inherit; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; }
|
|
319
|
-
.result { display: flex; flex-direction: column; justify-content: center; gap: ${space(2)}; padding: ${space(8)}; color: ${t.onBrand}; background: ${t.brand}; }
|
|
320
|
-
.caption { margin: 0; ${type("sm")} opacity: 0.85; }
|
|
321
|
-
output { display: block; font-family: ${t.fontHeading}; ${type("4xl")} font-weight: ${fontWeight("bold")}; }
|
|
322
|
-
.line { margin: 0; ${type("sm")} }
|
|
323
|
-
.foot { grid-column: 1 / -1; padding: ${space(4)} ${space(8)}; background: ${t.surfaceSubtle}; }
|
|
324
|
-
/* Muted text is proved against the card colour, not this band, so the small print here is in the text colour (1.4.3). */
|
|
325
|
-
.foot .small { color: ${t.text}; }
|
|
326
|
-
@container (max-width: 44rem) { .wrap { grid-template-columns: minmax(0, 1fr); } .inputs, .result { padding: ${space(5)}; } .foot { padding: ${space(4)} ${space(5)}; } }
|
|
327
|
-
`;
|
|
328
|
-
var ImpaktStampDutyCalculator = class extends ImpaktElement {
|
|
329
|
-
static {
|
|
330
|
-
this.properties = {
|
|
331
|
-
heading: { type: String },
|
|
332
|
-
price: { type: Number },
|
|
333
|
-
buyer: { type: String },
|
|
334
|
-
smallPrint: { type: String, attribute: "small-print" },
|
|
335
|
-
headingLevel: { type: Number, attribute: "heading-level" },
|
|
336
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
337
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
constructor() {
|
|
341
|
-
super();
|
|
342
|
-
this.heading = "How much stamp duty would you pay?";
|
|
343
|
-
this.price = 385e3;
|
|
344
|
-
this.buyer = "first-time";
|
|
345
|
-
this.smallPrint = "Based on Stamp Duty Land Tax rates in England and Northern Ireland from 1 April 2025. Scotland and Wales have their own taxes. Check what you would pay on GOV.UK.";
|
|
346
|
-
this.headingLevel = 2;
|
|
347
|
-
this.spaceAbove = "none";
|
|
348
|
-
this.spaceBelow = "none";
|
|
349
|
-
}
|
|
350
|
-
static {
|
|
351
|
-
this.styles = [...ImpaktElement.styles, focusRing, spaceAround, card, calcStyles];
|
|
352
|
-
}
|
|
353
|
-
render() {
|
|
354
|
-
const duty = stampDuty(this.price, this.buyer);
|
|
355
|
-
const rate = this.price > 0 ? duty / this.price * 100 : 0;
|
|
356
|
-
const buyers = [
|
|
357
|
-
["first-time", say("First home")],
|
|
358
|
-
["mover", say("Moving home")],
|
|
359
|
-
["additional", say("Second home")]
|
|
360
|
-
];
|
|
361
|
-
return html`<div class="card wrap" part="wrap">
|
|
362
|
-
<div class="inputs">
|
|
363
|
-
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
364
|
-
<div><label for=${this.id_("price")}>${say("Price of the home (\xA3)")}</label>
|
|
365
|
-
<input id=${this.id_("price")} type="number" min="0" step="1000" inputmode="numeric" .value=${String(this.price)} @input=${(e) => {
|
|
366
|
-
this.price = Number(e.target.value) || 0;
|
|
367
|
-
}} /></div>
|
|
368
|
-
<fieldset><legend>${say("Are you buying")}</legend><div class="choices">
|
|
369
|
-
${buyers.map(
|
|
370
|
-
([value, label]) => html`<label><input type="radio" name=${this.id_("buyer")} .checked=${this.buyer === value} @change=${() => {
|
|
371
|
-
this.buyer = value;
|
|
372
|
-
}} />${label}</label>`
|
|
373
|
-
)}
|
|
374
|
-
</div></fieldset>
|
|
375
|
-
</div>
|
|
376
|
-
<div class="result" aria-live="polite">
|
|
377
|
-
<p class="caption">${say("Stamp duty to pay")}</p>
|
|
378
|
-
<output for=${this.id_("price")}>${money(duty)}</output>
|
|
379
|
-
<p class="line">${duty ? say("About {rate}% of the price", { rate: rate.toFixed(1) }) : say("Nothing to pay at this price")}</p>
|
|
380
|
-
${this.buyer === "first-time" && this.price > SDLT.firstTimeLimit ? html`<p class="line">${say("First-time buyer relief stops above {limit}, so the usual rates apply.", { limit: money(SDLT.firstTimeLimit) })}</p>` : nothing}
|
|
381
|
-
</div>
|
|
382
|
-
${this.smallPrint ? html`<div class="foot"><p class="small">${this.smallPrint}</p></div>` : nothing}
|
|
383
|
-
</div>`;
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
var ImpaktAffordabilityCalculator = class extends ImpaktElement {
|
|
387
|
-
static {
|
|
388
|
-
this.properties = {
|
|
389
|
-
heading: { type: String },
|
|
390
|
-
income: { type: Number },
|
|
391
|
-
secondIncome: { type: Number, attribute: "second-income" },
|
|
392
|
-
deposit: { type: Number },
|
|
393
|
-
timesIncome: { type: Number, attribute: "times-income" },
|
|
394
|
-
smallPrint: { type: String, attribute: "small-print" },
|
|
395
|
-
headingLevel: { type: Number, attribute: "heading-level" },
|
|
396
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
397
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
constructor() {
|
|
401
|
-
super();
|
|
402
|
-
this.heading = "How much could you borrow?";
|
|
403
|
-
this.income = 45e3;
|
|
404
|
-
this.secondIncome = 0;
|
|
405
|
-
this.deposit = 3e4;
|
|
406
|
-
this.timesIncome = 4.5;
|
|
407
|
-
this.smallPrint = "This is a guide, not a mortgage offer. What a lender offers depends on your circumstances. Your home may be repossessed if you do not keep up repayments on your mortgage.";
|
|
408
|
-
this.headingLevel = 2;
|
|
409
|
-
this.spaceAbove = "none";
|
|
410
|
-
this.spaceBelow = "none";
|
|
411
|
-
}
|
|
412
|
-
static {
|
|
413
|
-
this.styles = [...ImpaktElement.styles, focusRing, spaceAround, card, calcStyles];
|
|
414
|
-
}
|
|
415
|
-
field(key) {
|
|
416
|
-
return (event) => {
|
|
417
|
-
this[key] = Number(event.target.value) || 0;
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
render() {
|
|
421
|
-
const borrow = Math.max(0, (this.income + this.secondIncome) * this.timesIncome);
|
|
422
|
-
const input = (key, label) => html`<div><label for=${this.id_(key)}>${label}</label>
|
|
423
|
-
<input id=${this.id_(key)} type="number" min="0" step="1000" inputmode="numeric" .value=${String(this[key])} @input=${this.field(key)} /></div>`;
|
|
424
|
-
return html`<div class="card wrap" part="wrap">
|
|
425
|
-
<div class="inputs">
|
|
426
|
-
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
427
|
-
${input("income", say("Your yearly income before tax (\xA3)"))}
|
|
428
|
-
${input("secondIncome", say("A second person\u2019s income, if buying together (\xA3)"))}
|
|
429
|
-
${input("deposit", say("Your deposit (\xA3)"))}
|
|
430
|
-
</div>
|
|
431
|
-
<div class="result" aria-live="polite">
|
|
432
|
-
<p class="caption">${say("You could borrow about")}</p>
|
|
433
|
-
<output>${money(borrow)}</output>
|
|
434
|
-
<p class="line">${say("With your deposit, that\u2019s a home of about {amount}.", { amount: money(borrow + this.deposit) })}</p>
|
|
435
|
-
</div>
|
|
436
|
-
${this.smallPrint ? html`<div class="foot"><p class="small">${this.smallPrint}</p></div>` : nothing}
|
|
437
|
-
</div>`;
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
var ImpaktContactBlock = class extends ImpaktElement {
|
|
441
|
-
static {
|
|
442
|
-
this.properties = {
|
|
443
|
-
heading: { type: String },
|
|
444
|
-
phone: { type: String },
|
|
445
|
-
hours: { type: String },
|
|
446
|
-
email: { type: String },
|
|
447
|
-
callbackHeading: { type: String, attribute: "callback-heading" },
|
|
448
|
-
buttonText: { type: String, attribute: "button-text" },
|
|
449
|
-
doneText: { type: String, attribute: "done-text" },
|
|
450
|
-
headingLevel: { type: Number, attribute: "heading-level" },
|
|
451
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
452
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
constructor() {
|
|
456
|
-
super();
|
|
457
|
-
this.heading = "Talk to us";
|
|
458
|
-
this.phone = "0800 000 0000";
|
|
459
|
-
this.hours = "Monday to Friday, 9am to 6pm\nSaturday, 10am to 2pm";
|
|
460
|
-
this.email = "";
|
|
461
|
-
this.callbackHeading = "Or we can call you";
|
|
462
|
-
this.buttonText = "Ask for a call back";
|
|
463
|
-
this.doneText = "Thanks. We\u2019ll call you at the time you chose.";
|
|
464
|
-
this.headingLevel = 2;
|
|
465
|
-
this.sent = false;
|
|
466
|
-
this.spaceAbove = "none";
|
|
467
|
-
this.spaceBelow = "none";
|
|
468
|
-
}
|
|
469
|
-
static {
|
|
470
|
-
this.styles = [
|
|
471
|
-
...ImpaktElement.styles,
|
|
472
|
-
focusRing,
|
|
473
|
-
spaceAround,
|
|
474
|
-
card,
|
|
475
|
-
css`
|
|
476
|
-
:host { display: block; container-type: inline-size; }
|
|
477
|
-
.wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: ${space(6)}; padding: ${space(8)}; }
|
|
478
|
-
.phone { display: inline-block; margin: ${space(3)} 0; font-family: ${t.fontHeading}; ${type("3xl")} font-weight: ${fontWeight("bold")}; color: ${t.link}; text-decoration: none; }
|
|
479
|
-
.hours { margin: 0; white-space: pre-line; color: ${t.textMuted}; }
|
|
480
|
-
.email { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; margin-block-start: ${space(3)}; color: ${t.link}; overflow-wrap: anywhere; }
|
|
481
|
-
form { display: grid; gap: ${space(3)}; padding: ${space(5)}; border-radius: ${t.radiusLg}; background: ${t.surfaceInset}; }
|
|
482
|
-
.sub { margin: 0; ${type("lg")} font-weight: ${fontWeight("bold")}; color: ${t.text}; }
|
|
483
|
-
label { display: block; ${type("sm")} font-weight: ${fontWeight("semibold")}; margin-block-end: ${space(1)}; }
|
|
484
|
-
input, select { box-sizing: border-box; inline-size: 100%; min-block-size: 44px; padding: ${space(2)} ${space(3)}; font: inherit; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; }
|
|
485
|
-
.done { margin: 0; padding: ${space(5)}; border-radius: ${t.radiusLg}; background: ${t.successSubtle}; color: ${t.successText}; font-weight: ${fontWeight("semibold")}; }
|
|
486
|
-
@container (max-width: 40rem) { .wrap { grid-template-columns: minmax(0, 1fr); padding: ${space(5)}; } }
|
|
487
|
-
`
|
|
488
|
-
];
|
|
489
|
-
}
|
|
490
|
-
submit(event) {
|
|
491
|
-
event.preventDefault();
|
|
492
|
-
const form = new FormData(event.target);
|
|
493
|
-
const data = { name: String(form.get("name") ?? ""), phone: String(form.get("phone") ?? ""), when: String(form.get("when") ?? "") };
|
|
494
|
-
this.dispatchEvent(new CustomEvent("impakt-submit", { detail: data, bubbles: true, composed: true }));
|
|
495
|
-
this.sent = true;
|
|
496
|
-
}
|
|
497
|
-
render() {
|
|
498
|
-
return html`<div class="card wrap" part="wrap">
|
|
499
|
-
<div>
|
|
500
|
-
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
501
|
-
${this.phone ? html`<a class="phone" href=${`tel:${this.phone.replace(/[^\d+]/g, "")}`}>${this.phone}</a>` : nothing}
|
|
502
|
-
${this.hours ? html`<p class="hours">${this.hours}</p>` : nothing}
|
|
503
|
-
${this.email ? html`<a class="email" href=${`mailto:${this.email}`}>${this.email}</a>` : nothing}
|
|
504
|
-
</div>
|
|
505
|
-
${!this.callbackHeading ? nothing : this.sent ? html`<p class="done" role="status">${this.doneText}</p>` : html`<form @submit=${this.submit} aria-labelledby=${this.id_("cb")}>
|
|
506
|
-
<p class="sub" id=${this.id_("cb")}>${this.callbackHeading}</p>
|
|
507
|
-
<div><label for=${this.id_("name")}>${say("Your name")}</label><input id=${this.id_("name")} name="name" autocomplete="name" required /></div>
|
|
508
|
-
<div><label for=${this.id_("tel")}>${say("Phone number")}</label><input id=${this.id_("tel")} name="phone" type="tel" autocomplete="tel" required /></div>
|
|
509
|
-
<div><label for=${this.id_("when")}>${say("Best time to call")}</label><select id=${this.id_("when")} name="when"><option value="Morning">${say("Morning")}</option><option value="Afternoon">${say("Afternoon")}</option><option value="Evening">${say("Evening")}</option></select></div>
|
|
510
|
-
<button class="btn" type="submit">${this.buttonText}</button>
|
|
511
|
-
</form>`}
|
|
512
|
-
</div>`;
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
ImpaktVideo.createProperty("playing", { state: true });
|
|
516
|
-
ImpaktContactBlock.createProperty("sent", { state: true });
|
|
517
|
-
customElements.define("impakt-plan-comparison", ImpaktPlanComparison);
|
|
518
|
-
customElements.define("impakt-video", ImpaktVideo);
|
|
519
|
-
customElements.define("impakt-regulatory-notice", ImpaktRegulatoryNotice);
|
|
520
|
-
customElements.define("impakt-stamp-duty-calculator", ImpaktStampDutyCalculator);
|
|
521
|
-
customElements.define("impakt-affordability-calculator", ImpaktAffordabilityCalculator);
|
|
522
|
-
customElements.define("impakt-contact-block", ImpaktContactBlock);
|
|
523
|
-
|
|
524
|
-
export {
|
|
525
|
-
ImpaktPlanComparison,
|
|
526
|
-
embedOf,
|
|
527
|
-
ImpaktVideo,
|
|
528
|
-
ImpaktRegulatoryNotice,
|
|
529
|
-
SDLT,
|
|
530
|
-
stampDuty,
|
|
531
|
-
ImpaktStampDutyCalculator,
|
|
532
|
-
ImpaktAffordabilityCalculator,
|
|
533
|
-
ImpaktContactBlock
|
|
534
|
-
};
|
|
535
|
-
//# sourceMappingURL=chunk-ZODL5HD4.js.map
|