@atomic-ui/ui 0.1.5 → 0.2.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 +17 -3
- package/custom-elements.json +24569 -0
- package/dist/base/ImpktElement.d.ts +14 -0
- package/dist/base/locale.d.ts +8 -0
- package/dist/base/say.d.ts +1 -0
- package/dist/base/styles.d.ts +1 -1
- package/dist/base/tokens.d.ts +28 -2
- package/dist/{chunk-KWURASAB.js → chunk-26O27BQS.js} +3 -3
- package/dist/chunk-2CFVV2NZ.js +494 -0
- package/dist/chunk-2CFVV2NZ.js.map +1 -0
- package/dist/chunk-3IGNZTJU.js +14 -0
- package/dist/chunk-3IGNZTJU.js.map +1 -0
- package/dist/{chunk-DR3SJ7ZV.js → chunk-3IQ73WNW.js} +3 -3
- package/dist/{chunk-AXQ5YBN2.js → chunk-4X723QBD.js} +135 -10
- package/dist/chunk-4X723QBD.js.map +1 -0
- package/dist/{chunk-OFAVRPRK.js → chunk-6YYAOKNI.js} +2 -2
- package/dist/chunk-6YYAOKNI.js.map +1 -0
- package/dist/{chunk-DI2CJ3MZ.js → chunk-7AJN2TIS.js} +2 -2
- package/dist/chunk-7BSZPUE3.js +53 -0
- package/dist/chunk-7BSZPUE3.js.map +1 -0
- package/dist/{chunk-IBTOZOGI.js → chunk-7OXTZJR4.js} +2 -2
- package/dist/chunk-7XEPNEVQ.js +264 -0
- package/dist/chunk-7XEPNEVQ.js.map +1 -0
- package/dist/{chunk-5NUF7ZQA.js → chunk-D6C7XEY4.js} +64 -3
- package/dist/chunk-D6C7XEY4.js.map +1 -0
- package/dist/{chunk-4JKUAA6K.js → chunk-E2VBUWJ4.js} +53 -14
- package/dist/chunk-E2VBUWJ4.js.map +1 -0
- package/dist/{chunk-57P4WO4Y.js → chunk-E3XJK7MY.js} +38 -23
- package/dist/chunk-E3XJK7MY.js.map +1 -0
- package/dist/{chunk-6UDDZQDK.js → chunk-EDSZI227.js} +3 -3
- package/dist/chunk-EDSZI227.js.map +1 -0
- package/dist/{chunk-3OSL2HMN.js → chunk-FFCIY7NM.js} +9 -6
- package/dist/chunk-FFCIY7NM.js.map +1 -0
- package/dist/{chunk-4AJPS5AU.js → chunk-FJRHZA3C.js} +16 -6
- package/dist/chunk-FJRHZA3C.js.map +1 -0
- package/dist/{chunk-JPEWRJSQ.js → chunk-GQDUHZE3.js} +3 -3
- package/dist/chunk-HYPPG4NF.js +553 -0
- package/dist/chunk-HYPPG4NF.js.map +1 -0
- package/dist/chunk-J4JULXUG.js +249 -0
- package/dist/chunk-J4JULXUG.js.map +1 -0
- package/dist/{chunk-CFGLOYWW.js → chunk-KFD4O7VA.js} +4 -2
- package/dist/chunk-KFD4O7VA.js.map +1 -0
- package/dist/{chunk-LLRJU7XE.js → chunk-MVEFM5QI.js} +6 -6
- package/dist/chunk-MVEFM5QI.js.map +1 -0
- package/dist/{chunk-6GKI67P7.js → chunk-NCASAXQT.js} +7 -3
- package/dist/chunk-NCASAXQT.js.map +1 -0
- package/dist/{chunk-H6L3FSQY.js → chunk-NKTMMJYD.js} +7 -6
- package/dist/chunk-NKTMMJYD.js.map +1 -0
- package/dist/{chunk-QELX47AP.js → chunk-OB7WULFK.js} +50 -27
- package/dist/chunk-OB7WULFK.js.map +1 -0
- package/dist/chunk-OHDPGIJ3.js +428 -0
- package/dist/chunk-OHDPGIJ3.js.map +1 -0
- package/dist/{chunk-TZD7IVVQ.js → chunk-OLLZFNO6.js} +13 -5
- package/dist/chunk-OLLZFNO6.js.map +1 -0
- package/dist/{chunk-5RVMMKMO.js → chunk-OMJMUFOW.js} +3 -3
- package/dist/{chunk-U2S7OESF.js → chunk-QB2KMV6S.js} +56 -15
- package/dist/chunk-QB2KMV6S.js.map +1 -0
- package/dist/{chunk-QH46SOPJ.js → chunk-R67PDFKE.js} +54 -11
- package/dist/chunk-R67PDFKE.js.map +1 -0
- package/dist/chunk-RZSZQMSE.js +236 -0
- package/dist/chunk-RZSZQMSE.js.map +1 -0
- package/dist/{chunk-6MLXFFH4.js → chunk-TGT7J4EG.js} +3 -3
- package/dist/chunk-TGT7J4EG.js.map +1 -0
- package/dist/{chunk-S3EQO33M.js → chunk-UCHJCUYI.js} +6 -4
- package/dist/chunk-UCHJCUYI.js.map +1 -0
- package/dist/chunk-UHLRXI6J.js +453 -0
- package/dist/chunk-UHLRXI6J.js.map +1 -0
- package/dist/chunk-UNVL3CNM.js +725 -0
- package/dist/chunk-UNVL3CNM.js.map +1 -0
- package/dist/{chunk-2RBYVWZT.js → chunk-WDDWWCHN.js} +5 -3
- package/dist/chunk-WDDWWCHN.js.map +1 -0
- package/dist/chunk-WFKSOM6O.js +498 -0
- package/dist/chunk-WFKSOM6O.js.map +1 -0
- package/dist/{chunk-HWNY6U5F.js → chunk-XEJMFFIM.js} +4 -3
- package/dist/chunk-XEJMFFIM.js.map +1 -0
- package/dist/{chunk-ZDYTNFQI.js → chunk-XJXCTGDR.js} +16 -6
- package/dist/chunk-XJXCTGDR.js.map +1 -0
- package/dist/{chunk-G6UVYMA6.js → chunk-YD6IZ2C5.js} +2 -2
- package/dist/chunk-YK5QI57J.js +396 -0
- package/dist/chunk-YK5QI57J.js.map +1 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/app-ui.d.ts +421 -0
- package/dist/components/app-ui.js +27 -0
- package/dist/components/app-ui.js.map +1 -0
- package/dist/components/blocks.d.ts +2 -2
- package/dist/components/blocks.js +3 -3
- package/dist/components/button.d.ts +14 -0
- package/dist/components/button.js +3 -3
- package/dist/components/changelog.d.ts +386 -0
- package/dist/components/changelog.js +25 -0
- package/dist/components/changelog.js.map +1 -0
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +3 -3
- package/dist/components/date-input.js +3 -3
- package/dist/components/dialog.js +2 -2
- package/dist/components/estimator.d.ts +246 -0
- package/dist/components/estimator.js +16 -0
- package/dist/components/estimator.js.map +1 -0
- package/dist/components/fieldset.js +2 -2
- package/dist/components/grid.d.ts +2 -2
- package/dist/components/grid.js +2 -2
- package/dist/components/help.js +2 -2
- package/dist/components/icon.d.ts +2 -0
- package/dist/components/icon.js +2 -2
- package/dist/components/journey.d.ts +433 -0
- package/dist/components/journey.js +22 -0
- package/dist/components/journey.js.map +1 -0
- package/dist/components/layout.d.ts +34 -5
- package/dist/components/layout.js +2 -2
- package/dist/components/link.js +3 -3
- package/dist/components/list.d.ts +50 -0
- package/dist/components/list.js +8 -0
- package/dist/components/list.js.map +1 -0
- package/dist/components/marketing.d.ts +119 -6
- package/dist/components/marketing.js +7 -3
- package/dist/components/media.d.ts +10 -0
- package/dist/components/media.js +2 -2
- package/dist/components/navigation.d.ts +25 -2
- package/dist/components/navigation.js +3 -3
- package/dist/components/organisms.d.ts +559 -0
- package/dist/components/organisms.js +25 -0
- package/dist/components/organisms.js.map +1 -0
- package/dist/components/page.d.ts +14 -3
- package/dist/components/page.js +2 -2
- package/dist/components/price.d.ts +6 -1
- package/dist/components/price.js +3 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/property.d.ts +389 -0
- package/dist/components/property.js +20 -0
- package/dist/components/property.js.map +1 -0
- package/dist/components/radio-group.js +3 -3
- package/dist/components/scene.d.ts +138 -0
- package/dist/components/scene.js +8 -0
- package/dist/components/scene.js.map +1 -0
- package/dist/components/scrubber.d.ts +86 -0
- package/dist/components/scrubber.js +8 -0
- package/dist/components/scrubber.js.map +1 -0
- package/dist/components/select.js +3 -3
- package/dist/components/selling.d.ts +407 -0
- package/dist/components/selling.js +25 -0
- package/dist/components/selling.js.map +1 -0
- package/dist/components/site.d.ts +283 -0
- package/dist/components/site.js +20 -0
- package/dist/components/site.js.map +1 -0
- package/dist/components/summary-list.js +2 -2
- package/dist/components/table.js +2 -2
- package/dist/components/text-input.js +3 -3
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +3 -3
- package/dist/index.d.ts +13 -2
- package/dist/index.js +180 -47
- package/package.json +11 -4
- package/dist/chunk-2RBYVWZT.js.map +0 -1
- package/dist/chunk-3OSL2HMN.js.map +0 -1
- package/dist/chunk-4AJPS5AU.js.map +0 -1
- package/dist/chunk-4JKUAA6K.js.map +0 -1
- package/dist/chunk-57P4WO4Y.js.map +0 -1
- package/dist/chunk-5NUF7ZQA.js.map +0 -1
- package/dist/chunk-6GKI67P7.js.map +0 -1
- package/dist/chunk-6MLXFFH4.js.map +0 -1
- package/dist/chunk-6UDDZQDK.js.map +0 -1
- package/dist/chunk-AXQ5YBN2.js.map +0 -1
- package/dist/chunk-CFGLOYWW.js.map +0 -1
- package/dist/chunk-H6L3FSQY.js.map +0 -1
- package/dist/chunk-HWNY6U5F.js.map +0 -1
- package/dist/chunk-LLRJU7XE.js.map +0 -1
- package/dist/chunk-OFAVRPRK.js.map +0 -1
- package/dist/chunk-QELX47AP.js.map +0 -1
- package/dist/chunk-QH46SOPJ.js.map +0 -1
- package/dist/chunk-S3EQO33M.js.map +0 -1
- package/dist/chunk-TZD7IVVQ.js.map +0 -1
- package/dist/chunk-U2S7OESF.js.map +0 -1
- package/dist/chunk-ZDYTNFQI.js.map +0 -1
- /package/dist/{chunk-KWURASAB.js.map → chunk-26O27BQS.js.map} +0 -0
- /package/dist/{chunk-DR3SJ7ZV.js.map → chunk-3IQ73WNW.js.map} +0 -0
- /package/dist/{chunk-DI2CJ3MZ.js.map → chunk-7AJN2TIS.js.map} +0 -0
- /package/dist/{chunk-IBTOZOGI.js.map → chunk-7OXTZJR4.js.map} +0 -0
- /package/dist/{chunk-JPEWRJSQ.js.map → chunk-GQDUHZE3.js.map} +0 -0
- /package/dist/{chunk-5RVMMKMO.js.map → chunk-OMJMUFOW.js.map} +0 -0
- /package/dist/{chunk-G6UVYMA6.js.map → chunk-YD6IZ2C5.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
space,
|
|
7
7
|
t,
|
|
8
8
|
targetSize
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-D6C7XEY4.js";
|
|
10
10
|
|
|
11
11
|
// packages/ui/src/components/accordion.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -35,7 +35,7 @@ var ImpktAccordion = class extends ImpktElement {
|
|
|
35
35
|
display: block;
|
|
36
36
|
}
|
|
37
37
|
.item {
|
|
38
|
-
border-block-end: ${t.borderThin} solid ${t.
|
|
38
|
+
border-block-end: ${t.borderThin} solid ${t.rule};
|
|
39
39
|
}
|
|
40
40
|
button {
|
|
41
41
|
${targetSize}
|
|
@@ -119,4 +119,4 @@ customElements.define("impkt-accordion", ImpktAccordion);
|
|
|
119
119
|
export {
|
|
120
120
|
ImpktAccordion
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-TGT7J4EG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/accordion.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface AccordionItem {\n id: string;\n heading: string;\n body: string;\n}\n\n/**\n * Disclosure sections — frequently asked questions, \"what does this mean?\".\n *\n * **Each header is a button inside a heading.** The heading is what lets a\n * screen-reader user jump between sections without tabbing through every\n * paragraph; the button is what makes the section openable. One without the\n * other is a common half-implementation: all-headings cannot be operated,\n * all-buttons cannot be navigated.\n *\n * `headingLevel` is a property because the right level depends on what is\n * above the accordion on the page, and guessing produces exactly the skipped\n * levels that 1.3.1 is about.\n *\n * **Panels are hidden, not unmounted.** `hidden` keeps the content in the\n * accessibility tree's structure and lets in-page search find it when opened,\n * and it means `aria-controls` always points at an element that exists.\n *\n * **A panel can hold more than words.** `body` is plain text, which is what a\n * composition can author safely. Content rendered elsewhere, such as an FAQ\n * answer with links and a list, is slotted instead: a child with\n * `slot=\"panel-<item id>\"` replaces that item's body. The slot sits inside the\n * panel, so the region, its label and its `hidden` state are unchanged, and a\n * panel with nothing slotted still shows its body.\n *\n * @category content\n * @icon accordion\n */\nexport class ImpktAccordion extends ImpktElement {\n static properties = {\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n open: { type: Array },\n multiple: { type: Boolean },\n };\n\n declare items: AccordionItem[];\n declare headingLevel: number;\n /** Ids currently expanded. */\n declare open: string[];\n /** When false, opening one closes the others. */\n declare multiple: boolean;\n\n constructor() {\n super();\n this.items = [];\n this.headingLevel = 3;\n this.open = [];\n this.multiple = true;\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n }\n .item {\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n button {\n ${targetSize}\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n inline-size: 100%;\n padding: ${space(3)} 0;\n background: none;\n border: 0;\n font: inherit;\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.text};\n text-align: start;\n cursor: pointer;\n }\n button:hover {\n color: ${t.link};\n }\n .marker {\n flex: none;\n transition: transform 120ms ease-in-out;\n }\n button[aria-expanded='true'] .marker {\n transform: rotate(90deg);\n }\n .panel {\n padding-block-end: ${space(4)};\n font-size: ${fontSize('md')};\n }\n `,\n ];\n\n private toggle(id: string): void {\n const isOpen = this.open.includes(id);\n if (isOpen) this.open = this.open.filter((o) => o !== id);\n else this.open = this.multiple ? [...this.open, id] : [id];\n }\n\n render(): TemplateResult {\n return html`\n ${this.items.map((item) => {\n const expanded = this.open.includes(item.id);\n const panelId = this.id_(`panel-${item.id}`);\n const buttonId = this.id_(`button-${item.id}`);\n return html`\n <div class=\"item\" part=\"item\">\n <div role=\"heading\" aria-level=${this.headingLevel}>\n <button\n id=${buttonId}\n part=\"header\"\n type=\"button\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${panelId}\n @click=${() => this.toggle(item.id)}\n >\n <span>${item.heading}</span>\n <span class=\"marker\" aria-hidden=\"true\">›</span>\n </button>\n </div>\n <div\n id=${panelId}\n class=\"panel\"\n part=\"panel\"\n role=\"region\"\n aria-labelledby=${buttonId}\n ?hidden=${!expanded}\n >\n <slot name=${`panel-${item.id}`}>${item.body}</slot>\n </div>\n </div>\n `;\n })}\n ${this.items.length === 0 ? nothing : nothing}\n `;\n }\n}\n\ncustomElements.define('impkt-accordion', ImpktAccordion);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-accordion': ImpktAccordion }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAsCjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAC/C;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,MAAM;AAAA,MACrB,cAAc,EAAE,MAAM,QAAQ,WAAW,gBAAgB;AAAA,MACzD,MAAM,EAAE,MAAM,MAAM;AAAA,MACpB,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC5B;AAAA;AAAA,EASA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ,CAAC;AACd,SAAK,eAAe;AACpB,SAAK,OAAO,CAAC;AACb,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAKwB,EAAE,UAAU,UAAU,EAAE,IAAI;AAAA;AAAA;AAAA,UAG9C,UAAU;AAAA;AAAA;AAAA;AAAA,eAIL,MAAM,CAAC,CAAC;AAAA;AAAA,mBAEJ,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,qBAIN,SAAS,IAAI,CAAC;AAAA,uBACZ,WAAW,UAAU,CAAC;AAAA,iBAC5B,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKN,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAUM,MAAM,CAAC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
|
|
|
11
11
|
// packages/ui/src/components/dialog.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -34,9 +34,10 @@ var ImpktDialog = class extends ImpktElement {
|
|
|
34
34
|
dialog {
|
|
35
35
|
padding: 0;
|
|
36
36
|
border: 0;
|
|
37
|
-
border-radius: ${t.
|
|
37
|
+
border-radius: ${t.radius2xl};
|
|
38
38
|
background: ${t.surfaceCard};
|
|
39
39
|
color: ${t.text};
|
|
40
|
+
box-shadow: ${t.shadowXl}, 0 0 0 1px ${t.hairline};
|
|
40
41
|
max-inline-size: min(32rem, calc(100vw - 2rem));
|
|
41
42
|
/* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside
|
|
42
43
|
itself rather than clipping, at 320px and at 400% zoom alike. */
|
|
@@ -44,7 +45,8 @@ var ImpktDialog = class extends ImpktElement {
|
|
|
44
45
|
overflow: auto;
|
|
45
46
|
}
|
|
46
47
|
dialog::backdrop {
|
|
47
|
-
background:
|
|
48
|
+
background: color-mix(in srgb, ${t.text} 30%, transparent);
|
|
49
|
+
backdrop-filter: blur(2px);
|
|
48
50
|
}
|
|
49
51
|
.head {
|
|
50
52
|
display: flex;
|
|
@@ -127,4 +129,4 @@ customElements.define("impkt-dialog", ImpktDialog);
|
|
|
127
129
|
export {
|
|
128
130
|
ImpktDialog
|
|
129
131
|
};
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
132
|
+
//# sourceMappingURL=chunk-UCHJCUYI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/dialog.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A modal dialog — \"are you sure you want to leave this order?\".\n *\n * **It is a native `<dialog>` opened with `showModal()`, and that is the whole\n * design.** The platform then provides, correctly and in every browser: a\n * focus trap, Escape to close, the rest of the page made inert so a screen\n * reader cannot wander out of the dialog, rendering in the top layer so no\n * `z-index` can cover it, and focus returned to whatever opened it when it\n * closes.\n *\n * Every one of those is a thing hand-rolled modals get wrong. The focus trap\n * is the famous one, but inertness is the worse failure: a dialog that traps\n * the Tab key but leaves the background in the accessibility tree lets a\n * screen-reader user read straight past it into a page they cannot interact\n * with, and nothing on screen tells them that is what happened.\n *\n * What is left to get right is the labelling. `aria-labelledby` points at the\n * dialog's own heading, so it is announced by name on open rather than as\n * \"dialog\".\n\n *\n * @category feedback\n * @icon dialog\n * @slot - The body of the dialog.\n */\nexport class ImpktDialog extends ImpktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n closeLabel: { type: String, attribute: 'close-label' },\n dismissible: { type: Boolean },\n };\n\n declare open: boolean;\n declare heading: string;\n declare closeLabel: string;\n /** When false, Escape and the backdrop do not close it — a decision must be made. */\n declare dismissible: boolean;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.closeLabel = 'Close';\n this.dismissible = true;\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n css`\n dialog {\n padding: 0;\n border: 0;\n border-radius: ${t.radius2xl};\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: ${t.shadowXl}, 0 0 0 1px ${t.hairline};\n max-inline-size: min(32rem, calc(100vw - 2rem));\n /* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside\n itself rather than clipping, at 320px and at 400% zoom alike. */\n max-block-size: calc(100vh - 2rem);\n overflow: auto;\n }\n dialog::backdrop {\n background: color-mix(in srgb, ${t.text} 30%, transparent);\n backdrop-filter: blur(2px);\n }\n .head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: ${space(3)};\n padding: ${space(5)} ${space(5)} 0;\n }\n .heading {\n margin: 0;\n font-family: ${t.fontHeading};\n font-size: ${fontSize('xl')};\n font-weight: ${fontWeight('bold')};\n color: ${t.textHeading};\n }\n .body {\n padding: ${space(4)} ${space(5)} ${space(5)};\n }\n .close {\n ${targetSize}\n flex: none;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n font: inherit;\n font-size: ${fontSize('lg')};\n color: ${t.text};\n cursor: pointer;\n }\n `,\n ];\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n // happy-dom and older engines do not implement showModal. Falling back to\n // the `open` attribute renders a NON-modal dialog — no focus trap, no\n // inert background — so it is used only to keep tests and ancient browsers\n // from throwing, never as an equivalent.\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n } else if (typeof dialog.close === 'function' && dialog.open) {\n dialog.close();\n } else {\n dialog.removeAttribute('open');\n }\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impkt-close', { bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n return html`\n <dialog\n part=\"dialog\"\n aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${(e: Event) => {\n // `cancel` fires on Escape. Blocking it is what makes a dialog\n // non-dismissible, and it is why `dismissible` exists rather than\n // leaving a caller to re-open on close.\n if (!this.dismissible) e.preventDefault();\n else this.close();\n }}\n @close=${() => { if (this.open) this.close(); }}\n >\n <div class=\"head\">\n ${this.heading\n ? html`<h2 class=\"heading\" id=${this.id_('heading')} part=\"heading\">${this.heading}</h2>`\n : nothing}\n ${this.dismissible\n ? html`<button class=\"close\" part=\"close\" type=\"button\" @click=${this.close}>\n <span aria-hidden=\"true\">×</span>\n <span class=\"sr-only\" style=\"position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)\">${this.closeLabel}</span>\n </button>`\n : nothing}\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n </dialog>\n `;\n }\n}\n\ncustomElements.define('impkt-dialog', ImpktDialog);\n\ndeclare global {\n interface HTMLElementTagNameMap { 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unk-3IGNZTJU.js";
|
|
4
|
+
import {
|
|
5
|
+
ImpktElement,
|
|
6
|
+
focusRing,
|
|
7
|
+
fontWeight,
|
|
8
|
+
say,
|
|
9
|
+
space,
|
|
10
|
+
spaceAround,
|
|
11
|
+
t,
|
|
12
|
+
targetSize,
|
|
13
|
+
type,
|
|
14
|
+
visuallyHidden
|
|
15
|
+
} from "./chunk-D6C7XEY4.js";
|
|
16
|
+
|
|
17
|
+
// packages/ui/src/components/selling.ts
|
|
18
|
+
import { css, html, nothing } from "lit";
|
|
19
|
+
var card = css`
|
|
20
|
+
.card { background: ${t.surfaceCard}; border-radius: ${t.radiusXl}; box-shadow: ${t.shadowSm}, 0 0 0 1px ${t.hairline}; }
|
|
21
|
+
.h { margin: 0; font-family: ${t.fontHeading}; ${type("2xl")} font-weight: ${fontWeight("bold")}; color: ${t.textHeading}; }
|
|
22
|
+
.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; }
|
|
23
|
+
.btn:hover { background: ${t.brandHover}; }
|
|
24
|
+
.btn.quiet { color: ${t.link}; background: transparent; box-shadow: inset 0 0 0 ${t.borderThin} ${t.border}; }
|
|
25
|
+
.small { margin: 0; ${type("xs")} color: ${t.textMuted}; }
|
|
26
|
+
.visually-hidden { ${visuallyHidden} }
|
|
27
|
+
`;
|
|
28
|
+
var money = (amount, currency = "GBP", digits = 0) => {
|
|
29
|
+
try {
|
|
30
|
+
return new Intl.NumberFormat(pageLocale(), { style: "currency", currency, maximumFractionDigits: digits, minimumFractionDigits: digits }).format(amount);
|
|
31
|
+
} catch {
|
|
32
|
+
return String(Math.round(amount));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var ImpktPlanComparison = class extends ImpktElement {
|
|
36
|
+
static {
|
|
37
|
+
this.properties = {
|
|
38
|
+
heading: { type: String },
|
|
39
|
+
plans: { type: Array },
|
|
40
|
+
rows: { type: Array },
|
|
41
|
+
buttonText: { type: String, attribute: "button-text" },
|
|
42
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
43
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
44
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
this.heading = "Compare cover";
|
|
50
|
+
this.plans = [];
|
|
51
|
+
this.rows = [];
|
|
52
|
+
this.buttonText = "Choose";
|
|
53
|
+
this.headingLevel = 2;
|
|
54
|
+
this.spaceAbove = "none";
|
|
55
|
+
this.spaceBelow = "none";
|
|
56
|
+
}
|
|
57
|
+
static {
|
|
58
|
+
this.styles = [...ImpktElement.styles, focusRing, targetSize, spaceAround, card, css`
|
|
59
|
+
:host { display: block; container-type: inline-size; }
|
|
60
|
+
.h { margin-block-end: ${space(5)}; }
|
|
61
|
+
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: ${space(4)}; }
|
|
62
|
+
.plan { position: relative; display: flex; flex-direction: column; gap: ${space(3)}; padding: ${space(6)}; }
|
|
63
|
+
.plan.top { box-shadow: 0 0 0 2px ${t.brand}, ${t.shadowMd}; }
|
|
64
|
+
.badge { position: absolute; inset-block-start: 0; inset-inline-start: 50%; transform: translate(-50%, -50%); padding: ${space(1)} ${space(3)}; border-radius: 999px; ${type("xs")} font-weight: ${fontWeight("bold")}; color: ${t.onBrand}; background: ${t.brand}; white-space: nowrap; }
|
|
65
|
+
.name { margin: 0; ${type("lg")} font-weight: ${fontWeight("bold")}; color: ${t.text}; }
|
|
66
|
+
.price { margin: 0; font-family: ${t.fontHeading}; ${type("3xl")} font-weight: ${fontWeight("bold")}; color: ${t.text}; }
|
|
67
|
+
.period { ${type("sm")} font-weight: ${fontWeight("regular")}; color: ${t.textMuted}; }
|
|
68
|
+
.note { margin: 0; ${type("sm")} color: ${t.textMuted}; }
|
|
69
|
+
ul { flex: 1; margin: 0; padding: ${space(3)} 0 0; list-style: none; display: grid; gap: ${space(2)}; border-block-start: 1px solid ${t.rule}; align-content: start; }
|
|
70
|
+
li { display: flex; gap: ${space(2)}; ${type("sm")} }
|
|
71
|
+
li[data-has='false'] { color: ${t.textMuted}; }
|
|
72
|
+
.mark { flex-shrink: 0; inline-size: 1.25em; font-weight: ${fontWeight("bold")}; text-align: center; }
|
|
73
|
+
li[data-has='true'] .mark { color: ${t.successText}; }
|
|
74
|
+
@container (max-width: 40rem) { .grid { grid-template-columns: minmax(0, 1fr); gap: ${space(6)}; } }
|
|
75
|
+
`];
|
|
76
|
+
}
|
|
77
|
+
has(plan, row) {
|
|
78
|
+
return plan.includes.split(",").map((s) => s.trim().toLowerCase()).includes(row.label.trim().toLowerCase());
|
|
79
|
+
}
|
|
80
|
+
choose(plan, event) {
|
|
81
|
+
const go = this.dispatchEvent(new CustomEvent("impkt-select", { detail: { plan }, bubbles: true, composed: true, cancelable: true }));
|
|
82
|
+
if (!go) event.preventDefault();
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
return html`
|
|
86
|
+
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
87
|
+
<div class="grid" style=${`--cols: ${Math.max(1, this.plans.length)}`}>
|
|
88
|
+
${this.plans.map((p) => html`<section class="card plan ${p.badge ? "top" : ""}" aria-labelledby=${this.id_(`n-${p.id}`)}>
|
|
89
|
+
${p.badge ? html`<span class="badge">${p.badge}</span>` : nothing}
|
|
90
|
+
<h3 class="name" id=${this.id_(`n-${p.id}`)}>${p.name}</h3>
|
|
91
|
+
<p class="price">${p.price}${p.period ? html` <span class="period">${p.period}</span>` : nothing}</p>
|
|
92
|
+
${p.note ? html`<p class="note">${p.note}</p>` : nothing}
|
|
93
|
+
<ul>${this.rows.map((r) => {
|
|
94
|
+
const has = this.has(p, r);
|
|
95
|
+
return html`<li data-has=${String(has)}><span class="mark" aria-hidden="true">${has ? "\u2713" : "\u2013"}</span><span>${r.label}<span class="visually-hidden">: ${say(has ? "included" : "not included")}</span></span></li>`;
|
|
96
|
+
})}</ul>
|
|
97
|
+
${p.href ? html`<a class="btn ${p.badge ? "" : "quiet"}" href=${p.href} @click=${(e) => this.choose(p, e)}>${this.buttonText}<span class="visually-hidden"> ${p.name}</span></a>` : html`<button class="btn ${p.badge ? "" : "quiet"}" type="button" @click=${(e) => this.choose(p, e)}>${this.buttonText}<span class="visually-hidden"> ${p.name}</span></button>`}
|
|
98
|
+
</section>`)}
|
|
99
|
+
</div>`;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
function embedOf(src, locale) {
|
|
103
|
+
const yt = /(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{6,})/.exec(src);
|
|
104
|
+
const hl = locale && !/^en\b/i.test(locale) ? `&hl=${encodeURIComponent(locale.split("-")[0])}&cc_lang_pref=${encodeURIComponent(locale.split("-")[0])}` : "";
|
|
105
|
+
if (yt) return `https://www.youtube-nocookie.com/embed/${yt[1]}?autoplay=1&rel=0${hl}`;
|
|
106
|
+
const vimeo = /vimeo\.com\/(?:video\/)?(\d+)/.exec(src);
|
|
107
|
+
if (vimeo) return `https://player.vimeo.com/video/${vimeo[1]}?autoplay=1&dnt=1`;
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
var ImpktVideo = class extends ImpktElement {
|
|
111
|
+
static {
|
|
112
|
+
this.properties = {
|
|
113
|
+
videoSrc: { type: String, attribute: "video-src" },
|
|
114
|
+
label: { type: String },
|
|
115
|
+
posterSrc: { type: String, attribute: "poster-src" },
|
|
116
|
+
captionsSrc: { type: String, attribute: "captions-src" },
|
|
117
|
+
transcriptHref: { type: String, attribute: "transcript-href" },
|
|
118
|
+
playText: { type: String, attribute: "play-text" },
|
|
119
|
+
ratio: { type: String, reflect: true },
|
|
120
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
121
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
constructor() {
|
|
125
|
+
super();
|
|
126
|
+
this.videoSrc = "";
|
|
127
|
+
this.label = "Video";
|
|
128
|
+
this.posterSrc = "";
|
|
129
|
+
this.captionsSrc = "";
|
|
130
|
+
this.transcriptHref = "";
|
|
131
|
+
this.playText = "Play video";
|
|
132
|
+
this.ratio = "16:9";
|
|
133
|
+
this.playing = false;
|
|
134
|
+
this.spaceAbove = "none";
|
|
135
|
+
this.spaceBelow = "none";
|
|
136
|
+
}
|
|
137
|
+
static {
|
|
138
|
+
this.styles = [...ImpktElement.styles, focusRing, spaceAround, card, css`
|
|
139
|
+
:host { display: block; }
|
|
140
|
+
.frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: ${t.radiusXl}; background: #111; }
|
|
141
|
+
:host([ratio='4:3']) .frame { aspect-ratio: 4 / 3; }
|
|
142
|
+
:host([ratio='1:1']) .frame { aspect-ratio: 1; }
|
|
143
|
+
:host([ratio='9:16']) .frame { aspect-ratio: 9 / 16; max-inline-size: 420px; }
|
|
144
|
+
iframe, video, img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; border: 0; object-fit: cover; }
|
|
145
|
+
.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; }
|
|
146
|
+
.disc { display: grid; place-items: center; inline-size: 72px; block-size: 72px; border-radius: 50%; background: ${t.brand}; box-shadow: ${t.shadowLg}; }
|
|
147
|
+
.label { position: absolute; inset-inline-start: ${space(5)}; inset-block-end: ${space(4)}; ${type("lg")} font-weight: ${fontWeight("semibold")}; text-align: start; }
|
|
148
|
+
.foot { margin: ${space(2)} 0 0; ${type("sm")} }
|
|
149
|
+
.foot a { color: ${t.link}; }
|
|
150
|
+
.empty { display: grid; place-items: center; block-size: 100%; color: #ccc; }
|
|
151
|
+
`];
|
|
152
|
+
}
|
|
153
|
+
render() {
|
|
154
|
+
const embed = embedOf(this.videoSrc, pageLocale(this));
|
|
155
|
+
let player;
|
|
156
|
+
if (!this.videoSrc) player = html`<div class="empty">${say("Add a video address")}</div>`;
|
|
157
|
+
else if (embed && this.playing) player = html`<iframe src=${embed} title=${this.label} allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen></iframe>`;
|
|
158
|
+
else if (embed) player = html`${this.posterSrc ? html`<img src=${this.posterSrc} alt="" />` : nothing}
|
|
159
|
+
<button class="play" type="button" @click=${() => {
|
|
160
|
+
this.playing = true;
|
|
161
|
+
}}>
|
|
162
|
+
<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>
|
|
163
|
+
<span class="label">${this.playText}<span class="visually-hidden">: ${this.label}</span></span>
|
|
164
|
+
</button>`;
|
|
165
|
+
else player = html`<video controls preload="metadata" poster=${this.posterSrc || nothing} aria-label=${this.label}>
|
|
166
|
+
<source src=${this.videoSrc} />
|
|
167
|
+
${this.captionsSrc ? html`<track kind="captions" src=${this.captionsSrc} srclang="en" label="English" default />` : nothing}
|
|
168
|
+
</video>`;
|
|
169
|
+
return html`<div class="frame" part="frame">${player}</div>
|
|
170
|
+
${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}`;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var NOTICE_WORDS = {
|
|
174
|
+
mortgage: { heading: "Your home may be repossessed", text: "Your home may be repossessed if you do not keep up repayments on your mortgage." },
|
|
175
|
+
"secured-loan": { heading: "Think carefully before securing other debts against your home", text: "Your home may be repossessed if you do not keep up repayments on a mortgage or any other debt secured on it." },
|
|
176
|
+
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." },
|
|
177
|
+
insurance: { heading: "Important information", text: "Read the policy documents to check the cover suits your needs. Limits and exclusions apply." },
|
|
178
|
+
custom: { heading: "", text: "" }
|
|
179
|
+
};
|
|
180
|
+
var ImpktRegulatoryNotice = class extends ImpktElement {
|
|
181
|
+
static {
|
|
182
|
+
this.properties = {
|
|
183
|
+
kind: { type: String, reflect: true },
|
|
184
|
+
heading: { type: String },
|
|
185
|
+
text: { type: String },
|
|
186
|
+
firm: { type: String },
|
|
187
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
188
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
constructor() {
|
|
192
|
+
super();
|
|
193
|
+
this.kind = "mortgage";
|
|
194
|
+
this.heading = "";
|
|
195
|
+
this.text = "";
|
|
196
|
+
this.firm = "";
|
|
197
|
+
this.spaceAbove = "none";
|
|
198
|
+
this.spaceBelow = "none";
|
|
199
|
+
}
|
|
200
|
+
static {
|
|
201
|
+
this.styles = [...ImpktElement.styles, spaceAround, css`
|
|
202
|
+
:host { display: block; }
|
|
203
|
+
.box { padding: ${space(5)}; border-inline-start: 6px solid ${t.warning}; border-radius: ${t.radiusLg}; background: ${t.warningSubtle}; }
|
|
204
|
+
:host([kind='insurance']) .box { border-color: ${t.info}; background: ${t.infoSubtle}; }
|
|
205
|
+
strong { display: block; margin-block-end: ${space(1)}; ${type("md")} color: ${t.text}; }
|
|
206
|
+
p { margin: 0; color: ${t.text}; }
|
|
207
|
+
.firm { margin-block-start: ${space(3)}; ${type("sm")} color: ${t.textMuted}; }
|
|
208
|
+
`];
|
|
209
|
+
}
|
|
210
|
+
render() {
|
|
211
|
+
const preset = NOTICE_WORDS[this.kind] ?? NOTICE_WORDS.custom;
|
|
212
|
+
const heading = this.heading || (preset.heading ? say(preset.heading) : "");
|
|
213
|
+
const text = this.text || (preset.text ? say(preset.text) : "");
|
|
214
|
+
return html`<aside class="box" part="box" aria-label=${heading || say("Important information")}>
|
|
215
|
+
${heading ? html`<strong>${heading}</strong>` : nothing}
|
|
216
|
+
${text ? html`<p>${text}</p>` : nothing}
|
|
217
|
+
${this.firm ? html`<p class="firm">${this.firm}</p>` : nothing}
|
|
218
|
+
</aside>`;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var SDLT = {
|
|
222
|
+
standard: [{ from: 0, rate: 0 }, { from: 125e3, rate: 2 }, { from: 25e4, rate: 5 }, { from: 925e3, rate: 10 }, { from: 15e5, rate: 12 }],
|
|
223
|
+
firstTime: [{ from: 0, rate: 0 }, { from: 3e5, rate: 5 }],
|
|
224
|
+
firstTimeLimit: 5e5,
|
|
225
|
+
additionalSurcharge: 5
|
|
226
|
+
};
|
|
227
|
+
function taxOn(price, bands, extra = 0) {
|
|
228
|
+
let tax = 0;
|
|
229
|
+
bands.forEach((band, i) => {
|
|
230
|
+
const top = bands[i + 1]?.from ?? Infinity;
|
|
231
|
+
if (price > band.from) tax += (Math.min(price, top) - band.from) * (band.rate + extra) / 100;
|
|
232
|
+
});
|
|
233
|
+
return Math.round(tax);
|
|
234
|
+
}
|
|
235
|
+
function stampDuty(price, buyer) {
|
|
236
|
+
if (price <= 0) return 0;
|
|
237
|
+
if (buyer === "first-time" && price <= SDLT.firstTimeLimit) return taxOn(price, SDLT.firstTime);
|
|
238
|
+
if (buyer === "additional") return price < 4e4 ? 0 : taxOn(price, SDLT.standard, SDLT.additionalSurcharge);
|
|
239
|
+
return taxOn(price, SDLT.standard);
|
|
240
|
+
}
|
|
241
|
+
var calcStyles = css`
|
|
242
|
+
:host { display: block; container-type: inline-size; }
|
|
243
|
+
.wrap { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); overflow: hidden; }
|
|
244
|
+
.inputs { display: flex; flex-direction: column; gap: ${space(5)}; padding: ${space(8)}; }
|
|
245
|
+
label, legend { display: block; ${type("sm")} font-weight: ${fontWeight("semibold")}; margin-block-end: ${space(1.5)}; padding: 0; }
|
|
246
|
+
fieldset { margin: 0; padding: 0; border: 0; }
|
|
247
|
+
.choices { display: flex; flex-wrap: wrap; gap: ${space(2)}; }
|
|
248
|
+
.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; }
|
|
249
|
+
.choices input { accent-color: ${t.brand}; }
|
|
250
|
+
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}; }
|
|
251
|
+
.result { display: flex; flex-direction: column; justify-content: center; gap: ${space(2)}; padding: ${space(8)}; color: ${t.onBrand}; background: ${t.brand}; }
|
|
252
|
+
.caption { margin: 0; ${type("sm")} opacity: 0.85; }
|
|
253
|
+
output { display: block; font-family: ${t.fontHeading}; ${type("4xl")} font-weight: ${fontWeight("bold")}; }
|
|
254
|
+
.line { margin: 0; ${type("sm")} }
|
|
255
|
+
.foot { grid-column: 1 / -1; padding: ${space(4)} ${space(8)}; background: ${t.surfaceSubtle}; }
|
|
256
|
+
@container (max-width: 44rem) { .wrap { grid-template-columns: minmax(0, 1fr); } .inputs, .result { padding: ${space(5)}; } .foot { padding: ${space(4)} ${space(5)}; } }
|
|
257
|
+
`;
|
|
258
|
+
var ImpktStampDutyCalculator = class extends ImpktElement {
|
|
259
|
+
static {
|
|
260
|
+
this.properties = {
|
|
261
|
+
heading: { type: String },
|
|
262
|
+
price: { type: Number },
|
|
263
|
+
buyer: { type: String },
|
|
264
|
+
smallPrint: { type: String, attribute: "small-print" },
|
|
265
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
266
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
267
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
constructor() {
|
|
271
|
+
super();
|
|
272
|
+
this.heading = "How much stamp duty would you pay?";
|
|
273
|
+
this.price = 385e3;
|
|
274
|
+
this.buyer = "first-time";
|
|
275
|
+
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.";
|
|
276
|
+
this.headingLevel = 2;
|
|
277
|
+
this.spaceAbove = "none";
|
|
278
|
+
this.spaceBelow = "none";
|
|
279
|
+
}
|
|
280
|
+
static {
|
|
281
|
+
this.styles = [...ImpktElement.styles, focusRing, spaceAround, card, calcStyles];
|
|
282
|
+
}
|
|
283
|
+
render() {
|
|
284
|
+
const duty = stampDuty(this.price, this.buyer);
|
|
285
|
+
const rate = this.price > 0 ? duty / this.price * 100 : 0;
|
|
286
|
+
const buyers = [["first-time", say("First home")], ["mover", say("Moving home")], ["additional", say("Second home")]];
|
|
287
|
+
return html`<div class="card wrap" part="wrap">
|
|
288
|
+
<div class="inputs">
|
|
289
|
+
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
290
|
+
<div><label for=${this.id_("price")}>${say("Price of the home (\xA3)")}</label>
|
|
291
|
+
<input id=${this.id_("price")} type="number" min="0" step="1000" inputmode="numeric" .value=${String(this.price)} @input=${(e) => {
|
|
292
|
+
this.price = Number(e.target.value) || 0;
|
|
293
|
+
}} /></div>
|
|
294
|
+
<fieldset><legend>${say("Are you buying")}</legend><div class="choices">
|
|
295
|
+
${buyers.map(([value, label]) => html`<label><input type="radio" name=${this.id_("buyer")} .checked=${this.buyer === value} @change=${() => {
|
|
296
|
+
this.buyer = value;
|
|
297
|
+
}} />${label}</label>`)}
|
|
298
|
+
</div></fieldset>
|
|
299
|
+
</div>
|
|
300
|
+
<div class="result" aria-live="polite">
|
|
301
|
+
<p class="caption">${say("Stamp duty to pay")}</p>
|
|
302
|
+
<output for=${this.id_("price")}>${money(duty)}</output>
|
|
303
|
+
<p class="line">${duty ? say("About {rate}% of the price", { rate: rate.toFixed(1) }) : say("Nothing to pay at this price")}</p>
|
|
304
|
+
${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}
|
|
305
|
+
</div>
|
|
306
|
+
${this.smallPrint ? html`<div class="foot"><p class="small">${this.smallPrint}</p></div>` : nothing}
|
|
307
|
+
</div>`;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var ImpktAffordabilityCalculator = class extends ImpktElement {
|
|
311
|
+
static {
|
|
312
|
+
this.properties = {
|
|
313
|
+
heading: { type: String },
|
|
314
|
+
income: { type: Number },
|
|
315
|
+
secondIncome: { type: Number, attribute: "second-income" },
|
|
316
|
+
deposit: { type: Number },
|
|
317
|
+
timesIncome: { type: Number, attribute: "times-income" },
|
|
318
|
+
smallPrint: { type: String, attribute: "small-print" },
|
|
319
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
320
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
321
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
constructor() {
|
|
325
|
+
super();
|
|
326
|
+
this.heading = "How much could you borrow?";
|
|
327
|
+
this.income = 45e3;
|
|
328
|
+
this.secondIncome = 0;
|
|
329
|
+
this.deposit = 3e4;
|
|
330
|
+
this.timesIncome = 4.5;
|
|
331
|
+
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.";
|
|
332
|
+
this.headingLevel = 2;
|
|
333
|
+
this.spaceAbove = "none";
|
|
334
|
+
this.spaceBelow = "none";
|
|
335
|
+
}
|
|
336
|
+
static {
|
|
337
|
+
this.styles = [...ImpktElement.styles, focusRing, spaceAround, card, calcStyles];
|
|
338
|
+
}
|
|
339
|
+
field(key) {
|
|
340
|
+
return (event) => {
|
|
341
|
+
this[key] = Number(event.target.value) || 0;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
render() {
|
|
345
|
+
const borrow = Math.max(0, (this.income + this.secondIncome) * this.timesIncome);
|
|
346
|
+
const input = (key, label) => html`<div><label for=${this.id_(key)}>${label}</label>
|
|
347
|
+
<input id=${this.id_(key)} type="number" min="0" step="1000" inputmode="numeric" .value=${String(this[key])} @input=${this.field(key)} /></div>`;
|
|
348
|
+
return html`<div class="card wrap" part="wrap">
|
|
349
|
+
<div class="inputs">
|
|
350
|
+
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
351
|
+
${input("income", say("Your yearly income before tax (\xA3)"))}
|
|
352
|
+
${input("secondIncome", say("A second person\u2019s income, if buying together (\xA3)"))}
|
|
353
|
+
${input("deposit", say("Your deposit (\xA3)"))}
|
|
354
|
+
</div>
|
|
355
|
+
<div class="result" aria-live="polite">
|
|
356
|
+
<p class="caption">${say("You could borrow about")}</p>
|
|
357
|
+
<output>${money(borrow)}</output>
|
|
358
|
+
<p class="line">${say("With your deposit, that\u2019s a home of about {amount}.", { amount: money(borrow + this.deposit) })}</p>
|
|
359
|
+
</div>
|
|
360
|
+
${this.smallPrint ? html`<div class="foot"><p class="small">${this.smallPrint}</p></div>` : nothing}
|
|
361
|
+
</div>`;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
var ImpktContactBlock = class extends ImpktElement {
|
|
365
|
+
static {
|
|
366
|
+
this.properties = {
|
|
367
|
+
heading: { type: String },
|
|
368
|
+
phone: { type: String },
|
|
369
|
+
hours: { type: String },
|
|
370
|
+
email: { type: String },
|
|
371
|
+
callbackHeading: { type: String, attribute: "callback-heading" },
|
|
372
|
+
buttonText: { type: String, attribute: "button-text" },
|
|
373
|
+
doneText: { type: String, attribute: "done-text" },
|
|
374
|
+
headingLevel: { type: Number, attribute: "heading-level" },
|
|
375
|
+
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
376
|
+
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
constructor() {
|
|
380
|
+
super();
|
|
381
|
+
this.heading = "Talk to us";
|
|
382
|
+
this.phone = "0800 000 0000";
|
|
383
|
+
this.hours = "Monday to Friday, 9am to 6pm\nSaturday, 10am to 2pm";
|
|
384
|
+
this.email = "";
|
|
385
|
+
this.callbackHeading = "Or we can call you";
|
|
386
|
+
this.buttonText = "Ask for a call back";
|
|
387
|
+
this.doneText = "Thanks. We\u2019ll call you at the time you chose.";
|
|
388
|
+
this.headingLevel = 2;
|
|
389
|
+
this.sent = false;
|
|
390
|
+
this.spaceAbove = "none";
|
|
391
|
+
this.spaceBelow = "none";
|
|
392
|
+
}
|
|
393
|
+
static {
|
|
394
|
+
this.styles = [...ImpktElement.styles, focusRing, spaceAround, card, css`
|
|
395
|
+
:host { display: block; container-type: inline-size; }
|
|
396
|
+
.wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: ${space(6)}; padding: ${space(8)}; }
|
|
397
|
+
.phone { display: inline-block; margin: ${space(3)} 0; font-family: ${t.fontHeading}; ${type("3xl")} font-weight: ${fontWeight("bold")}; color: ${t.link}; text-decoration: none; }
|
|
398
|
+
.hours { margin: 0; white-space: pre-line; color: ${t.textMuted}; }
|
|
399
|
+
.email { display: inline-block; margin-block-start: ${space(3)}; color: ${t.link}; }
|
|
400
|
+
form { display: grid; gap: ${space(3)}; padding: ${space(5)}; border-radius: ${t.radiusLg}; background: ${t.surfaceInset}; }
|
|
401
|
+
.sub { margin: 0; ${type("lg")} font-weight: ${fontWeight("bold")}; color: ${t.text}; }
|
|
402
|
+
label { display: block; ${type("sm")} font-weight: ${fontWeight("semibold")}; margin-block-end: ${space(1)}; }
|
|
403
|
+
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}; }
|
|
404
|
+
.done { margin: 0; padding: ${space(5)}; border-radius: ${t.radiusLg}; background: ${t.successSubtle}; color: ${t.successText}; font-weight: ${fontWeight("semibold")}; }
|
|
405
|
+
@container (max-width: 40rem) { .wrap { grid-template-columns: minmax(0, 1fr); padding: ${space(5)}; } }
|
|
406
|
+
`];
|
|
407
|
+
}
|
|
408
|
+
submit(event) {
|
|
409
|
+
event.preventDefault();
|
|
410
|
+
const form = new FormData(event.target);
|
|
411
|
+
const data = { name: String(form.get("name") ?? ""), phone: String(form.get("phone") ?? ""), when: String(form.get("when") ?? "") };
|
|
412
|
+
this.dispatchEvent(new CustomEvent("impkt-submit", { detail: data, bubbles: true, composed: true }));
|
|
413
|
+
this.sent = true;
|
|
414
|
+
}
|
|
415
|
+
render() {
|
|
416
|
+
return html`<div class="card wrap" part="wrap">
|
|
417
|
+
<div>
|
|
418
|
+
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
419
|
+
${this.phone ? html`<a class="phone" href=${`tel:${this.phone.replace(/[^\d+]/g, "")}`}>${this.phone}</a>` : nothing}
|
|
420
|
+
${this.hours ? html`<p class="hours">${this.hours}</p>` : nothing}
|
|
421
|
+
${this.email ? html`<a class="email" href=${`mailto:${this.email}`}>${this.email}</a>` : nothing}
|
|
422
|
+
</div>
|
|
423
|
+
${!this.callbackHeading ? nothing : this.sent ? html`<p class="done" role="status">${this.doneText}</p>` : html`<form @submit=${this.submit} aria-labelledby=${this.id_("cb")}>
|
|
424
|
+
<p class="sub" id=${this.id_("cb")}>${this.callbackHeading}</p>
|
|
425
|
+
<div><label for=${this.id_("name")}>${say("Your name")}</label><input id=${this.id_("name")} name="name" autocomplete="name" required /></div>
|
|
426
|
+
<div><label for=${this.id_("tel")}>${say("Phone number")}</label><input id=${this.id_("tel")} name="phone" type="tel" autocomplete="tel" required /></div>
|
|
427
|
+
<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>
|
|
428
|
+
<button class="btn" type="submit">${this.buttonText}</button>
|
|
429
|
+
</form>`}
|
|
430
|
+
</div>`;
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
ImpktVideo.createProperty("playing", { state: true });
|
|
434
|
+
ImpktContactBlock.createProperty("sent", { state: true });
|
|
435
|
+
customElements.define("impkt-plan-comparison", ImpktPlanComparison);
|
|
436
|
+
customElements.define("impkt-video", ImpktVideo);
|
|
437
|
+
customElements.define("impkt-regulatory-notice", ImpktRegulatoryNotice);
|
|
438
|
+
customElements.define("impkt-stamp-duty-calculator", ImpktStampDutyCalculator);
|
|
439
|
+
customElements.define("impkt-affordability-calculator", ImpktAffordabilityCalculator);
|
|
440
|
+
customElements.define("impkt-contact-block", ImpktContactBlock);
|
|
441
|
+
|
|
442
|
+
export {
|
|
443
|
+
ImpktPlanComparison,
|
|
444
|
+
embedOf,
|
|
445
|
+
ImpktVideo,
|
|
446
|
+
ImpktRegulatoryNotice,
|
|
447
|
+
SDLT,
|
|
448
|
+
stampDuty,
|
|
449
|
+
ImpktStampDutyCalculator,
|
|
450
|
+
ImpktAffordabilityCalculator,
|
|
451
|
+
ImpktContactBlock
|
|
452
|
+
};
|
|
453
|
+
//# sourceMappingURL=chunk-UHLRXI6J.js.map
|