@atomic-ui/ui 0.10.0 → 0.12.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/custom-elements.json +9839 -6255
- package/dist/base/FieldElement.d.ts +10 -3
- package/dist/{chunk-YWP2Z3JN.js → chunk-2TNF7O43.js} +7 -5
- package/dist/{chunk-YWP2Z3JN.js.map → chunk-2TNF7O43.js.map} +1 -1
- package/dist/{chunk-FKUBEVCU.js → chunk-2WHOBIOY.js} +11 -9
- package/dist/{chunk-FKUBEVCU.js.map → chunk-2WHOBIOY.js.map} +1 -1
- package/dist/{chunk-26BO3W56.js → chunk-3BWCD5U5.js} +5 -3
- package/dist/{chunk-26BO3W56.js.map → chunk-3BWCD5U5.js.map} +1 -1
- package/dist/chunk-3GPGDERO.js +201 -0
- package/dist/chunk-3GPGDERO.js.map +1 -0
- package/dist/{chunk-3T7J66Z2.js → chunk-3KAFK24X.js} +13 -11
- package/dist/chunk-3KAFK24X.js.map +1 -0
- package/dist/{chunk-5OJAJA3U.js → chunk-5HCWL2YD.js} +6 -4
- package/dist/{chunk-5OJAJA3U.js.map → chunk-5HCWL2YD.js.map} +1 -1
- package/dist/{chunk-AG4EP3OY.js → chunk-5IGBH4GL.js} +8 -6
- package/dist/{chunk-AG4EP3OY.js.map → chunk-5IGBH4GL.js.map} +1 -1
- package/dist/{chunk-AL4IUSML.js → chunk-5OYQZWP2.js} +5 -3
- package/dist/{chunk-AL4IUSML.js.map → chunk-5OYQZWP2.js.map} +1 -1
- package/dist/chunk-5PRB7P7N.js +167 -0
- package/dist/chunk-5PRB7P7N.js.map +1 -0
- package/dist/chunk-6CDQSHVW.js +21 -0
- package/dist/chunk-6CDQSHVW.js.map +1 -0
- package/dist/{chunk-MLKNZL5J.js → chunk-6J22I7F6.js} +14 -12
- package/dist/chunk-6J22I7F6.js.map +1 -0
- package/dist/chunk-72WNCCDC.js +136 -0
- package/dist/chunk-72WNCCDC.js.map +1 -0
- package/dist/chunk-7UI3OBXL.js +104 -0
- package/dist/chunk-7UI3OBXL.js.map +1 -0
- package/dist/{chunk-D6NET2VB.js → chunk-ALFE35FS.js} +30 -3
- package/dist/chunk-ALFE35FS.js.map +1 -0
- package/dist/chunk-AYINRYNC.js +184 -0
- package/dist/chunk-AYINRYNC.js.map +1 -0
- package/dist/{chunk-2D2IMQII.js → chunk-BAITBJUC.js} +51 -29
- package/dist/chunk-BAITBJUC.js.map +1 -0
- package/dist/{chunk-2EP3IV3G.js → chunk-BGHAANTP.js} +22 -8
- package/dist/chunk-BGHAANTP.js.map +1 -0
- package/dist/{chunk-OJO62KRX.js → chunk-CFCFKLTN.js} +85 -10
- package/dist/chunk-CFCFKLTN.js.map +1 -0
- package/dist/{chunk-UFPI4I2Y.js → chunk-CQT3VPYK.js} +8 -29
- package/dist/chunk-CQT3VPYK.js.map +1 -0
- package/dist/{chunk-AURT72IC.js → chunk-DXLEYNID.js} +13 -7
- package/dist/chunk-DXLEYNID.js.map +1 -0
- package/dist/{chunk-L4CIBOGK.js → chunk-EKPTMRBG.js} +5 -3
- package/dist/{chunk-L4CIBOGK.js.map → chunk-EKPTMRBG.js.map} +1 -1
- package/dist/{chunk-7UWJXPR3.js → chunk-F3NHPQU5.js} +17 -36
- package/dist/chunk-F3NHPQU5.js.map +1 -0
- package/dist/{chunk-Z2EWQMTR.js → chunk-F4IXELLK.js} +5 -3
- package/dist/{chunk-Z2EWQMTR.js.map → chunk-F4IXELLK.js.map} +1 -1
- package/dist/{chunk-APQEXM4I.js → chunk-FJHPGOGS.js} +5 -3
- package/dist/{chunk-APQEXM4I.js.map → chunk-FJHPGOGS.js.map} +1 -1
- package/dist/chunk-FLAUZU7Y.js +345 -0
- package/dist/chunk-FLAUZU7Y.js.map +1 -0
- package/dist/{chunk-3NEWOO2P.js → chunk-FZWUQC42.js} +7 -5
- package/dist/{chunk-3NEWOO2P.js.map → chunk-FZWUQC42.js.map} +1 -1
- package/dist/{chunk-ONED3PUB.js → chunk-HSXLSJVG.js} +54 -8
- package/dist/chunk-HSXLSJVG.js.map +1 -0
- package/dist/{chunk-V7EB7Q2M.js → chunk-JTCTQBAX.js} +2 -131
- package/dist/chunk-JTCTQBAX.js.map +1 -0
- package/dist/{chunk-ZL3JFUIE.js → chunk-K5QFVLCI.js} +7 -5
- package/dist/{chunk-ZL3JFUIE.js.map → chunk-K5QFVLCI.js.map} +1 -1
- package/dist/{chunk-DN5YZFSG.js → chunk-KE6WCXQP.js} +55 -9
- package/dist/chunk-KE6WCXQP.js.map +1 -0
- package/dist/chunk-LBHTXY7K.js +75 -0
- package/dist/chunk-LBHTXY7K.js.map +1 -0
- package/dist/{chunk-OZGKK3N5.js → chunk-LP4RTYTL.js} +88 -9
- package/dist/chunk-LP4RTYTL.js.map +1 -0
- package/dist/{chunk-MOO63SHZ.js → chunk-LXVPWTSY.js} +80 -23
- package/dist/chunk-LXVPWTSY.js.map +1 -0
- package/dist/{chunk-JNLKM3JT.js → chunk-N6EEW2GF.js} +6 -4
- package/dist/{chunk-JNLKM3JT.js.map → chunk-N6EEW2GF.js.map} +1 -1
- package/dist/chunk-NHEU5FT6.js +115 -0
- package/dist/chunk-NHEU5FT6.js.map +1 -0
- package/dist/chunk-P3BPW446.js +294 -0
- package/dist/chunk-P3BPW446.js.map +1 -0
- package/dist/chunk-QPOM7W3D.js +104 -0
- package/dist/chunk-QPOM7W3D.js.map +1 -0
- package/dist/{chunk-FU3CEHBS.js → chunk-R6PBY3YN.js} +6 -4
- package/dist/{chunk-FU3CEHBS.js.map → chunk-R6PBY3YN.js.map} +1 -1
- package/dist/{chunk-TJOYBDKS.js → chunk-R6YMSJR7.js} +65 -36
- package/dist/chunk-R6YMSJR7.js.map +1 -0
- package/dist/{chunk-ZEIV5X3U.js → chunk-SOYKSPPX.js} +73 -23
- package/dist/chunk-SOYKSPPX.js.map +1 -0
- package/dist/{chunk-NKMJMVZP.js → chunk-T52CUOCJ.js} +5 -3
- package/dist/{chunk-NKMJMVZP.js.map → chunk-T52CUOCJ.js.map} +1 -1
- package/dist/chunk-UFENSIWD.js +135 -0
- package/dist/chunk-UFENSIWD.js.map +1 -0
- package/dist/{chunk-A4M3A4SZ.js → chunk-UYTIJCCW.js} +10 -42
- package/dist/chunk-UYTIJCCW.js.map +1 -0
- package/dist/chunk-XX6JZW5N.js +36 -0
- package/dist/chunk-XX6JZW5N.js.map +1 -0
- package/dist/{chunk-2ZF3J7OO.js → chunk-XXSZL5CY.js} +17 -5
- package/dist/chunk-XXSZL5CY.js.map +1 -0
- package/dist/{chunk-6PMA6NHE.js → chunk-Y55FNQHS.js} +5 -3
- package/dist/{chunk-6PMA6NHE.js.map → chunk-Y55FNQHS.js.map} +1 -1
- package/dist/chunk-ZAWGJC4I.js +176 -0
- package/dist/chunk-ZAWGJC4I.js.map +1 -0
- package/dist/chunk-ZUQ3DOG2.js +110 -0
- package/dist/chunk-ZUQ3DOG2.js.map +1 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +6 -2
- package/dist/components/alert.d.ts +22 -1
- package/dist/components/alert.js +3 -2
- package/dist/components/app-bar.d.ts +153 -0
- package/dist/components/app-bar.js +15 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-ui.d.ts +29 -2
- package/dist/components/app-ui.js +5 -4
- package/dist/components/badge.d.ts +17 -1
- package/dist/components/badge.js +4 -3
- package/dist/components/blocks.js +5 -4
- package/dist/components/button.d.ts +18 -2
- package/dist/components/button.js +4 -3
- package/dist/components/checkbox-group.js +4 -3
- package/dist/components/checkbox.js +4 -3
- package/dist/components/checked.d.ts +77 -0
- package/dist/components/checked.js +10 -0
- package/dist/components/checked.js.map +1 -0
- package/dist/components/chip-group.d.ts +113 -0
- package/dist/components/chip-group.js +11 -0
- package/dist/components/chip-group.js.map +1 -0
- package/dist/components/chip.d.ts +11 -0
- package/dist/components/chip.js +3 -2
- package/dist/components/code-diff.d.ts +77 -0
- package/dist/components/code-diff.js +10 -0
- package/dist/components/code-diff.js.map +1 -0
- package/dist/components/date-input.js +4 -3
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.js +3 -2
- package/dist/components/fieldset.js +3 -2
- package/dist/components/grid.js +3 -2
- package/dist/components/help.js +3 -2
- package/dist/components/icon.js +3 -2
- package/dist/components/journey.js +4 -3
- package/dist/components/language-switch.d.ts +59 -0
- package/dist/components/language-switch.js +10 -0
- package/dist/components/language-switch.js.map +1 -0
- package/dist/components/layout.d.ts +8 -2
- package/dist/components/layout.js +3 -2
- package/dist/components/link.js +4 -3
- package/dist/components/list.js +3 -2
- package/dist/components/media.js +3 -2
- package/dist/components/meter.d.ts +112 -0
- package/dist/components/meter.js +13 -0
- package/dist/components/meter.js.map +1 -0
- package/dist/components/navigation.d.ts +52 -0
- package/dist/components/navigation.js +4 -3
- package/dist/components/page.d.ts +13 -8
- package/dist/components/page.js +3 -2
- package/dist/components/price.js +3 -2
- package/dist/components/progress.d.ts +16 -2
- package/dist/components/progress.js +3 -2
- package/dist/components/radio-group.js +4 -3
- package/dist/components/redaction.d.ts +51 -0
- package/dist/components/redaction.js +10 -0
- package/dist/components/redaction.js.map +1 -0
- package/dist/components/rows.d.ts +28 -0
- package/dist/components/rows.js +7 -3
- package/dist/components/select.js +4 -3
- package/dist/components/shell.js +4 -3
- package/dist/components/source.d.ts +68 -0
- package/dist/components/source.js +10 -0
- package/dist/components/source.js.map +1 -0
- package/dist/components/status-pill-style.d.ts +16 -0
- package/dist/components/status-pill-style.js +15 -0
- package/dist/components/status-pill-style.js.map +1 -0
- package/dist/components/status.d.ts +66 -0
- package/dist/components/status.js +10 -0
- package/dist/components/status.js.map +1 -0
- package/dist/components/summary-list.js +3 -2
- package/dist/components/switch.js +4 -3
- package/dist/components/table.d.ts +19 -0
- package/dist/components/table.js +4 -3
- package/dist/components/text-input.js +5 -4
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.js +4 -3
- package/dist/components/tool-card.d.ts +107 -0
- package/dist/components/tool-card.js +11 -0
- package/dist/components/tool-card.js.map +1 -0
- package/dist/components/tool-kit-tokens.d.ts +25 -0
- package/dist/components/tool-kit-tokens.js +8 -0
- package/dist/components/tool-kit-tokens.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +116 -70
- package/dist/standalone/atomic-ui.js +2047 -733
- package/dist/standalone/atomic-ui.js.map +4 -4
- package/package.json +2 -2
- package/dist/chunk-2D2IMQII.js.map +0 -1
- package/dist/chunk-2EP3IV3G.js.map +0 -1
- package/dist/chunk-2ZF3J7OO.js.map +0 -1
- package/dist/chunk-3T7J66Z2.js.map +0 -1
- package/dist/chunk-7UWJXPR3.js.map +0 -1
- package/dist/chunk-A4M3A4SZ.js.map +0 -1
- package/dist/chunk-AURT72IC.js.map +0 -1
- package/dist/chunk-AYKYHZGQ.js +0 -108
- package/dist/chunk-AYKYHZGQ.js.map +0 -1
- package/dist/chunk-D6NET2VB.js.map +0 -1
- package/dist/chunk-DN5YZFSG.js.map +0 -1
- package/dist/chunk-MLKNZL5J.js.map +0 -1
- package/dist/chunk-MOO63SHZ.js.map +0 -1
- package/dist/chunk-OJO62KRX.js.map +0 -1
- package/dist/chunk-ONED3PUB.js.map +0 -1
- package/dist/chunk-OZGKK3N5.js.map +0 -1
- package/dist/chunk-QU3U2CS2.js +0 -144
- package/dist/chunk-QU3U2CS2.js.map +0 -1
- package/dist/chunk-TJOYBDKS.js.map +0 -1
- package/dist/chunk-UFPI4I2Y.js.map +0 -1
- package/dist/chunk-V7EB7Q2M.js.map +0 -1
- package/dist/chunk-ZEIV5X3U.js.map +0 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktElement,
|
|
3
|
+
hideOn
|
|
4
|
+
} from "./chunk-72WNCCDC.js";
|
|
5
|
+
import {
|
|
3
6
|
fontSize,
|
|
4
|
-
|
|
7
|
+
fontWeight,
|
|
5
8
|
space,
|
|
6
|
-
t
|
|
7
|
-
|
|
9
|
+
t,
|
|
10
|
+
token
|
|
11
|
+
} from "./chunk-JTCTQBAX.js";
|
|
8
12
|
|
|
9
13
|
// packages/ui/src/components/chip.ts
|
|
10
14
|
import { css, html, nothing } from "lit";
|
|
@@ -35,6 +39,7 @@ var ImpaktChip = class extends ImpaktElement {
|
|
|
35
39
|
icon: { type: String, reflect: true },
|
|
36
40
|
tone: { type: String },
|
|
37
41
|
look: { type: String, reflect: true },
|
|
42
|
+
size: { type: String, reflect: true },
|
|
38
43
|
hideOn: { type: String, reflect: true, attribute: "hide-on" }
|
|
39
44
|
};
|
|
40
45
|
}
|
|
@@ -45,6 +50,7 @@ var ImpaktChip = class extends ImpaktElement {
|
|
|
45
50
|
this.icon = "none";
|
|
46
51
|
this.tone = "success";
|
|
47
52
|
this.look = "filled";
|
|
53
|
+
this.size = "md";
|
|
48
54
|
this.hideOn = "never";
|
|
49
55
|
}
|
|
50
56
|
static {
|
|
@@ -53,11 +59,19 @@ var ImpaktChip = class extends ImpaktElement {
|
|
|
53
59
|
hideOn,
|
|
54
60
|
css`
|
|
55
61
|
:host { display: inline-flex; flex: none; }
|
|
56
|
-
span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius:
|
|
62
|
+
span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-family: ${MONO}; font-size: ${fontSize("xs")}; line-height: 1.2; white-space: nowrap; }
|
|
57
63
|
:host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }
|
|
58
|
-
:host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.
|
|
64
|
+
:host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.text}; background: ${t.surfaceCard}; }
|
|
65
|
+
:host([size='marketing']) span.chip { font-size: 11px; font-weight: ${fontWeight("medium")}; text-transform: uppercase; letter-spacing: 0.06em; }
|
|
66
|
+
/* Body: a 35px square box in the body face, for a row of tags such as a stack (G2 case study, 21:1493). */
|
|
67
|
+
:host([size='body']) span.chip { box-sizing: border-box; min-block-size: 35px; padding: ${space(1.5)} ${space(3)}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radius}; font-family: ${t.fontBody}; font-size: 14px; line-height: 1.2; }
|
|
68
|
+
:host([size='lg']) span.chip { box-sizing: border-box; min-block-size: 49px; gap: ${space(3)}; padding: ${space(2)} ${space(4)}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radius}; font-family: ${t.fontBody}; font-size: 20px; line-height: 1.2; }
|
|
69
|
+
:host([size='lg']) .meta { font-family: ${MONO}; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 1; color: ${t.textMuted}; }
|
|
59
70
|
:host([look='plain']) span.chip { padding: 0; }
|
|
60
|
-
.dot { inline-size:
|
|
71
|
+
.dot { flex: none; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--tone); }
|
|
72
|
+
/* Yellow means "needs your attention": the accent, with an ink stroke so it shows on white. */
|
|
73
|
+
.dot.warn { background: ${token("color.accent.default", "#ffd43b")}; box-shadow: 0 0 0 1px ${t.text}; }
|
|
74
|
+
@media (forced-colors: active) { .dot, .dot.warn { background: CanvasText; } }
|
|
61
75
|
svg { inline-size: 12px; block-size: 12px; }
|
|
62
76
|
.meta { opacity: 0.72; text-transform: none; }
|
|
63
77
|
:host([look='plain']) .label { opacity: 0.72; }
|
|
@@ -65,7 +79,7 @@ var ImpaktChip = class extends ImpaktElement {
|
|
|
65
79
|
];
|
|
66
80
|
}
|
|
67
81
|
render() {
|
|
68
|
-
const icon = this.icon === "dot" ? html`<span class="dot" aria-hidden="true"></span>` : this.icon === "branch" ? html`<svg viewBox="0 0 14 14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="3.5" cy="3" r="1.5"/><circle cx="3.5" cy="11" r="1.5"/><circle cx="10.5" cy="4.5" r="1.5"/><path d="M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4"/></svg>` : nothing;
|
|
82
|
+
const icon = this.icon === "dot" ? html`<span class="dot ${this.tone === "warning" ? "warn" : ""}" aria-hidden="true"></span>` : this.icon === "branch" ? html`<svg viewBox="0 0 14 14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="3.5" cy="3" r="1.5"/><circle cx="3.5" cy="11" r="1.5"/><circle cx="10.5" cy="4.5" r="1.5"/><path d="M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4"/></svg>` : nothing;
|
|
69
83
|
return html`<span class="chip" part="chip" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class="label">${this.label}</span>${this.meta ? html` <span class="meta">${this.meta}</span>` : nothing}</span>`;
|
|
70
84
|
}
|
|
71
85
|
};
|
|
@@ -77,4 +91,4 @@ export {
|
|
|
77
91
|
toneOf,
|
|
78
92
|
ImpaktChip
|
|
79
93
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-BGHAANTP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chip.ts","../src/base/tone.ts"],"sourcesContent":["/**\n * A short label: a branch, a status with its dot, or a code such as a commit\n * hash.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { hideOn } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { toneOf, type Tone } from '../base/tone';\n\n/** Code-like labels: a branch, a hash, a commit message. */\nconst MONO = t.fontMono;\n\n/**\n * A short label: a branch name with its icon, a status with its dot, or a\n * code such as a commit hash. It says something; it does nothing.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n meta: { type: String },\n icon: { type: String, reflect: true },\n tone: { type: String },\n look: { type: String, reflect: true },\n size: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n declare label: string;\n /** A code after the label, quieter, such as a hash. */\n declare meta: string;\n /** A coloured dot, a branch, or nothing before the label. */\n declare icon: 'none' | 'dot' | 'branch';\n /** The dot's colour: a named tone, or 1 to 5 for the brand's chart colours. */\n declare tone: Tone;\n /** `outlined` on the card colour, `filled` with a faint wash, or `plain` words in the code face. */\n declare look: 'outlined' | 'filled' | 'plain';\n /**\n * `md` is the chip in a line of text. `marketing` sets the words in\n * capitals at 11px with 6% tracking, as the site's labels are. `lg` is a\n * studio tool tag: a square 49px box with an ink border, the label in\n * Archivo at 20px and the meta in capitals in the code face (frame 21:1152).\n */\n declare size: 'md' | 'marketing' | 'body' | 'lg';\n declare hideOn: 'never' | 'phone' | 'wide';\n\n constructor() {\n super();\n this.label = '';\n this.meta = '';\n this.icon = 'none';\n this.tone = 'success';\n this.look = 'filled';\n this.size = 'md';\n this.hideOn = 'never';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n hideOn,\n css`\n :host { display: inline-flex; flex: none; }\n span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-family: ${MONO}; font-size: ${fontSize('xs')}; line-height: 1.2; white-space: nowrap; }\n :host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }\n :host([look='outlined']) span.chip { border: ${t.borderThin} solid ${t.text}; background: ${t.surfaceCard}; }\n :host([size='marketing']) span.chip { font-size: 11px; font-weight: ${fontWeight('medium')}; text-transform: uppercase; letter-spacing: 0.06em; }\n /* Body: a 35px square box in the body face, for a row of tags such as a stack (G2 case study, 21:1493). */\n :host([size='body']) span.chip { box-sizing: border-box; min-block-size: 35px; padding: ${space(1.5)} ${space(3)}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radius}; font-family: ${t.fontBody}; font-size: 14px; line-height: 1.2; }\n :host([size='lg']) span.chip { box-sizing: border-box; min-block-size: 49px; gap: ${space(3)}; padding: ${space(2)} ${space(4)}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radius}; font-family: ${t.fontBody}; font-size: 20px; line-height: 1.2; }\n :host([size='lg']) .meta { font-family: ${MONO}; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 1; color: ${t.textMuted}; }\n :host([look='plain']) span.chip { padding: 0; }\n .dot { flex: none; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--tone); }\n /* Yellow means \"needs your attention\": the accent, with an ink stroke so it shows on white. */\n .dot.warn { background: ${token('color.accent.default', '#ffd43b')}; box-shadow: 0 0 0 1px ${t.text}; }\n @media (forced-colors: active) { .dot, .dot.warn { background: CanvasText; } }\n svg { inline-size: 12px; block-size: 12px; }\n .meta { opacity: 0.72; text-transform: none; }\n :host([look='plain']) .label { opacity: 0.72; }\n `,\n ];\n\n render(): TemplateResult {\n const icon =\n this.icon === 'dot'\n ? html`<span class=\"dot ${this.tone === 'warning' ? 'warn' : ''}\" aria-hidden=\"true\"></span>`\n : this.icon === 'branch'\n ? html`<svg viewBox=\"0 0 14 14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><circle cx=\"3.5\" cy=\"3\" r=\"1.5\"/><circle cx=\"3.5\" cy=\"11\" r=\"1.5\"/><circle cx=\"10.5\" cy=\"4.5\" r=\"1.5\"/><path d=\"M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4\"/></svg>`\n : nothing;\n return html`<span class=\"chip\" part=\"chip\" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class=\"label\">${this.label}</span>${this.meta ? html` <span class=\"meta\">${this.meta}</span>` : nothing}</span>`;\n }\n}\n\ncustomElements.define('impakt-chip', ImpaktChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-chip': ImpaktChip;\n }\n}\n","/**\n * Colours named by what they are in the brand, for a line, a lane, a dot or a\n * stripe. A tone is a brand token, never a hex value, so a partner's brand\n * restyles everything drawn with one.\n *\n * It is shared: `impakt-chip` here and the changelog, site and estimator blocks\n * in `@atomic-ui/blocks` all colour themselves with it.\n */\n\n/** A colour for a line or a lane, named by what it is in the brand. */\nexport type NamedTone = 'brand' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\n/** A named tone, or 1 to 5 for the brand's chart colours in order. */\nexport type Tone = NamedTone | 1 | 2 | 3 | 4 | 5;\nexport const TONE: Record<NamedTone, string> = {\n brand: 'var(--impakt-color-brand-default, #1f4ed8)',\n accent: 'var(--impakt-color-accent-default, #c8a15a)',\n info: 'var(--impakt-color-status-info-default, #1f4ed8)',\n success: 'var(--impakt-color-status-success-default, #047857)',\n warning: 'var(--impakt-color-status-warning-default, #b45309)',\n danger: 'var(--impakt-color-status-danger-default, #c8102e)',\n};\n/** When an item names no tone, lanes take these in turn. */\nexport const CYCLE: NamedTone[] = ['success', 'info', 'warning', 'accent', 'danger', 'brand'];\n/**\n * A named tone, or for an item that names none, the brand's chart colour for its\n * place (color.chart.1 to 5), falling back to the status colours in turn.\n */\nexport const toneOf = (tone: Tone | undefined, i: number): string => {\n if (typeof tone === 'number') return `var(--impakt-color-chart-${tone}, ${TONE[CYCLE[(tone - 1) % CYCLE.length]!]})`;\n if (tone && tone in TONE) return TONE[tone];\n return `var(--impakt-color-chart-${(i % 5) + 1}, ${TONE[CYCLE[i % CYCLE.length]!]})`;\n};\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAS,KAAK,MAAM,eAAoC;;;ACSjD,IAAM,OAAkC;AAAA,EAC7C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,QAAqB,CAAC,WAAW,QAAQ,WAAW,UAAU,UAAU,OAAO;AAKrF,IAAM,SAAS,CAAC,MAAwB,MAAsB;AACnE,MAAI,OAAO,SAAS,SAAU,QAAO,4BAA4B,IAAI,KAAK,KAAK,OAAO,OAAO,KAAK,MAAM,MAAM,CAAE,CAA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AAC,cAAc,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,aAAa,EAAE,UAAU,UAAU,EAAE,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,EAAE,QAAQ;AAAA,8CACrL,IAAI,4FAA4F,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA,8BAI3H,MAAM,wBAAwB,SAAS,CAAC,2BAA2B,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrG;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,OACJ,KAAK,SAAS,QACV,wBAAwB,KAAK,SAAS,YAAY,SAAS,EAAE,iCAC7D,KAAK,SAAS,WACZ,oQACA;AACR,WAAO,4CAA4C,UAAU,OAAO,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,IAAI,uBAAuB,KAAK,KAAK,UAAU,KAAK,OAAO,2BAA2B,KAAK,IAAI,YAAY,OAAO;AAAA,EAC3M;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
iconSvg
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5OYQZWP2.js";
|
|
4
4
|
import {
|
|
5
5
|
ImpaktElement,
|
|
6
6
|
focusRing,
|
|
7
|
+
say,
|
|
8
|
+
targetSize,
|
|
9
|
+
visuallyHidden
|
|
10
|
+
} from "./chunk-72WNCCDC.js";
|
|
11
|
+
import {
|
|
7
12
|
fontSize,
|
|
8
13
|
fontWeight,
|
|
9
14
|
space,
|
|
10
|
-
t
|
|
11
|
-
|
|
12
|
-
visuallyHidden
|
|
13
|
-
} from "./chunk-V7EB7Q2M.js";
|
|
15
|
+
t
|
|
16
|
+
} from "./chunk-JTCTQBAX.js";
|
|
14
17
|
|
|
15
18
|
// packages/ui/src/components/navigation.ts
|
|
16
19
|
import { css, html, nothing } from "lit";
|
|
@@ -41,6 +44,11 @@ var ImpaktNav = class extends ImpaktElement {
|
|
|
41
44
|
this.menuLook = "button";
|
|
42
45
|
this.size = "md";
|
|
43
46
|
this.align = "end";
|
|
47
|
+
this.fold = "measure";
|
|
48
|
+
this.actionText = "";
|
|
49
|
+
this.actionHref = "";
|
|
50
|
+
this.look = "links";
|
|
51
|
+
this.current = "";
|
|
44
52
|
}
|
|
45
53
|
static {
|
|
46
54
|
this.properties = {
|
|
@@ -49,7 +57,12 @@ var ImpaktNav = class extends ImpaktElement {
|
|
|
49
57
|
menuText: { type: String, attribute: "menu-text" },
|
|
50
58
|
menuLook: { type: String, reflect: true, attribute: "menu-look" },
|
|
51
59
|
size: { type: String, reflect: true },
|
|
52
|
-
align: { type: String, reflect: true }
|
|
60
|
+
align: { type: String, reflect: true },
|
|
61
|
+
fold: { type: String, reflect: true },
|
|
62
|
+
actionText: { type: String, attribute: "action-text" },
|
|
63
|
+
actionHref: { type: String, attribute: "action-href" },
|
|
64
|
+
look: { type: String, reflect: true },
|
|
65
|
+
current: { type: String }
|
|
53
66
|
};
|
|
54
67
|
}
|
|
55
68
|
get open() {
|
|
@@ -87,13 +100,45 @@ var ImpaktNav = class extends ImpaktElement {
|
|
|
87
100
|
:host([folded]) ul.open { display: flex; }
|
|
88
101
|
:host([folded]) li { text-align: start; }
|
|
89
102
|
:host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }
|
|
103
|
+
/* Tabs: a bordered group on the soft surface; the current tab is white with a dot before it. */
|
|
104
|
+
:host([look='tabs']) ul { gap: 0; padding: 3px; background: ${t.surfaceSubtle}; border: ${t.borderThin} solid var(--impakt-color-line-soft, #dcdcd8); }
|
|
105
|
+
:host([look='tabs']) a { min-block-size: 42px; gap: ${space(2)}; padding: 0 ${space(4)}; font-size: ${fontSize("sm")}; font-weight: ${fontWeight("regular")}; border-radius: 0; }
|
|
106
|
+
:host([look='tabs']) a:hover { text-decoration: none; background: ${t.wash}; }
|
|
107
|
+
:host([look='tabs']) a[aria-current] { text-decoration: none; background: ${t.surfaceCard}; box-shadow: inset 0 0 0 1px var(--impakt-color-line-soft, #dcdcd8); }
|
|
108
|
+
:host([look='tabs']) a[aria-current]::before { content: ''; flex: none; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }
|
|
109
|
+
@media (forced-colors: active) { :host([look='tabs']) a[aria-current] { outline: 1px solid CanvasText; } }
|
|
110
|
+
:host([look='tabs'][folded]) ul { padding: ${space(2)}; }
|
|
90
111
|
/* With no script the element is never defined, so it cannot measure itself and fold. The links
|
|
91
112
|
wrap onto more lines instead, so they are never cut off or drawn over what is beside them. */
|
|
92
113
|
:host(:not(:defined)) ul { flex-wrap: wrap; row-gap: 0; }
|
|
114
|
+
/*
|
|
115
|
+
* fold="narrow": the fold is decided here, by the width of the container around the nav, so it
|
|
116
|
+
* is the same before the script runs, after it, and without it. The Menu button opens the
|
|
117
|
+
* panel as a popover, which the browser does by itself. On a wide screen the panel is not a box
|
|
118
|
+
* at all, and its links sit in the row as they always did.
|
|
119
|
+
*/
|
|
120
|
+
:host([fold='narrow']) .panel { display: contents; color: inherit; }
|
|
121
|
+
:host([fold='narrow']) .close, :host([fold='narrow']) .action { display: none; }
|
|
122
|
+
@container (max-width: 40rem) {
|
|
123
|
+
:host([fold='narrow']) { flex: 0 0 auto; }
|
|
124
|
+
:host([fold='narrow']) .toggle { display: inline-flex; }
|
|
125
|
+
:host([fold='narrow']) .panel { display: none; }
|
|
126
|
+
:host([fold='narrow']) .panel:popover-open { display: flex; flex-direction: column; gap: ${space(6)}; position: fixed; inset: 0; box-sizing: border-box; inline-size: 100%; block-size: 100%; max-inline-size: none; max-block-size: none; margin: 0; padding: ${space(3)} ${space(4)} calc(${space(6)} + env(safe-area-inset-bottom)); border: 0; overflow: auto; overscroll-behavior: contain; background: ${t.text}; color: ${t.surfaceCard}; }
|
|
127
|
+
:host([fold='narrow']) .close { display: inline-flex; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight("semibold")}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }
|
|
128
|
+
:host([fold='narrow']) ul { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; }
|
|
129
|
+
:host([fold='narrow']) li { border-block-end: ${t.borderThin} solid color-mix(in srgb, currentColor 22%, transparent); }
|
|
130
|
+
:host([fold='narrow']) li a { display: flex; padding: ${space(4)} 0; font-family: ${t.fontHeading}; font-size: ${fontSize("2xl")}; font-weight: ${fontWeight("semibold")}; letter-spacing: -0.02em; }
|
|
131
|
+
:host([fold='narrow']) .action { display: flex; ${targetSize} align-items: center; justify-content: center; margin-block-start: auto; padding: ${space(3)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.text}; font-weight: ${fontWeight("semibold")}; text-decoration: none; border-radius: ${t.radius}; }
|
|
132
|
+
:host([fold='narrow']) .action:hover { text-decoration: underline; }
|
|
133
|
+
}
|
|
93
134
|
`
|
|
94
135
|
];
|
|
95
136
|
}
|
|
96
137
|
fit() {
|
|
138
|
+
if (this.fold === "narrow") {
|
|
139
|
+
this.removeAttribute("folded");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
97
142
|
if (!this.hasUpdated) return;
|
|
98
143
|
const room = this.getBoundingClientRect().width;
|
|
99
144
|
if (room <= 0) return;
|
|
@@ -108,7 +153,7 @@ var ImpaktNav = class extends ImpaktElement {
|
|
|
108
153
|
if (!fold && this.menuOpen) this.open = false;
|
|
109
154
|
}
|
|
110
155
|
updated(changed) {
|
|
111
|
-
if (changed.has("links")) {
|
|
156
|
+
if (changed.has("links") || changed.has("fold")) {
|
|
112
157
|
this.needs = 0;
|
|
113
158
|
this.fit();
|
|
114
159
|
}
|
|
@@ -132,13 +177,35 @@ var ImpaktNav = class extends ImpaktElement {
|
|
|
132
177
|
this.open = false;
|
|
133
178
|
this.renderRoot.querySelector(".toggle")?.focus();
|
|
134
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* fold="narrow": the Menu button and the panel are tied by `popovertarget`, so the browser opens
|
|
182
|
+
* and closes the panel, moves on to it with Tab, and closes it on Escape, with no script. The
|
|
183
|
+
* browser also tells a screen reader whether it is open.
|
|
184
|
+
*/
|
|
185
|
+
renderNarrow() {
|
|
186
|
+
const panel = this.id_("panel");
|
|
187
|
+
return html`<nav aria-label=${this.label || nothing} part="nav">
|
|
188
|
+
<button class="toggle" type="button" popovertarget=${panel}>${iconSvg(this.menuLook === "icon" ? "menu-two" : "menu")}<span class="words">${this.menuText}</span></button>
|
|
189
|
+
<div id=${panel} class="panel" popover="auto" part="panel">
|
|
190
|
+
<button class="close" type="button" popovertarget=${panel} popovertargetaction="hide">${iconSvg("close")}<span>${say("Close")}</span></button>
|
|
191
|
+
<ul part="list">
|
|
192
|
+
${(this.links ?? []).map((link) => {
|
|
193
|
+
const current = this.current ? link.href === this.current ? "page" : null : where(link.href);
|
|
194
|
+
return html`<li><a href=${link.href} aria-current=${current === "page" ? "page" : current === "section" ? "true" : nothing} part="link">${link.label}</a></li>`;
|
|
195
|
+
})}
|
|
196
|
+
</ul>
|
|
197
|
+
${this.actionText ? html`<a class="action" href=${this.actionHref || "#"} part="action">${this.actionText}</a>` : nothing}
|
|
198
|
+
</div>
|
|
199
|
+
</nav>`;
|
|
200
|
+
}
|
|
135
201
|
render() {
|
|
202
|
+
if (this.fold === "narrow") return this.renderNarrow();
|
|
136
203
|
const list = this.id_("links");
|
|
137
204
|
return html`<nav aria-label=${this.label || nothing} part="nav" @keydown=${this.onKey}>
|
|
138
205
|
<button class="toggle" type="button" aria-expanded=${this.open ? "true" : "false"} aria-controls=${list} @click=${this.toggle}>${iconSvg(this.open ? "close" : this.menuLook === "icon" ? "menu-two" : "menu")}<span class="words">${this.menuText}</span></button>
|
|
139
206
|
<ul id=${list} class=${this.open ? "open" : ""} part="list">
|
|
140
207
|
${(this.links ?? []).map((link) => {
|
|
141
|
-
const current = where(link.href);
|
|
208
|
+
const current = this.current ? link.href === this.current ? "page" : null : where(link.href);
|
|
142
209
|
return html`<li><a href=${link.href} aria-current=${current === "page" ? "page" : current === "section" ? "true" : nothing} part="link">${link.label}</a></li>`;
|
|
143
210
|
})}
|
|
144
211
|
</ul>
|
|
@@ -149,13 +216,15 @@ var ImpaktBreadcrumbs = class extends ImpaktElement {
|
|
|
149
216
|
static {
|
|
150
217
|
this.properties = {
|
|
151
218
|
items: { type: Array },
|
|
152
|
-
label: { type: String }
|
|
219
|
+
label: { type: String },
|
|
220
|
+
look: { type: String, reflect: true }
|
|
153
221
|
};
|
|
154
222
|
}
|
|
155
223
|
constructor() {
|
|
156
224
|
super();
|
|
157
225
|
this.items = [];
|
|
158
226
|
this.label = "Breadcrumb";
|
|
227
|
+
this.look = "default";
|
|
159
228
|
}
|
|
160
229
|
static {
|
|
161
230
|
this.styles = [
|
|
@@ -169,6 +238,12 @@ var ImpaktBreadcrumbs = class extends ImpaktElement {
|
|
|
169
238
|
a { color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; border-radius: ${t.radiusSm}; }
|
|
170
239
|
a:hover { color: ${t.linkHover}; }
|
|
171
240
|
[aria-current] { color: ${t.textMuted}; }
|
|
241
|
+
:host([look='mono']) { font-family: ${t.fontMono}; font-size: ${fontSize("sm")}; color: ${t.textMuted}; }
|
|
242
|
+
/* The G2 trail (34:602): "Home / Tools / Accessibility", a slash between, the links underlined only on hover. A trail is its own list, not a link in a sentence, so it needs no underline to be told apart (1.4.1). */
|
|
243
|
+
:host([look='mono']) a { color: ${t.textMuted}; text-decoration: none; }
|
|
244
|
+
:host([look='mono']) a:hover { color: ${t.text}; text-decoration: underline; text-decoration-thickness: 1px; }
|
|
245
|
+
:host([look='mono']) [aria-current] { color: ${t.text}; }
|
|
246
|
+
:host([look='mono']) li + li::before { content: '/'; inline-size: auto; block-size: auto; border: 0; transform: none; margin-inline: ${space(1)}; color: ${t.textMuted}; }
|
|
172
247
|
.sr-only { ${visuallyHidden} }
|
|
173
248
|
`
|
|
174
249
|
];
|
|
@@ -189,4 +264,4 @@ export {
|
|
|
189
264
|
ImpaktNav,
|
|
190
265
|
ImpaktBreadcrumbs
|
|
191
266
|
};
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
267
|
+
//# sourceMappingURL=chunk-CFCFKLTN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/navigation.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { say } from '../base/say';\nimport { focusRing, targetSize, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/** One link in a navigation or a trail. */\nexport interface NavLink {\n label: string;\n href: string;\n}\n\n/** Whether a link is the page the visitor is on, or a page above it. */\nfunction where(href: string): 'page' | 'section' | null {\n // A link to a place on this page, or to nowhere yet (\"#\"), is not where the reader is.\n if (typeof location === 'undefined' || !href || href.startsWith('#')) return null;\n let path: string;\n try {\n const url = new URL(href, location.href);\n // A link to another site is never where the reader is, even when its path matches, as a\n // product at app.example.com linking back to example.com/ would otherwise mark that link.\n if (url.origin !== location.origin) return null;\n path = url.pathname.replace(/\\/$/, '') || '/';\n } catch {\n return null;\n }\n const here = location.pathname.replace(/\\/$/, '') || '/';\n if (path === here) return 'page';\n return path !== '/' && here.startsWith(`${path}/`) ? 'section' : null;\n}\n\n/**\n * The site's main navigation: a row of links that folds into a Menu button\n * when there is not room for all of them, whatever the screen.\n *\n * **The page you are on is marked in words as well as colour.** Its link\n * carries `aria-current=\"page\"`, which a screen reader announces, and an\n * underline, so it does not rely on colour alone (1.4.1).\n *\n * **The menu is a disclosure, not a pop-up.** The Menu button says whether the\n * list is open (`aria-expanded`), the links follow it in the reading order, and\n * Escape closes it and returns focus to the button.\n *\n * @category action\n * @icon menu\n */\nexport class ImpaktNav extends ImpaktElement {\n static properties = {\n links: { type: Array },\n label: { type: String },\n menuText: { type: String, attribute: 'menu-text' },\n menuLook: { type: String, reflect: true, attribute: 'menu-look' },\n size: { type: String, reflect: true },\n align: { type: String, reflect: true },\n fold: { type: String, reflect: true },\n actionText: { type: String, attribute: 'action-text' },\n actionHref: { type: String, attribute: 'action-href' },\n look: { type: String, reflect: true },\n current: { type: String },\n };\n /** The links, in order. */\n declare links: NavLink[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The words on the button that opens the links on a narrow screen. */\n declare menuText: string;\n /**\n * The Menu button: `button` with its words, or `icon`, a round button with\n * only the icon, the words kept as its name for screen readers.\n */\n declare menuLook: 'button' | 'icon';\n /** `sm` sets the links a step smaller and closer, as a site header's are. */\n declare size: 'md' | 'sm';\n /** Where the links sit along the row. */\n declare align: 'start' | 'center' | 'end';\n /**\n * How the links fold behind the Menu button. `measure` folds them when they do not fit, which\n * needs script. `narrow` folds them when the container around the nav is 40rem wide or less,\n * which is decided in CSS, and the Menu button then opens a whole-screen menu with no script at\n * all. `narrow` is for a page that may be drawn on a server and shown without script. It needs a\n * size container around the nav, and `impakt-site-header` is one.\n */\n declare fold: 'measure' | 'narrow';\n /** With `fold=\"narrow\"`: an action shown at the foot of the whole-screen menu, for a header that hides its own button on a narrow screen. */\n declare actionText: string;\n /** Where that action goes. */\n declare actionHref: string;\n /**\n * `links` is a row of words. `tabs` is the G2 site header's file tabs: a\n * bordered group on the soft surface, each tab 42px tall, and the page you\n * are on a white tab with a dot before it (frame 9:264). The current tab is\n * still `aria-current`, so it is not said by colour alone.\n */\n declare look: 'links' | 'tabs';\n /** The href of the link to mark as the page you are on, for when the page's address cannot say it (a preview, or `#` links). Unset, it is worked out from the address. */\n declare current: string;\n /** Whether the menu is open on a narrow screen. Not a setting: it is the visitor's. */\n private menuOpen = false;\n private get open(): boolean {\n return this.menuOpen;\n }\n private set open(next: boolean) {\n this.menuOpen = next;\n this.requestUpdate();\n }\n\n constructor() {\n super();\n this.links = [];\n this.label = 'Main';\n this.menuText = 'Menu';\n this.menuLook = 'button';\n this.size = 'md';\n this.align = 'end';\n this.fold = 'measure';\n this.actionText = '';\n this.actionHref = '';\n this.look = 'links';\n this.current = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n /* It grows to fill a row it sits in, because it measures itself to decide when to fold. */\n :host { display: block; flex: 1 1 8rem; min-inline-size: 0; }\n nav { display: flex; flex-direction: column; position: relative; }\n li { flex: none; }\n ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)} ${space(6)}; align-items: center; justify-content: flex-end; }\n :host([align='start']) ul { justify-content: flex-start; }\n :host([align='center']) ul { justify-content: center; }\n a { ${targetSize} display: inline-flex; align-items: center; padding: ${space(2)} ${space(1)}; color: inherit; font-weight: ${fontWeight('semibold')}; text-decoration: none; border-radius: ${t.radiusSm}; }\n a:hover { text-decoration: underline; text-underline-offset: 0.25em; }\n a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }\n .toggle { display: none; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }\n /* When they do not fit, the links fold behind a Menu button and open as a panel under it. */\n :host([folded]) { flex: 0 0 auto; }\n :host([folded]) .toggle { display: inline-flex; }\n :host([menu-look='icon']) .toggle { inline-size: 44px; block-size: 44px; padding: 0; justify-content: center; border: 0; border-radius: 50%; background: ${t.brand}; color: ${t.onBrand}; }\n :host([menu-look='icon']) .toggle .words { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n :host([size='sm']) ul { column-gap: ${space(6)}; }\n :host([size='sm']) a { padding-inline: 0; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('medium')}; }\n :host([size='sm'][folded]) a { padding-inline: ${space(3)}; }\n :host([folded]) ul { display: none; position: absolute; inset-block-start: calc(100% + ${space(2)}); inset-inline-end: 0; z-index: 30; flex-direction: column; align-items: stretch; gap: 0; min-inline-size: 14rem; padding: ${space(2)}; background: ${t.surfaceCard}; color: ${t.text}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: 0 8px 24px rgb(0 0 0 / 14%); }\n :host([folded]) ul.open { display: flex; }\n :host([folded]) li { text-align: start; }\n :host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }\n /* Tabs: a bordered group on the soft surface; the current tab is white with a dot before it. */\n :host([look='tabs']) ul { gap: 0; padding: 3px; background: ${t.surfaceSubtle}; border: ${t.borderThin} solid var(--impakt-color-line-soft, #dcdcd8); }\n :host([look='tabs']) a { min-block-size: 42px; gap: ${space(2)}; padding: 0 ${space(4)}; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('regular')}; border-radius: 0; }\n :host([look='tabs']) a:hover { text-decoration: none; background: ${t.wash}; }\n :host([look='tabs']) a[aria-current] { text-decoration: none; background: ${t.surfaceCard}; box-shadow: inset 0 0 0 1px var(--impakt-color-line-soft, #dcdcd8); }\n :host([look='tabs']) a[aria-current]::before { content: ''; flex: none; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }\n @media (forced-colors: active) { :host([look='tabs']) a[aria-current] { outline: 1px solid CanvasText; } }\n :host([look='tabs'][folded]) ul { padding: ${space(2)}; }\n /* With no script the element is never defined, so it cannot measure itself and fold. The links\n wrap onto more lines instead, so they are never cut off or drawn over what is beside them. */\n :host(:not(:defined)) ul { flex-wrap: wrap; row-gap: 0; }\n /*\n * fold=\"narrow\": the fold is decided here, by the width of the container around the nav, so it\n * is the same before the script runs, after it, and without it. The Menu button opens the\n * panel as a popover, which the browser does by itself. On a wide screen the panel is not a box\n * at all, and its links sit in the row as they always did.\n */\n :host([fold='narrow']) .panel { display: contents; color: inherit; }\n :host([fold='narrow']) .close, :host([fold='narrow']) .action { display: none; }\n @container (max-width: 40rem) {\n :host([fold='narrow']) { flex: 0 0 auto; }\n :host([fold='narrow']) .toggle { display: inline-flex; }\n :host([fold='narrow']) .panel { display: none; }\n :host([fold='narrow']) .panel:popover-open { display: flex; flex-direction: column; gap: ${space(6)}; position: fixed; inset: 0; box-sizing: border-box; inline-size: 100%; block-size: 100%; max-inline-size: none; max-block-size: none; margin: 0; padding: ${space(3)} ${space(4)} calc(${space(6)} + env(safe-area-inset-bottom)); border: 0; overflow: auto; overscroll-behavior: contain; background: ${t.text}; color: ${t.surfaceCard}; }\n :host([fold='narrow']) .close { display: inline-flex; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }\n :host([fold='narrow']) ul { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; }\n :host([fold='narrow']) li { border-block-end: ${t.borderThin} solid color-mix(in srgb, currentColor 22%, transparent); }\n :host([fold='narrow']) li a { display: flex; padding: ${space(4)} 0; font-family: ${t.fontHeading}; font-size: ${fontSize('2xl')}; font-weight: ${fontWeight('semibold')}; letter-spacing: -0.02em; }\n :host([fold='narrow']) .action { display: flex; ${targetSize} align-items: center; justify-content: center; margin-block-start: auto; padding: ${space(3)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.text}; font-weight: ${fontWeight('semibold')}; text-decoration: none; border-radius: ${t.radius}; }\n :host([fold='narrow']) .action:hover { text-decoration: underline; }\n }\n `,\n ];\n\n /** The width the links need in one row. Measured once for each set of links, and again while folded it cannot be read. */\n private needs = 0;\n private resize?: ResizeObserver;\n\n private fit(): void {\n // With fold=\"narrow\" the fold is CSS's to decide, and nothing is measured.\n if (this.fold === 'narrow') {\n this.removeAttribute('folded');\n return;\n }\n // An element the server drew waits for the element around it before it draws here, and the\n // screen can report a size in that wait. There is nothing to measure until it has drawn.\n if (!this.hasUpdated) return;\n const room = this.getBoundingClientRect().width;\n if (room <= 0) return;\n if (!this.needs) {\n this.removeAttribute('folded');\n const items = Array.from(this.renderRoot.querySelectorAll('li'));\n const gap = Number.parseFloat(getComputedStyle(this.renderRoot.querySelector('ul')!).columnGap) || 0;\n this.needs = items.reduce((total, item) => total + item.getBoundingClientRect().width, 0) + gap * Math.max(0, items.length - 1);\n }\n const fold = this.needs > room;\n this.toggleAttribute('folded', fold);\n if (!fold && this.menuOpen) this.open = false;\n }\n\n protected updated(changed: Map<string, unknown>): void {\n if (changed.has('links') || changed.has('fold')) {\n this.needs = 0;\n this.fit();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(() => this.fit());\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resize?.disconnect();\n }\n\n private toggle(): void {\n this.open = !this.open;\n }\n\n private onKey(event: KeyboardEvent): void {\n if (event.key !== 'Escape' || !this.open) return;\n this.open = false;\n this.renderRoot.querySelector<HTMLButtonElement>('.toggle')?.focus();\n }\n\n /**\n * fold=\"narrow\": the Menu button and the panel are tied by `popovertarget`, so the browser opens\n * and closes the panel, moves on to it with Tab, and closes it on Escape, with no script. The\n * browser also tells a screen reader whether it is open.\n */\n private renderNarrow(): TemplateResult {\n const panel = this.id_('panel');\n return html`<nav aria-label=${this.label || nothing} part=\"nav\">\n <button class=\"toggle\" type=\"button\" popovertarget=${panel}>${iconSvg(this.menuLook === 'icon' ? 'menu-two' : 'menu')}<span class=\"words\">${this.menuText}</span></button>\n <div id=${panel} class=\"panel\" popover=\"auto\" part=\"panel\">\n <button class=\"close\" type=\"button\" popovertarget=${panel} popovertargetaction=\"hide\">${iconSvg('close')}<span>${say('Close')}</span></button>\n <ul part=\"list\">\n ${(this.links ?? []).map((link) => {\n const current = this.current ? (link.href === this.current ? 'page' : null) : where(link.href);\n return html`<li><a href=${link.href} aria-current=${current === 'page' ? 'page' : current === 'section' ? 'true' : nothing} part=\"link\">${link.label}</a></li>`;\n })}\n </ul>\n ${this.actionText ? html`<a class=\"action\" href=${this.actionHref || '#'} part=\"action\">${this.actionText}</a>` : nothing}\n </div>\n </nav>`;\n }\n\n render(): TemplateResult {\n if (this.fold === 'narrow') return this.renderNarrow();\n const list = this.id_('links');\n return html`<nav aria-label=${this.label || nothing} part=\"nav\" @keydown=${this.onKey}>\n <button class=\"toggle\" type=\"button\" aria-expanded=${this.open ? 'true' : 'false'} aria-controls=${list} @click=${this.toggle}>${iconSvg(this.open ? 'close' : this.menuLook === 'icon' ? 'menu-two' : 'menu')}<span class=\"words\">${this.menuText}</span></button>\n <ul id=${list} class=${this.open ? 'open' : ''} part=\"list\">\n ${(this.links ?? []).map((link) => {\n const current = this.current ? (link.href === this.current ? 'page' : null) : where(link.href);\n return html`<li><a href=${link.href} aria-current=${current === 'page' ? 'page' : current === 'section' ? 'true' : nothing} part=\"link\">${link.label}</a></li>`;\n })}\n </ul>\n </nav>`;\n }\n}\n\n/**\n * Where the page sits in the site, as a trail of links back to the top: Home,\n * then Developments, then this page.\n *\n * The last item is the page itself. It is not a link, and it carries\n * `aria-current=\"page\"`. The separators are drawn, not written, so a screen\n * reader reads the trail as a list rather than a string of slashes.\n *\n * @category action\n * @icon breadcrumbs\n */\nexport class ImpaktBreadcrumbs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n look: { type: String, reflect: true },\n };\n /** `default` is the body face with links. `mono` is the code face at 14px, muted, as the G2 tools' trail is (frame 34:602). */\n declare look: 'default' | 'mono';\n /** The trail, from the top of the site down to this page. */\n declare items: NavLink[];\n /** What the trail is called for a screen reader. */\n declare label: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Breadcrumb';\n this.look = 'default';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; font-size: ${fontSize('sm')}; }\n ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${space(1)}; }\n li { display: inline-flex; align-items: center; gap: ${space(1)}; }\n li + li::before { content: ''; inline-size: 0.45em; block-size: 0.45em; border-block-start: 1.5px solid ${t.textMuted}; border-inline-end: 1.5px solid ${t.textMuted}; transform: rotate(45deg); margin-inline: ${space(1)} ${space(2)}; }\n a { color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; border-radius: ${t.radiusSm}; }\n a:hover { color: ${t.linkHover}; }\n [aria-current] { color: ${t.textMuted}; }\n :host([look='mono']) { font-family: ${t.fontMono}; font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n /* The G2 trail (34:602): \"Home / Tools / Accessibility\", a slash between, the links underlined only on hover. A trail is its own list, not a link in a sentence, so it needs no underline to be told apart (1.4.1). */\n :host([look='mono']) a { color: ${t.textMuted}; text-decoration: none; }\n :host([look='mono']) a:hover { color: ${t.text}; text-decoration: underline; text-decoration-thickness: 1px; }\n :host([look='mono']) [aria-current] { color: ${t.text}; }\n :host([look='mono']) li + li::before { content: '/'; inline-size: auto; block-size: auto; border: 0; transform: none; margin-inline: ${space(1)}; color: ${t.textMuted}; }\n .sr-only { ${visuallyHidden} }\n `,\n ];\n\n render(): TemplateResult {\n const items = this.items ?? [];\n return html`<nav aria-label=${this.label} part=\"nav\"><ol>\n ${items.map(\n (item, i) =>\n html`<li>${\n i === items.length - 1 ? html`<span aria-current=\"page\">${item.label}</span>` : html`<a href=${item.href} part=\"link\">${item.label}</a>`\n }</li>`,\n )}\n </ol></nav>`;\n }\n}\n\ncustomElements.define('impakt-nav', ImpaktNav);\ncustomElements.define('impakt-breadcrumbs', ImpaktBreadcrumbs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-nav': ImpaktNav;\n 'impakt-breadcrumbs': ImpaktBreadcrumbs;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAcxD,SAAS,MAAM,MAAyC;AAEtD,MAAI,OAAO,aAAa,eAAe,CAAC,QAAQ,KAAK,WAAW,GAAG,EAAG,QAAO;AAC7E,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,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
5
|
+
} from "./chunk-HSXLSJVG.js";
|
|
10
6
|
|
|
11
7
|
// packages/ui/src/components/textarea.ts
|
|
12
8
|
import { html, css, nothing } from "lit";
|
|
@@ -20,6 +16,7 @@ var ImpaktTextarea = class extends FieldElement {
|
|
|
20
16
|
this.rows = 4;
|
|
21
17
|
this.maxlength = void 0;
|
|
22
18
|
this.fillFrom = "none";
|
|
19
|
+
this.placeholder = "";
|
|
23
20
|
}
|
|
24
21
|
static {
|
|
25
22
|
this.properties = {
|
|
@@ -27,40 +24,21 @@ var ImpaktTextarea = class extends FieldElement {
|
|
|
27
24
|
width: { type: String, reflect: true },
|
|
28
25
|
rows: { type: Number },
|
|
29
26
|
maxlength: { type: Number },
|
|
30
|
-
fillFrom: { type: String, attribute: "fill-from" }
|
|
27
|
+
fillFrom: { type: String, attribute: "fill-from" },
|
|
28
|
+
placeholder: { type: String }
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
31
|
static {
|
|
34
32
|
this.styles = [
|
|
35
33
|
...FieldElement.styles,
|
|
36
34
|
fieldWidths,
|
|
35
|
+
fieldControl("textarea"),
|
|
37
36
|
css`
|
|
38
37
|
textarea {
|
|
39
|
-
inline-size: min(100%, var(--impakt-field-width));
|
|
40
|
-
padding: ${space(2.5)} ${space(3)};
|
|
41
|
-
font-family: inherit;
|
|
42
|
-
font-size: ${fontSize("md")};
|
|
43
|
-
color: ${t.text};
|
|
44
|
-
background: var(--impakt-color-field-surface, ${t.surfaceCard});
|
|
45
|
-
border: ${t.borderThin} solid ${t.border};
|
|
46
|
-
border-radius: ${t.radiusLg};
|
|
47
|
-
box-shadow: var(--impakt-shadow-field, ${t.shadowXs});
|
|
48
|
-
transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;
|
|
49
38
|
/* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text
|
|
50
39
|
can be made bigger, and a fixed box is where that stops working. */
|
|
51
40
|
resize: vertical;
|
|
52
41
|
}
|
|
53
|
-
textarea:hover:not(:disabled) {
|
|
54
|
-
border-color: ${t.borderStrong};
|
|
55
|
-
}
|
|
56
|
-
textarea:focus-visible {
|
|
57
|
-
border-color: ${t.brand};
|
|
58
|
-
box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};
|
|
59
|
-
}
|
|
60
|
-
:host([invalid]) textarea {
|
|
61
|
-
border-color: ${t.danger};
|
|
62
|
-
border-width: ${t.borderThick};
|
|
63
|
-
}
|
|
64
42
|
`
|
|
65
43
|
];
|
|
66
44
|
}
|
|
@@ -93,6 +71,7 @@ var ImpaktTextarea = class extends FieldElement {
|
|
|
93
71
|
name=${this.name || nothing}
|
|
94
72
|
rows=${this.rows}
|
|
95
73
|
maxlength=${this.maxlength ?? nothing}
|
|
74
|
+
placeholder=${this.placeholder || nothing}
|
|
96
75
|
?disabled=${this.disabled}
|
|
97
76
|
?readonly=${this.readonly}
|
|
98
77
|
?required=${this.required}
|
|
@@ -116,4 +95,4 @@ customElements.define("impakt-textarea", ImpaktTextarea);
|
|
|
116
95
|
export {
|
|
117
96
|
ImpaktTextarea
|
|
118
97
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
98
|
+
//# sourceMappingURL=chunk-CQT3VPYK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldControl, fieldWidths } from '../base/FieldElement';\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 placeholder: { type: String },\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 /** An example of what to write. The label is still the field's name; a placeholder never replaces it. */\n declare placeholder: string;\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 this.placeholder = '';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n fieldControl('textarea'),\n css`\n textarea {\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 `,\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 placeholder=${this.placeholder || 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 .value=${this.value}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n ></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\nd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BAAgC;AACxC,WAAO;AAAA;AAAA,aAEE,KAAK,SAAS;AAAA;AAAA,eAEZ,KAAK,QAAQ,OAAO;AAAA,eACpB,KAAK,IAAI;AAAA,oBACJ,KAAK,aAAa,OAAO;AAAA,sBACvB,KAAK,eAAe,OAAO;AAAA,oBAC7B,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,2BACN,KAAK,WAAW;AAAA,uBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,iBACnC,KAAK,KAAK;AAAA,iBACV,CAAC,MAAa;AACrB,WAAK,aAAa;AAClB,WAAK,aAAc,EAAE,OAA+B,KAAK;AAAA,IAC3D,CAAC;AAAA;AAAA;AAAA,EAGP;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":[]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktElement,
|
|
3
|
+
visuallyHidden
|
|
4
|
+
} from "./chunk-72WNCCDC.js";
|
|
5
|
+
import {
|
|
3
6
|
fontSize,
|
|
4
7
|
fontWeight,
|
|
5
8
|
lineHeight,
|
|
6
9
|
space,
|
|
7
10
|
spaceAround,
|
|
8
11
|
t,
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
} from "./chunk-V7EB7Q2M.js";
|
|
12
|
+
type
|
|
13
|
+
} from "./chunk-JTCTQBAX.js";
|
|
12
14
|
|
|
13
15
|
// packages/ui/src/components/layout.ts
|
|
14
16
|
import { html, css, nothing } from "lit";
|
|
@@ -99,9 +101,9 @@ var ImpaktCard = class extends ImpaktElement {
|
|
|
99
101
|
display: flex;
|
|
100
102
|
flex-direction: column;
|
|
101
103
|
background: ${t.surfaceCard};
|
|
102
|
-
border: ${t.borderThin} solid ${t.
|
|
104
|
+
border: ${t.borderThin} solid ${t.text};
|
|
103
105
|
border-radius: ${t.radiusXl};
|
|
104
|
-
box-shadow:
|
|
106
|
+
box-shadow: none;
|
|
105
107
|
overflow: hidden;
|
|
106
108
|
--ratio: 16 / 9;
|
|
107
109
|
}
|
|
@@ -109,6 +111,10 @@ var ImpaktCard = class extends ImpaktElement {
|
|
|
109
111
|
:host([tone='brand']) { background: ${t.brand}; border-color: transparent; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; }
|
|
110
112
|
:host([tone='outline']) { background: transparent; box-shadow: none; border-color: ${t.rule}; }
|
|
111
113
|
:host([raised]) { border-color: transparent; box-shadow: 0 24px 60px rgb(16 19 23 / 12%), 0 2px 6px rgb(16 19 23 / 6%); border-radius: ${t.radius2xl}; }
|
|
114
|
+
/* Ink: the colours are kept on the host and repainted for what is inside, so the fill is the outer text colour. */
|
|
115
|
+
:host([tone='ink']) { --impakt-card-ink: ${t.text}; --impakt-card-on: var(--impakt-color-text-inverse, var(--impakt-solid-card, ${t.surfaceCard})); background: var(--impakt-card-ink); color: var(--impakt-card-on); border-color: var(--impakt-card-ink); }
|
|
116
|
+
:host([tone='ink']) .body { --impakt-eyebrow: color-mix(in srgb, var(--impakt-card-on) 72%, var(--impakt-card-ink)); --impakt-color-text-default: var(--impakt-card-on); --impakt-color-text-heading: var(--impakt-card-on); --impakt-color-text-muted: color-mix(in srgb, var(--impakt-card-on) 72%, var(--impakt-card-ink)); --impakt-color-text-link: var(--impakt-card-on); --impakt-color-text-link-hover: var(--impakt-card-on); --impakt-color-text-inverse: var(--impakt-card-ink); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-card-ink) 95%, var(--impakt-card-on)); --impakt-color-line-soft: color-mix(in srgb, var(--impakt-card-ink) 87%, var(--impakt-card-on)); --impakt-button-primary: var(--impakt-card-on); --impakt-button-on-primary: var(--impakt-card-ink); --impakt-button-primary-hover: color-mix(in srgb, var(--impakt-card-on) 86%, var(--impakt-card-ink)); }
|
|
117
|
+
:host([tone='dashed']) { background: transparent; border-style: dashed; }
|
|
112
118
|
:host([tone='plain']) { background: transparent; border-color: transparent; border-radius: 0; box-shadow: none; }
|
|
113
119
|
:host([ratio='4:3']) { --ratio: 4 / 3; }
|
|
114
120
|
:host([ratio='3:2']) { --ratio: 3 / 2; }
|
|
@@ -120,7 +126,7 @@ var ImpaktCard = class extends ImpaktElement {
|
|
|
120
126
|
:host([tone='plain']) .body { padding-inline: 0; }
|
|
121
127
|
img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }
|
|
122
128
|
.picture { position: relative; }
|
|
123
|
-
.tag { position: absolute; inset-block-start: ${space(4)}; inset-inline-start: ${space(4)}; padding: ${space(1.5)} ${space(3)}; font-size: ${fontSize("sm")}; color: ${t.text}; background: ${t.surfaceCard}; border-radius:
|
|
129
|
+
.tag { position: absolute; inset-block-start: ${space(4)}; inset-inline-start: ${space(4)}; padding: ${space(1.5)} ${space(3)}; font-size: ${fontSize("sm")}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); }
|
|
124
130
|
@media (forced-colors: active) { :host { border-color: CanvasText; } }
|
|
125
131
|
`
|
|
126
132
|
];
|
|
@@ -254,4 +260,4 @@ export {
|
|
|
254
260
|
ImpaktHeading,
|
|
255
261
|
ImpaktText
|
|
256
262
|
};
|
|
257
|
-
//# sourceMappingURL=chunk-
|
|
263
|
+
//# sourceMappingURL=chunk-DXLEYNID.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/layout.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { visuallyHidden as hiddenStyle } from '../base/styles';\nimport { fontSize, fontWeight, lineHeight, space, spaceAround, t, type } from '../base/tokens';\n\n/**\n * Layout and typography primitives.\n *\n * These are the components a composition is mostly made of, and they are\n * deliberately dull. Their one job is that spacing, type and colour come from\n * tokens, so that a page built in the CMS cannot contain a hard-coded 13px.\n */\n\n/** Vertical rhythm. Every gap is a spacing token, never a number.\n *\n * @category layout\n * @icon stack\n * @slot - The things being stacked.\n */\nexport class ImpaktStack extends ImpaktElement {\n static properties = {\n gap: { type: String, reflect: true },\n align: { type: String, reflect: true },\n direction: { type: String, reflect: true },\n justify: { 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 gap: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** How the items line up across the stack. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Down the page, or along a row that wraps when it runs out of room, such as a row of buttons. */\n declare direction: 'vertical' | 'horizontal';\n /** Where the items sit along a row. */\n declare justify: 'start' | 'center' | 'end' | 'between';\n /** Space before the stack, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the stack, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.gap = 'md';\n this.align = 'stretch';\n this.direction = 'vertical';\n this.justify = 'start';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n :host([gap='none']) { gap: 0; }\n :host([gap='xs']) { gap: ${space(1)}; }\n :host([align='start']) { align-items: flex-start; }\n :host([align='center']) { align-items: center; text-align: center; }\n :host([align='end']) { align-items: flex-end; }\n :host([direction='horizontal']) { flex-direction: row; flex-wrap: wrap; align-items: center; }\n :host([direction='horizontal'][align='start']) { align-items: flex-start; }\n :host([direction='horizontal'][align='end']) { align-items: flex-end; }\n :host([direction='horizontal'][align='center']) { text-align: start; }\n :host([justify='center']) { justify-content: center; }\n :host([justify='end']) { justify-content: flex-end; }\n :host([justify='between']) { justify-content: space-between; }\n :host([gap='sm']) { gap: ${space(2)}; }\n :host([gap='md']) { gap: ${space(4)}; }\n :host([gap='lg']) { gap: ${space(6)}; }\n :host([gap='xl']) { gap: ${space(8)}; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<slot></slot>`;\n }\n}\n\n/** A surface. What text is read against, and what contrast is measured from.\n *\n * @category layout\n * @icon card\n * @slot - What sits on the card.\n */\nexport class ImpaktCard extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n imageSrc: { type: String, attribute: 'image-src' },\n imageAlt: { type: String, attribute: 'image-alt' },\n ratio: { type: String, reflect: true },\n badge: { type: String },\n raised: { type: Boolean, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /**\n * The card's surface. Text on a brand card takes the brand's text colour.\n * The default is G2's: white, a 1px ink border and no shadow. `ink` is the\n * text colour as a fill with the words turned over, and `dashed` a\n * transparent card with a dashed ink border, for a slot still to be filled\n * (frames 36:497, 39:513, 39:671).\n */\n declare tone: 'default' | 'subtle' | 'brand' | 'outline' | 'plain' | 'ink' | 'dashed';\n /** Space inside the card. */\n declare padding: 'none' | 'sm' | 'md' | 'lg';\n /** A picture across the top of the card. */\n declare imageSrc: string;\n /** What the picture shows. Leave empty only when it is decoration. */\n declare imageAlt: string;\n /** A short label on the picture, such as \"3 left\". */\n declare badge: string;\n /** The picture's shape. */\n declare ratio: '16:9' | '4:3' | '3:2' | '1:1';\n /** Lifted off the page with a soft shadow and no edge, as a form that floats beside its words is. */\n declare raised: boolean;\n /** Space before the card, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the card, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'default';\n this.padding = 'lg';\n this.imageSrc = '';\n this.imageAlt = '';\n this.ratio = '16:9';\n this.badge = '';\n this.raised = false;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.text};\n border-radius: ${t.radiusXl};\n box-shadow: none;\n overflow: hidden;\n --ratio: 16 / 9;\n }\n :host([tone='subtle']) { background: ${t.surfaceSubtle}; border-color: transparent; box-shadow: none; }\n :host([tone='brand']) { background: ${t.brand}; border-color: transparent; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; }\n :host([tone='outline']) { background: transparent; box-shadow: none; border-color: ${t.rule}; }\n :host([raised]) { border-color: transparent; box-shadow: 0 24px 60px rgb(16 19 23 / 12%), 0 2px 6px rgb(16 19 23 / 6%); border-radius: ${t.radius2xl}; }\n /* Ink: the colours are kept on the host and repainted for what is inside, so the fill is the outer text colour. */\n :host([tone='ink']) { --impakt-card-ink: ${t.text}; --impakt-card-on: var(--impakt-color-text-inverse, var(--impakt-solid-card, ${t.surfaceCard})); background: var(--impakt-card-ink); color: var(--impakt-card-on); border-color: var(--impakt-card-ink); }\n :host([tone='ink']) .body { --impakt-eyebrow: color-mix(in srgb, var(--impakt-card-on) 72%, var(--impakt-card-ink)); --impakt-color-text-default: var(--impakt-card-on); --impakt-color-text-heading: var(--impakt-card-on); --impakt-color-text-muted: color-mix(in srgb, var(--impakt-card-on) 72%, var(--impakt-card-ink)); --impakt-color-text-link: var(--impakt-card-on); --impakt-color-text-link-hover: var(--impakt-card-on); --impakt-color-text-inverse: var(--impakt-card-ink); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-card-ink) 95%, var(--impakt-card-on)); --impakt-color-line-soft: color-mix(in srgb, var(--impakt-card-ink) 87%, var(--impakt-card-on)); --impakt-button-primary: var(--impakt-card-on); --impakt-button-on-primary: var(--impakt-card-ink); --impakt-button-primary-hover: color-mix(in srgb, var(--impakt-card-on) 86%, var(--impakt-card-ink)); }\n :host([tone='dashed']) { background: transparent; border-style: dashed; }\n :host([tone='plain']) { background: transparent; border-color: transparent; border-radius: 0; box-shadow: none; }\n :host([ratio='4:3']) { --ratio: 4 / 3; }\n :host([ratio='3:2']) { --ratio: 3 / 2; }\n :host([ratio='1:1']) { --ratio: 1 / 1; }\n .body { padding: ${space(6)}; flex: 1; display: flex; flex-direction: column; }\n :host([padding='none']) .body { padding: 0; }\n :host([padding='sm']) .body { padding: ${space(3)}; }\n :host([padding='md']) .body { padding: ${space(4)}; }\n :host([tone='plain']) .body { padding-inline: 0; }\n img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }\n .picture { position: relative; }\n .tag { position: absolute; inset-block-start: ${space(4)}; inset-inline-start: ${space(4)}; padding: ${space(1.5)} ${space(3)}; font-size: ${fontSize('sm')}; color: ${t.text}; background: ${t.surfaceCard}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); }\n @media (forced-colors: active) { :host { border-color: CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n return html`${this.imageSrc ? html`<div class=\"picture\"><img src=${this.imageSrc} alt=${this.imageAlt} part=\"image\" />${this.badge ? html`<span class=\"tag\">${this.badge}</span>` : nothing}</div>` : nothing}<div class=\"body\" part=\"body\"><slot></slot></div>`;\n }\n}\n\n/**\n * A heading.\n *\n * `level` is required and renders the matching `<h1>`–`<h6>`, because heading\n * level is document structure rather than appearance: a screen-reader user\n * navigates by it, and a page whose levels skip is a page they cannot skim.\n * Size is a separate property, so a visually small `<h2>` needs no lie about\n * its level — which is the usual reason levels end up wrong.\n\n *\n * @category typography\n * @icon heading\n * @role heading\n * @slot - The heading text.\n */\nexport class ImpaktHeading extends ImpaktElement {\n static properties = {\n level: { type: Number, reflect: true },\n size: { type: String, reflect: true },\n eyebrow: { type: String, reflect: true },\n align: { type: String, reflect: true },\n screenReaderOnly: { type: Boolean, reflect: true, attribute: 'screen-reader-only' },\n };\n\n declare level: 1 | 2 | 3 | 4 | 5 | 6;\n declare size: '5xl' | '4xl' | '3xl' | '2xl' | 'xl' | 'lg' | 'md' | 'sm';\n /** A short label above the heading, such as \"Why Larkfield\". Part of the heading, read before it. */\n declare eyebrow: string;\n declare align: 'start' | 'center';\n /**\n * Read by screen readers and search engines, but not drawn: for a heading\n * whose words are already in a picture, such as a hero drawn as artwork.\n * The page still has its heading; nobody sees it twice. An eyebrow still shows.\n */\n declare screenReaderOnly: boolean;\n\n constructor() {\n super();\n this.level = 2;\n this.size = 'xl';\n this.eyebrow = '';\n this.align = 'start';\n this.screenReaderOnly = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n color: ${t.textHeading};\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n line-height: ${lineHeight('tight')};\n }\n :host([size='5xl']) { ${type('5xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='4xl']) { ${type('4xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='3xl']) { ${type('3xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='2xl']) { ${type('2xl')} letter-spacing: ${t.trackingTight}; }\n :host([size='xl']) { ${type('xl')} }\n :host([size='lg']) { ${type('lg')} }\n :host([size='md']) { ${type('md')} }\n :host([size='sm']) { ${type('sm')} }\n .h { text-wrap: balance; }\n .h {\n margin: 0;\n font: inherit;\n color: inherit;\n }\n :host([align='center']) { text-align: center; }\n /* Only the words go: an eyebrow over a heading drawn as a picture still shows. */\n :host([screen-reader-only]) .words { ${hiddenStyle} }\n :host([screen-reader-only]:not([eyebrow])) { ${hiddenStyle} }\n .eyebrow {\n display: block;\n margin-block-end: ${space(2)};\n color: var(--impakt-eyebrow, var(--impakt-color-text-eyebrow, ${t.brand}));\n font-family: var(--impakt-font-family-eyebrow, ${t.fontBody});\n font-size: var(--impakt-font-size-eyebrow, ${fontSize('sm')});\n font-weight: var(--impakt-font-weight-eyebrow, ${fontWeight('semibold')});\n letter-spacing: 0.06em;\n text-transform: uppercase;\n }\n `,\n ];\n\n render(): TemplateResult {\n // A `role=\"heading\"` with `aria-level` rather than six branches of\n // template. The native element would be marginally better; this is the one\n // place where Lit's lack of a dynamic tag makes the explicit role the\n // honest trade, and the role is fully supported.\n return html`<div class=\"h\" role=\"heading\" aria-level=${this.level} part=\"heading\">\n ${this.eyebrow ? html`<span class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}<span style=\"position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%)\">: </span></span>` : nothing}<span class=\"words\"><slot></slot></span>\n </div>`;\n }\n}\n\n/** A paragraph.\n *\n * @category typography\n * @icon text\n * @slot - The paragraph text.\n */\nexport class ImpaktText extends ImpaktElement {\n static properties = {\n size: { type: String, reflect: true },\n tone: { type: String, reflect: true },\n align: { type: String, reflect: true },\n look: { type: String, reflect: true },\n };\n\n declare size: 'sm' | 'md' | 'lg' | 'xl';\n declare tone: 'default' | 'muted';\n declare align: 'start' | 'center';\n /** `code` sets the words in the brand's monospace face on a faint panel, for a line like \"base: main ← compare: you/idea\". */\n declare look: 'prose' | 'code';\n\n constructor() {\n super();\n this.size = 'md';\n this.tone = 'default';\n this.align = 'start';\n this.look = 'prose';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n /* 1.4.8 asks for 1.5 within a paragraph, and it is the default here\n rather than an option, because body text is what it is about. */\n line-height: ${lineHeight('normal')};\n /* 1.4.12 Text Spacing: a user stylesheet must be able to widen this\n without clipping, which a max-width in ch units survives and a\n fixed pixel height does not. */\n max-inline-size: 70ch;\n }\n :host([size='sm']) { ${type('sm')} }\n :host([size='md']) { ${type('md')} }\n :host([size='lg']) { ${type('lg')} }\n :host([size='xl']) { ${type('xl')} }\n p { text-wrap: pretty; }\n :host([tone='muted']) { color: ${t.textMuted}; }\n :host([align='center']) { text-align: center; margin-inline: auto; }\n :host([look='code']) { font-family: ${t.fontMono}; ${type('sm')} padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 6%, transparent); max-inline-size: none; }\n p {\n margin: 0;\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`<p part=\"text\"><slot></slot></p>`;\n }\n}\n\ncustomElements.define('impakt-stack', ImpaktStack);\ncustomElements.define('impakt-card', ImpaktCard);\ncustomElements.define('impakt-heading', ImpaktHeading);\ncustomElements.define('impakt-text', ImpaktText);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-stack': ImpaktStack;\n 'impakt-card': ImpaktCard;\n 'impakt-heading': ImpaktHeading;\n 'impakt-text': ImpaktText;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAmBjD,IAAM,cAAN,cAA0B,cAAc;AAAA,EAC7C;AAAA,SAAO,aAAa;AAAA,MAClB,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACnC,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,WAAW,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACzC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,YAAY,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,cAAc;AAAA,MACpE,YAAY,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,cAAc;AAAA,IACtE;AAAA;AAAA,EAaA,cAAc;AACZ,UAAM;AACN,SAAK,MAAM;AACX,SAAK,QAAQ;AACb,SAAK,YAAY;AACjB,SA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
|
fontSize,
|
|
7
9
|
fontWeight,
|
|
8
10
|
space,
|
|
9
11
|
t
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JTCTQBAX.js";
|
|
11
13
|
|
|
12
14
|
// packages/ui/src/components/price.ts
|
|
13
15
|
import { html, css, nothing } from "lit";
|
|
@@ -86,4 +88,4 @@ customElements.define("impakt-price", ImpaktPrice);
|
|
|
86
88
|
export {
|
|
87
89
|
ImpaktPrice
|
|
88
90
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-EKPTMRBG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/price.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { pageLocale } from '../base/locale';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A money amount.\n *\n * This component exists because of a decision taken in the content model: a\n * binding names a source and cannot compute\n * ([ADR 0003](https://github.com/matthill8286/strata/blob/main/docs/decisions/0003-binding-expressions.md)). The\n * consequence is that formatting lives here, where the locale and the currency\n * are known, rather than in authored content — so there is one place that\n * decides what \"£24.99\" looks like, and nobody writes a format string into a\n * CMS field.\n *\n * **The amount is one text node.** Splitting the pounds and the pence into\n * separate elements for typographic effect makes some screen readers read them\n * as two numbers, and \"twenty-four ninety-nine\" becomes \"twenty four, ninety\n * nine\". The visual emphasis is done with CSS over one node instead.\n *\n * **Minor units in, major units out.** `amount` is in pence, because a price\n * that arrives from a pricing API as a float has already lost money to binary\n * rounding before it reaches the screen.\n\n *\n * @category content\n * @icon price\n */\nexport class ImpaktPrice extends ImpaktElement {\n static properties = {\n amount: { type: Number },\n currency: { type: String },\n locale: { type: String },\n prefix: { type: String },\n period: { type: String },\n size: { type: String, reflect: true },\n pending: { type: String },\n };\n\n /** In minor units — pence, cents. */\n declare amount: number | undefined;\n declare currency: string;\n declare locale: string;\n /** \"From\", \"Guide\". Read before the amount. */\n declare prefix: string;\n /** \"a month\", \"a year\". Read after the amount. */\n declare period: string;\n declare size: 'md' | 'lg' | 'xl';\n /** Shown while there is no amount yet. A price takes seconds to arrive. */\n declare pending: string;\n\n constructor() {\n super();\n this.amount = undefined;\n this.currency = 'GBP';\n this.locale = '';\n this.prefix = '';\n this.period = '';\n this.size = 'xl';\n this.pending = '—';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: inline-flex;\n align-items: baseline;\n gap: ${space(1)};\n color: ${t.text};\n }\n .amount {\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n /* Tabular figures so a price does not reflow as the digits change,\n which otherwise makes a recalculating price jitter. */\n font-variant-numeric: tabular-nums;\n }\n :host([size='md']) .amount { font-size: ${fontSize('lg')}; }\n :host([size='lg']) .amount { font-size: ${fontSize('2xl')}; }\n :host([size='xl']) .amount { font-size: ${fontSize('3xl')}; }\n .period {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n `,\n ];\n\n private get formatted(): string {\n if (this.amount === undefined || Number.isNaN(this.amount)) return this.pending;\n try {\n return new Intl.NumberFormat(this.locale || pageLocale(this), {\n style: 'currency',\n currency: this.currency,\n // A house price reads as £385,000. Pence only mean something on small amounts.\n ...(this.amount >= 100000 && this.amount % 100 === 0 ? { minimumFractionDigits: 0, maximumFractionDigits: 0 } : {}),\n }).format(this.amount / 100);\n } catch {\n // An unknown currency or locale must not take the page down. The number\n // is still the most useful thing on the screen.\n return (this.amount / 100).toFixed(2);\n }\n }\n\n render(): TemplateResult {\n return html`\n ${this.prefix ? html`<span class=\"period\" part=\"prefix\">${this.prefix}</span>` : nothing}\n <span class=\"amount\" part=\"amount\">${this.formatted}</span>\n ${this.period ? html`<span class=\"period\" part=\"period\">${this.period}</span>` : nothing}\n `;\n }\n}\n\ncustomElements.define('impakt-price', ImpaktPrice);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-price': ImpaktPrice;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/price.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { pageLocale } from '../base/locale';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A money amount.\n *\n * This component exists because of a decision taken in the content model: a\n * binding names a source and cannot compute\n * ([ADR 0003](https://github.com/matthill8286/strata/blob/main/docs/decisions/0003-binding-expressions.md)). The\n * consequence is that formatting lives here, where the locale and the currency\n * are known, rather than in authored content — so there is one place that\n * decides what \"£24.99\" looks like, and nobody writes a format string into a\n * CMS field.\n *\n * **The amount is one text node.** Splitting the pounds and the pence into\n * separate elements for typographic effect makes some screen readers read them\n * as two numbers, and \"twenty-four ninety-nine\" becomes \"twenty four, ninety\n * nine\". The visual emphasis is done with CSS over one node instead.\n *\n * **Minor units in, major units out.** `amount` is in pence, because a price\n * that arrives from a pricing API as a float has already lost money to binary\n * rounding before it reaches the screen.\n\n *\n * @category content\n * @icon price\n */\nexport class ImpaktPrice extends ImpaktElement {\n static properties = {\n amount: { type: Number },\n currency: { type: String },\n locale: { type: String },\n prefix: { type: String },\n period: { type: String },\n size: { type: String, reflect: true },\n pending: { type: String },\n };\n\n /** In minor units — pence, cents. */\n declare amount: number | undefined;\n declare currency: string;\n declare locale: string;\n /** \"From\", \"Guide\". Read before the amount. */\n declare prefix: string;\n /** \"a month\", \"a year\". Read after the amount. */\n declare period: string;\n declare size: 'md' | 'lg' | 'xl';\n /** Shown while there is no amount yet. A price takes seconds to arrive. */\n declare pending: string;\n\n constructor() {\n super();\n this.amount = undefined;\n this.currency = 'GBP';\n this.locale = '';\n this.prefix = '';\n this.period = '';\n this.size = 'xl';\n this.pending = '—';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: inline-flex;\n align-items: baseline;\n gap: ${space(1)};\n color: ${t.text};\n }\n .amount {\n font-family: ${t.fontHeading};\n font-weight: ${fontWeight('bold')};\n /* Tabular figures so a price does not reflow as the digits change,\n which otherwise makes a recalculating price jitter. */\n font-variant-numeric: tabular-nums;\n }\n :host([size='md']) .amount { font-size: ${fontSize('lg')}; }\n :host([size='lg']) .amount { font-size: ${fontSize('2xl')}; }\n :host([size='xl']) .amount { font-size: ${fontSize('3xl')}; }\n .period {\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n `,\n ];\n\n private get formatted(): string {\n if (this.amount === undefined || Number.isNaN(this.amount)) return this.pending;\n try {\n return new Intl.NumberFormat(this.locale || pageLocale(this), {\n style: 'currency',\n currency: this.currency,\n // A house price reads as £385,000. Pence only mean something on small amounts.\n ...(this.amount >= 100000 && this.amount % 100 === 0 ? { minimumFractionDigits: 0, maximumFractionDigits: 0 } : {}),\n }).format(this.amount / 100);\n } catch {\n // An unknown currency or locale must not take the page down. The number\n // is still the most useful thing on the screen.\n return (this.amount / 100).toFixed(2);\n }\n }\n\n render(): TemplateResult {\n return html`\n ${this.prefix ? html`<span class=\"period\" part=\"prefix\">${this.prefix}</span>` : nothing}\n <span class=\"amount\" part=\"amount\">${this.formatted}</span>\n ${this.period ? html`<span class=\"period\" part=\"period\">${this.period}</span>` : nothing}\n `;\n }\n}\n\ncustomElements.define('impakt-price', ImpaktPrice);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-price': ImpaktPrice;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA6BjD,IAAM,cAAN,cAA0B,cAAc;AAAA,EAC7C;AAAA,SAAO,aAAa;AAAA,MAClB,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,UAAU,EAAE,MAAM,OAAO;AAAA,MACzB,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,QAAQ,EAAE,MAAM,OAAO;AAAA,MACvB,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,S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