@atomic-ui/ui 0.7.0 → 0.7.2
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 +8 -8
- package/custom-elements.json +460 -28
- package/dist/base/FieldElement.d.ts +4 -0
- package/dist/{chunk-TRZO5CHU.js → chunk-26BO3W56.js} +8 -4
- package/dist/chunk-26BO3W56.js.map +1 -0
- package/dist/{chunk-4ZQTXTPA.js → chunk-2EP3IV3G.js} +8 -4
- package/dist/chunk-2EP3IV3G.js.map +1 -0
- package/dist/{chunk-NU34ZQFR.js → chunk-2ZF3J7OO.js} +8 -5
- package/dist/chunk-2ZF3J7OO.js.map +1 -0
- package/dist/{chunk-WP5WJ4V5.js → chunk-3NEWOO2P.js} +3 -3
- package/dist/chunk-3NEWOO2P.js.map +1 -0
- package/dist/{chunk-AMDTBUUL.js → chunk-3T7J66Z2.js} +16 -4
- package/dist/chunk-3T7J66Z2.js.map +1 -0
- package/dist/{chunk-XU2XODVH.js → chunk-5OJAJA3U.js} +3 -3
- package/dist/chunk-5OJAJA3U.js.map +1 -0
- package/dist/{chunk-3EF4T242.js → chunk-6PMA6NHE.js} +8 -4
- package/dist/chunk-6PMA6NHE.js.map +1 -0
- package/dist/{chunk-HNBG2POR.js → chunk-7C56LPNJ.js} +2 -2
- package/dist/{chunk-HNBG2POR.js.map → chunk-7C56LPNJ.js.map} +1 -1
- package/dist/{chunk-EJSX4WCD.js → chunk-7UWJXPR3.js} +12 -8
- package/dist/chunk-7UWJXPR3.js.map +1 -0
- package/dist/{chunk-WH43U4IY.js → chunk-A4M3A4SZ.js} +4 -4
- package/dist/{chunk-WH43U4IY.js.map → chunk-A4M3A4SZ.js.map} +1 -1
- package/dist/{chunk-I54DOEZB.js → chunk-AG4EP3OY.js} +3 -3
- package/dist/{chunk-I54DOEZB.js.map → chunk-AG4EP3OY.js.map} +1 -1
- package/dist/{chunk-WS4AYRSL.js → chunk-AL4IUSML.js} +7 -4
- package/dist/{chunk-WS4AYRSL.js.map → chunk-AL4IUSML.js.map} +1 -1
- package/dist/{chunk-ZQBEFP2O.js → chunk-APQEXM4I.js} +8 -4
- package/dist/chunk-APQEXM4I.js.map +1 -0
- package/dist/{chunk-YYYQPKQ7.js → chunk-AURT72IC.js} +2 -2
- package/dist/{chunk-KFAGXPIK.js → chunk-AVDSYLOY.js} +3 -3
- package/dist/{chunk-KFAGXPIK.js.map → chunk-AVDSYLOY.js.map} +1 -1
- package/dist/{chunk-GJPHQLLN.js → chunk-AYKYHZGQ.js} +2 -2
- package/dist/{chunk-GJPHQLLN.js.map → chunk-AYKYHZGQ.js.map} +1 -1
- package/dist/{chunk-QBORJTS4.js → chunk-D3JWVMJE.js} +55 -19
- package/dist/chunk-D3JWVMJE.js.map +1 -0
- package/dist/{chunk-RXX4CN5J.js → chunk-EGJZDKMW.js} +2 -2
- package/dist/{chunk-RXX4CN5J.js.map → chunk-EGJZDKMW.js.map} +1 -1
- package/dist/{chunk-UPOTBKKK.js → chunk-FU3CEHBS.js} +2 -2
- package/dist/{chunk-UPOTBKKK.js.map → chunk-FU3CEHBS.js.map} +1 -1
- package/dist/{chunk-FWR6SEIA.js → chunk-HA6OJRVI.js} +17 -6
- package/dist/chunk-HA6OJRVI.js.map +1 -0
- package/dist/{chunk-XZQH2M5I.js → chunk-HURHKQTJ.js} +18 -8
- package/dist/chunk-HURHKQTJ.js.map +1 -0
- package/dist/{chunk-UF6KCRNT.js → chunk-JNLKM3JT.js} +29 -13
- package/dist/chunk-JNLKM3JT.js.map +1 -0
- package/dist/{chunk-2HWO5TFV.js → chunk-KAQJVGYW.js} +14 -9
- package/dist/{chunk-2HWO5TFV.js.map → chunk-KAQJVGYW.js.map} +1 -1
- package/dist/{chunk-BNYILASW.js → chunk-MLKNZL5J.js} +28 -12
- package/dist/chunk-MLKNZL5J.js.map +1 -0
- package/dist/{chunk-PYVUQNFQ.js → chunk-MOO63SHZ.js} +2 -2
- package/dist/{chunk-PYVUQNFQ.js.map → chunk-MOO63SHZ.js.map} +1 -1
- package/dist/{chunk-A7YBFS4H.js → chunk-NKMJMVZP.js} +2 -2
- package/dist/{chunk-5ZQVL3V2.js → chunk-ONED3PUB.js} +8 -7
- package/dist/{chunk-5ZQVL3V2.js.map → chunk-ONED3PUB.js.map} +1 -1
- package/dist/{chunk-MLRTPQQO.js → chunk-OZGKK3N5.js} +11 -6
- package/dist/chunk-OZGKK3N5.js.map +1 -0
- package/dist/{chunk-RZWRAJCD.js → chunk-P6HG5RB2.js} +71 -29
- package/dist/chunk-P6HG5RB2.js.map +1 -0
- package/dist/{chunk-NUUX2SSN.js → chunk-TE3CBEJQ.js} +34 -12
- package/dist/chunk-TE3CBEJQ.js.map +1 -0
- package/dist/{chunk-YR6T73GY.js → chunk-V7EB7Q2M.js} +1 -1
- package/dist/chunk-V7EB7Q2M.js.map +1 -0
- package/dist/{chunk-OE6O3XQB.js → chunk-VYYY5DDZ.js} +3 -3
- package/dist/chunk-VYYY5DDZ.js.map +1 -0
- package/dist/{chunk-DE3INTHZ.js → chunk-YWP2Z3JN.js} +3 -3
- package/dist/{chunk-DE3INTHZ.js.map → chunk-YWP2Z3JN.js.map} +1 -1
- package/dist/{chunk-WS5AUJ35.js → chunk-Z2EWQMTR.js} +7 -4
- package/dist/chunk-Z2EWQMTR.js.map +1 -0
- package/dist/{chunk-INA53XXW.js → chunk-ZL3JFUIE.js} +3 -3
- package/dist/chunk-ZL3JFUIE.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 +13 -0
- package/dist/components/app-ui.js +4 -4
- package/dist/components/badge.js +3 -3
- package/dist/components/blocks.js +4 -4
- package/dist/components/button.js +3 -3
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +3 -3
- package/dist/components/chip.js +2 -2
- package/dist/components/date-input.js +3 -3
- package/dist/components/dialog.js +2 -2
- package/dist/components/fieldset.js +2 -2
- package/dist/components/grid.js +2 -2
- package/dist/components/help.js +2 -2
- package/dist/components/icon.js +2 -2
- package/dist/components/journey.js +3 -3
- package/dist/components/layout.js +2 -2
- package/dist/components/link.js +3 -3
- package/dist/components/list.js +2 -2
- package/dist/components/media.js +2 -2
- package/dist/components/navigation.js +3 -3
- package/dist/components/page.js +2 -2
- package/dist/components/price.js +2 -2
- package/dist/components/progress.d.ts +12 -0
- package/dist/components/progress.js +2 -2
- package/dist/components/radio-group.js +3 -3
- package/dist/components/rows.js +3 -3
- package/dist/components/select.d.ts +11 -0
- package/dist/components/select.js +3 -3
- package/dist/components/shell.js +3 -3
- package/dist/components/summary-list.js +2 -2
- package/dist/components/switch.d.ts +17 -0
- package/dist/components/switch.js +3 -3
- package/dist/components/table.js +3 -3
- package/dist/components/text-input.js +4 -4
- package/dist/components/textarea.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +35 -35
- package/dist/standalone/atomic-ui.js +95 -73
- package/dist/standalone/atomic-ui.js.map +3 -3
- package/dist/standalone/index.html +189 -150
- package/package.json +2 -2
- package/scripts/copy-to-product.mjs +8 -7
- package/specimen/index.html +189 -150
- package/dist/chunk-3EF4T242.js.map +0 -1
- package/dist/chunk-4ZQTXTPA.js.map +0 -1
- package/dist/chunk-AMDTBUUL.js.map +0 -1
- package/dist/chunk-BNYILASW.js.map +0 -1
- package/dist/chunk-EJSX4WCD.js.map +0 -1
- package/dist/chunk-FWR6SEIA.js.map +0 -1
- package/dist/chunk-INA53XXW.js.map +0 -1
- package/dist/chunk-MLRTPQQO.js.map +0 -1
- package/dist/chunk-NU34ZQFR.js.map +0 -1
- package/dist/chunk-NUUX2SSN.js.map +0 -1
- package/dist/chunk-OE6O3XQB.js.map +0 -1
- package/dist/chunk-QBORJTS4.js.map +0 -1
- package/dist/chunk-RZWRAJCD.js.map +0 -1
- package/dist/chunk-TRZO5CHU.js.map +0 -1
- package/dist/chunk-UF6KCRNT.js.map +0 -1
- package/dist/chunk-WP5WJ4V5.js.map +0 -1
- package/dist/chunk-WS5AUJ35.js.map +0 -1
- package/dist/chunk-XU2XODVH.js.map +0 -1
- package/dist/chunk-XZQH2M5I.js.map +0 -1
- package/dist/chunk-YR6T73GY.js.map +0 -1
- package/dist/chunk-ZQBEFP2O.js.map +0 -1
- /package/dist/{chunk-YYYQPKQ7.js.map → chunk-AURT72IC.js.map} +0 -0
- /package/dist/{chunk-A7YBFS4H.js.map → chunk-NKMJMVZP.js.map} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ONED3PUB.js";
|
|
4
4
|
import {
|
|
5
5
|
fontSize,
|
|
6
6
|
space,
|
|
7
7
|
t,
|
|
8
8
|
targetSize,
|
|
9
9
|
touchTarget
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
11
11
|
|
|
12
12
|
// packages/ui/src/components/checkbox.ts
|
|
13
13
|
import { html, css, nothing } from "lit";
|
|
@@ -87,4 +87,4 @@ customElements.define("impakt-checkbox", ImpaktCheckbox);
|
|
|
87
87
|
export {
|
|
88
88
|
ImpaktCheckbox
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-AG4EP3OY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/checkbox.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize, touchTarget } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A single checkbox — a consent, an opt-in, a confirmation.\n *\n * The label sits beside the box rather than above it, so this overrides the\n * base layout. The whole `<label>` is the hit area: a 20px box is legal under\n * 2.5.8 and still unkind, and the row costs nothing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpaktCheckbox extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n };\n\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n touchTarget('.row'),\n css`\n .row {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n cursor: pointer;\n }\n input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([invalid]) .row {\n color: ${t.dangerText};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <input\n type=\"checkbox\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"text\">\n ${this.label}${this.required
|
|
1
|
+
{"version":3,"sources":["../src/components/checkbox.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize, touchTarget } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A single checkbox — a consent, an opt-in, a confirmation.\n *\n * The label sits beside the box rather than above it, so this overrides the\n * base layout. The whole `<label>` is the hit area: a 20px box is legal under\n * 2.5.8 and still unkind, and the row costs nothing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpaktCheckbox extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n };\n\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n touchTarget('.row'),\n css`\n .row {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n cursor: pointer;\n }\n input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([invalid]) .row {\n color: ${t.dangerText};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <input\n type=\"checkbox\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"text\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </span>\n </label>\n `;\n }\n\n /** The label is inside the control here, so the base class's is suppressed. */\n protected renderLabel(): TemplateResult {\n return html`${nothing}`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-checkbox', ImpaktCheckbox);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-checkbox': ImpaktCheckbox;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAgBjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAC/C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAC1C;AAAA;AAAA,EAIA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB,YAAY,MAAM;AAAA,MAClB;AAAA;AAAA;AAAA;AAAA,eAIW,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,UAIb,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKI,EAAE,KAAK;AAAA;AAAA;AAAA,qBAGV,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA,iBAGlB,EAAE,UAAU;AAAA;AAAA;AAAA,IAG3B;AAAA;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA,0CAC+B,KAAK,SAAS;AAAA;AAAA;AAAA,eAGzC,KAAK,SAAS;AAAA;AAAA,iBAEZ,KAAK,QAAQ,OAAO;AAAA,qBAChB,KAAK,OAAO;AAAA,sBACX,KAAK,QAAQ;AAAA,sBACb,KAAK,QAAQ;AAAA,6BACN,KAAK,WAAW;AAAA,yBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,oBAClC,CAAC,MAAa;AACtB,WAAK,UAAW,EAAE,OAA4B;AAC9C,WAAK,aAAa,KAAK,UAAU,OAAO,EAAE;AAAA,IAC5C,CAAC;AAAA;AAAA;AAAA,YAGC,KAAK,KAAK,GAAG,KAAK,WAAW,gCAAgC,KAAK,YAAY,aAAa,OAAO;AAAA;AAAA;AAAA;AAAA,EAI5G;AAAA;AAAA,EAGU,cAA8B;AACtC,WAAO,OAAO,OAAO;AAAA,EACvB;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,mBAAmB,cAAc;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktElement,
|
|
3
3
|
t
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
5
5
|
|
|
6
6
|
// packages/ui/src/components/icon.ts
|
|
7
7
|
import { css, html, nothing, svg } from "lit";
|
|
@@ -81,12 +81,15 @@ var ImpaktIcon = class extends ImpaktElement {
|
|
|
81
81
|
this.tone = "inherit";
|
|
82
82
|
}
|
|
83
83
|
static {
|
|
84
|
-
this.styles = [
|
|
84
|
+
this.styles = [
|
|
85
|
+
...ImpaktElement.styles,
|
|
86
|
+
css`
|
|
85
87
|
:host { display: inline-flex; vertical-align: middle; line-height: 0; }
|
|
86
88
|
:host([tone='brand']) { color: ${t.brand}; }
|
|
87
89
|
:host([tone='muted']) { color: ${t.textMuted}; }
|
|
88
90
|
@media (forced-colors: active) { :host { color: CanvasText; } }
|
|
89
|
-
`
|
|
91
|
+
`
|
|
92
|
+
];
|
|
90
93
|
}
|
|
91
94
|
render() {
|
|
92
95
|
const size = { sm: "16px", md: "24px", lg: "32px", xl: "48px" }[this.size] ?? "24px";
|
|
@@ -102,4 +105,4 @@ export {
|
|
|
102
105
|
iconSvg,
|
|
103
106
|
ImpaktIcon
|
|
104
107
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-AL4IUSML.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/icon.ts"],"sourcesContent":["import { css, html, nothing, svg, type SVGTemplateResult, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { t } from '../base/tokens';\n\n/**\n * The icons the library draws, each on a 24 by 24 grid in strokes of the\n * current text colour. Kept to a set the components need and editors reach\n * for, so an icon always matches the line weight of the ones beside it.\n */\nexport const ICONS = {\n 'arrow-right': svg`<path d=\"M5 12h14M13 6l6 6-6 6\"/>`,\n 'arrow-left': svg`<path d=\"M19 12H5M11 6l-6 6 6 6\"/>`,\n 'chevron-right': svg`<path d=\"M9 6l6 6-6 6\"/>`,\n 'chevron-down': svg`<path d=\"M6 9l6 6 6-6\"/>`,\n check: svg`<path d=\"M5 12.5l4.5 4.5L19 7\"/>`,\n close: svg`<path d=\"M6 6l12 12M18 6L6 18\"/>`,\n menu: svg`<path d=\"M4 7h16M4 12h16M4 17h16\"/>`,\n /** Two lines: a menu drawn quieter, as a round icon button. */\n 'menu-two': svg`<path d=\"M5 9.5h14M5 14.5h14\"/>`,\n plus: svg`<path d=\"M12 5v14M5 12h14\"/>`,\n minus: svg`<path d=\"M5 12h14\"/>`,\n search: svg`<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M16 16l4 4\"/>`,\n external: svg`<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>`,\n download: svg`<path d=\"M12 4v11M7 10l5 5 5-5M5 20h14\"/>`,\n home: svg`<path d=\"M4 11l8-7 8 7M6 9.5V20h12V9.5\"/><path d=\"M10 20v-6h4v6\"/>`,\n phone: svg`<path d=\"M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z\"/>`,\n mail: svg`<rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"1.5\"/><path d=\"M4 7l8 6 8-6\"/>`,\n 'map-pin': svg`<path d=\"M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z\"/><circle cx=\"12\" cy=\"10\" r=\"2.5\"/>`,\n calendar: svg`<rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"1.5\"/><path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\"/>`,\n clock: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 7.5V12l3 2\"/>`,\n user: svg`<circle cx=\"12\" cy=\"8.5\" r=\"3.5\"/><path d=\"M5 20a7 7 0 0 1 14 0\"/>`,\n star: svg`<path d=\"M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z\"/>`,\n heart: svg`<path d=\"M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z\"/>`,\n shield: svg`<path d=\"M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/>`,\n leaf: svg`<path d=\"M5 19c0-8 5-13 14-14 0 9-5 14-13 14z\"/><path d=\"M5 19l7-7\"/>`,\n sun: svg`<circle cx=\"12\" cy=\"12\" r=\"3.5\"/><path d=\"M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4\"/>`,\n bolt: svg`<path d=\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"/>`,\n key: svg`<circle cx=\"8\" cy=\"15\" r=\"3.5\"/><path d=\"M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2\"/>`,\n info: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 11v5.5M12 7.5v.5\"/>`,\n warning: svg`<path d=\"M12 4l9 15.5H3z\"/><path d=\"M12 10v4M12 16.5v.5\"/>`,\n document: svg`<path d=\"M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z\"/><path d=\"M14 3.5V8h4M9 13h6M9 16.5h6\"/>`,\n pound: svg`<path d=\"M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10\"/>`,\n chat: svg`<path d=\"M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z\"/>`,\n /** Product navigation and actions, drawn to Lucide's shapes so they sit beside its line weight. */\n grid: svg`<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>`,\n clipboard: svg`<rect x=\"8\" y=\"2\" width=\"8\" height=\"4\" rx=\"1\"/><path d=\"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M12 11h4M12 16h4M8 11h.01M8 16h.01\"/>`,\n 'map-pinned': svg`<path d=\"M18 8c0 3.6-3.9 7.4-5.4 8.8a1 1 0 0 1-1.2 0C9.9 15.4 6 11.6 6 8a6 6 0 0 1 12 0\"/><circle cx=\"12\" cy=\"8\" r=\"2\"/><path d=\"M8.7 14H5a1 1 0 0 0-.9.7l-2 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .9-1.3l-2-6a1 1 0 0 0-.9-.7h-3.7\"/>`,\n users: svg`<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8\"/>`,\n radio: svg`<path d=\"M4.9 19.1C1 15.2 1 8.8 4.9 4.9M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5M19.1 4.9C23 8.8 23 15.1 19.1 19\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/>`,\n settings: svg`<path d=\"M12.2 2h-.4a2 2 0 0 0-2 2v.2a2 2 0 0 1-1 1.7l-.4.3a2 2 0 0 1-2 0l-.2-.1a2 2 0 0 0-2.7.7l-.2.4a2 2 0 0 0 .7 2.7l.2.1a2 2 0 0 1 1 1.7v.5a2 2 0 0 1-1 1.8l-.2.1a2 2 0 0 0-.7 2.7l.2.4a2 2 0 0 0 2.7.7l.2-.1a2 2 0 0 1 2 0l.4.3a2 2 0 0 1 1 1.7v.2a2 2 0 0 0 2 2h.4a2 2 0 0 0 2-2v-.2a2 2 0 0 1 1-1.7l.4-.3a2 2 0 0 1 2 0l.2.1a2 2 0 0 0 2.7-.7l.2-.4a2 2 0 0 0-.7-2.7l-.2-.1a2 2 0 0 1-1-1.8v-.5a2 2 0 0 1 1-1.7l.2-.1a2 2 0 0 0 .7-2.7l-.2-.4a2 2 0 0 0-2.7-.7l-.2.1a2 2 0 0 1-2 0l-.4-.3a2 2 0 0 1-1-1.7V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n 'log-out': svg`<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9\"/>`,\n 'arrow-up-right': svg`<path d=\"M7 7h10v10M7 17L17 7\"/>`,\n more: svg`<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>`,\n upload: svg`<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>`,\n image: svg`<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"M21 15l-3.1-3.1a2 2 0 0 0-2.8 0L6 21\"/>`,\n lock: svg`<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/>`,\n eye: svg`<path d=\"M2.1 12.3a1 1 0 0 1 0-.7 10.8 10.8 0 0 1 19.8 0 1 1 0 0 1 0 .7 10.8 10.8 0 0 1-19.8 0\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n trash: svg`<path d=\"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6\"/>`,\n pencil: svg`<path d=\"M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8L2 21.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5zM15 5l4 4\"/>`,\n 'qr-code': svg`<rect x=\"3\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"16\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"3\" y=\"16\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"M21 16h-3a2 2 0 0 0-2 2v3M21 21v.01M12 7v3a2 2 0 0 1-2 2H7M3 12h.01M12 3h.01M12 16v.01M16 12h1M21 12v.01M12 21v-1\"/>`,\n battery: svg`<rect x=\"2\" y=\"7\" width=\"16\" height=\"10\" rx=\"2\"/><path d=\"M22 11v2M6 11v2M10 11v2\"/>`,\n} as const satisfies Record<string, SVGTemplateResult>;\n\nexport type IconName = keyof typeof ICONS;\nexport const ICON_NAMES = Object.keys(ICONS) as IconName[];\n\n/** An icon as markup, for components that draw one beside their own words. Always decorative. */\nexport function iconSvg(name: string | undefined, size = '1.25em'): TemplateResult | typeof nothing {\n const shape = name ? ICONS[name as IconName] : undefined;\n if (!shape) return nothing;\n return html`<svg class=\"icon\" viewBox=\"0 0 24 24\" width=${size} height=${size} fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${shape}</svg>`;\n}\n\n/**\n * A small picture that stands for something: a phone beside a number, a tick\n * beside a benefit.\n *\n * **An icon is decorative unless it is labelled.** With no `label` it is\n * hidden from screen readers, because the words beside it already say what it\n * means. Give it a label only when it stands alone and carries meaning (1.1.1).\n *\n * @category media\n * @icon star\n */\nexport class ImpaktIcon extends ImpaktElement {\n static properties = {\n name: { type: String, reflect: true },\n label: { type: String },\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Which icon. */\n declare name: 'arrow-right' | 'arrow-left' | 'chevron-right' | 'chevron-down' | 'check' | 'close' | 'menu' | 'plus' | 'minus' | 'search' | 'external' | 'download' | 'home' | 'phone' | 'mail' | 'map-pin' | 'calendar' | 'clock' | 'user' | 'star' | 'heart' | 'shield' | 'leaf' | 'sun' | 'bolt' | 'key' | 'info' | 'warning' | 'document' | 'pound' | 'chat' | 'grid' | 'clipboard' | 'map-pinned' | 'users' | 'radio' | 'settings' | 'log-out' | 'arrow-up-right' | 'more' | 'upload' | 'image' | 'lock' | 'eye' | 'trash' | 'pencil' | 'qr-code' | 'battery';\n /** What the icon means, when it stands alone. Leave empty when words beside it say the same. */\n declare label: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n /** The icon's colour. */\n declare tone: 'inherit' | 'brand' | 'muted';\n\n constructor() {\n super();\n this.name = 'star';\n this.label = '';\n this.size = 'md';\n this.tone = 'inherit';\n }\n\n static styles = [...ImpaktElement.styles, css`\n :host { display: inline-flex; vertical-align: middle; line-height: 0; }\n :host([tone='brand']) { color: ${t.brand}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n @media (forced-colors: active) { :host { color: CanvasText; } }\n `];\n\n render(): TemplateResult {\n const size = { sm: '16px', md: '24px', lg: '32px', xl: '48px' }[this.size] ?? '24px';\n const drawn = iconSvg(this.name, size);\n return this.label ? html`<span role=\"img\" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;\n }\n}\n\ncustomElements.define('impakt-icon', ImpaktIcon);\ndeclare global { interface HTMLElementTagNameMap { 'impakt-icon': ImpaktIcon } }\n"],"mappings":";;;;;;AAAA,SAAS,KAAK,MAAM,SAAS,WAAwD;AAS9E,IAAM,QAAQ;AAAA,EACnB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA;AAAA,EAEN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA;AAAA,EAEN,MAAM;AAAA,EACN,WAAW;AAAA,EACX,cAAc;AAAA,EACd,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS;AACX;AAGO,IAAM,aAAa,OAAO,KAAK,KAAK;AAGpC,SAAS,QAAQ,MAA0B,OAAO,UAA2C;AAClG,QAAM,QAAQ,OAAO,MAAM,IAAgB,IAAI;AAC/C,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,mDAAmD,IAAI,WAAW,IAAI,8IAA8I,KAAK;AAClO;AAaO,IAAM,aAAN,cAAyB,cAAc;AAAA,EAC5C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EASA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS,CAAC,GAAG,cAAc,QAAQ;AAAA;AAAA,qCAEP,EAAE,KAAK;AAAA,qCACP,EAAE,SAAS;AAAA;AAAA,GAE7C;AAAA;AAAA,EAED,SAAyB;AACvB,UAAM,OAAO,EAAE,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,OAAO,EAAE,KAAK,IAAI,KAAK;AAC9E,UAAM,QAAQ,QAAQ,KAAK,MAAM,IAAI;AACrC,WAAO,KAAK,QAAQ,mCAAmC,KAAK,KAAK,IAAI,KAAK,YAAY,OAAO,KAAK;AAAA,EACpG;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/icon.ts"],"sourcesContent":["import { css, html, nothing, svg, type SVGTemplateResult, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { t } from '../base/tokens';\n\n/**\n * The icons the library draws, each on a 24 by 24 grid in strokes of the\n * current text colour. Kept to a set the components need and editors reach\n * for, so an icon always matches the line weight of the ones beside it.\n */\nexport const ICONS = {\n 'arrow-right': svg`<path d=\"M5 12h14M13 6l6 6-6 6\"/>`,\n 'arrow-left': svg`<path d=\"M19 12H5M11 6l-6 6 6 6\"/>`,\n 'chevron-right': svg`<path d=\"M9 6l6 6-6 6\"/>`,\n 'chevron-down': svg`<path d=\"M6 9l6 6 6-6\"/>`,\n check: svg`<path d=\"M5 12.5l4.5 4.5L19 7\"/>`,\n close: svg`<path d=\"M6 6l12 12M18 6L6 18\"/>`,\n menu: svg`<path d=\"M4 7h16M4 12h16M4 17h16\"/>`,\n /** Two lines: a menu drawn quieter, as a round icon button. */\n 'menu-two': svg`<path d=\"M5 9.5h14M5 14.5h14\"/>`,\n plus: svg`<path d=\"M12 5v14M5 12h14\"/>`,\n minus: svg`<path d=\"M5 12h14\"/>`,\n search: svg`<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"M16 16l4 4\"/>`,\n external: svg`<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>`,\n download: svg`<path d=\"M12 4v11M7 10l5 5 5-5M5 20h14\"/>`,\n home: svg`<path d=\"M4 11l8-7 8 7M6 9.5V20h12V9.5\"/><path d=\"M10 20v-6h4v6\"/>`,\n phone: svg`<path d=\"M7 3.5h3l1.5 4-2 1.5a11 11 0 0 0 5.5 5.5l1.5-2 4 1.5v3a2 2 0 0 1-2 2A16 16 0 0 1 5 5.5a2 2 0 0 1 2-2z\"/>`,\n mail: svg`<rect x=\"3.5\" y=\"5.5\" width=\"17\" height=\"13\" rx=\"1.5\"/><path d=\"M4 7l8 6 8-6\"/>`,\n 'map-pin': svg`<path d=\"M12 21s-6.5-6-6.5-11a6.5 6.5 0 0 1 13 0c0 5-6.5 11-6.5 11z\"/><circle cx=\"12\" cy=\"10\" r=\"2.5\"/>`,\n calendar: svg`<rect x=\"4\" y=\"5.5\" width=\"16\" height=\"14.5\" rx=\"1.5\"/><path d=\"M4 10h16M8.5 3.5v4M15.5 3.5v4\"/>`,\n clock: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 7.5V12l3 2\"/>`,\n user: svg`<circle cx=\"12\" cy=\"8.5\" r=\"3.5\"/><path d=\"M5 20a7 7 0 0 1 14 0\"/>`,\n star: svg`<path d=\"M12 4l2.4 5 5.4.6-4 3.7 1.1 5.4L12 16l-4.9 2.7 1.1-5.4-4-3.7 5.4-.6z\"/>`,\n heart: svg`<path d=\"M12 19.5s-7.5-4.6-7.5-10A4 4 0 0 1 12 7a4 4 0 0 1 7.5 2.5c0 5.4-7.5 10-7.5 10z\"/>`,\n shield: svg`<path d=\"M12 3.5l7 2.5v5.5c0 4.5-3 7.8-7 9-4-1.2-7-4.5-7-9V6z\"/><path d=\"M9 12l2 2 4-4\"/>`,\n leaf: svg`<path d=\"M5 19c0-8 5-13 14-14 0 9-5 14-13 14z\"/><path d=\"M5 19l7-7\"/>`,\n sun: svg`<circle cx=\"12\" cy=\"12\" r=\"3.5\"/><path d=\"M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6L7 7M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4\"/>`,\n bolt: svg`<path d=\"M13 3L5 13.5h6L10 21l8-10.5h-6z\"/>`,\n key: svg`<circle cx=\"8\" cy=\"15\" r=\"3.5\"/><path d=\"M10.5 12.5L19 4M16 7l2.5 2.5M14 9l2 2\"/>`,\n info: svg`<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 11v5.5M12 7.5v.5\"/>`,\n warning: svg`<path d=\"M12 4l9 15.5H3z\"/><path d=\"M12 10v4M12 16.5v.5\"/>`,\n document: svg`<path d=\"M6 3.5h8l4 4V20a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 6 20z\"/><path d=\"M14 3.5V8h4M9 13h6M9 16.5h6\"/>`,\n pound: svg`<path d=\"M16 6.5a3.5 3.5 0 0 0-6.5 1.8V20M7 13h7M7 20h10\"/>`,\n chat: svg`<path d=\"M4.5 5.5h15v10h-9l-4 3.5v-3.5h-2z\"/>`,\n /** Product navigation and actions, drawn to Lucide's shapes so they sit beside its line weight. */\n grid: svg`<rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"14\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>`,\n clipboard: svg`<rect x=\"8\" y=\"2\" width=\"8\" height=\"4\" rx=\"1\"/><path d=\"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2M12 11h4M12 16h4M8 11h.01M8 16h.01\"/>`,\n 'map-pinned': svg`<path d=\"M18 8c0 3.6-3.9 7.4-5.4 8.8a1 1 0 0 1-1.2 0C9.9 15.4 6 11.6 6 8a6 6 0 0 1 12 0\"/><circle cx=\"12\" cy=\"8\" r=\"2\"/><path d=\"M8.7 14H5a1 1 0 0 0-.9.7l-2 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .9-1.3l-2-6a1 1 0 0 0-.9-.7h-3.7\"/>`,\n users: svg`<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8\"/>`,\n radio: svg`<path d=\"M4.9 19.1C1 15.2 1 8.8 4.9 4.9M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5M19.1 4.9C23 8.8 23 15.1 19.1 19\"/><circle cx=\"12\" cy=\"12\" r=\"2\"/>`,\n settings: svg`<path d=\"M12.2 2h-.4a2 2 0 0 0-2 2v.2a2 2 0 0 1-1 1.7l-.4.3a2 2 0 0 1-2 0l-.2-.1a2 2 0 0 0-2.7.7l-.2.4a2 2 0 0 0 .7 2.7l.2.1a2 2 0 0 1 1 1.7v.5a2 2 0 0 1-1 1.8l-.2.1a2 2 0 0 0-.7 2.7l.2.4a2 2 0 0 0 2.7.7l.2-.1a2 2 0 0 1 2 0l.4.3a2 2 0 0 1 1 1.7v.2a2 2 0 0 0 2 2h.4a2 2 0 0 0 2-2v-.2a2 2 0 0 1 1-1.7l.4-.3a2 2 0 0 1 2 0l.2.1a2 2 0 0 0 2.7-.7l.2-.4a2 2 0 0 0-.7-2.7l-.2-.1a2 2 0 0 1-1-1.8v-.5a2 2 0 0 1 1-1.7l.2-.1a2 2 0 0 0 .7-2.7l-.2-.4a2 2 0 0 0-2.7-.7l-.2.1a2 2 0 0 1-2 0l-.4-.3a2 2 0 0 1-1-1.7V4a2 2 0 0 0-2-2z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n 'log-out': svg`<path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9\"/>`,\n 'arrow-up-right': svg`<path d=\"M7 7h10v10M7 17L17 7\"/>`,\n more: svg`<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>`,\n upload: svg`<path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12\"/>`,\n image: svg`<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"M21 15l-3.1-3.1a2 2 0 0 0-2.8 0L6 21\"/>`,\n lock: svg`<rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/>`,\n eye: svg`<path d=\"M2.1 12.3a1 1 0 0 1 0-.7 10.8 10.8 0 0 1 19.8 0 1 1 0 0 1 0 .7 10.8 10.8 0 0 1-19.8 0\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>`,\n trash: svg`<path d=\"M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6\"/>`,\n pencil: svg`<path d=\"M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8L2 21.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5zM15 5l4 4\"/>`,\n 'qr-code': svg`<rect x=\"3\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"16\" y=\"3\" width=\"5\" height=\"5\" rx=\"1\"/><rect x=\"3\" y=\"16\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"M21 16h-3a2 2 0 0 0-2 2v3M21 21v.01M12 7v3a2 2 0 0 1-2 2H7M3 12h.01M12 3h.01M12 16v.01M16 12h1M21 12v.01M12 21v-1\"/>`,\n battery: svg`<rect x=\"2\" y=\"7\" width=\"16\" height=\"10\" rx=\"2\"/><path d=\"M22 11v2M6 11v2M10 11v2\"/>`,\n} as const satisfies Record<string, SVGTemplateResult>;\n\nexport type IconName = keyof typeof ICONS;\nexport const ICON_NAMES = Object.keys(ICONS) as IconName[];\n\n/** An icon as markup, for components that draw one beside their own words. Always decorative. */\nexport function iconSvg(name: string | undefined, size = '1.25em'): TemplateResult | typeof nothing {\n const shape = name ? ICONS[name as IconName] : undefined;\n if (!shape) return nothing;\n return html`<svg class=\"icon\" viewBox=\"0 0 24 24\" width=${size} height=${size} fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">${shape}</svg>`;\n}\n\n/**\n * A small picture that stands for something: a phone beside a number, a tick\n * beside a benefit.\n *\n * **An icon is decorative unless it is labelled.** With no `label` it is\n * hidden from screen readers, because the words beside it already say what it\n * means. Give it a label only when it stands alone and carries meaning (1.1.1).\n *\n * @category media\n * @icon star\n */\nexport class ImpaktIcon extends ImpaktElement {\n static properties = {\n name: { type: String, reflect: true },\n label: { type: String },\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n };\n /** Which icon. */\n declare name:\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** What the icon means, when it stands alone. Leave empty when words beside it say the same. */\n declare label: string;\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n /** The icon's colour. */\n declare tone: 'inherit' | 'brand' | 'muted';\n\n constructor() {\n super();\n this.name = 'star';\n this.label = '';\n this.size = 'md';\n this.tone = 'inherit';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-flex; vertical-align: middle; line-height: 0; }\n :host([tone='brand']) { color: ${t.brand}; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n @media (forced-colors: active) { :host { color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const size = { sm: '16px', md: '24px', lg: '32px', xl: '48px' }[this.size] ?? '24px';\n const drawn = iconSvg(this.name, size);\n return this.label ? html`<span role=\"img\" aria-label=${this.label}>${drawn}</span>` : html`${drawn}`;\n }\n}\n\ncustomElements.define('impakt-icon', ImpaktIcon);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-icon': ImpaktIcon;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,KAAK,MAAM,SAAS,WAAwD;AAS9E,IAAM,QAAQ;AAAA,EACnB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA;AAAA,EAEN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA;AAAA,EAEN,MAAM;AAAA,EACN,WAAW;AAAA,EACX,cAAc;AAAA,EACd,OAAO;AAAA,EACP,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS;AACX;AAGO,IAAM,aAAa,OAAO,KAAK,KAAK;AAGpC,SAAS,QAAQ,MAA0B,OAAO,UAA2C;AAClG,QAAM,QAAQ,OAAO,MAAM,IAAgB,IAAI;AAC/C,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,mDAAmD,IAAI,WAAW,IAAI,8IAA8I,KAAK;AAClO;AAaO,IAAM,aAAN,cAAyB,cAAc;AAAA,EAC5C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EAyDA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA;AAAA,qCAEiC,EAAE,KAAK;AAAA,qCACP,EAAE,SAAS;AAAA;AAAA;AAAA,IAG9C;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,OAAO,EAAE,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,OAAO,EAAE,KAAK,IAAI,KAAK;AAC9E,UAAM,QAAQ,QAAQ,KAAK,MAAM,IAAI;AACrC,WAAO,KAAK,QAAQ,mCAAmC,KAAK,KAAK,IAAI,KAAK,YAAY,OAAO,KAAK;AAAA,EACpG;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ImpaktElement,
|
|
3
3
|
spaceAround,
|
|
4
4
|
token
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
6
6
|
|
|
7
7
|
// packages/ui/src/components/grid.ts
|
|
8
8
|
import { css, html } from "lit";
|
|
@@ -38,7 +38,10 @@ var ImpaktGrid = class extends ImpaktElement {
|
|
|
38
38
|
this.spaceBelow = "none";
|
|
39
39
|
}
|
|
40
40
|
static {
|
|
41
|
-
this.styles = [
|
|
41
|
+
this.styles = [
|
|
42
|
+
...ImpaktElement.styles,
|
|
43
|
+
spaceAround,
|
|
44
|
+
css`
|
|
42
45
|
:host { display: block; min-inline-size: 0; container-type: inline-size; }
|
|
43
46
|
.columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${token("layout.gutter.md", "16px")}; align-items: stretch; }
|
|
44
47
|
:host([gap='none']) .columns { gap: 0; }
|
|
@@ -57,7 +60,8 @@ var ImpaktGrid = class extends ImpaktElement {
|
|
|
57
60
|
::slotted(*) { max-inline-size: 100%; }
|
|
58
61
|
@container (max-width: 40rem) { :host(:not([stack-on='never'])) .columns { grid-template-columns: minmax(0, 1fr) !important; } }
|
|
59
62
|
@container (max-width: 64rem) { :host([stack-on='tablet']) .columns { grid-template-columns: minmax(0, 1fr) !important; } }
|
|
60
|
-
`
|
|
63
|
+
`
|
|
64
|
+
];
|
|
61
65
|
}
|
|
62
66
|
render() {
|
|
63
67
|
const count = this.columns === "one" ? 1 : this.columns === "three" ? 3 : this.columns === "four" ? 4 : 2;
|
|
@@ -71,4 +75,4 @@ customElements.define("impakt-grid", ImpaktGrid);
|
|
|
71
75
|
export {
|
|
72
76
|
ImpaktGrid
|
|
73
77
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
78
|
+
//# sourceMappingURL=chunk-APQEXM4I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/grid.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { spaceAround, token } from '../base/tokens';\n\n/** Column widths as fractions, for each choice of `widths`. */\nconst WIDTHS: Record<string, string> = {\n '2:1': '2fr 1fr',\n '1:2': '1fr 2fr',\n '3:1': '3fr 1fr',\n '1:3': '1fr 3fr',\n '1:2:1': '1fr 2fr 1fr',\n '2:1:1': '2fr 1fr 1fr',\n '1:1:2': '1fr 1fr 2fr',\n};\n\n/**\n * A responsive row with named column slots. Child order stays inside each\n * column; changing a page's visual grid never reorders its reading sequence.\n *\n * Gutters come from the brand's layout, so every grid for a partner keeps the\n * same rhythm. Where the columns stack is a choice, because a three-column\n * row of cards may work on a tablet where two columns of long text do not.\n *\n * @category layout\n * @icon columns\n * @slot column-1 - First column.\n * @slot column-2 - Second column.\n * @slot column-3 - Third column.\n * @slot column-4 - Fourth column.\n */\nexport class ImpaktGrid extends ImpaktElement {\n static properties = {\n columns: { type: String, reflect: true },\n widths: { type: String, reflect: true },\n gap: { type: String, reflect: true },\n stackOn: { type: String, reflect: true, attribute: 'stack-on' },\n align: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare columns: 'one' | 'two' | 'three' | 'four' | 'sidebar-left' | 'sidebar-right';\n /** How wide each column is against the others. Applies when it has as many parts as there are columns. */\n declare widths: 'equal' | '2:1' | '1:2' | '3:1' | '1:3' | '1:2:1' | '2:1:1' | '1:1:2';\n /** The space between columns, from the brand's gutters. */\n declare gap: 'none' | 'sm' | 'md' | 'lg' | 'xl';\n /** The screens on which the columns stack, one above another, in column order. */\n declare stackOn: 'phone' | 'tablet' | 'never';\n /** How columns of different heights line up. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Space before the grid, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the grid, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n constructor() {\n super();\n this.columns = 'two';\n this.widths = 'equal';\n this.gap = 'md';\n this.stackOn = 'phone';\n this.align = 'stretch';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host { display: block; min-inline-size: 0; container-type: inline-size; }\n .columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${token('layout.gutter.md', '16px')}; align-items: stretch; }\n :host([gap='none']) .columns { gap: 0; }\n :host([gap='sm']) .columns { gap: ${token('layout.gutter.sm', '8px')}; }\n :host([gap='lg']) .columns { gap: ${token('layout.gutter.lg', '32px')}; }\n :host([gap='xl']) .columns { gap: ${token('layout.gutter.xl', '48px')}; }\n :host([align='start']) .columns { align-items: start; }\n :host([align='center']) .columns { align-items: center; }\n :host([align='end']) .columns { align-items: end; }\n :host([columns='one']) .columns { grid-template-columns: minmax(0, 1fr); }\n :host([columns='three']) .columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='four']) .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n :host([columns='sidebar-left']) .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }\n :host([columns='sidebar-right']) .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }\n .column { min-inline-size: 0; overflow-wrap: anywhere; }\n ::slotted(*) { max-inline-size: 100%; }\n @container (max-width: 40rem) { :host(:not([stack-on='never'])) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n @container (max-width: 64rem) { :host([stack-on='tablet']) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n `,\n ];\n render() {\n const count = this.columns === 'one' ? 1 : this.columns === 'three' ? 3 : this.columns === 'four' ? 4 : 2;\n const fractions = WIDTHS[this.widths]?.split(' ');\n // A width split for a different number of columns would leave a column out, so it is ignored.\n const template = fractions && fractions.length === count ? fractions.map((f) => `minmax(0, ${f})`).join(' ') : '';\n return html`<div class=\"columns\" part=\"row\" style=${template ? `grid-template-columns: ${template}` : ''}>${Array.from({ length: count }, (_, i) => html`<div class=\"column\" part=\"column\"><slot name=${`column-${i + 1}`}></slot></div>`)}</div>`;\n }\n}\ncustomElements.define('impakt-grid', ImpaktGrid);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-grid': ImpaktGrid;\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAS,KAAK,YAAY;AAK1B,IAAM,SAAiC;AAAA,EACrC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AACX;AAiBO,IAAM,aAAN,cAAyB,cAAc;AAAA,EAC5C;AAAA,SAAO,aAAa;AAAA,MAClB,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,QAAQ,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACtC,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACnC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,WAAW;AAAA,MAC9D,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,YAAY,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,cAAc;AAAA,MACpE,YAAY,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,cAAc;AAAA,IACtE;AAAA;AAAA,EAcA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AACf,SAAK,SAAS;AACd,SAAK,MAAM;AACX,SAAK,UAAU;AACf,SAAK,QAAQ;AACb,SAAK,aAAa;AAClB,SAAK,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA,MACA;AAAA;AAAA,uFAEmF,MAAM,oBAAoB,MAAM,CAAC;AAAA;AAAA,wCAEhF,MAAM,oBAAoB,KAAK,CAAC;AAAA,wCAChC,MAAM,oBAAoB,MAAM,CAAC;AAAA,wCACjC,MAAM,oBAAoB,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcvE;AAAA;AAAA,EACA,SAAS;AACP,UAAM,QAAQ,KAAK,YAAY,QAAQ,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,IAAI;AACxG,UAAM,YAAY,OAAO,KAAK,MAAM,GAAG,MAAM,GAAG;AAEhD,UAAM,WAAW,aAAa,UAAU,WAAW,QAAQ,UAAU,IAAI,CAAC,MAAM,aAAa,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI;AAC/G,WAAO,6CAA6C,WAAW,0BAA0B,QAAQ,KAAK,EAAE,IAAI,MAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM,oDAAoD,UAAU,IAAI,CAAC,EAAE,gBAAgB,CAAC;AAAA,EAC5O;AACF;AACA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
t,
|
|
9
9
|
type,
|
|
10
10
|
visuallyHidden
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
12
12
|
|
|
13
13
|
// packages/ui/src/components/layout.ts
|
|
14
14
|
import { html, css, nothing } from "lit";
|
|
@@ -254,4 +254,4 @@ export {
|
|
|
254
254
|
ImpaktHeading,
|
|
255
255
|
ImpaktText
|
|
256
256
|
};
|
|
257
|
-
//# sourceMappingURL=chunk-
|
|
257
|
+
//# sourceMappingURL=chunk-AURT72IC.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldElement,
|
|
3
3
|
fieldWidths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ONED3PUB.js";
|
|
5
5
|
import {
|
|
6
6
|
fontSize,
|
|
7
7
|
space,
|
|
8
8
|
t
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
10
10
|
|
|
11
11
|
// packages/ui/src/components/textarea.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -115,4 +115,4 @@ customElements.define("impakt-textarea", ImpaktTextarea);
|
|
|
115
115
|
export {
|
|
116
116
|
ImpaktTextarea
|
|
117
117
|
};
|
|
118
|
-
//# sourceMappingURL=chunk-
|
|
118
|
+
//# sourceMappingURL=chunk-AVDSYLOY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text — a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n textarea {\n inline-size: min(100%, var(--impakt-field-width));\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n textarea:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n textarea:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {
|
|
1
|
+
{"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text — a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n textarea {\n inline-size: min(100%, var(--impakt-field-width));\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n textarea:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n textarea:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem('impakt.estimate');\n } catch {\n saved = null;\n }\n if (saved) {\n this.filledText = saved;\n this.setFormValue(saved);\n }\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n >${this.value}</textarea>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n this.fill();\n }\n}\n\ncustomElements.define('impakt-textarea', ImpaktTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-textarea': ImpaktTextarea;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AASjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAiB/C,cAAc;AACZ,UAAM;AAwCR,SAAQ,SAAS;AAEjB;AAAA,SAAQ,aAAa;AAzCnB,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,WAAW;AAAA,EAClB;AAAA,EAtBA;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,WAAW,EAAE,MAAM,OAAO;AAAA,MAC1B,UAAU,EAAE,MAAM,QAAQ,WAAW,YAAY;AAAA,IACnD;AAAA;AAAA,EAkBA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA,mBAGe,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA;AAAA,qBAEpB,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,IAAI;AAAA,wDACiC,EAAE,WAAW;AAAA,kBACnD,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,yBACvB,EAAE,QAAQ;AAAA,iDACc,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAOnC,EAAE,YAAY;AAAA;AAAA;AAAA,wBAGd,EAAE,KAAK;AAAA,sBACT,EAAE,WAAW,eAAe,EAAE,SAAS;AAAA;AAAA;AAAA,wBAGrC,EAAE,MAAM;AAAA,wBACR,EAAE,WAAW;AAAA;AAAA;AAAA,IAGnC;AAAA;AAAA;AAAA,EAOU,WAAW,SAAqC;AACxD,UAAM,aAAa,OAAgB;AACnC,QAAI,KAAK,cAAc,QAAQ,IAAI,OAAO,KAAK,CAAC,KAAK,MAAO,MAAK,QAAQ,KAAK;AAAA,EAChF;AAAA;AAAA,EAGQ,OAAa;AACnB,QAAI,KAAK,UAAU,KAAK,aAAa,WAAY;AACjD,SAAK,SAAS;AACd,QAAI,KAAK,MAAO;AAChB,QAAI,QAAuB;AAC3B,QAAI;AACF,cAAQ,eAAe,QAAQ,iBAAiB;AAAA,IAClD,QAAQ;AACN,cAAQ;AAAA,IACV;AACA,QAAI,OAAO;AACT,WAAK,aAAa;AAClB,WAAK,aAAa,KAAK;AAAA,IACzB;AAAA,EACF;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA;AAAA,aAEE,KAAK,SAAS;AAAA;AAAA,eAEZ,KAAK,QAAQ,OAAO;AAAA,eACpB,KAAK,IAAI;AAAA,oBACJ,KAAK,aAAa,OAAO;AAAA,oBACzB,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,2BACN,KAAK,WAAW;AAAA,uBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,iBACnC,CAAC,MAAa;AACrB,WAAK,aAAa;AAClB,WAAK,aAAc,EAAE,OAA+B,KAAK;AAAA,IAC3D,CAAC;AAAA,SACA,KAAK,KAAK;AAAA;AAAA,EAEjB;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAC7E,SAAK,KAAK;AAAA,EACZ;AACF;AAEA,eAAe,OAAO,mBAAmB,cAAc;","names":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
say,
|
|
6
6
|
space,
|
|
7
7
|
t
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
9
9
|
|
|
10
10
|
// packages/ui/src/components/alert.ts
|
|
11
11
|
import { html, css, nothing } from "lit";
|
|
@@ -105,4 +105,4 @@ customElements.define("impakt-alert", ImpaktAlert);
|
|
|
105
105
|
export {
|
|
106
106
|
ImpaktAlert
|
|
107
107
|
};
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-AYKYHZGQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/alert.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out — at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpaktAlert extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || say(ImpaktAlert.TONE_WORDS[this.tone]);\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${this.heading\n
|
|
1
|
+
{"version":3,"sources":["../src/components/alert.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out — at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpaktAlert extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || say(ImpaktAlert.TONE_WORDS[this.tone]);\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${\n this.heading\n ? html`<div class=\"heading\" part=\"heading\">\n <span class=\"tone-word\">${word}:</span> ${this.heading}\n </div>`\n : nothing\n }\n <slot></slot>\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-alert', ImpaktAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-alert': ImpaktAlert;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAyBjD,IAAM,cAAN,MAAM,qBAAoB,cAAc;AAAA,EAC7C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,IACrD;AAAA;AAAA,EAOA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA;AAAA,SAAwB,aAAwC;AAAA,MAC9D,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA;AAAA;AAAA,4BAGwB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,mBAGjB,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,yBACd,EAAE,QAAQ;AAAA;AAAA,sCAEG,EAAE,QAAQ;AAAA,qBAC3B,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA,uBAIZ,WAAW,UAAU,CAAC;AAAA,4BACjB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,sBAGd,EAAE,UAAU;AAAA,wBACV,EAAE,IAAI;AAAA,iBACb,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,aAAa;AAAA,wBACb,EAAE,OAAO;AAAA,iBAChB,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,aAAa;AAAA,wBACb,EAAE,OAAO;AAAA,iBAChB,EAAE,IAAI;AAAA;AAAA;AAAA,sBAGD,EAAE,YAAY;AAAA,wBACZ,EAAE,MAAM;AAAA,iBACf,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYrB;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,OAAO,KAAK,aAAa,IAAI,aAAY,WAAW,KAAK,IAAI,CAAC;AACpE,WAAO;AAAA;AAAA;AAAA;AAAA,eAII,KAAK,SAAS,WAAW,UAAU,QAAQ;AAAA,qBACrC,KAAK,UAAU,UAAU,IAAI;AAAA;AAAA,UAGxC,KAAK,UACD;AAAA,wCAC0B,IAAI,YAAY,KAAK,OAAO;AAAA,sBAEtD,OACN;AAAA;AAAA;AAAA;AAAA,EAIN;AACF;AAEA,eAAe,OAAO,gBAAgB,WAAW;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
FieldElement,
|
|
6
6
|
fieldWidths
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ONED3PUB.js";
|
|
8
8
|
import {
|
|
9
9
|
ImpaktElement,
|
|
10
10
|
focusRing,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
touchTarget,
|
|
19
19
|
type,
|
|
20
20
|
visuallyHidden
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-V7EB7Q2M.js";
|
|
22
22
|
|
|
23
23
|
// packages/ui/src/components/journey.ts
|
|
24
24
|
import { css, html, nothing } from "lit";
|
|
@@ -82,7 +82,11 @@ var ImpaktAddressLookup = class extends FieldElement {
|
|
|
82
82
|
this.busy = false;
|
|
83
83
|
}
|
|
84
84
|
static {
|
|
85
|
-
this.styles = [
|
|
85
|
+
this.styles = [
|
|
86
|
+
...FieldElement.styles,
|
|
87
|
+
fieldWidths,
|
|
88
|
+
inputStyles,
|
|
89
|
+
css`
|
|
86
90
|
.row { display: flex; flex-wrap: wrap; gap: ${space(2)}; align-items: flex-end; }
|
|
87
91
|
.row label { display: block; ${type("sm")} font-weight: ${fontWeight("semibold")}; margin-block-end: ${space(1)}; }
|
|
88
92
|
.postcode input { inline-size: 12ch; text-transform: uppercase; }
|
|
@@ -93,7 +97,8 @@ var ImpaktAddressLookup = class extends FieldElement {
|
|
|
93
97
|
.manual input { inline-size: 100%; }
|
|
94
98
|
.note { ${type("sm")} color: ${t.textMuted}; margin: ${space(2)} 0 0; }
|
|
95
99
|
.switch { margin-block-start: ${space(3)}; }
|
|
96
|
-
`
|
|
100
|
+
`
|
|
101
|
+
];
|
|
97
102
|
}
|
|
98
103
|
async find() {
|
|
99
104
|
const postcode = this.postcode.trim().toUpperCase();
|
|
@@ -179,14 +184,20 @@ var ImpaktErrorSummary = class extends ImpaktElement {
|
|
|
179
184
|
this.spaceBelow = "md";
|
|
180
185
|
}
|
|
181
186
|
static {
|
|
182
|
-
this.styles = [
|
|
187
|
+
this.styles = [
|
|
188
|
+
...ImpaktElement.styles,
|
|
189
|
+
focusRing,
|
|
190
|
+
spaceAround,
|
|
191
|
+
touchTarget("a"),
|
|
192
|
+
css`
|
|
183
193
|
:host { display: block; }
|
|
184
194
|
.box { padding: ${space(5)}; border: ${t.borderThick} solid ${t.danger}; border-inline-start-width: 6px; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }
|
|
185
195
|
.box:focus { outline: 3px solid ${t.danger}; outline-offset: 2px; }
|
|
186
196
|
h2 { margin: 0 0 ${space(3)}; ${type("lg")} font-weight: ${fontWeight("bold")}; color: ${t.text}; }
|
|
187
197
|
ul { margin: 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }
|
|
188
198
|
a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.dangerText}; font-weight: ${fontWeight("semibold")}; text-underline-offset: 0.2em; }
|
|
189
|
-
`
|
|
199
|
+
`
|
|
200
|
+
];
|
|
190
201
|
}
|
|
191
202
|
go(event, href) {
|
|
192
203
|
const id = href.replace(/^#/, "");
|
|
@@ -234,7 +245,12 @@ var ImpaktFileUpload = class extends FieldElement {
|
|
|
234
245
|
this.said = "";
|
|
235
246
|
}
|
|
236
247
|
static {
|
|
237
|
-
this.styles = [
|
|
248
|
+
this.styles = [
|
|
249
|
+
...FieldElement.styles,
|
|
250
|
+
inputStyles,
|
|
251
|
+
targetSize,
|
|
252
|
+
touchTarget("label.btn, .quiet"),
|
|
253
|
+
css`
|
|
238
254
|
.zone { display: flex; flex-wrap: wrap; align-items: center; gap: ${space(3)}; padding: ${space(5)}; border: 2px dashed ${t.border}; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }
|
|
239
255
|
.zone.over { border-color: ${t.brand}; background: ${t.brandSubtle}; }
|
|
240
256
|
:host([invalid]) .zone { border-color: ${t.danger}; border-style: solid; }
|
|
@@ -246,12 +262,15 @@ var ImpaktFileUpload = class extends FieldElement {
|
|
|
246
262
|
ul { margin: ${space(3)} 0 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }
|
|
247
263
|
li { display: flex; justify-content: space-between; gap: ${space(3)}; align-items: center; padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: ${t.surfaceInset}; }
|
|
248
264
|
.size { color: ${t.textMuted}; ${type("sm")} }
|
|
249
|
-
`
|
|
265
|
+
`
|
|
266
|
+
];
|
|
250
267
|
}
|
|
251
268
|
fits(file) {
|
|
252
269
|
if (this.maxSizeMb && file.size > this.maxSizeMb * 1048576) return say("{file} is bigger than {size} MB", { file: file.name, size: this.maxSizeMb });
|
|
253
270
|
const kinds = this.accept.split(",").map((k) => k.trim().toLowerCase()).filter(Boolean);
|
|
254
|
-
if (kinds.length && !kinds.some(
|
|
271
|
+
if (kinds.length && !kinds.some(
|
|
272
|
+
(k) => k.startsWith(".") ? file.name.toLowerCase().endsWith(k) : file.type === k || k.endsWith("/*") && file.type.startsWith(k.slice(0, -1))
|
|
273
|
+
)) {
|
|
255
274
|
return say("{file} must be {kinds}", { file: file.name, kinds: kinds.map((k) => k.replace(".", "").toUpperCase()).join(", ") });
|
|
256
275
|
}
|
|
257
276
|
return null;
|
|
@@ -344,11 +363,16 @@ var ImpaktMoneyInput = class extends FieldElement {
|
|
|
344
363
|
this.shown = "";
|
|
345
364
|
}
|
|
346
365
|
static {
|
|
347
|
-
this.styles = [
|
|
366
|
+
this.styles = [
|
|
367
|
+
...FieldElement.styles,
|
|
368
|
+
fieldWidths,
|
|
369
|
+
inputStyles,
|
|
370
|
+
css`
|
|
348
371
|
.wrap { display: flex; align-items: stretch; inline-size: min(100%, var(--impakt-field-width)); }
|
|
349
372
|
.sign { display: flex; align-items: center; padding: 0 ${space(3)}; font-weight: ${fontWeight("semibold")}; background: ${t.surfaceInset}; border: ${t.borderThin} solid ${t.border}; border-inline-end: 0; border-radius: ${t.radiusLg} 0 0 ${t.radiusLg}; }
|
|
350
373
|
.wrap input { inline-size: 100%; border-radius: 0 ${t.radiusLg} ${t.radiusLg} 0; }
|
|
351
|
-
`
|
|
374
|
+
`
|
|
375
|
+
];
|
|
352
376
|
}
|
|
353
377
|
willUpdate(changed) {
|
|
354
378
|
if (changed.has("value") && this.value !== this.shown.replace(/,/g, "")) this.shown = groupDigits(this.value);
|
|
@@ -366,7 +390,8 @@ var ImpaktMoneyInput = class extends FieldElement {
|
|
|
366
390
|
const money = (x) => `${symbolOf(this.currency)}${x.toLocaleString("en-GB")}`;
|
|
367
391
|
if (this.lowest !== void 0 && n < this.lowest) this.error = say("Enter an amount of {amount} or more", { amount: money(this.lowest) });
|
|
368
392
|
else if (this.highest !== void 0 && n > this.highest) this.error = say("Enter an amount of {amount} or less", { amount: money(this.highest) });
|
|
369
|
-
else if (this.error === say("Enter an amount of {amount} or more", { amount: money(this.lowest ?? 0) }) || this.error === say("Enter an amount of {amount} or less", { amount: money(this.highest ?? 0) }))
|
|
393
|
+
else if (this.error === say("Enter an amount of {amount} or more", { amount: money(this.lowest ?? 0) }) || this.error === say("Enter an amount of {amount} or less", { amount: money(this.highest ?? 0) }))
|
|
394
|
+
this.error = "";
|
|
370
395
|
}
|
|
371
396
|
/** The currency sign describes the field too, so a screen reader hears that the amount is in pounds. */
|
|
372
397
|
get describedBy() {
|
|
@@ -407,12 +432,15 @@ var ImpaktRangeInput = class extends FieldElement {
|
|
|
407
432
|
this.value = "50";
|
|
408
433
|
}
|
|
409
434
|
static {
|
|
410
|
-
this.styles = [
|
|
435
|
+
this.styles = [
|
|
436
|
+
...FieldElement.styles,
|
|
437
|
+
css`
|
|
411
438
|
.top { display: flex; justify-content: space-between; gap: ${space(3)}; }
|
|
412
439
|
output { font-weight: ${fontWeight("semibold")}; color: ${t.text}; }
|
|
413
440
|
input { inline-size: 100%; min-block-size: 32px; margin: 0; accent-color: ${t.brand}; }
|
|
414
441
|
.ends { display: flex; justify-content: space-between; ${type("sm")} color: ${t.textMuted}; }
|
|
415
|
-
`
|
|
442
|
+
`
|
|
443
|
+
];
|
|
416
444
|
}
|
|
417
445
|
/** The value as the customer reads it, such as £25,000 or 25 years. */
|
|
418
446
|
shownAs(n) {
|
|
@@ -468,7 +496,12 @@ var ImpaktTaskList = class extends ImpaktElement {
|
|
|
468
496
|
this.spaceBelow = "none";
|
|
469
497
|
}
|
|
470
498
|
static {
|
|
471
|
-
this.styles = [
|
|
499
|
+
this.styles = [
|
|
500
|
+
...ImpaktElement.styles,
|
|
501
|
+
focusRing,
|
|
502
|
+
spaceAround,
|
|
503
|
+
touchTarget("a"),
|
|
504
|
+
css`
|
|
472
505
|
:host { display: block; }
|
|
473
506
|
.h { margin: 0 0 ${space(2)}; ${type("xl")} font-weight: ${fontWeight("bold")}; color: ${t.textHeading}; }
|
|
474
507
|
.count { margin: 0 0 ${space(4)}; color: ${t.textMuted}; }
|
|
@@ -481,18 +514,21 @@ var ImpaktTaskList = class extends ImpaktElement {
|
|
|
481
514
|
.tag[data-status='done'] { background: ${t.successSubtle}; color: ${t.successText}; }
|
|
482
515
|
.tag[data-status='in-progress'] { background: ${t.brandSubtle}; color: ${t.link}; }
|
|
483
516
|
.tag[data-status='cannot-start'] { background: transparent; color: ${t.textMuted}; }
|
|
484
|
-
`
|
|
517
|
+
`
|
|
518
|
+
];
|
|
485
519
|
}
|
|
486
520
|
render() {
|
|
487
521
|
const done = this.items.filter((i) => i.status === "done").length;
|
|
488
522
|
return html`
|
|
489
523
|
${this.heading ? html`<div class="h" role="heading" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}
|
|
490
524
|
${this.items.length ? html`<p class="count">${say(this.items.length === 1 ? "You have completed {done} of {total} part." : "You have completed {done} of {total} parts.", { done, total: this.items.length })}</p>` : nothing}
|
|
491
|
-
<ul>${this.items.map(
|
|
525
|
+
<ul>${this.items.map(
|
|
526
|
+
(i) => html`<li>
|
|
492
527
|
<span>${i.href && i.status !== "cannot-start" ? html`<a href=${i.href} aria-describedby=${this.id_(`s-${i.id}`)}>${i.title}</a>` : html`<span class="title">${i.title}</span>`}
|
|
493
528
|
${i.hint ? html`<span class="hint">${i.hint}</span>` : nothing}</span>
|
|
494
529
|
<span class="tag" data-status=${i.status} id=${this.id_(`s-${i.id}`)}>${TASK_WORDS[i.status] ? say(TASK_WORDS[i.status]) : i.status}</span>
|
|
495
|
-
</li>`
|
|
530
|
+
</li>`
|
|
531
|
+
)}</ul>`;
|
|
496
532
|
}
|
|
497
533
|
};
|
|
498
534
|
ImpaktAddressLookup.createProperty("manual", { state: true });
|
|
@@ -519,4 +555,4 @@ export {
|
|
|
519
555
|
ImpaktRangeInput,
|
|
520
556
|
ImpaktTaskList
|
|
521
557
|
};
|
|
522
|
-
//# sourceMappingURL=chunk-
|
|
558
|
+
//# sourceMappingURL=chunk-D3JWVMJE.js.map
|